Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp662283rwe; Fri, 26 Aug 2022 11:49:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR4uCXdKMuzx+8q0a5pZ8Zv38Q6oxFEiVeFqcphWirYVHaGZsTH0vY+bG//kNALLNKAa3JEg X-Received: by 2002:a17:907:9693:b0:73d:cc84:deb with SMTP id hd19-20020a170907969300b0073dcc840debmr6173108ejc.552.1661539781441; Fri, 26 Aug 2022 11:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661539781; cv=none; d=google.com; s=arc-20160816; b=z9awr7TMXwGIRI7GFY17Qc/iT8sAODoeAw36gVLGiB7Smutom28j3PwaWyj81pqQ1T +JIrb/dVgjk3P7iR/4duLYo/cC/vIpdxvhwf8v9Kf/czy0tuVsy3/46JN5n/fW1+WLYv ftNVCAtqo/7XBo4EgD7LvH8LeBZ+08cUvLzeGn1RUexdv0+SLrW5Sb2hQDl/Zobo9euu UeAmA98KDbLN1XGTK4LNRmwvdcQbPS+GA8o3/AUmiZl1OU3HfW+XBsGR3y5ztGmyihU2 fuh+AvRGZGPJ//LXVIAULS3GtNVePTQqPqqQ9eaFTx79abeqJ+NrVuGIjczI6yDmOLwW DLYg== 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=qrsP2SrWHrsPF1J22BGAy2WeMDihSV0m+9MzapsaXv8=; b=dgurUweoqEiEMNox52qvKANt89v/qLwmNM62FKywVifS8KLGeHQGtFs72TrrJTR51e RCeLLkMm3Y7INSC6ntfO5vINizedi9cJQlfY1yxXYTNV3Tw/S/nGeHxLjUbuf2PF5z+O TUF6SrJNNHQEcUftzGpn9HWxKbJv+CPHiqzc8vbhMkOiaaeFXIoGKisZ6vv59mrpObdB qDJ5w0myWVyhBDGdORpCw/kPmV8TTFRtm8RMuR6tJWV2csW1VfRxucaLxE4Dw+uXvSSs he0xcrkmXp/xmOeOQpZ8X/5CSd8Xugdn8pB+eQpuWU30C4skrBletJASKkYuxcvP9kak Ss9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=iGsz0qJ2; 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 hg5-20020a1709072cc500b007309350f2f9si1552696ejc.555.2022.08.26.11.49.15; Fri, 26 Aug 2022 11:49:41 -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=iGsz0qJ2; 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 S1345059AbiHZSfJ (ORCPT + 99 others); Fri, 26 Aug 2022 14:35:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343791AbiHZSdz (ORCPT ); Fri, 26 Aug 2022 14:33:55 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85BE7E58B7; Fri, 26 Aug 2022 11:33:30 -0700 (PDT) Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id C4457FF807; Fri, 26 Aug 2022 18:33:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1661538809; 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=qrsP2SrWHrsPF1J22BGAy2WeMDihSV0m+9MzapsaXv8=; b=iGsz0qJ2EwVqdlfus8q1c8g4bGq4NPNXbDy7IIUHufJlMdoF9Dp4Y8aXB5Vhq1fucYLR0n UDK8oYiGZaPIm6DAuDOc5phbrNGVUpXzesTzX793k0tykLwjDVDj/3SV+LW5Hgl2O7WpjA OJtqy8uWWVQyFTfXYVeG+pbUmx3jgOG4jnkp5s3pTG/e33yjJLzJb5Ft8Gje1LLbrR5Wln nV0oZztpIM+cH0oktNpZdYd4xz10PVspMBj+X0vnjINMK7sSpzlbsPAwxD0+3QS2FZAYMY wCx3fOxUvScIA7NxqAJcrwFJIvQd45mNmrepW6BI5V8d6e/15/AWZB5zVoregQ== 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 20/43] media: sun6i-csi: Add dimensions and format helpers to capture Date: Fri, 26 Aug 2022 20:32:17 +0200 Message-Id: <20220826183240.604834-21-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, RCVD_IN_MSPIKE_H2,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 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 8bdc876eddc3..f56335cdd477 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.37.1