* i2c adapter scan device issue
@ 2009-11-25 4:18 Lanttor
[not found] ` <4B0CAFFD.7030603-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Lanttor @ 2009-11-25 4:18 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
Hi,
I have a confused problem as follows:
I instantiate a i2c device with function i2c_register_board_info();
This function pre-declare the I2C devices which live on this bus and the
call of it
is before the real i2c bus driver loaded.
In i2c_register_board_info(),
__i2c_first_dynamic_bus_num = busnum +1;
My i2c bus driver use i2c_add_adapter() to register adapter, In
i2c_add_adapter(),
res = idr_get_new_above(&i2c_adapter_idr, adapter,
__i2c_first_dynamic_bus_num , &id);
adapter->nr = id;
That means if I pass busnum 0 to i2c_register_board_info(), but my i2c
adapter will get
busnum 1 and so it can't scan pre-declared i2c devices.
In fact, I only have one i2c adapter.
It seems I can't use i2c_add_adapter(), instead of using
i2c_add_numbered_adapter, right?
Best Regards,
Lanttor
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: i2c adapter scan device issue
[not found] ` <4B0CAFFD.7030603-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
@ 2009-11-25 8:12 ` Jean Delvare
[not found] ` <20091125091218.518d47af-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Jean Delvare @ 2009-11-25 8:12 UTC (permalink / raw)
To: Lanttor; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA
On Wed, 25 Nov 2009 12:18:05 +0800, Lanttor wrote:
> Hi,
>
> I have a confused problem as follows:
>
> I instantiate a i2c device with function i2c_register_board_info();
> This function pre-declare the I2C devices which live on this bus and the
> call of it
> is before the real i2c bus driver loaded.
>
> In i2c_register_board_info(),
> __i2c_first_dynamic_bus_num = busnum +1;
>
> My i2c bus driver use i2c_add_adapter() to register adapter, In
> i2c_add_adapter(),
> res = idr_get_new_above(&i2c_adapter_idr, adapter,
> __i2c_first_dynamic_bus_num , &id);
>
> adapter->nr = id;
>
> That means if I pass busnum 0 to i2c_register_board_info(), but my i2c
> adapter will get
> busnum 1 and so it can't scan pre-declared i2c devices.
> In fact, I only have one i2c adapter.
>
> It seems I can't use i2c_add_adapter(), instead of using
> i2c_add_numbered_adapter, right?
Yes, you are correct. You can't predefine I2C devices with
i2c_register_board_info() if you don't also set I2C adapter numbers
with i2c_add_numbered_adapter(). Trying would be equivalent to sending a
letter to someone when you know the city and street number but not the
street name: unlikely to succeed.
--
Jean Delvare
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: i2c adapter scan device issue
[not found] ` <20091125091218.518d47af-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2009-11-25 8:42 ` Lanttor
[not found] ` <4B0CEDDA.2000909-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Lanttor @ 2009-11-25 8:42 UTC (permalink / raw)
To: Jean Delvare; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA
>
> Yes, you are correct. You can't predefine I2C devices with
> i2c_register_board_info() if you don't also set I2C adapter numbers
> with i2c_add_numbered_adapter(). Trying would be equivalent to sending a
> letter to someone when you know the city and street number but not the
> street name: unlikely to succeed.
>
Thanks Jean.
In fact my bus driver used i2c_add_adapter() not i2c_add_numbered_adapter().
Now I use i2c_add_numbered_adapter() to replace 2c_add_adapter() and set
the bus number first.
In one word, you mean that i2c_add_adapter() can not work normally if
useing i2c_register_board_info() to pre-declare the i2c device, right?
I really need track i2c-stack in detail.
Best Regards,
Lanttor
------------------------------------------------------------------------
*From:* Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
*Sent:* 11/25/2009 4:12:18 PM +0800
*To:* Lanttor <lanttor.guo-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
*CC:* linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
*Subject:* i2c adapter scan device issue
> On Wed, 25 Nov 2009 12:18:05 +0800, Lanttor wrote:
>
>> Hi,
>>
>> I have a confused problem as follows:
>>
>> I instantiate a i2c device with function i2c_register_board_info();
>> This function pre-declare the I2C devices which live on this bus and the
>> call of it
>> is before the real i2c bus driver loaded.
>>
>> In i2c_register_board_info(),
>> __i2c_first_dynamic_bus_num = busnum +1;
>>
>> My i2c bus driver use i2c_add_adapter() to register adapter, In
>> i2c_add_adapter(),
>> res = idr_get_new_above(&i2c_adapter_idr, adapter,
>> __i2c_first_dynamic_bus_num , &id);
>>
>> adapter->nr = id;
>>
>> That means if I pass busnum 0 to i2c_register_board_info(), but my i2c
>> adapter will get
>> busnum 1 and so it can't scan pre-declared i2c devices.
>> In fact, I only have one i2c adapter.
>>
>> It seems I can't use i2c_add_adapter(), instead of using
>> i2c_add_numbered_adapter, right?
>>
>
> Yes, you are correct. You can't predefine I2C devices with
> i2c_register_board_info() if you don't also set I2C adapter numbers
> with i2c_add_numbered_adapter(). Trying would be equivalent to sending a
> letter to someone when you know the city and street number but not the
> street name: unlikely to succeed.
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: i2c adapter scan device issue
[not found] ` <4B0CEDDA.2000909-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
@ 2009-11-25 8:53 ` Jean Delvare
0 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2009-11-25 8:53 UTC (permalink / raw)
To: Lanttor; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA
On Wed, 25 Nov 2009 16:42:02 +0800, Lanttor wrote:
> >
> > Yes, you are correct. You can't predefine I2C devices with
> > i2c_register_board_info() if you don't also set I2C adapter numbers
> > with i2c_add_numbered_adapter(). Trying would be equivalent to sending a
> > letter to someone when you know the city and street number but not the
> > street name: unlikely to succeed.
> >
> Thanks Jean.
>
> In fact my bus driver used i2c_add_adapter() not i2c_add_numbered_adapter().
> Now I use i2c_add_numbered_adapter() to replace 2c_add_adapter() and set
> the bus number first.
>
> In one word, you mean that i2c_add_adapter() can not work normally if
> useing i2c_register_board_info() to pre-declare the i2c device, right?
Yes, exactly.
> I really need track i2c-stack in detail.
--
Jean Delvare
http://khali.linux-fr.org/wishlist.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-11-25 8:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-25 4:18 i2c adapter scan device issue Lanttor
[not found] ` <4B0CAFFD.7030603-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2009-11-25 8:12 ` Jean Delvare
[not found] ` <20091125091218.518d47af-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-11-25 8:42 ` Lanttor
[not found] ` <4B0CEDDA.2000909-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2009-11-25 8:53 ` Jean Delvare
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox