Overview

This s4548 driver exposes uses the kernel's i2c driver model to expose
the functionality of the s4548 i2c LCD to userspace.
This screen doesn't exactly seem common, but the code isn't too complex
so it may act as a helpful example for anyone trying to implement an i2c
device driver

=============
Functionality
=============

For each attached screen a character device node is created which allows
a user to access the screen:
/dev/s4548-n, where n is the screen number

You may want to add a udev rule to make the node writable by people
other than root (plugdev in this case):

# /etc/udev/rules.d/15-s4548.rules
ACTION=="add", SUBSYSTEM=="s4548", GROUP="plugdev", MODE="0664"

For each screen, a buffer is created, as well as a cache representing
what is currently displayed. If the screen's auto-update is enabled, any
changes to the buffer will be automatically written to the screen.
Using the device node, a user can either write/read directly to the
buffer through reac()/write(), send a command through an ioctl, or
memory map the buffer.

Auto-update is enabled whenever the device node is opened, so changes
will be automatically applied to the screen.

=====================
Setup on Raspberry Pi
=====================

To tell the i2c system about an attached display, you can use the 
new_device node in sysfs.

For example, on a raspberry pi, the following command will add an 
s4548 to the i2c-0 bus:

echo s4548 0x3A > /sys/class/i2c-adapter/i2c-0/new_device

Alternatively, you can add it directly to the board info in the kernel.
On a raspberry pi, this can be done thus:
In linux/arch/arm/mach-bcm2708/bcm2708.c add:

static struct i2c_board_info bcm2708_i2c_s4548_info = {
	I2C_BOARD_INFO("s4548", 0x3A),
};

To declare the screen, and then in the function bcm2708_init(void),
register it at some point after bsc0 is registered. Mine looks like
this:

bcm_register_device(&bcm2708_bsc0_device);
bcm_register_device(&bcm2708_bsc1_device);
i2c_register_board_info(0, &bcm2708_i2c_s4548_info, 1);

If everything worked OK, you should have a device node called
/dev/s4548-0 (or something similar)

You can test the screen is working by writing to the device node:
cat /dev/urandom > /dev/s4548-0 # should display random noise
cat /dev/zero > /dev/s4548-0 # should clear the display

=======
Contact
=======

Should you want to you can get hold of me (Brian Starkey) at:
stark3y[at]gmail.com