aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/elantech.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2011-10-10 21:27:03 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-10-10 21:28:16 -0400
commitb5d21704361eefe337a36ebbb57a1d9927132511 (patch)
tree8ab7f31597a792a37d578d5652fbb573b8f5723c /drivers/input/mouse/elantech.c
parentae927560a7d3055618ccc73a5d057cdd91b63740 (diff)
Input: psmouse - switch to using dev_*() for messages
This will ensure our reporting is consistent with the rest of the system and we do not refer to obsolete source file names. Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> Reviewed-by: JJ Ding <dgdunix@gmail.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse/elantech.c')
-rw-r--r--drivers/input/mouse/elantech.c84
1 files changed, 47 insertions, 37 deletions
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 25290b395c88..09b93b11a274 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -10,8 +10,6 @@
10 * Trademarks are the property of their respective owners. 10 * Trademarks are the property of their respective owners.
11 */ 11 */
12 12
13#define pr_fmt(fmt) KBUILD_BASENAME ": " fmt
14
15#include <linux/delay.h> 13#include <linux/delay.h>
16#include <linux/slab.h> 14#include <linux/slab.h>
17#include <linux/module.h> 15#include <linux/module.h>
@@ -25,7 +23,8 @@
25#define elantech_debug(fmt, ...) \ 23#define elantech_debug(fmt, ...) \
26 do { \ 24 do { \
27 if (etd->debug) \ 25 if (etd->debug) \
28 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ 26 psmouse_printk(KERN_DEBUG, psmouse, \
27 fmt, ##__VA_ARGS__); \
29 } while (0) 28 } while (0)
30 29
31/* 30/*
@@ -36,7 +35,7 @@ static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c,
36{ 35{
37 if (psmouse_sliced_command(psmouse, c) || 36 if (psmouse_sliced_command(psmouse, c) ||
38 ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) { 37 ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) {
39 pr_err("synaptics_send_cmd query 0x%02x failed.\n", c); 38 psmouse_err(psmouse, "%s query 0x%02x failed.\n", __func__, c);
40 return -1; 39 return -1;
41 } 40 }
42 41
@@ -65,7 +64,7 @@ static int elantech_ps2_command(struct psmouse *psmouse,
65 } while (tries > 0); 64 } while (tries > 0);
66 65
67 if (rc) 66 if (rc)
68 pr_err("ps2 command 0x%02x failed.\n", command); 67 psmouse_err(psmouse, "ps2 command 0x%02x failed.\n", command);
69 68
70 return rc; 69 return rc;
71} 70}
@@ -117,7 +116,7 @@ static int elantech_read_reg(struct psmouse *psmouse, unsigned char reg,
117 } 116 }
118 117
119 if (rc) 118 if (rc)
120 pr_err("failed to read register 0x%02x.\n", reg); 119 psmouse_err(psmouse, "failed to read register 0x%02x.\n", reg);
121 else if (etd->hw_version != 4) 120 else if (etd->hw_version != 4)
122 *val = param[0]; 121 *val = param[0];
123 else 122 else
@@ -191,8 +190,9 @@ static int elantech_write_reg(struct psmouse *psmouse, unsigned char reg,
191 } 190 }
192 191
193 if (rc) 192 if (rc)
194 pr_err("failed to write register 0x%02x with value 0x%02x.\n", 193 psmouse_err(psmouse,
195 reg, val); 194 "failed to write register 0x%02x with value 0x%02x.\n",
195 reg, val);
196 196
197 return rc; 197 return rc;
198} 198}
@@ -200,13 +200,13 @@ static int elantech_write_reg(struct psmouse *psmouse, unsigned char reg,
200/* 200/*
201 * Dump a complete mouse movement packet to the syslog 201 * Dump a complete mouse movement packet to the syslog
202 */ 202 */
203static void elantech_packet_dump(unsigned char *packet, int size) 203static void elantech_packet_dump(struct psmouse *psmouse)
204{ 204{
205 int i; 205 int i;
206 206
207 printk(KERN_DEBUG pr_fmt("PS/2 packet [")); 207 psmouse_printk(KERN_DEBUG, psmouse, "PS/2 packet [");
208 for (i = 0; i < size; i++) 208 for (i = 0; i < psmouse->pktsize; i++)
209 printk("%s0x%02x ", (i) ? ", " : " ", packet[i]); 209 printk("%s0x%02x ", i ? ", " : " ", psmouse->packet[i]);
210 printk("]\n"); 210 printk("]\n");
211} 211}
212 212
@@ -705,7 +705,7 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse)
705 return PSMOUSE_GOOD_DATA; 705 return PSMOUSE_GOOD_DATA;
706 706
707 if (etd->debug > 1) 707 if (etd->debug > 1)
708 elantech_packet_dump(psmouse->packet, psmouse->pktsize); 708 elantech_packet_dump(psmouse);
709 709
710 switch (etd->hw_version) { 710 switch (etd->hw_version) {
711 case 1: 711 case 1:
@@ -801,7 +801,7 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
801 /* 801 /*
802 * Read back reg 0x10. For hardware version 1 we must make 802 * Read back reg 0x10. For hardware version 1 we must make
803 * sure the absolute mode bit is set. For hardware version 2 803 * sure the absolute mode bit is set. For hardware version 2
804 * the touchpad is probably initalising and not ready until 804 * the touchpad is probably initializing and not ready until
805 * we read back the value we just wrote. 805 * we read back the value we just wrote.
806 */ 806 */
807 do { 807 do {
@@ -814,17 +814,19 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
814 } while (tries > 0); 814 } while (tries > 0);
815 815
816 if (rc) { 816 if (rc) {
817 pr_err("failed to read back register 0x10.\n"); 817 psmouse_err(psmouse,
818 "failed to read back register 0x10.\n");
818 } else if (etd->hw_version == 1 && 819 } else if (etd->hw_version == 1 &&
819 !(val & ETP_R10_ABSOLUTE_MODE)) { 820 !(val & ETP_R10_ABSOLUTE_MODE)) {
820 pr_err("touchpad refuses to switch to absolute mode.\n"); 821 psmouse_err(psmouse,
822 "touchpad refuses to switch to absolute mode.\n");
821 rc = -1; 823 rc = -1;
822 } 824 }
823 } 825 }
824 826
825 skip_readback_reg_10: 827 skip_readback_reg_10:
826 if (rc) 828 if (rc)
827 pr_err("failed to initialise registers.\n"); 829 psmouse_err(psmouse, "failed to initialise registers.\n");
828 830
829 return rc; 831 return rc;
830} 832}
@@ -1131,7 +1133,7 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
1131 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || 1133 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
1132 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || 1134 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
1133 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) { 1135 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) {
1134 pr_debug("sending Elantech magic knock failed.\n"); 1136 psmouse_dbg(psmouse, "sending Elantech magic knock failed.\n");
1135 return -1; 1137 return -1;
1136 } 1138 }
1137 1139
@@ -1141,8 +1143,9 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
1141 */ 1143 */
1142 if (param[0] != 0x3c || param[1] != 0x03 || 1144 if (param[0] != 0x3c || param[1] != 0x03 ||
1143 (param[2] != 0xc8 && param[2] != 0x00)) { 1145 (param[2] != 0xc8 && param[2] != 0x00)) {
1144 pr_debug("unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n", 1146 psmouse_dbg(psmouse,
1145 param[0], param[1], param[2]); 1147 "unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n",
1148 param[0], param[1], param[2]);
1146 return -1; 1149 return -1;
1147 } 1150 }
1148 1151
@@ -1152,15 +1155,17 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
1152 * to Elantech magic knock and there might be more. 1155 * to Elantech magic knock and there might be more.
1153 */ 1156 */
1154 if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) { 1157 if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) {
1155 pr_debug("failed to query firmware version.\n"); 1158 psmouse_dbg(psmouse, "failed to query firmware version.\n");
1156 return -1; 1159 return -1;
1157 } 1160 }
1158 1161
1159 pr_debug("Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n", 1162 psmouse_dbg(psmouse,
1160 param[0], param[1], param[2]); 1163 "Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n",
1164 param[0], param[1], param[2]);
1161 1165
1162 if (!elantech_is_signature_valid(param)) { 1166 if (!elantech_is_signature_valid(param)) {
1163 pr_debug("Probably not a real Elantech touchpad. Aborting.\n"); 1167 psmouse_dbg(psmouse,
1168 "Probably not a real Elantech touchpad. Aborting.\n");
1164 return -1; 1169 return -1;
1165 } 1170 }
1166 1171
@@ -1192,7 +1197,8 @@ static int elantech_reconnect(struct psmouse *psmouse)
1192 return -1; 1197 return -1;
1193 1198
1194 if (elantech_set_absolute_mode(psmouse)) { 1199 if (elantech_set_absolute_mode(psmouse)) {
1195 pr_err("failed to put touchpad back into absolute mode.\n"); 1200 psmouse_err(psmouse,
1201 "failed to put touchpad back into absolute mode.\n");
1196 return -1; 1202 return -1;
1197 } 1203 }
1198 1204
@@ -1262,42 +1268,46 @@ int elantech_init(struct psmouse *psmouse)
1262 * Do the version query again so we can store the result 1268 * Do the version query again so we can store the result
1263 */ 1269 */
1264 if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) { 1270 if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) {
1265 pr_err("failed to query firmware version.\n"); 1271 psmouse_err(psmouse, "failed to query firmware version.\n");
1266 goto init_fail; 1272 goto init_fail;
1267 } 1273 }
1268 etd->fw_version = (param[0] << 16) | (param[1] << 8) | param[2]; 1274 etd->fw_version = (param[0] << 16) | (param[1] << 8) | param[2];
1269 1275
1270 if (elantech_set_properties(etd)) { 1276 if (elantech_set_properties(etd)) {
1271 pr_err("unknown hardware version, aborting...\n"); 1277 psmouse_err(psmouse, "unknown hardware version, aborting...\n");
1272 goto init_fail; 1278 goto init_fail;
1273 } 1279 }
1274 pr_info("assuming hardware version %d " 1280 psmouse_info(psmouse,
1275 "(with firmware version 0x%02x%02x%02x)\n", 1281 "assuming hardware version %d (with firmware version 0x%02x%02x%02x)\n",
1276 etd->hw_version, param[0], param[1], param[2]); 1282 etd->hw_version, param[0], param[1], param[2]);
1277 1283
1278 if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY, 1284 if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY,
1279 etd->capabilities)) { 1285 etd->capabilities)) {
1280 pr_err("failed to query capabilities.\n"); 1286 psmouse_err(psmouse, "failed to query capabilities.\n");
1281 goto init_fail; 1287 goto init_fail;
1282 } 1288 }
1283 pr_info("Synaptics capabilities query result 0x%02x, 0x%02x, 0x%02x.\n", 1289 psmouse_info(psmouse,
1284 etd->capabilities[0], etd->capabilities[1], 1290 "Synaptics capabilities query result 0x%02x, 0x%02x, 0x%02x.\n",
1285 etd->capabilities[2]); 1291 etd->capabilities[0], etd->capabilities[1],
1292 etd->capabilities[2]);
1286 1293
1287 if (elantech_set_absolute_mode(psmouse)) { 1294 if (elantech_set_absolute_mode(psmouse)) {
1288 pr_err("failed to put touchpad into absolute mode.\n"); 1295 psmouse_err(psmouse,
1296 "failed to put touchpad into absolute mode.\n");
1289 goto init_fail; 1297 goto init_fail;
1290 } 1298 }
1291 1299
1292 if (elantech_set_input_params(psmouse)) { 1300 if (elantech_set_input_params(psmouse)) {
1293 pr_err("failed to query touchpad range.\n"); 1301 psmouse_err(psmouse, "failed to query touchpad range.\n");
1294 goto init_fail; 1302 goto init_fail;
1295 } 1303 }
1296 1304
1297 error = sysfs_create_group(&psmouse->ps2dev.serio->dev.kobj, 1305 error = sysfs_create_group(&psmouse->ps2dev.serio->dev.kobj,
1298 &elantech_attr_group); 1306 &elantech_attr_group);
1299 if (error) { 1307 if (error) {
1300 pr_err("failed to create sysfs attributes, error: %d.\n", error); 1308 psmouse_err(psmouse,
1309 "failed to create sysfs attributes, error: %d.\n",
1310 error);
1301 goto init_fail; 1311 goto init_fail;
1302 } 1312 }
1303 1313