From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: arnd@arndb.de, gregkh@linuxfoundation.org
Cc: ulf.hansson@linaro.org, stern@rowland.harvard.edu,
bauer.chen@realtek.com, ricky_wu@realtek.com,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
Kai-Heng Feng <kai.heng.feng@canonical.com>
Subject: [1/5] misc: rtsx_usb: Use USB remote wakeup signaling for card insertion detection
Date: Mon, 23 Jul 2018 18:27:40 +0800 [thread overview]
Message-ID: <20180723102744.15140-2-kai.heng.feng@canonical.com> (raw)
Although rtsx_usb doesn't support card removal detection, card insertion
will resume rtsx_usb by USB remote wakeup signaling.
When rtsx_usb gets resumed, also resumes its child devices,
rtsx_usb_sdmmc and rtsx_usb_ms, to notify them there's a card in its
slot.
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
drivers/misc/cardreader/rtsx_usb.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/misc/cardreader/rtsx_usb.c b/drivers/misc/cardreader/rtsx_usb.c
index b97903ff1a72..fed83453e5c5 100644
--- a/drivers/misc/cardreader/rtsx_usb.c
+++ b/drivers/misc/cardreader/rtsx_usb.c
@@ -723,8 +723,20 @@ static int rtsx_usb_suspend(struct usb_interface *intf, pm_message_t message)
return 0;
}
+static int rtsx_usb_resume_child(struct device *dev, void *data)
+{
+ /* No need to wake up self again */
+ if (dev == data)
+ return 0;
+
+ dev_dbg(dev, "%s called\n", __func__);
+ pm_request_resume(dev);
+ return 0;
+}
+
static int rtsx_usb_resume(struct usb_interface *intf)
{
+ device_for_each_child(&intf->dev, &intf->dev, rtsx_usb_resume_child);
return 0;
}
@@ -734,6 +746,7 @@ static int rtsx_usb_reset_resume(struct usb_interface *intf)
(struct rtsx_ucr *)usb_get_intfdata(intf);
rtsx_usb_reset_chip(ucr);
+ device_for_each_child(&intf->dev, &intf->dev, rtsx_usb_resume_child);
return 0;
}
WARNING: multiple messages have this Message-ID (diff)
From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: arnd@arndb.de, gregkh@linuxfoundation.org
Cc: ulf.hansson@linaro.org, stern@rowland.harvard.edu,
bauer.chen@realtek.com, ricky_wu@realtek.com,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
Kai-Heng Feng <kai.heng.feng@canonical.com>
Subject: [PATCH 1/5] misc: rtsx_usb: Use USB remote wakeup signaling for card insertion detection
Date: Mon, 23 Jul 2018 18:27:40 +0800 [thread overview]
Message-ID: <20180723102744.15140-2-kai.heng.feng@canonical.com> (raw)
In-Reply-To: <20180723102744.15140-1-kai.heng.feng@canonical.com>
Although rtsx_usb doesn't support card removal detection, card insertion
will resume rtsx_usb by USB remote wakeup signaling.
When rtsx_usb gets resumed, also resumes its child devices,
rtsx_usb_sdmmc and rtsx_usb_ms, to notify them there's a card in its
slot.
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
drivers/misc/cardreader/rtsx_usb.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/misc/cardreader/rtsx_usb.c b/drivers/misc/cardreader/rtsx_usb.c
index b97903ff1a72..fed83453e5c5 100644
--- a/drivers/misc/cardreader/rtsx_usb.c
+++ b/drivers/misc/cardreader/rtsx_usb.c
@@ -723,8 +723,20 @@ static int rtsx_usb_suspend(struct usb_interface *intf, pm_message_t message)
return 0;
}
+static int rtsx_usb_resume_child(struct device *dev, void *data)
+{
+ /* No need to wake up self again */
+ if (dev == data)
+ return 0;
+
+ dev_dbg(dev, "%s called\n", __func__);
+ pm_request_resume(dev);
+ return 0;
+}
+
static int rtsx_usb_resume(struct usb_interface *intf)
{
+ device_for_each_child(&intf->dev, &intf->dev, rtsx_usb_resume_child);
return 0;
}
@@ -734,6 +746,7 @@ static int rtsx_usb_reset_resume(struct usb_interface *intf)
(struct rtsx_ucr *)usb_get_intfdata(intf);
rtsx_usb_reset_chip(ucr);
+ device_for_each_child(&intf->dev, &intf->dev, rtsx_usb_resume_child);
return 0;
}
--
2.17.1
next reply other threads:[~2018-07-23 10:27 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-23 10:27 Kai-Heng Feng [this message]
2018-07-23 10:27 ` [PATCH 1/5] misc: rtsx_usb: Use USB remote wakeup signaling for card insertion detection Kai-Heng Feng
-- strict thread matches above, loose matches on Subject: below --
2018-09-17 8:07 [1/5] " Kai-Heng Feng
2018-09-13 13:41 Alan Stern
2018-09-13 10:31 Kai-Heng Feng
2018-07-31 6:17 Kai-Heng Feng
2018-07-25 15:25 Kai-Heng Feng
2018-07-24 9:03 Kai-Heng Feng
2018-07-24 9:03 ` [PATCH 1/5] " Kai Heng Feng
2018-07-23 14:19 [1/5] " Alan Stern
2018-07-23 14:19 ` [PATCH 1/5] " Alan Stern
2018-07-23 10:27 [5/5] misc: rtsx_usb: / memstick: rtsx_usb_ms: Avoid long delay before system suspend Kai-Heng Feng
2018-07-23 10:27 ` [PATCH 5/5] " Kai-Heng Feng
2018-07-23 10:27 [4/5] memstick: rtsx_usb_ms: Support runtime power management Kai-Heng Feng
2018-07-23 10:27 ` [PATCH 4/5] " Kai-Heng Feng
2018-07-23 10:27 [3/5] memstick: rtsx_usb_ms: Use ms_dev() helper Kai-Heng Feng
2018-07-23 10:27 ` [PATCH 3/5] " Kai-Heng Feng
2018-07-23 10:27 [2/5] memstick: Prevent memstick host from getting runtime suspended during card detection Kai-Heng Feng
2018-07-23 10:27 ` [PATCH 2/5] " Kai-Heng Feng
2018-07-23 10:27 [PATCH 0/5 v2] Keep rtsx_usb suspended when there's no card Kai-Heng Feng
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=20180723102744.15140-2-kai.heng.feng@canonical.com \
--to=kai.heng.feng@canonical.com \
--cc=arnd@arndb.de \
--cc=bauer.chen@realtek.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=ricky_wu@realtek.com \
--cc=stern@rowland.harvard.edu \
--cc=ulf.hansson@linaro.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 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.