public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Scott Jiang <scott.jiang.linux@gmail.com>
Cc: LMML <linux-media@vger.kernel.org>,
	"uclinux-dist-devel@blackfin.uclinux.org"
	<uclinux-dist-devel@blackfin.uclinux.org>,
	Martin Bugge <marbugge@cisco.com>
Subject: Re: [RFC PATCH 1/3] adv7842: add new video decoder driver.
Date: Mon, 19 Aug 2013 16:52:01 +0200	[thread overview]
Message-ID: <52123111.1050305@xs4all.nl> (raw)
In-Reply-To: <CAHG8p1CqONcw1LqTwNEZOpc_W8pL2rsH68UJRor2UbDb1fJ-Fg@mail.gmail.com>

On 08/16/2013 12:10 PM, Scott Jiang wrote:
>> +
>> +static int adv7842_g_mbus_fmt(struct v4l2_subdev *sd,
>> +                             struct v4l2_mbus_framefmt *fmt)
>> +{
>> +       struct adv7842_state *state = to_state(sd);
>> +
>> +       fmt->width = state->timings.bt.width;
>> +       fmt->height = state->timings.bt.height;
>> +       fmt->code = V4L2_MBUS_FMT_FIXED;
>> +       fmt->field = V4L2_FIELD_NONE;
>> +
>> +       if (state->mode == ADV7842_MODE_SDP) {
>> +               /* SPD block */
>> +               if (!(sdp_read(sd, 0x5A) & 0x01))
>> +                       return -EINVAL;
>> +               fmt->width = 720;
>> +               /* valid signal */
>> +               if (state->norm & V4L2_STD_525_60)
>> +                       fmt->height = 480;
>> +               else
>> +                       fmt->height = 576;
>> +               fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
>> +               return 0;
>> +       }
>> +
> I believe someone use SDP mode to capture 480i instead of 480p.
> I think we can add a table to map adv7842 output setting and v4l format.

The driver as it stands only supports progressive output from the chip, because
that is all we support in our products (interlaced video conferencing? Nah, not
a good idea...).

I don't think I can easily test it (if at all!), so I leave this as an
exercise for the reader.

>> +static int adv7842_s_std(struct v4l2_subdev *sd, v4l2_std_id norm)
>> +{
>> +       struct adv7842_state *state = to_state(sd);
>> +
>> +       v4l2_dbg(1, debug, sd, "%s:\n", __func__);
>> +
>> +       if (state->mode != ADV7842_MODE_SDP)
>> +               return -ENODATA;
>> +
>> +       if (norm & V4L2_STD_ALL) {
>> +               state->norm = norm;
>> +               return 0;
>> +       }
>> +       return -EINVAL;
>> +}
> Why is there no hardware operation?
> 
> if (std == V4L2_STD_NTSC_443)
>                 val = 0x20;
> else if (std == V4L2_STD_PAL_60)
>                 val = 0x10;
> else if (std == V4L2_STD_PAL_Nc)
>                 val = 0x08;
> else if (std == V4L2_STD_PAL_M)
>                 val = 0x04;
> else if (std & V4L2_STD_NTSC)
>                 val = 0x02;
> else if (std & V4L2_STD_PAL)
>                 val = 0x01;
> else if (std & V4L2_STD_SECAM)
>                 val = 0x40;
> else
>                 return -EINVAL;
> /* force the digital core into a specific video standard */
> sdp_write(sd, 0x0, val);
> /* wait 100ms, otherwise color will be lost */
> msleep(100);
> state->std = std;
> return 0;

I checked with Martin Bugge who wrote this and the reason is that apparently forcing
the core to a specific standard will break the querystd functionality.

That said, this can definitely be improved by only forcing the standard when you start
streaming and reverting to the autodetect mode when streaming stops. QUERYSTD can return
-EBUSY when streaming is on.

I would prefer to do this in a separate patch later, though, as this will take some
time to implement and especially test.

Regards,

	Hans

  reply	other threads:[~2013-08-19 14:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-12 13:13 [RFC PATCH 0/3] Add adv7842 and adv7511 drivers Hans Verkuil
2013-08-12 13:13 ` [RFC PATCH 1/3] adv7842: add new video decoder driver Hans Verkuil
2013-08-14  3:10   ` Prabhakar Lad
2013-08-14  6:13     ` Hans Verkuil
2013-08-16 10:10   ` Scott Jiang
2013-08-19 14:52     ` Hans Verkuil [this message]
2013-08-12 13:13 ` [RFC PATCH 2/3] adv7511: add new video encoder Hans Verkuil
2013-08-12 13:13 ` [RFC PATCH 3/3] MAINTAINERS: add entries for adv7511 and adv7842 Hans Verkuil

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=52123111.1050305@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=marbugge@cisco.com \
    --cc=scott.jiang.linux@gmail.com \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    /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