All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 resend 11/11] backlight: pwm_bl: retrieve configured pwm period
Date: Mon, 19 May 2014 20:42:42 +0000	[thread overview]
Message-ID: <1400532162-29483-12-git-send-email-alexandre.belloni@free-electrons.com> (raw)
In-Reply-To: <1400532162-29483-1-git-send-email-alexandre.belloni@free-electrons.com>

The PWM core is now able to initialize the PWM period from platform_data. Use it
and if it is not configured, use the supplied pwm_period_ns.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 drivers/video/backlight/pwm_bl.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index b75201ff46f6..1bb8a69062c5 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -304,12 +304,14 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 	/*
 	 * The DT case will set the pwm_period_ns field to 0 and store the
 	 * period, parsed from the DT, in the PWM device. For the non-DT case,
-	 * set the period from platform data.
+	 * set the period from platform data if it is not already set.
 	 */
-	if (data->pwm_period_ns > 0)
+	pb->period = pwm_get_period(pb->pwm);
+	if (!pb->period && (data->pwm_period_ns > 0)) {
+		pb->period = data->pwm_period_ns;
 		pwm_set_period(pb->pwm, data->pwm_period_ns);
+	}
 
-	pb->period = pwm_get_period(pb->pwm);
 	pb->lth_brightness = data->lth_brightness * (pb->period / pb->scale);
 
 	memset(&props, 0, sizeof(struct backlight_properties));
-- 
1.9.1


WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Tony Lindgren <tony@atomide.com>,
	Philipp Zabel <philipp.zabel@gmail.com>,
	Paul Parsons <lost.distance@yahoo.com>,
	Simon Horman <horms@verge.net.au>,
	Magnus Damm <magnus.damm@gmail.com>,
	Eric Miao <eric.y.miao@gmail.com>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Bryan Wu <cooloney@gmail.com>, Jingoo Han <jg1.han@samsung.com>,
	Lee Jones <lee.jones@linaro.org>,
	linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
	linux-sh@vger.kernel.org, linux-leds@vger.kernel.org,
	linux-fbdev@vger.kernel.org,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>
Subject: [PATCHv2 resend 11/11] backlight: pwm_bl: retrieve configured pwm period
Date: Mon, 19 May 2014 22:42:42 +0200	[thread overview]
Message-ID: <1400532162-29483-12-git-send-email-alexandre.belloni@free-electrons.com> (raw)
In-Reply-To: <1400532162-29483-1-git-send-email-alexandre.belloni@free-electrons.com>

The PWM core is now able to initialize the PWM period from platform_data. Use it
and if it is not configured, use the supplied pwm_period_ns.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 drivers/video/backlight/pwm_bl.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index b75201ff46f6..1bb8a69062c5 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -304,12 +304,14 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 	/*
 	 * The DT case will set the pwm_period_ns field to 0 and store the
 	 * period, parsed from the DT, in the PWM device. For the non-DT case,
-	 * set the period from platform data.
+	 * set the period from platform data if it is not already set.
 	 */
-	if (data->pwm_period_ns > 0)
+	pb->period = pwm_get_period(pb->pwm);
+	if (!pb->period && (data->pwm_period_ns > 0)) {
+		pb->period = data->pwm_period_ns;
 		pwm_set_period(pb->pwm, data->pwm_period_ns);
+	}
 
-	pb->period = pwm_get_period(pb->pwm);
 	pb->lth_brightness = data->lth_brightness * (pb->period / pb->scale);
 
 	memset(&props, 0, sizeof(struct backlight_properties));
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: alexandre.belloni@free-electrons.com (Alexandre Belloni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 resend 11/11] backlight: pwm_bl: retrieve configured pwm period
Date: Mon, 19 May 2014 22:42:42 +0200	[thread overview]
Message-ID: <1400532162-29483-12-git-send-email-alexandre.belloni@free-electrons.com> (raw)
In-Reply-To: <1400532162-29483-1-git-send-email-alexandre.belloni@free-electrons.com>

