From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Mark Brown <broonie@kernel.org>
Cc: linuxarm@huawei.com, mauro.chehab@huawei.com,
John Stultz <john.stultz@linaro.org>,
Manivannan Sadhasivam <mani@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Liam Girdwood <lgirdwood@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC 09/10] misc: hisi_hikey_usb: add support for Hikey 970
Date: Fri, 4 Sep 2020 14:38:48 +0200 [thread overview]
Message-ID: <20200904143848.535d4c13@coco.lan> (raw)
In-Reply-To: <20200904122303.GC4625@sirena.org.uk>
Em Fri, 4 Sep 2020 13:23:03 +0100
Mark Brown <broonie@kernel.org> escreveu:
> On Fri, Sep 04, 2020 at 12:23:31PM +0200, Mauro Carvalho Chehab wrote:
>
> > + regulator = devm_regulator_get_optional(&pdev->dev, "hub-vdd");
> > + if (IS_ERR(regulator)) {
> > + if (PTR_ERR(regulator) == -EPROBE_DEFER) {
> > + dev_info(&pdev->dev,
> > + "waiting for hub-vdd-supply to be probed\n");
> > + return PTR_ERR(regulator);
> > + }
> > +
> > + /* let it fall back to regulator dummy */
> > + regulator = devm_regulator_get(&pdev->dev, "hub-vdd");
> > + if (IS_ERR(regulator)) {
> > + dev_err(&pdev->dev,
> > + "get hub-vdd-supply failed with error %ld\n",
> > + PTR_ERR(regulator));
> > + return PTR_ERR(regulator);
> > + }
> > + }
>
> This seems weird - if the supply is non-optional why is the code trying
> with devm_regulator_get_optional()? Just use normal get directly.
That's meant to avoid problems with EPROBE_DEFER.
See, Hikey 970 need to initialize 4 drivers for the regulators:
SPMI core, SPMI bus controller, MFD and regulator. This can take
some time. So, a first call to *regulator_get() may return
EPROBE_DEFER, specially if both regulator drivers and USB HUB
are builtin.
I ended doing the same as some other DRM drivers do (like adv7535).
> > + ret = regulator_set_voltage(regulator, 3300000, 3300000);
> > + if (ret)
> > + dev_err(&pdev->dev, "set hub-vdd-supply voltage failed\n");
>
> Unless the device is actively managing the voltage at runtime it should
> just let the voltage be set by machine constraints, most of the time
> this will do nothing. This only sets the voltage in this one place.
Ok, I'll drop this.
> > + hub_reset_en_gpio = of_get_named_gpio(pdev->dev.of_node,
> > + "hub_reset_en_gpio", 0);
> > + if (!gpio_is_valid(hub_reset_en_gpio)) {
> > + dev_err(&pdev->dev, "Failed to get a valid reset gpio\n");
> > + return -ENODEV;
> > + }
>
> Why not just use devm_gpio_request() which already asks for the GPIO by
> name?
Makes sense.
Thanks,
Mauro
next prev parent reply other threads:[~2020-09-04 12:39 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-04 10:23 [RFC 00/10] Add USB support for Hikey 970 Mauro Carvalho Chehab
2020-09-04 10:23 ` Mauro Carvalho Chehab
2020-09-04 10:23 ` [RFC 01/10] phy: hisilicon: add USB physical layer for Kirin 3670 Mauro Carvalho Chehab
2020-09-04 10:23 ` [RFC 02/10] phy: hisilicon: phy-hi3670-usb3: fix some issues at the init code Mauro Carvalho Chehab
2020-09-04 10:23 ` [RFC 03/10] phy: hisilicon: phy-hi3670-usb3: use a consistent namespace Mauro Carvalho Chehab
2020-09-09 20:15 ` Rob Herring
2020-09-10 5:37 ` Mauro Carvalho Chehab
2020-09-15 16:51 ` Rob Herring
2020-09-04 10:23 ` [RFC 04/10] phy: hisilicon: phy-hi3670-usb3: fix coding style Mauro Carvalho Chehab
2020-09-04 10:23 ` [RFC 05/10] phy: hisilicon: phy-hi3670-usb3: change some DT properties Mauro Carvalho Chehab
2020-09-04 10:23 ` [RFC 06/10] dt-bindings: phy: convert phy-kirin970-usb3.txt to yaml Mauro Carvalho Chehab
2020-09-04 10:23 ` [RFC 07/10] MAINTAINERS: add myself as maintainer for Kirin 970 USB PHY Mauro Carvalho Chehab
2020-09-04 10:23 ` [RFC 08/10] misc: hisi_hikey_usb: Driver to support onboard USB gpio hub on Hikey960 Mauro Carvalho Chehab
2020-09-04 12:53 ` Randy Dunlap
2020-09-04 10:23 ` [RFC 09/10] misc: hisi_hikey_usb: add support for Hikey 970 Mauro Carvalho Chehab
2020-09-04 12:23 ` Mark Brown
2020-09-04 12:38 ` Mauro Carvalho Chehab [this message]
2020-09-04 12:45 ` Mark Brown
2020-09-04 13:47 ` Mauro Carvalho Chehab
2020-09-04 10:23 ` [RFC 10/10] dts: hisilicon: add support for USB3 on " Mauro Carvalho Chehab
2020-09-04 10:23 ` Mauro Carvalho Chehab
2020-09-04 10:53 ` [RFC 00/10] Add USB support for " Robin Murphy
2020-09-04 10:53 ` Robin Murphy
2020-09-04 12:28 ` Mauro Carvalho Chehab
2020-09-04 12:28 ` Mauro Carvalho Chehab
2020-09-04 12:34 ` Mark Brown
2020-09-04 12:34 ` Mark Brown
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=20200904143848.535d4c13@coco.lan \
--to=mchehab+huawei@kernel.org \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=john.stultz@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mani@kernel.org \
--cc=mauro.chehab@huawei.com \
--cc=robin.murphy@arm.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.