Commit 9b5b95dd authored by Jason Gerecke's avatar Jason Gerecke Committed by Dmitry Torokhov

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: default avatarJason Gerecke <killertofu@gmail.com>
Reviewed-by: default avatarPing Cheng <pingc@wacom.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent f860e581
...@@ -15,9 +15,10 @@ Contact: linux-input@vger.kernel.org ...@@ -15,9 +15,10 @@ Contact: linux-input@vger.kernel.org
Description: Description:
Attribute group for control of the status LEDs and the OLEDs. Attribute group for control of the status LEDs and the OLEDs.
This attribute group is only available for Intuos 4 M, L, This attribute group is only available for Intuos 4 M, L,
and XL (with LEDs and OLEDs) and Cintiq 21UX2 and Cintiq 24HD and XL (with LEDs and OLEDs), Intuos 5 (LEDs only), and Cintiq
(LEDs only). Therefore its presence implicitly signifies the 21UX2 and Cintiq 24HD (LEDs only). Therefore its presence
presence of said LEDs and OLEDs on the tablet device. implicitly signifies the presence of said LEDs and OLEDs on the
tablet device.
What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status0_luminance What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status0_luminance
Date: August 2011 Date: August 2011
...@@ -40,10 +41,10 @@ What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led0 ...@@ -40,10 +41,10 @@ What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led0
Date: August 2011 Date: August 2011
Contact: linux-input@vger.kernel.org Contact: linux-input@vger.kernel.org
Description: Description:
Writing to this file sets which one of the four (for Intuos 4) Writing to this file sets which one of the four (for Intuos 4
or of the right four (for Cintiq 21UX2 and Cintiq 24HD) status and Intuos 5) or of the right four (for Cintiq 21UX2 and Cintiq
LEDs is active (0..3). The other three LEDs on the same side are 24HD) status LEDs is active (0..3). The other three LEDs on the
always inactive. same side are always inactive.
What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led1_select What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led1_select
Date: September 2011 Date: September 2011
......
...@@ -574,23 +574,39 @@ static void wacom_remove_shared_data(struct wacom_wac *wacom) ...@@ -574,23 +574,39 @@ static void wacom_remove_shared_data(struct wacom_wac *wacom)
static int wacom_led_control(struct wacom *wacom) static int wacom_led_control(struct wacom *wacom)
{ {
unsigned char *buf; unsigned char *buf;
int retval, led = 0; int retval;
buf = kzalloc(9, GFP_KERNEL); buf = kzalloc(9, GFP_KERNEL);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
if (wacom->wacom_wac.features.type == WACOM_21UX2 || if (wacom->wacom_wac.features.type >= INTUOS5S &&
wacom->wacom_wac.features.type == WACOM_24HD) wacom->wacom_wac.features.type <= INTUOS5L) {
led = (wacom->led.select[1] << 4) | 0x40; /*
* Touch Ring and crop mark LED luminance may take on
led |= wacom->led.select[0] | 0x4; * one of four values:
* 0 = Low; 1 = Medium; 2 = High; 3 = Off
buf[0] = WAC_CMD_LED_CONTROL; */
buf[1] = led; int ring_led = wacom->led.select[0] & 0x03;
buf[2] = wacom->led.llv; int ring_lum = (((wacom->led.llv & 0x60) >> 5) - 1) & 0x03;
buf[3] = wacom->led.hlv; int crop_lum = 0;
buf[4] = wacom->led.img_lum;
buf[0] = WAC_CMD_LED_CONTROL;
buf[1] = (crop_lum << 4) | (ring_lum << 2) | (ring_led);
}
else {
int led = wacom->led.select[0] | 0x4;
if (wacom->wacom_wac.features.type == WACOM_21UX2 ||
wacom->wacom_wac.features.type == WACOM_24HD)
led |= (wacom->led.select[1] << 4) | 0x40;
buf[0] = WAC_CMD_LED_CONTROL;
buf[1] = led;
buf[2] = wacom->led.llv;
buf[3] = wacom->led.hlv;
buf[4] = wacom->led.img_lum;
}
retval = wacom_set_report(wacom->intf, 0x03, WAC_CMD_LED_CONTROL, retval = wacom_set_report(wacom->intf, 0x03, WAC_CMD_LED_CONTROL,
buf, 9, WAC_CMD_RETRIES); buf, 9, WAC_CMD_RETRIES);
...@@ -783,6 +799,17 @@ static struct attribute_group intuos4_led_attr_group = { ...@@ -783,6 +799,17 @@ static struct attribute_group intuos4_led_attr_group = {
.attrs = intuos4_led_attrs, .attrs = intuos4_led_attrs,
}; };
static struct attribute *intuos5_led_attrs[] = {
&dev_attr_status0_luminance.attr,
&dev_attr_status_led0_select.attr,
NULL
};
static struct attribute_group intuos5_led_attr_group = {
.name = "wacom_led",
.attrs = intuos5_led_attrs,
};
static int wacom_initialize_leds(struct wacom *wacom) static int wacom_initialize_leds(struct wacom *wacom)
{ {
int error; int error;
...@@ -812,6 +839,19 @@ static int wacom_initialize_leds(struct wacom *wacom) ...@@ -812,6 +839,19 @@ static int wacom_initialize_leds(struct wacom *wacom)
&cintiq_led_attr_group); &cintiq_led_attr_group);
break; break;
case INTUOS5S:
case INTUOS5:
case INTUOS5L:
wacom->led.select[0] = 0;
wacom->led.select[1] = 0;
wacom->led.llv = 32;
wacom->led.hlv = 0;
wacom->led.img_lum = 0;
error = sysfs_create_group(&wacom->intf->dev.kobj,
&intuos5_led_attr_group);
break;
default: default:
return 0; return 0;
} }
...@@ -840,6 +880,13 @@ static void wacom_destroy_leds(struct wacom *wacom) ...@@ -840,6 +880,13 @@ static void wacom_destroy_leds(struct wacom *wacom)
sysfs_remove_group(&wacom->intf->dev.kobj, sysfs_remove_group(&wacom->intf->dev.kobj,
&cintiq_led_attr_group); &cintiq_led_attr_group);
break; break;
case INTUOS5S:
case INTUOS5:
case INTUOS5L:
sysfs_remove_group(&wacom->intf->dev.kobj,
&intuos5_led_attr_group);
break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment