linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/8] lcd: allow lcd device to handle mode change events
@ 2008-08-29  7:26 Eric Miao
  2008-08-30 21:36 ` Dmitry Baryshkov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Eric Miao @ 2008-08-29  7:26 UTC (permalink / raw)
  To: ARM Linux; +Cc: linux-fbdev-devel

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 <eric.miao@marvell.com>
---
 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=/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/8] lcd: allow lcd device to handle mode change events
  2008-08-29  7:26 [PATCH 3/8] lcd: allow lcd device to handle mode change events Eric Miao
@ 2008-08-30 21:36 ` Dmitry Baryshkov
  2008-08-31  7:20 ` Krzysztof Helt
  2008-10-08 14:07 ` Dmitry Baryshkov
  2 siblings, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2008-08-30 21:36 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-fbdev-devel

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 <eric.miao@marvell.com>

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/8] lcd: allow lcd device to handle mode change events
  2008-08-29  7:26 [PATCH 3/8] lcd: allow lcd device to handle mode change events Eric Miao
  2008-08-30 21:36 ` Dmitry Baryshkov
@ 2008-08-31  7:20 ` Krzysztof Helt
  2008-09-01  1:56   ` Eric Miao
  2008-10-08 14:07 ` Dmitry Baryshkov
  2 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Helt @ 2008-08-31  7:20 UTC (permalink / raw)
  To: Eric Miao; +Cc: linux-fbdev-devel, ARM Linux

On Fri, 29 Aug 2008 15:26:46 +0800
"Eric Miao" <eric.y.miao@gmail.com> 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 <eric.miao@marvell.com>
> ---

Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>

----------------------------------------------------------------------
Tylko u nas - swieza krew w rozsadnych cenach!
>> 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=/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/8] lcd: allow lcd device to handle mode change events
  2008-08-31  7:20 ` Krzysztof Helt
@ 2008-09-01  1:56   ` Eric Miao
  2008-09-05 22:41     ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Miao @ 2008-09-01  1:56 UTC (permalink / raw)
  To: Krzysztof Helt; +Cc: linux-fbdev-devel, ARM Linux

On Sun, Aug 31, 2008 at 3:20 PM, Krzysztof Helt <krzysztof.h1@poczta.fm> wrote:
> On Fri, 29 Aug 2008 15:26:46 +0800
> "Eric Miao" <eric.y.miao@gmail.com> 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 <eric.miao@marvell.com>
>> ---
>
> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
>

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=/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/8] lcd: allow lcd device to handle mode change events
  2008-09-01  1:56   ` Eric Miao
@ 2008-09-05 22:41     ` Andrew Morton
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2008-09-05 22:41 UTC (permalink / raw)
  To: Eric Miao; +Cc: linux-fbdev-devel, linux-arm-kernel

On Mon, 1 Sep 2008 09:56:23 +0800
"Eric Miao" <eric.y.miao@gmail.com> wrote:

> On Sun, Aug 31, 2008 at 3:20 PM, Krzysztof Helt <krzysztof.h1@poczta.fm> wrote:
> > On Fri, 29 Aug 2008 15:26:46 +0800
> > "Eric Miao" <eric.y.miao@gmail.com> 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 <eric.miao@marvell.com>
> >> ---
> >
> > Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
> >
> 
> 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=/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/8] lcd: allow lcd device to handle mode change events
  2008-08-29  7:26 [PATCH 3/8] lcd: allow lcd device to handle mode change events Eric Miao
  2008-08-30 21:36 ` Dmitry Baryshkov
  2008-08-31  7:20 ` Krzysztof Helt
@ 2008-10-08 14:07 ` Dmitry Baryshkov
  2 siblings, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2008-10-08 14:07 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: linux-arm-kernel

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 <eric.miao@marvell.com>

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=/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-10-08 14:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-29  7:26 [PATCH 3/8] lcd: allow lcd device to handle mode change events Eric Miao
2008-08-30 21:36 ` Dmitry Baryshkov
2008-08-31  7:20 ` Krzysztof Helt
2008-09-01  1:56   ` Eric Miao
2008-09-05 22:41     ` Andrew Morton
2008-10-08 14:07 ` Dmitry Baryshkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).