From: jacopo mondi <jacopo@jmondi.org>
To: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
Cc: Jacopo Mondi <jacopo+renesas@jmondi.org>,
laurent.pinchart@ideasonboard.com, mchehab@kernel.org,
linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v4 5/9] media: rcar-vin: Parse parallel input on Gen3
Date: Fri, 25 May 2018 09:16:15 +0200 [thread overview]
Message-ID: <20180525071615.GJ18369@w540> (raw)
In-Reply-To: <20180524222944.GI31036@bigcity.dyn.berto.se>
[-- Attachment #1: Type: text/plain, Size: 5509 bytes --]
Hi Niklas,
On Fri, May 25, 2018 at 12:29:44AM +0200, Niklas Söderlund wrote:
> Hi Jacopo,
>
> Thanks for your work.
>
> I really like what you did with this patch in v4.
Thanks for review and suggestions, what's there comes mostly from your
comments and guidance.
>
> On 2018-05-25 00:02:15 +0200, Jacopo Mondi wrote:
> > The rcar-vin driver so far had a mutually exclusive code path for
> > handling parallel and CSI-2 video input subdevices, with only the CSI-2
> > use case supporting media-controller. As we add support for parallel
> > inputs to Gen3 media-controller compliant code path now parse both port@0
> > and port@1, handling the media-controller use case in the parallel
> > bound/unbind notifier operations.
> >
> > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> >
> > ---
> > v3 -> v4:
> > - Change the mc/parallel initialization order. Initialize mc first, then
> > parallel
> > - As a consequence no need to delay parallel notifiers registration, the
> > media controller is set up already when parallel input got parsed,
> > this greatly simplify the group notifier complete callback.
> > ---
> > drivers/media/platform/rcar-vin/rcar-core.c | 56 ++++++++++++++++++-----------
> > 1 file changed, 35 insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c
> > index a799684..29619c2 100644
> > --- a/drivers/media/platform/rcar-vin/rcar-core.c
> > +++ b/drivers/media/platform/rcar-vin/rcar-core.c
> > @@ -399,6 +399,11 @@ static int rvin_parallel_subdevice_attach(struct rvin_dev *vin,
> > ret = rvin_find_pad(subdev, MEDIA_PAD_FL_SINK);
> > vin->parallel->sink_pad = ret < 0 ? 0 : ret;
> >
> > + if (vin->info->use_mc) {
> > + vin->parallel->subdev = subdev;
> > + return 0;
> > + }
> > +
> > /* Find compatible subdevices mbus format */
> > vin->mbus_code = 0;
> > code.index = 0;
> > @@ -460,10 +465,12 @@ static int rvin_parallel_subdevice_attach(struct rvin_dev *vin,
> > static void rvin_parallel_subdevice_detach(struct rvin_dev *vin)
> > {
> > rvin_v4l2_unregister(vin);
> > - v4l2_ctrl_handler_free(&vin->ctrl_handler);
> > -
> > - vin->vdev.ctrl_handler = NULL;
> > vin->parallel->subdev = NULL;
> > +
> > + if (!vin->info->use_mc) {
> > + v4l2_ctrl_handler_free(&vin->ctrl_handler);
> > + vin->vdev.ctrl_handler = NULL;
> > + }
> > }
> >
> > static int rvin_parallel_notify_complete(struct v4l2_async_notifier *notifier)
> > @@ -552,18 +559,18 @@ static int rvin_parallel_parse_v4l2(struct device *dev,
> > return 0;
> > }
> >
> > -static int rvin_parallel_graph_init(struct rvin_dev *vin)
> > +static int rvin_parallel_init(struct rvin_dev *vin)
> > {
> > int ret;
> >
> > - ret = v4l2_async_notifier_parse_fwnode_endpoints(
> > - vin->dev, &vin->notifier,
> > - sizeof(struct rvin_parallel_entity), rvin_parallel_parse_v4l2);
> > + ret = v4l2_async_notifier_parse_fwnode_endpoints_by_port(
> > + vin->dev, &vin->notifier, sizeof(struct rvin_parallel_entity),
> > + 0, rvin_parallel_parse_v4l2);
> > if (ret)
> > return ret;
> >
> > if (!vin->parallel)
> > - return -ENODEV;
> > + return -ENOTCONN;
>
> I think you still should return -ENODEV here if !vin->info->use_mc to
> preserve Gen2 which runs without media controller behavior. How about:
>
> return vin->info->use_mc ? -ENOTCONN : -ENODEV;
Right, I wish I had some gen2 board to test. I wonder if that's not
better handled in probe though... I'll see how it looks like.
>
> >
> > vin_dbg(vin, "Found parallel subdevice %pOF\n",
> > to_of_node(vin->parallel->asd.match.fwnode));
> > @@ -784,14 +791,8 @@ static int rvin_mc_init(struct rvin_dev *vin)
> > {
> > int ret;
> >
> > - vin->pad.flags = MEDIA_PAD_FL_SINK;
> > - ret = media_entity_pads_init(&vin->vdev.entity, 1, &vin->pad);
> > - if (ret)
> > - return ret;
> > -
> > - ret = rvin_group_get(vin);
> > - if (ret)
> > - return ret;
> > + if (!vin->info->use_mc)
> > + return 0;
> >
> > ret = rvin_mc_parse_of_graph(vin);
> > if (ret)
> > @@ -1074,11 +1075,24 @@ static int rcar_vin_probe(struct platform_device *pdev)
> > return ret;
> >
> > platform_set_drvdata(pdev, vin);
> > - if (vin->info->use_mc)
> > - ret = rvin_mc_init(vin);
> > - else
> > - ret = rvin_parallel_graph_init(vin);
> > - if (ret < 0)
> > +
> > + if (vin->info->use_mc) {
> > + vin->pad.flags = MEDIA_PAD_FL_SINK;
> > + ret = media_entity_pads_init(&vin->vdev.entity, 1, &vin->pad);
> > + if (ret)
> > + return ret;
> > +
> > + ret = rvin_group_get(vin);
> > + if (ret)
> > + return ret;
> > + }
>
> I don't see why you need to move the media pad creation out of
> rvin_mc_init(). With the reorder of the rvin_mc_init()
> rvin_parallel_init() I would keep this in rvin_mc_init().
>
Just because I've been lazy re-structuring that part of code I broke
up in previous versions. I'll move that part back to mc_init() and
possibly also remove the
+ if (!vin->info->use_mc)
+ return 0;
in that function and handle this in probe().
Thanks
j
> > +
> > + ret = rvin_mc_init(vin);
> > + if (ret)
> > + return ret;
> > +
> > + ret = rvin_parallel_init(vin);
> > + if (ret < 0 && ret != -ENOTCONN)
> > goto error;
> >
> > pm_suspend_ignore_children(&pdev->dev, true);
> > --
> > 2.7.4
> >
>
> --
> Regards,
> Niklas Söderlund
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2018-05-25 7:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-24 22:02 [PATCH v4 0/9] rcar-vin: Add support for parallel input on Gen3 Jacopo Mondi
2018-05-24 22:02 ` [PATCH v4 1/9] media: rcar-vin: Rename 'digital' to 'parallel' Jacopo Mondi
2018-05-24 22:02 ` [PATCH v4 2/9] media: rcar-vin: Remove two empty lines Jacopo Mondi
2018-05-24 22:02 ` [PATCH v4 3/9] media: rcar-vin: Create a group notifier Jacopo Mondi
2018-05-24 22:02 ` [PATCH v4 4/9] media: rcar-vin: Cache the mbus configuration flags Jacopo Mondi
2018-05-24 22:02 ` [PATCH v4 5/9] media: rcar-vin: Parse parallel input on Gen3 Jacopo Mondi
2018-05-24 22:29 ` Niklas Söderlund
2018-05-24 22:29 ` Niklas Söderlund
2018-05-25 7:16 ` jacopo mondi [this message]
2018-05-25 11:50 ` jacopo mondi
2018-05-28 13:50 ` Niklas Söderlund
2018-05-28 13:50 ` Niklas Söderlund
2018-05-24 22:02 ` [PATCH v4 6/9] media: rcar-vin: Link parallel input media entities Jacopo Mondi
2018-05-24 22:02 ` [PATCH v4 7/9] media: rcar-vin: Handle parallel subdev in link_notify Jacopo Mondi
2018-05-24 22:02 ` [PATCH v4 8/9] media: rcar-vin: Rename _rcar_info to rcar_info Jacopo Mondi
2018-05-24 22:02 ` [PATCH v4 9/9] media: rcar-vin: Add support for R-Car R8A77995 SoC 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=20180525071615.GJ18369@w540 \
--to=jacopo@jmondi.org \
--cc=jacopo+renesas@jmondi.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=niklas.soderlund@ragnatech.se \
/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 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.