diff options
author | Aaron Armstrong Skomra <skomra@gmail.com> | 2017-01-25 12:08:42 -0800 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2017-01-26 21:46:45 +0100 |
commit | 10c55cacb8b20518fddf92de43fbfb198f288eb2 (patch) | |
tree | 530ff17adcfb4421b67e57fd30610ae4111a8373 /drivers/hid/wacom_sys.c | |
parent | d2ec58aee8b1d68d309656a0561c81c12197a987 (diff) |
HID: wacom: generic: support LEDs
Add support for the LEDs around the mode switch to the generic code path in
support of the second generation Intuos Pro.
Signed-off-by: Aaron Skomra <aaron.skomra@wacom.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/wacom_sys.c')
-rw-r--r-- | drivers/hid/wacom_sys.c | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index a8e68dc2ca99..3586acbdb467 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -771,8 +771,13 @@ static int wacom_led_control(struct wacom *wacom) if (!buf) return -ENOMEM; - if (wacom->wacom_wac.features.type >= INTUOS5S && - wacom->wacom_wac.features.type <= INTUOSPL) { + if (wacom->wacom_wac.features.type == HID_GENERIC) { + buf[0] = WAC_CMD_LED_CONTROL_GENERIC; + buf[1] = wacom->led.llv; + buf[2] = wacom->led.groups[0].select & 0x03; + + } else if ((wacom->wacom_wac.features.type >= INTUOS5S && + wacom->wacom_wac.features.type <= INTUOSPL)) { /* * Touch Ring and crop mark LED luminance may take on * one of four values: @@ -1042,6 +1047,17 @@ static struct attribute_group intuos5_led_attr_group = { .attrs = intuos5_led_attrs, }; +static struct attribute *generic_led_attrs[] = { + &dev_attr_status0_luminance.attr, + &dev_attr_status_led0_select.attr, + NULL +}; + +static struct attribute_group generic_led_attr_group = { + .name = "wacom_led", + .attrs = generic_led_attrs, +}; + struct wacom_sysfs_group_devres { struct attribute_group *group; struct kobject *root; @@ -1363,7 +1379,7 @@ static int wacom_leds_alloc_and_register(struct wacom *wacom, int group_count, return 0; } -static int wacom_initialize_leds(struct wacom *wacom) +int wacom_initialize_leds(struct wacom *wacom) { int error; @@ -1372,6 +1388,23 @@ static int wacom_initialize_leds(struct wacom *wacom) /* Initialize default values */ switch (wacom->wacom_wac.features.type) { + case HID_GENERIC: + if (!wacom->generic_has_leds) + return 0; + wacom->led.llv = 100; + wacom->led.max_llv = 100; + + error = wacom_leds_alloc_and_register(wacom, 1, 4, false); + if (error) { + hid_err(wacom->hdev, + "cannot create leds err: %d\n", error); + return error; + } + + error = wacom_devm_sysfs_create_group(wacom, + &generic_led_attr_group); + break; + case INTUOS4S: case INTUOS4: case INTUOS4WL: |