From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-fbdev@vger.kernel.org
Subject: [PATCH v1 4/5] video: ssd1307fb: Convert to atomic PWM API
Date: Tue, 24 Mar 2020 17:05:31 +0000 [thread overview]
Message-ID: <20200324170532.44384-4-andriy.shevchenko@linux.intel.com> (raw)
Use the atomic API wherever appropriate and get rid of pwm_apply_args()
call (the reference period and polarity are now explicitly set when
calling pwm_apply_state()).
We also make use of the pwm_set_relative_duty_cycle() helper to ease
relative to absolute duty_cycle conversion.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/video/fbdev/ssd1307fb.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index 7a6a44a0b7a6..6e543396002a 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -79,7 +79,6 @@ struct ssd1307fb_par {
u32 prechargep1;
u32 prechargep2;
struct pwm_device *pwm;
- u32 pwm_period;
struct gpio_desc *reset;
struct regulator *vbat_reg;
u32 vcomh;
@@ -297,9 +296,9 @@ static void ssd1307fb_deferred_io(struct fb_info *info,
static int ssd1307fb_init(struct ssd1307fb_par *par)
{
+ struct pwm_state pwmstate;
int ret;
u32 precharge, dclk, com_invdir, compins;
- struct pwm_args pargs;
if (par->device_info->need_pwm) {
par->pwm = pwm_get(&par->client->dev, NULL);
@@ -308,21 +307,15 @@ static int ssd1307fb_init(struct ssd1307fb_par *par)
return PTR_ERR(par->pwm);
}
- /*
- * FIXME: pwm_apply_args() should be removed when switching to
- * the atomic PWM API.
- */
- pwm_apply_args(par->pwm);
+ pwm_init_state(par->pwm, &pwmstate);
+ pwm_set_relative_duty_cycle(&pwmstate, 50, 100);
+ pwm_apply_state(par->pwm, &pwmstate);
- pwm_get_args(par->pwm, &pargs);
-
- par->pwm_period = pargs.period;
/* Enable the PWM */
- pwm_config(par->pwm, par->pwm_period / 2, par->pwm_period);
pwm_enable(par->pwm);
dev_dbg(&par->client->dev, "Using PWM%d with a %dns period.\n",
- par->pwm->pwm, par->pwm_period);
+ par->pwm->pwm, pwm_get_period(par->pwm));
}
/* Set initial contrast */
--
2.25.1
next prev reply other threads:[~2020-03-24 17:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200324170539eucas1p25909201d48429c9489c286ac18af0f1c@eucas1p2.samsung.com>
2020-03-24 17:05 ` [PATCH v1 1/5] video: ssd1307fb: Convert driver to use ->probe_new() Andy Shevchenko
[not found] ` <CGME20200324170551eucas1p2a568c0296a5773cdf70e162c5a1e9b72@eucas1p2.samsung.com>
2020-03-24 17:05 ` [PATCH v1 2/5] video: ssd1307fb: Introduce temporary variable to increase readability Andy Shevchenko
2020-04-17 14:07 ` Bartlomiej Zolnierkiewicz
[not found] ` <CGME20200324170554eucas1p164794d0c08b18a1d066b2b83957c73a1@eucas1p1.samsung.com>
2020-03-24 17:05 ` [PATCH v1 3/5] video: ssd1307fb: Make use of device properties Andy Shevchenko
2020-04-17 14:07 ` Bartlomiej Zolnierkiewicz
[not found] ` <CGME20200324170539eucas1p12a3a4f7cd0d8cbd86f40d70a65ab0df5@eucas1p1.samsung.com>
2020-03-24 17:05 ` Andy Shevchenko [this message]
2020-04-17 14:07 ` [PATCH v1 4/5] video: ssd1307fb: Convert to atomic PWM API Bartlomiej Zolnierkiewicz
[not found] ` <CGME20200324170539eucas1p19f81f8c31975734ab56e19d15033be77@eucas1p1.samsung.com>
2020-03-24 17:05 ` [PATCH v1 5/5] video: ssd1307fb: Remove redundant forward declaration Andy Shevchenko
2020-04-17 14:07 ` Bartlomiej Zolnierkiewicz
2020-03-30 9:51 ` [PATCH v1 1/5] video: ssd1307fb: Convert driver to use ->probe_new() Andy Shevchenko
2020-04-15 14:20 ` Andy Shevchenko
2020-04-15 14:36 ` Bartlomiej Zolnierkiewicz
2020-04-17 14:07 ` Bartlomiej Zolnierkiewicz
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=20200324170532.44384-4-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=linux-fbdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).