input: cyapa: add gen5 trackpad device basic functions support
Subsystems (2)
PATCH v5 10/14 input: cyapa: add gen5 trackpad device basic functions support
Based on the cyapa core, add the gen5 trackpad device's basic functions supported, so gen5 trackpad device can work with kernel input system. And also based on the state parse interface, the cyapa driver can automatically determine the attached is gen3 or gen5 protocol trackpad device, then set the correct protocol to work with the attached trackpad device.
TEST=test on Chromebooks.
Signed-off-by Dudley Du <[email protected]>
--- drivers/input/mouse/Makefile | 2 +- drivers/input/mouse/cyapa.c | 29 +- drivers/input/mouse/cyapa.h | 1 + drivers/input/mouse/cyapa_gen5.c | 1660 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 1687 insertions(+), 5 deletions(-) create mode 100644 drivers/input/mouse/cyapa_gen5.c
drivers/input/mouse/Makefile +1 -1
@@ -35,4 +35,4 @@ psmouse-$(CONFIG_MOUSE_PS2_TRACKPOINT) += trackpoint.o psmouse-$(CONFIG_MOUSE_PS2_TOUCHKIT) += touchkit_ps2.o psmouse-$(CONFIG_MOUSE_PS2_CYPRESS) += cypress_ps2.o -cyapatp-y := cyapa.o cyapa_gen3.o +cyapatp-y := cyapa.o cyapa_gen3.o cyapa_gen5.o
drivers/input/mouse/cyapa.c +25 -4
@@ -122,6 +122,8 @@ void cyapa_default_irq_handler(struct cyapa *cyapa) cont = true;if (cyapa_gen3_ops.irq_cmd_handler) cont = cyapa_gen3_ops.irq_cmd_handler (cyapa); +if (cont && cyapa_gen5_ops.irq_cmd_handler) + cont = cyapa_gen5_ops.irq_cmd_handler (cyapa);if (!cont)return ;
@@ -264,6 +266,9 @@ static int cyapa_check_is_operational(struct cyapa *cyapa)return ret;switch (cyapa->gen) { +case CYAPA_GEN5 : + cyapa->ops = &cyapa_gen5_ops; +break ;case CYAPA_GEN3 : cyapa->ops = &cyapa_gen3_ops;break ;
@@ -377,6 +382,14 @@ static int cyapa_get_state(struct cyapa *cyapa)if (ret ==0 ) goto out_detected; } +if ((cyapa->gen ==CYAPA_GEN_UNKNOWN || + cyapa->gen ==CYAPA_GEN5 ) && + !smbus && even_addr) { + ret = cyapa_gen5_ops.state_parse (cyapa, + status,BL_STATUS_SIZE ); +if (ret ==0 ) + goto out_detected; + }/* * Cannot detect communication protocol based on current
@@ -1096,18 +1109,26 @@ static void cyapa_detect_and_start(void *data, async_cookie_t cookie)static int cyapa_tp_modules_init (struct cyapa *cyapa) { +int ret =0 ; +if (cyapa_gen3_ops.initialize) -return cyapa_gen3_ops.initialize (cyapa); + ret = cyapa_gen3_ops.initialize (cyapa); +if (!ret && cyapa_gen5_ops.initialize) + ret = cyapa_gen5_ops.initialize (cyapa); -return 0 ; +return ret; }static int cyapa_tp_modules_uninit (struct cyapa *cyapa) { +int ret =0 ; +if (cyapa_gen3_ops.uninitialize) -return cyapa_gen3_ops.uninitialize (cyapa); + ret = cyapa_gen3_ops.uninitialize (cyapa); +if (!ret && cyapa_gen5_ops.uninitialize) + ret = cyapa_gen5_ops.uninitialize (cyapa); -return 0 ; +return ret; } static int cyapa_probe(struct i2c_client *client,
drivers/input/mouse/cyapa.h +1 -0
@@ -299,5 +299,6 @@ u16 cyapa_pwr_cmd_to_sleep_time(u8 pwr_mode);extern const char unique_str[];extern const struct cyapa_dev_ops cyapa_gen3_ops; +extern const struct cyapa_dev_ops cyapa_gen5_ops;#endif
drivers/input/mouse/cyapa_gen5.c new file +1660 -0
1,660 lines not on this page · raw message
Signature · 1 line
1.9.1