[PATCH 3/8] lcd: allow lcd device to handle mode change events

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

STALE6508d

6 messages, 4 authors, 2008-10-08 · open the first message on its own page

[PATCH 3/8] lcd: allow lcd device to handle mode change events

From: Eric Miao <hidden>
Date: 2008-08-29 07:26:47

Some LCD panels are capable of different resolutions, and is allowed
to change at run-time, so to make "struct lcd_device" to be able to
handle mode change events here.

Signed-off-by: Eric Miao <redacted>
---
 drivers/video/backlight/lcd.c |   18 +++++++++++++++---
 drivers/video/fbmem.c         |    1 +
 include/linux/lcd.h           |    2 ++
 3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index b15b2b8..8e1731d 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -27,14 +27,26 @@ static int fb_notifier_callback(struct notifier_block *self,
 	struct fb_event *evdata = data;

 	/* If we aren't interested in this event, skip it immediately ... */
-	if (event != FB_EVENT_BLANK)
+	switch (event) {
+	case FB_EVENT_BLANK:
+	case FB_EVENT_MODE_CHANGE:
+	case FB_EVENT_MODE_CHANGE_ALL:
+		break;
+	default:
 		return 0;
+	}

 	ld = container_of(self, struct lcd_device, fb_notif);
+	if (!ld->ops)
+		return 0;
+
 	mutex_lock(&ld->ops_lock);
-	if (ld->ops)
-		if (!ld->ops->check_fb || ld->ops->check_fb(ld, evdata->info))
+	if (!ld->ops->check_fb || ld->ops->check_fb(ld, evdata->info)) {
+		if (event == FB_EVENT_BLANK)
 			ld->ops->set_power(ld, *(int *)evdata->data);
+		else
+			ld->ops->set_mode(ld, evdata->data);
+	}
 	mutex_unlock(&ld->ops_lock);
 	return 0;
 }
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 6b48780..fdfb0e5 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -979,6 +979,7 @@ fb_set_var(struct fb_info *info, struct
fb_var_screeninfo *var)

 				info->flags &= ~FBINFO_MISC_USEREVENT;
 				event.info = info;
+				event.data = &mode;
 				fb_notifier_call_chain(evnt, &event);
 			}
 		}
diff --git a/include/linux/lcd.h b/include/linux/lcd.h
index 173feba..f2d223b 100644
--- a/include/linux/lcd.h
+++ b/include/linux/lcd.h
@@ -45,6 +45,8 @@ struct lcd_ops {
 	int (*get_contrast)(struct lcd_device *);
 	/* Set LCD panel contrast */
         int (*set_contrast)(struct lcd_device *, int contrast);
+	/* Set LCD panel mode (resolutions ...) */
+	int (*set_mode)(struct lcd_device *, struct fb_videomode *);
 	/* Check if given framebuffer device is the one LCD is bound to;
 	   return 0 if not, !=0 if it is. If NULL, lcd always matches the fb. */
 	int (*check_fb)(struct lcd_device *, struct fb_info *);
-- 
1.5.4.3

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

Re: [PATCH 3/8] lcd: allow lcd device to handle mode change events

From: Dmitry Baryshkov <hidden>
Date: 2008-08-30 21:36:16

Eric Miao wrote:
Some LCD panels are capable of different resolutions, and is allowed to
change at run-time, so to make "struct lcd_device" to be able to handle
mode change events here.

Signed-off-by: Eric Miao <redacted>
I like this patch, since I need the same functionality for the tosa :)

-- 
With best wishes
Dmitry



-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

Re: [PATCH 3/8] lcd: allow lcd device to handle mode change events

From: Krzysztof Helt <hidden>
Date: 2008-08-31 07:41:44

On Fri, 29 Aug 2008 15:26:46 +0800
"Eric Miao" [off-list ref] wrote:
Some LCD panels are capable of different resolutions, and is allowed
to change at run-time, so to make "struct lcd_device" to be able to
handle mode change events here.

Signed-off-by: Eric Miao <redacted>
---
Acked-by: Krzysztof Helt <redacted>

----------------------------------------------------------------------
Tylko u nas - swieza krew w rozsadnych cenach!
quoted
http://link.interia.pl/f1eed

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

Re: [PATCH 3/8] lcd: allow lcd device to handle mode change events

From: Eric Miao <hidden>
Date: 2008-09-01 01:56:24

On Sun, Aug 31, 2008 at 3:20 PM, Krzysztof Helt [off-list ref] wrote:
On Fri, 29 Aug 2008 15:26:46 +0800
"Eric Miao" [off-list ref] wrote:
quoted
Some LCD panels are capable of different resolutions, and is allowed
to change at run-time, so to make "struct lcd_device" to be able to
handle mode change events here.

Signed-off-by: Eric Miao <redacted>
---
Acked-by: Krzysztof Helt <redacted>
OK, thanks. I'll queue this patch for next merge window then.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

Re: [PATCH 3/8] lcd: allow lcd device to handle mode change events

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2008-09-05 22:42:14

On Mon, 1 Sep 2008 09:56:23 +0800
"Eric Miao" [off-list ref] wrote:
On Sun, Aug 31, 2008 at 3:20 PM, Krzysztof Helt [off-list ref] wrote:
quoted
On Fri, 29 Aug 2008 15:26:46 +0800
"Eric Miao" [off-list ref] wrote:
quoted
Some LCD panels are capable of different resolutions, and is allowed
to change at run-time, so to make "struct lcd_device" to be able to
handle mode change events here.

Signed-off-by: Eric Miao <redacted>
---
Acked-by: Krzysztof Helt <redacted>
OK, thanks. I'll queue this patch for next merge window then.
It isn't in linux-next after eight days.  Where did this get queued?  

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

Re: [PATCH 3/8] lcd: allow lcd device to handle mode change events

From: Dmitry Baryshkov <hidden>
Date: 2008-10-08 14:08:24

Eric Miao wrote:
Some LCD panels are capable of different resolutions, and is allowed to
change at run-time, so to make "struct lcd_device" to be able to handle
mode change events here.

Signed-off-by: Eric Miao <redacted>
This patch broke a bit all existing fb drivers. At least you'll get a nice
segfault on modechange, if any lcd driver w/o set_mode is registered.
Please add a check for ld->ops->set_mode being non-NULL.

-- 
With best wishes
Dmitry



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help