Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2410879ioo; Sat, 28 May 2022 12:45:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOIFKCaZoTNxecN6Im2rMNZV6kgLrqJvdpu0xrZIN9FxYTpj+7lQynRRcDyMKgapZFMvfD X-Received: by 2002:a17:902:b703:b0:158:2667:7447 with SMTP id d3-20020a170902b70300b0015826677447mr48520114pls.92.1653767128867; Sat, 28 May 2022 12:45:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1653767128; cv=pass; d=google.com; s=arc-20160816; b=r63VMdBFPfOnwNA92W/ZYbhCB+UgXtNeYV0TOaoQxv7vI9XyZ6X2M0KONKhNdopMSL fo4fIAlurnazm/G7sN6ED6do5rsjMQFqaVOCgsfwWm0CaE24SVVbJY1xRXMvT3RgdRZI ibvsgtPczu+nU6Derrqs6qyCCHPYDzx7mGjCctEtwTNQJfft9rPpzYyrACo8+zMde6TU PgoGcyiysm/pH7EfeBZADtcUF55gEmHdkZu+8JVb4w4qXiVOawBjHVTQBDsjm32gHMow LxVnRCV/5Of+kWyap3A9G9JerrdTfWOf2BBQVCSkOGooU0DatIksXMi3wfKv5FuRbe7n qYWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=KoCzVMO2TSbL/kzMGVx0A/9AHGeZIpTfvLyq7cJkP3o=; b=RdzDdq7GAt82/gM5JBv5nAvMnorE11D6kzdq+5NxHtpZ4zolT8kO3+AbJQRp4zeTfE G7V70GZ9cokFVkR/ZAwe0Ah5XSv20RMJGlLeNrxroxFeExMePbLv2WrEKoP1mI6mkUsS tF52Zh5zc2xJOCsgtodTcOqMxIoBkt3q5HcuMQaQVUNxqJ+TgaOVRAH/PtOlNoAvZrZF 5+6lDfIqSoxaIbbEtIljvP/RmaVWAea27QROM3ZtQBVosSsk7btTtzP9L9JX9HItp7oG mNGV4X38pt2clIN3zYmWTofPxVTEQgmzgkgXQaqCR0wBt0842qjkdgd92msvpQ4Q1Hfg U4TA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=AhPuv42T; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t11-20020a65608b000000b003f25f65e382si10480357pgu.658.2022.05.28.12.45.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 12:45:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=AhPuv42T; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 41FF266C9F; Sat, 28 May 2022 12:08:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350927AbiE0KZL (ORCPT + 99 others); Fri, 27 May 2022 06:25:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234079AbiE0KZH (ORCPT ); Fri, 27 May 2022 06:25:07 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2070.outbound.protection.outlook.com [40.107.22.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CCED61295; Fri, 27 May 2022 03:25:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VMX4sCEBcxpJNVhcjJweBV1fhZGRn5HJVQVl9bhWLt7bqphaiYaQ/BKZHcIIX6ONcQDrSgIrzw1NyQ+DgyUKwKcRjwn8JjAS/FqPZXfHGB/MHNaRa3N34jRyJytNMitC6iQPxb7rlpVFbQAZkQBBK7506jLX0fqRRvdGjzJmmVpIG9G0cS+P43vUG9bPN55E7FSA9OINSSuVWUs3KOADlgyREVPcA7KEMMJDovW0V7yuYpUTx5J3wpLkzooGgB9O+mVTOcMNxNG8DMOYbnpnkHJtAZWPj/bnfl0vWM3CvVZwRNJ+3Ib8Gg2PosOzhEwSrJYOPMRopt2PDkaXaILqyQ== 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=KoCzVMO2TSbL/kzMGVx0A/9AHGeZIpTfvLyq7cJkP3o=; b=oPBXyMkm2nP2xxXFEVNezBa+GWO1eAGPt3HkZp8HmX8SuI7oFMWgBr82iMypnubKDn9Wn8CmBgBWes3JrmEAXwhF9sFJCP+yyQkXc7vk8jk75UMB+M8nWno7xt3G1ozECs8yMRiNmA1uGQcX4QuM88hjUp2ZUtuggFs9qHQ6yryBQ+ka4KhrwP04ApA3x+WWPfFg066DExmGtbBOS4DZKmoNCayFL11mbPghjD20oD31cxHchjY5dYm33CgSOcyUEmXCKDLAdMOpLap+tVkwlP71IG4HokD1G9fRfrTuIN1yrY2i2zS964Qyu7VLCR8170GNsdDoAcili9moyyrmyw== 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=KoCzVMO2TSbL/kzMGVx0A/9AHGeZIpTfvLyq7cJkP3o=; b=AhPuv42TGGBMZA2j/asaoYJ2e5mpCP8hGyzDKCTS9x7K76UIPjbGyWpQAPO3Sw9l4P5kXRR7pX82XOASUxXgKh9TIdwU7nNsULLGJ2gwLKLyt8JwjBsAswcaAUP2xZhcO3GKHsU2GbRGeMtkI/6aa/7ZHkufL4sO5olbskWAq+0= 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 DU2PR04MB8597.eurprd04.prod.outlook.com (2603:10a6:10:2d8::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13; Fri, 27 May 2022 10:25:03 +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.015; Fri, 27 May 2022 10:25:03 +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 v2] media: imx-jpeg: Leave a blank space before the configuration data Date: Fri, 27 May 2022 18:24:44 +0800 Message-Id: <20220527102444.19683-1-ming.qian@nxp.com> X-Mailer: git-send-email 2.36.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2P153CA0018.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::9) 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: 6c35468c-9025-4974-b6ce-08da3fcb2960 X-MS-TrafficTypeDiagnostic: DU2PR04MB8597: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: 5lQEfClQWETEwxwYM7t8+uDNX4wum4y3ok00Ow1UrdZVtzFq4FvtsKxNu0b/9R77hAb2OJCWndcYTqAglTh3/vJLDJZytZqyPsR5nX61rpH8t9jR/Tru+fo8v++Xv+Nn7+Ckv/KqlGjI6RiA0bkNmDFMwvhRO0RToeJWVjPPdRm0GFI/iBJr+/2tzJZ7WEZKDhJJtlZULn2Ui/m9WmodeURxnA4MIqEcNMJ2jO0nis+kXcGg0XR/K7OKVMuV2SfFdqkEX4/sfewUQxy6t+oqSPA5tpBRrvi5iHpxEtuyNP9hJhRx1DwcM/QFn67Cd5AVchRnlEdcEZeYXdg6l8bSWQY6NPseG3pRqcF6giDBQxcSMjU2HCezQS/lBZ0FmTVADbTxRj9Y6avcUNSBYmQqjJfe3TznnSM7ujP4/weBoBHbesOasvrYi9wDAFv1rj9edFGMLJimYXvtyJm95jbr9+efLTFUwzAXCry74cp2g6Ss434U7la7yY/Llu/UyT1zJLjImgbgbkj1yfrprUA73sCNIGXuRFACISP3VUweq7wuaKqdUdM4wf1mzmmYZNjCpChJaSxYpUFdCWArJujhmposKogPY9wkSayeVbBvYynawiBeWeFAoE+GSOvZdPKooiAxbBWWr8fez2MmFMcdyMFy13gwezFs8KeA8gR8DA6Ys1uea0OqzSYZBsa8PC6vMLLqU9t9XrogieWjHSLsVg== 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)(6512007)(2616005)(6666004)(52116002)(26005)(6506007)(316002)(66556008)(66946007)(508600001)(8676002)(4326008)(66476007)(38350700002)(6486002)(86362001)(38100700002)(1076003)(186003)(83380400001)(5660300002)(7416002)(2906002)(44832011)(8936002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ViC5bTyi3HYrFhbLbf9xFMq6S9erzWXVBnHCdbwtnWa+s7VSvEaVvkZhyyiq?= =?us-ascii?Q?Gn6HNxb5ZOW+e7QuIqp5H2yQpND3LUau0lPuq83wMxHaVymTUmT75uxYuVzQ?= =?us-ascii?Q?mlWvL8k3C+41O0fJtegvgq3oVi5TrpXTJeT+5dAtsreNMXB38UKa7t7nqJVt?= =?us-ascii?Q?l7wY8wLrsvLnKGqfW9ecnJljoroPssOuUIyxFD+cPbVtHWxksbWLRJNguO9s?= =?us-ascii?Q?teZAqkyAdZyrzqO3MCNalcYRBR70gbB+CFqajUqLTzE6RjeCyUPjOfKFcqij?= =?us-ascii?Q?bMrFvTbGw27VOgqmTcZu9SRrjJgKZ1TfpQGIBX5j2yCr2PeACvdtoEnhy81l?= =?us-ascii?Q?8mBZRhu/Hn3Kiub79VgL7WXavQEhCuDW7KQEMzkTNzK9va9VOXuBKvm4UuIC?= =?us-ascii?Q?tx6dQaNEzyT0cfY5+axbMriaJouAKjqmV79qG+DXWt07zxb0n8DZbuNdZGNK?= =?us-ascii?Q?ucf35S2qotP95FfU2OBNBJ/mPZ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-ascii?Q?5vNUi8Fcf8TGyZ06TILsw8qVCl75AR/4zYIb975OQQaRrRjLVXE/baYwENnG?= =?us-ascii?Q?0uPZKEsibdjak3BwdIUrXJo9tjLRsd8mNRxCUIjgnSEykEMCSm8yQYNe8Eok?= =?us-ascii?Q?NpZcW41xL4xn9Kf9XGulScAgI0mnmsoUgxQVJx79ywQLMb9mJrHVIHSW8hoG?= =?us-ascii?Q?l/nDvrqw3USad+HFKvdrnNBkTB731DmctEV5nEF8QYujl/TbCl5U630Z3pFG?= =?us-ascii?Q?RLu1fXXNlydp30DHAmJKsEuvtWfdrvkDerLevXoZTa4CsKoYhGVWGcOFw4DP?= =?us-ascii?Q?HXhgG+MHFtcwS/J9VmYp7jNZiEVkfNW1/LmJp/WZVctr6lcy/E6en/IWlsIG?= =?us-ascii?Q?gecmLkeSbQ=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c35468c-9025-4974-b6ce-08da3fcb2960 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 May 2022 10:25:03.3180 (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: kuJTc1WDeOarT+i3zZtxRDKmQc69e92dKTIRB/hO/K9CRF8OFGIMIjFWEMZ8kMg8fGk3O1iNP8RXyXwO/VYOIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8597 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Reviewed-by: Tommaso Merciai --- 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; -- 2.36.1