Skip to content

Commit 88006b8

Browse files
jigpuJiri Kosina
authored andcommitted
HID: wacom: Initialize brightness of LED trigger
If an LED has a default_trigger set prior to being registered with the subsystem, that trigger will be executed with a brightness value defined by `trigger->brightness`. Our driver was not setting this value, which was causing problems. It would cause the selected LED to be turned off, as well as corrupt the hlv/llv values assigned to other LEDs (since calling `wacom_led_brightness_set` will overite these values). This patch sets the value of `trigger->brightness` to an appropriate value. We use `wacom_leds_brightness_get` to transform the llv/hlv values into a brightness that is understood by the rest of the LED subsystem. Fixes: 822c91e ("leds: trigger: Store brightness set by led_trigger_event()") Cc: [email protected] # v6.10+ Signed-off-by: Jason Gerecke <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 8d355b5 commit 88006b8

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

drivers/hid/wacom_sys.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,17 +1370,6 @@ static int wacom_led_register_one(struct device *dev, struct wacom *wacom,
13701370
if (!name)
13711371
return -ENOMEM;
13721372

1373-
if (!read_only) {
1374-
led->trigger.name = name;
1375-
error = devm_led_trigger_register(dev, &led->trigger);
1376-
if (error) {
1377-
hid_err(wacom->hdev,
1378-
"failed to register LED trigger %s: %d\n",
1379-
led->cdev.name, error);
1380-
return error;
1381-
}
1382-
}
1383-
13841373
led->group = group;
13851374
led->id = id;
13861375
led->wacom = wacom;
@@ -1397,6 +1386,19 @@ static int wacom_led_register_one(struct device *dev, struct wacom *wacom,
13971386
led->cdev.brightness_set = wacom_led_readonly_brightness_set;
13981387
}
13991388

1389+
if (!read_only) {
1390+
led->trigger.name = name;
1391+
if (id == wacom->led.groups[group].select)
1392+
led->trigger.brightness = wacom_leds_brightness_get(led);
1393+
error = devm_led_trigger_register(dev, &led->trigger);
1394+
if (error) {
1395+
hid_err(wacom->hdev,
1396+
"failed to register LED trigger %s: %d\n",
1397+
led->cdev.name, error);
1398+
return error;
1399+
}
1400+
}
1401+
14001402
error = devm_led_classdev_register(dev, &led->cdev);
14011403
if (error) {
14021404
hid_err(wacom->hdev,

0 commit comments

Comments
 (0)