[PATCH] video: Add a callback 'notify_after' for backlight control

Subsystems: backlight class/subsystem, framebuffer layer, the rest

STALE5503d

3 messages, 3 authors, 2011-08-09 · open the first message on its own page

[PATCH] video: Add a callback 'notify_after' for backlight control

From: <hidden>
Date: 2011-08-09 02:30:54

From: Dilan Lee <redacted>

We need a callback to do some things after pwm_enable, pwm_disable
and pwm_config.

Signed-off-by: Dilan Lee <redacted>
---
 drivers/video/backlight/pwm_bl.c |    9 +++++++++
 include/linux/pwm_backlight.h    |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index b8f38ec..8b5b2a4 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -28,6 +28,8 @@ struct pwm_bl_data {
 	unsigned int		lth_brightness;
 	int			(*notify)(struct device *,
 					  int brightness);
+	void			(*notify_after)(struct device *,
+					int brightness);
 	int			(*check_fb)(struct device *, struct fb_info *);
 };
 
@@ -55,6 +57,10 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
 		pwm_config(pb->pwm, brightness, pb->period);
 		pwm_enable(pb->pwm);
 	}
+
+	if (pb->notify_after)
+		pb->notify_after(pb->dev, brightness);
+
 	return 0;
 }
 
@@ -105,6 +111,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 
 	pb->period = data->pwm_period_ns;
 	pb->notify = data->notify;
+	pb->notify_after = data->notify_after;
 	pb->check_fb = data->check_fb;
 	pb->lth_brightness = data->lth_brightness *
 		(data->pwm_period_ns / data->max_brightness);
@@ -172,6 +179,8 @@ static int pwm_backlight_suspend(struct platform_device *pdev,
 		pb->notify(pb->dev, 0);
 	pwm_config(pb->pwm, 0, pb->period);
 	pwm_disable(pb->pwm);
+	if (pb->notify_after)
+		pb->notify_after(pb->dev, 0);
 	return 0;
 }
 
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h
index 5e3e25a..63d2df4 100644
--- a/include/linux/pwm_backlight.h
+++ b/include/linux/pwm_backlight.h
@@ -14,6 +14,7 @@ struct platform_pwm_backlight_data {
 	unsigned int pwm_period_ns;
 	int (*init)(struct device *dev);
 	int (*notify)(struct device *dev, int brightness);
+	void (*notify_after)(struct device *dev, int brightness);
 	void (*exit)(struct device *dev);
 	int (*check_fb)(struct device *dev, struct fb_info *info);
 };
-- 
1.7.6

Re: [PATCH] video: Add a callback 'notify_after' for backlight control

From: Robert Morell <hidden>
Date: 2011-08-09 02:35:03

On Mon, Aug 08, 2011 at 07:29:56PM -0700, Dilan Lee wrote:
From: Dilan Lee <redacted>

We need a callback to do some things after pwm_enable, pwm_disable
and pwm_config.

Signed-off-by: Dilan Lee <redacted>
Reviewed-by: Robert Morell <redacted>

Thanks,
Robert

RE: [PATCH] video: Add a callback 'notify_after' for backlight control

From: Arun MURTHY <hidden>
Date: 2011-08-09 03:44:15

-----Original Message-----
From: dilee@nvidia.com [mailto:dilee@nvidia.com]
Sent: Tuesday, August 09, 2011 8:00 AM
To: rpurdie@rpsys.net; lethal@linux-sh.org; akpm@linux-foundation.org;
Arun MURTHY; rmorell@nvidia.com; Linus WALLEIJ
Cc: jnien@nvidia.com; swarren@nvidia.com; linux-fbdev@vger.kernel.org;
linux-kernel@vger.kernel.org; linux-tegra@vger.kernel.org; Dilan Lee
Subject: [PATCH] video: Add a callback 'notify_after' for backlight
control

From: Dilan Lee <redacted>

We need a callback to do some things after pwm_enable, pwm_disable
and pwm_config.

Signed-off-by: Dilan Lee <redacted>
Reviewed-by: Arun Murthy <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help