From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 08/10] video: backlight-pwm: Add regulator support
Date: Wed, 23 Sep 2015 13:47:29 +0200 [thread overview]
Message-ID: <1443008851-26596-9-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1443008851-26596-1-git-send-email-s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/video/backlight-pwm.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/video/backlight-pwm.c b/drivers/video/backlight-pwm.c
index 8f17f21..ba6f9bc 100644
--- a/drivers/video/backlight-pwm.c
+++ b/drivers/video/backlight-pwm.c
@@ -24,6 +24,7 @@
#include <pwm.h>
#include <linux/err.h>
#include <of.h>
+#include <regulator.h>
#include <gpio.h>
#include <of_gpio.h>
#include <asm-generic/div64.h>
@@ -31,6 +32,7 @@
struct pwm_backlight {
struct backlight_device backlight;
struct pwm_device *pwm;
+ struct regulator *power;
uint32_t period;
unsigned int *levels;
int enable_gpio;
@@ -50,6 +52,8 @@ static int backlight_pwm_enable(struct pwm_backlight *pwm_backlight)
if (ret)
return ret;
+ regulator_enable(pwm_backlight->power);
+
if (gpio_is_valid(pwm_backlight->enable_gpio)) {
gpio_direction_output(pwm_backlight->enable_gpio,
pwm_backlight->enable_active_high);
@@ -68,6 +72,9 @@ static int backlight_pwm_disable(struct pwm_backlight *pwm_backlight)
if (gpio_is_valid(pwm_backlight->enable_gpio)) {
gpio_direction_output(pwm_backlight->enable_gpio,
!pwm_backlight->enable_active_high);
+
+ regulator_disable(pwm_backlight->power);
+
/*
* Only disable PWM when an enable gpio is present.
* The output of the PWM is undefined when the PWM
@@ -173,6 +180,12 @@ static int backlight_pwm_of_probe(struct device_d *dev)
if (ret)
return ret;
+ pwm_backlight->power = regulator_get(dev, "power");
+ if (IS_ERR(pwm_backlight->power)) {
+ dev_err(dev, "Cannot find regulator\n");
+ return PTR_ERR(pwm_backlight->power);
+ }
+
pwm_backlight->period = pwm_get_period(pwm_backlight->pwm);
pwm_backlight->backlight.brightness_set = backlight_pwm_set;
--
2.5.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-09-23 11:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-23 11:47 [PATCH v2] video: imx-ipu-v3: ldb fixes Sascha Hauer
2015-09-23 11:47 ` [PATCH 01/10] video: ipuv3: Do not crash when no mode is found Sascha Hauer
2015-09-23 11:47 ` [PATCH 02/10] video: ipuv3: imx-ldb: remove unused variable Sascha Hauer
2015-09-23 11:47 ` [PATCH 03/10] video: ipuv3: imx-ldb: Support video modes in ldb node Sascha Hauer
2015-09-23 11:47 ` [PATCH 04/10] video: simple-panel: Add debug/error messages Sascha Hauer
2015-09-23 11:47 ` [PATCH 05/10] video: simple-panel: Add support for device tree provided nodes Sascha Hauer
2015-09-23 11:47 ` [PATCH 06/10] video: ipuv3: print error message when no modes are found Sascha Hauer
2015-09-23 11:47 ` [PATCH 07/10] video: backlight-pwm: Add error message Sascha Hauer
2015-09-23 11:47 ` Sascha Hauer [this message]
2015-09-23 11:47 ` [PATCH 09/10] ARM: i.MX: GuF Santaro: enable PWM Sascha Hauer
2015-09-23 11:47 ` [PATCH 10/10] ARM: i.MX: GuF Santaro: Fix panel support Sascha Hauer
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=1443008851-26596-9-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox