提交 1b50673d 编写于 作者: B Boris Brezillon 提交者: Thierry Reding

leds: pwm: Use pwm_get_args() where appropriate

The PWM framework has clarified the concept of reference PWM config (the
platform dependent config retrieved from the DT or the PWM lookup table)
and real PWM state.

Use pwm_get_args() when the PWM user wants to retrieve this reference
config and not the current state.

This is part of the rework allowing the PWM framework to support
hardware readout and expose real PWM state even when the PWM has just
been requested (before the user calls pwm_config/enable/disable()).
Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: NJacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: NThierry Reding <thierry.reding@gmail.com>
上级 ad4e9fec
...@@ -91,6 +91,7 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv, ...@@ -91,6 +91,7 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
struct led_pwm *led, struct device_node *child) struct led_pwm *led, struct device_node *child)
{ {
struct led_pwm_data *led_data = &priv->leds[priv->num_leds]; struct led_pwm_data *led_data = &priv->leds[priv->num_leds];
struct pwm_args pargs;
int ret; int ret;
led_data->active_low = led->active_low; led_data->active_low = led->active_low;
...@@ -117,7 +118,15 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv, ...@@ -117,7 +118,15 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
else else
led_data->cdev.brightness_set_blocking = led_pwm_set_blocking; led_data->cdev.brightness_set_blocking = led_pwm_set_blocking;
led_data->period = pwm_get_period(led_data->pwm); /*
* FIXME: pwm_apply_args() should be removed when switching to the
* atomic PWM API.
*/
pwm_apply_args(led_data->pwm);
pwm_get_args(led_data->pwm, &pargs);
led_data->period = pargs.period;
if (!led_data->period && (led->pwm_period_ns > 0)) if (!led_data->period && (led->pwm_period_ns > 0))
led_data->period = led->pwm_period_ns; led_data->period = led->pwm_period_ns;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册