Re: [PATCH 1/2] [media] imx214: Add imx214 camera sensor driver
From: Ricardo Ribalda Delgado
Date: Wed Sep 26 2018 - 02:07:21 EST
Hi Sakari
On Wed, Sep 26, 2018 at 7:26 AM Ricardo Ribalda Delgado
<ricardo.ribalda@xxxxxxxxx> wrote:
>
> Hello Sakari
> On Mon, Sep 24, 2018 at 10:32 PM Sakari Ailus
> <sakari.ailus@xxxxxxxxxxxxxxx> wrote:
> >
> > Hi Ricardo,
> >
> > On Fri, Sep 21, 2018 at 12:15:55PM +0200, Ricardo Ribalda Delgado wrote:
> > ...
> > > > > +static struct reg_8 mode_1920x1080[];
> > > > > +static struct reg_8 mode_4096x2304[];
> > > >
> > > > Const. Could you rearrange the bits to avoid the forward declarations?
> > > Const done, but I prefer to keep the forward declaration. Otherwise
> > > the long tables will "hide" the mode declaration.
> >
> > Well, I guess the long tables do "hide" a bunch of other stuff, too. :-)
> > But... I agree there's no trivial way around those tables either.
> >
> > It appears I'm not the only one who's commented on the matter of the
> > forward declaration.
>
> Ok, I will change it, Eppur si muove ;)
> >
> > ...
> >
> > > > > +static int imx214_probe(struct i2c_client *client)
> > > > > +{
> > > > > + struct device *dev = &client->dev;
> > > > > + struct imx214 *imx214;
> > > > > + struct fwnode_handle *endpoint;
> > > > > + int ret;
> > > > > + static const s64 link_freq[] = {
> > > > > + (IMX214_DEFAULT_PIXEL_RATE * 10LL) / 8,
> > > >
> > > > You should check the link frequency matches with that from the firmware.
> > >
> > > I am not sure what you mean here sorry.
> >
> > The system firmware holds safe frequencies for the CSI-2 bus on that
> > particular system; you should check that the register lists are valid for
> > that frequency.
> >
Can you point me to a driver that does this? Just for the example. Thanks
> > ...
> >
> > > > > + imx214->pixel_rate = v4l2_ctrl_new_std(&imx214->ctrls, NULL,
> > > > > + V4L2_CID_PIXEL_RATE, 0,
> > > > > + IMX214_DEFAULT_PIXEL_RATE, 1,
> > > > > + IMX214_DEFAULT_PIXEL_RATE);
> > > > > + imx214->link_freq = v4l2_ctrl_new_int_menu(&imx214->ctrls, NULL,
> > > > > + V4L2_CID_LINK_FREQ,
> > > > > + ARRAY_SIZE(link_freq) - 1,
> > > > > + 0, link_freq);
> > > >
> > > > Do I understand this correctly that the driver does not support setting
> > > > e.g. exposure time or gain? Those are very basic features...
> > >
> > >
> > > Yep :), this is just a first step. I do not have the register set from
> > > the device :(. So I am reverse engineering a lot of things.
> > > I will add more controls as I am done with them.
> >
> > Looking at the registers you have in the register list, the sensor's
> > registers appear similar to those used by the smiapp driver (the old SMIA
> > standard).
> >
> > I'd guess the same register would work for setting the exposure time. I'm
> > less certain about the limits though.
>
> Thanks for the pointer! I will try this out and probably add it as a patch.
>
> >
> > >
> > > >
> > > > You'll also need to ensure the s_ctrl() callback works without s_power()
> > > > being called. My suggestion is to switch to PM runtime; see e.g. the ov1385
> > > > driver in the current media tree master.
> > >
> > >
> > > There is one limitation with this chip on the dragonboard. I2c only
> > > works if the camss is ON. Therefore whatever s_ctrl needs to be
> > > cached and written at streamon.
> >
> > That's something that doesn't belong to this driver. It's the Iæ adapter
> > driver / camss issue, and not necessarily related to drivers only. Is the
> > Iæ controller part of the camss btw.?
>
> I am with you here. The i2c controller is a different driver but is
> integrated with camss. Checkout
> https://patchwork.kernel.org/patch/10569961/ I am interacting with
> Todor and Vinod to enable the i2c port indepently with camss. At least
> now it does not kill the port after an i2c timeout :)
>
> Will fix the fwd declaration and the csi-2 register. Then I wll upload
> it to my github, try it on real hw next monday and send back to the
> mailing list
>
> Thanks!
>
> >
> > --
> > Regards,
> >
> > Sakari Ailus
> > sakari.ailus@xxxxxxxxxxxxxxx
>
>
>
> --
> Ricardo Ribalda
--
Ricardo Ribalda