kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Reuse common gpio code on gl846
rodzic
31fecb8140
commit
ea5047466c
|
@ -1128,29 +1128,10 @@ SensorExposure CommandSetGl846::led_calibration(Genesys_Device* dev, const Genes
|
||||||
static void gl846_init_gpio(Genesys_Device* dev)
|
static void gl846_init_gpio(Genesys_Device* dev)
|
||||||
{
|
{
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
int idx=0;
|
apply_registers_ordered(dev->gpo.regs, { 0x6e, 0x6f }, [&](const GenesysRegisterSetting& reg)
|
||||||
|
|
||||||
/* search GPIO profile */
|
|
||||||
while (gpios[idx].gpio_id != GpioId::UNKNOWN && dev->model->gpio_id != gpios[idx].gpio_id) {
|
|
||||||
idx++;
|
|
||||||
}
|
|
||||||
if (gpios[idx].gpio_id == GpioId::UNKNOWN)
|
|
||||||
{
|
{
|
||||||
throw SaneException("failed to find GPIO profile for sensor_id=%d",
|
dev->interface->write_register(reg.address, reg.value);
|
||||||
static_cast<unsigned>(dev->model->sensor_id));
|
});
|
||||||
}
|
|
||||||
|
|
||||||
dev->interface->write_register(REG_0xA7, gpios[idx].ra7);
|
|
||||||
dev->interface->write_register(REG_0xA6, gpios[idx].ra6);
|
|
||||||
|
|
||||||
dev->interface->write_register(REG_0x6B, gpios[idx].r6b);
|
|
||||||
dev->interface->write_register(REG_0x6C, gpios[idx].r6c);
|
|
||||||
dev->interface->write_register(REG_0x6D, gpios[idx].r6d);
|
|
||||||
dev->interface->write_register(REG_0x6E, gpios[idx].r6e);
|
|
||||||
dev->interface->write_register(REG_0x6F, gpios[idx].r6f);
|
|
||||||
|
|
||||||
dev->interface->write_register(REG_0xA8, gpios[idx].ra8);
|
|
||||||
dev->interface->write_register(REG_0xA9, gpios[idx].ra9);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1218,7 +1199,6 @@ void CommandSetGl846::asic_boot(Genesys_Device* dev, bool cold) const
|
||||||
DBG(DBG_info, "%s: reported version for genesys chip is 0x%02x\n", __func__, val);
|
DBG(DBG_info, "%s: reported version for genesys chip is 0x%02x\n", __func__, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set default values for registers */
|
|
||||||
gl846_init_registers (dev);
|
gl846_init_registers (dev);
|
||||||
|
|
||||||
// Write initial registers
|
// Write initial registers
|
||||||
|
|
|
@ -50,26 +50,6 @@
|
||||||
namespace genesys {
|
namespace genesys {
|
||||||
namespace gl846 {
|
namespace gl846 {
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
GpioId gpio_id;
|
|
||||||
uint8_t r6b;
|
|
||||||
uint8_t r6c;
|
|
||||||
uint8_t r6d;
|
|
||||||
uint8_t r6e;
|
|
||||||
uint8_t r6f;
|
|
||||||
uint8_t ra6;
|
|
||||||
uint8_t ra7;
|
|
||||||
uint8_t ra8;
|
|
||||||
uint8_t ra9;
|
|
||||||
} Gpio_Profile;
|
|
||||||
|
|
||||||
static Gpio_Profile gpios[]={
|
|
||||||
{ GpioId::IMG101, 0x72, 0x1f, 0xa4, 0x13, 0xa7, 0x11, 0xff, 0x19, 0x05},
|
|
||||||
{ GpioId::PLUSTEK_OPTICBOOK_3800, 0x30, 0x01, 0x80, 0x2d, 0x80, 0x0c, 0x8f, 0x08, 0x04},
|
|
||||||
{ GpioId::UNKNOWN, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
const char *model;
|
const char *model;
|
||||||
|
|
|
@ -382,10 +382,8 @@ void genesys_init_gpo_tables()
|
||||||
gpo = Genesys_Gpo();
|
gpo = Genesys_Gpo();
|
||||||
gpo.id = GpioId::IMG101;
|
gpo.id = GpioId::IMG101;
|
||||||
gpo.regs = {
|
gpo.regs = {
|
||||||
{ 0x6c, 0x41 },
|
{ 0x6b, 0x72 }, { 0x6c, 0x1f }, { 0x6d, 0xa4 }, { 0x6e, 0x13 }, { 0x6f, 0xa7 },
|
||||||
{ 0x6d, 0xa4 },
|
{ 0xa6, 0x11 }, { 0xa7, 0xff }, { 0xa8, 0x19 }, { 0xa9, 0x05 },
|
||||||
{ 0x6e, 0x13 },
|
|
||||||
{ 0x6f, 0xa7 },
|
|
||||||
};
|
};
|
||||||
s_gpo->push_back(gpo);
|
s_gpo->push_back(gpo);
|
||||||
|
|
||||||
|
@ -393,10 +391,8 @@ void genesys_init_gpo_tables()
|
||||||
gpo = Genesys_Gpo();
|
gpo = Genesys_Gpo();
|
||||||
gpo.id = GpioId::PLUSTEK_OPTICBOOK_3800;
|
gpo.id = GpioId::PLUSTEK_OPTICBOOK_3800;
|
||||||
gpo.regs = {
|
gpo.regs = {
|
||||||
{ 0x6c, 0x41 },
|
{ 0x6b, 0x30 }, { 0x6c, 0x01 }, { 0x6d, 0x80 }, { 0x6e, 0x2d }, { 0x6f, 0x80 },
|
||||||
{ 0x6d, 0xa4 },
|
{ 0xa6, 0x0c }, { 0xa7, 0x8f }, { 0xa8, 0x08 }, { 0xa9, 0x04 },
|
||||||
{ 0x6e, 0x13 },
|
|
||||||
{ 0x6f, 0xa7 },
|
|
||||||
};
|
};
|
||||||
s_gpo->push_back(gpo);
|
s_gpo->push_back(gpo);
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue