All of lore.kernel.org
 help / color / mirror / Atom feed
* Need help on selecting one (and only one) i2c bus
@ 2009-03-09 10:58 Ayman KHAMOUMA
  0 siblings, 0 replies; 13+ messages in thread
From: Ayman KHAMOUMA @ 2009-03-09 10:58 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hello everybody,

I'm new on I2C device drivers programming and I'm facing a little problem, I can't find how to select my i2c-0 bus (I have 3 of them: i2c-0, i2c-1 and i2c-2)
I'd like my probe function to probe only this bus and ignore the others.
I guess I can find the solution with the i2c_address_data structure, but I don't really understand how to use it...


Thanks in advance,

Ayman KHAMOUMA

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

* Re: Need help on selecting one (and only one) i2c bus
       [not found]                 ` <001301c9a269$ab95d940$b23e81a4-J7BnVcvkGbbQT0dZR+AlfA@public.gmane.org>
@ 2009-03-11 19:09                   ` Jean Delvare
  0 siblings, 0 replies; 13+ messages in thread
From: Jean Delvare @ 2009-03-11 19:09 UTC (permalink / raw)
  To: Ayman KHAMOUMA; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hi Ayman,

On Wed, 11 Mar 2009 17:51:48 +0100, Ayman KHAMOUMA wrote:
> It's me again...
> 
> In I2c.h I found: 
> 
> /* Mainboard arch_initcall() code should register all its I2C devices.
>  * This is done at arch_initcall time, before declaring any i2c adapters.
>  * Modules for add-on boards must use other calls.
>  */
> 
> extern int
> i2c_register_board_info(int busnum, struct i2c_board_info const *info,
> unsigned n);
> 
> I guess I have to call this function near the arch_initcall().
> I greped my folder for arch_initcall() but couldn't figure out witch file to
> use...
> Any idea ?

I'm not much into embedded architectures, and I suspect it depends on
the architecture. Looking at the latest kernel tree I see this function
is called only in machine or platform initialization files, for example:

