* [PATCH v4 RESEND 0/2] Fixes for SRA sensor handling
@ 2025-04-21 21:32 Mario Limonciello
2025-04-21 21:32 ` [PATCH v4 RESEND 1/2] HID: amd_sfh: Fix SRA sensor when it's the only sensor Mario Limonciello
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Mario Limonciello @ 2025-04-21 21:32 UTC (permalink / raw)
To: Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires
Cc: open list, open list:AMD SENSOR FUSION HUB DRIVER,
Mario Limonciello
From: Mario Limonciello <mario.limonciello@amd.com>
On systems with an SRA sensor there are some problems with both init
and failure paths. This series accounts for both.
This is resend of V4 which ahsn't gotten any movement the past two
weeks:
Link: https://patchwork.kernel.org/project/linux-input/cover/20250407151835.1200867-1-superm1@kernel.org/
Mario Limonciello (2):
HID: amd_sfh: Fix SRA sensor when it's the only sensor
HID: amd_sfh: Avoid clearing reports for SRA sensor
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v4 RESEND 1/2] HID: amd_sfh: Fix SRA sensor when it's the only sensor
2025-04-21 21:32 [PATCH v4 RESEND 0/2] Fixes for SRA sensor handling Mario Limonciello
@ 2025-04-21 21:32 ` Mario Limonciello
2025-04-21 21:32 ` [PATCH v4 RESEND 2/2] HID: amd_sfh: Avoid clearing reports for SRA sensor Mario Limonciello
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Mario Limonciello @ 2025-04-21 21:32 UTC (permalink / raw)
To: Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires
Cc: open list, open list:AMD SENSOR FUSION HUB DRIVER,
Mario Limonciello, Yijun Shen, Yijun Shen, stable
From: Mario Limonciello <mario.limonciello@amd.com>
On systems that only have an SRA sensor connected to SFH the sensor
doesn't get enabled due to a bad optimization condition of breaking
the sensor walk loop.
This optimization is unnecessary in the first place because if there
is only one device then the loop only runs once. Drop the condition
and explicitly mark sensor as enabled.
Reported-by: Yijun Shen <Yijun.Shen@dell.com>
Tested-By: Yijun Shen <Yijun_Shen@Dell.com>
Fixes: d1c444b47100d ("HID: amd_sfh: Add support to export device operating states")
Cc: stable@vger.kernel.org
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v2:
* Add tag
---
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
index 25f0ebfcbd5f5..c1bdf1e0d44af 100644
--- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
+++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
@@ -134,9 +134,6 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata)
for (i = 0; i < cl_data->num_hid_devices; i++) {
cl_data->sensor_sts[i] = SENSOR_DISABLED;
- if (cl_data->num_hid_devices == 1 && cl_data->sensor_idx[0] == SRA_IDX)
- break;
-
if (cl_data->sensor_idx[i] == SRA_IDX) {
info.sensor_idx = cl_data->sensor_idx[i];
writel(0, privdata->mmio + amd_get_p2c_val(privdata, 0));
@@ -145,8 +142,10 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata)
(privdata, cl_data->sensor_idx[i], ENABLE_SENSOR);
cl_data->sensor_sts[i] = (status == 0) ? SENSOR_ENABLED : SENSOR_DISABLED;
- if (cl_data->sensor_sts[i] == SENSOR_ENABLED)
+ if (cl_data->sensor_sts[i] == SENSOR_ENABLED) {
+ cl_data->is_any_sensor_enabled = true;
privdata->dev_en.is_sra_present = true;
+ }
continue;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v4 RESEND 2/2] HID: amd_sfh: Avoid clearing reports for SRA sensor
2025-04-21 21:32 [PATCH v4 RESEND 0/2] Fixes for SRA sensor handling Mario Limonciello
2025-04-21 21:32 ` [PATCH v4 RESEND 1/2] HID: amd_sfh: Fix SRA sensor when it's the only sensor Mario Limonciello
@ 2025-04-21 21:32 ` Mario Limonciello
2025-04-22 4:25 ` [PATCH v4 RESEND 0/2] Fixes for SRA sensor handling Basavaraj Natikar
2025-04-24 10:18 ` Jiri Kosina
3 siblings, 0 replies; 5+ messages in thread
From: Mario Limonciello @ 2025-04-21 21:32 UTC (permalink / raw)
To: Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires
Cc: open list, open list:AMD SENSOR FUSION HUB DRIVER,
Mario Limonciello, Basavaraj Natikar
From: Mario Limonciello <mario.limonciello@amd.com>
SRA sensor doesn't allocate any memory for reports. Skip
trying to clear memory for that sensor in cleanup path.
Suggested-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v4:
* One more case for amd_sfh_hid_client_deinit()
v3:
* Less changes as amd_sfh_hid_client_deinit() covers a lot
v2:
* New patch
---
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
index c1bdf1e0d44af..0a9b44ce4904e 100644
--- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
+++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
@@ -83,6 +83,9 @@ static int amd_sfh_hid_client_deinit(struct amd_mp2_dev *privdata)
case ALS_IDX:
privdata->dev_en.is_als_present = false;
break;
+ case SRA_IDX:
+ privdata->dev_en.is_sra_present = false;
+ break;
}
if (cl_data->sensor_sts[i] == SENSOR_ENABLED) {
@@ -237,6 +240,8 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata)
cleanup:
amd_sfh_hid_client_deinit(privdata);
for (i = 0; i < cl_data->num_hid_devices; i++) {
+ if (cl_data->sensor_idx[i] == SRA_IDX)
+ continue;
devm_kfree(dev, cl_data->feature_report[i]);
devm_kfree(dev, in_data->input_report[i]);
devm_kfree(dev, cl_data->report_descr[i]);
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v4 RESEND 0/2] Fixes for SRA sensor handling
2025-04-21 21:32 [PATCH v4 RESEND 0/2] Fixes for SRA sensor handling Mario Limonciello
2025-04-21 21:32 ` [PATCH v4 RESEND 1/2] HID: amd_sfh: Fix SRA sensor when it's the only sensor Mario Limonciello
2025-04-21 21:32 ` [PATCH v4 RESEND 2/2] HID: amd_sfh: Avoid clearing reports for SRA sensor Mario Limonciello
@ 2025-04-22 4:25 ` Basavaraj Natikar
2025-04-24 10:18 ` Jiri Kosina
3 siblings, 0 replies; 5+ messages in thread
From: Basavaraj Natikar @ 2025-04-22 4:25 UTC (permalink / raw)
To: Mario Limonciello, Basavaraj Natikar, Jiri Kosina,
Benjamin Tissoires
Cc: open list, open list:AMD SENSOR FUSION HUB DRIVER,
Mario Limonciello
On 4/22/2025 3:02 AM, Mario Limonciello wrote:
> From: Mario Limonciello <mario.limonciello@amd.com>
>
> On systems with an SRA sensor there are some problems with both init
> and failure paths. This series accounts for both.
>
> This is resend of V4 which ahsn't gotten any movement the past two
> weeks:
> Link: https://patchwork.kernel.org/project/linux-input/cover/20250407151835.1200867-1-superm1@kernel.org/
>
> Mario Limonciello (2):
> HID: amd_sfh: Fix SRA sensor when it's the only sensor
> HID: amd_sfh: Avoid clearing reports for SRA sensor
>
> drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
Looks good to me.
Acked-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Thanks,
--
Basavaraj
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 RESEND 0/2] Fixes for SRA sensor handling
2025-04-21 21:32 [PATCH v4 RESEND 0/2] Fixes for SRA sensor handling Mario Limonciello
` (2 preceding siblings ...)
2025-04-22 4:25 ` [PATCH v4 RESEND 0/2] Fixes for SRA sensor handling Basavaraj Natikar
@ 2025-04-24 10:18 ` Jiri Kosina
3 siblings, 0 replies; 5+ messages in thread
From: Jiri Kosina @ 2025-04-24 10:18 UTC (permalink / raw)
To: Mario Limonciello
Cc: Basavaraj Natikar, Benjamin Tissoires, open list,
open list:AMD SENSOR FUSION HUB DRIVER, Mario Limonciello
On Mon, 21 Apr 2025, Mario Limonciello wrote:
> From: Mario Limonciello <mario.limonciello@amd.com>
>
> On systems with an SRA sensor there are some problems with both init
> and failure paths. This series accounts for both.
>
> This is resend of V4 which ahsn't gotten any movement the past two
> weeks:
> Link: https://patchwork.kernel.org/project/linux-input/cover/20250407151835.1200867-1-superm1@kernel.org/
>
> Mario Limonciello (2):
> HID: amd_sfh: Fix SRA sensor when it's the only sensor
> HID: amd_sfh: Avoid clearing reports for SRA sensor
>
> drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
Sorry, I previously reponded to v1 by mistake. v4 has been applied.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-24 10:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-21 21:32 [PATCH v4 RESEND 0/2] Fixes for SRA sensor handling Mario Limonciello
2025-04-21 21:32 ` [PATCH v4 RESEND 1/2] HID: amd_sfh: Fix SRA sensor when it's the only sensor Mario Limonciello
2025-04-21 21:32 ` [PATCH v4 RESEND 2/2] HID: amd_sfh: Avoid clearing reports for SRA sensor Mario Limonciello
2025-04-22 4:25 ` [PATCH v4 RESEND 0/2] Fixes for SRA sensor handling Basavaraj Natikar
2025-04-24 10:18 ` Jiri Kosina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).