From patchwork Mon May 30 07:48:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12864346 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 69C7FC433FE for ; Mon, 30 May 2022 07:49:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230079AbiE3Ht0 (ORCPT ); Mon, 30 May 2022 03:49:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232149AbiE3Hs4 (ORCPT ); Mon, 30 May 2022 03:48:56 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60044.outbound.protection.outlook.com [40.107.6.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B31B71D8B; Mon, 30 May 2022 00:48:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K+KCWI+7iUp8grU/4Q07wgC4uDh6RpOQelIbg4gEOh/7s0T3Bw5J0O4bwXbCYiayyvAMqW/N53efXiYegez0z5C/agEYvTZ+6Cww7Sc+721UkcqRoKRNL+b3vN0HaagTInxBObecD2W0dVruDj9tFwFRiLSmsxeQmKoklHwTLkTWTdl8WSxenuNZZLd4Q758NssWyTK4OYed7RRykqjMNO7VeLV2Ul8Me28T+AGG0dI8ENjEUJPkLSKA/iyOM4x54PL78ysMqMt1Z1E+06OGG575DSUmxrleYRgMQR7/uutTQSMBd+a47SOJGjwkrOzXlN17hk0QZYkX8v4aXsHJpQ== 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=wldO5Mwxe7XSyHRxNqBjPrwzyUBp+vSZB1mEGZn6yvI=; b=J7OSGAe5AbK1K2yt99b4vd05ZaQERlHOXLGxhbDJPB3Vg1P/nLKC68y/BbsrxfJV/aze0uQ5tOvzzJUEATH1YfvpPDThXQBLujP/ILvh9XLbID5eKlDNfdr2290Ww08CebL/zLlxHYSQ7B8VixhfTE869pYJvdanta74VySDIP6LJ1Dwe/ljDZwUKd5JqV6fm7b/3Gi7gSvQiptedJ0JDrnub0TrTTB+TJ1P3NFL+KcPyoSJKpZNKJIUrEu5AMrrnwGeGD+W1W4u8d8a38hRqYYONyYMAsKm2dgJc8usGbbdBL7Ai3Xe3B4i1ukkImGYtsg2XJsHkfhROWAYLhAiIA== 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=wldO5Mwxe7XSyHRxNqBjPrwzyUBp+vSZB1mEGZn6yvI=; b=bfSZitAGSCd0yLB4B1zMA5WxkoUl1jGI6PCIyB01WdKX8/ajjJilDAXi3wCWfGxN9DjhtBEu4N66Op8Lm/sKO6VEUfULV/PaoLHKyl0hbBYcnHg94SIQYs0XY2geil/szeiCnpx8XsbeLmbvXMDmMWuZ3fgFNeI2w/6YvkSrj/4= 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 DB7PR04MB5452.eurprd04.prod.outlook.com (2603:10a6:10:84::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.19; Mon, 30 May 2022 07:48:53 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::bc48:7565:c619:62c3]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::bc48:7565:c619:62c3%7]) with mapi id 15.20.5293.018; Mon, 30 May 2022 07:48:52 +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, 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 v3] media: imx-jpeg: Leave a blank space before the configuration data Date: Mon, 30 May 2022 15:48:37 +0800 Message-Id: <20220530074837.14643-1-ming.qian@nxp.com> X-Mailer: git-send-email 2.36.1 X-ClientProxiedBy: SI2PR02CA0054.apcprd02.prod.outlook.com (2603:1096:4:196::13) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 13a97624-765f-4d06-eb36-08da4210d759 X-MS-TrafficTypeDiagnostic: DB7PR04MB5452:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BXY0JuE7cr3+kCGRhNZHsbcqdD2FPxwBhopxbZAS7bF+Szo+09bVifrOLyWmCwF2hqO4JD8YzuFJ1L6sbXMH+8u5PjbIf3D7X5LeTWLvDEaygLMSNldX187SNK+rvvrHpa5uXYIdUgYTqV6KRGTHSnLCmMlJDSDegyorOyuksUhq5FzDw7P2Rzya2nSdnplehmh4eQPiiQplsQL2SmA9Pn561u1hRvsX6BEmWELR6UEPfKEnjDP5jDjU4eKTcRkWVsJ8SIgTBy2M3E6jBuOdqjV/ePdrK1pcXImco09NF7F54H1iQP3LhUnKgcOkZXcGPH+c1BoZuGJr3NZSfBbYQuRcPAxFDdrSzrTBcJ8KNhr+IjoIyVXTyA2teDAIw4c3DAwqVNx/gxAABteafKdJp55za+5H3l8s5GRuyZRoFud+00ZPE5CgQW6ef8eSeoRgJ4zcPT1ft9H7X9U6Bak/tnLi+vFuZBrJTsvmujBfRd7gPRcIqg1KxmzhYDwafW2rWPOsgEO2YKkOEzv9wKiFZxD4M+75/SzKnQ/7uyzHVlebRFBnHN6ZNGAy06t2yQTRfF87hbE8uNXg1G8ZRWEmtNIX5ysGvQSzHtQZeb6Kc53RLoGAFZihaGG8uYrGTn3pxPouH47MntJ0GTDapsJnAPJ/A64Xf1h+7d96+Tr7HAfh81MQdMscSt58rFbLiTu8ThpgPhdqOYSPmrnYDK8JCw== 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:(13230001)(4636009)(366004)(38350700002)(66556008)(66946007)(66476007)(36756003)(38100700002)(7416002)(6666004)(316002)(8936002)(1076003)(86362001)(186003)(5660300002)(52116002)(2616005)(2906002)(4326008)(8676002)(508600001)(83380400001)(26005)(6506007)(6512007)(44832011)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WSLJZjytOFxPno2ahuUExXpiZKtscJN3bXdd+/6zEk1PHfqDsCUZhJ/DjQdXxJ8p9r3hZVKsziwupZL14lSftY/JwFlcxN5xhHgHfU1eKOUMMq2DmQ+H/xPm+qbc6iTL3+sVy9OI3c/XUpIpc2pPrUlCjHvM6RqaqSvrfEZvN9/w5IqKcrVUFAKFx436JtdQhTpiT3kClPEnid4RgayF5DPtThOCEskme9dR5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udObIIaAwk+wsQZBGG4ib2wfHBvjXGMO3O5ZKayo0VaQnTx+9hMU6+0LXLhJbjoqkS4U7FviDxb+yKeG0O+QT7DU91Hoj6IBNrbTP9RVQ+CxdUnRMgLt04U+pm6+ZsynmNy4KJRd7QaxhCakyWB3neMAq0bSMQaXbyp74fGXJZ+wYnoQhJVgDf/ggw7s8uMOR8d5MBbe573DPw1o6UCaRItAIHOSezA2B7CUjANUJhqMXEd4O9UIB9ZojJ7GpZUJOADrTI6RCwEhMfuD52i6Ee6aIp8c4ll/t8WLaonn6aCf5T9ZrOCIWkgnnAu5lUo/WlFCjndUghINnT+pBok5kz75a9UsPU2ZZIZeXvb/mEDqLm9Yz+pWxctZ/za1B4WIySHxwoL2smcN42NRzeTesBnMfhYzWMUXWQ50Y4eesNujGvtNIKrxJUHeXyYd3EnpVC81mA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 13a97624-765f-4d06-eb36-08da4210d759 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2022 07:48:52.8594 (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: yQRHCv46q0qFjiKea85XZ/THOeaGZ5nOovNKoyhO0lMPToI+4e+xY/ZKf8q6z1MCnMTYl8wPdNhIxMoNjVP7/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB5452 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There is a hardware bug that it will load the first 128 bytes of configuration data twice, it will led to some configure error. so shift the configuration data 128 bytes, and make the first 128 bytes all zero, then hardware will load the 128 zero twice, and ignore them as garbage. then the configuration data can be loaded correctly Fixes: 2db16c6ed72ce ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder") Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Reviewed-by: Tommaso Merciai --- v3 - add Fixes tag v2 - add some comments about why the 0x80 offset is needed drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index 734e1b65fbc7..c0fd030d0f19 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -519,6 +519,7 @@ static bool mxc_jpeg_alloc_slot_data(struct mxc_jpeg_dev *jpeg, GFP_ATOMIC); if (!cfg_stm) goto err; + memset(cfg_stm, 0, MXC_JPEG_MAX_CFG_STREAM); jpeg->slot_data[slot].cfg_stream_vaddr = cfg_stm; skip_alloc: @@ -755,7 +756,13 @@ static unsigned int mxc_jpeg_setup_cfg_stream(void *cfg_stream_vaddr, u32 fourcc, u16 w, u16 h) { - unsigned int offset = 0; + /* + * There is a hardware issue that first 128 bytes of configuration data + * can't be loaded correctly. + * To avoid this issue, we need to write the configuration from + * an offset which should be no less than 0x80 (128 bytes). + */ + unsigned int offset = 0x80; u8 *cfg = (u8 *)cfg_stream_vaddr; struct mxc_jpeg_sof *sof; struct mxc_jpeg_sos *sos;