A second easycap driver implementation

Ezequiel García elezegarcia at gmail.com
Wed Mar 7 20:39:41 UTC 2012

Hi Mauro,

> em28xx is a good reference.

I'm looking at it.
In fact, I have a first question: why there is a limit to the number of devices
the driver support? I found the same idea in easycap original
implementation, but I
can't understand why do we have to limit in such a way.

        /* Check to see next free device and mark as used */
        do {
                nr = find_first_zero_bit(&em28xx_devused, EM28XX_MAXBOARDS);
                if (nr >= EM28XX_MAXBOARDS) {
                        /* No free device slots */
                        printk(DRIVER_NAME ": Supports only %i em28xx
                        retval = -ENOMEM;
                        goto err_no_slot;
        } while (test_and_set_bit(nr, &em28xx_devused));

> It is not clear, from the easycap code, where the I2C address
> is stored:
> int write_saa(struct usb_device *p, u16 reg0, u16 set0)
> {
>        if (!p)
>                return -ENODEV;
>        SET(p, 0x200, 0x00);
>        SET(p, 0x204, reg0);
>        SET(p, 0x205, set0);
>        SET(p, 0x200, 0x01);
>        return wait_i2c(p);
> }

I think i2c_address it is near registers 0x200/0x204, which gets
initialised at setup_stk().
I'll have a closer look.

Thanks for your comments,

More information about the devel mailing list