Skip to content

Commit 8f39af3

Browse files
Max StaudtJiri Kosina
authored andcommitted
HID: playstation: DS4: Fix LED blinking
There was no way to disable blinking once enabled. Disable it on brightness = 0, as per the Linux LED spec. The driver reports back the values it sends to the controller, but they need to be scaled back to milliseconds. Setting the LED blinking via sysfs works as expected now. Signed-off-by: Max Staudt <max@enpas.org> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 3e78a6c commit 8f39af3

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

drivers/hid/hid-playstation.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,8 +2037,9 @@ static int dualshock4_led_set_blink(struct led_classdev *led, unsigned long *del
20372037

20382038
dualshock4_schedule_work(ds4);
20392039

2040-
*delay_on = ds4->lightbar_blink_on;
2041-
*delay_off = ds4->lightbar_blink_off;
2040+
/* Report scaled values back to LED subsystem */
2041+
*delay_on = ds4->lightbar_blink_on * 10;
2042+
*delay_off = ds4->lightbar_blink_off * 10;
20422043

20432044
return 0;
20442045
}
@@ -2065,6 +2066,13 @@ static int dualshock4_led_set_brightness(struct led_classdev *led, enum led_brig
20652066
break;
20662067
case 3:
20672068
ds4->lightbar_enabled = !!value;
2069+
2070+
/* brightness = 0 also cancels blinking in Linux. */
2071+
if (!ds4->lightbar_enabled) {
2072+
ds4->lightbar_blink_off = 0;
2073+
ds4->lightbar_blink_on = 0;
2074+
ds4->update_lightbar_blink = true;
2075+
}
20682076
}
20692077

20702078
ds4->update_lightbar = true;

0 commit comments

Comments
 (0)