From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
To: Roderick Colenbrander <roderick.colenbrander@sony.com>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>,
Henrik Rydberg <rydberg@bitmath.org>
Cc: kernel@collabora.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 09/11] HID: playstation: Rename DualSense input report status field
Date: Mon, 26 May 2025 15:51:32 +0300 [thread overview]
Message-ID: <20250526-dualsense-hid-jack-v1-9-a65fee4a60cc@collabora.com> (raw)
In-Reply-To: <20250526-dualsense-hid-jack-v1-0-a65fee4a60cc@collabora.com>
The name of the 'status' member of struct dualsense_input_report is too
generic, since it is only used to provide battery data.
In preparation to support handling additional (non-battery) status
information and avoid ambiguity, rename the field to status_battery.
For consistency, also rename the related DS_STATUS_* bitfield macros.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/hid/hid-playstation.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
index 937b14679c8b17c5d3d245eae1cc4e0e56dadb71..b7777d3230b2fe277a4a2217ef6b1eff9cfad182 100644
--- a/drivers/hid/hid-playstation.c
+++ b/drivers/hid/hid-playstation.c
@@ -112,10 +112,10 @@ struct ps_led_info {
#define DS_BUTTONS2_TOUCHPAD BIT(1)
#define DS_BUTTONS2_MIC_MUTE BIT(2)
-/* Status field of DualSense input report. */
-#define DS_STATUS_BATTERY_CAPACITY GENMASK(3, 0)
-#define DS_STATUS_CHARGING GENMASK(7, 4)
-#define DS_STATUS_CHARGING_SHIFT 4
+/* Battery status field of DualSense input report. */
+#define DS_STATUS_BATTERY_CAPACITY GENMASK(3, 0)
+#define DS_STATUS_BATTERY_CHARGING GENMASK(7, 4)
+#define DS_STATUS_BATTERY_CHARGING_SHIFT 4
/* Feature version from DualSense Firmware Info report. */
#define DS_FEATURE_VERSION_MINOR GENMASK(7, 0)
@@ -236,7 +236,7 @@ struct dualsense_input_report {
struct dualsense_touch_point points[2];
u8 reserved3[12];
- u8 status;
+ u8 status_battery;
u8 reserved4[10];
} __packed;
/* Common input report size shared equals the size of the USB report minus 1 byte for ReportID. */
@@ -1462,8 +1462,9 @@ static int dualsense_parse_report(struct ps_device *ps_dev, struct hid_report *r
input_report_key(ds->touchpad, BTN_LEFT, ds_report->buttons[2] & DS_BUTTONS2_TOUCHPAD);
input_sync(ds->touchpad);
- battery_data = ds_report->status & DS_STATUS_BATTERY_CAPACITY;
- charging_status = (ds_report->status & DS_STATUS_CHARGING) >> DS_STATUS_CHARGING_SHIFT;
+ battery_data = ds_report->status_battery & DS_STATUS_BATTERY_CAPACITY;
+ charging_status = ds_report->status_battery & DS_STATUS_BATTERY_CHARGING;
+ charging_status >>= DS_STATUS_BATTERY_CHARGING_SHIFT;
switch (charging_status) {
case 0x0:
--
2.49.0
next prev parent reply other threads:[~2025-05-26 12:52 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-26 12:51 [PATCH 00/11] HID: playstation: Add support for audio jack handling on DualSense Cristian Ciocaltea
2025-05-26 12:51 ` [PATCH 01/11] HID: playstation: Make use of bitfield macros Cristian Ciocaltea
2025-06-10 4:07 ` Roderick Colenbrander
2025-06-12 8:20 ` Cristian Ciocaltea
2025-05-26 12:51 ` [PATCH 02/11] HID: playstation: Add spaces around arithmetic operators Cristian Ciocaltea
2025-06-10 4:19 ` Roderick Colenbrander
2025-06-12 8:30 ` Cristian Ciocaltea
2025-05-26 12:51 ` [PATCH 03/11] HID: playstation: Simplify locking with guard() and scoped_guard() Cristian Ciocaltea
2025-06-10 4:28 ` Roderick Colenbrander
2025-06-12 8:41 ` Cristian Ciocaltea
2025-05-26 12:51 ` [PATCH 04/11] HID: playstation: Replace uint{32,16,8}_t with u{32,16,8} Cristian Ciocaltea
2025-06-10 4:30 ` Roderick Colenbrander
2025-06-12 8:52 ` Cristian Ciocaltea
2025-05-26 12:51 ` [PATCH 05/11] HID: playstation: Correct spelling in comment sections Cristian Ciocaltea
2025-05-26 12:51 ` [PATCH 06/11] HID: playstation: Fix all alignment and line length issues Cristian Ciocaltea
2025-05-26 12:51 ` [PATCH 07/11] HID: playstation: Document spinlock_t usage Cristian Ciocaltea
2025-05-26 12:51 ` [PATCH 08/11] HID: playstation: Prefer kzalloc(sizeof(*buf)...) Cristian Ciocaltea
2025-05-26 12:51 ` Cristian Ciocaltea [this message]
2025-06-10 4:40 ` [PATCH 09/11] HID: playstation: Rename DualSense input report status field Roderick Colenbrander
2025-06-12 8:59 ` Cristian Ciocaltea
2025-05-26 12:51 ` [PATCH 10/11] HID: playstation: Support DualSense audio jack hotplug detection Cristian Ciocaltea
2025-06-10 5:04 ` Roderick Colenbrander
2025-06-12 9:14 ` Cristian Ciocaltea
2025-05-26 12:51 ` [PATCH 11/11] HID: playstation: Support DualSense audio jack event reporting Cristian Ciocaltea
2025-06-10 4:01 ` [PATCH 00/11] HID: playstation: Add support for audio jack handling on DualSense Roderick Colenbrander
2025-06-12 8:00 ` Cristian Ciocaltea
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=20250526-dualsense-hid-jack-v1-9-a65fee4a60cc@collabora.com \
--to=cristian.ciocaltea@collabora.com \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=kernel@collabora.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roderick.colenbrander@sony.com \
--cc=rydberg@bitmath.org \
/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
all inboxes | Powered by JetHome®