From: "Maíra Canal" <maira.canal@usp.br>
To: lee.jones@linaro.org, daniel.thompson@linaro.org,
jingoohan1@gmail.com, thierry.reding@gmail.com,
u.kleine-koenig@pengutronix.de
Cc: lkp@intel.com, llvm@lists.linux.dev,
dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
linux-pwm@vger.kernel.org
Subject: [PATCH v2] backlight: lp855x: Switch to atomic PWM API
Date: Wed, 27 Oct 2021 15:45:40 -0300 [thread overview]
Message-ID: <YXmeVPIroq96BXfm@fedora> (raw)
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>
Reported-by: kernel test robot <lkp@intel.com>
---
V1 -> V2: Initializing variable and simplyfing conditional loop
---
drivers/video/backlight/lp855x_bl.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index e94932c69f54..a895a8ca6d26 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -233,9 +233,8 @@ static int lp855x_configure(struct lp855x *lp)
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 = NULL;
+ struct pwm_state state;
/* request pwm device with the consumer name */
if (!lp->pwm) {
@@ -244,19 +243,15 @@ 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);
- if (duty)
- pwm_enable(lp->pwm);
- else
- pwm_disable(lp->pwm);
+ pwm_init_state(pwm, &state);
+
+ state.period = lp->pdata->period_ns;
+ state.duty_cycle = br * state.period / max_br;
+ state.enabled = state.duty_cycle;
+
+ pwm_apply_state(pwm, &state);
}
static int lp855x_bl_update_status(struct backlight_device *bl)
--
2.31.1
next reply other threads:[~2021-10-27 18:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-27 18:45 Maíra Canal [this message]
2021-10-28 6:32 ` [PATCH v2] backlight: lp855x: Switch to atomic PWM API Uwe Kleine-König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YXmeVPIroq96BXfm@fedora \
--to=maira.canal@usp.br \
--cc=daniel.thompson@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jingoohan1@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.