From: Max Staudt <max@enpas.org>
To: Roderick Colenbrander <roderick.colenbrander@sony.com>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, max@enpas.org
Subject: [PATCH v2 1/5] HID: playstation: DS4: Fix LED blinking
Date: Thu, 8 Feb 2024 01:36:43 +0900 [thread overview]
Message-ID: <20240207163647.15792-2-max@enpas.org> (raw)
In-Reply-To: <20240207163647.15792-1-max@enpas.org>
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>
---
drivers/hid/hid-playstation.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
index 8ac8f7b8e317..7f50e13601f0 100644
--- a/drivers/hid/hid-playstation.c
+++ b/drivers/hid/hid-playstation.c
@@ -2037,8 +2037,9 @@ static int dualshock4_led_set_blink(struct led_classdev *led, unsigned long *del
dualshock4_schedule_work(ds4);
- *delay_on = ds4->lightbar_blink_on;
- *delay_off = ds4->lightbar_blink_off;
+ /* Report scaled values back to LED subsystem */
+ *delay_on = ds4->lightbar_blink_on * 10;
+ *delay_off = ds4->lightbar_blink_off * 10;
return 0;
}
@@ -2065,6 +2066,13 @@ static int dualshock4_led_set_brightness(struct led_classdev *led, enum led_brig
break;
case 3:
ds4->lightbar_enabled = !!value;
+
+ /* brightness = 0 also cancels blinking in Linux. */
+ if (!ds4->lightbar_enabled) {
+ ds4->lightbar_blink_off = 0;
+ ds4->lightbar_blink_on = 0;
+ ds4->update_lightbar_blink = true;
+ }
}
ds4->update_lightbar = true;
--
2.39.2
next prev parent reply other threads:[~2024-02-07 16:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-07 16:36 [PATCH v2 0/5] HID: playstation: DS4: LED bugfix, third-party gamepad support Max Staudt
2024-02-07 16:36 ` Max Staudt [this message]
2024-02-07 16:36 ` [PATCH v2 2/5] HID: playstation: DS4: Don't fail on FW/HW version request Max Staudt
2024-02-07 16:36 ` [PATCH v2 3/5] HID: playstation: DS4: Don't fail on calibration data request Max Staudt
2024-02-07 16:36 ` [PATCH v2 4/5] HID: playstation: DS4: Parse minimal report 0x01 Max Staudt
2024-02-07 16:36 ` [PATCH v2 5/5] HID: playstation: Simplify device type ID Max Staudt
2024-02-27 16:40 ` [PATCH v2 0/5] HID: playstation: DS4: LED bugfix, third-party gamepad support Jiri Kosina
2024-04-03 18:11 ` Jiri Kosina
2024-04-03 19:24 ` Roderick Colenbrander
2024-04-03 19:54 ` Jiri Kosina
2024-04-03 23:39 ` Max Staudt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240207163647.15792-2-max@enpas.org \
--to=max@enpas.org \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roderick.colenbrander@sony.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox