From: "John Stoffel" <john@stoffel.org>
To: Stanislav Brabec <utx@penguin.cz>
Cc: linux-kernel@vger.kernel.org
Subject: Re: How to write driver that needs to call another driver?
Date: Tue, 26 Jan 2010 16:45:15 -0500 [thread overview]
Message-ID: <19295.25195.709536.806581@stoffel.org> (raw)
In-Reply-To: <1264540265.2411.20.camel@utx.utx.cz>
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
next prev parent reply other threads:[~2010-01-26 21:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-26 21:11 Stanislav Brabec
2010-01-26 21:45 ` John Stoffel [this message]
2010-01-26 21:46 ` Andreas Mohr
2010-01-27 18:28 ` Russ Dill
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19295.25195.709536.806581@stoffel.org \
--to=john@stoffel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=utx@penguin.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®