Need Help with video device node creation

Hi,

I have a custom board built with ADV7403 video decoder/encoder ic which will be interfaced to Beagleboard-xM Rev.C. Im trying to write linux device driver for ADV7403 to work with RGB input signals and output of 10-bit 4:2:2 YCbCr. i have added the support of i2c into my device drivers. now i have to integrate V4L2 into my device driver.

I have pasted the code below on what is done so far on V4L2.

v4l2_i2c_subdev_init(&state->subdev, client, &adv7403_ops); // for V4L2_subdev initialization

//--------------code to create the device node-----------------------------//

struct video_device *vfd;

vfd = video_device_alloc();
if(vfd == NULL)
{
return -ENOMEM;
printk(“failed to create /dev/video node\n”);
vfd->release = video_device_release;
}

err = video_register_device(vfd, VFL_TYPE_GRABBER, -1);
if(err) {
video_device_release(vfd);
printk(“failed to register the device node /dev/videoX\n”);
return err;
}

//----------------------------code to create the device node-------------------------//

v4l2_i2c_subdev_init() was included alone there was no error during compilation and run time…

then vfd = video_device_alloc(); was included and here also there was no error…

but on the next part… i.e.,

err = video_register_device(vfd, VFL_TYPE_GRABBER, -1);

i had a run time error which is pasted below…

//------------------------------------error--------------------------------------//

root@beagleboard-dvsdk:/lib/modules/2.6.32/kernel/drivers/media/video# insmod ad
v7403.ko
[ 82.966735] adv7403 2-0021: chip found @ 0x42 (OMAP I2C adapter)
[ 82.990478] adv7403: Detected ADV7403 @ 25
[ 82.994598] Memory is allocated
[ 82.997863] ------------[ cut here ]------------
[ 83.021789] WARNING: at drivers/media/video/v4l2-dev.c:421 _video_register_device+0x44/0x3ec()
[ 83.045166] Modules linked in: adv7403(+) sdmak lpm
omap3530 dsplinkk cmemk ipv6 rtc_twl rtc_core
[ 83.068572] [] (unwind_backtrace+0x0/0xdc) from [] (warn_slowpath_common+0x48/0x60)
[ 83.086395] [] (warn_slowpath_common+0x48/0x60) from [] (__video_register_device+0x44/0x3ec)
[ 83.097015] [] (__video_register_device+0x44/0x3ec) from [] (adv7403_probe+0x178/0x2ec [adv7403])
[ 83.107940] [] (adv7403_probe+0x178/0x2ec [adv7403]) from [] (i2c_device_probe+0x74/0x8c)
[ 83.118133] [] (i2c_device_probe+0x74/0x8c) from [] (driver_probe_device+0xc0/0x178)
[ 83.127868] [] (driver_probe_device+0xc0/0x178) from [] (bus_for_each_drv+0x44/0x80)
[ 83.137603] [] (bus_for_each_drv+0x44/0x80) from [] (device_attach+0x68/0x8c)
[ 83.147003] [] (device_attach+0x68/0x8c) from [] (bus_probe_device+0x24/0x40)
[ 83.156097] [] (bus_probe_device+0x24/0x40) from [] (device_add+0x31c/0x490)
[ 83.165100] [] (device_add+0x31c/0x490) from [] (i2c_new_device+0x154/0x1b0)
[ 83.174133] [] (i2c_new_device+0x154/0x1b0) from [] (adv7403_mod_init+0x70/0x94 [adv7403])
[ 83.184356] [] (adv7403_mod_init+0x70/0x94 [adv7403]) from [] (do_one_initcall+0x5c/0x1b4)
[ 83.194915] [] (do_one_initcall+0x5c/0x1b4) from [] (sys_init_module+0xb0/0x1dc)
[ 83.204345] [] (sys_init_module+0xb0/0x1dc) from [] (ret_fast_syscall+0x0/0x2c)
[ 83.213653] —[ end trace 09559d2558e8a7e2 ]—
[ 83.218444] failed to register the device node /dev/videoX
[ 83.223999] adv7403: probe of 2-0021 failed with error -22
root@beagleboard-dvsdk:/lib/modules/2.6.32/kernel/drivers/media/video#

//----------------------------------------error-----------------------------------------------//

Q1. regarding v4l2_subdev

during v4l2_i2c_subdev_int() only support for v4l2_subdev_core_ops(i.e., g_chip_ident) but these functions are not accessed during run time… is there any manual where i can get the details on the manner in which these functions are accessed… or the reason why these functions are triggered…

(these functions were added by referring the device drivers of ADV7180, TVP514x)

Q2. regarding device node creation

errno -22 represents INVALID ARGUMENT (reference: http://www-numi.fnal.gov/offline_software/srt_public_context/WebDocs/Errors/unix_system_errors.html )

is it because i didnt fill the fields of structure video_device in my device driver?? if it is because of this then how do i fill the parameters of video_device…

how do i solve this problem…??

thanking you,

Shravan Kulkarni

P.S :-

Host machine configuration:-

Intel Core 2 Duo 2.4Ghz,

2GB RAM,

O.S:- UBUNTU 10.04 (kernel:- 2.6.32)

BeagleBoard-xM Rev.C configuration:-

DM3730 Processor

1Ghz, 512MB RAM

O.S:- Angstrom Linux(kernel- 2.6.32)

If there is any information that i have missed out or required please point it out

hello
I am trying to read and write data on ADV7403 decoder IC on my designed board. I have been through almost all questions regarding I2C bus with ADV7403 but my problem still remains there.
You can send me source code of ADV7403.c and adv7403_regs.h