Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp669833rwe; Fri, 26 Aug 2022 12:00:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR6ON4mC3BiiGSSBfL7PeIjqb0YSdaK4By1ctoOV+ptNnN52kvIL4y6ye7jx33jyMVMc25/X X-Received: by 2002:a63:9dca:0:b0:429:c235:8b3b with SMTP id i193-20020a639dca000000b00429c2358b3bmr4122534pgd.567.1661540452943; Fri, 26 Aug 2022 12:00:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661540452; cv=none; d=google.com; s=arc-20160816; b=sjbJrpSg4d8pmKHEcSgwg5ciC8JEynKkzvuLALCNYye3dnb/u47vUcNJ1EmpHI+Yca rC1H5q9x2KM7gqDHDh8opOih502k1NYT0KhzhAmBx78MAwHUF1T8rXztz+6BS6k0iHiG lMXlRvxfwmrLg6E8Y8oc3twhPvdaVpzL5mkVQWWm1crC4Z8Q0staDcEugynk3C30Dudd sOiBYrok9shbBEkK+dL1QU/pdiUeqalivVRn8QqIUP9dQlJQyEYrVaAL8i4sjfz59lwK PlYQDW6zt4oe9xdq/eo40xC08QQ2srTHbdEmDP0dq4Axsp4mlPtF57Fy15lAJXzRelOB SWpQ== 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=O8Q+xZr8SG42UTx1FCXTRiee4fNSVZGwOvE7BsdKGW0=; b=ujjG31Kd+gGq+INfqjWTOQ73qJK6JMKmi/M993yAR2HI0oYbRAMVfKYHgwB9D+rOS5 B4kNNOBhtQJWKSiyLW7bDEZm1i03lSPo//OSMWBVzqep5yCv9b6de5Pho6UeN3buCRod QXkHJkFbiQqJ+ybZ7DMbd4eIuugjSCcx+tGjB+7NMJvlA7AdQYrhddO+1MYKhP4IPYzT BZQuaWHG9zREQZhZFakGurikmNOt5N1ATNJF4CCAwTZbzOJcJXOieLT+ab/AQmgLzFAp OgjXokW/G91Z2XzQ3EqqAJz+FYzNah+zjPzLAxx5cQGziW+q2mFh5jrZs8Ceoh15OI39 7khg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=OEZhPzT3; 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 c17-20020a170902849100b0016ee19bc5f9si2035416plo.553.2022.08.26.12.00.39; Fri, 26 Aug 2022 12:00:52 -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=OEZhPzT3; 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 S1344893AbiHZSgD (ORCPT + 99 others); Fri, 26 Aug 2022 14:36:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344810AbiHZSeP (ORCPT ); Fri, 26 Aug 2022 14:34:15 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8BECE68C4; Fri, 26 Aug 2022 11:33:38 -0700 (PDT) Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 421D8FF80E; Fri, 26 Aug 2022 18:33:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1661538817; 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=O8Q+xZr8SG42UTx1FCXTRiee4fNSVZGwOvE7BsdKGW0=; b=OEZhPzT39ZzCHi2xjMQv/iwH5md+hRM0fX9YImu45WBJ4ETwI6k5Oi6nAn0uKDHRi4FZMm cm//LsJwzegM+l95NPX3YLqD58aqZYsZsf7CKiBhRWmbse2oODZv+QGVMX3tTy0URpDeQE p/7G3v2TdJBnsKRCefYhp1GfOy/y7zbsZNfpZqgOiUEHE7Qm2e6WMkkXXcXxVD3gxrvG3p KQzqVZEJYdilYYr34o4xJgZNCTT5vIMY0Dfvlq3ZsYvnhJA2QV5ptm1JbwtWWjENQqW5SF IRw5qDFAvG8YhP2KBnR3ZLydyxPbXyXbsgByOqJdp1/UD3MiiiDljxaamg2L6w== 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 v6 27/43] media: sun6i-csi: Add bridge dimensions and format helpers Date: Fri, 26 Aug 2022 20:32:24 +0200 Message-Id: <20220826183240.604834-28-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220826183240.604834-1-paul.kocialkowski@bootlin.com> References: <20220826183240.604834-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,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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.37.1