All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Thierry Reding <thierry.reding@gmail.com>,
	Krzysztof Kozlowski <krzk@kernel.org>
Cc: linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	kernel@pengutronix.de
Subject: [PATCH 2/4] ARM: S3C24XX: rx1950: make use of atomic PWM API
Date: Fri, 26 Oct 2018 20:41:56 +0200	[thread overview]
Message-ID: <20181026184157.16371-2-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20181026184157.16371-1-u.kleine-koenig@pengutronix.de>

The legacy PWM API should be removed in the long run, so convert a user
to the atomic PWM API.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 arch/arm/mach-s3c24xx/mach-rx1950.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index 7f5a18fa305b..5c4459f9a5f7 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -375,6 +375,7 @@ static struct pwm_lookup rx1950_pwm_lookup[] = {
 		   PWM_POLARITY_NORMAL),
 };
 
+static struct pwm_state lcd_pwm_state;
 static struct pwm_device *lcd_pwm;
 
 static void rx1950_lcd_power(int enable)
@@ -428,15 +429,17 @@ static void rx1950_lcd_power(int enable)
 
 		/* GPB1->OUTPUT, GPB1->0 */
 		gpio_direction_output(S3C2410_GPB(1), 0);
-		pwm_config(lcd_pwm, 0, LCD_PWM_PERIOD);
-		pwm_disable(lcd_pwm);
+		lcd_pwm_state.duty_cycle = 0;
+		lcd_pwm_state.enabled = false;
+		pwm_apply_state(lcd_pwm, &lcd_pwm_state);
 
 		/* GPC0->0, GPC10->0 */
 		gpio_direction_output(S3C2410_GPC(0), 0);
 		gpio_direction_output(S3C2410_GPC(10), 0);
 	} else {
-		pwm_config(lcd_pwm, LCD_PWM_DUTY, LCD_PWM_PERIOD);
-		pwm_enable(lcd_pwm);
+		lcd_pwm_state.duty_cycle = LCD_PWM_DUTY;
+		lcd_pwm_state.enabled = true;
+		pwm_apply_state(lcd_pwm, &lcd_pwm_state);
 
 		gpio_direction_output(S3C2410_GPC(0), 1);
 		gpio_direction_output(S3C2410_GPC(5), 1);
@@ -491,11 +494,8 @@ static int rx1950_backlight_init(struct device *dev)
 		return PTR_ERR(lcd_pwm);
 	}
 
-	/*
-	 * FIXME: pwm_apply_args() should be removed when switching to
-	 * the atomic PWM API.
-	 */
-	pwm_apply_args(lcd_pwm);
+	pwm_get_state_default(lcd_pwm, &lcd_pwm_state);
+	lcd_pwm_state.period = LCD_PWM_PERIOD;
 
 	rx1950_lcd_power(1);
 	rx1950_bl_power(1);
-- 
2.19.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] ARM: S3C24XX: rx1950: make use of atomic PWM API
Date: Fri, 26 Oct 2018 20:41:56 +0200	[thread overview]
Message-ID: <20181026184157.16371-2-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20181026184157.16371-1-u.kleine-koenig@pengutronix.de>

The legacy PWM API should be removed in the long run, so convert a user
to the atomic PWM API.

Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
 arch/arm/mach-s3c24xx/mach-rx1950.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index 7f5a18fa305b..5c4459f9a5f7 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -375,6 +375,7 @@ static struct pwm_lookup rx1950_pwm_lookup[] = {
 		   PWM_POLARITY_NORMAL),
 };
 
+static struct pwm_state lcd_pwm_state;
 static struct pwm_device *lcd_pwm;
 
 static void rx1950_lcd_power(int enable)
@@ -428,15 +429,17 @@ static void rx1950_lcd_power(int enable)
 
 		/* GPB1->OUTPUT, GPB1->0 */
 		gpio_direction_output(S3C2410_GPB(1), 0);
