Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1885268rwi; Thu, 3 Nov 2022 10:07:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7BtcfsEGBwaJ4/0Zn3ODMOMcwpbGkC0Czz9/yDZynHZKAaYvlQbVfmtEeDsJ4JxZXPWNl3 X-Received: by 2002:a17:906:fe45:b0:788:15a5:7495 with SMTP id wz5-20020a170906fe4500b0078815a57495mr30357567ejb.633.1667495223573; Thu, 03 Nov 2022 10:07:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667495223; cv=none; d=google.com; s=arc-20160816; b=LnzHg9mhjgMbMac/kz45oOt7GOvi02nv821RzJsdSWuOQRYoEsKS41UTEYJ3ExuGJk QdibMgO7+s1L+7+qQ64Z8WM8XY/u4/og6uFtOa0yb6wQfVpkGWfDnJSz0cNlXGC0T4xT U31zLnH7P0FkdSpkWdcIX+fu60LSPwShZJjE/ePzzDzxsHmtZrvkGMh1NhdVtaZtom1g rEKWAwKuTwHOnXGMJFdelSl2QquK6FJbL1NYwcS3bk2x1XUbGcA0FC0SJAsQTdA5ahJO SEkgZtCv29xtU1nR/JmCP/dsu629eZaUJf/IlNH23hDZRFbPeMU8orj74duItGlOxs4p WB+A== 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=+gjn4CD8PEYxh1M1akgEFv9mvf2oHc+8uaWsRYHxl84=; b=Cq4OvBmgg3/c6l/4MsJZNqyN/SNEk3lP2bOVfrX0YIZ6sE+7e8Fhbug/Eh1IMH0ESe 80FHYshzU95QnMn7AimsBedguKU1WZzegaxB9LJSoHFNj+fYx7uludO52dTEzwxg4EaW QvipYin8uj7TWoP5iovjliFaq3ikCCpKhPaLlJJ6AfQuVoIZXKeGNSnimY/iRVCBxqa2 qhS/bVhcuKhwlnbkHWm2rCXPdytOqOoIS3PUM405n2t2JcUtuPdDDSNeKp2q3nmCs65I C0YaMHcNmz+dgNGbrK4Ydh/Lc0OFj4MU46pzG0GLasgdrhvW7vFtVmbOD4lFJFD0K9+T 6jeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=pvYJQIGx; 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 sc21-20020a1709078a1500b00788361f96a2si2283445ejc.776.2022.11.03.10.06.20; Thu, 03 Nov 2022 10:07:03 -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=pvYJQIGx; 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 S232229AbiKCQcb (ORCPT + 97 others); Thu, 3 Nov 2022 12:32:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231473AbiKCQbl (ORCPT ); Thu, 3 Nov 2022 12:31:41 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C978D1B7A7; Thu, 3 Nov 2022 09:31:40 -0700 (PDT) Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id AD81524000A; Thu, 3 Nov 2022 16:31:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1667493099; 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=+gjn4CD8PEYxh1M1akgEFv9mvf2oHc+8uaWsRYHxl84=; b=pvYJQIGx2QupSCS01wnjgSVt80CjWnBxJARV6C2mVhEly/hkQlJKokvOwrFspvVLH7s57Z jYNvDrssGdPQYP9m7D3JeXvZ3TVwktgIim2pFfR9nrH5ifU1u9yOW8RUMZChTvMHohF+Vz JvwBAK/X8fJ5kXN7YzlrJy5ZInwxXcrZhPN50TFbRVGQU3NxZQfZJ32e2mYVpQa35+sYc3 BnLzXEgYwV3GuxjvpJ/UaIesRZ38+R/fdhySlo/v9iSfLyNA2g9WZE12x+t9ECM/oWy6Do SY9gVsYXIu0gfL6tbvzMIVAx2/4WJO8x5mfwz4MseoHxRjsR9lWHj4HyEm+qdA== 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 05/28] media: sun6i-csi: Add dimensions and format helpers to capture Date: Thu, 3 Nov 2022 17:30:50 +0100 Message-Id: <20221103163113.245462-6-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,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 Define and export useful helpers to access dimensions and pixel format. Signed-off-by: Paul Kocialkowski Acked-by: Jernej Skrabec --- .../sunxi/sun6i-csi/sun6i_csi_capture.c | 19 +++++++++++++++++++ .../sunxi/sun6i-csi/sun6i_csi_capture.h | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c index bdc5465b68a2..a3c3bbf6a506 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c @@ -25,6 +25,25 @@ /* Helpers */ +void sun6i_csi_capture_dimensions(struct sun6i_csi_device *csi_dev, + unsigned int *width, unsigned int *height) +{ + if (width) + *width = csi_dev->capture.format.fmt.pix.width; + if (height) + *height = csi_dev->capture.format.fmt.pix.height; +} + +void sun6i_csi_capture_format(struct sun6i_csi_device *csi_dev, + u32 *pixelformat, u32 *field) +{ + if (pixelformat) + *pixelformat = csi_dev->capture.format.fmt.pix.pixelformat; + + if (field) + *field = csi_dev->capture.format.fmt.pix.field; +} + static struct v4l2_subdev * sun6i_csi_capture_remote_subdev(struct sun6i_csi_capture *capture, u32 *pad) { diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.h b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.h index 7fa66a2af5ec..935f35b7049a 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.h +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.h @@ -37,6 +37,11 @@ struct sun6i_csi_capture { u32 mbus_code; }; +void sun6i_csi_capture_dimensions(struct sun6i_csi_device *csi_dev, + unsigned int *width, unsigned int *height); +void sun6i_csi_capture_format(struct sun6i_csi_device *csi_dev, + u32 *pixelformat, u32 *field); + void sun6i_csi_capture_sync(struct sun6i_csi_device *csi_dev); void sun6i_csi_capture_frame_done(struct sun6i_csi_device *csi_dev); -- 2.38.1