Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1623646rdb; Tue, 20 Feb 2024 01:43:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVSHPG3ChvzpSdpNH4avqjAnVys9wxydpcy/Av4N8pTPXZAyFmx/ie9z7bcBDnq3kATR2sncTUp0RwEc/Lat5lAz/gsPoaGobSTHvSOoA== X-Google-Smtp-Source: AGHT+IHZ7sMAuK3CYPmP+dFJ2CvZrl7dgQVZKuqPiKaJayJx2UiF/DduN5ZmPT8xrWJ66Hk7h0Re X-Received: by 2002:a17:906:395b:b0:a3c:36ae:6c96 with SMTP id g27-20020a170906395b00b00a3c36ae6c96mr10414099eje.42.1708422227366; Tue, 20 Feb 2024 01:43:47 -0800 (PST) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o18-20020a1709061d5200b00a3e38d536e7si2645996ejh.654.2024.02.20.01.43.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 01:43:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72718-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=lOQdyYKz; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-72718-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72718-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id F05AE1F29980 for ; Tue, 20 Feb 2024 09:43:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2AC33664BF; Tue, 20 Feb 2024 09:40:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="lOQdyYKz" Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2128.outbound.protection.outlook.com [40.107.21.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8552865BBD; Tue, 20 Feb 2024 09:40:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.128 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708422021; cv=fail; b=dcqzSNboZ7U3Rw5TN5W6+7faIu5srbrF9N2RsMfjs17jNX5pmsU95QSs7lk6StVgf9TqR3aGJLnKX+hcUcluyUVBlLLyt1e1+c8SmOHXu1/6Ui8BnUQgpbI1oezeIDK0rISS5Mn1WiZpQq8wnmgwfZiOgU9Ye6/hrwtwGal1BSc= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708422021; c=relaxed/simple; bh=yxvnetxzaHXZbGOMHByLMYoilZ4RD8drlFJrk+JeioI=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=SA90AP1n1MsbEdu7tiNXuCfFdBvcvz1vHl8m0kFmsrZOqtK2Je/DCgq3fQXl4eczlZSbF+Ahq+qDzC7Sf2V9ujERS8AEeJQwZJ0kucuH/2ywN33ZxVVER01CvhKNev3nJgLWo+HzGOzLCa0qZoGSziryLAnfuDuxCtdJcd2O8Xs= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net; spf=pass smtp.mailfrom=wolfvision.net; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b=lOQdyYKz; arc=fail smtp.client-ip=40.107.21.128 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wolfvision.net 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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?B?dmhFTGFDNnREYUUvZVZJMTQ1R2UxRjU0djhKWG9LZkFyTnI1bXdCSXp5RkJ1?= =?utf-8?B?MjAyRWVOOU85S2o0MzhBUlNMOUpsV1RMVkFENXpkZnh6VXJhenlzVjE1Z1Mv?= =?utf-8?B?WWZrYXBXbmFWMmQvVlgvc1lON1lEdVBCK2tYcGpLOWFYZ0UwTWJERlVVUEZ2?= =?utf-8?B?VUdvbWFFZ2xuNnl6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l1bUZYRWt6cHFZQ3QwdHBiYVBkS2ts?= =?utf-8?B?YUF2SDBjaUhEZCtZaXZVZ1dLNW9rbEJZVittR1N1QkpMbmdHZVF4K3RmQ0dI?= =?utf-8?B?R0ZGVVNiOWwvam1rd1JNT3pQRUxHSEJMSzkxQmh3d01jd3RJWmY5MEdpZ1FD?= =?utf-8?B?Z0xIb1FaQUxlVm1QTjR0OWE3UTZxa2Z5S3pLamNTbStRSlRlZmhyczJvc2l6?= =?utf-8?B?b3c9PQ==?= 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 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[] = { -- 2.30.2