提交 f2ac0a8f 编写于 作者: M Maíra Canal 提交者: Lee Jones

backlight: lp855x: Switch to atomic PWM API

Remove legacy PWM interface (pwm_config, pwm_enable, pwm_disable) and
replace it for the atomic PWM API.
Signed-off-by: NMaíra Canal <mairacanal@riseup.net>
Reviewed-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: NDaniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: NLee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20220714215334.78226-1-mairacanal@riseup.net
上级 2654f59b
...@@ -218,9 +218,8 @@ static int lp855x_configure(struct lp855x *lp) ...@@ -218,9 +218,8 @@ static int lp855x_configure(struct lp855x *lp)
static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br) 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_device *pwm; struct pwm_device *pwm;
struct pwm_state state;
/* request pwm device with the consumer name */ /* request pwm device with the consumer name */
if (!lp->pwm) { if (!lp->pwm) {
...@@ -230,18 +229,16 @@ static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br) ...@@ -230,18 +229,16 @@ static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br)
lp->pwm = pwm; lp->pwm = pwm;
/* pwm_init_state(lp->pwm, &state);
* FIXME: pwm_apply_args() should be removed when switching to } else {
* the atomic PWM API. pwm_get_state(lp->pwm, &state);
*/
pwm_apply_args(pwm);
} }
pwm_config(lp->pwm, duty, period); state.period = lp->pdata->period_ns;
if (duty) state.duty_cycle = div_u64(br * state.period, max_br);
pwm_enable(lp->pwm); state.enabled = state.duty_cycle;
else
pwm_disable(lp->pwm); pwm_apply_state(lp->pwm, &state);
} }
static int lp855x_bl_update_status(struct backlight_device *bl) static int lp855x_bl_update_status(struct backlight_device *bl)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册