Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1855315rwi; Thu, 3 Nov 2022 09:48:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FVB/bYI9UC5tqLtoUImY7cjxLZzWEkl5/MmtiYQNFALWwSKjyzGnnnIsU+cPmtr06GOR5 X-Received: by 2002:aa7:c9c7:0:b0:463:4eff:a07 with SMTP id i7-20020aa7c9c7000000b004634eff0a07mr23180096edt.88.1667494080427; Thu, 03 Nov 2022 09:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667494080; cv=none; d=google.com; s=arc-20160816; b=QLQZyctklrJsQuFnJd8u8SUkndF0AJ/bYeaoatAl8sUN7cFo8EvbvSMpYuWRRbS6jY RN5Pneo7oWP5XbXrCbsSbkt75GY61XJwnCObdcoXLmkH4KOePI0UDahiOehlYq/8Qwvi tM84jNHjTFYerInSfZ2t4Y0pRvvOyao4veIm2oSfjm5foXTearKweLZ5NFylf5LeVGqt sPW+zpjplZt6j4nBSkfURNG7n4Ri0crCveodmpxnxAQBhZjjhMPIX2/6UuxTLukzfojj 7PwUllumaXENZgF4VcOIEOkrdKEvpCNNhCCnCFzn+z/+WrSAa6bTYtMLdkBJSAzTALDs khVg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DrwwHbobIIX6sa8FRVg9VNOkCqkmUmHNacccQQvVQhY=; b=wn+eMd/S6lttPrR4rnyGvV6QNOxevOuS0/7YgnZdN/dibVYNefKimHoSPS8WbhqOZp btk7fvuDrJ5tJsjD9nYjUftnSwT5fokwOG36ByVhLtpWrMet4uEiwqkdeN4an4N5hf55 l6YNQeGRFgfChKPy5QoA6T1VrtmwGf55IamiKBPisVC6tFJP6WG2jIvI1EAXxaBtzgIE DUx0MDV3YdTkAUt4bOe0EPWE2shesCLQqmclnShXGesX9mz2sC2TI2p4xD8CZNFzXQD4 +yeW5ltGL8x/iQ/2BgZwYE9rk/EXIFGQ30CQPhO7FyvfiA5wxsYxqCh6V5eq23/x8N0y HmeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=LCRKQKXj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne11-20020a1709077b8b00b007918f58458bsi1860630ejc.441.2022.11.03.09.47.36; Thu, 03 Nov 2022 09:48:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=LCRKQKXj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232117AbiKCQc5 (ORCPT + 98 others); Thu, 3 Nov 2022 12:32:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231996AbiKCQbx (ORCPT ); Thu, 3 Nov 2022 12:31:53 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EABE41C430; Thu, 3 Nov 2022 09:31:52 -0700 (PDT) Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id DD400240009; Thu, 3 Nov 2022 16:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1667493111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DrwwHbobIIX6sa8FRVg9VNOkCqkmUmHNacccQQvVQhY=; b=LCRKQKXjPkTmiORm/hqobINl7gHyP593/VfU97RBugMJnF7LUVdMCDcs6e4Gcta5QzxbOL jDy7ozn4aDjk1a/rDyJxs5A7hrnucqZlSZ1ejnyp0uEdySZaAQILE1irSiaodWgtW7f0s0 tAZVOI5FxHyh+X8KTkX+3/YF3/zd2FK/mcEtOLKhr2NhUywZdh/EMIFCy1CvaszMh8jRO4 3WnohUH5/P+G613meSN6FBWU5yDvNo+e9NGZjzm4pvKvIM4rXuOOI9HriRKvU/wi/lwDBP MrQLAoTwRmy8yKOARrE0D3zVg+FjoR+3/h2SJwG+Kt6tjtDHfLPlRW5Oh4X7ow== From: Paul Kocialkowski To: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Cc: Yong Deng , Paul Kocialkowski , Mauro Carvalho Chehab , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Laurent Pinchart , Maxime Ripard , Thomas Petazzoni Subject: [PATCH v7 12/28] media: sun6i-csi: Add bridge dimensions and format helpers Date: Thu, 3 Nov 2022 17:30:57 +0100 Message-Id: <20221103163113.245462-13-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221103163113.245462-1-paul.kocialkowski@bootlin.com> References: <20221103163113.245462-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce new helpers to ease getting information about the bridge. Signed-off-by: Paul Kocialkowski Acked-by: Jernej Skrabec --- .../sunxi/sun6i-csi/sun6i_csi_bridge.c | 20 +++++++++++++++++++ .../sunxi/sun6i-csi/sun6i_csi_bridge.h | 7 +++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.c index cac1b150e544..b98a1e18ddef 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.c @@ -12,6 +12,26 @@ #include "sun6i_csi.h" #include "sun6i_csi_bridge.h" +/* Helpers */ + +void sun6i_csi_bridge_dimensions(struct sun6i_csi_device *csi_dev, + unsigned int *width, unsigned int *height) +{ + if (width) + *width = csi_dev->bridge.mbus_format.width; + if (height) + *height = csi_dev->bridge.mbus_format.height; +} + +void sun6i_csi_bridge_format(struct sun6i_csi_device *csi_dev, + u32 *mbus_code, u32 *field) +{ + if (mbus_code) + *mbus_code = csi_dev->bridge.mbus_format.code; + if (field) + *field = csi_dev->bridge.mbus_format.field; +} + /* Format */ static const u32 sun6i_csi_bridge_mbus_codes[] = { diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.h b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.h index f9bf87bf3667..5e6448aa522f 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.h +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.h @@ -41,6 +41,13 @@ struct sun6i_csi_bridge { struct sun6i_csi_bridge_source source_parallel; }; +/* Helpers */ + +void sun6i_csi_bridge_dimensions(struct sun6i_csi_device *csi_dev, + unsigned int *width, unsigned int *height); +void sun6i_csi_bridge_format(struct sun6i_csi_device *csi_dev, + u32 *mbus_code, u32 *field); + /* Bridge */ int sun6i_csi_bridge_setup(struct sun6i_csi_device *csi_dev); -- 2.38.1