public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* Looking for help writing an i2c client for i2c-core
@ 2009-06-23  4:02 ` Brian Tompson
  2009-06-24  8:37   ` Linus Walleij
  2009-06-24  8:54   ` Jean Delvare
  0 siblings, 2 replies; 4+ messages in thread
From: Brian Tompson @ 2009-06-23  4:02 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hello,

In my i2c searches I stumbled upon this list.  I hope this message is
appropriate here.

I am trying to write an i2c client driver for the i2c core, using the Linux
Driver Model (new style driver).
I am looking for a list of steps I need to take to accomplish this.

I have been looking for a list something like this:

Load this i2c-core structure with this information.
Call this i2c-core function to register your driver.
Call this i2c-core function to connect to the adapter or bus or algorithm
(don’t know which)
Write a probe function that does this.
Write a remove function that does this.
Call this i2c-core function to write raw i2c data (not SMBus) to your device
Call this i2c-core function to read raw i2c data from your device.
Call this i2c-core function to disconnect from the adapter or bus or
algorithm

Or whatever the actual steps should be.

I have started writing a driver and have used i2c_add_driver() to register
my driver with i2c_core.
Now what?  Probe, attach, send, remove, …?  Is there a resource available
that simply lays out these facts?  I think a resource like that would be
very useful to someone trying to develop a client driver for the i2c-core
using the Linux Driver Model.


Thank you for your time,
Brian Tompson

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Looking for help writing an i2c client for i2c-core
  2009-06-23  4:02 ` Looking for help writing an i2c client for i2c-core Brian Tompson
@ 2009-06-24  8:37   ` Linus Walleij
  2009-06-24  8:54   ` Jean Delvare
  1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2009-06-24  8:37 UTC (permalink / raw)
  To: Brian Tompson; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

2009/6/23 Brian Tompson <brian.tompson-4c4C/Gi1/tVWk0Htik3J/w@public.gmane.org>:

> I am trying to write an i2c client driver for the i2c core, using the Linux
> Driver Model (new style driver).

I don't get the whole view of what you actually want to do but you
might be wanting to create a "MFD" multi-functional device driver.

Look at e.g. drivers/mfd/wm8350-core.c and how that driver
spawns a number of sub-platform devices which are then used
by e.g. drivers/regulator/wm8350-regulator.c

Linus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Looking for help writing an i2c client for i2c-core
  2009-06-23  4:02 ` Looking for help writing an i2c client for i2c-core Brian Tompson
  2009-06-24  8:37   ` Linus Walleij
@ 2009-06-24  8:54   ` Jean Delvare
       [not found]     ` <20090624105411.64a22474-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Jean Delvare @ 2009-06-24  8:54 UTC (permalink / raw)
  To: Brian Tompson; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Mon, 22 Jun 2009 21:02:40 -0700, Brian Tompson wrote:
> In my i2c searches I stumbled upon this list.  I hope this message is
> appropriate here.
> 
> I am trying to write an i2c client driver for the i2c core, using the Linux
> Driver Model (new style driver).
> I am looking for a list of steps I need to take to accomplish this.
> 
> I have been looking for a list something like this:
> 
> Load this i2c-core structure with this information.
> Call this i2c-core function to register your driver.
> Call this i2c-core function to connect to the adapter or bus or algorithm
> (don't know which)
> Write a probe function that does this.
> Write a remove function that does this.
> Call this i2c-core function to write raw i2c data (not SMBus) to your device
> Call this i2c-core function to read raw i2c data from your device.
> Call this i2c-core function to disconnect from the adapter or bus or
> algorithm
> 
> Or whatever the actual steps should be.
> 
> I have started writing a driver and have used i2c_add_driver() to register
> my driver with i2c_core.
> Now what?  Probe, attach, send, remove, ...?  Is there a resource available
> that simply lays out these facts?  I think a resource like that would be
> very useful to someone trying to develop a client driver for the i2c-core
> using the Linux Driver Model.

Have you read Documentation/i2c/writing-clients already? That would be
a very good start. Or more generally, the developer's documentation
section on http://i2c.wiki.kernel.org/

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Looking for help writing an i2c client for i2c-core
       [not found]     ` <20090624105411.64a22474-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2009-06-25 15:48       ` Brian Tompson
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Tompson @ 2009-06-25 15:48 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Thank you both for your responses.  The link to the kernel wiki was also
worthwhile.

In my all too quick research into writing a Linux Driver Model driver,
somehow I missed the step of calling i2c_register_board_info() in the kernel
startup code.  I could register my driver with the i2c_core, but since there
was not i2c_board_info entry nothing else happened in my driver.  No that I
have added the i2c_register_board_info call, my driver callbacks are called
and I can get back to writing device driver code again.

When my schedule frees up some, I hope I can write up description of the
steps I took to get a new Linux Driver Model I2C device driver written.

Thank you for your help,
Brian



-----Original Message-----
From: Jean Delvare [mailto:khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org] 
Sent: Wednesday, June 24, 2009 1:54 AM
To: Brian Tompson
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Looking for help writing an i2c client for i2c-core

On Mon, 22 Jun 2009 21:02:40 -0700, Brian Tompson wrote:
> In my i2c searches I stumbled upon this list.  I hope this message is
> appropriate here.
> 
> I am trying to write an i2c client driver for the i2c core, using the
Linux
> Driver Model (new style driver).
> I am looking for a list of steps I need to take to accomplish this.
> 
> I have been looking for a list something like this:
> 
> Load this i2c-core structure with this information.
> Call this i2c-core function to register your driver.
> Call this i2c-core function to connect to the adapter or bus or algorithm
> (don't know which)
> Write a probe function that does this.
> Write a remove function that does this.
> Call this i2c-core function to write raw i2c data (not SMBus) to your
device
> Call this i2c-core function to read raw i2c data from your device.
> Call this i2c-core function to disconnect from the adapter or bus or
> algorithm
> 
> Or whatever the actual steps should be.
> 
> I have started writing a driver and have used i2c_add_driver() to register
> my driver with i2c_core.
> Now what?  Probe, attach, send, remove, ...?  Is there a resource
available
> that simply lays out these facts?  I think a resource like that would be
> very useful to someone trying to develop a client driver for the i2c-core
> using the Linux Driver Model.

Have you read Documentation/i2c/writing-clients already? That would be
a very good start. Or more generally, the developer's documentation
section on http://i2c.wiki.kernel.org/

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-25 15:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Acnztit3TDXTYlAdQgGYzwdBmb7Njg==>
2009-06-23  4:02 ` Looking for help writing an i2c client for i2c-core Brian Tompson
2009-06-24  8:37   ` Linus Walleij
2009-06-24  8:54   ` Jean Delvare
     [not found]     ` <20090624105411.64a22474-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-06-25 15:48       ` Brian Tompson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox