aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2016-04-14 15:17:26 -0400
committerThierry Reding <thierry.reding@gmail.com>2016-05-17 08:45:02 -0400
commit1b50673dfa6486a69895bd45bb5eeaaede0a2b93 (patch)
treec8f7abecbf19506a97d956000f873b61669092cc /drivers/leds
parentad4e9fec143c453cae145d7d5ccac902c37fb912 (diff)
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: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-pwm.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index 4783bacb2e9d..a9145aa7f36a 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -91,6 +91,7 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
91 struct led_pwm *led, struct device_node *child) 91 struct led_pwm *led, struct device_node *child)
92{ 92{
93 struct led_pwm_data *led_data = &priv->leds[priv->num_leds]; 93 struct led_pwm_data *led_data = &priv->leds[priv->num_leds];
94 struct pwm_args pargs;
94 int ret; 95 int ret;
95 96
96 led_data->active_low = led->active_low; 97 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 else 118 else
118 led_data->cdev.brightness_set_blocking = led_pwm_set_blocking; 119 led_data->cdev.brightness_set_blocking = led_pwm_set_blocking;
119 120
120 led_data->period = pwm_get_period(led_data->pwm); 121 /*
122 * FIXME: pwm_apply_args() should be removed when switching to the
123 * atomic PWM API.
124 */
125 pwm_apply_args(led_data->pwm);
126
127 pwm_get_args(led_data->pwm, &pargs);
128
129 led_data->period = pargs.period;
121 if (!led_data->period && (led->pwm_period_ns > 0)) 130 if (!led_data->period && (led->pwm_period_ns > 0))
122 led_data->period = led->pwm_period_ns; 131 led_data->period = led->pwm_period_ns;
123 132