UPSTREAM: regulator: pwm: Adjust PWM config at probe time
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 14 Jun 2016 09:13:17 +0000 (11:13 +0200)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 6 Mar 2017 10:28:40 +0000 (18:28 +0800)
The PWM attached to a PWM regulator device might have been previously
configured by the bootloader.
Make sure the bootloader and linux config are in sync, and adjust the PWM
config if that's not the case.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit fd4f99c4c3ce8ccd9b8ea751afc614a7624ecef2)

Change-Id: I06abddddc4666cd6510b6317795931f282e44eb0
Signed-off-by: David Wu <david.wu@rock-chips.com>
drivers/regulator/pwm-regulator.c

index 666bc3bb52ef83790df5df9afab68306a39d766a..cb2f22c02469000de2eb9f94c67c0ef29cceef14 100644 (file)
@@ -316,11 +316,9 @@ static int pwm_regulator_probe(struct platform_device *pdev)
                return ret;
        }
 
-       /*
-        * FIXME: pwm_apply_args() should be removed when switching to the
-        * atomic PWM API.
-        */
-       pwm_apply_args(drvdata->pwm);
+       ret = pwm_adjust_config(drvdata->pwm);
+       if (ret)
+               return ret;
 
        regulator = devm_regulator_register(&pdev->dev,
                                            &drvdata->desc, &config);