[lkml]   [2006]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectDriver - cfag12864b Crystalfontz 128x64 2-color Graphic LCD

I have just finished a driver for the cfag12864b Crystalfontz 128x64
2-color Graphic LCD Series. You can check them at:

The drivers use the parallel port (data & control). Although the
company doesn't recommend it, they say the cfag12864b works fine that
way. The (unofficial) wiring is described at: The
wiring as seen is used by Windows programs like LCDStudio, so although
it isn't official, it's the most popular, so I wrote the driver
expecting that wiring.

The driver works fine, the interface is easy (I think) and I have done
as many tests as I could. I have tried it on some computers, some
different kernel versions with two different LCDs and works well on
all configurations.

Because this kind of driver is unusual and I'm a newbie device driver
writer, I would like to receive some answers/help/suggestions:

1. The cfag12864b has two ks0108 controllers. Each one share the same
wiring, so you have to set one bit to tell the cfag12864b which
controller are you talking to. So I wrote a small driver for the
ks0108 controller, and then a more general cfag12864b driver which
depends on the ks0108 driver. This way, other programmers could use
the ks0108 driver and easily write more Graphic LCD drivers which uses
the same controller, instead of rewriting all the code: "Do one thing
and do it well.". I thought it was the right way to approach the
problem. Was it?

2. The driver right now is requesting ports using request_region at
init time. I know there are the parport_pc, parport and lp drivers. I
set the port as a module parameter, so you can change it easily. That
way, you can load both parport and cfag12864b modules. Still, I'm not
sure if it is the right approach. Should I use the parport interface
to request and use the ports, or leave the driver as is?

3. The module uses a external script to create the neccesary devices.
By now, I have just one device, some like /dev/cfag12864b0 where you
can write, and it will be printed on the screen. Although I have tried
to simplify it as much as possible, still you have to know the way the
LCD is going to print the data you send. Just reading the driver
documentation or doing two or three "echo hello > /dev/cfag12864b0"
you can figure out how your user-space application should write the
device. Still, I wrote a example function application that reads a
128x64 boolean matrix and writes a 1024 bytes vector (128*64/8)
properly that you can send to the device. I can easily write a new
device, like /dev/cfag12864b0matrix where you can write the 128x64
matrix directly, without worrying anything else. But, on the other
side, although it is simpler, I think it is worse, because you have to
wait until you receive all the boolean matrix before the driver can
start converting it to the cfag12864b format. If this makes no sense,
please tell me, I will explain it further.

4. I would like to release the driver to the public, GPL'ed. Has it
any possibility to enter in the mainstream kernel? Who can review it?

It is my first attempt to write an useful Linux device driver, so I
expect this won't be a lame :-)

Thank you,

Miguel Ojeda
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-09-08 19:13    [W:0.044 / U:32.992 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site