Re: [PATCH 10/19 v3] regulator: s2mps11: Pass descriptor instead of GPIO number
From: Bartlomiej Zolnierkiewicz
Date: Mon May 28 2018 - 07:29:24 EST
Hi Linus,
On Monday, May 28, 2018 10:41:31 AM Linus Walleij wrote:
> On Sat, May 26, 2018 at 12:02 PM, Mark Brown <broonie@xxxxxxxxxx> wrote:
> > On Mon, May 14, 2018 at 10:06:31AM +0200, Linus Walleij wrote:
> >> Instead of passing a global GPIO number for the enable GPIO, pass
> >> a descriptor looked up with the standard devm_gpiod_get_optional()
> >> call.
> >>
> >> This regulator supports passing platform data, but enable/sleep
> >> regulators are looked up from the device tree exclusively, so
> >> we can need not touch other files.
> >
> > This seems to have broken the boot on Odroid XU3 so I'm going to revert
> > it:
> >
> > https://storage.kernelci.org/next/master/v4.17-rc6-9523-g47b9cef0672d/arm/multi_v7_defconfig/lab-baylibre-seattle/boot-exynos5422-odroidxu3.html
>
> How annoying. I will check with a colleague who might have this
> board so I can test it on hardware.
I've reproduced the problem on TM2e board and the patch below fixes
it (old code always initialized the structure, new code does it only
in case GPIO properties are provided).
I've also tested the new code (with fixup) on Artik5 board (which
actually uses GPIO properties) and discovered the other problem,
the GPIO core code doesn't handle shared GPIOs which are used by
many platforms.
Old code:
[ 1.094950] s2mps11-pmic s2mps14-regulator: Using GPIO 21 for ext-control over 10/LDO11
[ 1.095210] s2mps11-pmic s2mps14-regulator: Using GPIO 21 for ext-control over 11/LDO12
New code (with fixup):
[ 1.114288] s2mps11-pmic s2mps14-regulator: Using GPIO for ext-control over 10/LDO11
[ 1.143209] s2mps11-pmic s2mps14-regulator: Failed to get control GPIO for 11/LDO12
[ It fails with -EBUSY on gpiod_request() in gpiod_get_from_of_node(). ]
Therefore it seems that more work is needed before s2mps11 driver
can be converted to use GPIO descriptors.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Index: b/drivers/regulator/s2mps11.c
===================================================================
--- a/drivers/regulator/s2mps11.c 2018-05-28 10:53:58.121322472 +0200
+++ b/drivers/regulator/s2mps11.c 2018-05-28 11:33:38.613382421 +0200
@@ -1147,7 +1147,7 @@ static int s2mps11_pmic_probe(struct pla
return -EINVAL;
}
- s2mps11->ext_control_gpiod = devm_kmalloc(&pdev->dev,
+ s2mps11->ext_control_gpiod = devm_kzalloc(&pdev->dev,
sizeof(*s2mps11->ext_control_gpiod) * rdev_num,
GFP_KERNEL);
if (!s2mps11->ext_control_gpiod)