Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3566494yba; Mon, 29 Apr 2019 04:55:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZdFdAK0cNqMVVQrMP1LqRUN6JbNehUcP7NB+EXhNXNJc7wDexLw5hxaX4CCG0hjkd/L97 X-Received: by 2002:a62:ed05:: with SMTP id u5mr61227854pfh.63.1556538905653; Mon, 29 Apr 2019 04:55:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556538905; cv=none; d=google.com; s=arc-20160816; b=WPfcNKdBLOuoHsid+CccWUSAhB+KuZ3AUaNmhH3qn4rTb076WjPjAZWLyHDKplsG1M 7aaxfQd3OQ+2/gqRX3i4vUxaUD4KTzGmx8LuHKc1302nUI6+97fge89zf33D+8iaZhD9 sZ9HAB1Ok6LWvtE1nv+LuDj1G6dWdBmvqIvO3UaMp4URT/IEhasuOw0vVZGZrfuxYXUd SRKfjOOWrZZ5zkn/5nXAgyeIMPCDoKvjtrptu7jJILRd/8nuBxm63bKAaCFJBiNdKjNU EIR2reExQgTkVAdmFpXv7K9ms72PuSfRDDb4xtiOzCYGZiU8haA9hobROoe8MDoUxnKf gGjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=IIQPYJIa6SbGgif2ZfepZCnCYqla50Cw7lxLEVL4ulU=; b=SQp5GArT/olUSwW3/8q8622bE9fW06d/sSJm0mDJ8VnEnJNB0N7qxcHAoSoJNlfHSp o7MStr4jq+usNmV+zzk8Cn2PCPdbuw2knTUdtqNVfUWQKzVs9wgkjm3MuW7OH6arExvK OBNhupRk1rumMpBJyZhEAvGdkEoPoZzJa7aRmjEEUfVnMI4m5GB6yuFKojnT5dBQ0h5T YZfVtEtKLTEL1itCRg5Hmu98s/xmi11FtT7YngbXcwOkOB2fPyX9bCfNsh7uRcRx5eYD o4uxUO+tbPSzFZ3/sG7w42Z5BYyt1bLYyLN88nMR5P2HW+ip8UsKfnpeVysJ/ctGvKUh Gglw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f12si30277008pgo.388.2019.04.29.04.54.50; Mon, 29 Apr 2019 04:55:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728094AbfD2Lx2 (ORCPT + 99 others); Mon, 29 Apr 2019 07:53:28 -0400 Received: from lb3-smtp-cloud8.xs4all.net ([194.109.24.29]:40343 "EHLO lb3-smtp-cloud8.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727710AbfD2Lx2 (ORCPT ); Mon, 29 Apr 2019 07:53:28 -0400 Received: from [192.168.2.10] ([46.9.232.72]) by smtp-cloud8.xs4all.net with ESMTPA id L4qYhLvtcb8gSL4qbh8V2m; Mon, 29 Apr 2019 13:53:26 +0200 Subject: Re: [PATCH v11 2/7] cx25840: g_std operation really implements querystd operation To: "Maciej S. Szmigiero" Cc: Michael Krufky , Mauro Carvalho Chehab , Andy Walls , linux-kernel , linux-media@vger.kernel.org References: <9490ba236364690f582815c125b3e5208a4778a2.1556365459.git.mail@maciej.szmigiero.name> <7ae66245-e524-cecd-70dd-be33fe6589d9@xs4all.nl> <2b34d7d0-18b7-d403-4186-6a851c1520eb@maciej.szmigiero.name> From: Hans Verkuil Message-ID: Date: Mon, 29 Apr 2019 13:53:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <2b34d7d0-18b7-d403-4186-6a851c1520eb@maciej.szmigiero.name> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfKwA3S2IxZgjZWfqmKEPeqVdJDrLTFoc8t3n+0oGDJdUfvG37o7dh+28wPdouV7Qpllfaw4miwNPEkRAuGzksRzonSsqzJXDtCAI450oT8nVm4jesbfm jpckwjfiOsQyBabpqpstAzSKDhirsuRe/KwcAMavbQSc3eSO9L0PQ0rsZDqpfM/1c6bheKHDo2PNSdU0T5pQAVAFyJROymusiQAD0cTqb4H1ehJ3LrAU5iQU J5e6KCfD0/xnBHruBv9kX/dFQY+lxMDjagZP9elxWAMk5ffspayKB5FUb9ZAi6FaUBC2hGO5I6l0A8tZZu/okPxkiu9AArmxRV5gibFvc53Cj9YOSEDhjFzi brMnlWhp Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/29/19 1:41 PM, Maciej S. Szmigiero wrote: > On 29.04.2019 10:05, Hans Verkuil wrote: >> On 4/27/19 4:50 PM, Maciej S. Szmigiero wrote: >>> cx25840 driver g_std operation queries the currently detected video signal, >>> however this is what querystd operation should do, so let's rename the >>> handler. >>> >>> None of the existing cx25840 driver users ever called the g_std operation, >>> one of them calls querystd on each of its subdevs but then the result is >>> only used to implement VIDIOC_QUERYSTD (as it should). >>> >>> Signed-off-by: Maciej S. Szmigiero >>> --- >>> drivers/media/i2c/cx25840/cx25840-core.c | 9 +++++---- >>> 1 file changed, 5 insertions(+), 4 deletions(-) >>> >>> diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c >>> index 0bf30222cf93..2bcaf239b0d2 100644 >>> --- a/drivers/media/i2c/cx25840/cx25840-core.c >>> +++ b/drivers/media/i2c/cx25840/cx25840-core.c >>> @@ -1772,7 +1772,7 @@ static int cx25840_s_stream(struct v4l2_subdev *sd, int enable) >>> } >>> >>> /* Query the current detected video format */ >>> -static int cx25840_g_std(struct v4l2_subdev *sd, v4l2_std_id *std) >>> +static int cx25840_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) >>> { >>> struct i2c_client *client = v4l2_get_subdevdata(sd); >>> >>> @@ -1800,8 +1800,9 @@ static int cx25840_g_std(struct v4l2_subdev *sd, v4l2_std_id *std) >>> u32 fmt = (cx25840_read4(client, 0x40c) >> 8) & 0xf; >>> *std = stds[ fmt ]; >>> >>> - v4l_dbg(1, cx25840_debug, client, "g_std fmt = %x, v4l2_std_id = 0x%x\n", >>> - fmt, (unsigned int)stds[ fmt ]); >>> + v4l_dbg(1, cx25840_debug, client, >>> + "querystd fmt = %x, v4l2_std_id = 0x%x\n", >>> + fmt, (unsigned int)stds[fmt]); >>> >>> return 0; >>> } >>> @@ -5081,7 +5082,7 @@ static const struct v4l2_subdev_audio_ops cx25840_audio_ops = { >>> >>> static const struct v4l2_subdev_video_ops cx25840_video_ops = { >>> .s_std = cx25840_s_std, >>> - .g_std = cx25840_g_std, >>> + .querystd = cx25840_querystd, >>> .s_routing = cx25840_s_video_routing, >>> .s_stream = cx25840_s_stream, >>> .g_input_status = cx25840_g_input_status, >>> >> >> Hmm, you are right, g_std really implements querystd. I wondered why this wasn't >> noticed before, and it appears that no bridge driver ever calls the g_std op of the >> cx25840 driver. It's all handled inside the bridge driver itself. >> >> Can you add a new cx25840_g_std() op here that just returns state->std? >> >> That would make much more sense. >> >> You also need to use g_std in patch 6/7 (see my comments there) > > Will do, but a small comment here: > Currently, when somebody passes a set of multiple standards to s_std, > let's say V4L2_STD_ALL the chip isn't configured for "every standard > possible". > > It is set for a specific, single standard from this set of standards. > There is a "if" tree at the begging of set_v4lstd() that implements, > effectively, a list of priorities when selecting a single standard > from a set of multiple. > > That's why I think the incoming standard should be selected upfront > according to this priority list in s_std handler and only this > effective value should be set in state->std so g_std actually > returns what the device is set for. It's not what happens in other i2c drivers (I looked at saa7115 and adv7180), so let's just keep it as-is. I want to keep changes in the cx25840 behavior to a minimum. Regards, Hans > >> Regards, >> >> Hans >> > > Thanks, > Maciej >