[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e63ee918-c9e3-a8ee-e7c5-577b5a3e09be@topic.nl>
Date: Sun, 26 Jul 2020 09:10:39 +0200
From: Mike Looijmans <mike.looijmans@...ic.nl>
To: Mark Brown <broonie@...nel.org>,
Vincent Whitchurch <vincent.whitchurch@...s.com>
CC: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
balbi@...nel.org, gregkh@...uxfoundation.org, lgirdwood@...il.com
Subject: Re: [PATCH v3] usb: dwc3: Add support for VBUS power control
Met vriendelijke groet / kind regards,
Mike Looijmans
System Expert
TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands
T: +31 (0) 499 33 69 69
E: mike.looijmans@...icproducts.com
W: www.topicproducts.com
Please consider the environment before printing this e-mail
On 23-07-2020 13:05, Mark Brown wrote:
> On Thu, Jul 23, 2020 at 09:56:14AM +0200, Vincent Whitchurch wrote:
>> On Fri, Jun 19, 2020 at 04:25:12PM +0200, Mike Looijmans wrote:
>>> +void dwc3_set_vbus(struct dwc3 *dwc, bool enable)
>>> +{
>>> + int ret;
>>> +
>>> + if (enable != dwc->vbus_reg_enabled) {
>>> + if (enable)
>>> + ret = regulator_enable(dwc->vbus_reg);
>>> + else
>>> + ret = regulator_disable(dwc->vbus_reg);
>
>> dwc->vbus_reg is set to NULL when the regulator is not present. These
>> regulator_* functions expect a non-NULL pointer so a NULL check is
>> required before calling them.
> Does the device actually support running without power so that's a thing
> that can happen? _get_optional() should only ever be used for supplies
> that may be physically absent.
It's the 5V VBUS power for the USB "plug" that's being controlled here.
It must turned on when the controller is in "host" mode. Some boards
arrange this in hardware through the PHY, and some just don't have any
control at all and have it permanently on or off. On a board where the
5V is controlled using a GPIO line or an I2C chip, this patch is
required to make it work.
--
Mike Looijmans
Powered by blists - more mailing lists