Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3086601rwb; Mon, 15 Aug 2022 17:48:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR5yHTvon62kQTaH5YMZ4kRcdM3jg+Ndu8UQ5TVFi5LmOlkFwdNJR1pLxlvnQWB0XHwOuS7L X-Received: by 2002:a17:907:94c7:b0:730:d5bc:14c with SMTP id dn7-20020a17090794c700b00730d5bc014cmr12342612ejc.68.1660610886774; Mon, 15 Aug 2022 17:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610886; cv=none; d=google.com; s=arc-20160816; b=gVwpn6g7BlHGGmjxHS6xACkDLkBFJGPbg00Kk86KTqhtnxS1nwJGMNuAxmQSIMomMR Pky/L8oPjmieKq7wnZ6uEycbXNb23xidiKrkoFAmhd9rK0u8z49AAP+mAoVEAIPIMkhX T+68Aulp2sCxsv6E9Bqax0LOHbLKRF1IQBmuQWM+B4iwobxuC8zUENFITl6r0phgZ89G BSlV/dK8xQFrtG6VFAuEdjofFwF2cGJsG8urxVNM6cW7h3Tm8Wywm32RlewwSxJBfEmQ phytTUSRZ0quycTUgCzGD75qb76GgIHhBprsWHu7xoemMnbL8A5PaZxNbHp75W/wuo8q bF4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u2rhHirJqdaGV/FR+HxC6V/M/LXV0jNTgMjE8CYv02M=; b=hl+fIKNWgJ/GogbyVCai3qeNCi5I9f8wGuCZjP5Xm9HNVrPJIPU6yk9+R+aIIN8xLx EL1PIzNq3rMKt7LFCFSmRC00heGvoHxatQCJP91gpidcCtdAcECkjqVUV2no4JFYKPpb WEnXFJEQEyXUhxDQacskwZnLlPZDsfNqWwVdmvB8gWFIYA98vWCJy/5Te0gg+Wg6m9ZQ oZuikyCeM+/yQQY8sLrto0sbkV95f4Z0uwJ9oPcXt4o0fi8Wb3a+bTcGHaj4n5o5TPCq O7fZkgEBitmGJiKNTm7X7Jm2cPb0aScJ7CtnlLK0+8f2tJJkgJoWLixuhSJnxeleogwz yCww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kEgtP28I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ej27-20020a056402369b00b00443b1e53479si3782651edb.374.2022.08.15.17.47.41; Mon, 15 Aug 2022 17:48:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kEgtP28I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354396AbiHOXpH (ORCPT + 99 others); Mon, 15 Aug 2022 19:45:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354242AbiHOXlm (ORCPT ); Mon, 15 Aug 2022 19:41:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3AFD6326; Mon, 15 Aug 2022 13:11:23 -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 ams.source.kernel.org (Postfix) with ESMTPS id 6AC65B80EA9; Mon, 15 Aug 2022 20:11:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6E00C433C1; Mon, 15 Aug 2022 20:11:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594281; bh=C7k62fEpy+yHrA2x3tcQ+Ejjxyu4cnAMCRx2jM7/9Ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kEgtP28IwPFg3A1yRildhbJVJHoeJqHF783C+es1M/sYapQ5dhdf61asYgY6aXa4a rHKlaMpJ4VrisDTRqEVS/vkEHONhs5ozeeQqT+BGVvTDJev4FsMYHVGlCMY64CZHag TF0NBhFzXxIksVZ5etPxi/KEHa4kERhrw2+QzBGo= 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.19 0377/1157] media: imx-jpeg: Leave a blank space before the configuration data Date: Mon, 15 Aug 2022 19:55:33 +0200 Message-Id: <20220815180454.811942888@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 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 Encoder/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/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 f36b512bae51..dd264b82d0dd 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -520,6 +520,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.35.1