From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: kieran.bingham@ideasonboard.com
Cc: "Laurent Pinchart" <laurent.pinchart+renesas@ideasonboard.com>,
linux-media@vger.kernel.org,
"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
"Kuninori Morimoto" <kuninori.morimoto.gx@renesas.com>,
linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH] media: i2c: adv748x: Fix pixel rate values
Date: Mon, 23 Apr 2018 12:08:22 +0300 [thread overview]
Message-ID: <19059407.fUISklDEzf@avalon> (raw)
In-Reply-To: <e5490bf5-38a0-4536-ed2d-c2d63edb6c39@ideasonboard.com>
Hi Kieran,
On Monday, 23 April 2018 11:59:04 EEST Kieran Bingham wrote:
> On 21/04/18 13:44, Laurent Pinchart wrote:
> > The pixel rate, as reported by the V4L2_CID_PIXEL_RATE control, must
> > include both horizontal and vertical blanking. Both the AFE and HDMI
> > receiver program it incorrectly:
> >
> > - The HDMI receiver goes to the trouble of removing blanking to compute
> > the rate of active pixels. This is easy to fix by removing the
> > computation and returning the incoming pixel clock rate directly.
> >
> > - The AFE performs similar calculation, while it should simply return
> > the fixed pixel rate for analog sources, mandated by the ADV748x to be
> > 28.63636 MHz.
> >
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
>
> This looks quite reasonable, and simplifies the code. Win win.
>
> I presume this will have implications on the pixel receiver side (VIN in our
> case)... are there changes required there, or was it 'just wrong' here.
No change should be required on the VIN side. This patch was prompted by a BSP
patch for VIN that aimed at fixing the same issue, but in the wrong location.
See message 2461975.rTQ0tvdgNJ@avalon in the "[periperi] 2018-04-05 Multimedia
group chat report" thread (Date: Sat, 21 Apr 2018 15:49:49 +0300).
> Either way,
>
> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
As you maintain the adv748x driver, could you make sure this patch gets
upstream ? :-)
> > ---
> >
> > drivers/media/i2c/adv748x/adv748x-afe.c | 11 +++++------
> > drivers/media/i2c/adv748x/adv748x-hdmi.c | 8 +-------
> > 2 files changed, 6 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/media/i2c/adv748x/adv748x-afe.c
> > b/drivers/media/i2c/adv748x/adv748x-afe.c index
> > 61514bae7e5c..3e18d5ae813b 100644
> > --- a/drivers/media/i2c/adv748x/adv748x-afe.c
> > +++ b/drivers/media/i2c/adv748x/adv748x-afe.c
> > @@ -321,17 +321,16 @@ static const struct v4l2_subdev_video_ops
> > adv748x_afe_video_ops = {
> > static int adv748x_afe_propagate_pixelrate(struct adv748x_afe *afe)
> > {
> > struct v4l2_subdev *tx;
> > - unsigned int width, height, fps;
> >
> > tx = adv748x_get_remote_sd(&afe->pads[ADV748X_AFE_SOURCE]);
> > if (!tx)
> > return -ENOLINK;
> >
> > - width = 720;
> > - height = afe->curr_norm & V4L2_STD_525_60 ? 480 : 576;
> > - fps = afe->curr_norm & V4L2_STD_525_60 ? 30 : 25;
> > -
> > - return adv748x_csi2_set_pixelrate(tx, width * height * fps);
> > + /*
> > + * The ADV748x samples analog video signals using an externally
supplied
> > + * clock whose frequency is required to be 28.63636 MHz.
> > + */
> > + return adv748x_csi2_set_pixelrate(tx, 28636360);
> > }
> >
> > static int adv748x_afe_enum_mbus_code(struct v4l2_subdev *sd,
> > diff --git a/drivers/media/i2c/adv748x/adv748x-hdmi.c
> > b/drivers/media/i2c/adv748x/adv748x-hdmi.c index
> > 10d229a4f088..aecc2a84dfec 100644
> > --- a/drivers/media/i2c/adv748x/adv748x-hdmi.c
> > +++ b/drivers/media/i2c/adv748x/adv748x-hdmi.c
> > @@ -402,8 +402,6 @@ static int adv748x_hdmi_propagate_pixelrate(struct
> > adv748x_hdmi *hdmi)>
> > {
> > struct v4l2_subdev *tx;
> > struct v4l2_dv_timings timings;
> > - struct v4l2_bt_timings *bt = &timings.bt;
> > - unsigned int fps;
> >
> > tx = adv748x_get_remote_sd(&hdmi->pads[ADV748X_HDMI_SOURCE]);
> > if (!tx)
> > @@ -411,11 +409,7 @@ static int adv748x_hdmi_propagate_pixelrate(struct
> > adv748x_hdmi *hdmi)
> > adv748x_hdmi_query_dv_timings(&hdmi->sd, &timings);
> >
> > - fps = DIV_ROUND_CLOSEST_ULL(bt->pixelclock,
> > - V4L2_DV_BT_FRAME_WIDTH(bt) *
> > - V4L2_DV_BT_FRAME_HEIGHT(bt));
> > -
> > - return adv748x_csi2_set_pixelrate(tx, bt->width * bt->height * fps);
> > + return adv748x_csi2_set_pixelrate(tx, timings.bt.pixelclock);
> > }
> >
> > static int adv748x_hdmi_enum_mbus_code(struct v4l2_subdev *sd,
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2018-04-23 9:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-21 12:44 [PATCH] media: i2c: adv748x: Fix pixel rate values Laurent Pinchart
2018-04-23 8:59 ` Kieran Bingham
2018-04-23 9:08 ` Laurent Pinchart [this message]
2018-04-23 9:16 ` Kieran Bingham
2018-04-24 23:36 ` Niklas Söderlund
2018-05-04 22:58 ` Niklas Söderlund
2018-05-05 9:48 ` Laurent Pinchart
2018-05-05 11:20 ` Niklas Söderlund
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=19059407.fUISklDEzf@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox