linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@oss.nxp.com>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>,
	jun.li@nxp.com, Ulf Hansson <ulf.hansson@linaro.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Pavel Machek <pavel@kernel.org>,
	Peter Chen <peter.chen@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org, imx@lists.linux.dev,
	arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 2/3] usb: chipidea: ci_hdrc_imx: Set out of band wakeup for i.MX95
Date: Wed, 20 Aug 2025 00:21:33 +0800	[thread overview]
Message-ID: <20250819162133.GA18601@nxa18884-linux.ap.freescale.net> (raw)
In-Reply-To: <zdzpddjjdj2ezkkfh5jjnnjvkvu4gb6vqmhkdlnnc2ioamvcuk@ftmezbyxrhfb>

On Wed, Aug 06, 2025 at 05:28:08PM +0800, Xu Yang wrote:
>Hi Peng,
>
>On Fri, Aug 01, 2025 at 12:34:23PM +0800, Peng Fan wrote:
>> i.MX95 USB2 inside HSIOMIX could still wakeup Linux, even if HSIOMIX
>> power domain(Digital logic) is off. There is still always on logic
>> have the wakeup capability which is out band wakeup capbility.
>> 
>> So use device_set_out_band_wakeup for i.MX95 to make sure usb2 could
>> wakeup system even if HSIOMIX power domain is in off state.
>> 
>> Signed-off-by: Peng Fan <peng.fan@nxp.com>
>> ---
>>  drivers/usb/chipidea/ci_hdrc_imx.c | 8 ++++++++
>>  include/linux/usb/chipidea.h       | 1 +
>>  2 files changed, 9 insertions(+)
>> 
>> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
>> index e1ec9b38f5b9ba0568101b51fbf16b99461b6ee2..7a3360d8a0fd065394393de829108a12c27c85b9 100644
>> --- a/drivers/usb/chipidea/ci_hdrc_imx.c
>> +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
>> @@ -79,6 +79,10 @@ static const struct ci_hdrc_imx_platform_flag imx8ulp_usb_data = {
>>  		CI_HDRC_HAS_PORTSC_PEC_MISSED,
>>  };
>>  
>> +static const struct ci_hdrc_imx_platform_flag imx95_usb_data = {
>> +	.flags = CI_HDRC_SUPPORTS_RUNTIME_PM | CI_HDRC_OUT_BAND_WAKEUP,
>> +};
>> +
>>  static const struct ci_hdrc_imx_platform_flag s32g_usb_data = {
>>  	.flags = CI_HDRC_DISABLE_HOST_STREAMING,
>>  };
>> @@ -94,6 +98,7 @@ static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
>>  	{ .compatible = "fsl,imx7d-usb", .data = &imx7d_usb_data},
>>  	{ .compatible = "fsl,imx7ulp-usb", .data = &imx7ulp_usb_data},
>>  	{ .compatible = "fsl,imx8ulp-usb", .data = &imx8ulp_usb_data},
>> +	{ .compatible = "fsl,imx95-usb", .data = &imx95_usb_data},
>>  	{ .compatible = "nxp,s32g2-usb", .data = &s32g_usb_data},
>>  	{ /* sentinel */ }
>>  };
>> @@ -569,6 +574,9 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
>>  
>>  	device_set_wakeup_capable(dev, true);
>>  
>> +	if (pdata.flags & CI_HDRC_OUT_BAND_WAKEUP)
>> +		device_set_out_band_wakeup(dev, true);
>> +
>
>In current design, ci_hdrc_imx_probe() will create another platform
>device B which will be a child of current device A. Furthermore, device
>A and device B will attached to a same power domain. In this case, some
>conflict setting may happen. For example, if the user wants to enable
>wakeup for this USB port, they may echo "enabled" to wakeup file for
>both device A and device B as before. As a result, device A is out
>band wakeup so it doesn't depend on power domain on, but device B has
>also enabled wakeup so the power domain will keep on finally. Actually,
>the power domain needs to be off for imx95.
>
>So I think only letting the parent device A itself attach to power domain
>should be enough. If it's the right way, then below change needs to be
>included to avoid potential misbehavior.

Thanks for looking into this.
Just detaching the power domain may break others. I think the better one
should be:

if (device_get_out_band_wakeup(dev))
	device_set_out_band_wakeup(&pdev->dev);

Regards,
Peng
>
>diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
>index 694b4a8e4e1d..c2ca81fe5e09 100644
>--- a/drivers/usb/chipidea/core.c
>+++ b/drivers/usb/chipidea/core.c
>@@ -915,6 +915,8 @@ struct platform_device *ci_hdrc_add_device(struct device *dev,
>        if (ret)
>                goto err;
>
>+       dev_pm_domain_detach(&pdev->dev, false);

I think the 

>+
>        return pdev;
>
>Thanks,
>Xu Yang
>
>>  	return 0;
>>  
>>  disable_device:
>> diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
>> index e17ebeee24e3ecc4b1c2d153d9ea9b656b5a3d35..c6451191d2de68607a9380482701d11f949d0ff7 100644
>> --- a/include/linux/usb/chipidea.h
>> +++ b/include/linux/usb/chipidea.h
>> @@ -66,6 +66,7 @@ struct ci_hdrc_platform_data {
>>  #define CI_HDRC_HAS_PORTSC_PEC_MISSED	BIT(17)
>>  #define CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS	BIT(18)
>>  #define	CI_HDRC_HAS_SHORT_PKT_LIMIT	BIT(19)
>> +#define	CI_HDRC_OUT_BAND_WAKEUP		BIT(20)
>>  	enum usb_dr_mode	dr_mode;
>>  #define CI_HDRC_CONTROLLER_RESET_EVENT		0
>>  #define CI_HDRC_CONTROLLER_STOPPED_EVENT	1
>> 
>> -- 
>> 2.37.1
>> 

  reply	other threads:[~2025-08-19 15:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-01  4:34 [PATCH v2 0/3] pmdomain: core: Introduce device_set/get_out_band_wakeup Peng Fan
2025-08-01  4:34 ` [PATCH v2 1/3] pmdomain: core: Introduce device_set/get_out_band_wakeup() Peng Fan
2025-08-22  5:22   ` Peng Fan
2025-08-01  4:34 ` [PATCH v2 2/3] usb: chipidea: ci_hdrc_imx: Set out of band wakeup for i.MX95 Peng Fan
2025-08-06  9:28   ` Xu Yang
2025-08-19 16:21     ` Peng Fan [this message]
2025-08-25  5:58       ` Xu Yang
2025-08-01  4:34 ` [PATCH v2 3/3] usb: dwc3: imx8mp: " Peng Fan
2025-08-05 23:40   ` Thinh Nguyen

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=20250819162133.GA18601@nxa18884-linux.ap.freescale.net \
    --to=peng.fan@oss.nxp.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=arm-scmi@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=imx@lists.linux.dev \
    --cc=jun.li@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=lenb@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=peter.chen@kernel.org \
    --cc=rafael@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=vincent.guittot@linaro.org \
    --cc=xu.yang_2@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).