[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <19295.25195.709536.806581@stoffel.org>
Date: Tue, 26 Jan 2010 16:45:15 -0500
From: "John Stoffel" <john@...ffel.org>
To: Stanislav Brabec <utx@...guin.cz>
Cc: linux-kernel@...r.kernel.org
Subject: Re: How to write driver that needs to call another driver?
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
order.
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
at.
Cheers,
John
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists