Help Regarding I2C Driver...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
                This is Uma Kanta, seeking some help regarding the I2C
driver development on ARM Linux 2.6.19 platform.
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,
};
static int __init i2c_test_init(void) {
                
                char ret;
                printk(KERN_INFO "In i2c_test_init\n");
                ret = i2c_add_driver(&i2c_test_driver);
                printk(KERN_INFO "i2c_test_init ret: %d\n",ret);
                return ret;
}
Now ?i2c_add_driver()? calls to ?i2c_register_driver()?, residing in
KERN_SRC/drivers/i2c/i2c_core.c, 
Inside i2c_register_driver()?, ?driver_register()? is done, but the code
given below is bit complex:

/* now look for instances of driver on our adapters */
                if (driver->attach_adapter) {
                                list_for_each(item,&adapters) {
                                                adapter = list_entry(item,
struct i2c_adapter, list);
                                               
driver->attach_adapter(adapter);
                                                printk("In
list_for_each\n");
                                }
                }


So here ?list_for_each(item,&adapters)? returns FALSE for me. So my attach
adapter function, ?i2c_test_attach_adapter()? is not getting called.
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?

Can you please explain what are the minimum needs for the chip driver to be
functional?
And how can I get my driver working?
Thanks for sparing time for me.
Waiting for your reply?



With Regards,
Uma Kanta Patro



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

[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux