Hello ,
I am trying to get the Analog devices Decoder driver ADV 7180 working on my custom OMAP-5 board over I2C. My I2C client adv7180_probe() function is never getting called.
ADV7180 is a decoder and maximum I2c clk frequency =400 KHz and connected on i2c bus 1
Here are the changes that I have done.
Board specific changes in (Board.c) file is as follows:
static struct i2c_board_info __initdata adv7180_i2c_data[]=
{
{
I2C_BOARD_INFO("adv7180",0x40), /* device name and Slave addr of ADv 7180*/
.irq = 120,
},
};
/* Below is the init function for i2c */
static int __init omap_5430evm_i2c_init(void)
{
omap_i2c_hwspinlock_init(1, 0, &sdp4430_i2c_1_bus_pdata);
omap_i2c_hwspinlock_init(2, 1, &sdp4430_i2c_2_bus_pdata);
omap_i2c_hwspinlock_init(3, 2, &sdp4430_i2c_3_bus_pdata);
omap_i2c_hwspinlock_init(4, 3, &sdp4430_i2c_4_bus_pdata);
omap_i2c_hwspinlock_init(5, 4, &sdp4430_i2c_5_bus_pdata);
omap_register_i2c_bus_board_data(1, &sdp4430_i2c_1_bus_pdata);
omap_register_i2c_bus_board_data(2, &sdp4430_i2c_2_bus_pdata);
omap_register_i2c_bus_board_data(3, &sdp4430_i2c_3_bus_pdata);
omap_register_i2c_bus_board_data(4, &sdp4430_i2c_4_bus_pdata);
omap_register_i2c_bus_board_data(5, &sdp4430_i2c_5_bus_pdata);
omap_register_i2c_bus(1, 400, NULL, 0);
omap_register_i2c_bus(2, 400, NULL, 0);
omap_register_i2c_bus(3, 400, NULL, 0);
omap_register_i2c_bus(4, 400, NULL, 0);
omap_register_i2c_bus(5, 400, NULL, 0);
}
/* Below is the common init function of board.c*/
static void __init omap54xx_common_init(void)
{
omap_mux_init_array(omap5432_common_mux,ARRAY_SIZE(omap5432_common_mux));
omap_5430evm_i2c_init();
i2c_register_board_info(1,adv7180_i2c_data,ARRAY_SIZE(adv7180_i2c_data));
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
My driver adv7180.c file important functions
/*
* Generic i2c probe
* concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1'
*/
static __devinit int adv7180_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
printk(" Inside probe of ADV 7180 ......\n");
}
static __devexit int adv7180_remove(struct i2c_client *client)
{
printk(" Remove of adv 7180 ..... ..\n");
return 0;
}
static const struct i2c_device_id adv7180_id[] = {
{"adv7180", 0},
{},
};
MODULE_DEVICE_TABLE(i2c, adv7180_id);
static struct i2c_driver adv7180_driver = {
.driver = {
.owner = THIS_MODULE,
.name = "adv7180",
},
.probe = adv7180_probe,
.remove = __devexit_p(adv7180_remove),
.id_table = adv7180_id,
};
module_i2c_driver(adv7180_driver);
MODULE_DESCRIPTION("Analog Devices ADV7180 video decoder driver");
MODULE_AUTHOR("Mocean Laboratories");
MODULE_LICENSE("GPL v2");
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Note the following:
1. i2c nodes /dev/i2c-1, /dev/i2c-2, /dev/i2c-3, /dev/i2c-4 and /dev/i2c-5 are getting created successfully.
2. I have also tried using the i2c-tools which has some functions to test i2c from user space (uses adapter directly to communicate over i2c bus rather than the client driver) such as i2cdump(), i2cget () and i2cset() etc., but I am always getting Read and Write failed i2c errors.
Can you please help me as
1. Why my client probe function is not getting called (even though the driver name in adv7180.c and the one in board.c file are same "adv7180")
2. Even the i2c-test tool functions which test i2c bus directly from user space (client driver not involved here) using functions i2cget() and i2cdump() are always getting i2c read and write errors.
Regards
Yogesh