From: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
To: <jikos@kernel.org>, <bentiss@kernel.org>
Cc: <linux-input@vger.kernel.org>,
Basavaraj Natikar <Basavaraj.Natikar@amd.com>,
Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>
Subject: [PATCH 3/4] HID: amd_sfh: Add HPD support for new AMD SOC
Date: Wed, 2 Sep 2026 19:14:30 +0530 [thread overview]
Message-ID: <20260902134431.3146117-4-Basavaraj.Natikar@amd.com> (raw)
In-Reply-To: <20260902134431.3146117-1-Basavaraj.Natikar@amd.com>
Use HPD data from DRAM instead of reading from the C2P4 register
path in latest AMD SOC.
Co-developed-by: Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>
Signed-off-by: Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c | 13 +++++++++++--
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c | 14 ++++++++++++--
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h | 6 ++++++
3 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c
index c8916afefa62..b81a97dbb1b0 100644
--- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c
+++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c
@@ -187,6 +187,7 @@ static u8 get_input_rep(u8 current_index, int sensor_idx, int report_id,
struct sfh_gyro_data gyro_data;
struct sfh_mag_data mag_data;
struct sfh_als_data als_data;
+ struct sfh_hpd_data hpd_data;
struct hpd_status hpdstatus;
struct sfh_base_info binfo;
void __iomem *sensoraddr;
@@ -251,8 +252,16 @@ static u8 get_input_rep(u8 current_index, int sensor_idx, int report_id,
break;
case HPD_IDX:
get_common_inputs(&hpd_input.common_property, report_id);
- hpdstatus.val = readl(mp2->mmio + amd_get_c2p_val(mp2, 4));
- hpd_input.human_presence = hpdstatus.shpd.presence;
+ if (mp2->mp2_ver >= MP2_VER_1_2) {
+ sensoraddr = mp2->vsbase +
+ (HPD_IDX * SENSOR_DATA_MEM_SIZE_DEFAULT) +
+ OFFSET_SENSOR_DATA_DEFAULT;
+ memcpy_fromio(&hpd_data, sensoraddr, sizeof(struct sfh_hpd_data));
+ hpd_input.human_presence = hpd_data.status.shpd.presence;
+ } else {
+ hpdstatus.val = readl(mp2->mmio + amd_get_c2p_val(mp2, 4));
+ hpd_input.human_presence = hpdstatus.shpd.presence;
+ }
report_size = sizeof(hpd_input);
memcpy(input_report, &hpd_input, sizeof(hpd_input));
break;
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 60c185a9cd50..034ec237659a 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
@@ -160,7 +160,9 @@ static int amd_sfh_mode_info(u32 *platform_type, u32 *laptop_placement)
static int amd_sfh_hpd_info(u8 *user_present)
{
+ struct sfh_hpd_data hpd_data;
struct hpd_status hpdstatus;
+ void __iomem *sensoraddr;
if (!user_present)
return -EINVAL;
@@ -168,8 +170,16 @@ static int amd_sfh_hpd_info(u8 *user_present)
if (!emp2 || !emp2->dev_en.is_hpd_present || !emp2->dev_en.is_hpd_enabled)
return -ENODEV;
- hpdstatus.val = readl(emp2->mmio + amd_get_c2p_val(emp2, 4));
- *user_present = hpdstatus.shpd.presence;
+ if (emp2->mp2_ver >= MP2_VER_1_2) {
+ sensoraddr = emp2->vsbase +
+ (HPD_IDX * SENSOR_DATA_MEM_SIZE_DEFAULT) +
+ OFFSET_SENSOR_DATA_DEFAULT;
+ memcpy_fromio(&hpd_data, sensoraddr, sizeof(struct sfh_hpd_data));
+ *user_present = hpd_data.status.shpd.presence;
+ } else {
+ hpdstatus.val = readl(emp2->mmio + amd_get_c2p_val(emp2, 4));
+ *user_present = hpdstatus.shpd.presence;
+ }
return 0;
}
diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h
index 56258c4d1b3a..11c7a86ac52e 100644
--- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h
+++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h
@@ -165,6 +165,12 @@ struct hpd_status {
};
};
+struct sfh_hpd_data {
+ struct sfh_common_data commondata;
+ u32 reserved;
+ struct hpd_status status;
+};
+
struct sfh_op_mode {
union {
u32 val;
--
2.34.1
next prev parent reply other threads:[~2026-09-02 13:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 13:44 [PATCH 0/4] HID: amd_sfh: Add DMI quirk and support for new AMD SoCs Basavaraj Natikar
2026-09-02 13:44 ` [PATCH 1/4] HID: amd_sfh: Add DMI quirk and module param to disable interrupts Basavaraj Natikar
2026-09-02 13:54 ` sashiko-bot
2026-09-02 13:44 ` [PATCH 2/4] HID: amd_sfh: Add support for newer AMD SoCs Basavaraj Natikar
2026-09-02 13:44 ` Basavaraj Natikar [this message]
2026-09-02 14:02 ` [PATCH 3/4] HID: amd_sfh: Add HPD support for new AMD SOC sashiko-bot
2026-09-02 13:44 ` [PATCH 4/4] HID: amd_sfh: Add device mode support for latest " Basavaraj Natikar
2026-09-02 13:59 ` sashiko-bot
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=20260902134431.3146117-4-Basavaraj.Natikar@amd.com \
--to=basavaraj.natikar@amd.com \
--cc=Guruvendra.Punugupati@amd.com \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.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