public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: "Tommaso Merciai" <tomm.merciai@gmail.com>,
	jacopo.mondi@ideasonboard.com, martin.hecht@avnet.eu,
	michael.roeder@avnet.eu, linuxfancy@googlegroups.com,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Hans Verkuil" <hverkuil@xs4all.nl>,
	"Marco Felsch" <m.felsch@pengutronix.de>,
	"Gerald Loacker" <gerald.loacker@wolfvision.net>,
	"Nicholas Roth" <nicholas@rothemail.net>,
	"Krzysztof Hałasa" <khalasa@piap.pl>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Benjamin Mugnier" <benjamin.mugnier@foss.st.com>,
	"Mikhail Rudenko" <mike.rudenko@gmail.com>,
	"Shawn Tu" <shawnx.tu@intel.com>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH v5 3/3] media: i2c: Add support for alvium camera
Date: Mon, 19 Jun 2023 17:24:58 +0300	[thread overview]
Message-ID: <20230619142458.GE10462@pendragon.ideasonboard.com> (raw)
In-Reply-To: <ZJAy4vRxI9uEUwQj@kekkonen.localdomain>

On Mon, Jun 19, 2023 at 10:50:10AM +0000, Sakari Ailus wrote:
> On Fri, Jun 09, 2023 at 03:09:41PM +0200, Tommaso Merciai wrote:
> > On Fri, Jun 09, 2023 at 09:17:42AM +0000, Sakari Ailus wrote:
> > > On Thu, Jun 08, 2023 at 10:31:16AM +0200, Tommaso Merciai wrote:
> > > > The Alvium camera is shipped with sensor + isp in the same housing.
> > > > The camera can be equipped with one out of various sensor and abstract
> > > > the user from this. Camera is connected via MIPI CSI-2.
> > > > 
> > > > Most of the camera module features are supported, with the main exception
> > > > being fw update.
> > > > 
> > > > The driver provides all mandatory, optional and recommended V4L2 controls
> > > > for maximum compatibility with libcamera
> > > > 
> > > > References:
> > > >  - https://www.alliedvision.com/en/products/embedded-vision-solutions
> > > > 
> > > > Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
> > > > ---
> > > > Changes since v2:
> > > >  - Removed gpios/clock handling as suggested by LPinchart
> > > >  - Added vcc-ext-in supply support as suggested by LPinchart
> > > >  - Fixed alvium_setup_mipi_fmt funct as suggested by CJAILLET
> > > >  - Removed upside_down/hshake_bit priv data as suggested by CJAILLET
> > > >  - Fixed commit body as suggested by LPinchart
> > > >  - Mv alvium_set_streamon_delay to yalvium_set_lp2hs_delay
> > > >  - Fixed comment on lp2hs prop as suggested by LPinchart
> > > >  - Added pm resume/suspend functs as suggested by LPinchart
> > > >  - Dropped alvium_link_setup/alvium_s_power as suggested by LPinchart
> > > >  - Fixed regs defines as suggested by LPinchart
> > > >  - Fixed typedef as suggested by LPinchart
> > > >  - Dropped bcrm_v/fw_v from priv data as suggested by LPinchart
> > > >  - Now driver use the subdev active state to store the active format and crop
> > > >    as suggested by LPinchart
> > > >  - Dropped alvium_is_csi2/i2c_to_alvium as suggested by LPinchart
> > > > 
> > > > Changes since v3:
> > > >  - Fixed warnings Reported-by: kernel test robot <lkp@intel.com>
> > > > 
> > > > Changes since v4:
> > > >  - Removed print into alvium_get_dt_data for alliedvision,lp2hs-delay-us as
> > > >    suggested by CDooley
> > > > 
> > > >  drivers/media/i2c/Kconfig       |   10 +
> > > >  drivers/media/i2c/Makefile      |    1 +
> > > >  drivers/media/i2c/alvium-csi2.c | 3479 +++++++++++++++++++++++++++++++
> > > >  drivers/media/i2c/alvium-csi2.h |  485 +++++
> > > >  4 files changed, 3975 insertions(+)
> > > >  create mode 100644 drivers/media/i2c/alvium-csi2.c
> > > >  create mode 100644 drivers/media/i2c/alvium-csi2.h

