Hi,
On Mon, Jul 28, 2008 at 12:36 PM, <[EMAIL PROTECTED]> wrote:
> Hi,
>
> In order to improve my understanding of Linux i2c layer, I read the source
> code.
> I read i2c-core.c and I try to anderstand why my clients wasn't created.
>
> The problem is in the i2c_register_adapter function :
>
> /* create pre-declarated device nodes for new-style drivers */
> if (adap->nr < __i2c_first_dynamic_bus_num)
> i2c_scan_static_board_info(adap);
>
> The test is NEVER true. So my clients are not created.
>
>
>
> I read that __i2c_first_dynamic_bus_num is set to 1.
> It does not seems to change.
it changes in [EMAIL PROTECTED]:
/* dynamic bus numbers will be assigned after the last static one */
if (busnum >= __i2c_first_dynamic_bus_num)
__i2c_first_dynamic_bus_num = busnum + 1;
which would make the above if() true :-)
> And that adap->nr refers to "Dynamic Bus Number".
> My first bus register with adap->nr=1.
> The second register with adap->nr=2.
hmm.. i suppose your calling i2c_register_board_info() with wrong
parameters.
> That's why the test fails.
>
>
> So, I have had an idea to fix the problem.
>
> I change :
> i2c_add_adapter(adap);
>
> with
> adap->nr = 0;
> i2c_add_numbered_adapter(adap);
>
>
> But, it make new problems :
> - I can't manage two busses
> - I definitly don't anderstand how I2C_BOARD_INFO macro can associate
> a client to a specified bus
> - I don't anderstand what I am writing, and I really dislike it :c
show me your i2c_register_board_info() call.
it should be:
i2c_register_board_info(bus number, struct i2c_board_info **,
ARRAY_SIZE(i2c_board_info));
just a note, the first i2c bus is bus 1 and not bus 0. I suppose
that's not your problem, right ?
--
Best Regards,
Felipe Balbi
[EMAIL PROTECTED]
_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c