[libcamera-devel] Compatibility with cameras

Dave Stevenson dave.stevenson at raspberrypi.com
Thu Feb 24 17:45:40 CET 2022


On Thu, 24 Feb 2022 at 15:28, Laurent Pinchart
<laurent.pinchart at ideasonboard.com> wrote:
>
> On Thu, Feb 24, 2022 at 04:22:15PM +0100, Guido Körber wrote:
> > Hi Laurent,
> >
> > can’t check that at the moment but will do.
> >
> > The camera supposedly contains an Omnivision OV2740 sensor.
>
> You're lucky,
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/media/i2c/ov2740.c
>
> > I was hoping that we would only need to tell some existing driver to
> > use this camera.
>
> After a quick look at the driver, it seems you will only have to
> implement support for the V4L2_CID_ANALOG_GAIN control, and for the crop
> selection targets mentioned in the libcamera documentation.

Analogue gain appears to be there already -
https://elixir.bootlin.com/linux/v5.16.11/source/drivers/media/i2c/ov2740.c#L590

It appears that the driver doesn't support Device Tree, only ACPI.
It'll need a struct of_device_id defining and referenced from
ov2740_i2c_driver.

If you're really stuck then doing the basic work should only take one
of us about 15 minutes, so you may persuade us to do it for you. It
does rely on you having the same external clock feeding the sensor as
the driver is expecting (19.2MHz).

  Dave

> > > Am 24.02.2022 um 16:12 schrieb Laurent Pinchart:
> > > On Thu, Feb 24, 2022 at 04:02:58PM +0100, Guido Körber wrote:
> > >> We can see a device on the I2C. (Took a bit more testing to get the
> > >> hardware to really respond…)
> > >>
> > >> So will we need a specific kernel driver for that camera, or is there
> > >> some way to handle it via a generic driver?
> > >
> > > It needs a kernel driver. Have you checked in drivers/media/i2c/ (in the
> > > kernel) if the sensor you're using is already supported ? If so, some
> > > work may still be needed to support all the features required by
> > > libcamera (see Documentation/sensor_driver_requirements.rst), but it
> > > would be much easier than writing a new driver from scratch.
> > >
> > >>> Am 17.02.2022 um 17:43 schrieb Laurent Pinchart:
> > >>> On Thu, Feb 17, 2022 at 05:00:23PM +0100, Guido Körber wrote:
> > >>>> Is there a simple way to check if the hardware is present even if
> > >>>> the camera is not detected by software?
> > >>>>
> > >>>> I have set up a prototype with a hand soldered connector and would
> > >>>> like to know if I did all the wiring correct.
> > >>>
> > >>> You can use i2cdetect and i2cget ([1]) to talk to the sensor. You may
> > >>> need to first enable power by toggling the corresponding GPIO, which can
> > >>> also be done from userspace ([2]). Checking video transmission is more
> > >>> difficult, you will need to get at least the kernel driver for the
> > >>> sensor and Unicam up and running.
> > >>>
> > >>> [1] https://manpages.debian.org/unstable/i2c-tools/i2cdetect.8.en.html
> > >>> [2] https://manpages.debian.org/experimental/gpiod/gpioset.1.en.html
> > >>>
> > >>>>> Am 17.02.2022 um 14:09 schrieb Kieran Bingham:
> > >>>>> Quoting Guido Körber (2022-02-17 13:04:18)
> > >>>>>>
> > >>>>>> I want to use libcamera on Raspberry with a camera that is not
> > >>>>>> explicitly supported by libcamera but does generic CSI-2. Will this
> > >>>>>> work, or do I need a camera specific plugin or something else?
> > >>>>>
> > >>>>> You will likely need to make sure you have a relevant kernel driver, and
> > >>>>> may likely need to do some updates to libcamera, to manage the
> > >>>>> CameraSensorHelper classes.
> > >>>>>
> > >>>>> You might also then want to follow the Raspberry Pi ISP tuning
> > >>>>> procedures.
> > >>>>>
> > >>>>> https://datasheets.raspberrypi.com/camera/raspberry-pi-camera-guide.pdf
> > >>>>>
> > >>>>> But yes, you should be able to get it to work.
>
> --
> Regards,
>
> Laurent Pinchart


More information about the libcamera-devel mailing list