From patchwork Thu Nov 3 16:30:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 621263 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A060C4332F for ; Thu, 3 Nov 2022 16:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232112AbiKCQcT (ORCPT ); Thu, 3 Nov 2022 12:32:19 -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 Precedence: bulk List-ID: X-Mailing-List: linux-media@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);