* [PATCH 0/3] Fixes and updates to amd-sfh
@ 2024-05-07 7:10 Basavaraj Natikar
2024-05-07 7:10 ` [PATCH 1/3] HID: amd_sfh: Modify and log error only if case of functionality failures Basavaraj Natikar
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Basavaraj Natikar @ 2024-05-07 7:10 UTC (permalink / raw)
To: jikos, benjamin.tissoires, linux-input; +Cc: patreddy, Basavaraj Natikar
This patch series include changes for:
- Modify and log errors based on functionality.
- Handle "no sensors" exists in PM operations.
- Use amd_get_c2p_val() to read the C2P register for compatibility.
Basavaraj Natikar (3):
HID: amd_sfh: Modify and log error only if case of functionality
failures
HID: amd_sfh: Handle "no sensors" in PM operations
HID: amd_sfh: Use amd_get_c2p_val() to read C2P register
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 5 +----
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 17 ++++++++++++++---
.../hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c | 2 +-
3 files changed, 16 insertions(+), 8 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] HID: amd_sfh: Modify and log error only if case of functionality failures
2024-05-07 7:10 [PATCH 0/3] Fixes and updates to amd-sfh Basavaraj Natikar
@ 2024-05-07 7:10 ` Basavaraj Natikar
2024-05-07 7:10 ` [PATCH 2/3] HID: amd_sfh: Handle "no sensors" in PM operations Basavaraj Natikar
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Basavaraj Natikar @ 2024-05-07 7:10 UTC (permalink / raw)
To: jikos, benjamin.tissoires, linux-input; +Cc: patreddy, Basavaraj Natikar
Modify log messages, but only log errors when sensors are missing or a
true failure occurs to avoid misleading "failed" messages.
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 5 +----
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 7 ++++---
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index 9e97c26c4482..0c28ca349bcd 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -333,14 +333,11 @@ static const struct dmi_system_id dmi_nodevs[] = {
static void sfh1_1_init_work(struct work_struct *work)
{
struct amd_mp2_dev *mp2 = container_of(work, struct amd_mp2_dev, work);
- struct pci_dev *pdev = mp2->pdev;
int rc;
rc = mp2->sfh1_1_ops->init(mp2);
- if (rc) {
- dev_err(&pdev->dev, "sfh1_1_init failed err %d\n", rc);
+ if (rc)
return;
- }
amd_sfh_clear_intr(mp2);
mp2->init_done = 1;
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 5b24d5f63701..f46f9c670c6b 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
@@ -202,7 +202,7 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata)
}
if (!cl_data->is_any_sensor_enabled) {
- dev_warn(dev, "Failed to discover, sensors not enabled is %d\n",
+ dev_warn(dev, "No sensor registered, sensors not enabled is %d\n",
cl_data->is_any_sensor_enabled);
rc = -EOPNOTSUPP;
goto cleanup;
@@ -320,7 +320,7 @@ int amd_sfh1_1_init(struct amd_mp2_dev *mp2)
memcpy_fromio(&binfo, mp2->vsbase, sizeof(struct sfh_base_info));
if (binfo.sbase.fw_info.fw_ver == 0 || binfo.sbase.s_list.sl.sensors == 0) {
- dev_dbg(dev, "failed to get sensors\n");
+ dev_dbg(dev, "No sensor registered\n");
return -EOPNOTSUPP;
}
dev_dbg(dev, "firmware version 0x%x\n", binfo.sbase.fw_info.fw_ver);
@@ -337,7 +337,8 @@ int amd_sfh1_1_init(struct amd_mp2_dev *mp2)
rc = amd_sfh1_1_hid_client_init(mp2);
if (rc) {
sfh_deinit_emp2();
- dev_err(dev, "amd_sfh1_1_hid_client_init failed\n");
+ if ((rc != -ENODEV) && (rc != -EOPNOTSUPP))
+ dev_err(dev, "amd_sfh1_1_hid_client_init failed\n");
return rc;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] HID: amd_sfh: Handle "no sensors" in PM operations
2024-05-07 7:10 [PATCH 0/3] Fixes and updates to amd-sfh Basavaraj Natikar
2024-05-07 7:10 ` [PATCH 1/3] HID: amd_sfh: Modify and log error only if case of functionality failures Basavaraj Natikar
@ 2024-05-07 7:10 ` Basavaraj Natikar
2024-05-07 7:10 ` [PATCH 3/3] HID: amd_sfh: Use amd_get_c2p_val() to read C2P register Basavaraj Natikar
2024-05-07 13:19 ` [PATCH 0/3] Fixes and updates to amd-sfh Jiri Kosina
3 siblings, 0 replies; 5+ messages in thread
From: Basavaraj Natikar @ 2024-05-07 7:10 UTC (permalink / raw)
To: jikos, benjamin.tissoires, linux-input; +Cc: patreddy, Basavaraj Natikar
Resume or suspend each sensor device based on the num_hid_devices.
Therefore, add a check to handle the special case where no sensors are
present.
Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality")
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 10 ++++++++++
1 file changed, 10 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 f46f9c670c6b..621793d92464 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
@@ -227,6 +227,11 @@ static void amd_sfh_resume(struct amd_mp2_dev *mp2)
struct amd_mp2_sensor_info info;
int i, status;
+ if (!cl_data->is_any_sensor_enabled) {
+ amd_sfh_clear_intr(mp2);
+ return;
+ }
+
for (i = 0; i < cl_data->num_hid_devices; i++) {
if (cl_data->sensor_sts[i] == SENSOR_DISABLED) {
info.sensor_idx = cl_data->sensor_idx[i];
@@ -252,6 +257,11 @@ static void amd_sfh_suspend(struct amd_mp2_dev *mp2)
struct amdtp_cl_data *cl_data = mp2->cl_data;
int i, status;
+ if (!cl_data->is_any_sensor_enabled) {
+ amd_sfh_clear_intr(mp2);
+ return;
+ }
+
for (i = 0; i < cl_data->num_hid_devices; i++) {
if (cl_data->sensor_idx[i] != HPD_IDX &&
cl_data->sensor_sts[i] == SENSOR_ENABLED) {
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] HID: amd_sfh: Use amd_get_c2p_val() to read C2P register
2024-05-07 7:10 [PATCH 0/3] Fixes and updates to amd-sfh Basavaraj Natikar
2024-05-07 7:10 ` [PATCH 1/3] HID: amd_sfh: Modify and log error only if case of functionality failures Basavaraj Natikar
2024-05-07 7:10 ` [PATCH 2/3] HID: amd_sfh: Handle "no sensors" in PM operations Basavaraj Natikar
@ 2024-05-07 7:10 ` Basavaraj Natikar
2024-05-07 13:19 ` [PATCH 0/3] Fixes and updates to amd-sfh Jiri Kosina
3 siblings, 0 replies; 5+ messages in thread
From: Basavaraj Natikar @ 2024-05-07 7:10 UTC (permalink / raw)
To: jikos, benjamin.tissoires, linux-input; +Cc: patreddy, Basavaraj Natikar
Newer processors support various MP2 register sets. Therefore, to ensure
compatibility and obtain C2P data, use the amd_get_c2p_val().
Co-developed-by: Patil Rajesh Reddy <patreddy@amd.com>
Signed-off-by: Patil Rajesh Reddy <patreddy@amd.com>
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c
index 2de2668a0277..4676f060da26 100644
--- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c
+++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c
@@ -97,7 +97,7 @@ static int amd_sfh_hpd_info(u8 *user_present)
if (!emp2 || !emp2->dev_en.is_hpd_present)
return -ENODEV;
- hpdstatus.val = readl(emp2->mmio + AMD_C2P_MSG(4));
+ hpdstatus.val = readl(emp2->mmio + amd_get_c2p_val(emp2, 4));
*user_present = hpdstatus.shpd.presence;
return 0;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] Fixes and updates to amd-sfh
2024-05-07 7:10 [PATCH 0/3] Fixes and updates to amd-sfh Basavaraj Natikar
` (2 preceding siblings ...)
2024-05-07 7:10 ` [PATCH 3/3] HID: amd_sfh: Use amd_get_c2p_val() to read C2P register Basavaraj Natikar
@ 2024-05-07 13:19 ` Jiri Kosina
3 siblings, 0 replies; 5+ messages in thread
From: Jiri Kosina @ 2024-05-07 13:19 UTC (permalink / raw)
To: Basavaraj Natikar; +Cc: benjamin.tissoires, linux-input, patreddy
On Tue, 7 May 2024, Basavaraj Natikar wrote:
> This patch series include changes for:
> - Modify and log errors based on functionality.
> - Handle "no sensors" exists in PM operations.
> - Use amd_get_c2p_val() to read the C2P register for compatibility.
>
> Basavaraj Natikar (3):
> HID: amd_sfh: Modify and log error only if case of functionality
> failures
> HID: amd_sfh: Handle "no sensors" in PM operations
> HID: amd_sfh: Use amd_get_c2p_val() to read C2P register
>
> drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 5 +----
> drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 17 ++++++++++++++---
> .../hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c | 2 +-
> 3 files changed, 16 insertions(+), 8 deletions(-)
Queued for 6.10, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-05-07 13:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-07 7:10 [PATCH 0/3] Fixes and updates to amd-sfh Basavaraj Natikar
2024-05-07 7:10 ` [PATCH 1/3] HID: amd_sfh: Modify and log error only if case of functionality failures Basavaraj Natikar
2024-05-07 7:10 ` [PATCH 2/3] HID: amd_sfh: Handle "no sensors" in PM operations Basavaraj Natikar
2024-05-07 7:10 ` [PATCH 3/3] HID: amd_sfh: Use amd_get_c2p_val() to read C2P register Basavaraj Natikar
2024-05-07 13:19 ` [PATCH 0/3] Fixes and updates to amd-sfh 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).