public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mack <daniel-rDUAYElUppE@public.gmane.org>
To: Uma Kanta Patro <upatro-cl0A3XQdnGcanlnWow0HJg@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Help Regarding I2C Driver...
Date: Mon, 23 Mar 2009 09:40:34 +0100	[thread overview]
Message-ID: <20090323084034.GB28502@buzzloop.caiaq.de> (raw)
In-Reply-To: <000001c9ab6f$4ee35290$eca9f7b0$@com>

On Mon, Mar 23, 2009 at 09:54:50AM +0530, Uma Kanta Patro wrote:
>                 This is Uma Kanta, seeking some help regarding the I2C
> driver development on ARM Linux 2.6.19 platform.

This version is ancient, you should consider updating to something more
recent.

> I referred the second part of i2C driver articles in Linux Journal by Greg
> Kroah. As well as the book Essential Linux Device Drivers.
> I have to make I2C driver for a RTC (DS1340) and a camera module (Omnivision
> OVM7670).
> I could be able to make a chip driver. Unfortunately I was unable to insert
> the core driver “i2c_core” internally. So I inserted the i2c_core.ko and my
> own driver i2c_test.ko.
> Now both drivers are getting inserted fine but the problem exists is:
> In my init I am adding my i2c driver structure by using “i2c_add_driver()”,
> and my i2c driver structure named “i2c_test_driver”, whose declaration is as
> follows:
> 
> struct i2c_driver i2c_test_driver = {
>                 .driver = {
>                                 .name   = "i2c_test",
>                 },
>                 .id = I2C_DRIVERID_OVCAMCHIP,            /* OmniVision CMOS
> image sens.            *//* defined in include/linux/i2c-id.h */
>                 .attach_adapter               = i2c_test_attach_adapter,
>                 .detach_client   = i2c_test_detach_client,
> };

attach_adapter and friends are legacy callbacks, you should not use them
in new drivers. Did you read Documentation/i2c/writing-clients?

> So here “list_for_each(item,&adapters)” returns FALSE for me. So my attach
> adapter function, “i2c_test_attach_adapter()” is not getting called.

Probing should be done by setting i2c_board_info from your board support
code - also described in Documentation/i2c/writing-clients.

> So I searched where the entry “adapters” is getting a tail added in the
> function “i2c_add_adapter()” So the function “i2c_add_adapter ()” will be
> called by any client driver(as mentioned in comment…).
> I tried by all “*.ko” files in KERN_SRC/drivers/i2c/algos/ but no effect.
> So now to get the full functional I2C chip driver do I need to write a
> client driver for it?

You're digging too much through the core code. It works well for others,
so debugging this part is not the first thing you should consider. Best
thing is probably to grab an existing driver and see how it does the
job.

Daniel

  reply	other threads:[~2009-03-23  8:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-23  4:24 Help Regarding I2C Driver Uma Kanta Patro
2009-03-23  8:40 ` Daniel Mack [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-03-24  5:36 Uma Kanta
     [not found] ` <A86BA2998E0E00468669D392AF0631BBB26E-MbLMV4EUncCnnRLkZrclm3upHJ39lVTxwzqs5ZKRSiY@public.gmane.org>
2009-03-24  9:54   ` Daniel Mack

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=20090323084034.GB28502@buzzloop.caiaq.de \
    --to=daniel-rduayeluppe@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=upatro-cl0A3XQdnGcanlnWow0HJg@public.gmane.org \
    /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