Writing I2C chip driver in combination with other structure
From: aurum spark <hidden>
Date: 2012-07-20 10:54:45
Hi All,
I have written and seen lot of code of i2c drivers for input subsystem
devices and much familiar with that. Now I have started writing driver
for one chip that is not exactly type of input device. So, little bit
confused about how should be the driver architecture so that it will
be a clean code yet simple. Following text and diagram explains short
functional description of chip.
Chip Interface :-
==========
====== =======
| | | I2C |
| | ----- I2C --- | Device |
| ARM | ----- Bus -- | With rw | ------------ Input Connect
| | | regs |
| | ---------------| |
====== INTR =======
So above picture depicts how chip is interfaced to ARM CPU. This chip
has some registers which are rw and can be used to read certain
information from chip or to program it. This chip is capable of giving
intterupt to CPU. This chip has one input which it like some cable
connection. It detects when this cable is connected and raises the
interrupt.
Functionality Expected in Driver:-
===================
1. Driver should communicate with chip over I2C.
2. Driver should report event to user space upon receiving interrupt
from I2C device.
3. Driver should be capable of programming I2C chip @ the time of
initialization as well should be capable of changing registers as and
when Linux User Space application wants to.
What I have thought of:-