From patchwork Thu Nov 3 16:30:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 14994 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp637732wru; Thu, 3 Nov 2022 09:33:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4q88QZEDP+i70tK2Tsju2r/kFbga+miWignTp+OtHBxGFKAcVTTRy0l1mvpMOwKnyzabty X-Received: by 2002:a05:6402:847:b0:453:944a:ba8e with SMTP id b7-20020a056402084700b00453944aba8emr30723525edz.326.1667493234870; Thu, 03 Nov 2022 09:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667493234; cv=none; d=google.com; s=arc-20160816; b=XMF4B2gm7TCRNv5/13gc9JkwyGT+4uZCnJzrE44rp+ZqhIdaCqwD8Afs+bCa4jPDtB gCFIUaHIO1GSH5+reQ83zAWevMjbaPSPaf/fQRXevTp/DrnA2PXeqlMiIARMRGCjByiw LcNleORvLwxtSW2qjmBSVL5oAC0KyY253Jkgtd9uibG8P6l7ef5YfHeG0PiftRAePj4h HoK0ER93QW7wu9LLvDAS+ehpOZpubushaoIKYXYiQrc49syHE63yYV8cRh26wXQiBAmQ TqCdKtASI8OyXx8sH9suIubguyXe/1YUU1BD2eJBOBG6poVacBqmjhVMcu2GwBfk6HyE oJXw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc40-20020a17090716a800b0078d027ceb41si1917189ejc.857.2022.11.03.09.33.28; Thu, 03 Nov 2022 09:33:54 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748493386132340513?= X-GMAIL-MSGID: =?utf-8?q?1748493386132340513?= 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);