LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: <balbi@kernel.org>, <gregkh@linuxfoundation.org>,
	<linux-usb@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <bjorn.andersson@linaro.org>,
	<jackp@codeaurora.org>, <robh@kernel.org>,
	Andy Gross <agross@kernel.org>, Lee Jones <lee.jones@linaro.org>,
	Philipp Zabel <p.zabel@pengutronix.de>, <mike.looijmans@topic.nl>
Subject: Re: [PATCH 6/7] usb: dwc3: Add support for a role-switch notifier
Date: Thu, 23 Jul 2020 10:13:54 +0200	[thread overview]
Message-ID: <20200723081352.hrg6rdpz5zxpp2so@axis.com> (raw)
In-Reply-To: <20200311191501.8165-7-bryan.odonoghue@linaro.org>

On Wed, Mar 11, 2020 at 07:15:00PM +0000, Bryan O'Donoghue wrote:
> diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
> index 2705871ec95e..789e93dd93b4 100644
> --- a/drivers/usb/dwc3/drd.c
> +++ b/drivers/usb/dwc3/drd.c
> @@ -497,6 +497,8 @@ static int dwc3_usb_role_switch_set(struct usb_role_switch *sw, enum usb_role ro
>  	}
>  
>  	dwc3_set_mode(dwc, mode);
> +	raw_notifier_call_chain(&dwc->role_sw_nl, mode, NULL);
> +
>  	return 0;
>  }

dwc3_set_mode() is called from a bunch of other places too, is it
sufficient to call the notifier only from here?  Also, dwc3_set_mode()
performs the mode set asynchronously so the mode switch can race with
this notifier call, is that OK?

Mike Looijmans proposed the control of a vbus regulator from
__dwc3_set_mode(), and that would take care of both the points above.
Perhaps this notifier call can be moved to the same place or perhaps
Mike's patch could even work for you?  The only problem is that your
switching code in dwc3-qcom.c would have to be modelled as a reulator:

 https://lore.kernel.org/linux-usb/20200619142512.19824-1-mike.looijmans@topic.nl/

  reply	other threads:[~2020-07-23  8:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11 19:14 [PATCH 0/7] DWC3/Qualcomm connector based role-switching Bryan O'Donoghue
2020-03-11 19:14 ` [PATCH 1/7] usb: dwc3: Registering a role switch in the DRD code Bryan O'Donoghue
2020-03-11 19:14 ` [PATCH 2/7] dt-bindings: usb: dwc3: Add a gpio-usb-connector example Bryan O'Donoghue
2020-03-19  1:08   ` Stephen Boyd
2020-03-19 15:22     ` Bryan O'Donoghue
2020-03-19 16:40       ` Stephen Boyd
2020-03-19 18:03         ` Bryan O'Donoghue
2020-03-19 20:30           ` Stephen Boyd
2020-03-11 19:14 ` [PATCH 3/7] dt-bindings: usb: dwc3: Add a usb-role-switch to the example Bryan O'Donoghue
2020-03-11 19:14 ` [PATCH 4/7] usb: dwc3: qcom: Add support for usb-conn-gpio connectors Bryan O'Donoghue
2020-03-11 19:14 ` [PATCH 5/7] usb: dwc3: " Bryan O'Donoghue
2020-03-11 19:15 ` [PATCH 6/7] usb: dwc3: Add support for a role-switch notifier Bryan O'Donoghue
2020-07-23  8:13   ` Vincent Whitchurch [this message]
2020-03-11 19:15 ` [PATCH 7/7] usb: dwc3: qcom: Enable gpio-usb-conn based role-switching Bryan O'Donoghue
2020-03-17  6:31   ` Bjorn Andersson
2020-03-17 15:22     ` Bryan O'Donoghue

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=20200723081352.hrg6rdpz5zxpp2so@axis.com \
    --to=vincent.whitchurch@axis.com \
    --cc=agross@kernel.org \
    --cc=balbi@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jackp@codeaurora.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mike.looijmans@topic.nl \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --subject='Re: [PATCH 6/7] usb: dwc3: Add support for a role-switch notifier' \
    /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

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).