aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrzemo Firszt <przemo@firszt.eu>2012-03-22 14:54:08 -0400
committerJiri Kosina <jkosina@suse.cz>2012-03-28 04:23:47 -0400
commit4202f1de3b4f1edf74a7f8b2f8b56cb5a8398081 (patch)
treeef2328a06c2f39428c516f89b29878e9c58d8eb0
parente31e3832927f5ee2d788120826e73d120dd39ea9 (diff)
HID: wacom: Add battery/ac reporting for Intuos4 WL
This patch adds battery/ac reporting for Intuos4 WL. It uses existing sysfs code, but the device reports battery capacity in more fine-grained way, so there has to be a separate lookup table (called batcap_i4). Signed-off-by: Przemo Firszt <przemo@firszt.eu> Reviewed-by: Chris Bagwell <chris@cnpbagwell.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-wacom.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
index edf6cba6037a..f130f40488f6 100644
--- a/drivers/hid/hid-wacom.c
+++ b/drivers/hid/hid-wacom.c
@@ -49,6 +49,8 @@ struct wacom_data {
49/*percent of battery capacity for Graphire 49/*percent of battery capacity for Graphire
50 8th value means AC online and show 100% capacity */ 50 8th value means AC online and show 100% capacity */
51static unsigned short batcap_gr[8] = { 1, 15, 25, 35, 50, 70, 100, 100 }; 51static unsigned short batcap_gr[8] = { 1, 15, 25, 35, 50, 70, 100, 100 };
52/*percent of battery capacity for Intuos4 WL, AC has a separate bit*/
53static unsigned short batcap_i4[8] = { 1, 15, 30, 45, 60, 70, 85, 100 };
52 54
53static enum power_supply_property wacom_battery_props[] = { 55static enum power_supply_property wacom_battery_props[] = {
54 POWER_SUPPLY_PROP_PRESENT, 56 POWER_SUPPLY_PROP_PRESENT,
@@ -447,6 +449,7 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
447 struct input_dev *input; 449 struct input_dev *input;
448 unsigned char *data = (unsigned char *) raw_data; 450 unsigned char *data = (unsigned char *) raw_data;
449 int i; 451 int i;
452 __u8 power_raw;
450 453
451 if (!(hdev->claimed & HID_CLAIMED_INPUT)) 454 if (!(hdev->claimed & HID_CLAIMED_INPUT))
452 return 0; 455 return 0;
@@ -474,6 +477,13 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
474 wacom_i4_parse_report(hdev, wdata, input, data + i); 477 wacom_i4_parse_report(hdev, wdata, input, data + i);
475 i += 10; 478 i += 10;
476 wacom_i4_parse_report(hdev, wdata, input, data + i); 479 wacom_i4_parse_report(hdev, wdata, input, data + i);
480 power_raw = data[i+10];
481 if (power_raw != wdata->power_raw) {
482 wdata->power_raw = power_raw;
483 wdata->battery_capacity = batcap_i4[power_raw & 0x07];
484 wdata->ps_connected = power_raw & 0x08;
485 }
486
477 break; 487 break;
478 default: 488 default:
479 hid_err(hdev, "Unknown report: %d,%d size:%d\n", 489 hid_err(hdev, "Unknown report: %d,%d size:%d\n",