Linux I2C development
 help / color / mirror / Atom feed
* Question about i2c new style modle
@ 2008-10-12  6:35 Wen Wang
       [not found] ` <56458e0810112335r529622dei4c6891465c6fdf88-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Wen Wang @ 2008-10-12  6:35 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA


[-- Attachment #1.1: Type: text/plain, Size: 496 bytes --]

Hi all,

 Currently I'm writing an i2c adapter driver and a client driver under
2.6.25 kernel, and I need to update those drivers into 2.6.27 kernel.

Can anyone please help to tell me if I have to upgrade my I2C client driver
from legacy binding model to new style binding model in 2.6.27 kernel or
not? If I have to :(, I don't know which part of code will update the board
info about I2C devices or this should be done by the client driver?

Can anyone please help to answer that?

Thanks
Wen

[-- Attachment #1.2: Type: text/html, Size: 707 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

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

* Re: Question about i2c new style modle
       [not found] ` <56458e0810112335r529622dei4c6891465c6fdf88-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2008-10-12  7:57   ` Wolfram Sang
       [not found]     ` <20081012075715.GA26683-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2008-10-12  7:57 UTC (permalink / raw)
  To: Wen Wang; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA


[-- Attachment #1.1: Type: text/plain, Size: 990 bytes --]

Hello Wen,

On Sun, Oct 12, 2008 at 02:35:49PM +0800, Wen Wang wrote:

>    Can anyone please help to tell me if I have to upgrade my I2C client
>    driver from legacy binding model to new style binding model in 2.6.27
>    kernel or not?

It is not required yet, but it is always a good idea to move to the new
binding (which will be required somewhen, nevertheless).

>    If I have to :(, I don't know which part of code will
>    update the board info about I2C devices or this should be done by the
>    client driver?

I am not sure if I understood what you meant with "updating the board
info". You supply i2c_board_info in your board init code and when the
i2c adapter is initialized, it will call the client drivers
probe-function. Maybe the guide in Documentation/i2c/upgrading-clients
will further help you?

All the best,

   Wolfram

-- 
  Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

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

* Re: Question about i2c new style modle
       [not found]     ` <20081012075715.GA26683-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2008-10-12 11:52       ` Wen Wang
       [not found]         ` <56458e0810120452n2def8400n883ad46d0440e779-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Wen Wang @ 2008-10-12 11:52 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA


[-- Attachment #1.1: Type: text/plain, Size: 1350 bytes --]

 Hi Wolfram,

Thank you for your quick response, really appreciate.

You're saying "You supply i2c_board_info in your board init code and when
the
i2c adapter is initialized", but I'm quite sure there won't be a such
static i2c_board_info in the board init code.

And I'm just wonder if there is a dynamic detect method to go?

Here is my proposed code, can you please help to correct it if I'm wrong?

static const unsigned short normal_i2c[] = { DEVICE_ADDRESS, I2C_CLIENT_END
};
I2C_CLIENT_INSMOD(foo);

static int foo_detect(struct i2c_client *client, int kind,
                             struct i2c_board_info *info)
{
         /* Things here */
         return 0;
}

static int foo_probe(struct i2c_client *client,
                            const struct i2c_device_id *id)
{
          /* Things here */
         return 0;
}

static int foo_remove(struct i2c_client *client)
{
         /* Things here */
         return 0;
}

static const struct i2c_device_id foo_id[] = {
         { "foo", 0 },
         { }
};

static struct i2c_driver foo_driver = {
         .driver = {
                 .name = "foo",
         },
         .probe  = foo_probe,
         .remove  = foo_remove,
         .id_table = foo_id,
         .class  = I2C_CLASS_CAM_DIGITAL,
         .detect  = foo_detect,
         .address_data = &addr_data,
};

Best Regards
Wen

[-- Attachment #1.2: Type: text/html, Size: 3016 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

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

* Re: Question about i2c new style modle
       [not found]         ` <56458e0810120452n2def8400n883ad46d0440e779-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2008-10-12 13:00           ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2008-10-12 13:00 UTC (permalink / raw)
  To: Wen Wang; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA


[-- Attachment #1.1: Type: text/plain, Size: 738 bytes --]

Hello Wen,

On Sun, Oct 12, 2008 at 07:52:08PM +0800, Wen Wang wrote:

>    i2c adapter is initialized", but I'm quite sure there won't be a such
>    static i2c_board_info in the board init code.

Well, you could add one :)

>    And I'm just wonder if there is a dynamic detect method to go?

There is also Documentation/i2c/writing-clients with a chapter about
Device creation and Device detection using the standard driver model.
For reference examples, just look in drivers/hwmon/. There should be
plenty of drivers which use a detect-callback, in case you need this.

All the best,

   Wolfram

-- 
  Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

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

end of thread, other threads:[~2008-10-12 13:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-12  6:35 Question about i2c new style modle Wen Wang
     [not found] ` <56458e0810112335r529622dei4c6891465c6fdf88-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-10-12  7:57   ` Wolfram Sang
     [not found]     ` <20081012075715.GA26683-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2008-10-12 11:52       ` Wen Wang
     [not found]         ` <56458e0810120452n2def8400n883ad46d0440e779-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-10-12 13:00           ` Wolfram Sang

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