linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacopo Mondi <jacopo@jmondi.org>
To: Eugen Hristev <eugen.hristev@microchip.com>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	laurent.pinchart@ideasonboard.com, sakari.ailus@iki.fi,
	robh+dt@kernel.org, nicolas.ferre@microchip.com
Subject: Re: [PATCH 11/21] media: atmel: atmel-isc-base: implement mbus_code support in enumfmt
Date: Fri, 5 Nov 2021 10:51:28 +0100	[thread overview]
Message-ID: <20211105095128.7tu4rm6mogwy2dz6@uno.localdomain> (raw)
In-Reply-To: <20211105092559.ce6pdm4hwvxkmutd@uno.localdomain>

Hi Eugen

On Fri, Nov 05, 2021 at 10:25:59AM +0100, Jacopo Mondi wrote:
> Hi Eugen,
>
> On Fri, Oct 22, 2021 at 10:52:37AM +0300, Eugen Hristev wrote:
> > If enumfmt is called with an mbus_code, the enumfmt handler should only
> > return the formats that are supported for this mbus_code.
> > To make it more easy to understand the formats, changed the report order
> > to report first the native formats, and after that the formats that the ISC
> > can convert to.
> >
> > Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
>
> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
>

Too soon! Sorry...

> Thanks
>    j
>
> > ---
> >  drivers/media/platform/atmel/atmel-isc-base.c | 51 ++++++++++++++++---
> >  1 file changed, 43 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c
> > index 2dd2511c7be1..1f7fbe5e4d79 100644
> > --- a/drivers/media/platform/atmel/atmel-isc-base.c
> > +++ b/drivers/media/platform/atmel/atmel-isc-base.c
> > @@ -499,21 +499,56 @@ static int isc_enum_fmt_vid_cap(struct file *file, void *priv,
> >  	u32 index = f->index;
> >  	u32 i, supported_index;
> >
> > -	if (index < isc->controller_formats_size) {
> > -		f->pixelformat = isc->controller_formats[index].fourcc;
> > -		return 0;
> > +	supported_index = 0;
> > +
> > +	for (i = 0; i < isc->formats_list_size; i++) {
> > +		if (!isc->formats_list[i].sd_support)


> > +			continue;
> > +		/*
> > +		 * If specific mbus_code is requested, provide only
> > +		 * supported formats with this mbus code
> > +		 */
> > +		if (f->mbus_code && f->mbus_code !=
> > +		    isc->formats_list[i].mbus_code)
> > +			continue;
> > +		if (supported_index == index) {
> > +			f->pixelformat = isc->formats_list[i].fourcc;
> > +			return 0;
> > +		}
> > +		supported_index++;
> >  	}
> >
> > -	index -= isc->controller_formats_size;
> > +	/*
> > +	 * If the sensor does not support this mbus_code whatsoever,
> > +	 * there is no reason to advertise any of our output formats
> > +	 */
> > +	if (supported_index == 0)
> > +		return -EINVAL;

Shouldn't you also return -EINVAL if index > supported_index ?

In that case, I'm not gettng what the rest of the function is for ?

> > +
> > +	/*
> > +	 * If the sensor uses a format that is not raw, then we cannot
> > +	 * convert it to any of the formats that we usually can with a
> > +	 * RAW sensor. Thus, do not advertise them.
> > +	 */
> > +	if (!isc->config.sd_format ||
> > +	    !ISC_IS_FORMAT_RAW(isc->config.sd_format->mbus_code))
> > +		return -EINVAL;
> >
> > +	/*
> > +	 * Iterate again through the formats that we can convert to.
> > +	 * However, to avoid duplicates, skip the formats that
> > +	 * the sensor already supports directly
> > +	 */
> > +	index -= supported_index;
> >  	supported_index = 0;
> >
> > -	for (i = 0; i < isc->formats_list_size; i++) {
> > -		if (!ISC_IS_FORMAT_RAW(isc->formats_list[i].mbus_code) ||
> > -		    !isc->formats_list[i].sd_support)
> > +	for (i = 0; i < isc->controller_formats_size; i++) {
> > +		/* if this format is already supported by sensor, skip it */
> > +		if (find_format_by_fourcc(isc, isc->controller_formats[i].fourcc))
> >  			continue;
> >  		if (supported_index == index) {
> > -			f->pixelformat = isc->formats_list[i].fourcc;
> > +			f->pixelformat =
> > +				isc->controller_formats[i].fourcc;
> >  			return 0;
> >  		}
> >  		supported_index++;
> > --
> > 2.25.1
> >

  reply	other threads:[~2021-11-05  9:50 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22  7:52 [PATCH 00/21] media: atmel: atmel-isc: implement media controller Eugen Hristev
2021-10-22  7:52 ` [PATCH 01/21] MAINTAINERS: add microchip csi2dc Eugen Hristev
2021-10-22  7:52 ` [PATCH 02/21] dt-bindings: media: atmel: csi2dc: add bindings for " Eugen Hristev
2021-10-29  1:57   ` Rob Herring
2021-10-22  7:52 ` [PATCH 03/21] media: atmel: introduce microchip csi2dc driver Eugen Hristev
2021-11-02 17:22   ` Jacopo Mondi
2021-11-03  8:31     ` Eugen.Hristev
2021-11-03  9:28       ` Jacopo Mondi
2021-11-03  9:59         ` Eugen.Hristev
2021-11-03 10:59           ` Jacopo Mondi
2021-11-11 10:05             ` Eugen.Hristev
2021-10-22  7:52 ` [PATCH 04/21] MAINTAINERS: atmel-isc: add new file atmel-isc-clk.c Eugen Hristev
2021-10-22  7:52 ` [PATCH 05/21] media: atmel: atmel-isc: split the clock code into separate source file Eugen Hristev
2021-11-05  9:02   ` Jacopo Mondi
2021-11-05  9:13     ` Eugen.Hristev
2021-10-22  7:52 ` [PATCH 06/21] media: atmel: atmel-isc: replace video device name with module name Eugen Hristev
2021-11-05  9:14   ` Jacopo Mondi
2021-10-22  7:52 ` [PATCH 07/21] media: atmel: atmel-sama7g5-isc: fix ispck leftover Eugen Hristev
2021-11-05  9:15   ` Jacopo Mondi
2021-10-22  7:52 ` [PATCH 08/21] media: atmel: atmel-isc-base: use streaming status when queueing buffers Eugen Hristev
2021-11-05  9:18   ` Jacopo Mondi
2021-10-22  7:52 ` [PATCH 09/21] media: atmel: atmel-isc-base: remove frameintervals VIDIOC Eugen Hristev
2021-11-05  9:23   ` Jacopo Mondi
2021-10-22  7:52 ` [PATCH 10/21] media: atmel: atmel-isc-base: report frame sizes as full supported range Eugen Hristev
2021-11-05  9:52   ` Jacopo Mondi
2021-10-22  7:52 ` [PATCH 11/21] media: atmel: atmel-isc-base: implement mbus_code support in enumfmt Eugen Hristev
2021-11-05  9:25   ` Jacopo Mondi
2021-11-05  9:51     ` Jacopo Mondi [this message]
2021-11-05 11:03       ` Eugen.Hristev
2021-11-08 11:20         ` Jacopo Mondi
2021-11-08 14:08           ` Eugen.Hristev
2021-11-11  9:49             ` Eugen.Hristev
2021-10-22  7:52 ` [PATCH 12/21] media: atmel: atmel-isc-base: fix bytesperline value for planar formats Eugen Hristev
2021-10-22  7:52 ` [PATCH 13/21] MAINTAINERS: atmel-isc: add new file atmel-isc-mc.c Eugen Hristev
2021-10-22  7:52 ` [PATCH 14/21] media: atmel: atmel-isc: implement media controller Eugen Hristev
2021-10-22  7:52 ` [PATCH 15/21] ARM: dts: at91: sama7g5: add nodes for video capture Eugen Hristev
2021-10-22  7:52 ` [PATCH 16/21] ARM: configs: at91: sama7: add xisc and csi2dc Eugen Hristev
2021-10-22  7:52 ` [PATCH 17/21] ARM: multi_v7_defconfig: add atmel video pipeline modules Eugen Hristev
2021-10-22  7:52 ` [PATCH 18/21] media: atmel: atmel-sama5d2-isc: fix wrong mask in YUYV format check Eugen Hristev
2021-10-22  7:52 ` [PATCH 19/21] media: atmel: atmel-isc-base: use mutex to lock awb workqueue from streaming Eugen Hristev
2021-10-22  7:52 ` [PATCH 20/21] media: atmel: atmel-isc-base: add wb debug messages Eugen Hristev
2021-10-22  7:52 ` [PATCH 21/21] media: atmel: atmel-isc-base: clamp wb gain coefficients Eugen Hristev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211105095128.7tu4rm6mogwy2dz6@uno.localdomain \
    --to=jacopo@jmondi.org \
    --cc=devicetree@vger.kernel.org \
    --cc=eugen.hristev@microchip.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).