Re: How to write driver that needs to call another driver?

From: John Stoffel
Date: Tue Jan 26 2010 - 16:45:25 EST

Stanislav> My Zaurus SL-C3200 PDA needs a driver that needs to call
Stanislav> another driver from another part of the device tree:

Stanislav> MAX1111 (4 channel A/D) is connected to several other
Stanislav> pieces of hardware (audio player remote keyboard, battery
Stanislav> voltage, battery temperature, external power voltage).

Stanislav> Battery power and charging management needs to read values
Stanislav> from MAX1111 during. Also Remote Keyboard input device
Stanislav> needs to read MAX1111.

Stanislav> But both drivers also need dedicated GPIO that are
Stanislav> allocated on Scoop chip (different part of the platform
Stanislav> device tree).

Stanislav> What is the best way to implement it?

By no means am I a driver expert or writer, but from what I recall in
the past when such questions came up is for you to write a low level
core driver, which binds to the device, and then exposes that various
interfaces you want to bind to for other devices to talk to.

This gets the ref counting right, and lets you know when something is
accessing the MAX1111, so that suspend and such happen in the correct

Look through the lkml archives for previous answers. I'm sure Greg
will have a better answer and a pointer to an example driver to look

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