All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, grzegorz.alibozek@gmail.com,
	bastian@rieck.me, andrew.co@free.fr, meven29@gmail.com,
	pchernik@gmail.com, jorge.cep.mart@gmail.com,
	danielmorgan@disroot.org, bernie@codewiz.org,
	saipavanchitta1998@gmail.com, rubin@starset.net,
	maniette@gmail.com, nate@kde.org
Subject: [RFC PATCH 2/2] usb: typec: ucsi: acpi: Add PM hooks
Date: Wed,  7 Sep 2022 14:56:26 +0300	[thread overview]
Message-ID: <20220907115626.21976-3-heikki.krogerus@linux.intel.com> (raw)
In-Reply-To: <20220907115626.21976-1-heikki.krogerus@linux.intel.com>

Some systems notify the driver separately after resume if
the state of the connection changed during suspend, but
there is no way we can rely on that.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=210425
Fixes: a94ecde41f7e ("usb: typec: ucsi: ccg: enable runtime pm support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/typec/ucsi/ucsi_acpi.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
index 8873c1644a295..8c7008cc9942e 100644
--- a/drivers/usb/typec/ucsi/ucsi_acpi.c
+++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
@@ -185,6 +185,20 @@ static int ucsi_acpi_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static int ucsi_acpi_suspend(struct device *dev)
+{
+	return 0;
+}
+
+static int ucsi_acpi_resume(struct device *dev)
+{
+	struct ucsi_acpi *ua = dev_get_drvdata(dev);
+
+	return ucsi_resume(ua->ucsi);
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(ucsi_acpi_pm_ops, ucsi_acpi_suspend, ucsi_acpi_resume);
+
 static const struct acpi_device_id ucsi_acpi_match[] = {
 	{ "PNP0CA0", 0 },
 	{ },
@@ -194,6 +208,7 @@ MODULE_DEVICE_TABLE(acpi, ucsi_acpi_match);
 static struct platform_driver ucsi_acpi_platform_driver = {
 	.driver = {
 		.name = "ucsi_acpi",
+		.pm = pm_ptr(&ucsi_acpi_pm_ops),
 		.acpi_match_table = ACPI_PTR(ucsi_acpi_match),
 	},
 	.probe = ucsi_acpi_probe,
-- 
2.35.1


  parent reply	other threads:[~2022-09-07 11:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-07 11:56 [RFC PATCH 0/2] usb: typec: ucsi: Check connection on resume Heikki Krogerus
2022-09-07 11:56 ` [RFC PATCH 1/2] usb: typec: ucsi: Check the " Heikki Krogerus
2022-09-07 11:56 ` Heikki Krogerus [this message]
2022-09-07 21:33 ` [RFC PATCH 0/2] usb: typec: ucsi: Check " Grzegorz Alibożek
2022-09-08  5:01 ` Bastian Rieck
2022-09-09  6:22   ` Heikki Krogerus
2022-09-16 10:46     ` Heikki Krogerus
2022-10-07 10:00       ` Bastian Rieck
2022-10-07 10:04         ` Heikki Krogerus

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=20220907115626.21976-3-heikki.krogerus@linux.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=andrew.co@free.fr \
    --cc=bastian@rieck.me \
    --cc=bernie@codewiz.org \
    --cc=danielmorgan@disroot.org \
    --cc=grzegorz.alibozek@gmail.com \
    --cc=jorge.cep.mart@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=maniette@gmail.com \
    --cc=meven29@gmail.com \
    --cc=nate@kde.org \
    --cc=pchernik@gmail.com \
    --cc=rubin@starset.net \
    --cc=saipavanchitta1998@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.