From: Hans Verkuil <hverkuil@xs4all.nl>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-media@vger.kernel.org, william.towle@codethink.co.uk,
Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [PATCH 04/14] tw9910: init priv->scale and update standard
Date: Mon, 22 Jun 2015 09:04:58 +0200 [thread overview]
Message-ID: <5587B39A.4050805@xs4all.nl> (raw)
In-Reply-To: <Pine.LNX.4.64.1506211855010.7745@axis700.grange>
On 06/21/2015 07:23 PM, Guennadi Liakhovetski wrote:
> On Mon, 15 Jun 2015, Hans Verkuil wrote:
>
>> From: Hans Verkuil <hans.verkuil@cisco.com>
>>
>> When the standard changes the VACTIVE and VDELAY values need to be updated.
>>
>> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>> ---
>> drivers/media/i2c/soc_camera/tw9910.c | 29 ++++++++++++++++++++++++++++-
>> 1 file changed, 28 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/i2c/soc_camera/tw9910.c b/drivers/media/i2c/soc_camera/tw9910.c
>> index df66417..e939c24 100644
>> --- a/drivers/media/i2c/soc_camera/tw9910.c
>> +++ b/drivers/media/i2c/soc_camera/tw9910.c
>> @@ -510,13 +510,39 @@ static int tw9910_s_std(struct v4l2_subdev *sd, v4l2_std_id norm)
>> {
>> struct i2c_client *client = v4l2_get_subdevdata(sd);
>> struct tw9910_priv *priv = to_tw9910(client);
>> + const unsigned hact = 720;
>> + const unsigned hdelay = 15;
>> + unsigned vact;
>> + unsigned vdelay;
>> + int ret;
>>
>> if (!(norm & (V4L2_STD_NTSC | V4L2_STD_PAL)))
>> return -EINVAL;
>>
>> priv->norm = norm;
>> + if (norm & V4L2_STD_525_60) {
>> + vact = 240;
>> + vdelay = 18;
>> + ret = tw9910_mask_set(client, VVBI, 0x10, 0x10);
>> + } else {
>> + vact = 288;
>> + vdelay = 24;
>> + ret = tw9910_mask_set(client, VVBI, 0x10, 0x00);
>> + }
>> + if (!ret)
>> + ret = i2c_smbus_write_byte_data(client, CROP_HI,
>> + ((vdelay >> 2) & 0xc0) |
>> + ((vact >> 4) & 0x30) |
>> + ((hdelay >> 6) & 0x0c) |
>> + ((hact >> 8) & 0x03));
>
> I personally would find ((x & 0xc0) >> {2,4,6,8}) a bit easier for the
> eyes, but this works as well for me:)
>
>> + if (!ret)
>> + ret = i2c_smbus_write_byte_data(client, VDELAY_LO,
>> + vdelay & 0xff);
>> + if (!ret)
>> + ret = i2c_smbus_write_byte_data(client, VACTIVE_LO,
>> + vact & 0xff);
>>
>> - return 0;
>> + return ret;
>> }
>>
>> #ifdef CONFIG_VIDEO_ADV_DEBUG
>> @@ -820,6 +846,7 @@ static int tw9910_video_probe(struct i2c_client *client)
>> "tw9910 Product ID %0x:%0x\n", id, priv->revision);
>>
>> priv->norm = V4L2_STD_NTSC;
>> + priv->scale = &tw9910_ntsc_scales[0];
>
> Why do you need this? So far everywhere in the code priv->scale is either
> checked or set before use. Don't see why an additional initialisation is
> needed.
If you just start streaming without explicitly setting up formats (which is
allowed), then priv->scale is still NULL.
V4L2 always assumes that there is some initial format configured, and this line
enables that for this driver (NTSC).
Regards,
Hans
>
> Thanks
> Guennadi
>
>>
>> done:
>> tw9910_s_power(&priv->subdev, 0);
>> --
>> 2.1.4
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
next prev parent reply other threads:[~2015-06-22 7:05 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-15 11:33 [PATCH 00/14] Various soc_camera related fixes Hans Verkuil
2015-06-15 11:33 ` [PATCH 01/14] sh-veu: initialize timestamp_flags and copy timestamp info Hans Verkuil
2015-06-21 16:40 ` Guennadi Liakhovetski
2015-06-15 11:33 ` [PATCH 02/14] sh-veu: don't use COLORSPACE_JPEG Hans Verkuil
2015-06-21 16:34 ` Guennadi Liakhovetski
2015-06-15 11:33 ` [PATCH 03/14] tw9910: " Hans Verkuil
2015-06-15 11:33 ` [PATCH 04/14] tw9910: init priv->scale and update standard Hans Verkuil
2015-06-21 17:23 ` Guennadi Liakhovetski
2015-06-22 7:04 ` Hans Verkuil [this message]
2015-06-22 7:21 ` Guennadi Liakhovetski
2015-06-22 7:29 ` Hans Verkuil
2015-07-24 14:06 ` Hans Verkuil
2015-07-26 10:00 ` Guennadi Liakhovetski
2015-07-28 7:41 ` Hans Verkuil
2015-07-28 7:45 ` Guennadi Liakhovetski
2015-06-15 11:33 ` [PATCH 05/14] ak881x: simplify standard checks Hans Verkuil
2015-06-15 11:33 ` [PATCH 06/14] mt9t112: JPEG -> SRGB Hans Verkuil
2015-06-15 11:33 ` [PATCH 07/14] sh_mobile_ceu_camera: fix querycap Hans Verkuil
2015-06-15 11:33 ` [PATCH 08/14] sh_mobile_ceu_camera: set field to FIELD_NONE Hans Verkuil
2015-06-15 11:33 ` [PATCH 09/14] soc_camera: fix enum_input Hans Verkuil
2015-06-15 11:33 ` [PATCH 10/14] soc_camera: fix expbuf support Hans Verkuil
2015-06-15 11:33 ` [PATCH 11/14] soc_camera: compliance fixes Hans Verkuil
2015-06-15 11:33 ` [PATCH 12/14] soc_camera: pass on streamoff error Hans Verkuil
2015-06-15 11:33 ` [PATCH 13/14] soc_camera: always release queue for queue owner Hans Verkuil
2015-06-15 11:33 ` [PATCH 14/14] DocBook/media: fix bad spacing in VIDIOC_EXPBUF 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=5587B39A.4050805@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=g.liakhovetski@gmx.de \
--cc=hans.verkuil@cisco.com \
--cc=linux-media@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox