mbox series

[v6,00/4] HID: new driver for PS5 'DualSense' controller

Message ID 20210215004549.135251-1-roderick@gaikai.com (mailing list archive)
Headers show
Series HID: new driver for PS5 'DualSense' controller | expand

Message

Roderick Colenbrander Feb. 15, 2021, 12:45 a.m. UTC
From: Roderick Colenbrander <roderick.colenbrander@sony.com>

Hi,

Recently Sony released a HID driver for the new PlayStation 5 controller
'DualSense'. Pavel Machek noticed the driver got staged for "-next" and asked
me to share the LED patches to linux-leds as well.

The LED patches I'm sharing are patch 6, 9, 11, 12 from the v6 hid-playstation
series as originally posted to linux-input. The driver in its full form can be
found on "hid.git/log/?h=for-5.12/playstation".

A little bit of background on the DualSense controller. It is a generic HID
gamepad (e.g. buttons and sticks) with a number of additional features, such
as Motion Sensors, audio, LEDs and others.  All features are implemented using HID
input and output reports.

In regards to LEDs it has 3 types of LEDs. First, it has a RGB lightbar
which is used in PS4/PS5 games for various effects e.g. health indicator, police
siren, player color and other use cases. This patch series exposes it
using the multicolor class, which is great for our use case as the lightbar
state is sent using a single HID output report. Previously for our DualShock 4
controller, the driver exposed individual LEDs, which wasn't great due to race
conditions as games change LED state frequently.

The second LED type, is a row of 5 player indicator LEDs. Such LEDs are common
on gamepads to set a player number e.g. 1, 2, 4 etcetera. Each LED is exposed
as a single LED. A default player id is set based on the number of connected
controllers, which is common behavior within the input system.

Finally, the DualSense has a audio mute LED and a mute button. The mute button is
expected to mute the internal microphone of the DualSense. The mute behavior
is handled driver side and the driver then also programs the LED. From user space
perspective the LED is read-only.

Let me know if there are any questions or comments.

Thanks,

Roderick Colenbrander
Sony Interactive Entertainment, LLC

Roderick Colenbrander (13):
  HID: playstation: add DualSense lightbar support
  HID: playstation: add microphone mute support for DualSense.
  HID: playstation: add DualSense player LEDs support.
  HID: playstation: DualSense set LEDs to default player id.

 MAINTAINERS                   |    6 +
 drivers/hid/Kconfig           |   21 +
 drivers/hid/Makefile          |    1 +
 drivers/hid/hid-ids.h         |    1 +
 drivers/hid/hid-playstation.c | 1504 +++++++++++++++++++++++++++++++++
 5 files changed, 1533 insertions(+)
 create mode 100644 drivers/hid/hid-playstation.c

Comments

Marek BehĂșn Feb. 15, 2021, 2:29 p.m. UTC | #1
On Sun, 14 Feb 2021 16:45:45 -0800
Roderick Colenbrander <roderick@gaikai.com> wrote:

> From: Roderick Colenbrander <roderick.colenbrander@sony.com>
> 
> Hi,
> 
> Recently Sony released a HID driver for the new PlayStation 5 controller
> 'DualSense'. Pavel Machek noticed the driver got staged for "-next" and asked
> me to share the LED patches to linux-leds as well.
> 
> The LED patches I'm sharing are patch 6, 9, 11, 12 from the v6 hid-playstation
> series as originally posted to linux-input. The driver in its full form can be
> found on "hid.git/log/?h=for-5.12/playstation".
> 

Hi,

OK I see you described the purpose of these LEDs here, please ignore
that one question in my reply to patch 1/4.

> Finally, the DualSense has a audio mute LED and a mute button. The mute button is
> expected to mute the internal microphone of the DualSense. The mute behavior
> is handled driver side and the driver then also programs the LED. From user space
> perspective the LED is read-only.

The audio mute LED should not be read-only from userspace. Instead a
LED trigger should be assigned by default, audio-micmute / audio-mute.

With this trigger the LED subsystem will handle setting brightness of
the LED according to whether the audio is muted or not.

This trigger is currently simple, though. It is system wide - it
is impossible to configure it to report only on the state of a
specific microphone. But the trigger driver can be extended if this is needed.

Marek