Linux Input/HID development
 help / color / mirror / Atom feed
From: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
To: <jikos@kernel.org>, <benjamin.tissoires@redhat.com>,
	<linux-input@vger.kernel.org>
Cc: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Subject: [PATCH 4/7] HID: amd_sfh: Add support for shutdown operation
Date: Tue, 11 Apr 2023 21:40:27 +0530	[thread overview]
Message-ID: <20230411161030.909350-5-Basavaraj.Natikar@amd.com> (raw)
In-Reply-To: <20230411161030.909350-1-Basavaraj.Natikar@amd.com>

As soon as the system is booted after shutdown, the sensors may remain in
a weird state and fail to initialize. Therefore, all sensors should be
turned off during shutdown.

Fixes: 4f567b9f8141 ("SFH: PCIe driver to add support of AMD sensor fusion hub")
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index 47774b9ab3de..c936d6a51c0c 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -367,6 +367,14 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
 	return devm_add_action_or_reset(&pdev->dev, privdata->mp2_ops->remove, privdata);
 }
 
+static void amd_sfh_shutdown(struct pci_dev *pdev)
+{
+	struct amd_mp2_dev *mp2 = pci_get_drvdata(pdev);
+
+	if (mp2 && mp2->mp2_ops)
+		mp2->mp2_ops->stop_all(mp2);
+}
+
 static int __maybe_unused amd_mp2_pci_resume(struct device *dev)
 {
 	struct amd_mp2_dev *mp2 = dev_get_drvdata(dev);
@@ -401,6 +409,7 @@ static struct pci_driver amd_mp2_pci_driver = {
 	.id_table	= amd_mp2_pci_tbl,
 	.probe		= amd_mp2_pci_probe,
 	.driver.pm	= &amd_mp2_pm_ops,
+	.shutdown	= amd_sfh_shutdown,
 };
 module_pci_driver(amd_mp2_pci_driver);
 
-- 
2.25.1


  parent reply	other threads:[~2023-04-11 16:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11 16:10 [PATCH 0/7] Fixes to amd_sfh Basavaraj Natikar
2023-04-11 16:10 ` [PATCH 1/7] HID: amd_sfh: Correct the structure fields Basavaraj Natikar
2023-04-11 16:10 ` [PATCH 2/7] HID: amd_sfh: Correct the sensor enable and disable command Basavaraj Natikar
2023-04-11 16:10 ` [PATCH 3/7] HID: amd_sfh: Fix illuminance value Basavaraj Natikar
2023-04-11 16:10 ` Basavaraj Natikar [this message]
2023-04-11 16:10 ` [PATCH 5/7] HID: amd_sfh: Correct the stop all command Basavaraj Natikar
2023-04-11 16:10 ` [PATCH 6/7] HID: amd_sfh: Increase sensor command timeout for SFH1.1 Basavaraj Natikar
2023-04-11 16:10 ` [PATCH 7/7] HID: amd_sfh: Handle "no sensors" enabled " Basavaraj Natikar
2023-04-13 13:56 ` [PATCH 0/7] Fixes to amd_sfh Jiri Kosina

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=20230411161030.909350-5-Basavaraj.Natikar@amd.com \
    --to=basavaraj.natikar@amd.com \
    --cc=benjamin.tissoires@redhat.com \
    --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