Display class
Subsystems (6)
Ok, here is the patch (against git7+displayclass) which moves auxdisplay/* to video/display/* and start using the display class.
It is just a draft, but there isn't much code changed from -mm2.
- I would remove "struct device *dev, void *devdata" of display_device_register() Are they neccesary for other display drivers? I have to pass NULL right now.
- I would add a paramtere ("char *name") to display_device_register() so we set the name when registering. Right now I have to set my name after inited, and this is a Linux module and not a person borning, right? ;)
- I would add a read/writeable attr called "rate" for set/unset the refresh rate of a display.
- I was going to maintain the drivers/auxdisplay/* tree.
Are you going to maintain the driver? I think so, just for being sure.
P.S.
When I was working at 2.6.19-rc6-mm2 it worked all fine, but now I have copied it to git7 I'm getting some weird segmentation faults (oops) when at cfag12864bfb_init, at mutex_lock() in display_device_unregister module... I think unrelated (?), but I will look for some mistake I made.
miguelojeda-draft-drivers-video-display-add-support.patch
---
CREDITS +10 -0
@@ -2562,6 +2562,16 @@ S: Subiaco, 6008 S: Perth, Western Australia S: Australia +N: Miguel Ojeda Sandonis +E: [email protected] +W: http://maxextreme.googlepages.com/ +D: Author: ks0108 LCD Controller driver +D: Author: cfag12864b LCD driver +D: Author: cfag12864bfb LCD framebuffer driver +S: C/ Mieses 20, 9-B +S: Valladolid 47009 +S: Spain + N: Greg Page E: [email protected] D: IPX development and support
Documentation/display/cfag12864b new file +105 -0
105 lines not on this page · raw message
Documentation/display/cfag12864b-example.c new file +282 -0
282 lines not on this page · raw message
Documentation/display/ks0108 new file +55 -0
55 lines not on this page · raw message
MAINTAINERS +21 -0
@@ -659,6 +659,20 @@ L: [email protected] L: [email protected] S: Maintained +CFAG12864B LCD DRIVER +P: Miguel Ojeda Sandonis +M: [email protected] +W: http://maxextreme.googlepages.com/display.htm +L: [email protected] +S: Maintained + +CFAG12864BFB LCD FRAMEBUFFER DRIVER +P: Miguel Ojeda Sandonis +M: [email protected] +W: http://maxextreme.googlepages.com/display.htm +L: [email protected] +S: Maintained + COMMON INTERNET FILE SYSTEM (CIFS) P: Steve French M: [email protected]
@@ -1752,6 +1766,13 @@ M: [email protected] L: [email protected] S: Maintained +KS0108 LCD CONTROLLER DRIVER +P: Miguel Ojeda Sandonis +M: [email protected] +W: http://maxextreme.googlepages.com/display.htm +L: [email protected] +S: Maintained + LAPB module L: [email protected] S: Orphan
drivers/video/display/Kconfig +98 -0
102 lines not on this page · raw message
drivers/video/display/Makefile +3 -0
@@ -5,3 +5,6 @@ display-objs := display-sysfs.o obj-$(CONFIG_DISPLAY_SUPPORT) += display.o obj-$(CONFIG_DISPLAY_DDC) += display-ddc.o + +obj-$(CONFIG_KS0108) += ks0108.o +obj-$(CONFIG_CFAG12864B) += cfag12864b.o cfag12864bfb.o
drivers/video/display/cfag12864b.c new file +404 -0
404 lines not on this page · raw message
drivers/video/display/cfag12864bfb.c new file +205 -0
205 lines not on this page · raw message
drivers/video/display/ks0108.c new file +166 -0
166 lines not on this page · raw message
include/linux/cfag12864b.h new file +91 -0
91 lines not on this page · raw message
include/linux/ks0108.h new file +46 -0
46 lines not on this page · raw message
Quoted 12 lines · Miguel Ojeda Sandonis
Ok, here is the patch (against git7+displayclass) which moves auxdisplay/* to video/display/* and start using the display class.
It is just a draft, but there isn't much code changed from -mm2.
- I would remove "struct device *dev, void *devdata" of
display_device_register()Are they neccesary for other display drivers? I have to pass NULL right now.- I would add a paramtere ("char *name") to
display_device_register()so we set the name when registering. Right now I have to set my name after inited, and this is a Linux module and not a person borning, right? ;)
Quoted 5 lines
- I would add a read/writeable attr called "rate" for set/unset the refresh rate of a display.
- I was going to maintain the
drivers/auxdisplay/*tree.
Are you going to maintain the driver? I think so, just for being sure.
I meant display driver (display/*).
Quoted 8 lines
P.S.When I was working at 2.6.19-rc6-mm2 it worked all fine, but now I have copied it to git7 I'm getting some weird segmentation faults (oops) when at
cfag12864bfb_init, atmutex_lock()indisplay_device_unregistermodule... I think unrelated (?), but I will
I meant display_device_unregister function of display-sysfs.c
--
The changes have been made in driver/video/display/cfag12864bfb.c, so please focus the review on it.
Thanks
Quoted 3 lines
- I would remove "struct device *dev, void *devdata" of
display_device_register()Are they neccesary for other display drivers? I have to pass NULL right now.
Yes. Passing in a struct device allows you a link between the device and the class. If you pass in the device for the parport a link to the parport device would exist in you displayX directory. The devdata is used by the probe function to get data about the monitor if it is not NULL.
In the case of most desktop monitors they have EDID blocks. You can retrieve them (devdata) and it gets parsed thus you have detail data about the monitor. In your case it can be null.
Quoted 3 lines
- I would add a paramtere ("char *name") to
display_device_register()so we set the name when registering. Right now I have to set my name after inited, and this is a Linux module and not a person borning, right? ;)
The probe function gets this for you. In your case you would have a probe method that would just fill in the name of the LCD. For me using the ACPI video driver I get the name for my monitor
LEN 15"XGA 200nit
Which is the manufacturer - monitor id - ascii block.
Quoted 2 lines
- I would add a read/writeable attr called "rate" for set/unset the refresh rate of a display.
I suggest creating a group for your driver. See device.h for group_attributes.
Quoted 2 lines
- I was going to maintain the
drivers/auxdisplay/*tree.
Are you going to maintain the driver? I think so, just for being sure.
Yes. I need it for the ACPI video and fbdev layer. Remember its in the early stages yet.
Quoted 7 lines
P.S.When I was working at 2.6.19-rc6-mm2 it worked all fine, but now I have copied it to git7 I'm getting some weird segmentation faults (oops) when at
cfag12864bfb_init, atmutex_lock()indisplay_device_unregistermodule... I think unrelated (?), but I will look for some mistake I made.
Did you solve the problem?
Quoted 39 lines · James Simmons
Quoted 3 lines
- I would remove "struct device *dev, void *devdata" of
display_device_register()Are they neccesary for other display drivers? I have to pass NULL right now.Yes. Passing in a struct device allows you a link between the device and the class. If you pass in the device for the parport a link to the parport device would exist in you displayX directory. The devdata is used by the probe function to get data about the monitor if it is not NULL.
In the case of most desktop monitors they have EDID blocks. You can retrieve them (devdata) and it gets parsed thus you have detail data about the monitor. In your case it can be null.
Quoted 3 lines
- I would add a paramtere ("char *name") to
display_device_register()so we set the name when registering. Right now I have to set my name after inited, and this is a Linux module and not a person borning, right? ;)The probe function gets this for you. In your case you would have a probe method that would just fill in the name of the LCD. For me using the ACPI video driver I get the name for my monitor
LEN 15"XGA 200nit
Which is the manufacturer - monitor id - ascii block.
Quoted 2 lines
- I would add a read/writeable attr called "rate" for set/unset the refresh rate of a display.
I suggest creating a group for your driver. See
device.hforgroup_attributes.Quoted 2 lines
- I was going to maintain the
drivers/auxdisplay/*tree.
Are you going to maintain the driver? I think so, just for being sure.Yes. I need it for the ACPI video and fbdev layer. Remember its in the early stages yet.
Quoted 2 lines
P.S.
Quoted 8 lines
Quoted 5 lines
When I was working at 2.6.19-rc6-mm2 it worked all fine, but now I have copied it to git7 I'm getting some weird segmentation faults (oops) when at
cfag12864bfb_init, atmutex_lock()indisplay_device_unregistermodule... I think unrelated (?), but I will look for some mistake I made.Did you solve the problem?
I didn't look further, but I will be able to try again in some hours. Anyway, the problem is probably at cfag12864bfb.c (as it was almost the only file I modified from -mm2); but I can't tell where the problem is as I tried just a few times.
Please review cfag12864bfb_init/_exit to check if your code/class is intended to be used that way, I will focus on the segfaults.
Greets!
Signature · 2 lines
Miguel Ojeda http://maxextreme.googlepages.com/index.htm
Quoted 12 lines · James Simmons
Quoted 8 lines
P.S.When I was working at 2.6.19-rc6-mm2 it worked all fine, but now I have copied it to git7 I'm getting some weird segmentation faults (oops) when at
cfag12864bfb_init, atmutex_lock()indisplay_device_unregistermodule... I think unrelated (?), but I will look for some mistake I made.Did you solve the problem?
Ok, found it. It was at cfag12864bfb_init:
cfag12864bfb_device = display_device_register(&cfag12864bfb_driver,
NULL, NULL);
if (!cfag12864bfb_device) {
printk(KERN_ERR CFAG12864BFB_NAME ": ERROR: "
"can't register display device\n");
ret = -ENODEV;
goto fbregistered;
}
/*cfag12864bfb_device->name = cfag12864bfb_name;
cfag12864bfb_device->request_state = 1;*/
cfag12864bfb_power = 1;
cfag12864b_power_on();The commented code. I have exchange it to pass the name through probe as you suggested, still, it brokes when rmmoding it at display_device_unregister:
root@morfeo:/usr/src/git/linux-2.6.19-git12# dmesg [ 1593.770774] BUG: unable to handle kernel paging request at virtual address ff fffffc [ 1593.770780] printing eip: [ 1593.770782] c02e3f3f [ 1593.770784] *pde = 00003067 [ 1593.770787] Oops: 0002 [#1] [ 1593.770788] PREEMPT SMP [ 1593.770791] Modules linked in: cfag12864bfb display cfag12864b ks0108 ppdev n ls_utf8 ntfs ipv6 md_mod af_packet tsdev snd_intel8x0 snd_ac97_codec snd_ac97_bu s snd_pcm_oss snd_mixer_oss sk98lin psmouse snd_pcm snd_timer snd soundcore parp ort_pc parport skge floppy snd_page_alloc serio_raw pcspkr rtc intel_agp agpgart evdev dm_mirror dm_mod ide_generic ide_disk ide_cd cdrom piix generic vga16fb v gastate [ 1593.770829] CPU: 1 [ 1593.770829] EIP: 0060:[<c02e3f3f>] Not tainted VLI [ 1593.770831] EFLAGS: 00010282 (2.6.19-git12 #1) [ 1593.770838] EIP is at mutex_lock+0x0/0xb [ 1593.770841] eax: fffffffc ebx: fffffff4 ecx: 00000002 edx: f9955f00 [ 1593.770844] esi: 00000000 edi: fffffffc ebp: e2ae6000 esp: e2ae7f48 [ 1593.770847] ds: 007b es: 007b ss: 0068 [ 1593.770850] Process rmmod (pid: 13348, ti=e2ae6000 task=dfd6f030 task.ti=e2ae 6000) [ 1593.770852] Stack: f9952114 f9955e00 00000000 00000003 f9955066 c01374a1 6761 6663 36383231 [ 1593.770860] 62666234 b7eec000 f7d68780 c014f67b ffffffff b7eed000 f7d6 8784 e2616aac [ 1593.770868] b7eed000 e2616ab8 e2616aac f7d68780 00d687b4 f9955e00 0000 0880 e2ae7fa8 [ 1593.770877] Call Trace: [ 1593.770879] [<f9952114>] display_device_unregister+0x13/0x51 [display] [ 1593.770888] [<f9955066>] cfag12864bfb_exit+0xa/0x23 [cfag12864bfb] [ 1593.770893] [<c01374a1>] sys_delete_module+0x11d/0x189 [ 1593.770902] [<c014f67b>] do_munmap+0x177/0x1d0 [ 1593.770913] [<c0102d76>] sysenter_past_esp+0x5f/0x85 [ 1593.770922] [<c02e0033>] atm_dev_ioctl+0x35f/0x655 [ 1593.770929] ======================= [ 1593.770931] Code: c0 8d 54 24 08 8d 4c 24 1c 89 4c 24 1c 89 4c 24 20 8b 4c 24 38 89 0c 24 89 e9 8b 44 24 04 e8 3f ff ff ff 83 c4 24 5b 5e 5f 5d c3 <f0> ff 08 79 05 e8 1b 01 00 00 c3 f0 ff 00 7f 05 e8 34 00 00 00 [ 1593.770973] EIP: [<c02e3f3f>] mutex_lock+0x0/0xb SS:ESP 0068:e2ae7f48 [ 1593.770979]
Signature · 2 lines
Miguel Ojeda http://maxextreme.googlepages.com/index.htm