From patchwork Tue Feb 20 09:39:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Riesch X-Patchwork-Id: 13563816 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C5FDBC48BC4 for ; Tue, 20 Feb 2024 09:55:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=4Gene06JBUxukhxRDR4P7K/WwzTwubfFPEe10/Mtad0=; b=hw4XuoQtFWHcuY4eDTeULte0fQ xNduTF5orCCQg7RUekHXYf4XFWLXxnXtprueAqRYatcACW1XDkHH8H249Q7QNzMYaddoZpwQc5FNi XWrrPbYr9FjFmF2OsG0B24bxdX9vHOGOIHHBLkGNU3T6VSU8GJeHMCuzW8dLeBA+BCpVXL27fxsHz JeVJw2Yg3a1RVUakWEJCC1S8zW38f3diNF8EFOaKiSyH5BYTHRaNTz+wchfhVqxB9+zRAEW1LeAu9 mHsVHy3p7UqhS02bTVRJtECWse3VLsuGzv77BvnGCSJJkQTXLvt3wRRMvEK920GC98Q1kCYgvpG/q ZY+d8Ngg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcMq7-0000000E7mH-2zNW; Tue, 20 Feb 2024 09:55:03 +0000 Received: from mail-db5eur01on0717.outbound.protection.outlook.com ([2a01:111:f400:fe02::717] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcMq3-0000000E7kc-4BMM; Tue, 20 Feb 2024 09:55:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Df5jUfft/nsyS6bXWy8D21yO5Y4BP/DKqi47Da0S0hgcogm8OzOQeE5wLF3nkr1EtuaqxxGeHbogbqHJfOXvvxUg/qh5U0jhDR/SCXiYfjwRL+AIfx9Q+4R+YNCtbolXGWY09mM/+JGgUGaIbl7490Jq8yxrd7qMQ4+CEzZsJfAbstliL6oYM5zQKg4BKDPVEijw9MQBXRKZxMHLvpSNM2AmGhLGS9SCYupgW/EyYIi9+N1jR4inkpJkbk00ASwWiKXVE6iCABzGlRhgOVDA4QveQxvL5j/s/xNRmVRP7sdP8DMfonpA9wG4SgQR10MkvEBKSk+mZtNnnGzOPPZKzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EkTvgcGVFEdoJI5SU3mp1RMsMu+o0r2GkRiBHATwNfw=; b=DSPocW5VIBv/GsWA4h005VWtbyC9f+nSiCJd2F86TgnGSdgAwhIDMNjGJLOAG7ViR+KDSewENX7jAq8zVSje4L2sizu4Eoki07gGUdgi5PRFmmlmyaBvn93Zd4fA8VJC7P91znT9BC+4TXkmPNT6KRvbg59tQFnnP9yf96vX4I2I62RsVurxbgI4cnPk/8OgBs1/ldvLc+3jPOcgOo1UBBHElbe3SnNZ+2kLNVo0lEonDmKW5Bqi+9uloZEfGnxHLQJ8O7VbHXvLT17x55tKTLXctH5f6D5YhgQ2r2WBnQjXYZZBFlLj8KNX/HkoXOXnaMT7EoKCuj1n96NS66uUjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EkTvgcGVFEdoJI5SU3mp1RMsMu+o0r2GkRiBHATwNfw=; b=lOQdyYKz9gHGgblkYFhC5+70RhaxgEQxnx401skJXAQVmJnHqHTp4VtfrB56+BICqyp+/vyGzaikZMxPPHnRng6dHo2nZ0SDBo2+RhOIbH/56kAP+hQ0Gq5bIo6ji5i5G2azXE8uBwgq0Mq6guL2ynNwMR0TTCn+mD4rhqhwm6M= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5) by DB9PR08MB6763.eurprd08.prod.outlook.com (2603:10a6:10:2af::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.39; Tue, 20 Feb 2024 09:40:16 +0000 Received: from DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::7409:db60:8209:c9f4]) by DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::7409:db60:8209:c9f4%6]) with mapi id 15.20.7270.043; Tue, 20 Feb 2024 09:40:16 +0000 From: Michael Riesch Date: Tue, 20 Feb 2024 10:39:20 +0100 Subject: [PATCH 10/14] media: rockchip: cif: add variant specific input format list Message-Id: <20240220-v6-8-topic-rk3568-vicap-v1-10-2680a1fa640b@wolfvision.net> References: <20240220-v6-8-topic-rk3568-vicap-v1-0-2680a1fa640b@wolfvision.net> In-Reply-To: <20240220-v6-8-topic-rk3568-vicap-v1-0-2680a1fa640b@wolfvision.net> To: Mehdi Djait , =?utf-8?q?Th=C3=A9o_Lebrun?= , Thomas Petazzoni , Laurent Pinchart , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Sakari Ailus Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Michael Riesch X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708421995; l=12621; i=michael.riesch@wolfvision.net; s=20230803; h=from:subject:message-id; bh=yxvnetxzaHXZbGOMHByLMYoilZ4RD8drlFJrk+JeioI=; b=V/vHX+ML5xC6knGUSZYfu5ybfpeU+hRjnXyhiGjxSe1OzdSYsQESQnCR/cyS2xv2X1AW+jY28 GnwEImC6e0cDmWIzqpV15BA2IvHkAh6bOMk7b70ee1fv++3lWRfyJZY X-Developer-Key: i=michael.riesch@wolfvision.net; a=ed25519; pk=9ral3sulLe95bLcbaiNXTgUTRiBayRBEFZ5OVIEHp+0= X-ClientProxiedBy: VI1PR04CA0128.eurprd04.prod.outlook.com (2603:10a6:803:f0::26) To DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR08MB9155:EE_|DB9PR08MB6763:EE_ X-MS-Office365-Filtering-Correlation-Id: c6f4bfb8-8fe4-4233-1c0f-08dc31f7f1c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tm5u1P1hTgdL+5T/yyzwR1k2Gu0IydJ9pcF/ea0uiDgWQAaT0R/cwxNseCEwHCa1DeRieYHAtGMSY0QV/eM3pd9jcOYj94qtB+zmXu59DP5ongOcqzEi3s5T656nfRu9wBPTIwIMPJeLnFWg2TIzr429vnrd3HMYbi6oDa53DouuRMQX+tRHTI2Z96Nwphhaa5SJ7RfMEEB5OI7XbUHW1ND1p9GAofbocnh8goJ1nrkh2jIAYs+9BWfAUpAGeWmHDQqBwEiRu+/PD15wpO7AWtZLMmVTwvYJlzhwbEpIM7ijB+zy0UBI5eWcfqUm0Ja/3pbgffCCKzDVVteLxdRM/FVoCx2y2llf+V45wXStslQMTMkU9pcUZcnUkD/649oUeFnwJQVuEdjwt6dHtZ/zMkcXL9we01B0HzPcxXpl7fuSe6Xyg5UbhM0ej8kubavHV5MEOo95Tev+p3QJIYtG/XbKg26rCsv+CZscZWGSgkdtHXGBI1k5nLxsp/j7Ft86MffrN+3nimAS/2OPvlyKaVaha2vU93oJwiz+ONS7yOMnY7l49RwH+aphtMYEEsdA5PYtaOztBhAI1SgM1pZO3y6PQmPL/KyBTooD9cLp2d8NIVU5iFXG934oCuEe3hqrA0ctDH0w0XdaLeyCd+dkbg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR08MB9155.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(921011)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?vhELaC6tDaE/eVI145Ge1F54v8JX?= =?utf-8?q?oKfArNr5mwBIzyFBu202EeN9O9Kj438ARSL9JlWTLVAD5zdfxzUrazysV15gS/Yfk?= =?utf-8?q?apWnaV2d/VX/sYN7YDuPB+kXpjK9aXgE0MbDFUUPFvUGomaEgln6yzEgkT0fgtN0O?= =?utf-8?q?2TD10i5k1+yftgbinHnNjH41T0YlTYIdy5L6P+RTkrwXYMh99WkknN5YXWuFYAjuq?= =?utf-8?q?tUz9ZMANYVpHiPxzT/qNAKNrC3Je9RD+wveMX1zstSnaWeU5tnCb+tPFm7XTRHDwp?= =?utf-8?q?8AAJ7ErrKE//bxCeAitcpCGRaBhLzrNdwyz5PNdFIbCdCxy9dLGp9w406rxZHN6d4?= =?utf-8?q?QNVdYXAuDa3HTOMlyypWJq2zNL4EzTRXMKTx0inXv3X6jyTE8ihNqz7dL7KDzo6JS?= =?utf-8?q?Nlf7t1I45BnQaqfFKwn4joCvIx7YQSq1fINx9pptPJXanvh1zLnYf3JPkvFvx0dyj?= =?utf-8?q?ZVUiLxZuFdUKD5SBadn2ePVmAALKpMPtrHXBdoUBjfGUCBtKHBoFSW+ToJQpAceC1?= =?utf-8?q?muyUYwh3Osvk0QVFJ3AG8h5dZ1R2wQDwYWJO2B72A4cy68JzBVWF1hEEjUMVd4Bp/?= =?utf-8?q?Doek8hP9D7bQFhd+s73QaFYkoZ1gEFCa0dzWzbdfn+K/xP6DmV4b7nrvvIZtqv26o?= =?utf-8?q?E9/kFILcJzVqurDcb0VDz1NVNvAmqQ6JG9kTPRUhIJyyOTDLYlU8Q8gkBidFZX8Xt?= =?utf-8?q?8+xF7EFAYaNeuQrNJI6ISyxCECfAbM3gfhyjEoqvSScxcUHmvPkMmnk/1NU8+5/dq?= =?utf-8?q?Obd9qwrQFv+Z0cQX8SzoFypcqRpQLIqndENGTj2JsKhcymtqdfRNA67JPt+ZsG9qB?= =?utf-8?q?1OP2mFEfqsHhpgX3oxU8jcCBVse8S1KfsMZilQ6gvbXa10xiuV9FNkduLAqn5+J2a?= =?utf-8?q?Pdv0CZz1N24dvWNw6gFnYYZo9PgEN1iQwsFKLEwMHE6QSMoFBXETcwaQFt+kzmOhX?= =?utf-8?q?7UAaC9D8zrutFFQZAcCbE/uHHbipTmBtFK0sgRfC7eFnJcXFBu1EIlvz/UlJ8EahY?= =?utf-8?q?EF49Ym4Q62YKZw5Cu5R0wxBsEjdTBY7x/xFsRGPiahAV+5A0gSfrkRKYOsQexO0Ig?= =?utf-8?q?k4JuFLelw8Iog4lePBeIOXfgWeWwqKF7pk7eWEs8F7P+pVXN/v+/WPHyX70pngN4m?= =?utf-8?q?fujRZal1IKtM1XjpF0GS9UtgdTD1plAV+9/HbZ7hvqCIH78KmNor5ujc497ENQYqc?= =?utf-8?q?tSUzSAf8kpa7i30ph+QRvwCIKNCI1nn1DQzZj5qDnEF6CQdeOV9z+KVkqIMTcgm0q?= =?utf-8?q?YLvDGdreVoyIEwh/ef2aoYjy0siw4VEx/AdqBPv2BZxwTbfvHNxosqkPCdAbQQboP?= =?utf-8?q?NVNgWEMLARulM3vuDP1AqnQi2waGRiUheuZgs+XDaqor0RYS6QFloR6cXMS69ZPR8?= =?utf-8?q?x6ruYumFXEkzpqYCt0tpbaPdKklaAvH0ciHDd+YivUgWK5oklBYV+mGSuBJLngGeQ?= =?utf-8?q?x+tfCGHGFFUSb9l/jmkwRMOzPELGHBLK91BhwwMcwtIZf90GigQCgLHoQZALeVmPN?= =?utf-8?q?4t9a7Q6qkfyKzKjcSm+QJTefhrs2osizow=3D=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: c6f4bfb8-8fe4-4233-1c0f-08dc31f7f1c9 X-MS-Exchange-CrossTenant-AuthSource: DU0PR08MB9155.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 09:40:16.3924 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: D+3Yl6jmqvCquXdM2jvf7aWsDaFvT626mT58mi9UlkqkNPJV58I3w0RN1kEZczx6jHfCLTc4VSKdmursbD+/fgSdUhQIDjNJfNtFFfg/Njw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6763 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240220_015500_205100_B10A253F X-CRM114-Status: GOOD ( 12.71 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org The different variants of the Rockchip CIF may feature different input formats. Add a variant specific input format list to account for this. Signed-off-by: Michael Riesch --- drivers/media/platform/rockchip/cif/cif-capture.c | 154 +--------------------- drivers/media/platform/rockchip/cif/cif-common.h | 2 + drivers/media/platform/rockchip/cif/cif-dev.c | 147 +++++++++++++++++++++ 3 files changed, 154 insertions(+), 149 deletions(-) diff --git a/drivers/media/platform/rockchip/cif/cif-capture.c b/drivers/media/platform/rockchip/cif/cif-capture.c index c80a52028a21..b26e6023c2b0 100644 --- a/drivers/media/platform/rockchip/cif/cif-capture.c +++ b/drivers/media/platform/rockchip/cif/cif-capture.c @@ -109,154 +109,10 @@ static struct cif_output_fmt out_fmts[] = { } }; -static const struct cif_input_fmt in_fmts[] = { - { - .mbus_code = MEDIA_BUS_FMT_YUYV8_2X8, - .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | - CIF_FORMAT_YUV_INPUT_ORDER_YUYV, - .fmt_type = CIF_FMT_TYPE_YUV, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_YUYV8_2X8, - .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | - CIF_FORMAT_YUV_INPUT_ORDER_YUYV, - .fmt_type = CIF_FMT_TYPE_YUV, - .field = V4L2_FIELD_INTERLACED, - }, { - .mbus_code = MEDIA_BUS_FMT_YVYU8_2X8, - .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | - CIF_FORMAT_YUV_INPUT_ORDER_YVYU, - .fmt_type = CIF_FMT_TYPE_YUV, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_YVYU8_2X8, - .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | - CIF_FORMAT_YUV_INPUT_ORDER_YVYU, - .fmt_type = CIF_FMT_TYPE_YUV, - .field = V4L2_FIELD_INTERLACED, - }, { - .mbus_code = MEDIA_BUS_FMT_UYVY8_2X8, - .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | - CIF_FORMAT_YUV_INPUT_ORDER_UYVY, - .fmt_type = CIF_FMT_TYPE_YUV, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_UYVY8_2X8, - .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | - CIF_FORMAT_YUV_INPUT_ORDER_UYVY, - .fmt_type = CIF_FMT_TYPE_YUV, - .field = V4L2_FIELD_INTERLACED, - }, { - .mbus_code = MEDIA_BUS_FMT_VYUY8_2X8, - .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | - CIF_FORMAT_YUV_INPUT_ORDER_VYUY, - .fmt_type = CIF_FMT_TYPE_YUV, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_VYUY8_2X8, - .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | - CIF_FORMAT_YUV_INPUT_ORDER_VYUY, - .fmt_type = CIF_FMT_TYPE_YUV, - .field = V4L2_FIELD_INTERLACED, - }, { - .mbus_code = MEDIA_BUS_FMT_SBGGR8_1X8, - .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | - CIF_FORMAT_RAW_DATA_WIDTH_8, - .fmt_type = CIF_FMT_TYPE_RAW, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_SGBRG8_1X8, - .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | - CIF_FORMAT_RAW_DATA_WIDTH_8, - .fmt_type = CIF_FMT_TYPE_RAW, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_SGRBG8_1X8, - .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | - CIF_FORMAT_RAW_DATA_WIDTH_8, - .fmt_type = CIF_FMT_TYPE_RAW, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_SRGGB8_1X8, - .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | - CIF_FORMAT_RAW_DATA_WIDTH_8, - .fmt_type = CIF_FMT_TYPE_RAW, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, - .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | - CIF_FORMAT_RAW_DATA_WIDTH_10, - .fmt_type = CIF_FMT_TYPE_RAW, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_SGBRG10_1X10, - .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | - CIF_FORMAT_RAW_DATA_WIDTH_10, - .fmt_type = CIF_FMT_TYPE_RAW, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_SGRBG10_1X10, - .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | - CIF_FORMAT_RAW_DATA_WIDTH_10, - .fmt_type = CIF_FMT_TYPE_RAW, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_SRGGB10_1X10, - .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | - CIF_FORMAT_RAW_DATA_WIDTH_10, - .fmt_type = CIF_FMT_TYPE_RAW, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_SBGGR12_1X12, - .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | - CIF_FORMAT_RAW_DATA_WIDTH_12, - .fmt_type = CIF_FMT_TYPE_RAW, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_SGBRG12_1X12, - .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | - CIF_FORMAT_RAW_DATA_WIDTH_12, - .fmt_type = CIF_FMT_TYPE_RAW, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_SGRBG12_1X12, - .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | - CIF_FORMAT_RAW_DATA_WIDTH_12, - .fmt_type = CIF_FMT_TYPE_RAW, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_SRGGB12_1X12, - .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | - CIF_FORMAT_RAW_DATA_WIDTH_12, - .fmt_type = CIF_FMT_TYPE_RAW, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_RGB888_1X24, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_Y8_1X8, - .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | - CIF_FORMAT_RAW_DATA_WIDTH_8, - .fmt_type = CIF_FMT_TYPE_RAW, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_Y10_1X10, - .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | - CIF_FORMAT_RAW_DATA_WIDTH_10, - .fmt_type = CIF_FMT_TYPE_RAW, - .field = V4L2_FIELD_NONE, - }, { - .mbus_code = MEDIA_BUS_FMT_Y12_1X12, - .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | - CIF_FORMAT_RAW_DATA_WIDTH_12, - .fmt_type = CIF_FMT_TYPE_RAW, - .field = V4L2_FIELD_NONE, - } -}; - -static const struct -cif_input_fmt *get_input_fmt(struct v4l2_subdev *sd) +static const struct cif_input_fmt *get_input_fmt(struct cif_device *cif_dev, + struct v4l2_subdev *sd) { + const struct cif_input_fmt *in_fmts = cif_dev->match_data->in_fmts; struct v4l2_subdev_format fmt; u32 i; @@ -264,7 +120,7 @@ cif_input_fmt *get_input_fmt(struct v4l2_subdev *sd) fmt.pad = 0; v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt); - for (i = 0; i < ARRAY_SIZE(in_fmts); i++) + for (i = 0; i < cif_dev->match_data->in_fmts_num; i++) if (fmt.format.code == in_fmts[i].mbus_code && fmt.format.field == in_fmts[i].field) return &in_fmts[i]; @@ -550,7 +406,7 @@ static int cif_start_streaming(struct vb2_queue *queue, unsigned int count) sd = cif_dev->remote.sd; - stream->cif_fmt_in = get_input_fmt(cif_dev->remote.sd); + stream->cif_fmt_in = get_input_fmt(cif_dev, sd); if (!stream->cif_fmt_in) goto runtime_put; diff --git a/drivers/media/platform/rockchip/cif/cif-common.h b/drivers/media/platform/rockchip/cif/cif-common.h index ae8fedeadd1c..84a7545422e1 100644 --- a/drivers/media/platform/rockchip/cif/cif-common.h +++ b/drivers/media/platform/rockchip/cif/cif-common.h @@ -97,6 +97,8 @@ static inline struct cif_stream *to_cif_stream(struct video_device *vdev) struct cif_match_data { struct clk_bulk_data *clks; int clks_num; + const struct cif_input_fmt *in_fmts; + int in_fmts_num; void (*grf_dvp_setup)(struct cif_device *cif_dev); }; diff --git a/drivers/media/platform/rockchip/cif/cif-dev.c b/drivers/media/platform/rockchip/cif/cif-dev.c index b75b76508793..fb80e8f8dcab 100644 --- a/drivers/media/platform/rockchip/cif/cif-dev.c +++ b/drivers/media/platform/rockchip/cif/cif-dev.c @@ -132,9 +132,156 @@ static struct clk_bulk_data px30_cif_clks[] = { { .id = "pclk", }, }; +static const struct cif_input_fmt px30_in_fmts[] = { + { + .mbus_code = MEDIA_BUS_FMT_YUYV8_2X8, + .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | + CIF_FORMAT_YUV_INPUT_ORDER_YUYV, + .fmt_type = CIF_FMT_TYPE_YUV, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_YUYV8_2X8, + .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | + CIF_FORMAT_YUV_INPUT_ORDER_YUYV, + .fmt_type = CIF_FMT_TYPE_YUV, + .field = V4L2_FIELD_INTERLACED, + }, { + .mbus_code = MEDIA_BUS_FMT_YVYU8_2X8, + .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | + CIF_FORMAT_YUV_INPUT_ORDER_YVYU, + .fmt_type = CIF_FMT_TYPE_YUV, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_YVYU8_2X8, + .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | + CIF_FORMAT_YUV_INPUT_ORDER_YVYU, + .fmt_type = CIF_FMT_TYPE_YUV, + .field = V4L2_FIELD_INTERLACED, + }, { + .mbus_code = MEDIA_BUS_FMT_UYVY8_2X8, + .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | + CIF_FORMAT_YUV_INPUT_ORDER_UYVY, + .fmt_type = CIF_FMT_TYPE_YUV, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_UYVY8_2X8, + .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | + CIF_FORMAT_YUV_INPUT_ORDER_UYVY, + .fmt_type = CIF_FMT_TYPE_YUV, + .field = V4L2_FIELD_INTERLACED, + }, { + .mbus_code = MEDIA_BUS_FMT_VYUY8_2X8, + .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | + CIF_FORMAT_YUV_INPUT_ORDER_VYUY, + .fmt_type = CIF_FMT_TYPE_YUV, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_VYUY8_2X8, + .dvp_fmt_val = CIF_FORMAT_YUV_INPUT_422 | + CIF_FORMAT_YUV_INPUT_ORDER_VYUY, + .fmt_type = CIF_FMT_TYPE_YUV, + .field = V4L2_FIELD_INTERLACED, + }, { + .mbus_code = MEDIA_BUS_FMT_SBGGR8_1X8, + .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | + CIF_FORMAT_RAW_DATA_WIDTH_8, + .fmt_type = CIF_FMT_TYPE_RAW, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_SGBRG8_1X8, + .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | + CIF_FORMAT_RAW_DATA_WIDTH_8, + .fmt_type = CIF_FMT_TYPE_RAW, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_SGRBG8_1X8, + .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | + CIF_FORMAT_RAW_DATA_WIDTH_8, + .fmt_type = CIF_FMT_TYPE_RAW, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_SRGGB8_1X8, + .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | + CIF_FORMAT_RAW_DATA_WIDTH_8, + .fmt_type = CIF_FMT_TYPE_RAW, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, + .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | + CIF_FORMAT_RAW_DATA_WIDTH_10, + .fmt_type = CIF_FMT_TYPE_RAW, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_SGBRG10_1X10, + .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | + CIF_FORMAT_RAW_DATA_WIDTH_10, + .fmt_type = CIF_FMT_TYPE_RAW, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_SGRBG10_1X10, + .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | + CIF_FORMAT_RAW_DATA_WIDTH_10, + .fmt_type = CIF_FMT_TYPE_RAW, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_SRGGB10_1X10, + .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | + CIF_FORMAT_RAW_DATA_WIDTH_10, + .fmt_type = CIF_FMT_TYPE_RAW, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_SBGGR12_1X12, + .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | + CIF_FORMAT_RAW_DATA_WIDTH_12, + .fmt_type = CIF_FMT_TYPE_RAW, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_SGBRG12_1X12, + .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | + CIF_FORMAT_RAW_DATA_WIDTH_12, + .fmt_type = CIF_FMT_TYPE_RAW, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_SGRBG12_1X12, + .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | + CIF_FORMAT_RAW_DATA_WIDTH_12, + .fmt_type = CIF_FMT_TYPE_RAW, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_SRGGB12_1X12, + .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | + CIF_FORMAT_RAW_DATA_WIDTH_12, + .fmt_type = CIF_FMT_TYPE_RAW, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_RGB888_1X24, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_Y8_1X8, + .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | + CIF_FORMAT_RAW_DATA_WIDTH_8, + .fmt_type = CIF_FMT_TYPE_RAW, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_Y10_1X10, + .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | + CIF_FORMAT_RAW_DATA_WIDTH_10, + .fmt_type = CIF_FMT_TYPE_RAW, + .field = V4L2_FIELD_NONE, + }, { + .mbus_code = MEDIA_BUS_FMT_Y12_1X12, + .dvp_fmt_val = CIF_FORMAT_INPUT_MODE_RAW | + CIF_FORMAT_RAW_DATA_WIDTH_12, + .fmt_type = CIF_FMT_TYPE_RAW, + .field = V4L2_FIELD_NONE, + } +}; + static const struct cif_match_data px30_cif_match_data = { .clks = px30_cif_clks, .clks_num = ARRAY_SIZE(px30_cif_clks), + .in_fmts = px30_in_fmts, + .in_fmts_num = ARRAY_SIZE(px30_in_fmts), }; static const struct of_device_id cif_plat_of_match[] = {