aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorJJ Ding <jj_ding@emc.com.tw>2011-09-09 13:28:19 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-09-09 13:34:55 -0400
commit3c8bbb951ab23dc1192473ccad76cde89c172d27 (patch)
treefb74a059f02eb16946c5ad220f197d5c77a3e862 /drivers/input
parent7894f21b109848130be7547448af89dc33d0f268 (diff)
Input: elantech - clean up elantech_init
Group property setting code into elantech_set_properties. Signed-off-by: JJ Ding <jj_ding@emc.com.tw> Acked-by: Daniel Kurtz <djkurtz@chromium.org> Acked-by: Éric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/mouse/elantech.c69
1 files changed, 39 insertions, 30 deletions
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index f2e3a2be041..1ab1c14449d 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -791,6 +791,42 @@ static int elantech_reconnect(struct psmouse *psmouse)
791} 791}
792 792
793/* 793/*
794 * determine hardware version and set some properties according to it.
795 */
796static void elantech_set_properties(struct elantech_data *etd)
797{
798 /*
799 * Assume every version greater than 0x020030 is new EeePC style
800 * hardware with 6 byte packets, except 0x020600
801 */
802 if (etd->fw_version < 0x020030 || etd->fw_version == 0x020600)
803 etd->hw_version = 1;
804 else
805 etd->hw_version = 2;
806
807 /*
808 * Turn on packet checking by default.
809 */
810 etd->paritycheck = 1;
811
812 /*
813 * This firmware suffers from misreporting coordinates when
814 * a touch action starts causing the mouse cursor or scrolled page
815 * to jump. Enable a workaround.
816 */
817 etd->jumpy_cursor =
818 (etd->fw_version == 0x020022 || etd->fw_version == 0x020600);
819
820 if (etd->hw_version == 2) {
821 /* For now show extra debug information */
822 etd->debug = 1;
823
824 if (etd->fw_version >= 0x020800)
825 etd->reports_pressure = true;
826 }
827}
828
829/*
794 * Initialize the touchpad and create sysfs entries 830 * Initialize the touchpad and create sysfs entries
795 */ 831 */
796int elantech_init(struct psmouse *psmouse) 832int elantech_init(struct psmouse *psmouse)
@@ -816,26 +852,9 @@ int elantech_init(struct psmouse *psmouse)
816 } 852 }
817 853
818 etd->fw_version = (param[0] << 16) | (param[1] << 8) | param[2]; 854 etd->fw_version = (param[0] << 16) | (param[1] << 8) | param[2];
819 855 elantech_set_properties(etd);
820 /* 856 pr_info("assuming hardware version %d "
821 * Assume every version greater than this is new EeePC style 857 "(with firmware version 0x%02x%02x%02x)\n",
822 * hardware with 6 byte packets
823 */
824 if (etd->fw_version >= 0x020030) {
825 etd->hw_version = 2;
826 /* For now show extra debug information */
827 etd->debug = 1;
828 etd->paritycheck = 1;
829
830 if (etd->fw_version >= 0x020800)
831 etd->reports_pressure = true;
832
833 } else {
834 etd->hw_version = 1;
835 etd->paritycheck = 1;
836 }
837
838 pr_info("assuming hardware version %d, firmware version %d.%d.%d\n",
839 etd->hw_version, param[0], param[1], param[2]); 858 etd->hw_version, param[0], param[1], param[2]);
840 859
841 if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY, 860 if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY,
@@ -847,16 +866,6 @@ int elantech_init(struct psmouse *psmouse)
847 etd->capabilities[0], etd->capabilities[1], 866 etd->capabilities[0], etd->capabilities[1],
848 etd->capabilities[2]); 867 etd->capabilities[2]);
849 868
850 /*
851 * This firmware suffers from misreporting coordinates when
852 * a touch action starts causing the mouse cursor or scrolled page
853 * to jump. Enable a workaround.
854 */
855 if (etd->fw_version == 0x020022 || etd->fw_version == 0x020600) {
856 pr_info("firmware version 2.0.34/2.6.0 detected, enabling jumpy cursor workaround\n");
857 etd->jumpy_cursor = true;
858 }
859
860 if (elantech_set_absolute_mode(psmouse)) { 869 if (elantech_set_absolute_mode(psmouse)) {
861 pr_err("failed to put touchpad into absolute mode.\n"); 870 pr_err("failed to put touchpad into absolute mode.\n");
862 goto init_fail; 871 goto init_fail;