aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorTai-hwa Liang <avatar@sentelic.com>2012-05-07 11:45:58 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-05-10 23:39:04 -0400
commitd3132c5c95507d570987712d037d184c637171bb (patch)
treed670f31f02b10a0f3bc0194c3937d8cf89694940 /drivers/input
parent9ac7b1a36c729ce88eee7370da3c9992d7b40590 (diff)
Input: sentelic - report device's production serial number
Hardware since Cx supports an unique identity (used to identify OEM vendors and released lot number) which is very helpful for diagnostic purpose. This revision tries to make it as a part of driver boot up message. Whilst here, also bumping fsp_drv_ver to acknowledge recent addition of absolute coordinates output. Signed-off-by: Tai-hwa Liang <avatar@sentelic.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/mouse/sentelic.c34
-rw-r--r--drivers/input/mouse/sentelic.h8
2 files changed, 38 insertions, 4 deletions
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c
index 661a0ca3b3d6..3f5649f19082 100644
--- a/drivers/input/mouse/sentelic.c
+++ b/drivers/input/mouse/sentelic.c
@@ -41,7 +41,7 @@
41#define GET_ABS_Y(packet) ((packet[2] << 2) | (packet[3] & 0x03)) 41#define GET_ABS_Y(packet) ((packet[2] << 2) | (packet[3] & 0x03))
42 42
43/** Driver version. */ 43/** Driver version. */
44static const char fsp_drv_ver[] = "1.0.0-K"; 44static const char fsp_drv_ver[] = "1.1.0-K";
45 45
46/* 46/*
47 * Make sure that the value being sent to FSP will not conflict with 47 * Make sure that the value being sent to FSP will not conflict with
@@ -303,6 +303,27 @@ static int fsp_get_revision(struct psmouse *psmouse, int *rev)
303 return 0; 303 return 0;
304} 304}
305 305
306static int fsp_get_sn(struct psmouse *psmouse, int *sn)
307{
308 int v0, v1, v2;
309 int rc = -EIO;
310
311 /* production number since Cx is available at: 0x0b40 ~ 0x0b42 */
312 if (fsp_page_reg_write(psmouse, FSP_PAGE_0B))
313 goto out;
314 if (fsp_reg_read(psmouse, FSP_REG_SN0, &v0))
315 goto out;
316 if (fsp_reg_read(psmouse, FSP_REG_SN1, &v1))
317 goto out;
318 if (fsp_reg_read(psmouse, FSP_REG_SN2, &v2))
319 goto out;
320 *sn = (v0 << 16) | (v1 << 8) | v2;
321 rc = 0;
322out:
323 fsp_page_reg_write(psmouse, FSP_PAGE_DEFAULT);
324 return rc;
325}
326
306static int fsp_get_buttons(struct psmouse *psmouse, int *btn) 327static int fsp_get_buttons(struct psmouse *psmouse, int *btn)
307{ 328{
308 static const int buttons[] = { 329 static const int buttons[] = {
@@ -1000,16 +1021,21 @@ static int fsp_reconnect(struct psmouse *psmouse)
1000int fsp_init(struct psmouse *psmouse) 1021int fsp_init(struct psmouse *psmouse)
1001{ 1022{
1002 struct fsp_data *priv; 1023 struct fsp_data *priv;
1003 int ver, rev; 1024 int ver, rev, sn = 0;
1004 int error; 1025 int error;
1005 1026
1006 if (fsp_get_version(psmouse, &ver) || 1027 if (fsp_get_version(psmouse, &ver) ||
1007 fsp_get_revision(psmouse, &rev)) { 1028 fsp_get_revision(psmouse, &rev)) {
1008 return -ENODEV; 1029 return -ENODEV;
1009 } 1030 }
1031 if (ver >= FSP_VER_STL3888_C0) {
1032 /* firmware information is only available since C0 */
1033 fsp_get_sn(psmouse, &sn);
1034 }
1010 1035
1011 psmouse_info(psmouse, "Finger Sensing Pad, hw: %d.%d.%d, sw: %s\n", 1036 psmouse_info(psmouse,
1012 ver >> 4, ver & 0x0F, rev, fsp_drv_ver); 1037 "Finger Sensing Pad, hw: %d.%d.%d, sn: %x, sw: %s\n",
1038 ver >> 4, ver & 0x0F, rev, sn, fsp_drv_ver);
1013 1039
1014 psmouse->private = priv = kzalloc(sizeof(struct fsp_data), GFP_KERNEL); 1040 psmouse->private = priv = kzalloc(sizeof(struct fsp_data), GFP_KERNEL);
1015 if (!priv) 1041 if (!priv)
diff --git a/drivers/input/mouse/sentelic.h b/drivers/input/mouse/sentelic.h
index 334de19e5ddb..aa697ece405b 100644
--- a/drivers/input/mouse/sentelic.h
+++ b/drivers/input/mouse/sentelic.h
@@ -65,6 +65,14 @@
65#define FSP_BIT_SWC1_GST_GRP1 BIT(6) 65#define FSP_BIT_SWC1_GST_GRP1 BIT(6)
66#define FSP_BIT_SWC1_BX_COMPAT BIT(7) 66#define FSP_BIT_SWC1_BX_COMPAT BIT(7)
67 67
68#define FSP_PAGE_0B (0x0b)
69#define FSP_PAGE_82 (0x82)
70#define FSP_PAGE_DEFAULT FSP_PAGE_82
71
72#define FSP_REG_SN0 (0x40)
73#define FSP_REG_SN1 (0x41)
74#define FSP_REG_SN2 (0x42)
75
68/* Finger-sensing Pad packet formating related definitions */ 76/* Finger-sensing Pad packet formating related definitions */
69 77
70/* absolute packet type */ 78/* absolute packet type */