Lines Matching refs:psmouse

250 static void alps_process_packet_v1_v2(struct psmouse *psmouse)  in alps_process_packet_v1_v2()  argument
252 struct alps_data *priv = psmouse->private; in alps_process_packet_v1_v2()
253 unsigned char *packet = psmouse->packet; in alps_process_packet_v1_v2()
254 struct input_dev *dev = psmouse->dev; in alps_process_packet_v1_v2()
512 static void alps_report_mt_data(struct psmouse *psmouse, int n) in alps_report_mt_data() argument
514 struct alps_data *priv = psmouse->private; in alps_report_mt_data()
515 struct input_dev *dev = psmouse->dev; in alps_report_mt_data()
526 static void alps_report_semi_mt_data(struct psmouse *psmouse, int fingers) in alps_report_semi_mt_data() argument
528 struct alps_data *priv = psmouse->private; in alps_report_semi_mt_data()
529 struct input_dev *dev = psmouse->dev; in alps_report_semi_mt_data()
557 static void alps_process_trackstick_packet_v3(struct psmouse *psmouse) in alps_process_trackstick_packet_v3() argument
559 struct alps_data *priv = psmouse->private; in alps_process_trackstick_packet_v3()
560 unsigned char *packet = psmouse->packet; in alps_process_trackstick_packet_v3()
566 psmouse_warn(psmouse, in alps_process_trackstick_packet_v3()
573 psmouse_dbg(psmouse, "Bad trackstick packet, discarding\n"); in alps_process_trackstick_packet_v3()
637 struct psmouse *psmouse) in alps_decode_pinnacle() argument
663 struct psmouse *psmouse) in alps_decode_rushmore() argument
691 struct psmouse *psmouse) in alps_decode_dolphin() argument
694 struct alps_data *priv = psmouse->private; in alps_decode_dolphin()
727 static void alps_process_touchpad_packet_v3_v5(struct psmouse *psmouse) in alps_process_touchpad_packet_v3_v5() argument
729 struct alps_data *priv = psmouse->private; in alps_process_touchpad_packet_v3_v5()
730 unsigned char *packet = psmouse->packet; in alps_process_touchpad_packet_v3_v5()
737 priv->decode_fields(f, packet, psmouse); in alps_process_touchpad_packet_v3_v5()
758 priv->decode_fields(f, priv->multi_data, psmouse); in alps_process_touchpad_packet_v3_v5()
794 alps_report_semi_mt_data(psmouse, fingers); in alps_process_touchpad_packet_v3_v5()
805 static void alps_process_packet_v3(struct psmouse *psmouse) in alps_process_packet_v3() argument
807 unsigned char *packet = psmouse->packet; in alps_process_packet_v3()
818 alps_process_trackstick_packet_v3(psmouse); in alps_process_packet_v3()
822 alps_process_touchpad_packet_v3_v5(psmouse); in alps_process_packet_v3()
825 static void alps_process_packet_v6(struct psmouse *psmouse) in alps_process_packet_v6() argument
827 struct alps_data *priv = psmouse->private; in alps_process_packet_v6()
828 unsigned char *packet = psmouse->packet; in alps_process_packet_v6()
829 struct input_dev *dev = psmouse->dev; in alps_process_packet_v6()
842 psmouse_warn(psmouse, in alps_process_packet_v6()
891 static void alps_process_packet_v4(struct psmouse *psmouse) in alps_process_packet_v4() argument
893 struct alps_data *priv = psmouse->private; in alps_process_packet_v4()
894 unsigned char *packet = psmouse->packet; in alps_process_packet_v4()
937 alps_report_semi_mt_data(psmouse, f->fingers); in alps_process_packet_v4()
940 static bool alps_is_valid_package_v7(struct psmouse *psmouse) in alps_is_valid_package_v7() argument
942 switch (psmouse->pktcnt) { in alps_is_valid_package_v7()
944 return (psmouse->packet[2] & 0x40) == 0x40; in alps_is_valid_package_v7()
946 return (psmouse->packet[3] & 0x48) == 0x48; in alps_is_valid_package_v7()
948 return (psmouse->packet[5] & 0x40) == 0x00; in alps_is_valid_package_v7()
1030 struct psmouse *psmouse) in alps_decode_packet_v7() argument
1032 struct alps_data *priv = psmouse->private; in alps_decode_packet_v7()
1090 static void alps_process_trackstick_packet_v7(struct psmouse *psmouse) in alps_process_trackstick_packet_v7() argument
1092 struct alps_data *priv = psmouse->private; in alps_process_trackstick_packet_v7()
1093 unsigned char *packet = psmouse->packet; in alps_process_trackstick_packet_v7()
1099 psmouse_warn(psmouse, in alps_process_trackstick_packet_v7()
1118 static void alps_process_touchpad_packet_v7(struct psmouse *psmouse) in alps_process_touchpad_packet_v7() argument
1120 struct alps_data *priv = psmouse->private; in alps_process_touchpad_packet_v7()
1121 struct input_dev *dev = psmouse->dev; in alps_process_touchpad_packet_v7()
1126 if (priv->decode_fields(f, psmouse->packet, psmouse)) in alps_process_touchpad_packet_v7()
1129 alps_report_mt_data(psmouse, alps_get_mt_count(f->mt)); in alps_process_touchpad_packet_v7()
1140 static void alps_process_packet_v7(struct psmouse *psmouse) in alps_process_packet_v7() argument
1142 unsigned char *packet = psmouse->packet; in alps_process_packet_v7()
1145 alps_process_trackstick_packet_v7(psmouse); in alps_process_packet_v7()
1147 alps_process_touchpad_packet_v7(psmouse); in alps_process_packet_v7()
1180 unsigned char *p, struct psmouse *psmouse) in alps_decode_ss4_v2() argument
1182 struct alps_data *priv = psmouse->private; in alps_decode_ss4_v2()
1316 static void alps_process_packet_ss4_v2(struct psmouse *psmouse) in alps_process_packet_ss4_v2() argument
1318 struct alps_data *priv = psmouse->private; in alps_process_packet_ss4_v2()
1319 unsigned char *packet = psmouse->packet; in alps_process_packet_ss4_v2()
1320 struct input_dev *dev = psmouse->dev; in alps_process_packet_ss4_v2()
1325 priv->decode_fields(f, packet, psmouse); in alps_process_packet_ss4_v2()
1335 priv->decode_fields(f, priv->multi_data, psmouse); in alps_process_packet_ss4_v2()
1360 psmouse_warn(psmouse, in alps_process_packet_ss4_v2()
1378 alps_report_mt_data(psmouse, (f->fingers <= 4) ? f->fingers : 4); in alps_process_packet_ss4_v2()
1390 static bool alps_is_valid_package_ss4_v2(struct psmouse *psmouse) in alps_is_valid_package_ss4_v2() argument
1392 if (psmouse->pktcnt == 4 && ((psmouse->packet[3] & 0x08) != 0x08)) in alps_is_valid_package_ss4_v2()
1394 if (psmouse->pktcnt == 6 && ((psmouse->packet[5] & 0x10) != 0x0)) in alps_is_valid_package_ss4_v2()
1405 struct psmouse *psmouse = priv->psmouse; in alps_register_bare_ps2_mouse() local
1416 psmouse_err(psmouse, "failed to allocate secondary device\n"); in alps_register_bare_ps2_mouse()
1422 psmouse->ps2dev.serio->phys, in alps_register_bare_ps2_mouse()
1436 dev3->dev.parent = &psmouse->ps2dev.serio->dev; in alps_register_bare_ps2_mouse()
1448 psmouse_err(psmouse, in alps_register_bare_ps2_mouse()
1468 static void alps_report_bare_ps2_packet(struct psmouse *psmouse, in alps_report_bare_ps2_packet() argument
1472 struct alps_data *priv = psmouse->private; in alps_report_bare_ps2_packet()
1480 dev2 = psmouse->dev; in alps_report_bare_ps2_packet()
1484 psmouse_queue_work(psmouse, &priv->dev3_register_work, in alps_report_bare_ps2_packet()
1500 static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse) in alps_handle_interleaved_ps2() argument
1502 struct alps_data *priv = psmouse->private; in alps_handle_interleaved_ps2()
1504 if (psmouse->pktcnt < 6) in alps_handle_interleaved_ps2()
1507 if (psmouse->pktcnt == 6) { in alps_handle_interleaved_ps2()
1520 if (psmouse->packet[6] & 0x80) { in alps_handle_interleaved_ps2()
1528 if (((psmouse->packet[3] | in alps_handle_interleaved_ps2()
1529 psmouse->packet[4] | in alps_handle_interleaved_ps2()
1530 psmouse->packet[5]) & 0x80) || in alps_handle_interleaved_ps2()
1531 (!alps_is_valid_first_byte(priv, psmouse->packet[6]))) { in alps_handle_interleaved_ps2()
1532 psmouse_dbg(psmouse, in alps_handle_interleaved_ps2()
1534 psmouse->packet + 3); in alps_handle_interleaved_ps2()
1538 priv->process_packet(psmouse); in alps_handle_interleaved_ps2()
1541 psmouse->packet[0] = psmouse->packet[6]; in alps_handle_interleaved_ps2()
1542 psmouse->pktcnt = 1; in alps_handle_interleaved_ps2()
1562 alps_report_bare_ps2_packet(psmouse, &psmouse->packet[3], in alps_handle_interleaved_ps2()
1572 psmouse->packet[3] = psmouse->packet[6] & 0xf7; in alps_handle_interleaved_ps2()
1573 psmouse->pktcnt = 4; in alps_handle_interleaved_ps2()
1582 struct psmouse *psmouse = priv->psmouse; in alps_flush_packet() local
1584 serio_pause_rx(psmouse->ps2dev.serio); in alps_flush_packet()
1586 if (psmouse->pktcnt == psmouse->pktsize) { in alps_flush_packet()
1593 if ((psmouse->packet[3] | in alps_flush_packet()
1594 psmouse->packet[4] | in alps_flush_packet()
1595 psmouse->packet[5]) & 0x80) { in alps_flush_packet()
1596 psmouse_dbg(psmouse, in alps_flush_packet()
1598 psmouse->packet + 3); in alps_flush_packet()
1600 priv->process_packet(psmouse); in alps_flush_packet()
1602 psmouse->pktcnt = 0; in alps_flush_packet()
1605 serio_continue_rx(psmouse->ps2dev.serio); in alps_flush_packet()
1608 static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) in alps_process_byte() argument
1610 struct alps_data *priv = psmouse->private; in alps_process_byte()
1620 !psmouse->out_of_sync_cnt && in alps_process_byte()
1621 (psmouse->packet[0] & 0xc8) == 0x08) { in alps_process_byte()
1623 if (psmouse->pktcnt == 3) { in alps_process_byte()
1624 alps_report_bare_ps2_packet(psmouse, psmouse->packet, in alps_process_byte()
1634 psmouse->pktcnt >= 4 && (psmouse->packet[3] & 0x0f) == 0x0f) { in alps_process_byte()
1635 return alps_handle_interleaved_ps2(psmouse); in alps_process_byte()
1638 if (!alps_is_valid_first_byte(priv, psmouse->packet[0])) { in alps_process_byte()
1639 psmouse_dbg(psmouse, in alps_process_byte()
1641 psmouse->packet[0], priv->mask0, priv->byte0); in alps_process_byte()
1647 psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && in alps_process_byte()
1648 (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { in alps_process_byte()
1649 psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", in alps_process_byte()
1650 psmouse->pktcnt - 1, in alps_process_byte()
1651 psmouse->packet[psmouse->pktcnt - 1]); in alps_process_byte()
1654 psmouse->pktcnt == psmouse->pktsize) { in alps_process_byte()
1671 !alps_is_valid_package_v7(psmouse)) || in alps_process_byte()
1673 !alps_is_valid_package_ss4_v2(psmouse))) { in alps_process_byte()
1674 psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", in alps_process_byte()
1675 psmouse->pktcnt - 1, in alps_process_byte()
1676 psmouse->packet[psmouse->pktcnt - 1]); in alps_process_byte()
1680 if (psmouse->pktcnt == psmouse->pktsize) { in alps_process_byte()
1681 priv->process_packet(psmouse); in alps_process_byte()
1688 static int alps_command_mode_send_nibble(struct psmouse *psmouse, int nibble) in alps_command_mode_send_nibble() argument
1690 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_command_mode_send_nibble()
1691 struct alps_data *priv = psmouse->private; in alps_command_mode_send_nibble()
1708 static int alps_command_mode_set_addr(struct psmouse *psmouse, int addr) in alps_command_mode_set_addr() argument
1710 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_command_mode_set_addr()
1711 struct alps_data *priv = psmouse->private; in alps_command_mode_set_addr()
1719 if (alps_command_mode_send_nibble(psmouse, nibble)) in alps_command_mode_set_addr()
1726 static int __alps_command_mode_read_reg(struct psmouse *psmouse, int addr) in __alps_command_mode_read_reg() argument
1728 struct ps2dev *ps2dev = &psmouse->ps2dev; in __alps_command_mode_read_reg()
1745 static int alps_command_mode_read_reg(struct psmouse *psmouse, int addr) in alps_command_mode_read_reg() argument
1747 if (alps_command_mode_set_addr(psmouse, addr)) in alps_command_mode_read_reg()
1749 return __alps_command_mode_read_reg(psmouse, addr); in alps_command_mode_read_reg()
1752 static int __alps_command_mode_write_reg(struct psmouse *psmouse, u8 value) in __alps_command_mode_write_reg() argument
1754 if (alps_command_mode_send_nibble(psmouse, (value >> 4) & 0xf)) in __alps_command_mode_write_reg()
1756 if (alps_command_mode_send_nibble(psmouse, value & 0xf)) in __alps_command_mode_write_reg()
1761 static int alps_command_mode_write_reg(struct psmouse *psmouse, int addr, in alps_command_mode_write_reg() argument
1764 if (alps_command_mode_set_addr(psmouse, addr)) in alps_command_mode_write_reg()
1766 return __alps_command_mode_write_reg(psmouse, value); in alps_command_mode_write_reg()
1769 static int alps_rpt_cmd(struct psmouse *psmouse, int init_command, in alps_rpt_cmd() argument
1772 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_rpt_cmd()
1787 psmouse_dbg(psmouse, "%2.2X report: %3ph\n", in alps_rpt_cmd()
1808 static int alps_enter_command_mode(struct psmouse *psmouse) in alps_enter_command_mode() argument
1812 if (alps_rpt_cmd(psmouse, 0, PSMOUSE_CMD_RESET_WRAP, param)) { in alps_enter_command_mode()
1813 psmouse_err(psmouse, "failed to enter command mode\n"); in alps_enter_command_mode()
1818 psmouse_dbg(psmouse, in alps_enter_command_mode()
1825 static inline int alps_exit_command_mode(struct psmouse *psmouse) in alps_exit_command_mode() argument
1827 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_exit_command_mode()
1838 static int alps_passthrough_mode_v2(struct psmouse *psmouse, bool enable) in alps_passthrough_mode_v2() argument
1840 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_passthrough_mode_v2()
1855 static int alps_absolute_mode_v1_v2(struct psmouse *psmouse) in alps_absolute_mode_v1_v2() argument
1857 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_absolute_mode_v1_v2()
1874 static int alps_monitor_mode_send_word(struct psmouse *psmouse, u16 word) in alps_monitor_mode_send_word() argument
1884 if (alps_command_mode_send_nibble(psmouse, nibble)) in alps_monitor_mode_send_word()
1891 static int alps_monitor_mode_write_reg(struct psmouse *psmouse, in alps_monitor_mode_write_reg() argument
1894 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_monitor_mode_write_reg()
1898 alps_monitor_mode_send_word(psmouse, 0x0A0) || in alps_monitor_mode_write_reg()
1899 alps_monitor_mode_send_word(psmouse, addr) || in alps_monitor_mode_write_reg()
1900 alps_monitor_mode_send_word(psmouse, value) || in alps_monitor_mode_write_reg()
1907 static int alps_monitor_mode(struct psmouse *psmouse, bool enable) in alps_monitor_mode() argument
1909 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_monitor_mode()
1931 static int alps_absolute_mode_v6(struct psmouse *psmouse) in alps_absolute_mode_v6() argument
1937 if (alps_monitor_mode(psmouse, true)) in alps_absolute_mode_v6()
1940 ret = alps_monitor_mode_write_reg(psmouse, 0x000, reg_val); in alps_absolute_mode_v6()
1942 if (alps_monitor_mode(psmouse, false)) in alps_absolute_mode_v6()
1948 static int alps_get_status(struct psmouse *psmouse, char *param) in alps_get_status() argument
1951 if (alps_rpt_cmd(psmouse, 0, PSMOUSE_CMD_DISABLE, param)) in alps_get_status()
1966 static int alps_tap_mode(struct psmouse *psmouse, int enable) in alps_tap_mode() argument
1968 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_tap_mode()
1979 if (alps_get_status(psmouse, param)) in alps_tap_mode()
1989 static int alps_poll(struct psmouse *psmouse) in alps_poll() argument
1991 struct alps_data *priv = psmouse->private; in alps_poll()
1992 unsigned char buf[sizeof(psmouse->packet)]; in alps_poll()
1996 alps_passthrough_mode_v2(psmouse, true); in alps_poll()
1998 poll_failed = ps2_command(&psmouse->ps2dev, buf, in alps_poll()
1999 PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)) < 0; in alps_poll()
2002 alps_passthrough_mode_v2(psmouse, false); in alps_poll()
2007 if ((psmouse->badbyte & 0xc8) == 0x08) { in alps_poll()
2011 if (ps2_command(&psmouse->ps2dev, buf, PSMOUSE_CMD_POLL | (3 << 8))) in alps_poll()
2015 memcpy(psmouse->packet, buf, sizeof(buf)); in alps_poll()
2019 static int alps_hw_init_v1_v2(struct psmouse *psmouse) in alps_hw_init_v1_v2() argument
2021 struct alps_data *priv = psmouse->private; in alps_hw_init_v1_v2()
2024 alps_passthrough_mode_v2(psmouse, true)) { in alps_hw_init_v1_v2()
2028 if (alps_tap_mode(psmouse, true)) { in alps_hw_init_v1_v2()
2029 psmouse_warn(psmouse, "Failed to enable hardware tapping\n"); in alps_hw_init_v1_v2()
2033 if (alps_absolute_mode_v1_v2(psmouse)) { in alps_hw_init_v1_v2()
2034 psmouse_err(psmouse, "Failed to enable absolute mode\n"); in alps_hw_init_v1_v2()
2039 alps_passthrough_mode_v2(psmouse, false)) { in alps_hw_init_v1_v2()
2044 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSTREAM)) { in alps_hw_init_v1_v2()
2045 psmouse_err(psmouse, "Failed to enable stream mode\n"); in alps_hw_init_v1_v2()
2053 static int alps_trackstick_enter_extended_mode_v3_v6(struct psmouse *psmouse) in alps_trackstick_enter_extended_mode_v3_v6() argument
2057 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || in alps_trackstick_enter_extended_mode_v3_v6()
2058 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || in alps_trackstick_enter_extended_mode_v3_v6()
2059 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || in alps_trackstick_enter_extended_mode_v3_v6()
2060 ps2_command(&psmouse->ps2dev, &param[0], PSMOUSE_CMD_SETRATE) || in alps_trackstick_enter_extended_mode_v3_v6()
2061 ps2_command(&psmouse->ps2dev, &param[1], PSMOUSE_CMD_SETRATE)) in alps_trackstick_enter_extended_mode_v3_v6()
2067 static int alps_hw_init_v6(struct psmouse *psmouse) in alps_hw_init_v6() argument
2072 if (alps_passthrough_mode_v2(psmouse, true)) in alps_hw_init_v6()
2075 ret = alps_trackstick_enter_extended_mode_v3_v6(psmouse); in alps_hw_init_v6()
2077 if (alps_passthrough_mode_v2(psmouse, false)) in alps_hw_init_v6()
2083 if (alps_absolute_mode_v6(psmouse)) { in alps_hw_init_v6()
2084 psmouse_err(psmouse, "Failed to enable absolute mode\n"); in alps_hw_init_v6()
2094 static int alps_passthrough_mode_v3(struct psmouse *psmouse, in alps_passthrough_mode_v3() argument
2099 if (alps_enter_command_mode(psmouse)) in alps_passthrough_mode_v3()
2102 reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x0008); in alps_passthrough_mode_v3()
2111 ret = __alps_command_mode_write_reg(psmouse, reg_val); in alps_passthrough_mode_v3()
2114 if (alps_exit_command_mode(psmouse)) in alps_passthrough_mode_v3()
2120 static int alps_absolute_mode_v3(struct psmouse *psmouse) in alps_absolute_mode_v3() argument
2124 reg_val = alps_command_mode_read_reg(psmouse, 0x0004); in alps_absolute_mode_v3()
2129 if (__alps_command_mode_write_reg(psmouse, reg_val)) in alps_absolute_mode_v3()
2135 static int alps_probe_trackstick_v3_v7(struct psmouse *psmouse, int reg_base) in alps_probe_trackstick_v3_v7() argument
2139 if (alps_enter_command_mode(psmouse)) in alps_probe_trackstick_v3_v7()
2142 reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x08); in alps_probe_trackstick_v3_v7()
2150 alps_exit_command_mode(psmouse); in alps_probe_trackstick_v3_v7()
2154 static int alps_setup_trackstick_v3(struct psmouse *psmouse, int reg_base) in alps_setup_trackstick_v3() argument
2168 if (alps_passthrough_mode_v3(psmouse, reg_base, true)) in alps_setup_trackstick_v3()
2180 if (alps_rpt_cmd(psmouse, 0, PSMOUSE_CMD_SETSCALE21, param)) { in alps_setup_trackstick_v3()
2181 psmouse_warn(psmouse, "Failed to initialize trackstick (E7 report failed)\n"); in alps_setup_trackstick_v3()
2184 psmouse_dbg(psmouse, "trackstick E7 report: %3ph\n", param); in alps_setup_trackstick_v3()
2185 if (alps_trackstick_enter_extended_mode_v3_v6(psmouse)) { in alps_setup_trackstick_v3()
2186 psmouse_err(psmouse, "Failed to enter into trackstick extended mode\n"); in alps_setup_trackstick_v3()
2191 if (alps_passthrough_mode_v3(psmouse, reg_base, false)) in alps_setup_trackstick_v3()
2197 if (alps_enter_command_mode(psmouse)) in alps_setup_trackstick_v3()
2200 reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x08); in alps_setup_trackstick_v3()
2209 if (__alps_command_mode_write_reg(psmouse, reg_val)) in alps_setup_trackstick_v3()
2213 if (alps_exit_command_mode(psmouse)) in alps_setup_trackstick_v3()
2219 static int alps_hw_init_v3(struct psmouse *psmouse) in alps_hw_init_v3() argument
2221 struct alps_data *priv = psmouse->private; in alps_hw_init_v3()
2222 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_hw_init_v3()
2227 alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO) in alps_hw_init_v3()
2230 if (alps_enter_command_mode(psmouse) || in alps_hw_init_v3()
2231 alps_absolute_mode_v3(psmouse)) { in alps_hw_init_v3()
2232 psmouse_err(psmouse, "Failed to enter absolute mode\n"); in alps_hw_init_v3()
2236 reg_val = alps_command_mode_read_reg(psmouse, 0x0006); in alps_hw_init_v3()
2239 if (__alps_command_mode_write_reg(psmouse, reg_val | 0x01)) in alps_hw_init_v3()
2242 reg_val = alps_command_mode_read_reg(psmouse, 0x0007); in alps_hw_init_v3()
2245 if (__alps_command_mode_write_reg(psmouse, reg_val | 0x01)) in alps_hw_init_v3()
2248 if (alps_command_mode_read_reg(psmouse, 0x0144) == -1) in alps_hw_init_v3()
2250 if (__alps_command_mode_write_reg(psmouse, 0x04)) in alps_hw_init_v3()
2253 if (alps_command_mode_read_reg(psmouse, 0x0159) == -1) in alps_hw_init_v3()
2255 if (__alps_command_mode_write_reg(psmouse, 0x03)) in alps_hw_init_v3()
2258 if (alps_command_mode_read_reg(psmouse, 0x0163) == -1) in alps_hw_init_v3()
2260 if (alps_command_mode_write_reg(psmouse, 0x0163, 0x03)) in alps_hw_init_v3()
2263 if (alps_command_mode_read_reg(psmouse, 0x0162) == -1) in alps_hw_init_v3()
2265 if (alps_command_mode_write_reg(psmouse, 0x0162, 0x04)) in alps_hw_init_v3()
2268 alps_exit_command_mode(psmouse); in alps_hw_init_v3()
2274 psmouse_err(psmouse, "Failed to enable data reporting\n"); in alps_hw_init_v3()
2286 alps_exit_command_mode(psmouse); in alps_hw_init_v3()
2290 static int alps_get_v3_v7_resolution(struct psmouse *psmouse, int reg_pitch) in alps_get_v3_v7_resolution() argument
2293 struct alps_data *priv = psmouse->private; in alps_get_v3_v7_resolution()
2295 reg = alps_command_mode_read_reg(psmouse, reg_pitch); in alps_get_v3_v7_resolution()
2305 reg = alps_command_mode_read_reg(psmouse, reg_pitch + 1); in alps_get_v3_v7_resolution()
2321 psmouse_dbg(psmouse, in alps_get_v3_v7_resolution()
2329 static int alps_hw_init_rushmore_v3(struct psmouse *psmouse) in alps_hw_init_rushmore_v3() argument
2331 struct alps_data *priv = psmouse->private; in alps_hw_init_rushmore_v3()
2332 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_hw_init_rushmore_v3()
2336 reg_val = alps_setup_trackstick_v3(psmouse, in alps_hw_init_rushmore_v3()
2342 if (alps_enter_command_mode(psmouse) || in alps_hw_init_rushmore_v3()
2343 alps_command_mode_read_reg(psmouse, 0xc2d9) == -1 || in alps_hw_init_rushmore_v3()
2344 alps_command_mode_write_reg(psmouse, 0xc2cb, 0x00)) in alps_hw_init_rushmore_v3()
2347 if (alps_get_v3_v7_resolution(psmouse, 0xc2da)) in alps_hw_init_rushmore_v3()
2350 reg_val = alps_command_mode_read_reg(psmouse, 0xc2c6); in alps_hw_init_rushmore_v3()
2353 if (__alps_command_mode_write_reg(psmouse, reg_val & 0xfd)) in alps_hw_init_rushmore_v3()
2356 if (alps_command_mode_write_reg(psmouse, 0xc2c9, 0x64)) in alps_hw_init_rushmore_v3()
2360 reg_val = alps_command_mode_read_reg(psmouse, 0xc2c4); in alps_hw_init_rushmore_v3()
2363 if (__alps_command_mode_write_reg(psmouse, reg_val | 0x02)) in alps_hw_init_rushmore_v3()
2366 alps_exit_command_mode(psmouse); in alps_hw_init_rushmore_v3()
2370 alps_exit_command_mode(psmouse); in alps_hw_init_rushmore_v3()
2375 static int alps_absolute_mode_v4(struct psmouse *psmouse) in alps_absolute_mode_v4() argument
2379 reg_val = alps_command_mode_read_reg(psmouse, 0x0004); in alps_absolute_mode_v4()
2384 if (__alps_command_mode_write_reg(psmouse, reg_val)) in alps_absolute_mode_v4()
2390 static int alps_hw_init_v4(struct psmouse *psmouse) in alps_hw_init_v4() argument
2392 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_hw_init_v4()
2395 if (alps_enter_command_mode(psmouse)) in alps_hw_init_v4()
2398 if (alps_absolute_mode_v4(psmouse)) { in alps_hw_init_v4()
2399 psmouse_err(psmouse, "Failed to enter absolute mode\n"); in alps_hw_init_v4()
2403 if (alps_command_mode_write_reg(psmouse, 0x0007, 0x8c)) in alps_hw_init_v4()
2406 if (alps_command_mode_write_reg(psmouse, 0x0149, 0x03)) in alps_hw_init_v4()
2409 if (alps_command_mode_write_reg(psmouse, 0x0160, 0x03)) in alps_hw_init_v4()
2412 if (alps_command_mode_write_reg(psmouse, 0x017f, 0x15)) in alps_hw_init_v4()
2415 if (alps_command_mode_write_reg(psmouse, 0x0151, 0x01)) in alps_hw_init_v4()
2418 if (alps_command_mode_write_reg(psmouse, 0x0168, 0x03)) in alps_hw_init_v4()
2421 if (alps_command_mode_write_reg(psmouse, 0x014a, 0x03)) in alps_hw_init_v4()
2424 if (alps_command_mode_write_reg(psmouse, 0x0161, 0x03)) in alps_hw_init_v4()
2427 alps_exit_command_mode(psmouse); in alps_hw_init_v4()
2447 psmouse_err(psmouse, "Failed to enable data reporting\n"); in alps_hw_init_v4()
2459 alps_exit_command_mode(psmouse); in alps_hw_init_v4()
2463 static int alps_get_otp_values_ss4_v2(struct psmouse *psmouse, in alps_get_otp_values_ss4_v2() argument
2466 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_get_otp_values_ss4_v2()
2552 struct psmouse *psmouse) in alps_update_dual_info_ss4_v2() argument
2556 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_update_dual_info_ss4_v2()
2563 if (alps_exit_command_mode(psmouse) == 0 && in alps_update_dual_info_ss4_v2()
2564 alps_enter_command_mode(psmouse) == 0) { in alps_update_dual_info_ss4_v2()
2565 reg_val = alps_command_mode_read_reg(psmouse, in alps_update_dual_info_ss4_v2()
2568 alps_exit_command_mode(psmouse); in alps_update_dual_info_ss4_v2()
2583 static int alps_set_defaults_ss4_v2(struct psmouse *psmouse, in alps_set_defaults_ss4_v2() argument
2590 if (alps_get_otp_values_ss4_v2(psmouse, 1, &otp[1][0]) || in alps_set_defaults_ss4_v2()
2591 alps_get_otp_values_ss4_v2(psmouse, 0, &otp[0][0])) in alps_set_defaults_ss4_v2()
2598 alps_update_dual_info_ss4_v2(otp, priv, psmouse); in alps_set_defaults_ss4_v2()
2603 static int alps_dolphin_get_device_area(struct psmouse *psmouse, in alps_dolphin_get_device_area() argument
2606 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_dolphin_get_device_area()
2610 if (alps_enter_command_mode(psmouse)) in alps_dolphin_get_device_area()
2643 if (alps_exit_command_mode(psmouse)) in alps_dolphin_get_device_area()
2649 static int alps_hw_init_dolphin_v1(struct psmouse *psmouse) in alps_hw_init_dolphin_v1() argument
2651 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_hw_init_dolphin_v1()
2666 static int alps_hw_init_v7(struct psmouse *psmouse) in alps_hw_init_v7() argument
2668 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_hw_init_v7()
2671 if (alps_enter_command_mode(psmouse) || in alps_hw_init_v7()
2672 alps_command_mode_read_reg(psmouse, 0xc2d9) == -1) in alps_hw_init_v7()
2675 if (alps_get_v3_v7_resolution(psmouse, 0xc397)) in alps_hw_init_v7()
2678 if (alps_command_mode_write_reg(psmouse, 0xc2c9, 0x64)) in alps_hw_init_v7()
2681 reg_val = alps_command_mode_read_reg(psmouse, 0xc2c4); in alps_hw_init_v7()
2684 if (__alps_command_mode_write_reg(psmouse, reg_val | 0x02)) in alps_hw_init_v7()
2687 alps_exit_command_mode(psmouse); in alps_hw_init_v7()
2691 alps_exit_command_mode(psmouse); in alps_hw_init_v7()
2695 static int alps_hw_init_ss4_v2(struct psmouse *psmouse) in alps_hw_init_ss4_v2() argument
2697 struct ps2dev *ps2dev = &psmouse->ps2dev; in alps_hw_init_ss4_v2()
2710 if (alps_exit_command_mode(psmouse) || in alps_hw_init_ss4_v2()
2711 alps_enter_command_mode(psmouse) || in alps_hw_init_ss4_v2()
2712 alps_command_mode_write_reg(psmouse, 0x001D, 0x20)) { in alps_hw_init_ss4_v2()
2715 alps_exit_command_mode(psmouse); in alps_hw_init_ss4_v2()
2720 alps_exit_command_mode(psmouse); in alps_hw_init_ss4_v2()
2724 static int alps_set_protocol(struct psmouse *psmouse, in alps_set_protocol() argument
2728 psmouse->private = priv; in alps_set_protocol()
2762 if (alps_probe_trackstick_v3_v7(psmouse, in alps_set_protocol()
2778 if (alps_probe_trackstick_v3_v7(psmouse, in alps_set_protocol()
2802 if (alps_dolphin_get_device_area(psmouse, priv)) in alps_set_protocol()
2829 if (alps_probe_trackstick_v3_v7(psmouse, ALPS_REG_BASE_V7) < 0) in alps_set_protocol()
2842 if (alps_set_defaults_ss4_v2(psmouse, priv)) in alps_set_protocol()
2867 static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) in alps_identify() argument
2879 if (alps_rpt_cmd(psmouse, PSMOUSE_CMD_SETRES, in alps_identify()
2890 if (alps_rpt_cmd(psmouse, PSMOUSE_CMD_SETRES, in alps_identify()
2892 alps_rpt_cmd(psmouse, PSMOUSE_CMD_SETRES, in alps_identify()
2894 alps_exit_command_mode(psmouse)) in alps_identify()
2918 psmouse_warn(psmouse, in alps_identify()
2923 psmouse_dbg(psmouse, in alps_identify()
2933 error = alps_set_protocol(psmouse, priv, protocol); in alps_identify()
2941 static int alps_reconnect(struct psmouse *psmouse) in alps_reconnect() argument
2943 struct alps_data *priv = psmouse->private; in alps_reconnect()
2945 psmouse_reset(psmouse); in alps_reconnect()
2947 if (alps_identify(psmouse, priv) < 0) in alps_reconnect()
2950 return priv->hw_init(psmouse); in alps_reconnect()
2953 static void alps_disconnect(struct psmouse *psmouse) in alps_disconnect() argument
2955 struct alps_data *priv = psmouse->private; in alps_disconnect()
2957 psmouse_reset(psmouse); in alps_disconnect()
3023 int alps_init(struct psmouse *psmouse) in alps_init() argument
3025 struct alps_data *priv = psmouse->private; in alps_init()
3026 struct input_dev *dev1 = psmouse->dev; in alps_init()
3029 error = priv->hw_init(psmouse); in alps_init()
3081 psmouse_err(psmouse, in alps_init()
3088 psmouse->ps2dev.serio->phys); in alps_init()
3101 dev2->dev.parent = &psmouse->ps2dev.serio->dev; in alps_init()
3118 psmouse_err(psmouse, in alps_init()
3128 priv->psmouse = psmouse; in alps_init()
3133 psmouse->protocol_handler = alps_process_byte; in alps_init()
3134 psmouse->poll = alps_poll; in alps_init()
3135 psmouse->disconnect = alps_disconnect; in alps_init()
3136 psmouse->reconnect = alps_reconnect; in alps_init()
3137 psmouse->pktsize = priv->proto_version == ALPS_PROTO_V4 ? 8 : 6; in alps_init()
3140 psmouse->resync_time = 0; in alps_init()
3143 psmouse->resetafter = psmouse->pktsize * 2; in alps_init()
3148 psmouse_reset(psmouse); in alps_init()
3153 kfree(psmouse->private); in alps_init()
3154 psmouse->private = NULL; in alps_init()
3158 int alps_detect(struct psmouse *psmouse, bool set_properties) in alps_detect() argument
3163 error = alps_identify(psmouse, NULL); in alps_detect()
3173 psmouse_reset(psmouse); in alps_detect()
3179 error = alps_identify(psmouse, priv); in alps_detect()
3186 psmouse->vendor = "ALPS"; in alps_detect()
3187 psmouse->name = priv->flags & ALPS_DUALPOINT ? in alps_detect()
3189 psmouse->model = priv->proto_version; in alps_detect()
3198 psmouse->private = NULL; in alps_detect()