From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Felipe Balbi <balbi@kernel.org>
Cc: Peter Chen <peter.chen@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
agross@kernel.org, gregkh@linuxfoundation.org,
jackp@codeaurora.org, wcheng@codeaurora.org,
linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 0/3] Implement role-switch notifications from dwc3-drd to dwc3-qcom
Date: Wed, 25 Aug 2021 09:33:20 -0700 [thread overview]
Message-ID: <YSZw0LGNji8JvQUa@ripper> (raw)
In-Reply-To: <87mtp5a6ix.fsf@kernel.org>
On Wed 25 Aug 08:22 PDT 2021, Felipe Balbi wrote:
>
> Hi,
>
> Bjorn Andersson <bjorn.andersson@linaro.org> writes:
> >> Bjorn Andersson <bjorn.andersson@linaro.org> writes:
> >> > On Wed 07 Jul 20:06 PDT 2021, Peter Chen wrote:
> >> >
> >> >> On 21-07-07 14:03:19, Bjorn Andersson wrote:
> >> >> > On Tue 06 Jul 20:57 CDT 2021, Peter Chen wrote:
> >> >> >
> >> >> > Allow me to reorder your two questions:
> >> >> >
> >> >> > > And why using a notifier need to concern core's deferral probe?
> >> >> >
> >> >> > The problem at hand calls for the core for somehow invoking
> >> >> > dwc3_qcom_vbus_overrride_enable() with a pointer to dwc3_qcom passed.
> >> >> >
> >> >> > This means that dwc3-qcom somehow needs to inform the dwc3-core about
> >> >> > this (and stash the pointer). And this can't be done until dwc3-core
> >> >> > actually exist, which it won't until dwc3_probe() has completed
> >> >> > successfully (or in particular allocated struct dwc).
> >> >>
> >> >> Maybe you misunderstood the notifier I meant previous, my pointer was
> >> >> calling glue layer API directly.
> >> >>
> >> >> Role switch is from dwc3-core, when it occurs, it means structure dwc3 has
> >> >> allocated successfully, you could call glue layer notifier at function
> >> >> dwc3_usb_role_switch_set directly.
> >> >> Some references of my idea [1] [2]
> >> >>
> >> >> [1] Function ci_hdrc_msm_notify_event at ci_hdrc_msm_notify_event
> >> >> [2] https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/usb/dwc3/core.c?h=lf-5.10.y#n205
> >> >>
> >> >
> >> > Hi Peter, I took a proper look at this again, hoping to find a way to
> >> > pass a callback pointer from dwc3-qcom to the dwc3 core, that can be
> >> > called from __dwc3_set_mode() to inform the Qualcomm glue about mode
> >> > changes.
> >>
> >> I would rather keep the strict separation between glue and core.
> >>
> >
> > I'm okay with that goal, but the result is that both the OMAP and
> > Qualcomm driver duplicates the extcon interface already present in the
> > DRD, and the Meson driver duplicates the usb_role_switch. In addition to
> > the code duplication this manifest itself in the need for us to link
> > extcon to both the glue and core nodes in DeviceTree.
> >
> > In order to function in a USB-C based setup we now need to register a
> > usb_role_switch from the Qualcomm glue and we need to evolve the
> > usb_role_switch implementation to allow for the Type-C controller to
> > notify more than a single role-switcher.
> >
> > So we're facing the need to introduce another bunch of duplication and
> > the DT will be quite ugly with both glue and core having to set up an
> > of_graph with the Type-C controller.
> >
> >
> > I really would like for us to come up with a way where the core can
> > notify the glue that role switching is occurring, so that we instead of
> > adding more duplication could aim to, over time, remove the extcon and
> > usb_role_switch logic from the Qualcomm, OMAP and Meson drivers.
>
> We can make a comparison between clk rate notifiers. Anyone can
> subscribe to a clk rate notification and react to the notification. A
> generic dual role notification system should allow for something
> similar. I really don't get why folks want to treat a glue and core
> driver differently in this case.
>
> Why do we want to pass function pointers around instead of letting
> whatever role notification mechanism to be able to notify more than one
> user?
>
> Also keep in mind that we have dwc3 implementations which are dual role
> capable but don't ship the synopsys DRD block. Rather, there's a
> peripheral-only dwc3 instance and a separate xhci with custom logic
> handling role swap.
>
So you're suggesting that we invent a 3rd mechanism (in addition to the
already existing duplication between extcon and usb_role_switch) for
propagating role switching notifications through the kernel?
> If we were to provide a dwc3-specific role swap function-pointer based
> interface, we would just create yet another special case for this. A
> better approach would be to start consolidating all of these different
> role-swap mechanisms in a generic layer that "knows-it-all". If dwc3 is
> generating the role notification or a separate type-c controller or even
> some EC IRQ, that shouldn't matter for the listeners.
>
I was under the impression that usb_role_switch is the attempt to
replace extcon as the one solution. The problem in the dwc3 case is that
the same piece of hardware (i.e. _the_ USB controller) needs to
implement and wired up as two separate consumers of that message.
I recognize the complexity caused by the flexibility in DWC3 based
designs, but I would like to see whatever combination be seen as a
single entity to the rest of the system - rather than building the
notification plumbing between the two pieces using DeviceTree.
Regards,
Bjorn
prev parent reply other threads:[~2021-08-25 16:32 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-04 1:33 [PATCH 0/3] Implement role-switch notifications from dwc3-drd to dwc3-qcom Bryan O'Donoghue
2021-07-04 1:33 ` [PATCH 1/3] usb: dwc3: dwc3-qcom: Fix typo in the dwc3 vbus override API Bryan O'Donoghue
2021-07-07 5:06 ` Bjorn Andersson
2021-07-04 1:33 ` [PATCH 2/3] usb: dwc3: Add role switch relay support Bryan O'Donoghue
2021-07-06 2:51 ` Peter Chen
2021-07-06 10:07 ` Bryan O'Donoghue
2021-07-07 5:14 ` Bjorn Andersson
2021-07-07 9:49 ` Bryan O'Donoghue
2021-07-07 9:51 ` Bryan O'Donoghue
2021-07-04 1:33 ` [PATCH 3/3] usb: dwc3: dwc3-qcom: Make dwc3-qcom a role-switch signal recipient Bryan O'Donoghue
2021-07-07 1:57 ` [PATCH 0/3] Implement role-switch notifications from dwc3-drd to dwc3-qcom Peter Chen
2021-07-07 19:03 ` Bjorn Andersson
2021-07-08 3:06 ` Peter Chen
2021-07-08 3:54 ` Bjorn Andersson
2021-07-08 10:17 ` Bryan O'Donoghue
2021-08-24 23:52 ` Bjorn Andersson
2021-08-24 23:58 ` Bryan O'Donoghue
2021-08-25 0:01 ` Bjorn Andersson
2021-08-25 0:17 ` Bryan O'Donoghue
2021-08-24 23:37 ` Bjorn Andersson
2021-08-25 5:51 ` Felipe Balbi
2021-08-25 8:18 ` Bryan O'Donoghue
2021-08-25 15:53 ` Bjorn Andersson
2021-08-25 16:43 ` Heikki Krogerus
2021-08-25 17:04 ` Bjorn Andersson
2021-08-25 17:59 ` Bryan O'Donoghue
2021-08-25 20:06 ` Bjorn Andersson
2021-08-26 6:15 ` Felipe Balbi
2021-09-15 13:53 ` Bjorn Andersson
2021-09-17 12:33 ` Heikki Krogerus
2021-08-25 20:11 ` Dmitry Baryshkov
2021-08-25 12:12 ` Rob Herring
2021-08-25 15:20 ` Felipe Balbi
2021-08-25 13:16 ` Bjorn Andersson
2021-08-25 15:22 ` Felipe Balbi
2021-08-25 16:33 ` Bjorn Andersson [this message]
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=YSZw0LGNji8JvQUa@ripper \
--to=bjorn.andersson@linaro.org \
--cc=agross@kernel.org \
--cc=balbi@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=jackp@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=peter.chen@kernel.org \
--cc=robh+dt@kernel.org \
--cc=wcheng@codeaurora.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;
as well as URLs for NNTP newsgroup(s).