From patchwork Mon Dec 11 09:43:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changhuang Liang X-Patchwork-Id: 176559 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6930242vqy; Mon, 11 Dec 2023 01:43:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEh5XxToS6t205zMeSUBmyUor0eT5gyvYISiUej+Pa6R2Q9+UOqUXnJB06tIBi1v7z0WOCh X-Received: by 2002:a05:6a20:7d8e:b0:18f:c81c:4484 with SMTP id v14-20020a056a207d8e00b0018fc81c4484mr5582376pzj.29.1702287819131; Mon, 11 Dec 2023 01:43:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702287819; cv=none; d=google.com; s=arc-20160816; b=nB/s59AIhnXy/HISMBodD5ISCxBILZz1zcGf9fAeKtdzxP5KB8silNQJw2Ajl0/obM eYuv39dg/sOqXvkO3D3cYAh7p+v0c01oT6f7qOcdSpcStDXqOvooyvQym6UsB8O/Osgf d9Cujeb8grClFlO9UnUqggIyV2CXpQ+hwaxhwy2Dyn+5R2mcP2n130DrDcLXbLjpowLC shV0TynaRP0qXfbvx8msBB1M9YVnpqsKlf72Q2PYn10F2sRrxgbuTA9twjJRpYRntu/L /2+GR9QG/3br3KAiDQHo2mtrtj12rf8r79AoKlrherEcAXybcv2ow+Xvvmeda7L3Enf8 z9VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=J7UD4B9WWNZBHMsJKhVBLdcPBrmjMWHtWHNDRqlglVg=; fh=C6pN6fwecOjWXhJtj8Js0bccT49CAFjcCTt102KN4iM=; b=CvhSif8lntJ/68WCN6KX6jRSwGjSDtk6597d1fooOGOygWZOg+Nt/gLI+0WIACUdOL dd5Wjy4+gpnljlrEAdt75lsk4Ds6dwkk2OPBfTE6V6S+fKb4qRqt/4/vNFHpgHbIFLGN EL/Jlvjimd5dQt7pF7oWZFdxW24BM/+Po+ZbijisZ7xIKzwXJCfBOTsIOEyaNtVIm/Cf WZ6Uhw4mPG7OqLd04GMiBVG1zTVYR+V0l0WP0Kjd+GpmKe1GIEE2FHRJ5s9PYOc6Wo+9 ALzZKAsJfax5CfbInHJHhy+SSISXpraXwj63YlMXpkalDZsh9vxsnTWTQL+lfNGLh62L mFig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id a7-20020a17090a8c0700b00286a073c8e8si7222516pjo.153.2023.12.11.01.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 01:43:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id AD496807745E; Mon, 11 Dec 2023 01:43:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234468AbjLKJn0 convert rfc822-to-8bit (ORCPT + 99 others); Mon, 11 Dec 2023 04:43:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbjLKJnZ (ORCPT ); Mon, 11 Dec 2023 04:43:25 -0500 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 102ABD1; Mon, 11 Dec 2023 01:43:32 -0800 (PST) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id C4AA624DC33; Mon, 11 Dec 2023 17:43:30 +0800 (CST) Received: from EXMBX062.cuchost.com (172.16.6.62) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 11 Dec 2023 17:43:30 +0800 Received: from ubuntu.localdomain (183.27.97.57) by EXMBX062.cuchost.com (172.16.6.62) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 11 Dec 2023 17:43:29 +0800 From: Changhuang Liang To: Maxime Ripard , Mauro Carvalho Chehab CC: Jack Zhu , Changhuang Liang , , Subject: [PATCH v1] media: cadence: csi2rx: Add enum_mbus_code pad ops Date: Mon, 11 Dec 2023 01:43:29 -0800 Message-ID: <20231211094329.9090-1-changhuang.liang@starfivetech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [183.27.97.57] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX062.cuchost.com (172.16.6.62) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 11 Dec 2023 01:43:35 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784978152074216831 X-GMAIL-MSGID: 1784978152074216831 Add enum_mbus_code ioctl so that user space can know what formats are supported to csi2rx. Signed-off-by: Changhuang Liang Reviewed-by: Julien Massot Tested-by: Julien Massot Reviewed-by: Jai Luthra Tested-by: Jai Luthra # [Test on sk-am62a] --- drivers/media/platform/cadence/cdns-csi2rx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c index 889f4fbbafb3..7788ce0e3171 100644 --- a/drivers/media/platform/cadence/cdns-csi2rx.c +++ b/drivers/media/platform/cadence/cdns-csi2rx.c @@ -389,6 +389,18 @@ static int csi2rx_s_stream(struct v4l2_subdev *subdev, int enable) return ret; } +static int csi2rx_enum_mbus_code(struct v4l2_subdev *subdev, + struct v4l2_subdev_state *state, + struct v4l2_subdev_mbus_code_enum *code_enum) +{ + if (code_enum->index >= ARRAY_SIZE(formats)) + return -EINVAL; + + code_enum->code = formats[code_enum->index].code; + + return 0; +} + static int csi2rx_set_fmt(struct v4l2_subdev *subdev, struct v4l2_subdev_state *state, struct v4l2_subdev_format *format) @@ -439,6 +451,7 @@ static int csi2rx_init_cfg(struct v4l2_subdev *subdev, } static const struct v4l2_subdev_pad_ops csi2rx_pad_ops = { + .enum_mbus_code = csi2rx_enum_mbus_code, .get_fmt = v4l2_subdev_get_fmt, .set_fmt = csi2rx_set_fmt, .init_cfg = csi2rx_init_cfg,