-		pwm_config(lcd_pwm, 0, LCD_PWM_PERIOD);
-		pwm_disable(lcd_pwm);
+		lcd_pwm_state.duty_cycle = 0;
+		lcd_pwm_state.enabled = false;
+		pwm_apply_state(lcd_pwm, &lcd_pwm_state);
 
 		/* GPC0->0, GPC10->0 */
 		gpio_direction_output(S3C2410_GPC(0), 0);
 		gpio_direction_output(S3C2410_GPC(10), 0);
 	} else {
-		pwm_config(lcd_pwm, LCD_PWM_DUTY, LCD_PWM_PERIOD);
-		pwm_enable(lcd_pwm);
+		lcd_pwm_state.duty_cycle = LCD_PWM_DUTY;
+		lcd_pwm_state.enabled = true;
+		pwm_apply_state(lcd_pwm, &lcd_pwm_state);
 
 		gpio_direction_output(S3C2410_GPC(0), 1);
 		gpio_direction_output(S3C2410_GPC(5), 1);
@@ -491,11 +494,8 @@ static int rx1950_backlight_init(struct device *dev)
 		return PTR_ERR(lcd_pwm);
 	}
 
-	/*
-	 * FIXME: pwm_apply_args() should be removed when switching to
-	 * the atomic PWM API.
-	 */
-	pwm_apply_args(lcd_pwm);
+	pwm_get_state_default(lcd_pwm, &lcd_pwm_state);
+	lcd_pwm_state.period = LCD_PWM_PERIOD;
 
 	rx1950_lcd_power(1);
 	rx1950_bl_power(1);
-- 
2.19.1

  reply	other threads:[~2018-10-26 18:41 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-26 18:41 [PATCH 1/4] pwm: Add new helper to initialize a pwm_state variable with defaults Uwe Kleine-König
2018-10-26 18:41 ` Uwe Kleine-König
2018-10-26 18:41 ` Uwe Kleine-König [this message]
2018-10-26 18:41   ` [PATCH 2/4] ARM: S3C24XX: rx1950: make use of atomic PWM API Uwe Kleine-König
2018-10-29 10:46   ` Krzysztof Kozlowski
2018-10-29 10:46     ` Krzysztof Kozlowski
2018-11-14  9:15     ` Uwe Kleine-König
2018-11-14  9:15       ` Uwe Kleine-König
2018-11-14 12:08   ` Thierry Reding
2018-11-14 12:08     ` Thierry Reding
2018-11-15  8:58     ` Uwe Kleine-König
2018-11-15  8:58       ` Uwe Kleine-König
2018-11-15 16:15       ` Thierry Reding
2018-11-15 16:15         ` Thierry Reding
2018-11-15 21:00         ` Uwe Kleine-König
2018-11-15 21:00           ` Uwe Kleine-König
2018-10-26 18:41 ` [PATCH 3/4] bus: ts-nbus: convert to " Uwe Kleine-König
2018-10-26 18:41   ` Uwe Kleine-König
2018-11-14 12:15   ` Thierry Reding
2018-11-14 12:15     ` Thierry Reding
2018-10-26 18:41 ` [PATCH 4/4] bus: ts-nbus: weaken driver dependency to allow broader compile testing Uwe Kleine-König
2018-10-26 18:41   ` Uwe Kleine-König
2018-11-14 12:18   ` Thierry Reding
2018-11-14 12:18     ` Thierry Reding
2018-10-29 11:33 ` [PATCH 1/4] pwm: Add new helper to initialize a pwm_state variable with defaults Thierry Reding
2018-10-29 11:33   ` Thierry Reding
2018-11-03 14:25   ` Uwe Kleine-König
2018-11-03 14:25     ` Uwe Kleine-König
2018-11-08 15:13     ` Uwe Kleine-König
2018-11-08 15:13       ` Uwe Kleine-König
2018-11-14 12:32 ` Thierry Reding
2018-11-14 12:32   ` Thierry Reding
2018-11-15  9:16   ` Uwe Kleine-König
2018-11-15  9:16     ` Uwe Kleine-König
2018-11-15 16:21     ` Thierry Reding
2018-11-15 16:21       ` Thierry Reding
2018-11-15 21:05       ` Uwe Kleine-König
2018-11-15 21:05         ` Uwe Kleine-König
2018-11-16 10:24         ` Thierry Reding
2018-11-16 10:24           ` Thierry Reding

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=20181026184157.16371-2-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /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.