The PWM core is now able to initialize the PWM period from platform_data. Use it
and if it is not configured, use the supplied pwm_period_ns.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 drivers/video/backlight/pwm_bl.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index b75201ff46f6..1bb8a69062c5 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -304,12 +304,14 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 	/*
 	 * The DT case will set the pwm_period_ns field to 0 and store the
 	 * period, parsed from the DT, in the PWM device. For the non-DT case,
-	 * set the period from platform data.
+	 * set the period from platform data if it is not already set.
 	 */
-	if (data->pwm_period_ns > 0)
+	pb->period = pwm_get_period(pb->pwm);
+	if (!pb->period && (data->pwm_period_ns > 0)) {
+		pb->period = data->pwm_period_ns;
 		pwm_set_period(pb->pwm, data->pwm_period_ns);
+	}
 
-	pb->period = pwm_get_period(pb->pwm);
 	pb->lth_brightness = data->lth_brightness * (pb->period / pb->scale);
 
 	memset(&props, 0, sizeof(struct backlight_properties));
-- 
1.9.1

  parent reply	other threads:[~2014-05-19 20:42 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-19 20:42 [PATCHv2 resend 00/11] improve PWM lookup support without device tree Alexandre Belloni
2014-05-19 20:42 ` Alexandre Belloni
2014-05-19 20:42 ` Alexandre Belloni
2014-05-19 20:42 ` [PATCHv2 resend 01/11] pwm: add period and polarity to struct pwm_lookup Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42 ` [PATCHv2 resend 02/11] ARM: shmobile: Armadillo 800 EVA: initialize all struct pwm_lookup members Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42 ` [PATCHv2 resend 03/11] pwm: renesas-tpu: remove useless struct tpu_pwm_platform_data Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42 ` [PATCHv2 resend 04/11] ARM: OMAP3: Beagle: initialize all the struct pwm_lookup members Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:49   ` Tony Lindgren
2014-05-19 20:49     ` Tony Lindgren
2014-05-19 20:49     ` Tony Lindgren
2014-05-19 20:42 ` [PATCHv2 resend 05/11] ARM: pxa: hx4700: " Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42 ` [PATCHv2 resend 06/11] pwm: modify PWM_LOOKUP to initialize all " Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42 ` [PATCHv2 resend 07/11] ARM: OMAP3: Beagle: use PWM_LOOKUP to initialize struct pwm_lookup Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:50   ` Tony Lindgren
2014-05-19 20:50     ` Tony Lindgren
2014-05-19 20:50     ` Tony Lindgren
2014-05-19 20:42 ` [PATCHv2 resend 08/11] ARM: shmobile: Armadillo 800 EVA: use PWM_LOOKUP to initialize struct pwm_loo Alexandre Belloni
2014-05-19 20:42   ` [PATCHv2 resend 08/11] ARM: shmobile: Armadillo 800 EVA: use PWM_LOOKUP to initialize struct pwm_lookup Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42 ` [PATCHv2 resend 09/11] ARM: pxa: hx4700: " Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42 ` [PATCHv2 resend 10/11] leds: leds-pwm: retrieve configured pwm period Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 20:42 ` Alexandre Belloni [this message]
2014-05-19 20:42   ` [PATCHv2 resend 11/11] backlight: pwm_bl: " Alexandre Belloni
2014-05-19 20:42   ` Alexandre Belloni
2014-05-19 21:08 ` [PATCHv2 resend 00/11] improve PWM lookup support without device tree Thierry Reding
2014-05-19 21:08   ` Thierry Reding
2014-05-19 21:08   ` Thierry Reding
2014-05-19 22:39 ` Simon Horman
2014-05-19 22:39   ` Simon Horman
2014-05-19 22:39   ` Simon Horman
2014-05-20  0:55   ` Laurent Pinchart
2014-05-20  0:55     ` Laurent Pinchart
2014-05-20  0:55     ` Laurent Pinchart
2014-05-20  0:55     ` Laurent Pinchart
2014-05-20 17:27 ` Philipp Zabel
2014-05-20 17:27   ` Philipp Zabel
2014-05-20 17:27   ` Philipp Zabel
2014-05-21  9:16 ` Thierry Reding
2014-05-21  9:16   ` Thierry Reding
2014-05-21  9:16   ` 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=1400532162-29483-12-git-send-email-alexandre.belloni@free-electrons.com \
    --to=alexandre.belloni@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.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 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.