[snip]

> > > > diff --git a/drivers/media/i2c/alvium-csi2.c b/drivers/media/i2c/alvium-csi2.c
> > > > new file mode 100644
> > > > index 000000000000..52c9263075cf
> > > > --- /dev/null
> > > > +++ b/drivers/media/i2c/alvium-csi2.c
> > > > @@ -0,0 +1,3479 @@

[snip]

> > > > +static int alvium_get_img_width_params(struct alvium_dev *alvium)
> > > > +{
> > > > +	struct device *dev = &alvium->i2c_client->dev;
> > > > +	int ret;
> > > > +	u64 val;
> > > > +
> > > > +	if (!alvium->bcrm_addr)
> > > > +		return -EINVAL;
> > > > +
> > > > +	ret = alvium_read(alvium,
> > > > +			  REG_BCRM_IMG_WIDTH_MIN_R,
> > > > +			  &val);
> > > > +	if (ret) {
> > > > +		dev_err(dev, "Fail to read img min width reg\n");
> > > > +		return ret;
> > > > +	}
> > > 
> > > Could you add a macro that assigns the value to the variable (or a struct
> > > field in this case) when the read is successful? Add the print if you think
> > > you need it.
> > 
> > I don't get this comment.
> > Can you explain me better your plan please.
> 
> You have exactly the same pattern repeated over and over in a number of
> functions. I'd like you to add a macro (or a function) that takes what
> varies as arguments, and call that function here. It would reduce a lot of
> the repeated lines code here.
> 
> ...

The best option is to print an error message in alvium_read() and drop
all error messages from the callers.

-- 
Regards,

Laurent Pinchart

  parent reply	other threads:[~2023-06-19 14:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08  8:31 [PATCH v5 0/3] media: i2c: Add support for alvium camera Tommaso Merciai
2023-06-08  8:31 ` [PATCH v5 1/3] dt-bindings: vendor-prefixes: Add prefix alliedvision Tommaso Merciai
2023-06-08  8:31 ` [PATCH v5 2/3] media: dt-bindings: alvium: add document YAML binding Tommaso Merciai
2023-06-09  8:35   ` Sakari Ailus
2023-06-09  9:41     ` Tommaso Merciai
2023-06-09  9:44       ` Sakari Ailus
2023-06-09 10:04         ` Tommaso Merciai
2023-06-08  8:31 ` [PATCH v5 3/3] media: i2c: Add support for alvium camera Tommaso Merciai
2023-06-08 21:08   ` kernel test robot
2023-06-09  9:17   ` Sakari Ailus
2023-06-09 13:09     ` Tommaso Merciai
2023-06-19 10:50       ` Sakari Ailus
2023-06-19 14:13         ` Tommaso Merciai
2023-06-19 14:24         ` Laurent Pinchart [this message]
2023-06-20  4:54           ` Tommaso Merciai
2023-06-20  9:43             ` Laurent Pinchart
2023-06-20 10:39               ` Tommaso Merciai
2023-06-20 10:53                 ` Laurent Pinchart
2023-06-20 11:09                   ` Tommaso Merciai

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=20230619142458.GE10462@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=benjamin.mugnier@foss.st.com \
    --cc=broonie@kernel.org \
    --cc=gerald.loacker@wolfvision.net \
    --cc=hverkuil@xs4all.nl \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=khalasa@piap.pl \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linuxfancy@googlegroups.com \
    --cc=m.felsch@pengutronix.de \
    --cc=martin.hecht@avnet.eu \
    --cc=mchehab@kernel.org \
    --cc=michael.roeder@avnet.eu \
    --cc=mike.rudenko@gmail.com \
    --cc=nicholas@rothemail.net \
    --cc=sakari.ailus@linux.intel.com \
    --cc=shawnx.tu@intel.com \
    --cc=tomm.merciai@gmail.com \
    /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