Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1367552
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v5 41/46] backlight: lp855x: switch to the atomic PWM API |
| Date | 2016-03-30 22:10 +0200 |
| Message-ID | <riuBd-28V-31@gated-at.bofh.it> (permalink) |
| References | <riuBc-28V-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
pwm_config/enable/disable() have been deprecated and should be replaced
by pwm_apply_state().
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
drivers/video/backlight/lp855x_bl.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index daca9e6..5468e7a 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -235,8 +235,7 @@ err:
static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br)
{
- unsigned int period = lp->pdata->period_ns;
- unsigned int duty = br * period / max_br;
+ struct pwm_state pstate;
struct pwm_device *pwm;
/* request pwm device with the consumer name */
@@ -248,11 +247,15 @@ static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br)
lp->pwm = pwm;
}
- pwm_config(lp->pwm, duty, period);
- if (duty)
- pwm_enable(lp->pwm);
+ pwm_get_state(lp->pwm, &pstate);
+ pstate.period = lp->pdata->period_ns;
+ pstate.duty_cycle = br * pstate.period / max_br;
+ if (pstate.duty_cycle)
+ pstate.enabled = true;
else
- pwm_disable(lp->pwm);
+ pstate.enabled = false;
+
+ pwm_apply_state(lp->pwm, &pstate);
}
static int lp855x_bl_update_status(struct backlight_device *bl)
--
2.5.0
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH v5 41/46] backlight: lp855x: switch to the atomic PWM API Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-03-30 22:10 +0200
csiph-web