arch/arm/mach-pxa/cm-x300.c:	i2c_register_board_info(0, cm_x300_gpio_ext_info,
arch/arm/mach-rpc/riscpc.c:	i2c_register_board_info(0, &i2c_rtc, 1);
arch/arm/mach-s3c6410/mach-smdk6410.c:	i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
arch/arm/mach-s3c6410/mach-smdk6410.c:	i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
arch/arm/plat-omap/i2c.c:		err = i2c_register_board_info(bus_id, info, len);
arch/arm/mach-s3c2440/mach-osiris.c:	i2c_register_board_info(0, osiris_i2c_devs,
arch/arm/mach-s3c2440/mach-anubis.c:	i2c_register_board_info(0, anubis_i2c_devs,
arch/arm/mach-ep93xx/core.c:	i2c_register_board_info(0, devices, num);

I can't tell more without knowing which architecture and machine or
platform you're working on. And maybe the question would be better
asked to someone who is familiar with the architecture in question.

> Another thing, what would be the equivalent of
> MODULE_DEVICE_TABLE(i2c, example_idtable);
> As you said, the i2c_device_id structure doesn't exist in this kernel...

There is no equivalent, just omit this part.

-- 
Jean Delvare
http://khali.linux-fr.org/wishlist.html

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

* RE: Need help on selecting one (and only one) i2c bus
       [not found]             ` <20090311122257.7c7805f0-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  2009-03-11 11:44               ` Ayman KHAMOUMA
@ 2009-03-11 16:51               ` Ayman KHAMOUMA
       [not found]                 ` <001301c9a269$ab95d940$b23e81a4-J7BnVcvkGbbQT0dZR+AlfA@public.gmane.org>
  1 sibling, 1 reply; 13+ messages in thread
From: Ayman KHAMOUMA @ 2009-03-11 16:51 UTC (permalink / raw)
  To: 'Jean Delvare'; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

It's me again...

In I2c.h I found: 

/* Mainboard arch_initcall() code should register all its I2C devices.
 * This is done at arch_initcall time, before declaring any i2c adapters.
 * Modules for add-on boards must use other calls.
 */

extern int
i2c_register_board_info(int busnum, struct i2c_board_info const *info,
unsigned n);

I guess I have to call this function near the arch_initcall().
I greped my folder for arch_initcall() but couldn't figure out witch file to
use...
Any idea ?

Another thing, what would be the equivalent of
MODULE_DEVICE_TABLE(i2c, example_idtable);
As you said, the i2c_device_id structure doesn't exist in this kernel...

-----Original Message-----
From: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
[mailto:linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Jean Delvare
Sent: Wednesday, March 11, 2009 12:23 PM
To: Ayman KHAMOUMA
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Need help on selecting one (and only one) i2c bus

Hi Ayman,

On Wed, 11 Mar 2009 11:55:22 +0100, Ayman KHAMOUMA wrote:
> After some researches I guess I have to use the normal_i2c and ignore
> arrays:
> 
> static unsigned short normal_i2c[] = { 0x71, I2C_CLIENT_END}; static 
> unsigned short ignore[] = { 0x01, 0x71, 0x02, 0x71, I2C_CLIENT_END};
> 
> static struct i2c_client_address_data addr_data = {
>     .normal_i2c = normal_i2c,
>     .ignore     = ignore,
> };
> 
> Int the init function I have to allocate a major to the driver, and 
> than add the I2c driver:
> i2c_add_driver(&i2c_my_drv);
> 
> After doing that, i2c_my_drv.attach_adapter is called.
> 
> Which will call (among others) my probe function, in which I call 
> i2c_attach_client.
> 
> 
> Am I in the right way ?

No. You're using the old, deprecated way to instantiate devices, and you are
abusing it (the ignore array wasn't meant to be used the way you do.)

You said you're using kernel 2.6.23.17, it's not brand new, but it's not too
old either. At any rate, it already includes the new-style device binding.
So, instead of using the old binding model and then fight to get your driver
to _not_ attach to improper devices/addresses, you should use the new model
and explicitly instantiate your device, so that your driver won't even try
to bind to the wrong devices.

I have posted an explanation about how to do this recently:
http://marc.info/?l=linux-i2c&m=123659553713018&w=2

You should convert your driver to a new-style one and use either method
1 or method 2, whichever is easier for you. See the following document for a
guide on how to update your code:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plai
n;f=Documentation/i2c/upgrading-clients;hb=HEAD

It's for kernel 2.6.26 and later but it should mostly apply to 2.6.23 too.
The only big difference I can think of is that 2.6.23 doesn't have struct
i2c_device_id, instead the device driver binding is based on the i2c driver
name. I can help you with this if you can't figure it out.

As a side note, the fact that you needed to add buses 1 and 2 to the ignore
list suggests that something is wrong with your I2C bus driver.
It is rather unlikely that all 3 I2C buses on your system have a device at
address 0x71, so your old-style driver shouldn't have instantiated 3
devices. If it did, it strongly suggests that the quick write i2c-core is
using to check for the presence of a device at a given address improperly
reported success in all cases. You really should check your I2C bus driver
and in particular the implementation of 0-byte messages before going further
with the device driver.

--
Jean Delvare
http://khali.linux-fr.org/wishlist.html
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the
body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at
http://vger.kernel.org/majordomo-info.html

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

* RE: Need help on selecting one (and only one) i2c bus
       [not found]             ` <20090311122257.7c7805f0-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2009-03-11 11:44               ` Ayman KHAMOUMA
  2009-03-11 16:51               ` Ayman KHAMOUMA
  1 sibling, 0 replies; 13+ messages in thread
From: Ayman KHAMOUMA @ 2009-03-11 11:44 UTC (permalink / raw)
  To: 'Jean Delvare'; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Thanks a lot Jean,

Well I added bus 1 and 2 to the ignore list because I thought it wat a clean
way to do it.
There is nothing at 0x71 of bus 1 and 2.
I just wanted my code to be a "generic" code and to work even if in the
future some devices were added in bus 1 et 2.

Thanks again for your help,

Ayman KHAMOUMA

-----Original Message-----
From: Jean Delvare [mailto:khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org] 
Sent: Wednesday, March 11, 2009 12:23 PM
To: Ayman KHAMOUMA
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Need help on selecting one (and only one) i2c bus

Hi Ayman,

On Wed, 11 Mar 2009 11:55:22 +0100, Ayman KHAMOUMA wrote:
> After some researches I guess I have to use the normal_i2c and ignore
> arrays:
> 
> static unsigned short normal_i2c[] = { 0x71, I2C_CLIENT_END}; static 
> unsigned short ignore[] = { 0x01, 0x71, 0x02, 0x71, I2C_CLIENT_END};
> 
> static struct i2c_client_address_data addr_data = {
>     .normal_i2c = normal_i2c,
>     .ignore     = ignore,
> };
> 
> Int the init function I have to allocate a major to the driver, and 
> than add the I2c driver:
> i2c_add_driver(&i2c_my_drv);
> 
> After doing that, i2c_my_drv.attach_adapter is called.
> 
> Which will call (among others) my probe function, in which I call 
> i2c_attach_client.
> 
> 
> Am I in the right way ?

No. You're using the old, deprecated way to instantiate devices, and you are
abusing it (the ignore array wasn't meant to be used the way you do.)

You said you're using kernel 2.6.23.17, it's not brand new, but it's not too
old either. At any rate, it already includes the new-style device binding.
So, instead of using the old binding model and then fight to get your driver
to _not_ attach to improper devices/addresses, you should use the new model
and explicitly instantiate your device, so that your driver won't even try
to bind to the wrong devices.

I have posted an explanation about how to do this recently:
http://marc.info/?l=linux-i2c&m=123659553713018&w=2

You should convert your driver to a new-style one and use either method
1 or method 2, whichever is easier for you. See the following document for a
guide on how to update your code:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plai
n;f=Documentation/i2c/upgrading-clients;hb=HEAD

It's for kernel 2.6.26 and later but it should mostly apply to 2.6.23 too.
The only big difference I can think of is that 2.6.23 doesn't have struct
i2c_device_id, instead the device driver binding is based on the i2c driver
name. I can help you with this if you can't figure it out.

As a side note, the fact that you needed to add buses 1 and 2 to the ignore
list suggests that something is wrong with your I2C bus driver.
It is rather unlikely that all 3 I2C buses on your system have a device at
address 0x71, so your old-style driver shouldn't have instantiated 3
devices. If it did, it strongly suggests that the quick write i2c-core is
using to check for the presence of a device at a given address improperly
reported success in all cases. You really should check your I2C bus driver
and in particular the implementation of 0-byte messages before going further
with the device driver.

--
Jean Delvare
http://khali.linux-fr.org/wishlist.html

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

* Re: Need help on selecting one (and only one) i2c bus
       [not found]         ` <000301c9a237$e6d3c8f0$b23e81a4-J7BnVcvkGbbQT0dZR+AlfA@public.gmane.org>
@ 2009-03-11 11:22           ` Jean Delvare
       [not found]             ` <20090311122257.7c7805f0-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Jean Delvare @ 2009-03-11 11:22 UTC (permalink / raw)
  To: Ayman KHAMOUMA; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hi Ayman,

On Wed, 11 Mar 2009 11:55:22 +0100, Ayman KHAMOUMA wrote:
> After some researches I guess I have to use the normal_i2c and ignore
> arrays:
> 
> static unsigned short normal_i2c[] = { 0x71, I2C_CLIENT_END};
> static unsigned short ignore[] = { 0x01, 0x71, 0x02, 0x71, I2C_CLIENT_END};
> 
> static struct i2c_client_address_data addr_data = {
>     .normal_i2c = normal_i2c,
>     .ignore     = ignore,
> };
> 
> Int the init function I have to allocate a major to the driver, and than add
> the I2c driver:
> i2c_add_driver(&i2c_my_drv);
> 
> After doing that, i2c_my_drv.attach_adapter is called.
> 
> Which will call (among others) my probe function, in which I call
> i2c_attach_client.
> 
> 
> Am I in the right way ?

No. You're using the old, deprecated way to instantiate devices, and
you are abusing it (the ignore array wasn't meant to be used the way
you do.)

You said you're using kernel 2.6.23.17, it's not brand new, but it's
not too old either. At any rate, it already includes the new-style
device binding. So, instead of using the old binding model and then
fight to get your driver to _not_ attach to improper devices/addresses,
you should use the new model and explicitly instantiate your device, so
that your driver won't even try to bind to the wrong devices.

I have posted an explanation about how to do this recently:
http://marc.info/?l=linux-i2c&m=123659553713018&w=2

You should convert your driver to a new-style one and use either method
1 or method 2, whichever is easier for you. See the following document
for a guide on how to update your code:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=Documentation/i2c/upgrading-clients;hb=HEAD

It's for kernel 2.6.26 and later but it should mostly apply to 2.6.23
too. The only big difference I can think of is that 2.6.23 doesn't have
struct i2c_device_id, instead the device driver binding is based on the
i2c driver name. I can help you with this if you can't figure it out.

As a side note, the fact that you needed to add buses 1 and 2 to the
ignore list suggests that something is wrong with your I2C bus driver.
It is rather unlikely that all 3 I2C buses on your system have a device
at address 0x71, so your old-style driver shouldn't have instantiated 3
devices. If it did, it strongly suggests that the quick write i2c-core
is using to check for the presence of a device at a given address
improperly reported success in all cases. You really should check your
I2C bus driver and in particular the implementation of 0-byte messages
before going further with the device driver.

-- 
Jean Delvare
http://khali.linux-fr.org/wishlist.html

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

* RE: Need help on selecting one (and only one) i2c bus
       [not found]     ` <20090310163044.571e4aff-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  2009-03-10 15:58       ` Ayman KHAMOUMA
  2009-03-10 16:03       ` Ayman KHAMOUMA
@ 2009-03-11 10:55       ` Ayman KHAMOUMA
       [not found]         ` <000301c9a237$e6d3c8f0$b23e81a4-J7BnVcvkGbbQT0dZR+AlfA@public.gmane.org>
  2 siblings, 1 reply; 13+ messages in thread
From: Ayman KHAMOUMA @ 2009-03-11 10:55 UTC (permalink / raw)
  To: 'Jean Delvare'; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

After some researches I guess I have to use the normal_i2c and ignore
arrays:

static unsigned short normal_i2c[] = { 0x71, I2C_CLIENT_END};
static unsigned short ignore[] = { 0x01, 0x71, 0x02, 0x71, I2C_CLIENT_END};

static struct i2c_client_address_data addr_data = {
    .normal_i2c = normal_i2c,
    .ignore     = ignore,
};

Int the init function I have to allocate a major to the driver, and than add
the I2c driver:
i2c_add_driver(&i2c_my_drv);

After doing that, i2c_my_drv.attach_adapter is called.

Which will call (among others) my probe function, in which I call
i2c_attach_client.


Am I in the right way ?

-----Original Message-----
From: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
[mailto:linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Jean Delvare
Sent: Tuesday, March 10, 2009 4:31 PM
To: Ayman KHAMOUMA
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Need help on selecting one (and only one) i2c bus

Hi Ayman,

On Mon, 9 Mar 2009 15:52:56 +0100, Ayman KHAMOUMA wrote:
> I'm new on I2C device drivers programming and I'm facing a little problem,
I can't find how to select my i2c-0 bus (I have 3 of them: i2c-0, i2c-1 and
i2c-2) I'd like my probe function to probe only this bus and ignore the
others.
> I guess I can find the solution with the i2c_address_data structure, but I
don't really understand how to use it...

It would help if you would first tell us what kernel version you are using,
what device you are writing a driver for, and what architecture / system
type this is all working on.

> Do I have to use the ignore_range array ?

ignore_range has gone away long ago. The last kernel that had it was
2.6.12.6, released in late August 2005. Are really you using such an old
kernel?

> Once filed, I have nothing to do ?
> 
> The device I want to probe/send data to is located on bus i2c-0 and at 
> the adresses 0x00 to 0x15

I seriously doubt this. Addresses 0x00, 0x01 and 0x02 are very special for
I2C, no device can use them. I suspect you are mixing register addresses
(the map of which is internal and specific to each device) with device
addresses on the bus.

> I guess I have to do:
> static unsigned short ignore_range[] = { 0x00, 0x16, 0xff, 0x01, 0x00, 
> 0xff, 0x02, 0x00, 0xff, I2C_CLIENT_END };
> 
> Am I right ?

No, this is seriously wrong. But I can't tell more without additional
information about what you are trying to achieve in the first place.

--
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the
body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at
http://vger.kernel.org/majordomo-info.html

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

* Re: Need help on selecting one (and only one) i2c bus
       [not found]                 ` <fd6b62c10903110319w1eebd2ebs4b83e7d1247f1678-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-03-11 10:40                   ` Daniel Mack
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Mack @ 2009-03-11 10:40 UTC (permalink / raw)
  To: 伊泽
  Cc: Ayman KHAMOUMA, linux-i2c-u79uwXL29TY76Z2rM5mHXA, pramod gurav,
	Jean Delvare

On Wed, Mar 11, 2009 at 06:19:18PM +0800, 伊泽 wrote:
> > Not true. You need to provide a firmware for that device and this
> > firmware selects the I2C slave address. Read the datasheet again.
> 
> 
> Thanks Jean, daniel,
> 
> Yeah, the capsensor has the function to re-program its own slave address ,we
> did try that already. If programmed with other address, only coming out data
> "0".
> 
> The capsensor with 0x00 can also work with correct data,except the phone
> hang problem.
> 
> I really be confused, when i2c bus unit is blocked by some slave device,  is
> it necessary to control the scl/sda by GPIO mode operation?

You need to have a master to the bus. Whether that is done by GPIO
bit-banging or with a real hardware module in some kind of processor or
peripheral device is up to you. You won't even see the difference from
the Linux API as long as your bus master is supported.

> >  "The I2C address is programmable during configuration. It can be locked
> >  to prevent accidental change by setting a flag in a config-uration
> >  register."
> >
> > > > We met much phone hang problem with i2c,errors such as "waiting for bus
> > > > free" or "exhausted retries" are all with this sensor.
> >
> > Same reason. Without a firmware, the chips does not have its I2C core
> > set up and hence it's blocking SDA and/or SCL.
> 
> I think we have the firmware, and the chips have its i2c-core set up
> already,any other situation which the device block the SDA / SCL  ?

Every device connected to the bus can probably block it. If that
happens, you need to find out why (this implies at least using a
soldering iron and an oscilloscope). But as long as you're not sure
whether you have 'the firmware' or not, I'm confident nobody on this
list can help you with that.

Daniel

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

* Re: Need help on selecting one (and only one) i2c bus
       [not found]           ` <20090311101513.271f5464-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2009-03-11  9:47             ` Daniel Mack
       [not found]               ` <fd6b62c10903110319w1eebd2ebs4b83e7d1247f1678@mail.gmail.com>
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Mack @ 2009-03-11  9:47 UTC (permalink / raw)
  To: 伊泽
  Cc: Ayman KHAMOUMA, linux-i2c-u79uwXL29TY76Z2rM5mHXA, pramod gurav,
	Jean Delvare

On Wed, 11 Mar 2009 14:27:33 +0800, 伊泽 wrote:                                                                                               
> > As you said,i2c address 0x00 is not allowed for common i2c slave device,it
> > is reserved as broadcast address.Unfortunately,our project has a sensor
> > cy8c201a0 on i2c-bus,it use 0x00 address.

Not true. You need to provide a firmware for that device and this
firmware selects the I2C slave address. Read the datasheet again.

 (page 5):

 "The I2C address is programmable during configuration. It can be locked
 to prevent accidental change by setting a flag in a config-uration
 register."

> > We met much phone hang problem with i2c,errors such as "waiting for bus
> > free" or "exhausted retries" are all with this sensor.

Same reason. Without a firmware, the chips does not have its I2C core
set up and hence it's blocking SDA and/or SCL.

Daniel

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

* Re: Need help on selecting one (and only one) i2c bus
       [not found]       ` <fd6b62c10903102327u426a4262meeabe2c581d7107b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-03-11  9:15         ` Jean Delvare
       [not found]           ` <20090311101513.271f5464-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Jean Delvare @ 2009-03-11  9:15 UTC (permalink / raw)
  To: 伊泽
  Cc: Ayman KHAMOUMA, linux-i2c-u79uwXL29TY76Z2rM5mHXA, pramod gurav

On Wed, 11 Mar 2009 14:27:33 +0800, 伊泽 wrote:
> hi Jean,
> 
> As you said,i2c address 0x00 is not allowed for common i2c slave device,it
> is reserved as broadcast address.Unfortunately,our project has a sensor
> cy8c201a0 on i2c-bus,it use 0x00 address.
> 
> We met much phone hang problem with i2c,errors such as "waiting for bus
> free" or "exhausted retries" are all with this sensor.
> 
> I guess when master would try to address this senosr,it infact send a
> broadcast address,that may cause problem easily,every slave device would
> have a chance to pull down the bus line.
> 
> Now, as the signal show,the ACk signal is too too long in hard-ware,that
> cause the the i2c-bus unit busy,which block the other i2c operation.
> 
> I am trying to re-configure i2c-unit as gpio-mode,and set high/low level
> manually as a workround.
> 
> Any good suggestion to solve this issue?

Yeah, switch to hardware which respects the I2C standard.

-- 
Jean Delvare

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

* RE: Need help on selecting one (and only one) i2c bus
       [not found]     ` <20090310163044.571e4aff-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  2009-03-10 15:58       ` Ayman KHAMOUMA
@ 2009-03-10 16:03       ` Ayman KHAMOUMA
  2009-03-11 10:55       ` Ayman KHAMOUMA
  2 siblings, 0 replies; 13+ messages in thread
From: Ayman KHAMOUMA @ 2009-03-10 16:03 UTC (permalink / raw)
  To: 'Jean Delvare'; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

I forgot to say that I'm using STLinux 2.3 

-----Original Message-----
From: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
[mailto:linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Jean Delvare
Sent: Tuesday, March 10, 2009 4:31 PM
To: Ayman KHAMOUMA
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Need help on selecting one (and only one) i2c bus

Hi Ayman,

On Mon, 9 Mar 2009 15:52:56 +0100, Ayman KHAMOUMA wrote:
> I'm new on I2C device drivers programming and I'm facing a little problem,
I can't find how to select my i2c-0 bus (I have 3 of them: i2c-0, i2c-1 and
i2c-2) I'd like my probe function to probe only this bus and ignore the
others.
> I guess I can find the solution with the i2c_address_data structure, but I
don't really understand how to use it...

It would help if you would first tell us what kernel version you are using,
what device you are writing a driver for, and what architecture / system
type this is all working on.

> Do I have to use the ignore_range array ?

ignore_range has gone away long ago. The last kernel that had it was
2.6.12.6, released in late August 2005. Are really you using such an old
kernel?

> Once filed, I have nothing to do ?
> 
> The device I want to probe/send data to is located on bus i2c-0 and at 
> the adresses 0x00 to 0x15

I seriously doubt this. Addresses 0x00, 0x01 and 0x02 are very special for
I2C, no device can use them. I suspect you are mixing register addresses
(the map of which is internal and specific to each device) with device
addresses on the bus.

> I guess I have to do:
> static unsigned short ignore_range[] = { 0x00, 0x16, 0xff, 0x01, 0x00, 
> 0xff, 0x02, 0x00, 0xff, I2C_CLIENT_END };
> 
> Am I right ?

No, this is seriously wrong. But I can't tell more without additional
information about what you are trying to achieve in the first place.

--
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the
body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at
http://vger.kernel.org/majordomo-info.html

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

* RE: Need help on selecting one (and only one) i2c bus
       [not found]     ` <20090310163044.571e4aff-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2009-03-10 15:58       ` Ayman KHAMOUMA
  2009-03-10 16:03       ` Ayman KHAMOUMA
  2009-03-11 10:55       ` Ayman KHAMOUMA
  2 siblings, 0 replies; 13+ messages in thread
From: Ayman KHAMOUMA @ 2009-03-10 15:58 UTC (permalink / raw)
  To: 'Jean Delvare'; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA


I'm using a 2.6.23.17 kernel for sh4 architecture.
I have to write a driver for an i2c controled audio chip.
You are totally right...I was mixing  register adresses with device
adresses...the only adress I have to use is 0x71 on i2c-0
 



-----Original Message-----
From: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
[mailto:linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Jean Delvare
Sent: Tuesday, March 10, 2009 4:31 PM
To: Ayman KHAMOUMA
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Need help on selecting one (and only one) i2c bus

Hi Ayman,

On Mon, 9 Mar 2009 15:52:56 +0100, Ayman KHAMOUMA wrote:
> I'm new on I2C device drivers programming and I'm facing a little problem,
I can't find how to select my i2c-0 bus (I have 3 of them: i2c-0, i2c-1 and
i2c-2) I'd like my probe function to probe only this bus and ignore the
others.
> I guess I can find the solution with the i2c_address_data structure, but I
don't really understand how to use it...

It would help if you would first tell us what kernel version you are using,
what device you are writing a driver for, and what architecture / system
type this is all working on.

> Do I have to use the ignore_range array ?

ignore_range has gone away long ago. The last kernel that had it was
2.6.12.6, released in late August 2005. Are really you using such an old
kernel?

> Once filed, I have nothing to do ?
> 
> The device I want to probe/send data to is located on bus i2c-0 and at 
> the adresses 0x00 to 0x15

I seriously doubt this. Addresses 0x00, 0x01 and 0x02 are very special for
I2C, no device can use them. I suspect you are mixing register addresses
(the map of which is internal and specific to each device) with device
addresses on the bus.

> I guess I have to do:
> static unsigned short ignore_range[] = { 0x00, 0x16, 0xff, 0x01, 0x00, 
> 0xff, 0x02, 0x00, 0xff, I2C_CLIENT_END };
> 
> Am I right ?

No, this is seriously wrong. But I can't tell more without additional
information about what you are trying to achieve in the first place.

--
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the
body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at
http://vger.kernel.org/majordomo-info.html

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

* Re: Need help on selecting one (and only one) i2c bus
       [not found] ` <000001c9a0c6$bf92af80$b23e81a4-J7BnVcvkGbbQT0dZR+AlfA@public.gmane.org>
@ 2009-03-10 15:30   ` Jean Delvare
       [not found]     ` <fd6b62c10903102327u426a4262meeabe2c581d7107b@mail.gmail.com>
       [not found]     ` <20090310163044.571e4aff-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 2 replies; 13+ messages in thread
From: Jean Delvare @ 2009-03-10 15:30 UTC (permalink / raw)
  To: Ayman KHAMOUMA; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hi Ayman,

On Mon, 9 Mar 2009 15:52:56 +0100, Ayman KHAMOUMA wrote:
> I'm new on I2C device drivers programming and I'm facing a little problem, I can't find how to select my i2c-0 bus (I have 3 of them: i2c-0, i2c-1 and i2c-2) I'd like my probe function to probe only this bus and ignore the others.
> I guess I can find the solution with the i2c_address_data structure, but I don't really understand how to use it...

It would help if you would first tell us what kernel version you are
using, what device you are writing a driver for, and what
architecture / system type this is all working on.

> Do I have to use the ignore_range array ?

ignore_range has gone away long ago. The last kernel that had it was
2.6.12.6, released in late August 2005. Are really you using such an
old kernel?

> Once filed, I have nothing to do ?
> 
> The device I want to probe/send data to is located on bus i2c-0 and at the adresses 0x00 to 0x15

I seriously doubt this. Addresses 0x00, 0x01 and 0x02 are very special
for I2C, no device can use them. I suspect you are mixing register
addresses (the map of which is internal and specific to each device)
with device addresses on the bus.

> I guess I have to do:
> static unsigned short ignore_range[] = { 0x00, 0x16, 0xff, 0x01, 0x00, 0xff, 0x02, 0x00, 0xff, I2C_CLIENT_END };
> 
> Am I right ?

No, this is seriously wrong. But I can't tell more without additional
information about what you are trying to achieve in the first place.

-- 
Jean Delvare

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

* RE: Need help on selecting one (and only one) i2c bus
@ 2009-03-09 14:52 Ayman KHAMOUMA
       [not found] ` <000001c9a0c6$bf92af80$b23e81a4-J7BnVcvkGbbQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Ayman KHAMOUMA @ 2009-03-09 14:52 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA

 
Do I have to use the ignore_range array ?
Once filed, I have nothing to do ?

The device I want to probe/send data to is located on bus i2c-0 and at the adresses 0x00 to 0x15

I guess I have to do:
static unsigned short ignore_range[] = { 0x00, 0x16, 0xff, 0x01, 0x00, 0xff, 0x02, 0x00, 0xff, I2C_CLIENT_END };

Am I right ?



-----Original Message-----
From: khamouma [mailto:ayman.khamouma-qxv4g6HH51o@public.gmane.org] 
Sent: Monday, March 09, 2009 11:59 AM
To: 'linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org'
Subject: Need help on selecting one (and only one) i2c bus

Hello everybody,

I'm new on I2C device drivers programming and I'm facing a little problem, I can't find how to select my i2c-0 bus (I have 3 of them: i2c-0, i2c-1 and i2c-2) I'd like my probe function to probe only this bus and ignore the others.
I guess I can find the solution with the i2c_address_data structure, but I don't really understand how to use it...


Thanks in advance,

Ayman KHAMOUMA

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

end of thread, other threads:[~2009-03-11 19:09 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-09 10:58 Need help on selecting one (and only one) i2c bus Ayman KHAMOUMA
2009-03-09 14:52 Ayman KHAMOUMA
     [not found] ` <000001c9a0c6$bf92af80$b23e81a4-J7BnVcvkGbbQT0dZR+AlfA@public.gmane.org>
2009-03-10 15:30   ` Jean Delvare
     [not found]     ` <fd6b62c10903102327u426a4262meeabe2c581d7107b@mail.gmail.com>
     [not found]       ` <fd6b62c10903102327u426a4262meeabe2c581d7107b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-03-11  9:15         ` Jean Delvare
     [not found]           ` <20090311101513.271f5464-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-03-11  9:47             ` Daniel Mack
     [not found]               ` <fd6b62c10903110319w1eebd2ebs4b83e7d1247f1678@mail.gmail.com>
     [not found]                 ` <fd6b62c10903110319w1eebd2ebs4b83e7d1247f1678-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-03-11 10:40                   ` Daniel Mack
     [not found]     ` <20090310163044.571e4aff-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-03-10 15:58       ` Ayman KHAMOUMA
2009-03-10 16:03       ` Ayman KHAMOUMA
2009-03-11 10:55       ` Ayman KHAMOUMA
     [not found]         ` <000301c9a237$e6d3c8f0$b23e81a4-J7BnVcvkGbbQT0dZR+AlfA@public.gmane.org>
2009-03-11 11:22           ` Jean Delvare
     [not found]             ` <20090311122257.7c7805f0-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-03-11 11:44               ` Ayman KHAMOUMA
2009-03-11 16:51               ` Ayman KHAMOUMA
     [not found]                 ` <001301c9a269$ab95d940$b23e81a4-J7BnVcvkGbbQT0dZR+AlfA@public.gmane.org>
2009-03-11 19:09                   ` Jean Delvare

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.