From patchwork Wed Feb 21 16:02:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pawe=C5=82_Anikiel?= X-Patchwork-Id: 204283 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1130539dyc; Wed, 21 Feb 2024 08:03:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUaKy5t2P0DFWeHDGoAJrktsjzKFusViV+K55xDsYPAc4LWg73hYWGJ7qKBRNOhPMvgzgNquOL/8iXc8RuWkFQxAMymzQ== X-Google-Smtp-Source: AGHT+IGfkWzvzsRD9Sm+4H3GQoXPRZ4UrUidRbMbOsRywhViGdvZzNjeL/A0Zj3lwWsH+t/aVj/P X-Received: by 2002:a05:6602:2110:b0:7c4:3e65:dde with SMTP id x16-20020a056602211000b007c43e650ddemr22413212iox.11.1708531436784; Wed, 21 Feb 2024 08:03:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708531436; cv=pass; d=google.com; s=arc-20160816; b=U4vBjE2c9uObJBs5CMBUC+z0kopUUUAjMOZWqv4q5HWLTVaON5MyDuMNxkMiAC03EZ oNcdSyQ+ik+2cLgrXMkjf990Pu+afRl8DfkCAi3J6+RUybUcD1cQkwOMl5uF5642kKh0 JiAd/olNwQ8XU9mhPL76cZVPUjRms5oXV1l68/Hk4rkh/D2FgAx62oG9pMod+YDMC9yW Bxocje4c/BHqCvnDKSHSgtcKj2zgSOFhGQWMO3hvJLtoic0ooCw4VkhsZAPXDZrKHpNs IkTZbvIS6j6c39BxJIlrtPO8Y9HWXFY75n9WtLoRdhjC84J0KRVshvfWa2BJc9xBykuF ibYQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :in-reply-to:date:dkim-signature; bh=pXMOhwD5qEr4jMu4yu+cDm4xZSeU+k4T71jhjLqjWWI=; fh=XpJcoE0C/IxAbuO1VQuly6gf8orqSAiUZXqYX/AhkDY=; b=eIlQ7FL2/+o1eBOOjl1NQOQdRmHjHiLTzsCo5nIW0v3xT8SRoiZ3Mqs/oBjM3RsX0z lTKuPbRC849cOnwSdgbvTziOrH4g4tzaoSi3OF94xTlq3ZzYYK4BNKC2K2I0QKhrf2Sd 8QgYnOw04d+Nk240jPdqzGMOMV2nZ08KFAgHwfSkDAFgzUsBgEWfG0LfA8Oixb2r/dzk cOttMPdh8sv0Bkrx3/oF0/9XHum1IjS0EASdo9tKfzU1eyPOqbbicB28h9B/YIKK8a9h 2c0heoyRgFDC1O0KXZ9gMu8iMtIQjpqf7N8fBDft6ZsepNIt4jp9V/pFdKIXhfubAsOc GR5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=TC2r+sho; arc=pass (i=1 spf=pass spfdomain=flex--panikiel.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75063-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75063-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 4-20020a6b1504000000b007c484d0304bsi3204195iov.83.2024.02.21.08.03.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 08:03:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75063-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=TC2r+sho; arc=pass (i=1 spf=pass spfdomain=flex--panikiel.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75063-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75063-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D042C28791F for ; Wed, 21 Feb 2024 16:03:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E50EC811E0; Wed, 21 Feb 2024 16:02:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TC2r+sho" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E6A481AAA for ; Wed, 21 Feb 2024 16:02:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708531354; cv=none; b=GehQQlgWBwA0AgpItY+lDTWxRH/yKlyczRi5H8poht0qb1z3R2TgICmmxR52ITJubkd5GnMsFNAeeN/bnQBhdqXLWECtc3vPsLxjNGYiU1u8/J2s4njD9lu+uVsjWK4lQ40DTwnmh0GBGL+oD4cyMwmho0PjRIsmo+Mv8EiiS1k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708531354; c=relaxed/simple; bh=xp1En7WEY2Yy2e9YIWX40hV8+s5QANKt/pakIjV5+QE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ooRhgc+E8SAfNYuMT+TdS3zdz+8nK+3DoheAq/3pN4HSJrx/QaOolpUC40UNsL/gt+JbOuXS/GwaTbjpHyTX9/CCXF0QI2MTSYj1dJ66psGSgo/DgN9O80iZSXyGewz5t80cuRvdslflhO3Xu43dPQdG2kOesiJ3IUM05pwPTco= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--panikiel.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TC2r+sho; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--panikiel.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-608852fc324so12067317b3.2 for ; Wed, 21 Feb 2024 08:02:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708531352; x=1709136152; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=pXMOhwD5qEr4jMu4yu+cDm4xZSeU+k4T71jhjLqjWWI=; b=TC2r+shos3PvnTlGhemWMTI1tAZe6A9zkIbRBTvBK+uoX6/5G9J6oAwL0WH+srdvIW Hjk8JxwAb2MbIYVrD6oj71n5BlpxMH0WeQVaUzRyy19YiJBIf9wKGK174iEOKOevANwu +rGIaRYD4dB/FvwSc4KkHD4XZrAh6lsvisj+AusE+uG1ZFKt0CaJ2+dFL45ur7vsX/yl NRBk/oU+ZWf5g1JUWDFxpf6WG/hzCmH646Qtq0q4bgtRgdXBsGavjis6EQryswkTuvcn lNBFQXc2qC4cXfdDLSCY1jjeMVPIlwwXxalso1iirYnVg+Q06mnVQODCNpQiXb8nCnV6 zOcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708531352; x=1709136152; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=pXMOhwD5qEr4jMu4yu+cDm4xZSeU+k4T71jhjLqjWWI=; b=ZYPrQbBq2O0it1lhuveeMD3wcAmuwPmoSqcNhW7NaF20JA+s8Foz5+1ex4235QTjBx oR7igxIFx+pD4TFzy2SOcoOGHry++ag7jfO5jtsLhShT+s45BkB5UIsK/XtbtYvBqmHl X6bs+oOZChR6SuiXLzRuAxHV2LorLnvbwdzLlIO4kb0lStTvgk8sgPgw+4HCSPgjWwbu AvmNsQOwh1swvNS2SSOwWMeTBny+PcOV7nCbTKb3SzeX+joGNl5b1gqcTMVkfdcwJFVi 38MpF9EsGFN7tFi+GgVQ86J2af+9ey/7YaTyj0zPmDd09qGqXnSK7IbQ2vG8JmmZMDTl pkiQ== X-Forwarded-Encrypted: i=1; AJvYcCVY2sfZVMr1BrUijfznrhWZYVem661We9mwvtTHSK/GdDXe3f39GSTBRj9HgR3OkG0taua6hz7l7F/BAF4LZAGmCHNjmmVnBCbBp1tZ X-Gm-Message-State: AOJu0YxPizUZSQJLZ1QGCweXeSO5Zij4DJM/ssZzA+C8ZUgGnw8FTcAX cfwq0uFrMwKrPb6uRQTX4c4VJ69sWr4eaKo6icgwkYqcmhTAOsPUOGsOa8DtR20kdB4QZ3oSuza +SntJC0K+kQ== X-Received: from szatan.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:2d83]) (user=panikiel job=sendgmr) by 2002:a05:690c:a:b0:608:2104:5c64 with SMTP id bc10-20020a05690c000a00b0060821045c64mr2767809ywb.3.1708531352282; Wed, 21 Feb 2024 08:02:32 -0800 (PST) Date: Wed, 21 Feb 2024 16:02:07 +0000 In-Reply-To: <20240221160215.484151-1-panikiel@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240221160215.484151-1-panikiel@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240221160215.484151-2-panikiel@google.com> Subject: [PATCH v2 1/9] media: v4l2-subdev: Add a pad variant of .query_dv_timings() From: " =?utf-8?q?Pawe=C5=82_Anikiel?= " To: airlied@gmail.com, akpm@linux-foundation.org, conor+dt@kernel.org, daniel@ffwll.ch, dinguyen@kernel.org, hverkuil-cisco@xs4all.nl, 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, " =?utf-8?q?Pawe?= =?utf-8?q?=C5=82_Anikiel?= " X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791525060009751975 X-GMAIL-MSGID: 1791525060009751975 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. 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,