All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacopo Mondi <jacopo@jmondi.org>
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 07/11] rcar-vin: Extend group notifier DT parser to work with any port
Date: Wed, 7 Jul 2021 12:24:54 +0200	[thread overview]
Message-ID: <20210707102454.ysyl7y4rd4oyyrui@uno.localdomain> (raw)
In-Reply-To: <20210413180253.2575451-8-niklas.soderlund+renesas@ragnatech.se>

Hi Niklas,

On Tue, Apr 13, 2021 at 08:02:49PM +0200, Niklas Söderlund wrote:
> The R-Car VIN group notifier will be extend to support a new group of
> subdevices, the R-Car ISP channel selector in addition to the existing
> R-Car CSI-2 receiver subdevices.
>
> The existing DT parsing code can be reused if the port and max number of
> endpoints are provided as parameters instead of being hard-coded. While
> at it align the group notifier parser function names with the rest of
> the driver.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
>  drivers/media/platform/rcar-vin/rcar-core.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c
> index d951f739b3a9a034..2628637084ae2aa9 100644
> --- a/drivers/media/platform/rcar-vin/rcar-core.c
> +++ b/drivers/media/platform/rcar-vin/rcar-core.c
> @@ -506,7 +506,8 @@ static const struct v4l2_async_notifier_operations rvin_group_notify_ops = {
>  	.complete = rvin_group_notify_complete,
>  };
>
> -static int rvin_mc_parse_of(struct rvin_dev *vin, unsigned int id)
> +static int rvin_group_parse_of(struct rvin_dev *vin, unsigned int port,
> +			       unsigned int id)
>  {
>  	struct fwnode_handle *ep, *fwnode;
>  	struct v4l2_fwnode_endpoint vep = {
> @@ -515,7 +516,7 @@ static int rvin_mc_parse_of(struct rvin_dev *vin, unsigned int id)
>  	struct v4l2_async_subdev *asd;
>  	int ret;
>
> -	ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(vin->dev), 1, id, 0);
> +	ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(vin->dev), port, id, 0);
>  	if (!ep)
>  		return 0;
>
> @@ -563,7 +564,8 @@ static void rvin_group_notifier_cleanup(struct rvin_dev *vin)
>  	mutex_unlock(&vin->group->lock);
>  }
>
> -static int rvin_mc_parse_of_graph(struct rvin_dev *vin)
> +static int rvin_group_notifier_init(struct rvin_dev *vin, unsigned int port,
> +				    unsigned int max_id)
>  {
>  	unsigned int count = 0, vin_mask = 0;
>  	unsigned int i, id;
> @@ -589,19 +591,18 @@ static int rvin_mc_parse_of_graph(struct rvin_dev *vin)
>  	v4l2_async_notifier_init(&vin->group->notifier);
>
>  	/*
> -	 * Have all VIN's look for CSI-2 subdevices. Some subdevices will
> -	 * overlap but the parser function can handle it, so each subdevice
> -	 * will only be registered once with the group notifier.
> +	 * Some subdevices may overlap but the parser function can handle it and
> +	 * each subdevice will only be registered once with the group notifier.
>  	 */
>  	for (i = 0; i < RCAR_VIN_NUM; i++) {
>  		if (!(vin_mask & BIT(i)))
>  			continue;
>
> -		for (id = 0; id < RVIN_CSI_MAX; id++) {
> +		for (id = 0; id < max_id; id++) {
>  			if (vin->group->remotes[id].asd)
>  				continue;
>
> -			ret = rvin_mc_parse_of(vin->group->vin[i], id);
> +			ret = rvin_group_parse_of(vin->group->vin[i], port, id);
>  			if (ret)
>  				return ret;
>  		}
> @@ -981,7 +982,7 @@ static int rvin_csi2_init(struct rvin_dev *vin)
>  	if (ret && ret != -ENODEV)
>  		goto err_group;
>
> -	ret = rvin_mc_parse_of_graph(vin);
> +	ret = rvin_group_notifier_init(vin, 1, RVIN_CSI_MAX);

You know, I would define RVIN_CSI2_ENDPOINT_NUM or similar.
Small nit apart, it's good to be able to reuse the same routines!

Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>

Thanks
   j

>  	if (ret)
>  		goto err_parallel;
>
> --
> 2.31.1
>

  reply	other threads:[~2021-07-07 10:24 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 18:02 [PATCH 00/11] rcar-vin: Add r8a779a0 support Niklas Söderlund
2021-04-13 18:02 ` [PATCH 01/11] rcar-vin: Refactor controls creation for video device Niklas Söderlund
2021-07-06 16:04   ` Jacopo Mondi
2021-07-06 16:16     ` Niklas Söderlund
2021-07-06 16:58       ` Jacopo Mondi
2021-07-08 13:40         ` Sakari Ailus
2021-07-08 14:05           ` Niklas Söderlund
2021-07-08 14:42             ` Sakari Ailus
2021-07-06 16:08   ` Jacopo Mondi
2021-07-06 16:17     ` Niklas Söderlund
2021-04-13 18:02 ` [PATCH 02/11] rcar-vin: Fix error paths for rvin_mc_init() Niklas Söderlund
2021-07-06 16:09   ` Jacopo Mondi
2021-04-13 18:02 ` [PATCH 03/11] rcar-vin: Improve async notifier cleanup paths Niklas Söderlund
2021-07-06 16:41   ` Jacopo Mondi
2021-04-13 18:02 ` [PATCH 04/11] rcar-vin: Improve reuse of parallel notifier Niklas Söderlund
2021-07-06 16:51   ` Jacopo Mondi
2021-07-07  8:51     ` Niklas Söderlund
2021-04-13 18:02 ` [PATCH 05/11] rcar-vin: Rename array storing subdevice information Niklas Söderlund
2021-07-06 16:53   ` Jacopo Mondi
2021-04-13 18:02 ` [PATCH 06/11] rcar-vin: Move group async notifier Niklas Söderlund
2021-07-06 16:58   ` Jacopo Mondi
2021-04-13 18:02 ` [PATCH 07/11] rcar-vin: Extend group notifier DT parser to work with any port Niklas Söderlund
2021-07-07 10:24   ` Jacopo Mondi [this message]
2021-04-13 18:02 ` [PATCH 08/11] rcar-vin: Create a callback to setup media links Niklas Söderlund
2021-07-07 10:33   ` Jacopo Mondi
2021-07-08 15:46     ` Niklas Söderlund
2021-04-13 18:02 ` [PATCH 09/11] rcar-vin: Specify media device ops at group creation time Niklas Söderlund
2021-07-07 10:40   ` Jacopo Mondi
2021-04-13 18:02 ` [PATCH 10/11] rcar-vin: Move and rename CSI-2 link notifications Niklas Söderlund
2021-07-07 10:46   ` Jacopo Mondi
2021-04-13 18:02 ` [PATCH 11/11] rcar-vin: Add r8a779a0 support Niklas Söderlund
2021-07-07 11:09   ` Jacopo Mondi

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=20210707102454.ysyl7y4rd4oyyrui@uno.localdomain \
    --to=jacopo@jmondi.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --subject='Re: [PATCH 07/11] rcar-vin: Extend group notifier DT parser to work with any port' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.