From patchwork Mon Nov 2 03:08:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mirela Rabulea OSS X-Patchwork-Id: 315091 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F3B9C2D0A3 for ; Mon, 2 Nov 2020 03:10:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF68A20870 for ; Mon, 2 Nov 2020 03:10:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="kIiNCA+p" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727765AbgKBDKM (ORCPT ); Sun, 1 Nov 2020 22:10:12 -0500 Received: from mail-am6eur05on2083.outbound.protection.outlook.com ([40.107.22.83]:60192 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727461AbgKBDKK (ORCPT ); Sun, 1 Nov 2020 22:10:10 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gMXtoz2QV9CunhzCb53jSXwWqtzSOURT61ggOTYGK9bCIhvKCghlfiUfs8pviTtBmbsEa5Br4RjO8h4otfrWZbE0G2nuF836299zqS1piEg2nI1DPvfKpmYjfuHA7O8Z3LHIxTRXejE8u0fDLDVQvwcMnWmrZFampWwoxrQ++HIOKCwMoUVg90euYhkI5RbVVVVYKawD9hRwfMOxGzNYdfvsFyqvXY0GPkldr5kk2TQ6y9Q6lALNO8L8H3PIScnyVtxnl79N53giCa5cutJRkiMliRFHZ0h5YYIdCViznt48caC9zDX0D7uR0MXEtebYNwrGbBHgzdjmRKp9vb5+cA== 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-SenderADCheck; bh=SIB/fjhy+ggZllz0p/bsfZJ9PPhieqbJIhplMpF9Gbo=; b=oY50zn7v5pYUXGpIDqUJPWdFxgBYg07PTIlK1z7fPa5N7Z/lmQEaEaMcYi+pCz5OA5BrdEhNOhjkSOSFGg5ogUNk1j44y64UKoZoH2/Sqsbhu6vB7vXaiOfBnzGHU5koFcJXyQ9xl0dLbI5TQF/hT7iXbt6rHdqDbo1dcw3rIH8E9LLZNSK70Z3H4aKNd689mFysbIXpBaC+DhYUxC6EGf31/tED2BsTrrOKRwKEQcwzdmXLFVipyQaajoUzy3FkAWcrHWuCSo79GCY7bOGZckyDRsGXrwogOiVCOE5AuawcJI7+4/8Pk4fFJhXS0h3BfQnWtuO4webQykdvvwsovA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SIB/fjhy+ggZllz0p/bsfZJ9PPhieqbJIhplMpF9Gbo=; b=kIiNCA+pm4kOjqYPgMMyo2mtvvmlMbSYF4XuSw25h9zkYMl+ZE+OUFAgFO2azj+H6eRVqgTeLYXfe8I/GlraEYLlg3bL2+vwyWbRsEXputH0qvgWn7fSwV3C36U8bnyofwqo8/08+Z4Z/JrHBPUSkRK6SwikNOSjU6yQ1R/HMMg= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from AM5PR04MB3137.eurprd04.prod.outlook.com (2603:10a6:206:c::18) by AM6PR04MB5173.eurprd04.prod.outlook.com (2603:10a6:20b:d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Mon, 2 Nov 2020 03:09:59 +0000 Received: from AM5PR04MB3137.eurprd04.prod.outlook.com ([fe80::2d75:aaf5:5aa6:5de9]) by AM5PR04MB3137.eurprd04.prod.outlook.com ([fe80::2d75:aaf5:5aa6:5de9%6]) with mapi id 15.20.3499.029; Mon, 2 Nov 2020 03:09:59 +0000 From: "Mirela Rabulea (OSS)" To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, shawnguo@kernel.org, robh+dt@kernel.org Cc: paul.kocialkowski@bootlin.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, s.hauer@pengutronix.de, aisheng.dong@nxp.com, daniel.baluta@nxp.com, robert.chiras@nxp.com, laurentiu.palcu@nxp.com, mark.rutland@arm.com, devicetree@vger.kernel.org, p.zabel@pengutronix.de, ezequiel@collabora.com, laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, dafna.hirschfeld@collabora.com, Mirela Rabulea Subject: [PATCH v4 02/11] firmware: imx: scu-pd: Add power domains for imx-jpeg Date: Mon, 2 Nov 2020 05:08:12 +0200 Message-Id: <20201102030821.3049-3-mirela.rabulea@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201102030821.3049-1-mirela.rabulea@oss.nxp.com> References: <20201102030821.3049-1-mirela.rabulea@oss.nxp.com> X-Originating-IP: [86.124.170.94] X-ClientProxiedBy: AM0PR06CA0128.eurprd06.prod.outlook.com (2603:10a6:208:ab::33) To AM5PR04MB3137.eurprd04.prod.outlook.com (2603:10a6:206:c::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from fsr-ub1664-134.ea.freescale.net (86.124.170.94) by AM0PR06CA0128.eurprd06.prod.outlook.com (2603:10a6:208:ab::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Mon, 2 Nov 2020 03:09:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2118dfc2-9d00-49a7-8c93-08d87edcc85c X-MS-TrafficTypeDiagnostic: AM6PR04MB5173: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1013; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zTc/ROMUqV3iI8DPUuholwiCt1eNfy78Kd8EN9CzDRxezV0jXAuxEM6ERN+3oxUM7I9GeMbykogv15rRWhySGN7UMEJ6DScZHkkZNSSAwWUmS2EuzG+ezGE2lvauJMV8NsEUqZ+hmC8Ie4Ct6GqcotMv43/FJS0oqnGbsqapUB+dNL6BpNZ8bh94K8NpXa44o0l4Nyrcf+am7sEmIe8zS7NGiK8jDvLXUcWZFZr1cAT+ro860kQzSA7Uzgb+EYv5RxHl4HP1KEkjuBmHG0WT5E7vlH9M4Vzuh9v3rDq3buRBSoRMXw3BqS4DfDabQUgPeex0bVKnIb3ymg91vyBz/Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM5PR04MB3137.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(396003)(39860400002)(376002)(366004)(136003)(5660300002)(478600001)(86362001)(16526019)(186003)(8936002)(6512007)(6666004)(26005)(2906002)(6486002)(316002)(4326008)(66946007)(8676002)(52116002)(956004)(6506007)(1076003)(66476007)(2616005)(7416002)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 3JA0RGZ07qGjnwY3nu5Uwp5kUfJENcitpWnQff25y09ZGfcpN2FpxvNdq9Y0XecGJCO57V6auyRF+pux2MBETtoG8/RlS1MHFuVFR0VLCEzuYqrYOJ8hlYHcCu9fyln7ykauS195mAwpF9h/tl77HzVhg+XITiwN0OUkK3d3o7lOUnF612yiIq5EX8bIzrzyP/RXy7emC2RGVFThnSlXOYsuYsYfDLFk0cbzH0LQHVJ3fvre3YTy9BGMiuoNk1iVOUq3evM2aTa48mzoiZCmKOdC15KV+yTpUY4uYE48LHqDG5sHKWcq+VoO5yhG/k9IfBtRMqirbK1TtfDr4lJ8UBi5w+VpzvVw1TYjcsqbLTAwkVF64L0c5nnhUNaSNQWVxvwY9gosMU9dc4Kd4SflZRWdnyzL3eG1gFapoo4lr3Kypkx4aQpZSXGI/up6qIQi0Skk1AA9/ib18ViWCkROYWX+nGtIK517DhtTjlGRJM27Y3590UuU6dIOMvZz1/GTChu8NCO+Dmiy/z2xiC1jW6KIQkjgKUW//fjUbpKuGQD9xaq3CofA86pwXoMgJjHuIRZLc1LwseM1ncgGMFCbo1vch10aSzjd93x5pyDaDYA5czfaqSzhsOfWEojWCTrK9Z9ApP4U6oLxhu8/esSHNA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2118dfc2-9d00-49a7-8c93-08d87edcc85c X-MS-Exchange-CrossTenant-AuthSource: AM5PR04MB3137.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2020 03:09:59.3947 (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: 7FCRVsKltl4EMe1Nh0WjaHlfnw8stk3xUKS3Id8a3Ptw6LMK2WwsCbwKRYW1vP4h4xFN6E3E6sbqXkVrje6mqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5173 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mirela Rabulea The power domains are for imx8qxp/imx8qm JPEG encoder & decoder. Each has 4 slots and a wrapper. Signed-off-by: Mirela Rabulea --- drivers/firmware/imx/scu-pd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/firmware/imx/scu-pd.c b/drivers/firmware/imx/scu-pd.c index 946eea292b52..a614d8dd868e 100644 --- a/drivers/firmware/imx/scu-pd.c +++ b/drivers/firmware/imx/scu-pd.c @@ -180,6 +180,12 @@ static const struct imx_sc_pd_range imx8qxp_scu_pd_ranges[] = { { "cm41-pid", IMX_SC_R_M4_1_PID0, 5, true, 0}, { "cm41-mu-a1", IMX_SC_R_M4_1_MU_1A, 1, false, 0}, { "cm41-lpuart", IMX_SC_R_M4_1_UART, 1, false, 0}, + + /* IMAGE SS */ + { "img-jpegdec-mp", IMX_SC_R_MJPEG_DEC_MP, 1, false, 0 }, + { "img-jpegdec-s0", IMX_SC_R_MJPEG_DEC_S0, 4, true, 0 }, + { "img-jpegenc-mp", IMX_SC_R_MJPEG_ENC_MP, 1, false, 0 }, + { "img-jpegenc-s0", IMX_SC_R_MJPEG_ENC_S0, 4, true, 0 }, }; static const struct imx_sc_pd_soc imx8qxp_scu_pd = { From patchwork Mon Nov 2 03:08:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mirela Rabulea OSS X-Patchwork-Id: 315087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5421DC55179 for ; Mon, 2 Nov 2020 03:10:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F08062224E for ; Mon, 2 Nov 2020 03:10:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="ixCdV53E" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727821AbgKBDKS (ORCPT ); Sun, 1 Nov 2020 22:10:18 -0500 Received: from mail-am6eur05on2083.outbound.protection.outlook.com ([40.107.22.83]:60192 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727781AbgKBDKQ (ORCPT ); Sun, 1 Nov 2020 22:10:16 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e/O14qbC3nCQNOyXar0HOze8IhwFyTh26fRWo93YgOidcY1iZ+Zy/UQ+wmj6OOWrIFXT6ZtqJXBdIzkxNa7raPHP7LFN1sDs2gWyGwbzNvWYAPNye1eAiwLUN1VvkW9ITxt5YCsUQVR+0hG4oJwJ6J7O1Kba8J+NgSauhZEnE4VrrR87eD8B0yV9rIurh2JV7Uri9M3vrI4FjMn5HN9tEpiUEV4NkF6swUk5ljdYAzzIYgwd4vTUwc67o37TGlDJGWqFNzrmgTLKgJ0pGoWRQ5COFDbEL7sI2QnIl5E1XBP2pM0Qmzhceg5y1kJBZBoivxTJf9c1FAsIlRqmquXfVg== 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-SenderADCheck; bh=AMOvSSgHNhcgFbSvMjgkrROxoUwvCKgAU8i+N1ujUyU=; b=CUEfGcmKize6EDO7Wt2KYyx4CFc69UDpov5iSu+UiH40X5xeM9ai6UwKWGGSlLI1bioBZFGFZm9J5aJ7Y1NYSfkywgqMABuX5bKu489v99ipsqHMe6O4a4xdj9e65E+VeReV+r3JKEoXm+Sb4HW8D1l/WUjFvlD/fu7kCDgYPOq5cc5RpAsINOvHxRkyo+iQYDqokltvpYpoLBmTi0VTqeYWp3IkA+CXuRbb/POBWtkWNUnu7t1RgJZWnuQnAYQTMfHJgs8IattKLghq4plUAqEWR1IyQLjBnHArdOm1N9xg2O/HaL+1BAM5qBS3YN82roOzH7awor9gieOrsT6uyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AMOvSSgHNhcgFbSvMjgkrROxoUwvCKgAU8i+N1ujUyU=; b=ixCdV53EWvCSnTcInbuAz7ufD/ohC0hvdFso6Wnio/3tXF1kmLROi8XpyhBMvPf/x5LBtMt6fPj03AmbjdOlonExHz0FHRoKWps2sI6WOnIiRKi4zIndNtzzi2DpWAVnNuZkk+6qhv8tPRNg4mnPoPmDaU+QNIDE8KqbRwRkRqs= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from AM5PR04MB3137.eurprd04.prod.outlook.com (2603:10a6:206:c::18) by AM6PR04MB5173.eurprd04.prod.outlook.com (2603:10a6:20b:d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Mon, 2 Nov 2020 03:10:03 +0000 Received: from AM5PR04MB3137.eurprd04.prod.outlook.com ([fe80::2d75:aaf5:5aa6:5de9]) by AM5PR04MB3137.eurprd04.prod.outlook.com ([fe80::2d75:aaf5:5aa6:5de9%6]) with mapi id 15.20.3499.029; Mon, 2 Nov 2020 03:10:03 +0000 From: "Mirela Rabulea (OSS)" To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, shawnguo@kernel.org, robh+dt@kernel.org Cc: paul.kocialkowski@bootlin.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, s.hauer@pengutronix.de, aisheng.dong@nxp.com, daniel.baluta@nxp.com, robert.chiras@nxp.com, laurentiu.palcu@nxp.com, mark.rutland@arm.com, devicetree@vger.kernel.org, p.zabel@pengutronix.de, ezequiel@collabora.com, laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, dafna.hirschfeld@collabora.com, Mirela Rabulea Subject: [PATCH v4 05/11] arm64: dts: imx8qxp: Add jpeg encoder/decoder nodes Date: Mon, 2 Nov 2020 05:08:15 +0200 Message-Id: <20201102030821.3049-6-mirela.rabulea@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201102030821.3049-1-mirela.rabulea@oss.nxp.com> References: <20201102030821.3049-1-mirela.rabulea@oss.nxp.com> X-Originating-IP: [86.124.170.94] X-ClientProxiedBy: AM0PR06CA0128.eurprd06.prod.outlook.com (2603:10a6:208:ab::33) To AM5PR04MB3137.eurprd04.prod.outlook.com (2603:10a6:206:c::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from fsr-ub1664-134.ea.freescale.net (86.124.170.94) by AM0PR06CA0128.eurprd06.prod.outlook.com (2603:10a6:208:ab::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Mon, 2 Nov 2020 03:10:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d172a6f0-4b9a-4373-6065-08d87edccafd X-MS-TrafficTypeDiagnostic: AM6PR04MB5173: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9ytymTMiSlkhTD1oaZGW9FuKtx8wfhCPbAv9W6AoH3BEDpEj3yHTGbTAqCyPXDcrl3nmk7A+83QqRLj0cF9tCwdRiiy+7ISICebVHcv4o0vhZJbSGSoKIPNbNFyE+6Dxq5FdyRVAQFNxkEf7s/ir7T24IFxBypbVcSrIqHC7FRJSWuMPRdK9CybmbJLd5MZRlP9scFN/xiLOLmC4uRUL/RKWIVK3o5Q6Y9Y2wt6+DeXBJXOgy9v4J3KI8hN3ROapUqOFfWGfR6fL1+zvE9a85H6aWQTX5VIqv5Ng2Ma86e6Vzu63eyNE5/o0Y1lauRBkDOPX8SZVun+t61TKdlW4ObUdIDOohkq/hxjTBZV7EF0AeYegZBKAZtqnvFYBlWOy X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM5PR04MB3137.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(396003)(39860400002)(376002)(366004)(136003)(5660300002)(478600001)(86362001)(16526019)(186003)(8936002)(83380400001)(6512007)(6666004)(26005)(2906002)(6486002)(316002)(4326008)(66946007)(8676002)(52116002)(956004)(6506007)(1076003)(66476007)(2616005)(7416002)(66556008)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: BAKe5Oi3UeQ6TjFSaqnAggQ3uN4ir78NgGAeDSNEeh4K8HWbbmtKnr8jtj1ZGslrULsUjseizjp5IOPp0BKhrdMeOsvm16CTIkRFO/s8oT/PsYbvfilj/D+f1DDkSlcLktZkBYve28+BFx3XKWXix1nps46q7qpQMcZoYSwiuEvbTF71e7PlU5WvPyc93he3Ffb290Az9mPr06Tby2UpU5WdR3yQDYQLf9JHye8nUIKXyrgAyCsv9MaY/qkmKr48+UvdVw7Dn3ivG4pKPfRbmlGBZ4bspL3VfjHZJcWo/Cv1aIaoQDEM7o1TdpCvsWws3PBvEgNhy3zByA8rn2mAcARNIw+tSQM02pL1cHcivTjx2xp1aFcXi/awM0FpMpIx4lH/TYu6Q0FL/ZkWXAP32ZyAcrRTsU55MtMqwRenyQ/yU6Tuhl08FbOvCpEcdv0bbUJJGW4xqvNIM0FbrBo876l/gouz8H3gPK3e+t5DRLgjwOUB3BLR//ZADl0HwC00PMC8GiDmhM0pxXW5IbMmwnSDGtCwg9AFs/hjwDGnEx/8NVdalmNERlNl3YtLqVxgLgSGv5/DEDU4zc0GkSV0hQNvWTU0ex6HqpxL6dL7UeXvWOMi4M5UJA0witYHa7Px0cIxuGnkxQe9i/36pSu82g== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d172a6f0-4b9a-4373-6065-08d87edccafd X-MS-Exchange-CrossTenant-AuthSource: AM5PR04MB3137.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2020 03:10:03.8241 (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: tm+Y/vowgy9/fG2aL6v0y0uiXBudiyeV5JaPitrnqcz2Pv4MLlern5OIxkZqGlahvkJG0sLTRWWxCEkCBFnEmA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5173 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mirela Rabulea Add jpeg decoder/encoder nodes, for now on imx8qxp only. The same should work on imx8qm, but it was not tested. Signed-off-by: Mirela Rabulea --- arch/arm64/boot/dts/freescale/imx8qxp-mek.dts | 8 ++++ arch/arm64/boot/dts/freescale/imx8qxp.dtsi | 37 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts b/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts index 46437d3c7a04..a0ad9789e9b8 100644 --- a/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts +++ b/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts @@ -270,3 +270,11 @@ >; }; }; + +&jpegdec { + status = "okay"; +}; + +&jpegenc { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/freescale/imx8qxp.dtsi b/arch/arm64/boot/dts/freescale/imx8qxp.dtsi index e46faac1fe71..774afa1d4665 100644 --- a/arch/arm64/boot/dts/freescale/imx8qxp.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8qxp.dtsi @@ -629,4 +629,41 @@ }; }; }; + + img_subsys: bus@58000000 { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x58000000 0x0 0x58000000 0x1000000>; + + jpegdec: jpegdec@58400000 { + compatible = "fsl,imx8-jpgdec"; + reg = <0x58400000 0x00050000 >; + interrupts = , + , + , + ; + power-domains = <&pd IMX_SC_R_MJPEG_DEC_MP>, + <&pd IMX_SC_R_MJPEG_DEC_S0>, + <&pd IMX_SC_R_MJPEG_DEC_S1>, + <&pd IMX_SC_R_MJPEG_DEC_S2>, + <&pd IMX_SC_R_MJPEG_DEC_S3>; + status = "disabled"; + }; + + jpegenc: jpegenc@58450000 { + compatible = "fsl,imx8-jpgenc"; + reg = <0x58450000 0x00050000 >; + interrupts = , + , + , + ; + power-domains = <&pd IMX_SC_R_MJPEG_ENC_MP>, + <&pd IMX_SC_R_MJPEG_ENC_S0>, + <&pd IMX_SC_R_MJPEG_ENC_S1>, + <&pd IMX_SC_R_MJPEG_ENC_S2>, + <&pd IMX_SC_R_MJPEG_ENC_S3>; + status = "disabled"; + }; + }; }; From patchwork Mon Nov 2 03:08:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mirela Rabulea OSS X-Patchwork-Id: 315090 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09AF4C388F2 for ; Mon, 2 Nov 2020 03:10:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC9092224E for ; Mon, 2 Nov 2020 03:10:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="RRm3jmcW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727862AbgKBDKY (ORCPT ); Sun, 1 Nov 2020 22:10:24 -0500 Received: from mail-am6eur05on2083.outbound.protection.outlook.com ([40.107.22.83]:60192 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727450AbgKBDKX (ORCPT ); Sun, 1 Nov 2020 22:10:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nXCcVosIGOzr3y4Mv/I+FSLTtkeu/avB7+PpPatWJuJECQJfHR22nBmJCZ0i9eLOC7wWnRKuU+OONTYERUQif5N8coewWJ9L03kRtoW1uT89yfo0i7g2rc7cTU5nyvDZfIjJFJE+WhO3cvp8pF1S+z2UlBIywp7d4JcNg8igL7XayLULcXEe4ja08MHxTwN7gCbIxeltjvfapLVnBILr8k8o+m0kWpIITKG2Jq4Q0zJ9MRw9a5X2TXgtDyCV2+YSYZIrLIxMbj3Nk86MRQL5hAEV5nFUyIf+QN0LGjlrshzwRa7cac0ujZONGFeQhaHQ05pk80/wtdncYz+eHtqdYQ== 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-SenderADCheck; bh=uWnDWlmv+OZ7PMdjC0dRjDnTLiMzQj93Wzq2GDIW6sY=; b=iEpaJGmmPyIiyTul0lTbZ/ZbyeMXsBDXR7S88Te2lmCrbfXUqyIvRw5Qym5M2NUkZY7NI3GJf3ipfoL3QKt5Hd6xpNpc/eWPWRD4Qwi2T/B/dDer6RaH6mr8sJjplxn7jy+gyyVyVzyTtfo4WBrDGQG52rfORett/dI7i/5TFxmKZT2b2p/kc1stUAdVgkVUzerdNgUBGrPrxnu+oKo6ZtRHMdlEmYyUFZtMAfRbzr/pTGwQ1ikoY62APvqeJuRXCMaWzeJ1oJ/Ly9uhbmWpT9z5DjbpBh00axBxur/zn7FrXnAKtG9zw6ZEjSXOpWjbF/7aUX1Ocobga6vmA5tjOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uWnDWlmv+OZ7PMdjC0dRjDnTLiMzQj93Wzq2GDIW6sY=; b=RRm3jmcWFGqxmprlvU6ji9HUoP2K0gKAfK/dJPv94pITjaUgRoOQY7DSsHbfc4lXVgOYszkGGEYIX42ME73vt9Vn2ozK40PiDnEPrw4Hsld//ReqLYM1vHzL5uGIOMfGUoqgjzKp7kqEIcmUPAL7Bl8V7PY05TgOtMOniaN7sjc= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from AM5PR04MB3137.eurprd04.prod.outlook.com (2603:10a6:206:c::18) by AM6PR04MB5173.eurprd04.prod.outlook.com (2603:10a6:20b:d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Mon, 2 Nov 2020 03:10:06 +0000 Received: from AM5PR04MB3137.eurprd04.prod.outlook.com ([fe80::2d75:aaf5:5aa6:5de9]) by AM5PR04MB3137.eurprd04.prod.outlook.com ([fe80::2d75:aaf5:5aa6:5de9%6]) with mapi id 15.20.3499.029; Mon, 2 Nov 2020 03:10:06 +0000 From: "Mirela Rabulea (OSS)" To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, shawnguo@kernel.org, robh+dt@kernel.org Cc: paul.kocialkowski@bootlin.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, s.hauer@pengutronix.de, aisheng.dong@nxp.com, daniel.baluta@nxp.com, robert.chiras@nxp.com, laurentiu.palcu@nxp.com, mark.rutland@arm.com, devicetree@vger.kernel.org, p.zabel@pengutronix.de, ezequiel@collabora.com, laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, dafna.hirschfeld@collabora.com, Mirela Rabulea Subject: [PATCH v4 07/11] media: imx-jpeg: Fix v4l2-compliance streaming tests on decoder Date: Mon, 2 Nov 2020 05:08:17 +0200 Message-Id: <20201102030821.3049-8-mirela.rabulea@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201102030821.3049-1-mirela.rabulea@oss.nxp.com> References: <20201102030821.3049-1-mirela.rabulea@oss.nxp.com> X-Originating-IP: [86.124.170.94] X-ClientProxiedBy: AM0PR06CA0128.eurprd06.prod.outlook.com (2603:10a6:208:ab::33) To AM5PR04MB3137.eurprd04.prod.outlook.com (2603:10a6:206:c::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from fsr-ub1664-134.ea.freescale.net (86.124.170.94) by AM0PR06CA0128.eurprd06.prod.outlook.com (2603:10a6:208:ab::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Mon, 2 Nov 2020 03:10:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b9e8f3d2-694d-4eb3-78ec-08d87edcccb7 X-MS-TrafficTypeDiagnostic: AM6PR04MB5173: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GGRZprbcS0Zm4IQ/l0wTIgU+afX+W/ydZ+nwA3F5suN7SpT0thZwIHulp6c22P9X/LzXB89cZxhR5if6wrmS1sknELCg1yOo74DNvZQnr/NMMj14Rn26gm40M8ap/tZyPDxuMU0CfJRB9gEpy8rbRvDA3uKfMwSoKQ9kQL1q/gx36GN9+SqziJNoWypqQ5m5Lks+Idj1H8yKUN4hJfhHnhqomkCaSen+be1WmX5aflof1whxqiVzd2kcrGjwhrPaieqJPyTcOIShouXAf8CDUm3MG/1y5tgGxW9pAeCEZWXCJtsPunp46hjZh1nF04j4AQT4n5IGuG1ua4bL26lgew== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM5PR04MB3137.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(396003)(39860400002)(376002)(366004)(136003)(5660300002)(478600001)(86362001)(16526019)(186003)(8936002)(83380400001)(6512007)(6666004)(26005)(2906002)(6486002)(316002)(4326008)(66946007)(8676002)(52116002)(956004)(6506007)(1076003)(66476007)(2616005)(7416002)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: tlfsELMZ7P93dHDOT0AlokJpe87qaMNF5Ixloy3cvyDSU2mwscmUwrOk0ZhxVRdS346gUBLcNIeOkzUtdblOZgjFq5JDdB3NueYfnIgbxSpzJZvSM3XKSuACZMWFXkVNdrgblcqTh8yqaQLJp77UySIjrQ3jb8Dx+oQs+uyCXpeprntZtnkK4qSKu6FPLqneAmpeia06SwbJXAvlaG89vzT7dWVQQcip9tgkQMJVT4bsMLvAJHxOm2jzHNXa14J3xKqoPKBLDpyy6UWPX1UUIwgPfL8hwFmNGPu5QrEsQ1q0vfBNdUVxes9nkQJZGDVMSUA643JgSzldyeFa4jmDMV9iSr2Ik0yBzdjnkLH3FUfHUcY495tJLUGeTmOxb9HGEy9iukt8LQR6nDWLL3LPfzryNZyuSBOmdvkviEjrlWcBSd4onF9nzhzfOql9UBWMpk+pAkz7VSxk/tCzSQhA9LY++1ktTJRkYwsRAyR4uMgqnsWhcJc71ix+JPapRzqazH3ezOJH35RJBQg3vyoV+CpaCkrVhbG5r7seqsEu6Js8AyKKZnLyl73KA4NaAVAaYVMEDCqiaOzIHnsC9RZJIXWx0eUA9LGa9CTgvbkHemrp5Ax7bK5beZnNvPoy192CQJq/c+BZqxPO+KtQTEYfBA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9e8f3d2-694d-4eb3-78ec-08d87edcccb7 X-MS-Exchange-CrossTenant-AuthSource: AM5PR04MB3137.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2020 03:10:06.7764 (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: 1m1T1w9T/u08h8jU3ZLQGXBu/ISEIXsPccy5kCFGcOFDftilmLFCZFw9bQDmT7DSdegL2/tQ3Xxa3J1OejCODQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5173 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mirela Rabulea Streaming tests were faling on decoder, due to errors on jpeg parse. Let the error be, until device_run, there check for errors and finish job. Signed-off-by: Mirela Rabulea --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 25 ++++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/imx-jpeg/mxc-jpeg.c index 8535da246a63..d87f99caf124 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -249,6 +249,7 @@ struct mxc_jpeg_src_buf { /* mxc-jpeg specific */ bool dht_needed; + bool jpeg_parse_error; }; static inline struct mxc_jpeg_src_buf *vb2_to_mxc_buf(struct vb2_buffer *vb) @@ -929,6 +930,7 @@ static void mxc_jpeg_device_run(void *priv) struct vb2_v4l2_buffer *src_buf, *dst_buf; unsigned long flags; struct mxc_jpeg_q_data *q_data_cap, *q_data_out; + struct mxc_jpeg_src_buf *jpeg_src_buf; spin_lock_irqsave(&ctx->mxc_jpeg->hw_lock, flags); src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); @@ -949,6 +951,19 @@ static void mxc_jpeg_device_run(void *priv) v4l2_m2m_buf_copy_metadata(src_buf, dst_buf, true); + jpeg_src_buf = vb2_to_mxc_buf(&src_buf->vb2_buf); + if (jpeg_src_buf->jpeg_parse_error) { + jpeg->slot_data[ctx->slot].used = false; + v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); + v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); + v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_ERROR); + v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_ERROR); + spin_unlock_irqrestore(&ctx->mxc_jpeg->hw_lock, flags); + v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx); + + return; + } + /* * TODO: this reset should be removed, once we figure out * how to overcome hardware issues both on encoder and decoder @@ -1483,17 +1498,13 @@ static void mxc_jpeg_buf_queue(struct vb2_buffer *vb) goto end; jpeg_src_buf = vb2_to_mxc_buf(vb); + jpeg_src_buf->jpeg_parse_error = false; ret = mxc_jpeg_parse(ctx, (u8 *)vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0), &jpeg_src_buf->dht_needed); - if (ret) { - v4l2_err(&ctx->mxc_jpeg->v4l2_dev, - "driver does not support this resolution/format\n"); - vb2_buffer_done(vb, VB2_BUF_STATE_ERROR); - - return; - } + if (ret) + jpeg_src_buf->jpeg_parse_error = true; end: v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf); From patchwork Mon Nov 2 03:08:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mirela Rabulea OSS X-Patchwork-Id: 315089 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 809BAC388F2 for ; Mon, 2 Nov 2020 03:10:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2970822268 for ; Mon, 2 Nov 2020 03:10:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="KDk8nnJd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727924AbgKBDKd (ORCPT ); Sun, 1 Nov 2020 22:10:33 -0500 Received: from mail-am6eur05on2083.outbound.protection.outlook.com ([40.107.22.83]:60192 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727883AbgKBDKa (ORCPT ); Sun, 1 Nov 2020 22:10:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bGi8v8zZiKAYexd0SkyaVsokTL82bJrHevzqTuS0tGIWWZb9tP8H9kukPF2d9xqXAc/VQzMljyMawUdNO+K5vlOk1FYgEtlUptemg8M3fmHSZF3upQpSV9suBQxTPi2UTPtSd4Syl6eOLw0sQ1ezCSfITN7eMHOioq8jgsCjlPi4Oi4pc+Ya/0uq9+mgh8UjDBxJFTKjogkz20fwnHO/Xh7Z/fxI9ZGyObj/vg1yAhCO8MKw0qoAS2g0er8tdh/9HObcpeLkGfmJaHJ+GYYsB44qSe+Ockl4uewJToRJXKF3vQDLrsFpVd+LdweDlLq3ozLGSb6Nd/9GO1Ik2yZYaw== 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-SenderADCheck; bh=sKEMAYBoI/e2uwVluhjOnAF1xshVzRKA129+ErIM+aY=; b=Xcm30ObZwd47GY9a6+P+xJwPb0OD2B2en0i4i6Ek7WmtDUE/ZwOh1MY2LDmgnbnlZ074DJaCxOoL7HCyydxukZHgrffnMSUsuqa0nZrANPomO6upSaMJZKv+LwNqTLs0e+Hin+3mwS5OtP/PmJJr0sD6EUPMIGVVVZYgX8ulF5isqgUYI/++yhbq0cJ5mM8xI3T1SpNs9DaQccOV18ikolL2j/SAVZH2ygkoxN6zizn4+hhAjs15DH/WQo6oVzqFJML7NtojoEsYElo7nQTXdeXBptSt14N9aDI8C9Di2U6cr8q2qE/2WdeCWkAiSDSo9a8hD54KrAS33mZvGdA2/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sKEMAYBoI/e2uwVluhjOnAF1xshVzRKA129+ErIM+aY=; b=KDk8nnJdF7J6es68dm8Yu6Jd9tHWa/IkJ0xI+P3EokoIj8QBnoY1uM6v/yVupV64wegPYMwY7rYJtcNHk1kui/wauRuULkUNQmtRhaHpwLroO56IXfFwmDlKRH3QDq1ACbp2rRSvenfw+l0IQy3v4ChwNmh1Q83wPPYoGpwO/Zo= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from AM5PR04MB3137.eurprd04.prod.outlook.com (2603:10a6:206:c::18) by AM6PR04MB5173.eurprd04.prod.outlook.com (2603:10a6:20b:d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Mon, 2 Nov 2020 03:10:09 +0000 Received: from AM5PR04MB3137.eurprd04.prod.outlook.com ([fe80::2d75:aaf5:5aa6:5de9]) by AM5PR04MB3137.eurprd04.prod.outlook.com ([fe80::2d75:aaf5:5aa6:5de9%6]) with mapi id 15.20.3499.029; Mon, 2 Nov 2020 03:10:09 +0000 From: "Mirela Rabulea (OSS)" To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, shawnguo@kernel.org, robh+dt@kernel.org Cc: paul.kocialkowski@bootlin.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, s.hauer@pengutronix.de, aisheng.dong@nxp.com, daniel.baluta@nxp.com, robert.chiras@nxp.com, laurentiu.palcu@nxp.com, mark.rutland@arm.com, devicetree@vger.kernel.org, p.zabel@pengutronix.de, ezequiel@collabora.com, laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, dafna.hirschfeld@collabora.com, Mirela Rabulea Subject: [PATCH v4 09/11] media: Quit parsing stream if doesn't start with SOI Date: Mon, 2 Nov 2020 05:08:19 +0200 Message-Id: <20201102030821.3049-10-mirela.rabulea@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201102030821.3049-1-mirela.rabulea@oss.nxp.com> References: <20201102030821.3049-1-mirela.rabulea@oss.nxp.com> X-Originating-IP: [86.124.170.94] X-ClientProxiedBy: AM0PR06CA0128.eurprd06.prod.outlook.com (2603:10a6:208:ab::33) To AM5PR04MB3137.eurprd04.prod.outlook.com (2603:10a6:206:c::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from fsr-ub1664-134.ea.freescale.net (86.124.170.94) by AM0PR06CA0128.eurprd06.prod.outlook.com (2603:10a6:208:ab::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Mon, 2 Nov 2020 03:10:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b8a7d44d-3589-449f-f9c6-08d87edcce6e X-MS-TrafficTypeDiagnostic: AM6PR04MB5173: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XOVY8vnSsvw32IhQDpHJv2Gji7TQH1UdupLyPnx/vuAMDNhETYtMpU5pL8QmPlrzLhW8NqOBrjqkD+QSA6NW84eMwaagArdqohe+emPtKJJiDymOBVKzCX/qRmpR/Ux4GQjk858keoiDAbMrf19w03+UELSpopMHB3u086XMa6nG13w5vSWpwScOfkpHiW5TITRmI8n2sSdBx6BFJEt+24a/beI6NX3qKkdPxcpFny1+FWxeXF6JjmB9XS/QscrJ/jKqARONe0+WjDQBFAQsKUBpvRaCWjU/qJzHLj9RAWLAoQ9nA0uoaCjkdTbsMk4/5fGnQtnA33Hvjxlo3vN5Rg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM5PR04MB3137.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(396003)(39860400002)(376002)(366004)(136003)(5660300002)(478600001)(86362001)(16526019)(186003)(8936002)(83380400001)(6512007)(6666004)(26005)(2906002)(6486002)(316002)(4326008)(66946007)(8676002)(52116002)(956004)(6506007)(1076003)(66476007)(2616005)(7416002)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ko5nrKEAGozwfIk9CVQZhjrij3ePTotHtY58BnQxiJTXUvcVXX1qU+qMhbX3KdP2sFtDOlxaoz9RiuMMmbgqwb2Qn1C4Dlk18NPLZ+B5oE2Qw2PFlJbF530cGVzO4+wCd+t4OmzQ8Ih2rt8TAtwrLii6UVkt3u8F4C1s1LuYHet/UFVwXvQ6gyp5I55C0cd6oy+PGdlNMP2Cl3CYVc9S/t2iLnCeLFy9wu31ZZnL6wDAkD4zvN0TVI3nWfGZP0BJnuvpO8fF6ccRlpOzFaOrBUKXdJb4QNab5qsVHqb/0pTJlxa7hi6453APjGZ9WaA0RbctfvJE9W9CqoJUZxmDIRQ55mc5n+3Xgj7pFYajZJuduBm6/WkZ4aYLn9hkf0XZ7mLp6NoRojWvX4vhYyBqLxfkEc1a6ActEeChn9oI9JXyCpc/t3sd9jbkKIZvjikChXtB9+f6jt3xw1w/tRdwRW8uBskwbLgGlo/aR2MIKRKKrZZmDB87gHL85btnVZ25os0m0aibuXHMUJMlzYcQiEJ+0Da3utxKPtLG0dx7ikjX+k8ZTJDqcsBEfXwgiomM6npD8LtXU+Qym8iWQFTEFYzyV45bM0Gsoxw4oeKg0wQk8RHgmrAA4Zebq4nVgipEVwTXLmULcZR592ubrI1AgQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8a7d44d-3589-449f-f9c6-08d87edcce6e X-MS-Exchange-CrossTenant-AuthSource: AM5PR04MB3137.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2020 03:10:09.5978 (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: i3lxP5CRDWtBCX2Ya1g8durDtGZvC1gZKNTdvKeyFIu6Wfr34j04LTzVUgZ7E6U1ngwJbY4l2UyuTDw/YCfgmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5173 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mirela Rabulea In the case we get an invalid stream, such as from v4l2-compliance streaming test, jpeg_next_marker will end up parsing the entire stream. The standard describes the high level syntax of a jpeg as starting with SOI, ending with EOI, so return error if the very first 2 bytes are not SOI. Signed-off-by: Mirela Rabulea --- drivers/media/v4l2-core/v4l2-jpeg.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-jpeg.c b/drivers/media/v4l2-core/v4l2-jpeg.c index a8198f98c158..244feccc4ea0 100644 --- a/drivers/media/v4l2-core/v4l2-jpeg.c +++ b/drivers/media/v4l2-core/v4l2-jpeg.c @@ -497,11 +497,8 @@ int v4l2_jpeg_parse_header(void *buf, size_t len, struct v4l2_jpeg_header *out) out->num_dht = 0; out->num_dqt = 0; - /* the first marker must be SOI */ - marker = jpeg_next_marker(&stream); - if (marker < 0) - return marker; - if (marker != SOI) + /* the first bytes must be SOI, B.2.1 High-level syntax */ + if (jpeg_get_word_be(&stream) != SOI) return -EINVAL; /* init value to signal if this marker is not present */ From patchwork Mon Nov 2 03:08:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mirela Rabulea OSS X-Patchwork-Id: 315088 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB5E4C2D0A3 for ; Mon, 2 Nov 2020 03:10:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 799C7222E8 for ; Mon, 2 Nov 2020 03:10:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="WEysVUep" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727958AbgKBDKl (ORCPT ); Sun, 1 Nov 2020 22:10:41 -0500 Received: from mail-am6eur05on2083.outbound.protection.outlook.com ([40.107.22.83]:60192 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727883AbgKBDKk (ORCPT ); Sun, 1 Nov 2020 22:10:40 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R/+BH2B5xOGN41WOrojweZOCi9IHfK60NvTcPbwgItndyh/txrcmk3QyIa2VkueSBiXaE/il4Y9aGJdpOo+iBlBzzk+G8FYow3Zp+4KhODrjf53gL/XKDOysARoyGRjrO0IebOSv1qOImg9NZL5x/sLEdTntAknNLua9+wMBuiijtbpswcxnR0DP2mPwVRYRm2aJQtU56YAavLGhFjexR1VwEg4oGERZI0NASI7s/tCUN2nO88krzulkRqr2k7re9Kr2QH7JVlFGSzqXE9CTc7n8Jc+YdegPXJIi5vWsr8dQzU0z6QRIsm+kJ1yijI0hay9SVhJaPETD4LweeHhD2w== 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-SenderADCheck; bh=0yMD4Wz4QFd+9EyF0WjHoRFqnk5QYX6Y0mzrwKzR/iI=; b=jk6hMCTSCb+bIENVgCfHDi/PH6xkw6jTyYSjSe7ONubShYPE4cTZCF/svqWxF9U+X17Fr8jwgdZDLE4Pc4QyWOJp/SjAS5LDrWJGTylzrvWdpvYWYRdD4hJUZ8V4v5j6Rr4bZ1VC1AZ4Wrt156aVLYZWGKQgUEekIVogs5e6QpBCp3K7ISjXDs1EsvyqHjB+HHXEqzVbspTaBwFofQFuwds8+pYQmnEgmJqJMbtdLtRiul2jjkj7R1v4b9C3ibpFQrehU3BXiKDDrnj7f4L35XUI4ASBMAntFJvqLQksiDvo0uEkJ7iHz/5ZqVup6BdrmqWAR2Y3XHADKySYsvUe1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0yMD4Wz4QFd+9EyF0WjHoRFqnk5QYX6Y0mzrwKzR/iI=; b=WEysVUep0JR+ibZOcbuz92VXMHpHwaxpCINsDcFkcG5KXcyPWfkUZgbWivgJrZzdXJrTCViHNMFoTAvAd5bFSDEo0110r7OeZfw2odHbBnCnX2ONqKcZ5u9GY0DOqBrY3ioPylOseEBtf28w+jcyZWGkEEhVPYKynTuX58E2ttA= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from AM5PR04MB3137.eurprd04.prod.outlook.com (2603:10a6:206:c::18) by AM6PR04MB5173.eurprd04.prod.outlook.com (2603:10a6:20b:d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Mon, 2 Nov 2020 03:10:13 +0000 Received: from AM5PR04MB3137.eurprd04.prod.outlook.com ([fe80::2d75:aaf5:5aa6:5de9]) by AM5PR04MB3137.eurprd04.prod.outlook.com ([fe80::2d75:aaf5:5aa6:5de9%6]) with mapi id 15.20.3499.029; Mon, 2 Nov 2020 03:10:12 +0000 From: "Mirela Rabulea (OSS)" To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, shawnguo@kernel.org, robh+dt@kernel.org Cc: paul.kocialkowski@bootlin.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, s.hauer@pengutronix.de, aisheng.dong@nxp.com, daniel.baluta@nxp.com, robert.chiras@nxp.com, laurentiu.palcu@nxp.com, mark.rutland@arm.com, devicetree@vger.kernel.org, p.zabel@pengutronix.de, ezequiel@collabora.com, laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, dafna.hirschfeld@collabora.com, Mirela Rabulea Subject: [PATCH v4 11/11] media: imx-jpeg: Use v4l2 jpeg helpers in mxc-jpeg Date: Mon, 2 Nov 2020 05:08:21 +0200 Message-Id: <20201102030821.3049-12-mirela.rabulea@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201102030821.3049-1-mirela.rabulea@oss.nxp.com> References: <20201102030821.3049-1-mirela.rabulea@oss.nxp.com> X-Originating-IP: [86.124.170.94] X-ClientProxiedBy: AM0PR06CA0128.eurprd06.prod.outlook.com (2603:10a6:208:ab::33) To AM5PR04MB3137.eurprd04.prod.outlook.com (2603:10a6:206:c::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from fsr-ub1664-134.ea.freescale.net (86.124.170.94) by AM0PR06CA0128.eurprd06.prod.outlook.com (2603:10a6:208:ab::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Mon, 2 Nov 2020 03:10:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2cae1702-4772-4b61-1aa1-08d87edcd02e X-MS-TrafficTypeDiagnostic: AM6PR04MB5173: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MG90xhXOZBTb4TaDtdarG4wwzAAMM+gOZb/0oqbYPKZlBOtzox3JeDoJyh4M22f8erULOh4iR8ZT4dZSNqJ0m9Nz2lu7WszhXrGaxAMYqhJV22FR3W+mzdk+YmonRf7cUlu1MZbbZIp2y/Yre/NE7PezlT0xjxHb7+cdGy6FNJ2HlC/rauQzROzPRVs59b1cmyAcqlRmzyKUbUCzi1ZnP9gi+cz9Xdbs8BPB8DU4svN4CYWkC5D7QJRZw2Nbub/CAIbZ8R5ZC24y8tFS6KHUDsWl8CLiFBGPC2vfXVWxEc2TA/Pjtm5z7ujRgk3uJo0sCUtN8JybY0mUCRstHdcFRQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM5PR04MB3137.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(396003)(39860400002)(376002)(366004)(136003)(5660300002)(478600001)(30864003)(86362001)(16526019)(186003)(8936002)(83380400001)(6512007)(6666004)(26005)(2906002)(6486002)(316002)(4326008)(66946007)(8676002)(52116002)(956004)(6506007)(1076003)(66476007)(2616005)(7416002)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: voL5wha14p1qE69D4O+Ias60jihDkdb5hXXJhRu6VLQkP7FZkjRpHOUW3rKDf0HCWxOCWhjpxr6jGCFQCqg0kFCkJFVVpBJtgfFTO51Sen0ECR+qLJJaY43xJEZUj2TRSTdDuhGOs7irmpeu3fbaFZhdG+u4V0VOkAFMgs+WzkRM/trQsLkhtQz5in2w3s0t0ldRyT9bzYhuQsQD+37/fRw7k0K40WUTeRB3LdQWMMhm/AiCKs0OnM6cg+y7C+xEsniA2Mg7rLX/QqEzUvY1SHfwJIwrT61lWtzXmk2GfTXLGKTd7ajzCFF+Mj9Xj+FUlpJ2I8Hzf0p2LD1oqSdyrwFl40vE22bfktGCHVw+7WWgfopsAjt+lrKtyEr1k5euxqEDYbKEdvvR/7+GsKZu+etFvhObW0k9LXEOZgSWUHyhKa5stJRjrYqWC/n8XvtCV+8v/l8/rvsF+fseISOkOJbqtIsb0A08LMTKPYGQ+WCmgTwaBH8yGThp9ZZhqiw2uRyvOwvEz8NBXDzqBNBWCWtcAnESFf6IuDsJDOUoCjRkK3BrQ19n8pcw3H7X2YsKVyLrJUAv8QVnbVRooevlj672c5kUMjSb21JVr/Gjhs4rtQfPaUD+QhW718T2MYfQUro2qAjQYsVfMbVX65YuVA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2cae1702-4772-4b61-1aa1-08d87edcd02e X-MS-Exchange-CrossTenant-AuthSource: AM5PR04MB3137.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2020 03:10:12.5471 (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: e+6CRb8kkqmkzmPeb+dG560NNwobPOgwilOB5Tl7NEWBI5Kf70nvNAmaO93HxPXcmGc5yCYT+1/xZSDOr80czw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5173 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Mirela Rabulea Use v4l2_jpeg_parse_header in mxc_jpeg_parse, remove the old parsing way, which was duplicated in other jpeg drivers. Signed-off-by: Mirela Rabulea --- drivers/media/platform/imx-jpeg/Kconfig | 1 + drivers/media/platform/imx-jpeg/mxc-jpeg.c | 261 ++++++--------------- drivers/media/platform/imx-jpeg/mxc-jpeg.h | 26 +- 3 files changed, 83 insertions(+), 205 deletions(-) diff --git a/drivers/media/platform/imx-jpeg/Kconfig b/drivers/media/platform/imx-jpeg/Kconfig index 7cc89e5eff90..d875f7c88cda 100644 --- a/drivers/media/platform/imx-jpeg/Kconfig +++ b/drivers/media/platform/imx-jpeg/Kconfig @@ -4,6 +4,7 @@ config VIDEO_IMX8_JPEG depends on VIDEO_DEV && VIDEO_V4L2 select VIDEOBUF2_DMA_CONTIG select V4L2_MEM2MEM_DEV + select V4L2_JPEG_HELPER default m help This is a video4linux2 driver for the i.MX8 QXP/QM integrated diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/imx-jpeg/mxc-jpeg.c index d87f99caf124..61c6a3bd8cbd 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -52,6 +52,7 @@ #include #include +#include #include #include #include @@ -65,12 +66,16 @@ static struct mxc_jpeg_fmt mxc_formats[] = { { .name = "JPEG", .fourcc = V4L2_PIX_FMT_JPEG, + .subsampling = -1, + .nc = -1, .colplanes = 1, .flags = MXC_JPEG_FMT_TYPE_ENC, }, { .name = "RGB", /*RGBRGB packed format*/ .fourcc = V4L2_PIX_FMT_RGB24, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_444, + .nc = 3, .depth = 24, .colplanes = 1, .h_align = 3, @@ -80,6 +85,8 @@ static struct mxc_jpeg_fmt mxc_formats[] = { { .name = "ARGB", /* ARGBARGB packed format */ .fourcc = V4L2_PIX_FMT_ARGB32, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_444, + .nc = 4, .depth = 32, .colplanes = 1, .h_align = 3, @@ -89,6 +96,8 @@ static struct mxc_jpeg_fmt mxc_formats[] = { { .name = "YUV420", /* 1st plane = Y, 2nd plane = UV */ .fourcc = V4L2_PIX_FMT_NV12, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_420, + .nc = 3, .depth = 12, /* 6 bytes (4Y + UV) for 4 pixels */ .colplanes = 2, /* 1 plane Y, 1 plane UV interleaved */ .h_align = 4, @@ -98,6 +107,8 @@ static struct mxc_jpeg_fmt mxc_formats[] = { { .name = "YUV422", /* YUYV */ .fourcc = V4L2_PIX_FMT_YUYV, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_422, + .nc = 3, .depth = 16, .colplanes = 1, .h_align = 4, @@ -107,6 +118,8 @@ static struct mxc_jpeg_fmt mxc_formats[] = { { .name = "YUV444", /* YUVYUV */ .fourcc = V4L2_PIX_FMT_YUV24, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_444, + .nc = 3, .depth = 24, .colplanes = 1, .h_align = 3, @@ -116,6 +129,8 @@ static struct mxc_jpeg_fmt mxc_formats[] = { { .name = "Gray", /* Gray (Y8/Y12) or Single Comp */ .fourcc = V4L2_PIX_FMT_GREY, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY, + .nc = 1, .depth = 8, .colplanes = 1, .h_align = 3, @@ -406,33 +421,6 @@ static enum mxc_jpeg_image_format mxc_jpeg_fourcc_to_imgfmt(u32 fourcc) } } -static int mxc_jpeg_imgfmt_to_fourcc(enum mxc_jpeg_image_format imgfmt, - u32 *fourcc) -{ - switch (imgfmt) { - case MXC_JPEG_GRAY: - *fourcc = V4L2_PIX_FMT_GREY; - return 0; - case MXC_JPEG_YUV422: - *fourcc = V4L2_PIX_FMT_YUYV; - return 0; - case MXC_JPEG_YUV420: - *fourcc = V4L2_PIX_FMT_NV12; - return 0; - case MXC_JPEG_YUV444: - *fourcc = V4L2_PIX_FMT_YUV24; - return 0; - case MXC_JPEG_RGB: - *fourcc = V4L2_PIX_FMT_RGB24; - return 0; - case MXC_JPEG_ARGB: - *fourcc = V4L2_PIX_FMT_ARGB32; - return 0; - default: - return 1; - } -} - static struct mxc_jpeg_q_data *mxc_jpeg_get_q_data(struct mxc_jpeg_ctx *ctx, enum v4l2_buf_type type) { @@ -1152,45 +1140,6 @@ static void mxc_jpeg_stop_streaming(struct vb2_queue *q) release_active_buffers(q, VB2_BUF_STATE_ERROR); } -struct mxc_jpeg_stream { - u8 *addr; - u32 loc; - u32 end; -}; - -static u8 get_byte(struct mxc_jpeg_stream *stream) -{ - u8 ret; - - if (stream->loc >= stream->end) - return -1; - ret = stream->addr[stream->loc]; - stream->loc++; - return ret; -} - -static int get_sof(struct device *dev, - struct mxc_jpeg_stream *stream, - struct mxc_jpeg_sof *sof) -{ - int i; - - if (stream->loc + sizeof(struct mxc_jpeg_sof) >= stream->end) - return -1; - memcpy(sof, &stream->addr[stream->loc], sizeof(struct mxc_jpeg_sof)); - _bswap16(&sof->length); - _bswap16(&sof->height); - _bswap16(&sof->width); - dev_dbg(dev, "JPEG SOF: precision=%d\n", sof->precision); - dev_dbg(dev, "JPEG SOF: height=%d, width=%d\n", - sof->height, sof->width); - for (i = 0; i < sof->components_no; i++) { - dev_dbg(dev, "JPEG SOF: comp_id=%d, H=0x%x, V=0x%x\n", - sof->comp[i].id, sof->comp[i].v, sof->comp[i].h); - } - return 0; -} - static int mxc_jpeg_valid_comp_id(struct device *dev, struct mxc_jpeg_sof *sof, struct mxc_jpeg_sos *sos) @@ -1220,45 +1169,18 @@ static int mxc_jpeg_valid_comp_id(struct device *dev, return valid; } -static enum mxc_jpeg_image_format -mxc_jpeg_get_image_format(struct device *dev, const struct mxc_jpeg_sof *sof) +static u32 mxc_jpeg_get_image_format(struct device *dev, + const struct v4l2_jpeg_header header) { - if (sof->components_no == 1) { - dev_dbg(dev, "IMAGE_FORMAT is: MXC_JPEG_GRAY\n"); - return MXC_JPEG_GRAY; - } - if (sof->components_no == 3) { - if (sof->comp[0].h == 2 && sof->comp[0].v == 2 && - sof->comp[1].h == 1 && sof->comp[1].v == 1 && - sof->comp[2].h == 1 && sof->comp[2].v == 1){ - dev_dbg(dev, "IMAGE_FORMAT is: MXC_JPEG_YUV420\n"); - return MXC_JPEG_YUV420; - } - if (sof->comp[0].h == 2 && sof->comp[0].v == 1 && - sof->comp[1].h == 1 && sof->comp[1].v == 1 && - sof->comp[2].h == 1 && sof->comp[2].v == 1){ - dev_dbg(dev, "IMAGE_FORMAT is: MXC_JPEG_YUV422\n"); - return MXC_JPEG_YUV422; - } - if (sof->comp[0].h == 1 && sof->comp[0].v == 1 && - sof->comp[1].h == 1 && sof->comp[1].v == 1 && - sof->comp[2].h == 1 && sof->comp[2].v == 1){ - dev_dbg(dev, "IMAGE_FORMAT is: MXC_JPEG_YUV444\n"); - return MXC_JPEG_YUV444; - } - } - if (sof->components_no == 4) { - if (sof->comp[0].h == 1 && sof->comp[0].v == 1 && - sof->comp[1].h == 1 && sof->comp[1].v == 1 && - sof->comp[2].h == 1 && sof->comp[2].v == 1 && - sof->comp[3].h == 1 && sof->comp[3].v == 1){ - /* this is not tested */ - dev_dbg(dev, "IMAGE_FORMAT is: MXC_JPEG_ARGB\n"); - return MXC_JPEG_ARGB; - } - } + int i; + + for (i = 0; i < MXC_JPEG_NUM_FORMATS; i++) + if (mxc_formats[i].subsampling == header.frame.subsampling && + mxc_formats[i].nc == header.frame.num_components) + return mxc_formats[i].fourcc; + dev_err(dev, "Could not identify image format\n"); - return MXC_JPEG_INVALID; + return 0; } static void mxc_jpeg_bytesperline(struct mxc_jpeg_q_data *q, @@ -1312,112 +1234,71 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, struct device *dev = ctx->mxc_jpeg->dev; struct mxc_jpeg_q_data *q_data_out, *q_data_cap; enum v4l2_buf_type cap_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; - struct mxc_jpeg_stream stream; - bool notfound = true; - bool app14 = false; bool src_chg = false; - u8 app14_transform = 0; - struct mxc_jpeg_sof sof, *psof = 0; - struct mxc_jpeg_sos *psos = 0; - u8 byte, *next = 0; - enum mxc_jpeg_image_format img_fmt; u32 fourcc; + struct v4l2_jpeg_header header; + struct v4l2_jpeg_app14_data app14; + struct mxc_jpeg_sof *psof = 0; + struct mxc_jpeg_sos *psos = 0; + int ret; - memset(&sof, 0, sizeof(struct mxc_jpeg_sof)); - stream.addr = src_addr; - stream.end = size; - stream.loc = 0; - *dht_needed = true; - while (notfound) { - byte = get_byte(&stream); - if (byte == -1) - return -EINVAL; - if (byte != 0xff) - continue; - do { - byte = get_byte(&stream); - } while (byte == 0xff); - if (byte == -1) - return false; - if (byte == 0) - continue; - switch (byte) { - case DHT: - /* DHT marker present, no need to inject default one */ - *dht_needed = false; - break; - case SOF2: /* Progressive DCF frame definition */ - dev_err(dev, - "Progressive JPEG not supported by hardware"); - return -EINVAL; - case SOF1: /* Extended sequential DCF frame definition */ - case SOF0: /* Baseline sequential DCF frame definition */ - if (get_sof(dev, &stream, &sof) == -1) - break; - next = stream.addr + stream.loc; - psof = (struct mxc_jpeg_sof *)next; - break; - case SOS: - next = stream.addr + stream.loc; - psos = (struct mxc_jpeg_sos *)next; - notfound = false; - break; - case APP14: - app14 = true; - /* - * Application Data Syntax is: - * 2 bytes(APPn:0xFF,0xEE), 2 bytes(Lp), Ap1...ApLp-2 - * The transform flag is in Ap12 - * stream.loc is now on APPn-0xEE byte - */ - app14_transform = *(stream.addr + stream.loc + 12 + 1); - break; - default: - notfound = true; - } + memset(&header, 0, sizeof(header)); + header.app14 = &app14; + ret = v4l2_jpeg_parse_header((void *)src_addr, size, &header); + if (ret < 0) { + dev_err(dev, "Error parsing JPEG stream markers\n"); + return ret; } + + /* if DHT marker present, no need to inject default one */ + *dht_needed = (header.num_dht == 0); + q_data_out = mxc_jpeg_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); if (q_data_out->w == 0 && q_data_out->h == 0) { dev_warn(dev, "Invalid user resolution 0x0"); dev_warn(dev, "Keeping resolution from JPEG: %dx%d", - sof.width, sof.height); - q_data_out->w = sof.width; - q_data_out->h = sof.height; - } else if (sof.width != q_data_out->w || sof.height != q_data_out->h) { + header.frame.width, header.frame.height); + q_data_out->w = header.frame.width; + q_data_out->h = header.frame.height; + } else if (header.frame.width != q_data_out->w || + header.frame.height != q_data_out->h) { dev_err(dev, "Resolution mismatch: %dx%d (JPEG) versus %dx%d(user)", - sof.width, sof.height, q_data_out->w, q_data_out->h); + header.frame.width, header.frame.height, + q_data_out->w, q_data_out->h); return -EINVAL; } - if (sof.width % 8 != 0 || sof.height % 8 != 0) { + if (header.frame.width % 8 != 0 || header.frame.height % 8 != 0) { dev_err(dev, "JPEG width or height not multiple of 8: %dx%d\n", - sof.width, sof.height); + header.frame.width, header.frame.height); return -EINVAL; } - if (sof.width > MXC_JPEG_MAX_WIDTH || - sof.height > MXC_JPEG_MAX_HEIGHT) { + if (header.frame.width > MXC_JPEG_MAX_WIDTH || + header.frame.height > MXC_JPEG_MAX_HEIGHT) { dev_err(dev, "JPEG width or height should be <= 8192: %dx%d\n", - sof.width, sof.height); + header.frame.width, header.frame.height); return -EINVAL; } - if (sof.width < MXC_JPEG_MIN_WIDTH || - sof.height < MXC_JPEG_MIN_HEIGHT) { + if (header.frame.width < MXC_JPEG_MIN_WIDTH || + header.frame.height < MXC_JPEG_MIN_HEIGHT) { dev_err(dev, "JPEG width or height should be > 64: %dx%d\n", - sof.width, sof.height); + header.frame.width, header.frame.height); return -EINVAL; } - if (sof.components_no > MXC_JPEG_MAX_COMPONENTS) { + if (header.frame.num_components > V4L2_JPEG_MAX_COMPONENTS) { dev_err(dev, "JPEG number of components should be <=%d", - MXC_JPEG_MAX_COMPONENTS); + V4L2_JPEG_MAX_COMPONENTS); return -EINVAL; } /* check and, if necessary, patch component IDs*/ + psof = (struct mxc_jpeg_sof *)header.sof.start; + psos = (struct mxc_jpeg_sos *)header.sos.start; if (!mxc_jpeg_valid_comp_id(dev, psof, psos)) dev_warn(dev, "JPEG component ids should be 0-3 or 1-4"); - img_fmt = mxc_jpeg_get_image_format(dev, &sof); - if (img_fmt == MXC_JPEG_INVALID) + fourcc = mxc_jpeg_get_image_format(dev, header); + if (fourcc == 0) return -EINVAL; /* @@ -1425,12 +1306,11 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, * encoded with 3 components have RGB colorspace, see Recommendation * ITU-T T.872 chapter 6.5.3 APP14 marker segment for colour encoding */ - if (img_fmt == MXC_JPEG_YUV444 && app14 && app14_transform == 0) - img_fmt = MXC_JPEG_RGB; - - if (mxc_jpeg_imgfmt_to_fourcc(img_fmt, &fourcc)) { - dev_err(dev, "Fourcc not found for %d", img_fmt); - return -EINVAL; + if (fourcc == V4L2_PIX_FMT_YUV24 || fourcc == V4L2_PIX_FMT_RGB24) { + if (header.app14 && header.app14->transform_flag == 0) + fourcc = V4L2_PIX_FMT_RGB24; + else + fourcc = V4L2_PIX_FMT_YUV24; } /* @@ -1438,10 +1318,11 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, * detected from the jpeg output stream */ q_data_cap = mxc_jpeg_get_q_data(ctx, cap_type); - if (q_data_cap->w != sof.width || q_data_cap->h != sof.height) + if (q_data_cap->w != header.frame.width || + q_data_cap->h != header.frame.height) src_chg = true; - q_data_cap->w = sof.width; - q_data_cap->h = sof.height; + q_data_cap->w = header.frame.width; + q_data_cap->h = header.frame.height; q_data_cap->fmt = mxc_jpeg_find_format(ctx, fourcc); q_data_cap->w_adjusted = q_data_cap->w; q_data_cap->h_adjusted = q_data_cap->h; @@ -1469,7 +1350,7 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, } /* setup bytesperline/sizeimage for capture queue */ - mxc_jpeg_bytesperline(q_data_cap, sof.precision); + mxc_jpeg_bytesperline(q_data_cap, header.frame.precision); mxc_jpeg_sizeimage(q_data_cap); /* diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.h b/drivers/media/platform/imx-jpeg/mxc-jpeg.h index 5c9abeaa8bd6..a88ecccf0a47 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.h +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.h @@ -42,6 +42,8 @@ enum mxc_jpeg_mode { * struct jpeg_fmt - driver's internal color format data * @name: format description * @fourcc: fourcc code, 0 if not applicable + * @subsampling subsampling of jpeg components + * @nc: number of color components * @depth: number of bits per pixel * @colplanes: number of color planes (1 for packed formats) * @h_align: horizontal alignment order (align to 2^h_align) @@ -49,13 +51,15 @@ enum mxc_jpeg_mode { * @flags: flags describing format applicability */ struct mxc_jpeg_fmt { - char *name; - u32 fourcc; - int depth; - int colplanes; - int h_align; - int v_align; - u32 flags; + char *name; + u32 fourcc; + enum v4l2_jpeg_chroma_subsampling subsampling; + int nc; + int depth; + int colplanes; + int h_align; + int v_align; + u32 flags; }; struct mxc_jpeg_desc { @@ -121,14 +125,6 @@ struct mxc_jpeg_dev { struct device_link **pd_link; }; -/* JPEG marker identifiers */ -#define SOF0 0xC0 -#define SOF1 0xC1 -#define SOF2 0xC2 -#define SOS 0xDA -#define DHT 0xC4 -#define APP14 0xEE - /** * struct mxc_jpeg_sof_comp - JPEG Start Of Frame component fields * @id: component id