Re: A second easycap driver implementation

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

 



Em 19-03-2012 19:05, Ezequiel García escreveu:
> Hi Mauro,
> 
> On 3/7/12, Mauro Carvalho Chehab <mchehab@xxxxxxxxxx> wrote:
>>
>> The usage of saa711x is simple. All you need to do is to implement
>> an I2C bus at your easycap driver, load the module, and then, redirect
>> any demod ioctl call to the I2C bus, like:
>>
>> static int vidioc_querystd(struct file *file, void *priv, v4l2_std_id *norm)
>> {
>> 	struct em28xx_fh   *fh  = priv;
>> 	struct em28xx      *dev = fh->dev;
>> 	int                rc;
>>
>> 	rc = check_dev(dev);
>> 	if (rc < 0)
>> 		return rc;
>>
>> 	v4l2_device_call_all(&dev->v4l2_dev, 0, video, querystd, norm);
>>
>> 	return 0;
>> }
>>
>>
>> An I2C device has an address that needs to be send through the I2C
>> bus.
>>
>> The saa711x devices use one of the I2C addresses below:
>>
>> static unsigned short saa711x_addrs[] = {
>> 	0x4a >> 1, 0x48 >> 1,   /* SAA7111, SAA7111A and SAA7113 */
>> 	0x42 >> 1, 0x40 >> 1,   /* SAA7114, SAA7115 and SAA7118 */
>> 	I2C_CLIENT_END };
>>
> 
> I made my easycap driver use saa7115 driver to detect its saa7113 chip.
> It wasn't so hard after some head scratching.

Good!

> The problem is now modprobe is taking too long, mainly because saa7115 does
> some probing.
> I was thinking (since we already discussed deferring stuff to a workqueue):
> 
> Would it be problematic (in any fashion) to do add the i2c sub device
> 
>   v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
>                         "saa7115_auto", 0, saa711x_addrs);
> 
> in a workqueue, (in the same way modules are loaded in workqueues)?
> 
> I think not, since we won't call i2c directly, but rather through
> v4l2_device_call_all(), right?

It would likely work. I would add some locking maybe at open or at ioctl
level, to prevent calling the device while the init doesn't finish.

Regards,
Mauro
> 
> Thanks,
> Ezequiel.

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


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux