From nobody Sun Dec 14 06:20:35 2025 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 04011C00140 for ; Mon, 15 Aug 2022 18:49:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244026AbiHOSs6 (ORCPT ); Mon, 15 Aug 2022 14:48:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243278AbiHOSnj (ORCPT ); Mon, 15 Aug 2022 14:43:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 571C82F665; Mon, 15 Aug 2022 11:26:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E797660FA2; Mon, 15 Aug 2022 18:26:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0141C433D6; Mon, 15 Aug 2022 18:26:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588015; bh=iVbT3hOIMXfKnRpHkhG0uTYIVfdh5PIQwHNiNTQL4dY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kg1tdPGQaI7ix/abUgGZCqw/wN41YjUY47BOV7ePnG6iSJ0DUytgJ7qi0JGT3HOm6 qYZWpD5iF9e+eHPgzLKTJFmKI5VTIiLgdovJ+7pSgihwuc1/FmvtwhNvvJYFHhy7A2 AFVsIPf8Uy62bfDkJU+U6Mb5VNjqa2c9Gmcuk5eE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Tommaso Merciai , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 269/779] media: imx-jpeg: Leave a blank space before the configuration data Date: Mon, 15 Aug 2022 19:58:33 +0200 Message-Id: <20220815180348.839768786@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 6285cdea19daf764bf00f662a59fc83ef67345cf ] 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 Enco= der/Decoder") Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Reviewed-by: Tommaso Merciai Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.c index 37905547466b..5289a822bcb1 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -493,6 +493,7 @@ static bool mxc_jpeg_alloc_slot_data(struct mxc_jpeg_de= v *jpeg, GFP_ATOMIC); if (!cfg_stm) goto err; + memset(cfg_stm, 0, MXC_JPEG_MAX_CFG_STREAM); jpeg->slot_data[slot].cfg_stream_vaddr =3D cfg_stm; =20 skip_alloc: @@ -728,7 +729,13 @@ static unsigned int mxc_jpeg_setup_cfg_stream(void *cf= g_stream_vaddr, u32 fourcc, u16 w, u16 h) { - unsigned int offset =3D 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 =3D 0x80; u8 *cfg =3D (u8 *)cfg_stream_vaddr; struct mxc_jpeg_sof *sof; struct mxc_jpeg_sos *sos; --=20 2.35.1