Lines Matching refs:psmouse

71 static int fsp_reg_read(struct psmouse *psmouse, int reg_addr, int *reg_val)  in fsp_reg_read()  argument
73 struct ps2dev *ps2dev = &psmouse->ps2dev; in fsp_reg_read()
84 psmouse_deactivate(psmouse); in fsp_reg_read()
121 psmouse_activate(psmouse); in fsp_reg_read()
122 psmouse_dbg(psmouse, in fsp_reg_read()
128 static int fsp_reg_write(struct psmouse *psmouse, int reg_addr, int reg_val) in fsp_reg_write() argument
130 struct ps2dev *ps2dev = &psmouse->ps2dev; in fsp_reg_write()
174 psmouse_dbg(psmouse, in fsp_reg_write()
181 static int fsp_reg_write_enable(struct psmouse *psmouse, bool enable) in fsp_reg_write_enable() argument
185 if (fsp_reg_read(psmouse, FSP_REG_SYSCTL1, &v) == -1) in fsp_reg_write_enable()
195 if (fsp_reg_write(psmouse, FSP_REG_SYSCTL1, nv) == -1) in fsp_reg_write_enable()
201 static int fsp_page_reg_read(struct psmouse *psmouse, int *reg_val) in fsp_page_reg_read() argument
203 struct ps2dev *ps2dev = &psmouse->ps2dev; in fsp_page_reg_read()
207 psmouse_deactivate(psmouse); in fsp_page_reg_read()
232 psmouse_activate(psmouse); in fsp_page_reg_read()
233 psmouse_dbg(psmouse, in fsp_page_reg_read()
239 static int fsp_page_reg_write(struct psmouse *psmouse, int reg_val) in fsp_page_reg_write() argument
241 struct ps2dev *ps2dev = &psmouse->ps2dev; in fsp_page_reg_write()
271 psmouse_dbg(psmouse, in fsp_page_reg_write()
277 static int fsp_get_version(struct psmouse *psmouse, int *version) in fsp_get_version() argument
279 if (fsp_reg_read(psmouse, FSP_REG_VERSION, version)) in fsp_get_version()
285 static int fsp_get_revision(struct psmouse *psmouse, int *rev) in fsp_get_revision() argument
287 if (fsp_reg_read(psmouse, FSP_REG_REVISION, rev)) in fsp_get_revision()
293 static int fsp_get_sn(struct psmouse *psmouse, int *sn) in fsp_get_sn() argument
299 if (fsp_page_reg_write(psmouse, FSP_PAGE_0B)) in fsp_get_sn()
301 if (fsp_reg_read(psmouse, FSP_REG_SN0, &v0)) in fsp_get_sn()
303 if (fsp_reg_read(psmouse, FSP_REG_SN1, &v1)) in fsp_get_sn()
305 if (fsp_reg_read(psmouse, FSP_REG_SN2, &v2)) in fsp_get_sn()
310 fsp_page_reg_write(psmouse, FSP_PAGE_DEFAULT); in fsp_get_sn()
314 static int fsp_get_buttons(struct psmouse *psmouse, int *btn) in fsp_get_buttons() argument
324 if (fsp_reg_read(psmouse, FSP_REG_TMOD_STATUS, &val) == -1) in fsp_get_buttons()
332 static int fsp_opc_tag_enable(struct psmouse *psmouse, bool enable) in fsp_opc_tag_enable() argument
337 if (fsp_reg_read(psmouse, FSP_REG_OPC_QDOWN, &v) == -1) { in fsp_opc_tag_enable()
338 psmouse_err(psmouse, "Unable get OPC state.\n"); in fsp_opc_tag_enable()
349 fsp_reg_write_enable(psmouse, true); in fsp_opc_tag_enable()
350 res = fsp_reg_write(psmouse, FSP_REG_OPC_QDOWN, nv); in fsp_opc_tag_enable()
351 fsp_reg_write_enable(psmouse, false); in fsp_opc_tag_enable()
355 psmouse_err(psmouse, "Unable to enable OPC tag.\n"); in fsp_opc_tag_enable()
362 static int fsp_onpad_vscr(struct psmouse *psmouse, bool enable) in fsp_onpad_vscr() argument
364 struct fsp_data *pad = psmouse->private; in fsp_onpad_vscr()
367 if (fsp_reg_read(psmouse, FSP_REG_ONPAD_CTL, &val)) in fsp_onpad_vscr()
377 if (fsp_reg_write(psmouse, FSP_REG_ONPAD_CTL, val)) in fsp_onpad_vscr()
383 static int fsp_onpad_hscr(struct psmouse *psmouse, bool enable) in fsp_onpad_hscr() argument
385 struct fsp_data *pad = psmouse->private; in fsp_onpad_hscr()
388 if (fsp_reg_read(psmouse, FSP_REG_ONPAD_CTL, &val)) in fsp_onpad_hscr()
391 if (fsp_reg_read(psmouse, FSP_REG_SYSCTL5, &v2)) in fsp_onpad_hscr()
404 if (fsp_reg_write(psmouse, FSP_REG_ONPAD_CTL, val)) in fsp_onpad_hscr()
408 if (fsp_reg_write(psmouse, FSP_REG_SYSCTL5, v2)) in fsp_onpad_hscr()
419 static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data, in fsp_attr_set_setreg() argument
437 if (fsp_reg_write_enable(psmouse, true)) in fsp_attr_set_setreg()
440 retval = fsp_reg_write(psmouse, reg, val) < 0 ? -EIO : count; in fsp_attr_set_setreg()
442 fsp_reg_write_enable(psmouse, false); in fsp_attr_set_setreg()
449 static ssize_t fsp_attr_show_getreg(struct psmouse *psmouse, in fsp_attr_show_getreg() argument
452 struct fsp_data *pad = psmouse->private; in fsp_attr_show_getreg()
462 static ssize_t fsp_attr_set_getreg(struct psmouse *psmouse, void *data, in fsp_attr_set_getreg() argument
465 struct fsp_data *pad = psmouse->private; in fsp_attr_set_getreg()
476 if (fsp_reg_read(psmouse, reg, &val)) in fsp_attr_set_getreg()
488 static ssize_t fsp_attr_show_pagereg(struct psmouse *psmouse, in fsp_attr_show_pagereg() argument
493 if (fsp_page_reg_read(psmouse, &val)) in fsp_attr_show_pagereg()
499 static ssize_t fsp_attr_set_pagereg(struct psmouse *psmouse, void *data, in fsp_attr_set_pagereg() argument
512 if (fsp_page_reg_write(psmouse, val)) in fsp_attr_set_pagereg()
521 static ssize_t fsp_attr_show_vscroll(struct psmouse *psmouse, in fsp_attr_show_vscroll() argument
524 struct fsp_data *pad = psmouse->private; in fsp_attr_show_vscroll()
529 static ssize_t fsp_attr_set_vscroll(struct psmouse *psmouse, void *data, in fsp_attr_set_vscroll() argument
542 fsp_onpad_vscr(psmouse, val); in fsp_attr_set_vscroll()
550 static ssize_t fsp_attr_show_hscroll(struct psmouse *psmouse, in fsp_attr_show_hscroll() argument
553 struct fsp_data *pad = psmouse->private; in fsp_attr_show_hscroll()
558 static ssize_t fsp_attr_set_hscroll(struct psmouse *psmouse, void *data, in fsp_attr_set_hscroll() argument
571 fsp_onpad_hscr(psmouse, val); in fsp_attr_set_hscroll()
579 static ssize_t fsp_attr_show_flags(struct psmouse *psmouse, in fsp_attr_show_flags() argument
582 struct fsp_data *pad = psmouse->private; in fsp_attr_show_flags()
588 static ssize_t fsp_attr_set_flags(struct psmouse *psmouse, void *data, in fsp_attr_set_flags() argument
591 struct fsp_data *pad = psmouse->private; in fsp_attr_set_flags()
612 static ssize_t fsp_attr_show_ver(struct psmouse *psmouse, in fsp_attr_show_ver() argument
636 static void fsp_packet_debug(struct psmouse *psmouse, unsigned char packet[]) in fsp_packet_debug() argument
664 psmouse_dbg(psmouse, in fsp_packet_debug()
671 psmouse_dbg(psmouse, "PS/2 packets/sec = %d\n", ps2_packet_cnt); in fsp_packet_debug()
677 static void fsp_packet_debug(struct psmouse *psmouse, unsigned char packet[]) in fsp_packet_debug() argument
693 static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse) in fsp_process_byte() argument
695 struct input_dev *dev = psmouse->dev; in fsp_process_byte()
696 struct fsp_data *ad = psmouse->private; in fsp_process_byte()
697 unsigned char *packet = psmouse->packet; in fsp_process_byte()
701 if (psmouse->pktcnt < 4) in fsp_process_byte()
708 fsp_packet_debug(psmouse, packet); in fsp_process_byte()
710 switch (psmouse->packet[0] >> FSP_PKT_TYPE_SHIFT) { in fsp_process_byte()
838 static int fsp_activate_protocol(struct psmouse *psmouse) in fsp_activate_protocol() argument
840 struct fsp_data *pad = psmouse->private; in fsp_activate_protocol()
841 struct ps2dev *ps2dev = &psmouse->ps2dev; in fsp_activate_protocol()
858 psmouse_err(psmouse, in fsp_activate_protocol()
865 if (fsp_reg_read(psmouse, FSP_REG_SYSCTL5, &val)) { in fsp_activate_protocol()
866 psmouse_err(psmouse, in fsp_activate_protocol()
871 if (fsp_get_buttons(psmouse, &pad->buttons)) { in fsp_activate_protocol()
872 psmouse_err(psmouse, in fsp_activate_protocol()
885 if (fsp_reg_write(psmouse, FSP_REG_SYSCTL5, val)) { in fsp_activate_protocol()
886 psmouse_err(psmouse, in fsp_activate_protocol()
895 if (fsp_opc_tag_enable(psmouse, true)) in fsp_activate_protocol()
896 psmouse_warn(psmouse, in fsp_activate_protocol()
902 fsp_onpad_vscr(psmouse, true); in fsp_activate_protocol()
903 fsp_onpad_hscr(psmouse, true); in fsp_activate_protocol()
906 if (fsp_reg_write(psmouse, FSP_REG_SWC1, in fsp_activate_protocol()
911 psmouse_err(psmouse, in fsp_activate_protocol()
920 static int fsp_set_input_params(struct psmouse *psmouse) in fsp_set_input_params() argument
922 struct input_dev *dev = psmouse->dev; in fsp_set_input_params()
923 struct fsp_data *pad = psmouse->private; in fsp_set_input_params()
962 int fsp_detect(struct psmouse *psmouse, bool set_properties) in fsp_detect() argument
966 if (fsp_reg_read(psmouse, FSP_REG_DEVICE_ID, &id)) in fsp_detect()
973 psmouse->vendor = "Sentelic"; in fsp_detect()
974 psmouse->name = "FingerSensingPad"; in fsp_detect()
980 static void fsp_reset(struct psmouse *psmouse) in fsp_reset() argument
982 fsp_opc_tag_enable(psmouse, false); in fsp_reset()
983 fsp_onpad_vscr(psmouse, false); in fsp_reset()
984 fsp_onpad_hscr(psmouse, false); in fsp_reset()
987 static void fsp_disconnect(struct psmouse *psmouse) in fsp_disconnect() argument
989 sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, in fsp_disconnect()
992 fsp_reset(psmouse); in fsp_disconnect()
993 kfree(psmouse->private); in fsp_disconnect()
996 static int fsp_reconnect(struct psmouse *psmouse) in fsp_reconnect() argument
1000 if (fsp_detect(psmouse, 0)) in fsp_reconnect()
1003 if (fsp_get_version(psmouse, &version)) in fsp_reconnect()
1006 if (fsp_activate_protocol(psmouse)) in fsp_reconnect()
1012 int fsp_init(struct psmouse *psmouse) in fsp_init() argument
1018 if (fsp_get_version(psmouse, &ver) || in fsp_init()
1019 fsp_get_revision(psmouse, &rev)) { in fsp_init()
1024 fsp_get_sn(psmouse, &sn); in fsp_init()
1027 psmouse_info(psmouse, in fsp_init()
1031 psmouse->private = priv = kzalloc(sizeof(struct fsp_data), GFP_KERNEL); in fsp_init()
1038 psmouse->protocol_handler = fsp_process_byte; in fsp_init()
1039 psmouse->disconnect = fsp_disconnect; in fsp_init()
1040 psmouse->reconnect = fsp_reconnect; in fsp_init()
1041 psmouse->cleanup = fsp_reset; in fsp_init()
1042 psmouse->pktsize = 4; in fsp_init()
1044 error = fsp_activate_protocol(psmouse); in fsp_init()
1049 error = fsp_set_input_params(psmouse); in fsp_init()
1053 error = sysfs_create_group(&psmouse->ps2dev.serio->dev.kobj, in fsp_init()
1056 psmouse_err(psmouse, in fsp_init()
1064 kfree(psmouse->private); in fsp_init()
1065 psmouse->private = NULL; in fsp_init()