diff options
author | Jason Gerecke <killertofu@gmail.com> | 2012-04-03 18:50:37 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-04-04 12:25:42 -0400 |
commit | 9b5b95dd516a13d53ecf9217672d2116f05097bc (patch) | |
tree | da46a8b284d4595ff57e618b7e07066398e0b300 | |
parent | f860e581fd473250c6dcbd3e13d576b6197e4694 (diff) |
Input: wacom - add Intuos5 Touch Ring LED support
The Touch Ring LEDs on Intuos5 tablets use a different report
format which supports only 4 levels of brightness. We remap
the 7-bit value obtained from sysfs to an appropriate value
for the tablet. Control of the crop mark LEDs (new to the I5)
is left for a later patch.
Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r-- | Documentation/ABI/testing/sysfs-driver-wacom | 15 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_sys.c | 71 |
2 files changed, 67 insertions, 19 deletions
diff --git a/Documentation/ABI/testing/sysfs-driver-wacom b/Documentation/ABI/testing/sysfs-driver-wacom index 0130d6683c14..5e9cbdc7486e 100644 --- a/Documentation/ABI/testing/sysfs-driver-wacom +++ b/Documentation/ABI/testing/sysfs-driver-wacom | |||
@@ -15,9 +15,10 @@ Contact: linux-input@vger.kernel.org | |||
15 | Description: | 15 | Description: |
16 | Attribute group for control of the status LEDs and the OLEDs. | 16 | Attribute group for control of the status LEDs and the OLEDs. |
17 | This attribute group is only available for Intuos 4 M, L, | 17 | This attribute group is only available for Intuos 4 M, L, |
18 | and XL (with LEDs and OLEDs) and Cintiq 21UX2 and Cintiq 24HD | 18 | and XL (with LEDs and OLEDs), Intuos 5 (LEDs only), and Cintiq |
19 | (LEDs only). Therefore its presence implicitly signifies the | 19 | 21UX2 and Cintiq 24HD (LEDs only). Therefore its presence |
20 | presence of said LEDs and OLEDs on the tablet device. | 20 | implicitly signifies the presence of said LEDs and OLEDs on the |
21 | tablet device. | ||
21 | 22 | ||
22 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status0_luminance | 23 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status0_luminance |
23 | Date: August 2011 | 24 | Date: August 2011 |
@@ -40,10 +41,10 @@ What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led0 | |||
40 | Date: August 2011 | 41 | Date: August 2011 |
41 | Contact: linux-input@vger.kernel.org | 42 | Contact: linux-input@vger.kernel.org |
42 | Description: | 43 | Description: |
43 | Writing to this file sets which one of the four (for Intuos 4) | 44 | Writing to this file sets which one of the four (for Intuos 4 |
44 | or of the right four (for Cintiq 21UX2 and Cintiq 24HD) status | 45 | and Intuos 5) or of the right four (for Cintiq 21UX2 and Cintiq |
45 | LEDs is active (0..3). The other three LEDs on the same side are | 46 | 24HD) status LEDs is active (0..3). The other three LEDs on the |
46 | always inactive. | 47 | same side are always inactive. |
47 | 48 | ||
48 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led1_select | 49 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led1_select |
49 | Date: September 2011 | 50 | Date: September 2011 |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 19ba58640dc2..d7713388a953 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -574,23 +574,39 @@ static void wacom_remove_shared_data(struct wacom_wac *wacom) | |||
574 | static int wacom_led_control(struct wacom *wacom) | 574 | static int wacom_led_control(struct wacom *wacom) |
575 | { | 575 | { |
576 | unsigned char *buf; | 576 | unsigned char *buf; |
577 | int retval, led = 0; | 577 | int retval; |
578 | 578 | ||
579 | buf = kzalloc(9, GFP_KERNEL); | 579 | buf = kzalloc(9, GFP_KERNEL); |
580 | if (!buf) | 580 | if (!buf) |
581 | return -ENOMEM; | 581 | return -ENOMEM; |
582 | 582 | ||
583 | if (wacom->wacom_wac.features.type == WACOM_21UX2 || | 583 | if (wacom->wacom_wac.features.type >= INTUOS5S && |
584 | wacom->wacom_wac.features.type == WACOM_24HD) | 584 | wacom->wacom_wac.features.type <= INTUOS5L) { |
585 | led = (wacom->led.select[1] << 4) | 0x40; | 585 | /* |
586 | 586 | * Touch Ring and crop mark LED luminance may take on | |
587 | led |= wacom->led.select[0] | 0x4; | 587 | * one of four values: |
588 | 588 | * 0 = Low; 1 = Medium; 2 = High; 3 = Off | |
589 | buf[0] = WAC_CMD_LED_CONTROL; | 589 | */ |
590 | buf[1] = led; | 590 | int ring_led = wacom->led.select[0] & 0x03; |
591 | buf[2] = wacom->led.llv; | 591 | int ring_lum = (((wacom->led.llv & 0x60) >> 5) - 1) & 0x03; |
592 | buf[3] = wacom->led.hlv; | 592 | int crop_lum = 0; |
593 | buf[4] = wacom->led.img_lum; | 593 | |
594 | buf[0] = WAC_CMD_LED_CONTROL; | ||
595 | buf[1] = (crop_lum << 4) | (ring_lum << 2) | (ring_led); | ||
596 | } | ||
597 | else { | ||
598 | int led = wacom->led.select[0] | 0x4; | ||
599 | |||
600 | if (wacom->wacom_wac.features.type == WACOM_21UX2 || | ||
601 | wacom->wacom_wac.features.type == WACOM_24HD) | ||
602 | led |= (wacom->led.select[1] << 4) | 0x40; | ||
603 | |||
604 | buf[0] = WAC_CMD_LED_CONTROL; | ||
605 | buf[1] = led; | ||
606 | buf[2] = wacom->led.llv; | ||
607 | buf[3] = wacom->led.hlv; | ||
608 | buf[4] = wacom->led.img_lum; | ||
609 | } | ||
594 | 610 | ||
595 | retval = wacom_set_report(wacom->intf, 0x03, WAC_CMD_LED_CONTROL, | 611 | retval = wacom_set_report(wacom->intf, 0x03, WAC_CMD_LED_CONTROL, |
596 | buf, 9, WAC_CMD_RETRIES); | 612 | buf, 9, WAC_CMD_RETRIES); |
@@ -783,6 +799,17 @@ static struct attribute_group intuos4_led_attr_group = { | |||
783 | .attrs = intuos4_led_attrs, | 799 | .attrs = intuos4_led_attrs, |
784 | }; | 800 | }; |
785 | 801 | ||
802 | static struct attribute *intuos5_led_attrs[] = { | ||
803 | &dev_attr_status0_luminance.attr, | ||
804 | &dev_attr_status_led0_select.attr, | ||
805 | NULL | ||
806 | }; | ||
807 | |||
808 | static struct attribute_group intuos5_led_attr_group = { | ||
809 | .name = "wacom_led", | ||
810 | .attrs = intuos5_led_attrs, | ||
811 | }; | ||
812 | |||
786 | static int wacom_initialize_leds(struct wacom *wacom) | 813 | static int wacom_initialize_leds(struct wacom *wacom) |
787 | { | 814 | { |
788 | int error; | 815 | int error; |
@@ -812,6 +839,19 @@ static int wacom_initialize_leds(struct wacom *wacom) | |||
812 | &cintiq_led_attr_group); | 839 | &cintiq_led_attr_group); |
813 | break; | 840 | break; |
814 | 841 | ||
842 | case INTUOS5S: | ||
843 | case INTUOS5: | ||
844 | case INTUOS5L: | ||
845 | wacom->led.select[0] = 0; | ||
846 | wacom->led.select[1] = 0; | ||
847 | wacom->led.llv = 32; | ||
848 | wacom->led.hlv = 0; | ||
849 | wacom->led.img_lum = 0; | ||
850 | |||
851 | error = sysfs_create_group(&wacom->intf->dev.kobj, | ||
852 | &intuos5_led_attr_group); | ||
853 | break; | ||
854 | |||
815 | default: | 855 | default: |
816 | return 0; | 856 | return 0; |
817 | } | 857 | } |
@@ -840,6 +880,13 @@ static void wacom_destroy_leds(struct wacom *wacom) | |||
840 | sysfs_remove_group(&wacom->intf->dev.kobj, | 880 | sysfs_remove_group(&wacom->intf->dev.kobj, |
841 | &cintiq_led_attr_group); | 881 | &cintiq_led_attr_group); |
842 | break; | 882 | break; |
883 | |||
884 | case INTUOS5S: | ||
885 | case INTUOS5: | ||
886 | case INTUOS5L: | ||
887 | sysfs_remove_group(&wacom->intf->dev.kobj, | ||
888 | &intuos5_led_attr_group); | ||
889 | break; | ||
843 | } | 890 | } |
844 | } | 891 | } |
845 | 892 | ||