Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2409600ioo; Sat, 28 May 2022 12:42:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs7ar7yxJCCb6QNh+yXwPgByeMmHGNihE8R9RhwIOtARPqxs9xxCkdpVcHG/tkp19KCkHp X-Received: by 2002:a65:528a:0:b0:3c6:d2e6:e3a0 with SMTP id y10-20020a65528a000000b003c6d2e6e3a0mr42159572pgp.159.1653766976987; Sat, 28 May 2022 12:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653766976; cv=none; d=google.com; s=arc-20160816; b=VEAYSyiMnAaYLXVLhsEylPSaBqZk8KTVakkjQ5GzpCPZGqNDMp9Q7d9E48rZLkCp1K zQ7H/G1MhZijcfIx369UNF7IU5gkRH6mOcC/5f6YHoIFTKc36qPNV17AkwGhxoJ10se7 OYUUhXVyMtWaYyyLHju4xcaduIwLqhnlm92Z+375KqUzV0jn/WIFz2KDx2t8ZAATQrMF 2i0t0Gggmuo9Vha1zeJJIXomAOPHxpGH3s2b1a5/4eD1lq5B5WHdaDllEFgpqZxTYWvD bdfTA2y4tkikMMGGlhS7H13JjYUYMRxJTaEzmbJ5Xdlp6mE6C7eHB+B7jVOOXEQsU7Az sEwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ndP/m+5H1JvMzkVwLM22/7dPF6mVDOz8cWityZisy7w=; b=P3AZ+H/tcy0PRta6AwxaGG3TkuYddSs+N++OzfZf+zeaG5ZGGXNzhg1CmFNRh8zo1V oknsf0E2q2cja2UqvIAZR2eJbLh5PR9Jgja2/1oTksparSNmkNRDsPya4YkBGNVzMF8D 2PhELHd4cXFj6R9jtwBVmPjO5z32XAnUR0uOKO9QivxduuiViCa00yr7e6QWyPUhAcEZ oQUTc4B9+LS2VGWNkUv7DlBc1a3/ps1lgFX74DgQCWL/kjyz5Pcy4FRmnVdObxHa5PMX as19X0DxPq0ksVUNyXQg8K1UYa+pL2cSXasreSdI+EwyMKjTgnWN5+p+M6QJmH/VuEph M5Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=N4qtUMw9; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id b14-20020a170902d50e00b0015d52457704si11269476plg.475.2022.05.28.12.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 12:42:56 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=N4qtUMw9; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C8E6D62A16; Sat, 28 May 2022 12:06:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234298AbiE0K2q (ORCPT + 99 others); Fri, 27 May 2022 06:28:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235732AbiE0K2a (ORCPT ); Fri, 27 May 2022 06:28:30 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFC85127195 for ; Fri, 27 May 2022 03:28:24 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id ck4so7811055ejb.8 for ; Fri, 27 May 2022 03:28:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ndP/m+5H1JvMzkVwLM22/7dPF6mVDOz8cWityZisy7w=; b=N4qtUMw9eCH3aQwUwzVpgULVDpbYOtyXKlxVKlm+9SyP3Zn/8tudautlVEzJ8elE8n O6t6Wyau10+u5zSdHFf9W+3I4lygLpWfU2oKbPUS8J4jnZAGSxCmGSRSS0tPYKwSpr/b nhmSDr5Hn4Dm25mV9gX2muV/sLwh1FH/5bug8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ndP/m+5H1JvMzkVwLM22/7dPF6mVDOz8cWityZisy7w=; b=k8d+bOmqVxDqSYpFg5Qo9INXArEX4Sf5ry/qxoBZdvRwVRNPm1Ief2oc5pwbMJfgMe CkM9Pago9ydgOatm8alrPmtmDMw9AYHIFYILKAJ2Tg7UiQX7Ia+aVPKTomUUis2XKrhW C7X0VubS1vz0AbjFdc6xiRrza4QIjp8nbZRI7QodHiWnVTmBloqFjKH0gSKPPrNJClE6 RC8fAmodOz5tKzybWx6pJMKJlgXFqf27l7bHyPjHw3rr/n+zbp5cvK+9vm2C7ozEE3T6 tbS0X0F/s4ihoTd6G0LyoO9vcuLKkOWTHnQY5SroRGXn6gkYquhTXjQJy//5wYodLxW0 BP0Q== X-Gm-Message-State: AOAM530c4fLz51vDetoItXUpHVezTJDITYcf1zNZR+AoJupP3Z4E/bN/ Zt3EWzCVulx3d0ztNAIxtPIyvw== X-Received: by 2002:a17:907:971a:b0:6fe:bdf6:b67e with SMTP id jg26-20020a170907971a00b006febdf6b67emr26024672ejc.312.1653647303477; Fri, 27 May 2022 03:28:23 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i (net-188-217-53-154.cust.vodafonedsl.it. [188.217.53.154]) by smtp.gmail.com with ESMTPSA id cf8-20020a170907158800b006fe9e717143sm1312225ejc.94.2022.05.27.03.28.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 May 2022 03:28:23 -0700 (PDT) Date: Fri, 27 May 2022 12:28:20 +0200 From: Tommaso Merciai To: Ming Qian Cc: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl, 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: Re: [PATCH v2] media: imx-jpeg: Leave a blank space before the configuration data Message-ID: <20220527102820.GB24226@tom-ThinkPad-T14s-Gen-2i> References: <20220527102444.19683-1-ming.qian@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220527102444.19683-1-ming.qian@nxp.com> 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 On Fri, May 27, 2022 at 06:24:44PM +0800, Ming Qian wrote: > 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 > Looks good to me! Thanks, Tommaso -- Tommaso Merciai Embedded Linux Engineer tommaso.merciai@amarulasolutions.com __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 info@amarulasolutions.com www.amarulasolutions.com