From: Hans Verkuil <hverkuil@xs4all.nl>
To: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>,
linux-media@vger.kernel.org, linux-sh@vger.kernel.org
Cc: magnus.damm@gmail.com, laurent.pinchart@ideasonboard.com,
hans.verkuil@cisco.com, ian.molton@codethink.co.uk,
lars@metafoo.de, william.towle@codethink.co.uk
Subject: Re: [PATCH v2 2/2] media: adv7604: update timings on change of input signal
Date: Mon, 11 Jan 2016 10:22:29 +0000 [thread overview]
Message-ID: <56938265.6050803@xs4all.nl> (raw)
In-Reply-To: <1450794122-31293-3-git-send-email-ulrich.hecht+renesas@gmail.com>
On 12/22/2015 03:22 PM, Ulrich Hecht wrote:
> Without this, .get_selection will always return the boot-time state.
>
> Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> ---
> drivers/media/i2c/adv7604.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
> index 8ad5c28..dcd659b 100644
> --- a/drivers/media/i2c/adv7604.c
> +++ b/drivers/media/i2c/adv7604.c
> @@ -1945,6 +1945,7 @@ static int adv76xx_isr(struct v4l2_subdev *sd, u32 status, bool *handled)
> u8 fmt_change_digital;
> u8 fmt_change;
> u8 tx_5v;
> + int ret;
>
> if (irq_reg_0x43)
> io_write(sd, 0x44, irq_reg_0x43);
> @@ -1968,6 +1969,14 @@ static int adv76xx_isr(struct v4l2_subdev *sd, u32 status, bool *handled)
>
> v4l2_subdev_notify_event(sd, &adv76xx_ev_fmt);
>
> + /* update timings */
> + ret = adv76xx_query_dv_timings(sd, &state->timings);
> + if (ret = -ENOLINK) {
> + /* no signal, fall back to default timings */
> + state->timings = (struct v4l2_dv_timings)
> + V4L2_DV_BT_CEA_640X480P59_94;
> + }
Nack.
If you detect a change in timings, then send the V4L2_EVENT_SOURCE_CHANGE event and leave
it to the app to query the new timings. Never do this in the driver itself.
The reason is that this will pull the rug out from under the application: the app thinks
it is using timings A but the driver is using timings B. Instead, tell the app that the
timings have changed and let the app handle this.
Regards,
Hans
> +
> if (handled)
> *handled = true;
> }
>
WARNING: multiple messages have this Message-ID (diff)
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>,
linux-media@vger.kernel.org, linux-sh@vger.kernel.org
Cc: magnus.damm@gmail.com, laurent.pinchart@ideasonboard.com,
hans.verkuil@cisco.com, ian.molton@codethink.co.uk,
lars@metafoo.de, william.towle@codethink.co.uk
Subject: Re: [PATCH v2 2/2] media: adv7604: update timings on change of input signal
Date: Mon, 11 Jan 2016 11:22:29 +0100 [thread overview]
Message-ID: <56938265.6050803@xs4all.nl> (raw)
In-Reply-To: <1450794122-31293-3-git-send-email-ulrich.hecht+renesas@gmail.com>
On 12/22/2015 03:22 PM, Ulrich Hecht wrote:
> Without this, .get_selection will always return the boot-time state.
>
> Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> ---
> drivers/media/i2c/adv7604.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
> index 8ad5c28..dcd659b 100644
> --- a/drivers/media/i2c/adv7604.c
> +++ b/drivers/media/i2c/adv7604.c
> @@ -1945,6 +1945,7 @@ static int adv76xx_isr(struct v4l2_subdev *sd, u32 status, bool *handled)
> u8 fmt_change_digital;
> u8 fmt_change;
> u8 tx_5v;
> + int ret;
>
> if (irq_reg_0x43)
> io_write(sd, 0x44, irq_reg_0x43);
> @@ -1968,6 +1969,14 @@ static int adv76xx_isr(struct v4l2_subdev *sd, u32 status, bool *handled)
>
> v4l2_subdev_notify_event(sd, &adv76xx_ev_fmt);
>
> + /* update timings */
> + ret = adv76xx_query_dv_timings(sd, &state->timings);
> + if (ret == -ENOLINK) {
> + /* no signal, fall back to default timings */
> + state->timings = (struct v4l2_dv_timings)
> + V4L2_DV_BT_CEA_640X480P59_94;
> + }
Nack.
If you detect a change in timings, then send the V4L2_EVENT_SOURCE_CHANGE event and leave
it to the app to query the new timings. Never do this in the driver itself.
The reason is that this will pull the rug out from under the application: the app thinks
it is using timings A but the driver is using timings B. Instead, tell the app that the
timings have changed and let the app handle this.
Regards,
Hans
> +
> if (handled)
> *handled = true;
> }
>
next prev parent reply other threads:[~2016-01-11 10:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-22 14:22 [PATCH v2 0/2] adv7604: .get_selection support Ulrich Hecht
2015-12-22 14:22 ` Ulrich Hecht
2015-12-22 14:22 ` [PATCH v2 1/2] media: adv7604: implement get_selection Ulrich Hecht
2015-12-22 14:22 ` Ulrich Hecht
2015-12-24 11:42 ` Laurent Pinchart
2015-12-24 11:42 ` Laurent Pinchart
2015-12-22 14:22 ` [PATCH v2 2/2] media: adv7604: update timings on change of input signal Ulrich Hecht
2015-12-22 14:22 ` Ulrich Hecht
2015-12-24 11:47 ` Laurent Pinchart
2015-12-24 11:47 ` Laurent Pinchart
2015-12-24 12:59 ` hverkuil
2015-12-24 12:59 ` hverkuil
2016-01-11 10:22 ` Hans Verkuil [this message]
2016-01-11 10:22 ` Hans Verkuil
2016-01-11 17:04 ` Ulrich Hecht
2016-01-11 17:04 ` Ulrich Hecht
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=56938265.6050803@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=hans.verkuil@cisco.com \
--cc=ian.molton@codethink.co.uk \
--cc=lars@metafoo.de \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=ulrich.hecht+renesas@gmail.com \
--cc=william.towle@codethink.co.uk \
/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.