Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2877304rwb; Mon, 15 Aug 2022 13:08:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR6eyEqybolDRRYkW8fIZSsWBhnucl7VrjbGwtB/RetS2YOn7b5xsQKjL6OQL97QotqQH2aM X-Received: by 2002:a17:902:ba96:b0:170:9f15:b997 with SMTP id k22-20020a170902ba9600b001709f15b997mr18112729pls.34.1660594091640; Mon, 15 Aug 2022 13:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594091; cv=none; d=google.com; s=arc-20160816; b=k8zraJApa0K0Z7MQT4dmo+l5Fl7ntTe/LbBkAMKnlFOG+jfyVIte/CARV77Igsmp4X CfPPROdZarK+qE/KvGJtZUmyrjsJj6B81HK0FkDtCLHVi21WSnbB2XBXVSpDHRLwHKPl bhOndit4kWpYXAV6ao0l4d12gDB5CUZvFEOv9ciQ5Pp2DerwkwD9mH5hvtEcHoEX1kV/ Hi9gJKZLfkr1yirj1xgOA2msGU1GON5XKBsHP1P+hTU+3JyC+ER8jl7gwoStzgv/k6I0 NYVZd/nxvKvNEf8XsyiPcmwxGjbej7XBrjM7nYUp39rlI3ava6hc3xkhUJhXEL0GEJwF Pu5A== 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=LE/1I4EUGX1asNhHnHHCs4p8R5lT2rjWK5pw5RCL2D4=; b=XoMNxpwQQfaua7XQhRMd1C3YW19xehh34wzy4rAmljXuG9vuMPCBzXkuEpvdNNXqcL C01AKSMoQHKgpm8SHkxgMAxRVifdzQN/IyreJDDdgSkU++ZwQbEQ+Q5b4d8xDES/d9rG LKlcElfWG5bibZthYVHOClL1EBnnLCm946eDqMIvFIUA/3DdziZXB6dZheKhzM8LpFNR py9srkPjMwnPn5CEu1D2QY4MKCIEOv8NK1lq8baSNvaKLUUSz41mKxdQP+ON25IC6C4P G0KyiDOHG1DhXvMRGJ2sv0aeFuV1r3yjoA1gxe8/8d6emkTTCqPhDWqyhyzvEuGBQLXE cQmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Kg1tdPGQ; 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 l6-20020a170903120600b001727963f93esi754429plh.68.2022.08.15.13.08.00; Mon, 15 Aug 2022 13:08:11 -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=Kg1tdPGQ; 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 S232740AbiHOSs5 (ORCPT + 99 others); Mon, 15 Aug 2022 14:48:57 -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-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/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/platform/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_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: @@ -728,7 +729,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