Skip to content

Commit

Permalink
backlight: lp855x: Switch to atomic PWM API
Browse files Browse the repository at this point in the history
Remove legacy PWM interface (pwm_config, pwm_enable, pwm_disable) and
replace it for the atomic PWM API.

Signed-off-by: Maíra Canal <maira.canal@usp.br>
  • Loading branch information
mairacanal authored and intel-lab-lkp committed Oct 24, 2021
1 parent 3976e97 commit f79ab2c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions drivers/video/backlight/lp855x_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ 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_state state;

/* request pwm device with the consumer name */
if (!lp->pwm) {
Expand All @@ -244,19 +245,19 @@ static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br)
return;

lp->pwm = pwm;

/*
* FIXME: pwm_apply_args() should be removed when switching to
* the atomic PWM API.
*/
pwm_apply_args(pwm);
}

pwm_config(lp->pwm, duty, period);
pwm_init_state(pwm, &state);

state.duty_cycle = duty;
state.period = period;

if (duty)
pwm_enable(lp->pwm);
state.enabled = true;
else
pwm_disable(lp->pwm);
state.enabled = false;

pwm_apply_state(pwm, &state);
}

static int lp855x_bl_update_status(struct backlight_device *bl)
Expand Down

0 comments on commit f79ab2c

Please sign in to comment.