summaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-led.c
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2016-07-04 21:47:52 +0200
committerJiri Kosina <jkosina@suse.cz>2016-07-07 11:20:59 +0200
commit9d1e048cc8e1f9317b0bff611021aaf52e65f9d4 (patch)
treeb790babe8b821113ea38a20a00ad3513a4174d1e /drivers/hid/hid-led.c
parentde9086509e716e9797f401dd260d5b4bdd2244c7 (diff)
downloadlinux-stable-9d1e048cc8e1f9317b0bff611021aaf52e65f9d4.tar.gz
linux-stable-9d1e048cc8e1f9317b0bff611021aaf52e65f9d4.tar.bz2
linux-stable-9d1e048cc8e1f9317b0bff611021aaf52e65f9d4.zip
HID: hid-led: add support for Greynut Luxafor
Add support for Greynut Luxafor. This device has two groups of three independent LED's each. Successfully tested with such a device. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-led.c')
-rw-r--r--drivers/hid/hid-led.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/hid/hid-led.c b/drivers/hid/hid-led.c
index d793ecefb8b6..4c43ef8e71f8 100644
--- a/drivers/hid/hid-led.c
+++ b/drivers/hid/hid-led.c
@@ -28,6 +28,7 @@ enum hidled_type {
DREAM_CHEEKY,
THINGM,
DELCOM,
+ LUXAFOR,
};
static unsigned const char riso_kagaku_tbl[] = {
@@ -329,6 +330,19 @@ static int delcom_init(struct hidled_device *ldev)
return dp.fw.family_code == 2 ? 0 : -ENODEV;
}
+static int luxafor_write(struct led_classdev *cdev, enum led_brightness br)
+{
+ struct hidled_led *led = to_hidled_led(cdev);
+ __u8 buf[MAX_REPORT_SIZE] = { [1] = 1 };
+
+ buf[2] = led->rgb->num + 1;
+ buf[3] = led->rgb->red.cdev.brightness;
+ buf[4] = led->rgb->green.cdev.brightness;
+ buf[5] = led->rgb->blue.cdev.brightness;
+
+ return hidled_send(led->rgb->ldev, buf);
+}
+
static const struct hidled_config hidled_configs[] = {
{
.type = RISO_KAGAKU,
@@ -373,6 +387,16 @@ static const struct hidled_config hidled_configs[] = {
.init = delcom_init,
.write = delcom_write,
},
+ {
+ .type = LUXAFOR,
+ .name = "Greynut Luxafor",
+ .short_name = "luxafor",
+ .max_brightness = 255,
+ .num_leds = 6,
+ .report_size = 9,
+ .report_type = OUTPUT_REPORT,
+ .write = luxafor_write,
+ },
};
static int hidled_init_led(struct hidled_led *led, const char *color_name,
@@ -480,6 +504,8 @@ static const struct hid_device_id hidled_table[] = {
USB_DEVICE_ID_BLINK1), .driver_data = THINGM },
{ HID_USB_DEVICE(USB_VENDOR_ID_DELCOM,
USB_DEVICE_ID_DELCOM_VISUAL_IND), .driver_data = DELCOM },
+ { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP,
+ USB_DEVICE_ID_LUXAFOR), .driver_data = LUXAFOR },
{ }
};
MODULE_DEVICE_TABLE(hid, hidled_table);