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 /drivers/input/tablet/wacom_sys.c | |
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>
Diffstat (limited to 'drivers/input/tablet/wacom_sys.c')
-rw-r--r-- | drivers/input/tablet/wacom_sys.c | 71 |
1 files changed, 59 insertions, 12 deletions
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 | ||