AnsweredAssumed Answered

Need Help with I2C Linux Device Drivers for ADV7403

Question asked by shravan on Jul 11, 2012
Latest reply on Jul 11, 2012 by larsc


        I have a custom board built with ADV7403 from analog devices. ADV7403 is connected as client to a Beagleboard-xM Rev.C on which linux Angstrom is ported with the kernel version 2.6.32.

Im trying to write a device driver for ADV7403 for RGB input signal. In order to configure ADV7403, i2c communication is used.

So far in the linux device drivers i have been able to include support for module_init and module_exit. and when i insert my module(i.e., .ko file) module_init is triggered. (this is done by using '    insmod adv7403.ko   ' command)

According to my knowledge, after module_init next function called is Probe(). but i dont see the probe() function being called and executed in the run time.. reason for this may be adv7403 hardware is not getting detected on the i2c line which triggers the probe() function.

one of the straight reason for this could be the adv7403's i2c slave address. the slave address of adv7403 is 0x21. but i dont know how to and where to give the i2c slave address in the linux device driver structure. Any suggestions or hint in this matter would be helpful.

Im new to writing linux device drivers and i might have missed out some important and simple things due to my insufficient knowledge on linux device drivers. If anything of this sort is found, please point it out.

I have pasted the code that is written so far below..



#include <linux/module.h>

#include <linux/init.h>

#include <linux/errno.h>

#include <linux/kernel.h>

#include <linux/interrupt.h>

#include <linux/i2c.h>

#include <linux/i2c-id.h>

#include <linux/videodev2.h>

#include <linux/mutex.h>

#include <linux/slab.h>

#include <linux/log2.h>


#include <media/v4l2-ioctl.h>

#include <media/v4l2-device.h>

#include <media/v4l2-chip-ident.h>

#include <media/v4l2-subdev.h>

#include <media/soc_camera.h>


#include "adv7403_regs.h"


#define DRIVER_NAME "adv7403"


struct adv7403_state {

          struct v4l2_subdev subdev;



static __devinit int adv7403_probe(struct i2c_client *client,

                              const struct i2c_device_id *id)


          struct adv7403_state *state;

          int ret;


          /* Check if the adapter supports the needed features */

          if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))

                    return -EIO;


          v4l_info(client, "chip found @ 0x%02x (%s)\n",

                              client->addr << 1, client->adapter->name);


          state = kzalloc(sizeof(struct adv7403_state), GFP_KERNEL);

          if (state == NULL) {

                    ret = -ENOMEM;

                    goto err;



                    printk(KERN_ERR DRIVER_NAME ": Detected %d\n");




          printk(KERN_ERR DRIVER_NAME ": Failed to probe: %d\n", ret);

          return ret;




static __devexit int adv7403_remove(struct i2c_client *client)


          struct v4l2_subdev *sd = i2c_get_clientdata(client);



          return 0;



static const struct i2c_device_id adv7403_id[] = {

          {DRIVER_NAME, 0},




MODULE_DEVICE_TABLE(i2c, adv7403_id);


static struct i2c_driver adv7403_driver = {

          .driver = {

                    .owner          = THIS_MODULE,

                    .name          = DRIVER_NAME,


        .probe                    = adv7403_probe,

        .remove                    = adv7403_remove,

          .id_table          = adv7403_id



static int __init adv7403_mod_init(void)


          printk(" ADV7403 Video Decoder Device Driver inserted to kernel \n");

          return i2c_add_driver(&adv7403_driver);



static void __exit adv7403_mod_exit(void)


        printk(" ADV7403 Video Decoder Device Driver removed from kernel \n");







MODULE_DESCRIPTION("Analog Devices ADV7403 video driver");


thanking you,

Shravan Kulkarni


P.S :

My system configuration:

Processor: intel core 2 duo 2.4 GHz

Ram : 2GB

O.S : Ubuntu 10.04 (kernel: 2.6.32-39)


BeagleBoard-xM Rev.C configuration( which host to ADV7403)

Processor : DM3730 1GHz

Ram: 512MB

O.S : Linux Angstrom ( kernel 2.6.32 )