AnsweredAssumed Answered

Need Help with video device node creation

Question asked by shravan on Sep 7, 2012
Latest reply on Sep 7, 2012 by larsc

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 signals and output of ADV7403 is 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] [<c003ab54>] (unwind_backtrace+0x0/0xdc) from [<c0065848>] (warn_slowpath_common+0x48/0x60)

[ 83.086395] [<c0065848>] (warn_slowpath_common+0x48/0x60) from [<c034357c>] (__video_register_device+0x44/0x3ec)

[ 83.097015] [<c034357c>] (__video_register_device+0x44/0x3ec) from [<bf0ad1e0>] (adv7403_probe+0x178/0x2ec [adv7403])

[ 83.107940] [<bf0ad1e0>] (adv7403_probe+0x178/0x2ec [adv7403]) from [<c033fe24>] (i2c_device_probe+0x74/0x8c)

[ 83.118133] [<c033fe24>] (i2c_device_probe+0x74/0x8c) from [<c02a87a4>] (driver_probe_device+0xc0/0x178)

[ 83.127868] [<c02a87a4>] (driver_probe_device+0xc0/0x178) from [<c02a7c74>] (bus_for_each_drv+0x44/0x80)

[ 83.137603] [<c02a7c74>] (bus_for_each_drv+0x44/0x80) from [<c02a89ac>] (device_attach+0x68/0x8c)

[ 83.147003] [<c02a89ac>] (device_attach+0x68/0x8c) from [<c02a7af8>] (bus_probe_device+0x24/0x40)

[ 83.156097] [<c02a7af8>] (bus_probe_device+0x24/0x40) from [<c02a6528>] (device_add+0x31c/0x490)

[ 83.165100] [<c02a6528>] (device_add+0x31c/0x490) from [<c03410ac>] (i2c_new_device+0x154/0x1b0)

[ 83.174133] [<c03410ac>] (i2c_new_device+0x154/0x1b0) from [<bf0b0070>] (adv7403_mod_init+0x70/0x94 [adv7403])

[ 83.184356] [<bf0b0070>] (adv7403_mod_init+0x70/0x94 [adv7403]) from [<c0035364>] (do_one_initcall+0x5c/0x1b4)

[ 83.194915] [<c0035364>] (do_one_initcall+0x5c/0x1b4) from [<c0096ed0>] (sys_init_module+0xb0/0x1dc)

[ 83.204345] [<c0096ed0>] (sys_init_module+0xb0/0x1dc) from [<c0035f40>] (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, g_register, s_register) 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

Outcomes