From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, <linux-kernel@vger.kernel.org>,
Richard Fitzgerald <rf@opensource.cirrus.com>,
<patches@opensource.cirrus.com>
Subject: Re: [PATCH] regulator: wm831x: Convert to use GPIO descriptors
Date: Mon, 10 Jun 2019 16:59:19 +0100 [thread overview]
Message-ID: <20190610155919.GQ28362@ediswmail.ad.cirrus.com> (raw)
In-Reply-To: <20190609210025.29224-1-linus.walleij@linaro.org>
On Sun, Jun 09, 2019 at 11:00:25PM +0200, Linus Walleij wrote:
> This converts the Wolfson Micro WM831x DCDC converter to use
> a GPIO descriptor for the GPIO driving the DVS pin.
>
> There is just one (non-DT) machine in the kernel using this, and
> that is the Wolfson Micro (now Cirrus) Cragganmore 6410 so we
> patch this board to pass a descriptor table and fix up the driver
> accordingly.
>
> Cc: Charles Keepax <ckeepax@opensource.cirrus.com>
> Cc: Richard Fitzgerald <rf@opensource.cirrus.com>
> Cc: patches@opensource.cirrus.com
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> +/*
> + * VDDARM is eventually ending up as a regulator hanging on the MFD cell device
> + * "wm831x-buckv.1" spawn from drivers/mfd/wm831x-core.c.
> + *
> + * From the note on the platform data we can see that this is clearly DVS1
> + * and assigned as dcdc1 resource to the MFD core which sets .id of the cell
> + * spawning the DVS1 platform device to 1, resulting in the device name
> + * "wm831x-buckv.1".
> + */
> +static struct gpiod_lookup_table crag_pmic_gpiod_table = {
> + .dev_id = "wm831x-buckv.1",
This is not correct, the mfd_add_devices in wm831x-core passes an
ID to the MFD core. Which is calculated from wm831x_num * 10,
taken from the pdata. So this should be "wm831x-buckv.11".
> + .table = {
> + GPIO_LOOKUP("GPIOK", 0, "dvs", GPIO_ACTIVE_HIGH),
> + { },
> + },
> +};
> +
<snip>
> - ret = devm_gpio_request_one(&pdev->dev, pdata->dvs_gpio,
> - dcdc->dvs_gpio_state ? GPIOF_INIT_HIGH : 0,
> - "DCDC DVS");
> - if (ret < 0) {
> - dev_err(wm831x->dev, "Failed to get %s DVS GPIO: %d\n",
> - dcdc->name, ret);
> + dcdc->dvs_gpiod = devm_gpiod_get_optional(&pdev->dev, "dvs",
> + dcdc->dvs_gpio_state ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW);
> + if (IS_ERR(dcdc->dvs_gpiod)) {
> + dev_err(wm831x->dev, "Failed to get %s DVS GPIO: %ld\n",
> + dcdc->name, PTR_ERR(dcdc->dvs_gpiod));
> return;
> }
>
Whats the thinking behind using get_optional here? A plain
devm_gpiod_get looks like it would be closer to the original
code. Previously if there was no GPIO we would log an error and
not execute the rest of the function, this is I think no longer
the case after this change.
Thanks,
Charles
prev parent reply other threads:[~2019-06-10 15:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-09 21:00 [PATCH] regulator: wm831x: Convert to use GPIO descriptors Linus Walleij
2019-06-10 15:59 ` Charles Keepax [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=20190610155919.GQ28362@ediswmail.ad.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=rf@opensource.cirrus.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox