[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180719114306.55b2e5f9e9a140a8922a2785@magewell.com>
Date: Thu, 19 Jul 2018 11:43:06 +0800
From: Yong <yong.deng@...ewell.com>
To: Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc: Sakari Ailus <sakari.ailus@....fi>,
Maxime Ripard <maxime.ripard@...tlin.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Chen-Yu Tsai <wens@...e.org>,
"David S. Miller" <davem@...emloft.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Walleij <linus.walleij@...aro.org>,
Randy Dunlap <rdunlap@...radead.org>,
Hans Verkuil <hans.verkuil@...co.com>,
Arnd Bergmann <arnd@...db.de>,
Stanimir Varbanov <stanimir.varbanov@...aro.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
Ramesh Shanmugasundaram <ramesh.shanmugasundaram@...renesas.com>,
Jacob Chen <jacob-chen@...wrt.com>,
Yannick Fertre <yannick.fertre@...com>,
Thierry Reding <treding@...dia.com>,
Benjamin Gaignard <benjamin.gaignard@...aro.org>,
Todor Tomov <todor.tomov@...aro.org>,
linux-media@...r.kernel.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-sunxi@...glegroups.com
Subject: Re: [PATCH v10 2/2] media: V3s: Add support for Allwinner CSI.
On Wed, 18 Jul 2018 12:55:14 +0300
Sakari Ailus <sakari.ailus@...ux.intel.com> wrote:
> Hi Yong,
>
> On Thu, Jul 05, 2018 at 03:48:02PM +0800, Yong wrote:
> > > > +
> > > > +/* -----------------------------------------------------------------------------
> > > > + * Media Operations
> > > > + */
> > > > +static int sun6i_video_formats_init(struct sun6i_video *video,
> > > > + const struct media_pad *remote)
> > > > +{
> > > > + struct v4l2_subdev_mbus_code_enum mbus_code = { 0 };
> > > > + struct sun6i_csi *csi = video->csi;
> > > > + struct v4l2_format format;
> > > > + struct v4l2_subdev *subdev;
> > > > + u32 pad;
> > > > + const u32 *pixformats;
> > > > + int pixformat_count = 0;
> > > > + u32 subdev_codes[32]; /* subdev format codes, 32 should be enough */
> > > > + int codes_count = 0;
> > > > + int num_fmts = 0;
> > > > + int i, j;
> > > > +
> > > > + pad = remote->index;
> > > > + subdev = media_entity_to_v4l2_subdev(remote->entity);
> > > > + if (subdev == NULL)
> > > > + return -ENXIO;
> > > > +
> > > > + /* Get supported pixformats of CSI */
> > > > + pixformat_count = sun6i_csi_get_supported_pixformats(csi, &pixformats);
> > > > + if (pixformat_count <= 0)
> > > > + return -ENXIO;
> > > > +
> > > > + /* Get subdev formats codes */
> > > > + mbus_code.pad = pad;
> > > > + mbus_code.which = V4L2_SUBDEV_FORMAT_ACTIVE;
> > > > + while (!v4l2_subdev_call(subdev, pad, enum_mbus_code, NULL,
> > > > + &mbus_code)) {
> > >
> > > The formats supported by the external sub-device may depend on horizontal
> > > and vertical flipping. You shouldn't assume any particular configuration
> > > here: instead, bridge drivers generally just need to make sure the formats
> > > match in link validation when streaming is started. At least the CSI-2
> > > receiver driver and the DMA engine driver (video device) should check the
> > > configuration is valid. See e.g. the IPU3 driver:
> > > drivers/media/pci/intel/ipu3/ipu3-cio2.c .
> >
> > Can mbus_code be added dynamically ?
> > The code here only enum the mbus code and get the possible supported
> > pairs of pixformat and mbus by SoC. Not try to check if the formats
> > (width height ...) is valid or not. The formats validation will be
> > in link validation when streaming is started as per your advise.
>
> The formats that can be enumerated from the sensor here are those settable
> using SUBDEV_S_FMT. The enumeration will change on raw sensors if you use
> the flipping controls. As the bridge driver implements MC as well as subdev
> APIs, generally the sensor configuration is out of scope of this driver
> since it's directly configured from the user space.
>
> Just check that the pipeline is valid before starting streaming in your
> driver.
OK. I will take some time to change these code.
>
> --
> Kind regards,
>
> Sakari Ailus
> sakari.ailus@...ux.intel.com
Thanks,
Yong
Powered by blists - more mailing lists