History log of /drivers/hid/hid-thingm.c
Revision Date Author Comments
67a97845830f79584c9db8849ac723e5d2d57f65 04-Sep-2014 Jiri Kosina <jkosina@suse.cz> HID: thingm: fix workqueue race on remove

thingm_remove_rgb() needs to flush the workqueue after all the LED classes
have been unregistered, otherwise the removal might race with another LED
event coming, causing thingm_led_set() to schedule additional work after
thingm_remove_rgb() has flushed it. This obviously causes oops later, as
the scheduled work has been freed in the meantime.

In addition to that, move the hid_hw_stop() to an earlier place, so that
dmesg is not polluted by failure messages about not being able to write
the LED while the device is being shut down.

Reported-and-tested-by: Dylan Alex Simon <dylan-kernel@dylex.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
e4cf19ffe060e75d34c007565d0aef7189ec654e 02-Sep-2014 Benjamin Tissoires <benjamin.tissoires@redhat.com> HID: thingm: set the proper error code before leaving

In case of an unsupported firmware, the driver bails out without setting
the LEDs interfaces, but forget to set the proper error code.
err is then still equal to 0 and the hid subsytem consider the device
to be in perfect shape.
When removing it, thingm_remove() tries to unbind the rgb LEDs which
has not been created, leading to a segfault.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
e4aecaf2f53bc6635b484ee2f1b8a1e4c73e7997 03-Jun-2014 Jiri Kosina <jkosina@suse.cz> HID: thingm: thingm_fwinfo[] doesn't need to be global

No need to pollute global namespace by thingm_fwinfo[]. Make it static.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
3121b1c44d0748f0286fd05b89a76232f40d1091 14-Apr-2014 Vivien Didelot <vivien.didelot@savoirfairelinux.com> HID: thingm: add support for blink(1) mk2

The blink(1) mk2 is a new version of the blink(1) USB RGB LED. The new
generation has 2 individually-controllable RGB chips.

This patch adds support for this device to the thingm driver, which
registers 3 new standard LED class instances for the second RGB chip.

Note that the 'n' (set) command does not support setting a color for a
single RGB chip, so it was changed to 'c' (fade) with a timeout of 0.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
f70ed8a6f7cd9c55cc16287c584cb26efb53cbd7 14-Apr-2014 Vivien Didelot <vivien.didelot@savoirfairelinux.com> HID: thingm: refactor blink(1) support

This patch refactors the way the thingm driver registers a blink(1) LED.
In order to make the driver simpler and more standard, drop the "rgb"
sysfs attribute and create one instance of LED class per RGB channel.

Actually, the name of the LED class instance registered for a blink(1)
device is "blink1::ABCD", where ABCD is the last 4 chars of the serial
number. The driver now registers 3 instances per RGB chip, named
"thingmX:{red,green,blue}:ledY" where X is the hidraw minor number and Y
is the RGB chip number (as seen by the firmware).

This patch also uses work queues to defer calls with the device, which
now allows triggers to work as expected with this LED device.

Also remove the brightness structure field and the brightness_get
backend, as it is already handled by the LED class, and changes the
prefix of functions and structures to thingm_ to match the driver name.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
aee114fd3c94f1be0f95af84d6ed25cd47702c41 14-Apr-2014 Vivien Didelot <vivien.didelot@savoirfairelinux.com> 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>
21200ad10aba00943f9aa832fab04b8926dc7a52 14-Apr-2014 Vivien Didelot <vivien.didelot@savoirfairelinux.com> HID: thingm: remove the "play" sysfs attribute

When the thingm driver registers an instance of LED class, it creates a
"play" sysfs attribute for this blink(1) specific feature.

Since this feature is not specific to the RGB chip but to the HID device
itself, let's remove this attribute from the LED instance and only
implement what is useful to switch on and off the LED.

This feature is still easily accessible through hidraw.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
b0dd72aafd785785bedbb6db932955807e454a65 10-Feb-2014 Benjamin Tissoires <benjamin.tissoires@redhat.com> HID: replace hid_output_raw_report with hid_hw_raw_request for feature requests

ret = hid_output_raw_report(A, B, C, HID_FEATURE_REPORT);
is equivalent to
ret = hid_hw_raw_request(A, B[0], B, C, HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
whatever the transport layer is.

So use the new API where available

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
7e845d46b13e7730a3720e978c28117ce422edf9 05-Feb-2014 Benjamin Tissoires <benjamin.tissoires@redhat.com> HID: introduce helper to access hid_output_raw_report()

Add a helper to access hdev->hid_output_raw_report().

To convert the drivers, use the following snippets:

for i in drivers/hid/*.c
do
sed -i.bak "s/[^ \t]*->hid_output_raw_report(/hid_output_raw_report(/g" $i
done

Then manually fix for checkpatch.pl

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
f3757cea18fadce23c95a4c4bc3123af73a95e65 25-Feb-2013 Benjamin Tissoires <benjamin.tissoires@gmail.com> HID: Kconfig: Remove explicit transport layer dependencies

Most HID drivers (rightfully) only depend on the HID bus, not the
specific transport layer. Remove such dependencies where applicable.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
30ba2fbde1840db440915491cdde235b72a11384 22-Jan-2013 Vivien Didelot <vivien.didelot@savoirfairelinux.com> HID: add ThingM blink(1) USB RGB LED support

The ThingM blink(1) is an open source hardware USB RGB LED. It contains
an internal EEPROM, allowing to configure up to 12 light patterns. A
light pattern is a RGB color plus a fade time. This driver registers a
LED class instance with additional sysfs attributes to support basic
functions such as setting RGB colors, fade and playing. Other functions
are still accessible through the hidraw interface.

At this time, the only documentation for the device is the firmware
source code from ThingM, plus a few schematics. They are available at:

https://github.com/todbot/blink1

This patch is version 3. It updates the name of the source file, the
driver and the led sysfs entry, according to comments from Jiri Kosina
and Simon Wood.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>