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>
This commit is contained in:
parent
9ffa4d12a8
commit
19f124d829
@ -32,16 +32,18 @@ static int pwm_backlight_enable(struct udevice *dev)
|
|||||||
uint duty_cycle;
|
uint duty_cycle;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
plat = dev_get_uclass_platdata(priv->reg);
|
if (priv->reg) {
|
||||||
debug("%s: Enable '%s', regulator '%s'/'%s'\n", __func__, dev->name,
|
plat = dev_get_uclass_platdata(priv->reg);
|
||||||
priv->reg->name, plat->name);
|
debug("%s: Enable '%s', regulator '%s'/'%s'\n", __func__,
|
||||||
ret = regulator_set_enable(priv->reg, true);
|
dev->name, priv->reg->name, plat->name);
|
||||||
if (ret) {
|
ret = regulator_set_enable(priv->reg, true);
|
||||||
debug("%s: Cannot enable regulator for PWM '%s'\n", __func__,
|
if (ret) {
|
||||||
dev->name);
|
debug("%s: Cannot enable regulator for PWM '%s'\n",
|
||||||
return ret;
|
__func__, dev->name);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
mdelay(120);
|
||||||
}
|
}
|
||||||
mdelay(120);
|
|
||||||
|
|
||||||
duty_cycle = priv->period_ns * (priv->default_level - priv->min_level) /
|
duty_cycle = priv->period_ns * (priv->default_level - priv->min_level) /
|
||||||
(priv->max_level - priv->min_level + 1);
|
(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__);
|
debug("%s: start\n", __func__);
|
||||||
ret = uclass_get_device_by_phandle(UCLASS_REGULATOR, dev,
|
ret = uclass_get_device_by_phandle(UCLASS_REGULATOR, dev,
|
||||||
"power-supply", &priv->reg);
|
"power-supply", &priv->reg);
|
||||||
if (ret) {
|
if (ret)
|
||||||
debug("%s: Cannot get power supply: ret=%d\n", __func__, 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,
|
ret = gpio_request_by_name(dev, "enable-gpios", 0, &priv->enable,
|
||||||
GPIOD_IS_OUT);
|
GPIOD_IS_OUT);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
Loading…
Reference in New Issue
Block a user