From patchwork Fri Feb 28 16:31:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13996751 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27679271818; Fri, 28 Feb 2025 16:32:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740760337; cv=none; b=tyW6L0t/eZyai1WW3qGnsmBRZPZpJBKYasSQAHXizKhfdHEQyv8k6deH6jqWab+oJO2sn9/fdHk951yJ2J9HCv26z+/iiBJDytHh8ghUXuxDDpV7A/A8vnLNMtiCZl1VmifnswD5nJDBRDzcOQuxXlBRzRssDCo3zN4Xn186ZK0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740760337; c=relaxed/simple; bh=XQznFnMqsIPsXD0MBLr0vJJYuk07C8gbaiNgn/UDHTM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=udh23J6S83mEqtNPyZbwxJuCfjtT1/f/FSGH8I7ue5IRJY9AK1BzU4FdDogubwq6NBt5zkezPs7aZydfHxwqdOSpNWbRHXOmiV3ByGsby0eDL9kbf/67OO92OYAYRTY5WgqQfjdD/VqI1eozAil/K700z85GTTlwnpMblYCn5qE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=crKACkZT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="crKACkZT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3073C4CEE2; Fri, 28 Feb 2025 16:32:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740760335; bh=XQznFnMqsIPsXD0MBLr0vJJYuk07C8gbaiNgn/UDHTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=crKACkZTlKACFn1Zw3tj750Ml4XvQDH9aQtjwAzsup3+9gBaC6Vs5Gpn33ghp/ZUA 8eYgR/d/sJ9TaRHa9DfH4snimwYkPaX/kyfr4ZRB351okOne84VuDJhBzDevKsMYXB 2lesfdKxZNbh/8XygCQFGbRByQlwLaBjip3CRio9fzungxt708bfXUXntpqsHoxsWJ FC89qEEBi7jnYq2Xx4jW74LTBNrwhxuYDEXEHb2xmQjUensTx2LEuU3XSZbt5Csc90 4QA39mcXjNqcHROfKYx3A1lV/dYn6cxxq1h529pUVoNEFWLhPph3F7TDkCzGMmpubV h+EkYWeZbFL2w== From: Mario Limonciello To: Basavaraj Natikar , Jiri Kosina , Benjamin Tissoires Cc: linux-kernel@vger.kernel.org (open list), linux-input@vger.kernel.org (open list:AMD SENSOR FUSION HUB DRIVER), Mario Limonciello , Pratap Nirujogi , Anson Tsao Subject: [PATCH 1/3] HID: amd_sfh: Allow configuring whether HPD is enabled or disabled Date: Fri, 28 Feb 2025 10:31:51 -0600 Message-ID: <20250228163153.2554935-2-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250228163153.2554935-1-superm1@kernel.org> References: <20250228163153.2554935-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Mario Limonciello Human presence detection (HPD) sensor uses a camera to determine when user is physically in front of the machine. This might not be a desirable behavior because it can (for example) cause the machine to wake on approach. Add a new sysfs file "hpd" that will control whether this sensor is enabled. Use the value of this sysfs file to turn off HPD and prevent it from re-enabling after resume from suspend. Cc: Pratap Nirujogi Tested-by: Anson Tsao Signed-off-by: Mario Limonciello --- .../ABI/testing/sysfs-driver-amd-sfh | 13 +++++ drivers/hid/amd-sfh-hid/amd_sfh_common.h | 1 + drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 58 +++++++++++++++++++ drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 49 +++++++++++++++- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.h | 3 + 5 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-driver-amd-sfh diff --git a/Documentation/ABI/testing/sysfs-driver-amd-sfh b/Documentation/ABI/testing/sysfs-driver-amd-sfh new file mode 100644 index 0000000000000..c053126a83bb3 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-driver-amd-sfh @@ -0,0 +1,13 @@ +What: /sys/bus/pci/drivers/pcie_mp2_amd/*/hpd +Date: April 2025 +Contact: mario.limonciello@amd.com +Description: + Human presence detection (HPD) enable/disable. + When HPD is enabled, the device will be able to detect the + presence of a human and will send an interrupt that can be + used to wake the system from a low power state. + When HPD is disabled, the device will not be able to detect + the presence of a human. + + Access: Read/Write + Valid values: enabled/disabled diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_common.h b/drivers/hid/amd-sfh-hid/amd_sfh_common.h index 799b8686a88a4..f44a3bb2fbd4f 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_common.h +++ b/drivers/hid/amd-sfh-hid/amd_sfh_common.h @@ -42,6 +42,7 @@ struct amd_mp2_sensor_info { struct sfh_dev_status { bool is_hpd_present; + bool is_hpd_enabled; bool is_als_present; bool is_sra_present; }; diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c index 48cfd0c582414..1c1fd63330c93 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "amd_sfh_pcie.h" #include "sfh1_1/amd_sfh_init.h" @@ -330,6 +331,57 @@ static const struct dmi_system_id dmi_nodevs[] = { { } }; +static ssize_t hpd_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct amd_mp2_dev *mp2 = dev_get_drvdata(dev); + + return sysfs_emit(buf, "%s\n", str_enabled_disabled(mp2->dev_en.is_hpd_enabled)); +} + +static ssize_t hpd_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct amd_mp2_dev *mp2 = dev_get_drvdata(dev); + bool enabled; + int ret; + + ret = kstrtobool(buf, &enabled); + if (ret) + return ret; + + mp2->sfh1_1_ops->toggle_hpd(mp2, enabled); + + return count; +} +static DEVICE_ATTR_RW(hpd); + +static umode_t sfh_attr_is_visible(struct kobject *kobj, struct attribute *attr, int idx) +{ + struct device *dev = kobj_to_dev(kobj); + struct amd_mp2_dev *mp2 = dev_get_drvdata(dev); + + if (!mp2->sfh1_1_ops || !mp2->dev_en.is_hpd_present) + return 0; + + return attr->mode; +} + +static struct attribute *sfh_attrs[] = { + &dev_attr_hpd.attr, + NULL, +}; + +static struct attribute_group sfh_attr_group = { + .attrs = sfh_attrs, + .is_visible = sfh_attr_is_visible, +}; + +static const struct attribute_group *amd_sfh_groups[] = { + &sfh_attr_group, + NULL, +}; + static void sfh1_1_init_work(struct work_struct *work) { struct amd_mp2_dev *mp2 = container_of(work, struct amd_mp2_dev, work); @@ -341,6 +393,11 @@ static void sfh1_1_init_work(struct work_struct *work) amd_sfh_clear_intr(mp2); mp2->init_done = 1; + + rc = sysfs_update_group(&mp2->pdev->dev.kobj, &sfh_attr_group); + if (rc) + dev_warn(&mp2->pdev->dev, "failed to update sysfs group\n"); + } static void sfh_init_work(struct work_struct *work) @@ -487,6 +544,7 @@ static struct pci_driver amd_mp2_pci_driver = { .driver.pm = &amd_mp2_pm_ops, .shutdown = amd_sfh_shutdown, .remove = amd_sfh_remove, + .dev_groups = amd_sfh_groups, }; module_pci_driver(amd_mp2_pci_driver); 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 e9929c4aa72eb..fc9c297d0db7f 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 @@ -212,6 +212,7 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata) switch (cl_data->sensor_idx[i]) { case HPD_IDX: privdata->dev_en.is_hpd_present = true; + privdata->dev_en.is_hpd_enabled = true; break; case ALS_IDX: privdata->dev_en.is_als_present = true; @@ -255,6 +256,10 @@ static void amd_sfh_resume(struct amd_mp2_dev *mp2) } for (i = 0; i < cl_data->num_hid_devices; i++) { + /* leave HPD alone; policy is controlled by sysfs */ + if (cl_data->sensor_idx[i] == HPD_IDX) + continue; + if (cl_data->sensor_sts[i] == SENSOR_DISABLED) { info.sensor_idx = cl_data->sensor_idx[i]; mp2->mp2_ops->start(mp2, info); @@ -285,8 +290,10 @@ static void amd_sfh_suspend(struct amd_mp2_dev *mp2) } 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) { + /* leave HPD alone; policy is controlled by sysfs */ + if (cl_data->sensor_idx[i] == HPD_IDX) + continue; + if (cl_data->sensor_sts[i] == SENSOR_ENABLED) { mp2->mp2_ops->stop(mp2, cl_data->sensor_idx[i]); status = amd_sfh_wait_for_response (mp2, cl_data->sensor_idx[i], DISABLE_SENSOR); @@ -304,6 +311,44 @@ static void amd_sfh_suspend(struct amd_mp2_dev *mp2) amd_sfh_clear_intr(mp2); } +void amd_sfh_toggle_hpd(struct amd_mp2_dev *mp2, bool enabled) +{ + struct amdtp_cl_data *cl_data = mp2->cl_data; + struct amd_mp2_sensor_info info; + int i, status; + + if (mp2->dev_en.is_hpd_enabled == enabled) + return; + + for (i = 0; i < cl_data->num_hid_devices; i++) { + if (cl_data->sensor_idx[i] != HPD_IDX) + continue; + info.sensor_idx = cl_data->sensor_idx[i]; + if (enabled) { + mp2->mp2_ops->start(mp2, info); + status = amd_sfh_wait_for_response + (mp2, cl_data->sensor_idx[i], ENABLE_SENSOR); + if (status == 0) + status = SENSOR_ENABLED; + if (status == SENSOR_ENABLED) + cl_data->sensor_sts[i] = SENSOR_ENABLED; + } else { + mp2->mp2_ops->stop(mp2, cl_data->sensor_idx[i]); + status = amd_sfh_wait_for_response + (mp2, cl_data->sensor_idx[i], DISABLE_SENSOR); + if (status == 0) + status = SENSOR_DISABLED; + if (status != SENSOR_ENABLED) + cl_data->sensor_sts[i] = SENSOR_DISABLED; + } + dev_dbg(&mp2->pdev->dev, "toggle sid 0x%x (%s) status 0x%x\n", + cl_data->sensor_idx[i], get_sensor_name(cl_data->sensor_idx[i]), + cl_data->sensor_sts[i]); + break; + } + mp2->dev_en.is_hpd_enabled = enabled; +} + static void amd_mp2_pci_remove(void *privdata) { struct amd_mp2_dev *mp2 = privdata; diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.h b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.h index 21c44990bbeba..797d206641c69 100644 --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.h +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.h @@ -15,12 +15,15 @@ struct amd_sfh1_1_ops { int (*init)(struct amd_mp2_dev *mp2); + void (*toggle_hpd)(struct amd_mp2_dev *mp2, bool enable); }; int amd_sfh1_1_init(struct amd_mp2_dev *mp2); +void amd_sfh_toggle_hpd(struct amd_mp2_dev *mp2, bool enabled); static const struct amd_sfh1_1_ops __maybe_unused sfh1_1_ops = { .init = amd_sfh1_1_init, + .toggle_hpd = amd_sfh_toggle_hpd, }; #endif From patchwork Fri Feb 28 16:31:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13996750 X-Patchwork-Delegate: jikos@jikos.cz Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 276DF27604E; Fri, 28 Feb 2025 16:32:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740760337; cv=none; b=UPjX+/EbSSXHVmc9Dm8WWbHX/gkxMaVMU6cN2T9fqiQ2KAj6tG7BtEypyz5UMMhOOclLZ+Jf1tR+lvXVsq7s4fFhHMrlExARXuPrTzTvpnnLnp/aJ2P3IFRs8CtV1tH5UDn6kG9PAovgM0MXW9JrDguO7G4/+CmXjJon9vnis8Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740760337; c=relaxed/simple; bh=sxUFdcTRMYRjSUOo6wStxVXhp4EIP3blAGInOSQ/iV8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CyRbCKqbSfWXnXFWUtlpKpISOaEIgq8kT2fU7nyi8WvGQXitWliPc83UHwwXIp+pspRgMOZxJBbS4vo4c1VRDhDrfWIHsYYjsRckr1SKGXVyot8rSnPCc9WxbouQQmKPy9KCZ8wWDpOy/gyKKXePFcWPkqFJLdvYgttyJojOk88= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NEFPTTnm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NEFPTTnm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD9E7C4CEE5; Fri, 28 Feb 2025 16:32:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740760336; bh=sxUFdcTRMYRjSUOo6wStxVXhp4EIP3blAGInOSQ/iV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NEFPTTnmIl6sOcDg/OE1J0BUrVx0SC/D5+KiMu3nNKuuVNZR5SyyygzMTC4H6KnXH q241GJlgyY3fQkRU5yqLtq2kMjP0+iTtSJQ5KjodV8VUaNt56ruMHqZv4H8W12idCB KArCJPWM6qU6DQcI3wYrnV2Es3qoc1DYkP0lutlZYSYdCgIpyvB9fYgCEXUNvtzhE1 PDqXnTR/M5sY9YjKn8NLCMKW2wLXCgLZ5c+k5oGiT11ungHkIE7g7i7eTdHSjsh8db a4lZP35b4tKrMe/wlpQizJVgdaVBY0q3XU/mfIPiDxAsT9GGun/IK8JvA4712pEa5W OR5zlKZIw1gKQ== From: Mario Limonciello To: Basavaraj Natikar , Jiri Kosina , Benjamin Tissoires Cc: linux-kernel@vger.kernel.org (open list), linux-input@vger.kernel.org (open list:AMD SENSOR FUSION HUB DRIVER), Mario Limonciello , Pratap Nirujogi , Anson Tsao Subject: [PATCH 2/3] HID: amd_sfh: Default to HPD disabled Date: Fri, 28 Feb 2025 10:31:52 -0600 Message-ID: <20250228163153.2554935-3-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250228163153.2554935-1-superm1@kernel.org> References: <20250228163153.2554935-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Mario Limonciello Unless you know to look for it, HPD is a surprising behavior; particularly because it can wake the system from suspend. It also has implications for power consumption because sensors are left enabled. After the sensors have been probed (and HPD is found present), explicitly turn off HPD by default. Userspace can manually turn it on if desirable. Cc: Pratap Nirujogi Tested-by: Anson Tsao Signed-off-by: Mario Limonciello --- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 1 + 1 file changed, 1 insertion(+) 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 fc9c297d0db7f..25f0ebfcbd5f5 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 @@ -213,6 +213,7 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata) case HPD_IDX: privdata->dev_en.is_hpd_present = true; privdata->dev_en.is_hpd_enabled = true; + amd_sfh_toggle_hpd(privdata, false); break; case ALS_IDX: privdata->dev_en.is_als_present = true; From patchwork Fri Feb 28 16:31:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13996752 X-Patchwork-Delegate: jikos@jikos.cz Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 269F5277812; Fri, 28 Feb 2025 16:32:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740760339; cv=none; b=hBCx9sCohdrtJ8+Fad/SWWmsuGWTcBmJNkHzZmIhpsSbXPrvv4bBnIj1mZHDkfji9zB5TvuBY+V5W1xmbQteqiHyNk3cmFWdOthvJYoQ9I/F4QbqZ2R85ufSQs+2TTTnD0TaFLC3unHl8cOioJNhvM20CSsMAHe4hVs2DmGF+kg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740760339; c=relaxed/simple; bh=P/RcA4P+v+ljSl+5AN9FN5lP81wuZbneRs9Oo7I8WlQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uH9+56X35l5alpwl+eayAc+FlpEGXIZM8r0snYxcYmYSpVL/a6nl4p9M65H8chpEdjXiWYtWrncDno7z4FwicilhA5Tswd2DgxMS5Lb7pzPoNOtf/svr5rUfpkxGNJ8RpLPjGoKhtPij2ZZHfb4PB8+F1Ai/+6g3Bvu7n7dUGng= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mgygkE0c; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mgygkE0c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE9DEC4CED6; Fri, 28 Feb 2025 16:32:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740760337; bh=P/RcA4P+v+ljSl+5AN9FN5lP81wuZbneRs9Oo7I8WlQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mgygkE0cniB6CNWpyJm5orUa820AWr6Al74fOmB5Adv0DHZj4hMkEUM08Y2QU5wq+ xRm3tYzGsVSuA21y9YNLLypFfcoItSGIc2yrxbLlVXKIwapeE9yNJ7iiA0tfjLsraP /ze+vCzXmSmdt1aHE6D+fYt/1Ctd0AABzJrhtkETmZ2HHxmi/d34ssJ7ZlrgeuN/ht BhXp23mzTO+zCODQfqtbFVPXeQVdSGyAE2r5XJtfsYUI5Y3bDEaN1vFYpIGda6xn96 /9aJZGr3sbMi4et8+k0WkD0UTNpR/hkVmeb9YsphvaXMY1eHRmJl1tvQDnNbkU7iZO VKhRjsWJubk5Q== From: Mario Limonciello To: Basavaraj Natikar , Jiri Kosina , Benjamin Tissoires Cc: linux-kernel@vger.kernel.org (open list), linux-input@vger.kernel.org (open list:AMD SENSOR FUSION HUB DRIVER), Mario Limonciello , Pratap Nirujogi , Anson Tsao Subject: [PATCH 3/3] HID: amd_sfh: Don't show wrong status for amd_sfh_hpd_info() Date: Fri, 28 Feb 2025 10:31:53 -0600 Message-ID: <20250228163153.2554935-4-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250228163153.2554935-1-superm1@kernel.org> References: <20250228163153.2554935-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Mario Limonciello When HPD is present but has been disabled, avoid reporting HPD status to PMF. Cc: Pratap Nirujogi Tested-by: Anson Tsao Signed-off-by: Mario Limonciello --- 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 ffb98b4c36cbd..837d59e7a6610 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 @@ -129,7 +129,7 @@ static int amd_sfh_hpd_info(u8 *user_present) if (!user_present) return -EINVAL; - if (!emp2 || !emp2->dev_en.is_hpd_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));