From patchwork Tue Dec 20 03:11:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 635546 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 4FA92C001B2 for ; Tue, 20 Dec 2022 03:12:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232957AbiLTDMc (ORCPT ); Mon, 19 Dec 2022 22:12:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbiLTDM3 (ORCPT ); Mon, 19 Dec 2022 22:12:29 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2040.outbound.protection.outlook.com [40.107.15.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CDB92DC0; Mon, 19 Dec 2022 19:12:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VdjuRl1F+8O2CemU+vYtqwnrR7/oj0msCCbkAfxViqAs+nmFUACuPnGrs2Us1TPIw4M8FUJd9EMBHsTpXX3EZNOhhApz4dEFn/NjSDiiarn8eMeahINs9z4lw5ZNsk1i9iL/7XzCLyDXHDjGvag34iE1l53s636QwZ7egIAzrR6IQcEYEg+0MhR9VZd95c3e22tSWvKKuc0buDfVhxgBLDtxnMgFbFd+6sGIcI/EpO/VWbmQQi7at/KhZsaxI3UQLoKcjVIXHSoPxFTjXqTWgt0iJcvwZbJ9Zi701HattxqwWsc6AmevGoFh/M/F9+8DAvJ9G+T6bAA4D4S+/DEvMQ== 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=d2Yx21b0j1MK0Ce6cSenyGIaB1kBCSsck2Aem2dw9Nc=; b=Q8OT2/2Na+ayz+cam14usmAV1GpqnvjhJ0hPyQhR0jUCpbOl5hyb84JXK3K/uRsSlWzDeDrzboSZ8LwIw98G99v94YVfyFCfwkKT+6xuBwmuw+z3gtVCSsaoGJQL1lNbr/FmYbV6Tl8B3bXsfbXgJQfRtaMrXGbMSz4Wz9MdKPhKNmHXAOgr7hC6a71AyC1kR1NnJg3cr3IbdpphY6Ah8ymeEe21F5IhTzhndiX1mbiJoW6RKiPvpjSpFWW7JIy0bSg9QIkAkRfSJCjaU3STVbhNTj/f3rrBRO3PloPeYCocYhGBwhXtr6zJwZOGSYUWKkiO9EiW4WW+t2O46DtHbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d2Yx21b0j1MK0Ce6cSenyGIaB1kBCSsck2Aem2dw9Nc=; b=N1Evrkcwj1fWAM0uYMwuCY8upnYoh/7jEzt+lXu3A0ey7LZyzqWxwDAa9ALr0apb8Yox0wuqwE+lzQhgrR+HGIIlEEMn3GVaPhryWkqvDYIfzWVE02eVCJXYIHCVYbFE7TUBEbqS7eODp+s31pTn3HEakXO1/VDaF+JNBn2K47k= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:24 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:24 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 02/10] media: Add Y012 video format Date: Tue, 20 Dec 2022 11:11:32 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: 7edcfb57-657b-45b8-24b9-08dae23803dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xG/hly2z2jD3b2Vhx4jnLkQn6jSVdmT2CKAFy/ww6YgWMDhRXrfcmIN+JduRFQD7NVmWiOoLirPEhvHYIHUUrEElQO+7vcFekmh6ZrlxPYa+Ro/C2Q6qHajnUWofCTqK+vPPKIkp55y7q9XKhZnYtLJfSfjIHVWfnVa/cJS1L5eQ7ipo7WU3GhHOqOKiNCh1yN4IkVyRa4azn8msnC0UWXRAa/3uCjwhoixW/iKeI3Z51Rka0uE4BXciAgJj289QZP0/UInp4Dkww8hL45T/5r15m7q0chIp3cIpd21+1j4rxBh15AEOgyyPqQsx6LNnMTlykFo6brMv1kuuCbMBkHklzY2o75lGxpWRfttpa7H+CgnhkohStrSU3azTOpx+7hW897KtF12mUh0rZpJy6ywfCvxlobWWel1ICB2QK7ahUGVpo+2XKsufv9IeVf4QjnKOKmyqVii6gR5c+uangNkGOJjZLIeT3e38jqrtZt9deClqnR7uNhEySc75uU0T5utAwuW832CzUcp1jktFrUHsyjCLFkauCzPhAfy3GE4pgfuuzF0CoalAHIvXX09wLKdP5z/s8YQ9elEzOL6Ch9XFR0jr21OPJQ0C3BmXAqxhwvxSgpkbInzabcAgrkC3pKa3w9H6XMZBWENjAs9XGuIH10siUwTVM25iHQOC5FqFUHSxf2UBUGj1LSc91b3N/G4LZCtxc7aRt1NLRdIlSA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB6341.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(6666004)(5660300002)(44832011)(66946007)(41300700001)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(83380400001)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QQ82qs5rSZC5+R7iSi5Ys2puFXjkGRjIRri+tsHp2hCY/axjkjYJYhgY/ELEuI4K9Aw+F+UpbH8f7DU2pUwMUgDyn854bkYLvpKQqo36OsIxEOqQb+rMch8l3drOJi6LPeeXpsI3gzGZsjbWsXc4l8mgNftFuuS9Hbt7oc1ryV9KzTFSREBZLX4Hm3E816SycHOSAqDiQytTDkq0t14/CC9OLSExCAwKHvnZKH5T04njTe/XudBNF3Lxa0HuEdhtQddNDj49/94sH8mK0DmU+Q0unKWmXXMImQ4S01xji6mkrnsIbQ9w2OumCAnNj5BwKqgWNeO05AYAyB8kNk2SLapHX+mseaPFRaSJZDJ60opoGq5ypMa4+mCIvWeCs5UsqsXEIxXZx6tTyu+M9sHDFJJL+OhowbELDu86t0cDUx9bWA0r4DjypJ4NzMTDNYI33swAXZCTxQV8TaBes44H6vNkDVEaTUxZ062uzaF7/HpuaWwvN/5ED/yAmLaT6hFFPVJnQo8hBmBnpNVb0D0nwl0ygyY8uiIMl2ubr/LTxdc8a/jNOST2dhFGvlauDUHOpSeitFoP19C4LhYoFV40tVf/K2nQmxRl7/Auprn2SwukMQTSpsrMqNrQZ0RlUob1Mim7qlDDPgXy/2DuUeeaVEjB0eXqVVzLZ+3NXCMQj3CQqj2+31H5MlOvGvDD9jAD/gD0cQMffacVYlsfa11MMEdAmA0vRYKjcL3iTwy/Fy1VhbUpfPovM0KmOwJpRflSPBpjqi/MnzfFETqcpRFpFA9iPK8CZAwqZ4f0wTr/qMafdcxmICRLwYFGqTRMtisoOAkjUTE3wcPTNQl+4s4N9dCE6omeryVqOyTby92TQsA55OsXQ1T20rjita5K+Op4ws5zEhOQ04maLTwevYEOJTt/PfBAmBNOjjtIlnlBBSt/7sJKztHNdJ8/+Q/Xicc6LKqFkMM5tnPa2DnhZ4CLlAmfbLnyzX+xl0KaWVw6rbCsTukLe97ihNEBK0LpQ8z88nZas6p+EhbCM71hJTQVSshRKDL/So3iSRpumjRJUrt4GwZ6izFtqvpTJF6sXVQ7il1ScDlhJ24q48O7RbcN2qR7NGjZzfCpAO/gRgWJynGlGVL7GckFo/CFWs6R76rWoP34F2rW3gG6AqZIj8ILJL13G1eH7z9mvRWwq8+hCpql7zLzAGbhyFdXoPS/NijhWVaGX1PH0gI7rCC5lqKClkDxj6vqmkMXEGNk/ogIOnx4gxCczgR1Mra35LTYO9R9xwqz6876ZmClfoyOCuwNjQPbzNfE0YXR5g9Q2Fz9SClrNMpQO6uYh2RTQSaWeEEPlhnm1gClccNCjLwdh9jr0X0PF9C/cWKZuMOTTMwRO6NOpGs7BMof/hgvzp4kkKPoXNEqUnwgQyC3UZVKgZLgen5n79Ijo/yIBGO5CmC/+85Qc2Nm/6dwLu+wX+Pob8jYKajOmDFfiY+0FWq4FuOoranOgBZuLMNYCNQ6qOlIyYQl/ofFP6wEwHYZQjY46D5bN1lWMlD/NVRHMhG817SlTNSdlmEYoWq34EUoYFxnVKlJ6Zm448cre8jp8qtXrxKd X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7edcfb57-657b-45b8-24b9-08dae23803dd X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:24.0029 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gK7ZbvyyoUXUnZeK1Hygv+ke0Xv88PMoT1n8U9FI+2e0vxYN+nPdOHkTGgnjxG/ZWMQl0iA8OGhLdAxgF7708Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Y012 is a luma-only formats with 12-bits per pixel, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- .../userspace-api/media/v4l/pixfmt-yuv-luma.rst | 11 +++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 13 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst index 6a387f9df3ba..3ffa29000238 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst @@ -103,6 +103,17 @@ are often referred to as greyscale formats. - ... - ... + * .. _V4L2-PIX-FMT-Y012: + + - ``V4L2_PIX_FMT_Y012`` + - 'Y012' + + - Y'\ :sub:`0`\ [3:0] `0000` + - Y'\ :sub:`0`\ [11:4] + - ... + - ... + - ... + * .. _V4L2-PIX-FMT-Y14: - ``V4L2_PIX_FMT_Y14`` diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 067dbdd0a9ef..0ee730aa6cc7 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1303,6 +1303,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break; case V4L2_PIX_FMT_Y10: descr = "10-bit Greyscale"; break; case V4L2_PIX_FMT_Y12: descr = "12-bit Greyscale"; break; + case V4L2_PIX_FMT_Y012: descr = "12-bit Greyscale"; break; case V4L2_PIX_FMT_Y14: descr = "14-bit Greyscale"; break; case V4L2_PIX_FMT_Y16: descr = "16-bit Greyscale"; break; case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 5448aa3b7858..3d8f89bff33c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -583,6 +583,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ #define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */ +#define V4L2_PIX_FMT_Y012 v4l2_fourcc('Y', '0', '1', '2') /* 12 Greyscale */ #define V4L2_PIX_FMT_Y14 v4l2_fourcc('Y', '1', '4', ' ') /* 14 Greyscale */ #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ #define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ') /* 16 Greyscale BE */ From patchwork Tue Dec 20 03:11:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 635545 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 11E31C4167B for ; Tue, 20 Dec 2022 03:12:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233008AbiLTDM5 (ORCPT ); Mon, 19 Dec 2022 22:12:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233007AbiLTDMv (ORCPT ); Mon, 19 Dec 2022 22:12:51 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2049.outbound.protection.outlook.com [40.107.15.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEA7613D1C; Mon, 19 Dec 2022 19:12:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U5YKTnaijjJHvzQbKtAKmfL1aqMD5xNLPVozRD6bKSDDzzgbf555hyZj5niqjtbjza1/EuM/wVF55Arh4HmhjyTcuUhkzbMuIoMMV26NnTryYPa3qPhFGysVTr1p3Q7cZPN2VyRuvQPfgy5XITnPH0h4VUmnadZxHJs9JDaec4XgXvaFfH++wok5A6cu5hog5ewdBdiFGVmcZGXcKJZnpAZT4qHx/79O8KFwoMq6oQZ8smiaxL/URXqAUpWoYIflLa0lX0fH2ZSmL0sVEoaQNQCqPxtEeCSuvrRddZRpcXMVbwX7s2kbtb4FpFXyeqpzOoxiBAiwoaaxMdiNdwFVEA== 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=/UIH+RRI67kjol9AqivPlGAMCEzoyQR92GRQaOICDhQ=; b=QGuUiew8JVvW+W9TGBMwH0s3w9kS3p0SLD5R9lG8nc5hAmwl2ZudyjUW3uWxHZCmJ8wxJioauJXEzbHq+xGUNHSzCIRrVuQSYCPdof8wC2vK3QvwbXyQAE9u+rD5g8/vcVgA0GhSZFN2BQmswvxuN1Q7XiFkh2yEClA7XndUoomICvJC7cl09Q4wKiU/XyH+WwPHLy50+7OmFXKK13ghUE0p71pbcGXSwIRNZ/np4dg/LOyT2E8u/dGlznzCzUmGUlZzZ1inojhMdR9mm141ojfib4VsB4fL8WN29WcGVBrGZQfGMI5wwehjppjwXQ1pBdPE4jEl1YMrf4xAxjpw7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/UIH+RRI67kjol9AqivPlGAMCEzoyQR92GRQaOICDhQ=; b=QCDncQ+a2+MML84yv0HJFfaBT6bitEZXvb9gRTKZfq/qszqigMhrFYs3QMLw4iMeExZZEF75X1M8VeWEfEmE55l0yOcQ0lNl72Eil2YW70uG7SzUIivZoYgef80HuuKjv+tCBnTKnkTxtAfk1IWz+o/FSEPeu9E9j5YOYHfcbjA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:32 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:32 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 04/10] media: Add Y312 video format Date: Tue, 20 Dec 2022 11:11:34 +0800 Message-Id: <4eb46df4bb84da00560c6c757cd661a1d00e76fb.1671071730.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b521f06-af78-47ba-77ef-08dae23808b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qkEaV+rhwwFMmhbvZ/uYURT/O7mZ0qzpq1E1tYWCxZy7HVPRUNY+h5sEqp9nwNuPzkpoOHX42pU1KCEiBDOF+3PGFxQIORbNf9m/6FWQx0NhWDVdaotlluSQA8uchI2NMpTkwpicmsIMYGC92xMYctZiA7kGzfVBCWZCc6wdqwQBv1TxIYsq9dWp/FwwAA0XtFFVdtcilWa3GHFA+WTRMOhiw8rmCralDgd3b3XUCW5KrTCLevPaGQSqFK2qcnyxh9J2KHhPAXgdYPsBVPHWFIW53b9b7uZmUKdOPgIHFSRgLYZFXrZeqsKnXdKzkVuvcRs7uzL/oNpoiBRCeDyj1jIOqF9nf9WyglYKE2/BSoe7MgNZCVL9UNtpq1bpGxzNcoGXfs4W0gJVY433qo3BMfgIvmcfumPnNKHoVPf+2kjv/qBqYc8lQ1EKq62B0wJDeQbQ+gNqu8hyudx3KOnn9VNq3qh98MOgxQ0oDJncNfBmAaMdyxbgnLa7/tUrxh3y0kUPp19x0tuQib3WPYUTP1tHdSnyNSRJrLzyGccjY/q0iopR5s6ZHaImsQ/3/4LFGq0bFXZRJgxgVERFGYLqwW2fI9sQdfO9qvBFrDRWFoc5+VHW4RdD68siC9bwjxij2KbZqFDLtqT7E2VFF/3pEJ9Fko2DoGcPCEFXl1MdDY5rG+VK9pkyoog6r7dpixoB X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB6341.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(5660300002)(44832011)(66946007)(41300700001)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(83380400001)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KnAuoOLLSJmw/2un7rTK0SNhz90LZnauOCZQEZGzp/qFIWzoga2ypUJGMpqtZh535Vk6c7JEm3T4xrEIxeKvAjZ1MwQyWAwd9XzLCQAUXio6OicslZFnmmB0wrU99UXcuPvmp4w9kb2yqs6hfSdelZ2xeETlDDGz0bmCATrHivfDFC5gkUnsoJ4Xd1iB6tv5I20R391N/OvXaoU2ypuA0bZe6AVJ/due6A6fICKgPXEo9z2rCplH6joD+R/1nniHaY4CDLcTABkQwdQfk1W8/Ng8Wr7az5UNOxRMrVThNPEpmBza2SDp7KgydJaIsXFuJ7Nzz76Gv0zpLTOcnTubfwWpvRcRCXTfzW689RcW0SD1oad0qqikRSGndcdIhX8frlWntunaqOhQUGZ2KJTQE5nrBmHoVd7xPGus68wjDEE1fHpNP+rlXlbXYjsPSW7FqqFIvl3hf6U255AsmaaFC8ZQGp05bJL+4416ghBCHZNx75wNCxdZNJXc8NVxsMb6zLS9Sq8EaIZXo6YDi/I18I20EvyVMv9WMoEANnZvaneuBUMde2g2m5NLRNLy+Vz3xksvy/XDvU1CS3bPVBvkb7ZUeSoFUFP0COg32EzDEzL8yG8BCDW8cKn86ks3RVoXMySWp1kKZgy+94joI+J7VygHtyJ6bj1oiDgXA7AdD3QVWTC7q44yEjZUXe88opv/nfCp00LFvZqMee5RvT8uXGbJqsR4wde5svJxdPvQ1nu/qZC+9lYYXkM0CdtEu9vEubAHlsrsr+su2aLCOXhlaB8EIKxrisYbNmDZm+rxTzp8B0AWTJkdX6ZgTNwc7jmHiq71ICgCdKBmbQAIQB2x/7z5WmABW9Qxh9iW1S4g7PtLi2QWOCn7+YrjkAqBiIVIYeihTX6pbh/LZBnf1ui33w/qHqQbLLg6emzgvLiTihEc/MIsuT0J3uA21lEvsb0B/T01LCKxvdc74OkFqHfIPrTCZwce8RlrNMXpz39wBcH9MShy/esUW+5eWHG1hB7XU/vQpRpeNHu/38/Sa46K8D2ic+YOeWu1h6DYXZfzQR6pMcOko0o7id2QBa1DJ07glxU+4XDb2YyMTk6yWdxia8BSvwrRJXJYIHHe3NMRFdW2Ep7UQi/uAvBeLpYHuIHeyw3GKhOmTSoQNIXhS7/H2MbmRIx3dvJbyeCtJxKp9tPj+sPOjsBw8x+/Lk6YjKLZ5UJrhe7alcXatO8lP8Iqwt6AYmopM1sWxzkHdE4QQ+k+g9/3GsFRaMqxgCxYXB6GPYtRJjrtPi6EGRoh4Miulw4EKKndeiQcl7f3SzNP/ZW+9k+DBN/8Ba1mnIs3mxHiqZB5m2E7olKLwLwhCMCZTP1RhAQaYWryt3KfNVVrihxTSjLpwFdNDIswO/1lVLU7yg/VZGiYRdz+1CBwLYi0cWg8ApgTBuWY+TDFFd3Q79WVD0xGZ52RCvlT2o5PpNRsRjWCJ0XMBst59b26jffCBEfSk8r2uzGYrnDfrxCwmFzH0Fy5b3UQz54eTT560kqyuMNnQjmM4pDyxXRemISsJJTmb3VMYnLo+LKb7goovqHWy7Y6OQXXV/3YAfz+WRqa X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b521f06-af78-47ba-77ef-08dae23808b2 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:31.9868 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IoCDAY/i5fvN+Rc7D9Gr0NqY1xZyVoMyNhzG4l4KzpslG9Iypa20O2fUckDItmjy9oxyXwLOS95GcYB1QN5YcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Y312 is a YUV format with 12-bits per component like YUV24, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- .../media/v4l/pixfmt-packed-yuv.rst | 28 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 31 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst index 39ded0b1e65c..a91c30ba6b73 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst @@ -257,6 +257,34 @@ the second byte and Y'\ :sub:`7-0` in the third byte. - The padding bits contain undefined values that must be ignored by all applications and drivers. +The next lists the packed YUV 4:4:4 formats with more than 8 bits per component. +expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, +arranged in little endian order. storing 1 pixels in 6 bytes. + +.. flat-table:: Packed YUV 4:4:4 Image Formats (more than 8bpc) + :header-rows: 1 + :stub-columns: 0 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + - Byte 9-8 + - Byte 11-10 + + * .. _V4L2-PIX-FMT-Y312: + + - ``V4L2_PIX_FMT_Y312`` + - 'Y312' + + - Y'\ :sub:`0` + - Cb\ :sub:`0` + - Cr\ :sub:`0` + - Y'\ :sub:`1` + - Cb\ :sub:`1` + - Cr\ :sub:`1` 4:2:2 Subsampling ================= diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 21ace56fac04..332d4b11bc1b 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -259,6 +259,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_UYVY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_VYUY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_Y212, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_Y312, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, /* YUV planar formats */ { .format = V4L2_PIX_FMT_NV12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 4d5f722b674a..5b97d7e5dbbf 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1343,6 +1343,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_HI240: descr = "8-bit Dithered RGB (BTTV)"; break; case V4L2_PIX_FMT_M420: descr = "YUV 4:2:0 (M420)"; break; case V4L2_PIX_FMT_Y212: descr = "12-bit Depth YUYV 4:2:2"; break; + case V4L2_PIX_FMT_Y312: descr = "12-bit Depth YUV 4:4:4"; break; case V4L2_PIX_FMT_NV12: descr = "Y/UV 4:2:0"; break; case V4L2_PIX_FMT_NV21: descr = "Y/VU 4:2:0"; break; case V4L2_PIX_FMT_NV16: descr = "Y/UV 4:2:2"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index b8a501dccfa4..3475331737af 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -619,6 +619,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X') /* 32 YUVX-8-8-8-8 */ #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ #define V4L2_PIX_FMT_Y212 v4l2_fourcc('Y', '2', '1', '2') /* 32 YUYV 12-bit per component */ +#define V4L2_PIX_FMT_Y312 v4l2_fourcc('Y', '3', '1', '2') /* 48 YUV 4:4:4 12-bit per component */ /* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ From patchwork Tue Dec 20 03:11:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 635544 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 1BE68C001B2 for ; Tue, 20 Dec 2022 03:13:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233134AbiLTDNk (ORCPT ); Mon, 19 Dec 2022 22:13:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233126AbiLTDNS (ORCPT ); Mon, 19 Dec 2022 22:13:18 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2078.outbound.protection.outlook.com [40.107.15.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B05BE15807; Mon, 19 Dec 2022 19:12:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=digdfR0kSEC+yqpZdV3hLaPsfdZ2GK3jZyGWJkbLRUlsz2tgCjL/7pyK0RdJ93Qy8cAE9ZV0X46wt0UsG63MgcXLhn/GrDW7EdYdfg0ehR223/ha2BbIfZOQd0qrfvo1lY6USPeAv1afh4sNYnE0Pk5x8Xw6KM5+YrkPzsoHM87miI5V3l6wSevcEftF60ZPqUJvMvZLE0MgSRcM+eqaqaYx8upg/3bp+n54tp+TcWrkJiesklrjpDjj9Azc2TLkr0x+D3WuXHJ2D7+Qrklm444bR5AG0TjyuJSPeSwWrLfb/kIsHoxZSdzGzjwNEcpjZpPYF64wBYLZIA4wmQnaVg== 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=/WnNYiad6tygjPwmw3EFwqU6eGmAf/6+8ZRHrgjUCc0=; b=cMTI3VHWwgp06HmRPcn/s8vwAusdgqMTKXfBfb7oDoraTP1qU/UhFcHSpWIhgEEf3aJPheSme1XkP0vlQ9PcMqyZQPIqz8to4OcybGEiCl2E2svrvinzxZtmAozR4lqO7n9J+RoGXbEbywgEKBNmiJJIujbuUSvUHXJb5Ckj6iixInJ8K6a7HLZjZrJ7WY0fqSKC/SaiTkYynAIatfb4YuCmPREdSurzqloZJvYxGY4jWKGQ22OI/lN0HhmYcUDDAIamFOiBWqn2p/7BaPKtuBX2JjBfmRq3O7NyP4CePSbXlDdLUEmbLhrBX/HQSntam2HH5aSmZPo1EZiAQS8j2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/WnNYiad6tygjPwmw3EFwqU6eGmAf/6+8ZRHrgjUCc0=; b=WomW4RqXXu8ZWxOIKoSVYRb6QckUzROP1SlJfEbIjdjok56eYHag8ewvY8nGr/vFmIB6RmWS58AkiKqPywpb/sk7GSfayLDHyZkz6ycgt9pRNuzzKqLGw7zUDQY0rgaI3pa07Y3euAMGK+er1T8K5M6WHrmmwi3OyuQMrKABaa4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:40 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:40 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 06/10] media: Add B412 video format Date: Tue, 20 Dec 2022 11:11:36 +0800 Message-Id: <86983e95cfd05ba9b3b4688e25b58e96ab23d185.1671071730.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: 924bbe90-35ef-4fdd-9198-08dae2380d6d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ueYEZTp1dnATx+210r+1x5bIA6en9cAELuCrlScDH68PJYxDLvXAZdk4obK7LY757iXCjllJ6a59Ar4ishHRkiwL9QBxYBW1gCxD59IH2Q36safvKDqHFwc027ftiTtyEWlzztQbuc4apvmoLI6eOb4oHGj/e1FhDfcH5UsJjIUrX9Au0u5Mwf+zRjsbxIBL1v8/HWbJRPeV/y71bhC6rWkvaWLcEsPLhksBlUN5yFgUlIFHfcNGvqmRq7nSlGbRyCujTe1DQGeJO/aTlHWggkdOxHEYimutAzKsIjr0XgDi/vbCpy8JXzhHmUWhBB/ndgxnMKPYALZI5walbl8gsOIygPty7qiW+q3uZ/z1gYRWhVt344PkvILsS75lEm/Ew0b6O8weJotrEUSZ5h8KVhKLrWXdL8h//DUXWIeTIGZlJqJCq/GOfNBVM+ayk5J5bClGHD/tzDh75MFyi+juYosdjpwIO63u7441mVvvE4R+3p4Kg18p0wuyRmA6KgNRdervJ8/wKlMdRfX680oRB4agzSgAI+m+7NMVA/82pthgy+1m7TFS/rmnRwQl6B/1pGYgouUcCUsr+g/tfgMIUfeiQ66GwcSwkhK2NxHRxc2j/1MhMSm1hU68NODwSJnp6OpSVruiMgmrqZTk2EBaxPn6XEcZAhJMlz7i6Zk3mQ9TYB0srtHc3RotGpJMQWBRueNXt+1ojjkAqlI3FjL0lg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB6341.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(6666004)(5660300002)(44832011)(66946007)(41300700001)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(83380400001)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Rh49TpMVSxzDvW3KY+wkJoUC4HQgiBVuEXfkn3fW8izzUPxEI3c8q01Z3CAouavLf714EW943NFOoS36cQVgBSvmHq2BxpExXzG6TnBGultDyxim8MqybfiBZhri05OM7mhDP9/j9c7G3X17lHPmv22wRF0XF87XWXWIXWoDhft/SNXs/Y7FfVjBaJ9KlhWxA9lL1VSvP5cdbaw1FZNQFs+nlXtnz7ojjndUEw1MU0yhwF2pn+ERJuMV9huTpbIJsPHspAK6epavHG0jv4Z0QfmXe7a/XAtmrhER4eRjoEFAw7wtB6ufC3uiN/U/hC6PHYhpQPHedgcTE8vv/7uwbR5M88+Y5Xi+1fLqzFjFEpFNhS815FS+d0fKSA8r16AIn666R3VwHQ3NipQwZFc0cBIY7/Y7kEFEbyXrLyCXRo/PAqHWJXA/GcYxr9ziJgnN6/je/jHs/Y+6XRZVfuFNWOqu/LCavWGsgB3+znfLHi9nUlISG2VrU88hwMd7ersrB2nSw8+6nE6v9Za+c5eiHavQTFsnZymPDgU8t2UVh5fy2FQWYdIAy84mbtgsZfbU2U4WX0cqK0T0ISoJrsRMSUB5vzMW/BsfMWtwWEQqaPDY+AQSiqBY3Pmn2bahiyLlpsFqponDhsCDMXp5nAOsDQjgf7VdFqhyqWPPSon1Vakmx8NR6vFRg7WbLYnSlS6EsvkRQYXlip4OAm+tMMztn5vEFw3BeQIGbkoIsfxsXqlRK8N0DyGL0WC4U35XtAJqztTABGYW8Ly8w9eCIOtyt5SybZUpN16R4NAnV8DEGcWdP/aH1uIddI4GEvFyAHZh92EPg++bIgBMGIcK+VxNrWM26urY2O6b3Uc5jpcJckPFkJEugDSKHdp5Z6VcO0wKEyDwUh0eoiJOdM75PEOp3jVwuGRZlfQZ+rGeuGEHY+Y2a+TUZ4Mx2hvcP0e+8HHSOJdRy92taMSeb3IxBFp6aLHxC3tpLsQTNqMNSqUWu5EzFfgnu2+erE8HIp7L79ghkk3rRRMVl5Wux5BEptxoBzs0hVJPxPf+jVmhVFbFGUnv05qI3RGHGex3lsymzv02inBusXq3uM94POVi+LZkzOFRWoyGAZpa6xd3OvvhnbnhVgvZeIKF4QkB1ysK29WtI2o584Ff0d0zWqR+fNemypMz3CXLeZExNixQ0Ihy/JDqBI6hJ94tJTLFI0mtUd9V6iAlOwvgiGX4wxthDWpKfMkNFGD4acNJfWI3TWqX3SMLH/ovcAcPxX0T2nQD9IzV6X5fig6v+0o4/F+5g9VmEK1hnAQj122skiqHOS7LKeNO13+K/Ear3I7SzI9aEZHw4TOvknD9wxu8qgLG06o2ucQ1nFBAAbJ+v3xukSwHE9vX5kAWegl9XbzlGDz1FJhVCFT0o9BLdVAGrbkv8jqlG/kjs0VgvVuvaLUJKIKiYZowogzRNBC+KypKdGzZlSm7wmZVPkAIbl8Sr8I6VzGwN/zOeEEnfpRaOWc88wPHiCuPnApmYu8ZVr7faDOir44EYie2ghiHBtDeofmo4QANMz6m8xLaYdxYbPIuP5bpYF3hAU4ndln2N8H52cjuw7+7 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 924bbe90-35ef-4fdd-9198-08dae2380d6d X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:39.9551 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FgqChrCwb+YUy5kWq4Z5UmFsrOOMj5/AbyQUWqhF7gQooPsgv/GhSXB2C5nztT8yvReun9c5urHEuVv95R/ZNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org B412 is a reversed RGB format with alpha channel last, 12 bits per component like ABGR32, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- Documentation/userspace-api/media/v4l/pixfmt-rgb.rst | 9 +++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 12 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst index f7785c93292a..b9d1e48c0224 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst @@ -793,6 +793,15 @@ arranged in little endian order. - G\ :sub:`15-4` - R\ :sub:`15-4` - + * .. _V4L2-PIX-FMT-B412: + + - ``V4L2_PIX_FMT_B412`` + - 'B412' + + - B\ :sub:`15-4` + - G\ :sub:`15-4` + - R\ :sub:`15-4` + - A\ :sub:`15-4` .. raw:: latex diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 0cc58abae562..5384648903a9 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -253,6 +253,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_RGB555, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_BGR666, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_B312, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_B412, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, /* YUV packed formats */ { .format = V4L2_PIX_FMT_YUYV, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 8c3d40d3acf5..8cb21024bd96 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1299,6 +1299,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_RGBA32: descr = "32-bit RGBA 8-8-8-8"; break; case V4L2_PIX_FMT_RGBX32: descr = "32-bit RGBX 8-8-8-8"; break; case V4L2_PIX_FMT_B312: descr = "12-bit Depth BGR"; break; + case V4L2_PIX_FMT_B412: descr = "12-bit Depth BGRA"; break; case V4L2_PIX_FMT_GREY: descr = "8-bit Greyscale"; break; case V4L2_PIX_FMT_Y4: descr = "4-bit Greyscale"; break; case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index c67f895210de..a26ff16a52c8 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -579,6 +579,7 @@ struct v4l2_pix_format { /* RGB formats (6 or 8 bytes per pixel) */ #define V4L2_PIX_FMT_B312 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */ +#define V4L2_PIX_FMT_B412 v4l2_fourcc('B', '4', '1', '2') /* 64 BGRA 12-bit per component */ /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ From patchwork Tue Dec 20 03:11:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 635543 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 320FAC4167B for ; Tue, 20 Dec 2022 03:14:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233006AbiLTDOW (ORCPT ); Mon, 19 Dec 2022 22:14:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233033AbiLTDN4 (ORCPT ); Mon, 19 Dec 2022 22:13:56 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2078.outbound.protection.outlook.com [40.107.15.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57839140FA; Mon, 19 Dec 2022 19:13:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dje3pO7Ux749KirwSq03wfZLA+DO0xyTjm222+CicYINSmvkGnQuNZE/eI4cF7Xocs7sarcg7ukY4KViQi/vs9XLeEv/88LoGngY7TRNrxPCTayWRQH/v7+Z5bzi4a5bastwChu8nyhty5ogDP+8MFW4CtJaxwOmcvE65AIVFi7xiaZEaNnBjFZnt+HB/U/pb/r2r3gYQ3IpRZ9v8J7FHXfDcL5KR0u0CuIQ7NvtQZZwaeaG+88McJtamKih4t7amUG6aXtCfvoRPn3yKfG49mfwu8J6awbC7kjz7hPA0V02N6hek2gZiXT7/SSK9mFecKpgJDo82S6K06WUFyFZOw== 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=9h8uKZQTfzm8jvmCuYuAAtG0YH8HMxtyA0Tm6yFmwWk=; b=ZqL9bI5GlD760PiPuzBHxTkN+5TieOKLaqkZkacIFO1s2eT6EOpyUCTsn6mjv02wiVeOLoOv7IzcYwh0vVC4DeMQ4qdSzKPgUyfINYXZeo3Ym7yhuexO+WWZ6mD5fzt+p5wNtv0sJxVw2C3jPmnBkZCR+Wwm8Y27btobFbnQwL5x1oRC0QCAjUb0j65u2TfPtH75i2wla8krYg2Z30OB8ZLC4bR4cY3W3lljig5H8/fi1IX++yfKOUijvlkSmy/ZZgWx+3zwHoOK/i8/XzmjxKAHcS37+UBBB85hLH+R9tWMeUal4GYCnmGN4iJBRbClW/Ww+jYIp7WOW45iFz/zUQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9h8uKZQTfzm8jvmCuYuAAtG0YH8HMxtyA0Tm6yFmwWk=; b=XPwA9VPLi8A+4HxQV871BMcZw5t50HFDPQ9Xpl6SmBdMNRpWYkJqBFYsi5J4gukqi6f+DgB+8BUIonUtTfdj/44FE0Qzacds89s5AivyUOyeBlzwKrz05sm+DCEOANDz0WrIxqsaATulZNCxdqqZZ86hI1A2cJpewoCfxgHrEJ4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:48 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:48 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 08/10] media: imx-jpeg: Clear slot next desc ptr if config error Date: Tue, 20 Dec 2022 11:11:38 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: f237a628-5683-481e-ab50-08dae2381228 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rh9P4ULE6snb25bnfwZgB3GoIMADpG+1KJceAnr8GI1gLsGEE3f7VCcc3CcSUlvT7bfdhboFr/XEgRmiU23L1XdgafHDEXLpLHUw1TEutAfUWQAWmjYSOnZHzuA0HTc4TUWVeQMo869V+VWK4GKRnxMOED7b9+xNTt5AUX4KzqN+K2sD6aBtE8BAn+JfWYJX/OoWUO98hQOHVd3nta+tL3+tYWyZ+JbyqLXXpkvfWikdsO2720owEOlkili2bKava8tGrS6ZUoOl4wnkJ/29sd9Vbhm3u8ODieeQUWiwmetT9xyaGn35XfkATDWZF5ImDfhL/zjHqwysBNfkrR+rwnOgJ+H2SnxMxRuF835LzfBpVfVWula0/lCBbaaaM9mx+ZMg0wIeA99d/n6PbodriXlxNkyzZn6UR1PISKyHmq37dueDvv0QTBxm4dhp1YwKfSiVFEJUG8KEqv5wkfP0qtsz3R7/09DuuKOZQcgRh/1oymFcB4NsGpirPlGexQ3gbdOTiP4HBxkDI62Nkwnod7IAmyig0f+ETtULl0S/tSX+N6bCjGnpw1yxZGnX+uiZMWT2ou6Y5vN5Dr6ukwE9fkBQw8K3uYAw8ijTDlI1WAF/lxUvZzYP9+Ra54WWDNZFX6KD0YFqnOEp8CBqp6daYUTlIRYYFMxuP3gD9RcK7cD/hdhiXHWdoypZnKkJkunA6ZgUyPyCloRh5+FQjiT7qw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB6341.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(6666004)(5660300002)(44832011)(66946007)(41300700001)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2TuSKkFiqMULsHju4dekT8KZydnTkSPsp7H4ZNVI5BL52MHu/6z9SCjn5ksNx0M28oj7poKi4kg9hb66Kyn+f10SuJsoltc5+OotDC59nT3+8SnSrnTRTuYreHS1v4NbgHOY8FgSc+dR1EHfbWjNYIRE6hQbi5WWU7FdYcXxSCIPNejk8XYZ1sO5AKO7bPUGKPU0xzpfW1vP1urEe4IYSFcGICzHpxAdSgbR8uiHJJWQYky3hwbgEVn8mEFIhPNQWM/rPupWK9XwhZDrCtnmDv91/iojH8T3++i29dsg8oTkHzzHVy2x6o/SKl3yqeXOuafY5bGbepuRmKhVVzxiufp5tU8gnXkpgUn+lcMGekU4EIumiw90v+nZx0kdP9u4AXzV8ZHMYtu+M69bDZP1t8qRxG9M+jJhaMH3ETtMyZXRlEA2I1Nx+yy44oz1RXFjlManBjVaf1W9hJANMGp9rUrpiV/5OqGia5HGPxFCO8sDzB5rESE70WNh8ugvLQzUA7FUB63lzxQ6IsQfTQgUwdKDPTPPC1sJKPbjNz2JM9OZlLk3wHESAimQqDSKE0k6KDA04n63rHpmQJBKKApoTyU7YgVkgA5zrnn7+0D99//3ycC8hbQ0m6NbzMcl8GF+3hMY8ooWFu7M6mcjZ+wOvX/rRP+oOVaidbVEgS+tng7Tcx/KNbSZOPDJPYFtZIU72oTq3yELt5IDeZ55h8y1Sxxks8jQz0Vd0zTesmJTEcMGhNzqIDdsM/x23iAK6FBuY5s6y01AXbutvQeqEB0vsg1q3z2nk5+IxwWhXzsGHBwhOkekgNgLhl5gcnAarfoZcQePcAalzsbEQVvKyICS76EfAKMVbE8+mYi9MVd4bh54YKwXRAvVuvwoRVuhvgmZDistzqu51GCBSXTEliLBtjac97YVMLb8OO6fXf1zcUCuEg+4+QWLMdHh0KWmwns2Ash4ZsaOIMQwW75gsd2vkbzlqYJG32SRpS9YC/UAc/0P+uCnHDaweylG7EayUhZd4kaPEB7d/q8HoiJRn15/BDaBhd59vJVeIqNIqdOeaALa2gwkUQt34VSckzS5KltSRhus40eNf23B+Cvdrdmt/mY27hPAHjsiiyWLdHsYnfbozB9G+pAD28NhxW4QHNlQiNBG57Wf3RwVDW0EEI/Wen2TyLuuBTmsfs5UHddWq7ibv6igMjBFQIOtzPY5ZHNYWDBww1zYTDAMFQBw/3HZ/teWAcRfLVAZGUXFGP4zFHSQTPyUaUVKK6FM//tqAX8A0XMOySA9UT2VV0EjsVFpdzmEEBCBNQOBHZ93B78u4YgKy5EX9oxmp1ClPB1zH+XB5aKDgor2Z+UM2jk3U717XuN5I2IILWqtuI2je72OkMGIk6akqklALAABtb/P16aBIf04Ng+Lp8YqYyMuvawgi7ud+CyMJ6mCKO15mw5ZnzPwWfb27+/VH1qwPWj1O1YOZz4GJvvSGa4T3IisQlsRc9Fd+H9en0fS/1NdeHANzGiiTg88+6uIrafv5qbNgzQSvEZ9qRVq7FIzApwg+26faKfXd1RyQ2BCe+h8Uto3BKPY20EMeihlTaJA2TC9lNW7 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f237a628-5683-481e-ab50-08dae2381228 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:48.0484 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YnmjyCfisowG5MJY9HMrjqHWmuSLBEDRDhMsseGd8rW06p2XMd9GzO/O6tCiRNrawzpO2amNGMoa8bsDJhxjzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org clear slot next desc ptr if config error, otherwise codec will report config error interrupt repeatedly, it may led to system hang. Signed-off-by: Ming Qian --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c | 5 +++++ drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h | 1 + drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 1 + 3 files changed, 7 insertions(+) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c index ef28122a5ed4..bbd5d6a9fc86 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c @@ -178,3 +178,8 @@ void mxc_jpeg_set_desc(u32 desc, void __iomem *reg, int slot) writel(desc | MXC_NXT_DESCPT_EN, reg + MXC_SLOT_OFFSET(slot, SLOT_NXT_DESCPT_PTR)); } + +void mxc_jpeg_clr_desc(void __iomem *reg, int slot) +{ + writel(0, reg + MXC_SLOT_OFFSET(slot, SLOT_NXT_DESCPT_PTR)); +} diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h index ecf3b6562ba2..8b7cd6526efd 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h @@ -137,6 +137,7 @@ void mxc_jpeg_set_bufsize(struct mxc_jpeg_desc *desc, u32 bufsize); void mxc_jpeg_set_res(struct mxc_jpeg_desc *desc, u16 w, u16 h); void mxc_jpeg_set_line_pitch(struct mxc_jpeg_desc *desc, u32 line_pitch); void mxc_jpeg_set_desc(u32 desc, void __iomem *reg, int slot); +void mxc_jpeg_clr_desc(void __iomem *reg, int slot); void mxc_jpeg_set_regs_from_desc(struct mxc_jpeg_desc *desc, void __iomem *reg); #endif diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index 97e61e28c649..7c3ad1ee4769 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -692,6 +692,7 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) u32 ret = readl(reg + CAST_STATUS12); dev_err(dev, "Encoder/decoder error, status=0x%08x", ret); + mxc_jpeg_clr_desc(reg, slot); mxc_jpeg_sw_reset(reg); buf_state = VB2_BUF_STATE_ERROR; goto buffers_done; From patchwork Tue Dec 20 03:11:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 635542 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 88628C4167B for ; Tue, 20 Dec 2022 03:14:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233204AbiLTDOw (ORCPT ); Mon, 19 Dec 2022 22:14:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbiLTDOP (ORCPT ); Mon, 19 Dec 2022 22:14:15 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2078.outbound.protection.outlook.com [40.107.15.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4B3D13F3A; Mon, 19 Dec 2022 19:13:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dCN9geygqwDJH7S5iqlTF0Zs0E5KG5itLScOoaRYpz1q97CCBaY4SK1XsF2klCXUH6V6Dh9rCIZNt9kinZ+EORndu7Ew4KzIZJ5oS1RxQkfwlJfPeFCSs06b7moikhMnMDAXBjkE7rdrrX9oCh9oosYAoW86dbYabGeMO8NhbxVuLwRNDWgN56iJHpvfJLZLlT26jegqtpzy6yUZvyiVl5fXKHleJfVtFS4If1VFq6tNjKA6YLsALv30rWUKtcbxiLRiatMXtqIRLd1uEVQrnDytgZByAPO4EBKYqWyRnsLmO5C7iG3Q1tTrZZO+TPAG63aXl4d/pM8EG2MAIatMUQ== 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=fXsCemDqwU/BGmmJxJFcHJwkpFGICbPOawFu8XCOI0Q=; b=DJYEtyenD+8IWTFglCjRSbkqF0BuX3jKCEWIXI0guI/9ygIo9l9cxuynUmDrjP/IGnePfDkqiuG1H6pwagXop6XMOFBGs8FaS4iWxW2oMnqYWW5465MCTYXCX4DgSv6zAz23MY2W8woJkCqnOq24HKEVv/OnuSSzxV4+RiufJVY6EC+nsbZFAJWfEYjTTO4OJNQxZ9HhOvQ4cZHLTl+YtztqG5Y/qSkiC89wx8ah1R2GSxNnxhRybn26/OYJAq9PPxfrjT5PlHdCFGmj80bz9nf39r0pi00O7/sAAt7+fVyEENPRNyu0aATq3MU63pIYhhKKRpbA2nCspo2T4obLzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fXsCemDqwU/BGmmJxJFcHJwkpFGICbPOawFu8XCOI0Q=; b=Xk9aqCmInH56jyfxJnr0zQ6L739AB0j2xQKJlgwtanowlhJlee1PQB+nbe5Of9IGhpCAumd8cWgNKfi61ySMIHLk3hBo5Ctp6dBmZs8mpKiONd31E7mNvz29YV+rwknPOxmBvFW72JHL6u7BRv2abyEPB9RSDiwbfwRc4YsLcvw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:56 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:56 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 10/10] media: imx-jpeg: Encoder add support for 12bit jpeg Date: Tue, 20 Dec 2022 11:11:40 +0800 Message-Id: <70d70246c065448766bb8d9a8e11d7e66497a042.1671071730.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: 0aeca902-d792-4bb8-c314-08dae2381702 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j605DDJf98UcJQHJlhCUnm0ebrTC21sSgXLAtSrZsJAGrSbnyMbX48+kHZKxAsroUuwP5BCJfFc/275G86TC3Qa59juFtMhTOF3a9mWht0UfgNd7zViiip9h0JdbFbz8dywrSbgfiTNg8yC55sJsgQWA/mn8sPbJJDLxw6lv1y77yD1t/XEbuL/YEkRlDnNZdOlHRknifDP524cp/cskU4dGSYIFK/av5rDHRN0eJ2HmmvWH9gy0V+MNiCT/Et31WoIUc11Q8ErtPA3AE4z6+XjstdgwhQ7IIgKL7vglfc594K3s/SqzlLt8VHhWvGaFpHPGhGFruzkyLrlmk+gzgqGIKLCob0JQwVmVKOIgt4ygX62fQ0pLVhgWmyjenPX1QchqBjbfvvO3Np1qAhg3mxDZDiQSlssmcbVNRxhLIP1gcJvMF9ZBjK3HC5vqGLT/R5mNyvlGYfvcDcBf++8jd/7GWNlTxy5ThpIglZimVbqLx7tmE+rwSCjIobaj4N9ER9eDSQF8d9TtCOyctdAh/9424+zh7+yPnGtRypb93okG8jBaY2nMPwR4k09WoA+hqxDe116qhX6KwJDXImPQ1I77m/c+uawHECCkZmHoClwSxniFMs1ShXwcN6VICi7JPsXyQ4wgBoZW4NGWlDdNk/w3mM7Qvd+Fpv3R/LzPH+FlCvJ36h661YBfmqx9Ughuzp3cWSJb3I00GabHz1VKVA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB6341.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(6666004)(5660300002)(44832011)(66946007)(41300700001)(30864003)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(83380400001)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DermT1WU/1uxo9pk2Oz8QcPA+k8C/BBL4bikC9YIj2/ImAsS2ZWtnH6MyAcrotRSvK9XeHaYGLX2osA71Zobaudzvpz2Zo6OekzHbLIZuZ2cajuYELFgjxnwOBz0xk5tuLsRhmX6xTyCzEZdovca+WaIxMDlqeWAY7fRo9gDay8xCuyxZoE311IW/fwsWLva9rVfdZYRHYj8tottezhlWEy6VgKXvc+MYxPAsH7mV6B8hU6/rJXCZJE26kvCI4TTgxsNGvw1voCsN7he8ofJeDORzg5/JNpPEb34Dam9Ci+oNSdpdfAOXFPQscO9X1Ja12fF7lXjTi/uhwLqR2qwrY3UWUd9h/uTg1UccWr+NI2oFKPX6UuSM7ov/EOg8mqO0d40UuzOt/Nykz1bTPl6yq3pRDpz5W3dKBvo84uyqVAyOLP664d3oj6WjiQrX86RpbgUqQbxvUefJguHNKs1JRbCHZsrtOdEHE87venhr2rl2QtZaGh3eLCl0MBM10XPiBpezylomrawugDl5UwBfNYPXCGPXOKBo89KiavWfXLimtyqW22JZdqPD899Jv55tqfB14TnP8gbAOnaR1x0WnbvlXNAfkPkU5VU/S+uqvtJHcF5Pq3YYh5LAONBJCfz8gTP0dkiq65DIXDnrsYCVjWVn0xTpyjuLvfFjTuCjgCuLzvW3HCJUv7OfrqYv2D9pa4WVoUNtkWstlz/JFKDLvz7CEM/s2F/dr5d4lEFQ4QPX9zOnhuEd4NPRBzst4heAxuAItQPSegxRpZFlWDJSvfIeXsz6KXgDthOUKE5jCkKDXMPAnwqdFGah3VEt+Dfl6iRiRz9sLfiB8NmsSzXNk8zX+m/n9a54sQkc2vuKXMRjSqgYR05Ub5cfTiXJSyN+RNOR4stKviuY33BBnZLNCNCjFad3oGmuwZvYCeBybzNnKKzXZPDuNk+/Pup8RnU+7Eyq8Hnpr0o0qfZZGXKX+t2m78VD3ywz5LocTpWNibhsCCTE3x0u6HuGGXgjXoLJDq6WO8HNNCMIHi/JoLXmHpDJJV2fhpxzT/AyHS5VUUIPDnO46UFMImOkje/09CrHCcz+J68jwlYCdbt80Ois9exLNh1UV5fYtFi86w3nLYUCrmOjy3V/HNZIxEZCnbaUapoGLr73iDHhyaoXUIv+DgOsclqKtU7a4dmVLkteK2g2/6YbAyafBZzNjiUQUiEjcYNTeF17Zozu4vNnFt2CF6KpiO4JX4D2yMJthgdx9PRDb5f/dM+ZGuz6AfIUHikBgmiSJmiAMO8vEBa3rk6TZSCuBRBbI48BCMaduegjU/SE1af+Dg7sjPpwpHb4D7fpFgBml9dJfXRVqeuBnFZEUODYw9i52AsuGcuv/JnXY+kkHKu9WUMImynvyl9GIU4keknbi7OoO/bqT4Xp/BAIt1sgzDQnu55X7Hjqu9tHt83gEbe8aTlZ4beM1s2053wFzIYtMRIs5Fpjxp3RqCyDSHdlKa1iowSGyTcLAtWTFc6l10syZCWG58HUQHDtMGZIOdqtvzdH1MVNGya5Hmrx+geIELCM1U0fZDbHcFos/3+Ar669CPP/SxDgdp5aFuC X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0aeca902-d792-4bb8-c314-08dae2381702 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:56.0793 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZQFjiHUbbRgaSacJ47A7Xr3LRjEp93PNktrKfKWL3H9mxNqKRePZj0FWWbDCHM9z6PmaLshOw1BGOrFVwIQrBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org enable encoding 12-bit extended jpeg Signed-off-by: Ming Qian --- .../media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c | 14 +- .../media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h | 4 +- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 172 +++++++++++++++++- 3 files changed, 175 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c index bbd5d6a9fc86..9a6e8b332e12 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c @@ -97,25 +97,31 @@ void mxc_jpeg_sw_reset(void __iomem *reg) writel(GLB_CTRL_SFT_RST, reg + GLB_CTRL); } -void mxc_jpeg_enc_mode_conf(struct device *dev, void __iomem *reg) +void mxc_jpeg_enc_mode_conf(struct device *dev, void __iomem *reg, u8 extseq) { dev_dbg(dev, "CAST Encoder CONFIG...\n"); /* * "Config_Mode" enabled, "Config_Mode auto clear enabled", */ - writel(0xa0, reg + CAST_MODE); + if (extseq) + writel(0xb0, reg + CAST_MODE); + else + writel(0xa0, reg + CAST_MODE); /* all markers and segments */ writel(0x3ff, reg + CAST_CFG_MODE); } -void mxc_jpeg_enc_mode_go(struct device *dev, void __iomem *reg) +void mxc_jpeg_enc_mode_go(struct device *dev, void __iomem *reg, u8 extseq) { dev_dbg(dev, "CAST Encoder GO...\n"); /* * "GO" enabled, "GO bit auto clear" enabled */ - writel(0x140, reg + CAST_MODE); + if (extseq) + writel(0x150, reg + CAST_MODE); + else + writel(0x140, reg + CAST_MODE); } void mxc_jpeg_enc_set_quality(struct device *dev, void __iomem *reg, u8 quality) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h index 8b7cd6526efd..ed15ea348f97 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h @@ -117,8 +117,8 @@ void print_wrapper_info(struct device *dev, void __iomem *reg); void mxc_jpeg_sw_reset(void __iomem *reg); int mxc_jpeg_enable(void __iomem *reg); void wait_frmdone(struct device *dev, void __iomem *reg); -void mxc_jpeg_enc_mode_conf(struct device *dev, void __iomem *reg); -void mxc_jpeg_enc_mode_go(struct device *dev, void __iomem *reg); +void mxc_jpeg_enc_mode_conf(struct device *dev, void __iomem *reg, u8 extseq); +void mxc_jpeg_enc_mode_go(struct device *dev, void __iomem *reg, u8 extseq); void mxc_jpeg_enc_set_quality(struct device *dev, void __iomem *reg, u8 quality); void mxc_jpeg_dec_mode_go(struct device *dev, void __iomem *reg); int mxc_jpeg_get_slot(void __iomem *reg); diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index 2dd52d593764..f6f87970a6c9 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -322,6 +322,45 @@ static const unsigned char jpeg_dqt[] = { 0x63, 0x63, 0x63, 0x63, 0x63, 0x63 }; +static const unsigned char jpeg_dqt_extseq[] = { + 0xFF, 0xDB, + 0x01, 0x04, + 0x10, + 0x00, 0x80, 0x00, 0x58, 0x00, 0x60, 0x00, 0x70, + 0x00, 0x60, 0x00, 0x50, 0x00, 0x80, 0x00, 0x70, + 0x00, 0x68, 0x00, 0x70, 0x00, 0x90, 0x00, 0x88, + 0x00, 0x80, 0x00, 0x98, 0x00, 0xC0, 0x01, 0x40, + 0x00, 0xD0, 0x00, 0xC0, 0x00, 0xB0, 0x00, 0xB0, + 0x00, 0xC0, 0x01, 0x88, 0x01, 0x18, 0x01, 0x28, + 0x00, 0xE8, 0x01, 0x40, 0x01, 0xD0, 0x01, 0x98, + 0x01, 0xE8, 0x01, 0xE0, 0x01, 0xC8, 0x01, 0x98, + 0x01, 0xC0, 0x01, 0xB8, 0x02, 0x00, 0x02, 0x40, + 0x02, 0xE0, 0x02, 0x70, 0x02, 0x00, 0x02, 0x20, + 0x02, 0xB8, 0x02, 0x28, 0x01, 0xB8, 0x01, 0xC0, + 0x02, 0x80, 0x03, 0x68, 0x02, 0x88, 0x02, 0xB8, + 0x02, 0xF8, 0x03, 0x10, 0x03, 0x38, 0x03, 0x40, + 0x03, 0x38, 0x01, 0xF0, 0x02, 0x68, 0x03, 0x88, + 0x03, 0xC8, 0x03, 0x80, 0x03, 0x20, 0x03, 0xC0, + 0x02, 0xE0, 0x03, 0x28, 0x03, 0x38, 0x03, 0x18, + 0x11, + 0x00, 0x88, 0x00, 0x90, 0x00, 0x90, 0x00, 0xC0, + 0x00, 0xA8, 0x00, 0xC0, 0x01, 0x78, 0x00, 0xD0, + 0x00, 0xD0, 0x01, 0x78, 0x03, 0x18, 0x02, 0x10, + 0x01, 0xC0, 0x02, 0x10, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, +}; + static const unsigned char jpeg_sof_maximal[] = { 0xFF, 0xC0, 0x00, 0x14, 0x08, 0x00, 0x40, 0x00, 0x40, @@ -329,6 +368,13 @@ static const unsigned char jpeg_sof_maximal[] = { 0x03, 0x11, 0x01, 0x04, 0x11, 0x01 }; +static const unsigned char jpeg_sof_extseq[] = { + 0xFF, 0xC1, + 0x00, 0x14, 0x08, 0x00, 0x40, 0x00, 0x40, + 0x04, 0x01, 0x11, 0x00, 0x02, 0x11, 0x01, + 0x03, 0x11, 0x01, 0x04, 0x11, 0x01 +}; + static const unsigned char jpeg_dht[] = { 0xFF, 0xC4, 0x01, 0xA2, 0x00, 0x00, 0x01, 0x05, 0x01, @@ -393,6 +439,90 @@ static const unsigned char jpeg_dht[] = { 0xF6, 0xF7, 0xF8, 0xF9, 0xFA }; +static const unsigned char jpeg_dht_extseq[] = { + 0xFF, 0xC4, + 0x02, 0x2a, 0x00, 0x00, 0x01, 0x05, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, + 0x04, 0x03, 0x05, 0x05, 0x02, 0x03, 0x02, + 0x00, 0x00, 0xbf, 0x01, 0x02, 0x03, 0x00, + 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, + 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, + 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, 0x23, + 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, + 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, + 0x16, 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, + 0x27, 0x28, 0x29, 0x2a, 0x34, 0x35, 0x36, + 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, + 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54, + 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x63, + 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, + 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, + 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, + 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, + 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, + 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, + 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, + 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, + 0xea, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, + 0xf7, 0xf8, 0xf9, 0xfa, 0x0b, 0x0c, 0x0d, + 0x0e, 0x1b, 0x1c, 0x1d, 0x1e, 0x2b, 0x2c, + 0x2d, 0x2e, 0x3b, 0x3c, 0x3d, 0x3e, 0x4b, + 0x4c, 0x4d, 0x4e, 0x5b, 0x5c, 0x5d, 0x5e, + 0x6b, 0x6c, 0x6d, 0x6e, 0x7b, 0x7c, 0x7d, + 0x7e, 0x8b, 0x8c, 0x8d, 0x8e, 0x9b, 0x9c, + 0x9d, 0x9e, 0xab, 0xac, 0xad, 0xae, 0xbb, + 0xbc, 0xbd, 0xbe, 0xcb, 0xcc, 0xcd, 0xce, + 0xdb, 0xdc, 0xdd, 0xde, 0xeb, 0xec, 0xed, + 0xee, 0xfb, 0xfc, 0xfd, 0xfe, 0x01, 0x00, + 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, + 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, + 0x0d, 0x0e, 0x0f, 0x11, 0x00, 0x02, 0x01, + 0x03, 0x03, 0x02, 0x04, 0x03, 0x05, 0x05, + 0x02, 0x03, 0x02, 0x00, 0x00, 0xbf, 0x01, + 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, + 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, + 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, + 0xa1, 0x08, 0x23, 0x42, 0xb1, 0xc1, 0x15, + 0x52, 0xd1, 0xf0, 0x24, 0x33, 0x62, 0x72, + 0x82, 0x09, 0x0a, 0x16, 0x17, 0x18, 0x19, + 0x1a, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, + 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, + 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, + 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, + 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, + 0x77, 0x78, 0x79, 0x7a, 0x83, 0x84, 0x85, + 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93, + 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, + 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, + 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, + 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, + 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, + 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, + 0xda, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, + 0xe7, 0xe8, 0xe9, 0xea, 0xf1, 0xf2, 0xf3, + 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, + 0x0b, 0x0c, 0x0d, 0x0e, 0x1b, 0x1c, 0x1d, + 0x1e, 0x2b, 0x2c, 0x2d, 0x2e, 0x3b, 0x3c, + 0x3d, 0x3e, 0x4b, 0x4c, 0x4d, 0x4e, 0x5b, + 0x5c, 0x5d, 0x5e, 0x6b, 0x6c, 0x6d, 0x6e, + 0x7b, 0x7c, 0x7d, 0x7e, 0x8b, 0x8c, 0x8d, + 0x8e, 0x9b, 0x9c, 0x9d, 0x9e, 0xab, 0xac, + 0xad, 0xae, 0xbb, 0xbc, 0xbd, 0xbe, 0xcb, + 0xcc, 0xcd, 0xce, 0xdb, 0xdc, 0xdd, 0xde, + 0xeb, 0xec, 0xed, 0xee, 0xfb, 0xfc, 0xfd, + 0xfe, +}; + static const unsigned char jpeg_dri[] = { 0xFF, 0xDD, 0x00, 0x04, 0x00, 0x20 @@ -802,7 +932,8 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) if (dec_ret & SLOT_STATUS_ENC_CONFIG_ERR) { u32 ret = readl(reg + CAST_STATUS12); - dev_err(dev, "Encoder/decoder error, status=0x%08x", ret); + dev_err(dev, "Encoder/decoder error, dec_ret = 0x%08x, status=0x%08x", + dec_ret, ret); mxc_jpeg_clr_desc(reg, slot); mxc_jpeg_sw_reset(reg); buf_state = VB2_BUF_STATE_ERROR; @@ -814,10 +945,11 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) if (jpeg->mode == MXC_JPEG_ENCODE && ctx->enc_state == MXC_JPEG_ENC_CONF) { + q_data = mxc_jpeg_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); ctx->enc_state = MXC_JPEG_ENCODING; dev_dbg(dev, "Encoder config finished. Start encoding...\n"); mxc_jpeg_enc_set_quality(dev, reg, ctx->jpeg_quality); - mxc_jpeg_enc_mode_go(dev, reg); + mxc_jpeg_enc_mode_go(dev, reg, mxc_jpeg_is_extended_sequential(q_data->fmt)); goto job_unlock; } if (jpeg->mode == MXC_JPEG_DECODE && jpeg_src_buf->dht_needed) { @@ -868,8 +1000,12 @@ static int mxc_jpeg_fixup_sof(struct mxc_jpeg_sof *sof, u16 w, u16 h) { int sof_length; + const struct mxc_jpeg_fmt *fmt = mxc_jpeg_find_format(fourcc); - sof->precision = 8; /* TODO allow 8/12 bit precision*/ + if (fmt) + sof->precision = fmt->precision; + else + sof->precision = 8; /* TODO allow 8/12 bit precision*/ sof->height = h; _bswap16(&sof->height); sof->width = w; @@ -988,16 +1124,28 @@ static unsigned int mxc_jpeg_setup_cfg_stream(void *cfg_stream_vaddr, offset += sizeof(jpeg_app0); } - memcpy(cfg + offset, jpeg_dqt, sizeof(jpeg_dqt)); - offset += sizeof(jpeg_dqt); + if (mxc_jpeg_is_extended_sequential(fmt)) { + memcpy(cfg + offset, jpeg_dqt_extseq, sizeof(jpeg_dqt_extseq)); + offset += sizeof(jpeg_dqt_extseq); + + memcpy(cfg + offset, jpeg_sof_extseq, sizeof(jpeg_sof_extseq)); + } else { + memcpy(cfg + offset, jpeg_dqt, sizeof(jpeg_dqt)); + offset += sizeof(jpeg_dqt); - memcpy(cfg + offset, jpeg_sof_maximal, sizeof(jpeg_sof_maximal)); + memcpy(cfg + offset, jpeg_sof_maximal, sizeof(jpeg_sof_maximal)); + } offset += 2; /* skip marker ID */ sof = (struct mxc_jpeg_sof *)(cfg + offset); offset += mxc_jpeg_fixup_sof(sof, fourcc, w, h); - memcpy(cfg + offset, jpeg_dht, sizeof(jpeg_dht)); - offset += sizeof(jpeg_dht); + if (mxc_jpeg_is_extended_sequential(fmt)) { + memcpy(cfg + offset, jpeg_dht_extseq, sizeof(jpeg_dht_extseq)); + offset += sizeof(jpeg_dht_extseq); + } else { + memcpy(cfg + offset, jpeg_dht, sizeof(jpeg_dht)); + offset += sizeof(jpeg_dht); + } memcpy(cfg + offset, jpeg_dri, sizeof(jpeg_dri)); offset += sizeof(jpeg_dri); @@ -1138,6 +1286,10 @@ static void mxc_jpeg_config_enc_desc(struct vb2_buffer *out_buf, desc->stm_ctrl = STM_CTRL_CONFIG_MOD(0) | STM_CTRL_IMAGE_FORMAT(img_fmt); desc->stm_ctrl |= STM_CTRL_BITBUF_PTR_CLR(1); + if (mxc_jpeg_is_extended_sequential(q_data->fmt)) + desc->stm_ctrl |= STM_CTRL_PIXEL_PRECISION; + else + desc->stm_ctrl &= ~STM_CTRL_PIXEL_PRECISION; mxc_jpeg_addrs(desc, src_buf, dst_buf, 0); dev_dbg(jpeg->dev, "cfg_desc:\n"); print_descriptor_info(jpeg->dev, cfg_desc); @@ -1338,7 +1490,9 @@ static void mxc_jpeg_device_run(void *priv) ctx->enc_state = MXC_JPEG_ENC_CONF; mxc_jpeg_config_enc_desc(&dst_buf->vb2_buf, ctx, &src_buf->vb2_buf, &dst_buf->vb2_buf); - mxc_jpeg_enc_mode_conf(dev, reg); /* start config phase */ + /* start config phase */ + mxc_jpeg_enc_mode_conf(dev, reg, + mxc_jpeg_is_extended_sequential(q_data_out->fmt)); } else { dev_dbg(dev, "Decoding on slot %d\n", ctx->slot); print_mxc_buf(jpeg, &src_buf->vb2_buf, 0);