diff options
author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2014-04-14 16:50:18 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-04-15 08:42:51 -0400 |
commit | aee114fd3c94f1be0f95af84d6ed25cd47702c41 (patch) | |
tree | 21ebe80fcc58e98aefc28ed34268136c12f8fa22 | |
parent | 21200ad10aba00943f9aa832fab04b8926dc7a52 (diff) |
HID: thingm: remove the "fade" sysfs attribute
As for the "play" sysfs attribute, remove this other non-standard
attribute, so the driver only implements what is required to switch the
LED on and off. Thus, a fade time won't be ideal for some fast-changing
triggers.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | Documentation/ABI/testing/sysfs-driver-hid-thingm | 8 | ||||
-rw-r--r-- | drivers/hid/hid-thingm.c | 41 |
2 files changed, 0 insertions, 49 deletions
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-thingm b/Documentation/ABI/testing/sysfs-driver-hid-thingm index fda6185b9292..735c5cb0bb07 100644 --- a/Documentation/ABI/testing/sysfs-driver-hid-thingm +++ b/Documentation/ABI/testing/sysfs-driver-hid-thingm | |||
@@ -6,11 +6,3 @@ Description: The ThingM blink1 is an USB RGB LED. The color notation is | |||
6 | color. Write the 24-bit hexadecimal color to change the current | 6 | color. Write the 24-bit hexadecimal color to change the current |
7 | LED color. The default color is full white (0xFFFFFF). | 7 | LED color. The default color is full white (0xFFFFFF). |
8 | For instance, set the color to green with: echo 00FF00 > rgb | 8 | For instance, set the color to green with: echo 00FF00 > rgb |
9 | |||
10 | What: /sys/class/leds/blink1::<serial>/fade | ||
11 | Date: January 2013 | ||
12 | Contact: Vivien Didelot <vivien.didelot@savoirfairelinux.com> | ||
13 | Description: This attribute allows to set a fade time in milliseconds for | ||
14 | the next color change. Read the attribute to know the current | ||
15 | fade time. The default value is set to 0 (no fade time). For | ||
16 | instance, set a fade time of 2 seconds with: echo 2000 > fade | ||
diff --git a/drivers/hid/hid-thingm.c b/drivers/hid/hid-thingm.c index 7e376b855632..e3b6647e00ce 100644 --- a/drivers/hid/hid-thingm.c +++ b/drivers/hid/hid-thingm.c | |||
@@ -26,14 +26,12 @@ | |||
26 | * @hdev: HID device. | 26 | * @hdev: HID device. |
27 | * @led_cdev: LED class instance. | 27 | * @led_cdev: LED class instance. |
28 | * @rgb: 8-bit per channel RGB notation. | 28 | * @rgb: 8-bit per channel RGB notation. |
29 | * @fade: fade time in hundredths of a second. | ||
30 | * @brightness: brightness coefficient. | 29 | * @brightness: brightness coefficient. |
31 | */ | 30 | */ |
32 | struct blink1_data { | 31 | struct blink1_data { |
33 | struct hid_device *hdev; | 32 | struct hid_device *hdev; |
34 | struct led_classdev led_cdev; | 33 | struct led_classdev led_cdev; |
35 | u32 rgb; | 34 | u32 rgb; |
36 | u16 fade; | ||
37 | u8 brightness; | 35 | u8 brightness; |
38 | }; | 36 | }; |
39 | 37 | ||
@@ -64,12 +62,6 @@ static int blink1_update_color(struct blink1_data *data) | |||
64 | buf[4] = DIV_ROUND_CLOSEST(blink1_rgb_to_b(data->rgb), coef); | 62 | buf[4] = DIV_ROUND_CLOSEST(blink1_rgb_to_b(data->rgb), coef); |
65 | } | 63 | } |
66 | 64 | ||
67 | if (data->fade) { | ||
68 | buf[1] = 'c'; | ||
69 | buf[5] = (data->fade & 0xFF00) >> 8; | ||
70 | buf[6] = (data->fade & 0x00FF); | ||
71 | } | ||
72 | |||
73 | return blink1_send_command(data, buf); | 65 | return blink1_send_command(data, buf); |
74 | } | 66 | } |
75 | 67 | ||
@@ -121,42 +113,9 @@ static ssize_t blink1_store_rgb(struct device *dev, | |||
121 | 113 | ||
122 | static DEVICE_ATTR(rgb, S_IRUGO | S_IWUSR, blink1_show_rgb, blink1_store_rgb); | 114 | static DEVICE_ATTR(rgb, S_IRUGO | S_IWUSR, blink1_show_rgb, blink1_store_rgb); |
123 | 115 | ||
124 | static ssize_t blink1_show_fade(struct device *dev, | ||
125 | struct device_attribute *attr, char *buf) | ||
126 | { | ||
127 | struct blink1_data *data = dev_get_drvdata(dev->parent); | ||
128 | |||
129 | return sprintf(buf, "%d\n", data->fade * 10); | ||
130 | } | ||
131 | |||
132 | static ssize_t blink1_store_fade(struct device *dev, | ||
133 | struct device_attribute *attr, const char *buf, size_t count) | ||
134 | { | ||
135 | struct blink1_data *data = dev_get_drvdata(dev->parent); | ||
136 | long unsigned int fade; | ||
137 | int ret; | ||
138 | |||
139 | ret = kstrtoul(buf, 10, &fade); | ||
140 | if (ret) | ||
141 | return ret; | ||
142 | |||
143 | /* blink(1) accepts 16-bit fade time, number of 10ms ticks */ | ||
144 | fade = DIV_ROUND_CLOSEST(fade, 10); | ||
145 | if (fade > 65535) | ||
146 | return -EINVAL; | ||
147 | |||
148 | data->fade = fade; | ||
149 | |||
150 | return count; | ||
151 | } | ||
152 | |||
153 | static DEVICE_ATTR(fade, S_IRUGO | S_IWUSR, | ||
154 | blink1_show_fade, blink1_store_fade); | ||
155 | |||
156 | static const struct attribute_group blink1_sysfs_group = { | 116 | static const struct attribute_group blink1_sysfs_group = { |
157 | .attrs = (struct attribute *[]) { | 117 | .attrs = (struct attribute *[]) { |
158 | &dev_attr_rgb.attr, | 118 | &dev_attr_rgb.attr, |
159 | &dev_attr_fade.attr, | ||
160 | NULL | 119 | NULL |
161 | }, | 120 | }, |
162 | }; | 121 | }; |