Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2484893rbb; Wed, 28 Feb 2024 03:26:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUOgX4pq4Rfjukp7pUwoZwEVErF9CgcVJZvaDocdwQqNB+slST2+OdbAW3DxU/b/jkzXhXhdq55wDYdZfbvKLYCadDWTUcRw30CMyaLKQ== X-Google-Smtp-Source: AGHT+IHrWKLo5Dt5rjnXz/fFhc7NsPtAwxOazRRFCiDSVsdQEg7kVcnVyJZHbEx366NnhWtSV+E9 X-Received: by 2002:a05:620a:3b99:b0:787:9863:f4c0 with SMTP id ye25-20020a05620a3b9900b007879863f4c0mr4323327qkn.51.1709119560340; Wed, 28 Feb 2024 03:26:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709119560; cv=pass; d=google.com; s=arc-20160816; b=vFLvbxRRxlevjSH3ScK1Z1Y0uCZkr383Ac6zWVKNf77J+7EeNMfJ41FY9v/NMeZzz9 vn0LVjaWfNhz60lG54HPv4I50w90xlDyrjXgJ6TFekupH+sC63A5S7rlYCPSNo1FMyTd 2ydPtWPU5Vv2cgprpCmUL6sUB46Ufd3MpCjbLr5kAMNNHoWYsbCXO4UzDwuYvcNZNRlr Uxep3BLS9L3b9Kuxho+J1/qE0lW5tf3+mZPJCL7tBdPwCHpCEotDUXatlP9yI8SJQfI/ Hoz/nUlqfapiK96EXqPbnheKCI3hlRVU/I77lE4tqT+my+D2e68wDzB6nqKJl9yEAGTk iGyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=h00219jPYsz1o91bV8rrkvjsOSJV9yvmcCZF22Gvc4E=; fh=usD7c/zXVdvwr5aGd+Gr6YDbzDGRo1unOi5TAPAaLng=; b=nkgjW+H0rDQNzFaMs6K+oXDYl4eyuZA6je8WCEOkrABxXvib4RVXMEmlo3z50eWHRZ CWwIIMw8WEnUqkzqhzTeLIPtlm0iGaOFgItJ2T1oSXTnG0Dwyx7UOfv5OfsPlZztEZ+w EPBcxhIFsXW2rN2VmtZoB7p6ROfTLnHrObKoKe05hVGs3bfaR+9Q3vzfeQRoGTshbkjs o2RvmsEbPeeWOAE6Of5YnVDYZmTM3ITs9S12UAWPd88FCNvxMwtIXB0AE8kMVQOvBIsW ZsR2EJvwO0vXJxRbxTNxeeqEKdfozrZC0mjBX/MxQG1x0KxCO6q7tz2dnUAcEuNp4QVG RREw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-84876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84876-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id t13-20020a05620a0b0d00b00787ae629248si9182454qkg.316.2024.02.28.03.26.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:26:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-84876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84876-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0BC7E1C22444 for ; Wed, 28 Feb 2024 11:26:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C5F6012FB14; Wed, 28 Feb 2024 11:25:49 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4463512A149; Wed, 28 Feb 2024 11:25:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709119549; cv=none; b=fZV4rcx7V1oH2skxa5e6Y9h0nY712pNHXOIHsRPZZSSaYsdcKQBsumzS4fWg/ZW7zEay3+V3FoqYBYcNdEriVF4pH8I9RDfcLFN6Hxcbhv08ucAljhcH3LOX7pJ/wo/UJ8ctXxx68aoI38UyP47n7sRm6ywfrXt3YcuHTao5LM8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709119549; c=relaxed/simple; bh=ohmwuBlhDPHH8tIibEhU/oAcbkZug7YwDw0TwsvqP6o=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TJopxshdDUA0JaWEho6PMGnPHrFlUgMgE58Re8HdxX0iY/Z9pUBqtVZ++AcG3uulGuS8pUlEq+z78bp++znkciyZetJ2YZQSbJzp810RXdcO1TGJQZTOssQGhRG2yOKmOSQ8XKIgkkZNS366mqFTw5paWMnU97zWER5YJ59kNu0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE6AEC433F1; Wed, 28 Feb 2024 11:25:44 +0000 (UTC) Message-ID: Date: Wed, 28 Feb 2024 12:25:44 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/9] media: v4l2-subdev: Add a pad variant of .query_dv_timings() Content-Language: en-US, nl To: =?UTF-8?Q?Pawe=C5=82_Anikiel?= , airlied@gmail.com, akpm@linux-foundation.org, conor+dt@kernel.org, daniel@ffwll.ch, dinguyen@kernel.org, krzysztof.kozlowski+dt@linaro.org, maarten.lankhorst@linux.intel.com, mchehab@kernel.org, mripard@kernel.org, robh+dt@kernel.org, tzimmermann@suse.de Cc: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, chromeos-krk-upstreaming@google.com, ribalda@chromium.org References: <20240221160215.484151-1-panikiel@google.com> <20240221160215.484151-2-panikiel@google.com> From: Hans Verkuil In-Reply-To: <20240221160215.484151-2-panikiel@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Paweł, On 21/02/2024 17:02, Paweł Anikiel wrote: > Currently, .query_dv_timings() is defined as a video callback without > a pad argument. This is a problem if the subdevice can have different > dv timings for each pad (e.g. a DisplayPort receiver with multiple > virtual channels). > > To solve this, add a pad variant of this callback which includes > the pad number as an argument. So now we have two query_dv_timings ops: one for video ops, and one for pad ops. That's not very maintainable. I would suggest switching all current users of the video op over to the pad op. Regards, Hans > > Signed-off-by: Paweł Anikiel > --- > drivers/media/v4l2-core/v4l2-subdev.c | 11 +++++++++++ > include/media/v4l2-subdev.h | 5 +++++ > 2 files changed, 16 insertions(+) > > diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c > index 4c6198c48dd6..11f865dd19b4 100644 > --- a/drivers/media/v4l2-core/v4l2-subdev.c > +++ b/drivers/media/v4l2-core/v4l2-subdev.c > @@ -389,6 +389,16 @@ static int call_enum_dv_timings(struct v4l2_subdev *sd, > sd->ops->pad->enum_dv_timings(sd, dvt); > } > > +static int call_query_dv_timings(struct v4l2_subdev *sd, unsigned int pad, > + struct v4l2_dv_timings *timings) > +{ > + if (!timings) > + return -EINVAL; > + > + return check_pad(sd, pad) ? : > + sd->ops->pad->query_dv_timings(sd, pad, timings); > +} > + > static int call_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad, > struct v4l2_mbus_config *config) > { > @@ -489,6 +499,7 @@ static const struct v4l2_subdev_pad_ops v4l2_subdev_call_pad_wrappers = { > .set_edid = call_set_edid, > .dv_timings_cap = call_dv_timings_cap, > .enum_dv_timings = call_enum_dv_timings, > + .query_dv_timings = call_query_dv_timings, > .get_frame_desc = call_get_frame_desc, > .get_mbus_config = call_get_mbus_config, > }; > diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h > index a9e6b8146279..dc8963fa5a06 100644 > --- a/include/media/v4l2-subdev.h > +++ b/include/media/v4l2-subdev.h > @@ -797,6 +797,9 @@ struct v4l2_subdev_state { > * @enum_dv_timings: callback for VIDIOC_SUBDEV_ENUM_DV_TIMINGS() ioctl handler > * code. > * > + * @query_dv_timings: same as query_dv_timings() from v4l2_subdev_video_ops, > + * but with additional pad argument. > + * > * @link_validate: used by the media controller code to check if the links > * that belongs to a pipeline can be used for stream. > * > @@ -868,6 +871,8 @@ struct v4l2_subdev_pad_ops { > struct v4l2_dv_timings_cap *cap); > int (*enum_dv_timings)(struct v4l2_subdev *sd, > struct v4l2_enum_dv_timings *timings); > + int (*query_dv_timings)(struct v4l2_subdev *sd, unsigned int pad, > + struct v4l2_dv_timings *timings); > #ifdef CONFIG_MEDIA_CONTROLLER > int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link, > struct v4l2_subdev_format *source_fmt,