All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jun Li <jun.li@nxp.com>
To: Felipe Balbi <balbi@kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "shawnguo@kernel.org" <shawnguo@kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>,
	"thunder.leizhen@huawei.com" <thunder.leizhen@huawei.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"heikki.krogerus@linux.intel.com"
	<heikki.krogerus@linux.intel.com>
Subject: RE: [PATCH] usb: dwc3: imx8mp: detect dwc3 core node via compatible string
Date: Fri, 7 May 2021 07:31:43 +0000	[thread overview]
Message-ID: <VI1PR04MB59354B7D5843B612D50937B589579@VI1PR04MB5935.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <87h7jggch0.fsf@kernel.org>

Hi

> -----Original Message-----
> From: Felipe Balbi <balbi@kernel.org>
> Sent: Thursday, May 6, 2021 10:32 PM
> To: Jun Li <jun.li@nxp.com>; gregkh@linuxfoundation.org
> Cc: shawnguo@kernel.org; dl-linux-imx <linux-imx@nxp.com>;
> thunder.leizhen@huawei.com; linux-usb@vger.kernel.org
> Subject: RE: [PATCH] usb: dwc3: imx8mp: detect dwc3 core node via compatible
> string
> 
> 
> Hi,
> 
> Jun Li <jun.li@nxp.com> writes:
> >> > 	val = readl(dwc3_imx->glue_base + USB_WAKEUP_CTRL);
> >> >
> >> > 	if ((dwc3->current_dr_role == DWC3_GCTL_PRTCAP_HOST) && dwc3->xhci)
> >> > 		val |= USB_WAKEUP_EN | USB_WAKEUP_SS_CONN |
> >> > 		       USB_WAKEUP_U3_EN | USB_WAKEUP_DPDM_EN;
> >> > 	else if (dwc3->current_dr_role == DWC3_GCTL_PRTCAP_DEVICE)
> >> > 		val |= USB_WAKEUP_EN | USB_WAKEUP_VBUS_EN |
> >> > 		       USB_WAKEUP_VBUS_SRC_SESS_VAL;
> >>
> >> for this, you could register a listener to the extcon notifier and
> >> update these bits accordingly. With that, you would already *know*
> >> that
> >> dwc3 is probed.
> >
> > With usb role switch class, there no extcon provider, so I think this
> > way can't work for me.
> 
> perhaps role switch class could learn about notifiers ;-)
> 
> >> > static irqreturn_t dwc3_imx8mp_interrupt(int irq, void *_dwc3_imx) {
> >> > 	struct dwc3_imx8mp	*dwc3_imx = _dwc3_imx;
> >> > 	struct dwc3		*dwc = platform_get_drvdata(dwc3_imx->dwc3);
> >> >
> >> > 	if (!dwc3_imx->pm_suspended)
> >> > 		return IRQ_HANDLED;
> >> >
> >> > 	disable_irq_nosync(dwc3_imx->irq);
> >> > 	dwc3_imx->wakeup_pending = true;
> >> >
> >> > 	if ((dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST) && dwc->xhci)
> >> > 		pm_runtime_resume(&dwc->xhci->dev);
> >> > 	else if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_DEVICE)
> >> > 		pm_runtime_get(dwc->dev);
> >> >
> >> > 	return IRQ_HANDLED;
> >> > }
> >>
> >> for this, maybe you need to teach dwc3 core about wakeup irqs
> >> instead. Have a look dev_pm_set_dedicated_wake_irq().
> >
> > Good suggestion, but if extcon notifier listener can't work for me, my
> > understanding is this *teach* in glue layer driver still need access
> > dwc3 core instance struct, right?
> 
> for now, maybe. But it may be better to implement a notifier method in role
> switch class.

I am not sure if introduce notifier in role switch class is a good idea,
I had the impression extcon is not encouraged to use if possible.

+ Heikki

Thanks
Li Jun

> 
> --
> balbi

  reply	other threads:[~2021-05-07  7:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30  6:57 [PATCH] usb: dwc3: imx8mp: detect dwc3 core node via compatible string Li Jun
2021-04-30  8:24 ` Felipe Balbi
2021-04-30  9:38   ` Jun Li
2021-04-30 10:00     ` Felipe Balbi
2021-05-06 11:28       ` Jun Li
2021-05-06 14:31         ` Felipe Balbi
2021-05-07  7:31           ` Jun Li [this message]
2021-05-11  7:59             ` Heikki Krogerus
2021-05-11  9:23               ` Jun Li
2021-05-11  9:26                 ` Felipe Balbi
2021-08-02  5:29                   ` Jun Li
2021-08-02  7:49                     ` Felipe Balbi
2021-08-02 10:43                       ` Jun Li

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=VI1PR04MB59354B7D5843B612D50937B589579@VI1PR04MB5935.eurprd04.prod.outlook.com \
    --to=jun.li@nxp.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-imx@nxp.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=thunder.leizhen@huawei.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.