diff options
author | Kever Yang <kever.yang@rock-chips.com> | 2018-02-09 10:45:12 +0800 |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2018-03-06 10:17:15 +0100 |
commit | 19f124d8295f17f23bc4b6d050f96b9d9d651d9f (patch) | |
tree | 98786edc92c4da9c871070bb6d1fcf7923c6da5a /drivers | |
parent | 9ffa4d12a850c6fb8b9b8f7d5fc31ac28633fcdb (diff) | |
download | u-boot-19f124d8295f17f23bc4b6d050f96b9d9d651d9f.zip u-boot-19f124d8295f17f23bc4b6d050f96b9d9d651d9f.tar.gz u-boot-19f124d8295f17f23bc4b6d050f96b9d9d651d9f.tar.bz2 |
pwm-backlight: make power-supply as option
Some pwm backlight may not need 'power-supply', let's make it as option
in pwm-backlight driver.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/pwm_backlight.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c index fbd7bf7..f40e57b 100644 --- a/drivers/video/pwm_backlight.c +++ b/drivers/video/pwm_backlight.c @@ -32,16 +32,18 @@ static int pwm_backlight_enable(struct udevice *dev) uint duty_cycle; int ret; - plat = dev_get_uclass_platdata(priv->reg); - debug("%s: Enable '%s', regulator '%s'/'%s'\n", __func__, dev->name, - priv->reg->name, plat->name); - ret = regulator_set_enable(priv->reg, true); - if (ret) { - debug("%s: Cannot enable regulator for PWM '%s'\n", __func__, - dev->name); - return ret; + if (priv->reg) { + plat = dev_get_uclass_platdata(priv->reg); + debug("%s: Enable '%s', regulator '%s'/'%s'\n", __func__, + dev->name, priv->reg->name, plat->name); + ret = regulator_set_enable(priv->reg, true); + if (ret) { + debug("%s: Cannot enable regulator for PWM '%s'\n", + __func__, dev->name); + return ret; + } + mdelay(120); } - mdelay(120); duty_cycle = priv->period_ns * (priv->default_level - priv->min_level) / (priv->max_level - priv->min_level + 1); @@ -68,10 +70,8 @@ static int pwm_backlight_ofdata_to_platdata(struct udevice *dev) debug("%s: start\n", __func__); ret = uclass_get_device_by_phandle(UCLASS_REGULATOR, dev, "power-supply", &priv->reg); - if (ret) { + if (ret) debug("%s: Cannot get power supply: ret=%d\n", __func__, ret); - return ret; - } ret = gpio_request_by_name(dev, "enable-gpios", 0, &priv->enable, GPIOD_IS_OUT); if (ret) { |