All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pattrick Hueper <pattyh@gmx.net>
To: linux-fbdev-devel@lists.sourceforge.net
Subject: [PATCH] notify fbcon if framebuffer registered
Date: Tue, 02 Mar 2004 12:38:57 +0100	[thread overview]
Message-ID: <40447251.3050801@gmx.net> (raw)

Hi,

Note: Please CC: me on replies, since i am not a member of the 
linux-fbdev-devel list!

I am helping a team at handhelds.org to port linux to the ipaq h2210, i 
was trying to get the framebuffer to start when i came across the 
problem, that our fb device is initialized after fb_console_init. I saw 
that sometime between 2.6.1 and 2.6.3 you added a notifier_chain for 
suspend/resume, so i added a new event for newly registered 
framebuffers, this helps my ipaq fb to start, when the kernel starts.

Here is the patch i came up with: (it is a patch based on the 
handhelds.org kernel sources, i hope that it still fits your sources. 
Sorry!)

I basically added a new event in fb.h and notified the event in 
register_framebuffer. I had to move the fb_register_client call in 
fb_console_init up, before "if (!num_registered_fb) because it otherwise 
did not get called in my case. in fbcon_event_notify() i just call 
take_over_console, which is what fb_console_init would have done, had 
the framebuffer been registered before, if i understood it correctly.

Regards, Patty

Index: drivers/video/fbmem.c
===================================================================
RCS file: /cvs/linux/kernel26/drivers/video/fbmem.c,v
retrieving revision 1.13
diff -u -b -r1.13 fbmem.c
--- drivers/video/fbmem.c	29 Feb 2004 01:49:03 -0000	1.13
+++ drivers/video/fbmem.c	1 Mar 2004 13:27:57 -0000
@@ -167,6 +167,7 @@
  extern int tcx_setup(char*);
  extern int leo_init(void);
  extern int leo_setup(char*);
+extern int mq1100fb_init(void);
  extern int kyrofb_init(void);
  extern int kyrofb_setup(char*);

@@ -385,6 +386,9 @@
  #ifdef CONFIG_FB_VOODOO1
  	{ "sstfb", sstfb_init, sstfb_setup },
  #endif
+#ifdef CONFIG_FB_MQ1100
+	{ "mq1100fb", mq1100fb_init, NULL },
+#endif
  #ifdef CONFIG_FB_KYRO
  	{ "kyrofb", kyrofb_init, kyrofb_setup },
  #endif
@@ -1303,6 +1307,9 @@

  	devfs_mk_cdev(MKDEV(FB_MAJOR, i),
  			S_IFCHR | S_IRUGO | S_IWUGO, "fb/%d", i);
+
+    notifier_call_chain (&fb_notifier_list, FB_EVENT_FB_REGISTERED, 
fb_info);
+
  	return 0;
  }

Index: drivers/video/console/fbcon.c
===================================================================
RCS file: /cvs/linux/kernel26/drivers/video/console/fbcon.c,v
retrieving revision 1.3
diff -u -b -r1.3 fbcon.c
--- drivers/video/console/fbcon.c	29 Feb 2004 01:49:04 -0000	1.3
+++ drivers/video/console/fbcon.c	1 Mar 2004 13:27:57 -0000
@@ -2295,6 +2295,10 @@
  	case FB_EVENT_RESUME:
  		fbcon_resumed(info);
  		break;
+    case FB_EVENT_FB_REGISTERED:
+        /* a framebuffer was registered, try to take over the console */
+        take_over_console(&fb_con, first_fb_vc, last_fb_vc, 
fbcon_is_default);
+        break;
  	}
  	return 0;
  }
@@ -2333,16 +2337,15 @@

  int __init fb_console_init(void)
  {
-	if (!num_registered_fb)
-		return -ENODEV;
-	take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
  	acquire_console_sem();
  	if (!fbcon_event_notifier_registered) {
  		fb_register_client(&fbcon_event_notifer);
  		fbcon_event_notifier_registered = 1;
  	}
  	release_console_sem();
-
+    if (!num_registered_fb)
+        return -ENODEV;
+    take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
  	return 0;
  }

Index: include/linux/fb.h
===================================================================
RCS file: /cvs/linux/kernel26/include/linux/fb.h,v
retrieving revision 1.2
diff -u -b -r1.2 fb.h
--- include/linux/fb.h	29 Feb 2004 01:49:22 -0000	1.2
+++ include/linux/fb.h	1 Mar 2004 13:27:58 -0000
@@ -353,6 +353,8 @@
   *	if you own it
   */
  #define FB_EVENT_RESUME			0x03
+/*	A new framebuffer registered */
+#define FB_EVENT_FB_REGISTERED	0x04

  extern int fb_register_client(struct notifier_block *nb);
  extern int fb_unregister_client(struct notifier_block *nb);


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

             reply	other threads:[~2004-03-02 11:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-02 11:38 Pattrick Hueper [this message]
2004-03-02 17:41 ` [PATCH] notify fbcon if framebuffer registered James Simmons
2004-03-02 20:42   ` Pattrick Hüper

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=40447251.3050801@gmx.net \
    --to=pattyh@gmx.net \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    /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.