Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1018519lqj; Mon, 3 Jun 2024 07:57:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfFhSvTKGWlSqVT7OmZrqKJ5CsXuAErVk26rMYBTsGmahTWwf6JNRFJsuXl1rqy/g6tlMT/yo59ovb+PaWEXiMbDFrbOjnf9frqgQ9Fw== X-Google-Smtp-Source: AGHT+IH9L80+7KJaf0+3h6JyQwqfxRQCzlYeXPqwrckgSHEs5noZEyvLt+qpxoneP8AWdU9DMASy X-Received: by 2002:a50:cdcc:0:b0:56a:ae8a:acc0 with SMTP id 4fb4d7f45d1cf-57a403e4c0fmr5206634a12.21.1717426665920; Mon, 03 Jun 2024 07:57:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717426665; cv=pass; d=google.com; s=arc-20160816; b=mp0X948zbMbXHzUSkg6wTlvT50I69AIHtjb97XzGrHXKEivQcMU+9xL1zfnLXA4wbi ODd5DspjZwDSZAf/JXYgrdj5DVewtkRCYV6CLMCJ7+C+Tk2EnoBOCmvpGHw4J6gFxDCV OSltZ+oZlis2UTPIPm7zLklC8zV0oRyT1Mn5LLnLvIF4aGU3ErOpJPbpFs0/SPUfaZXC NvEBBEp7KlQVU2Q8thHs5e0utQsOLKKkVZ79x+CSEYc5euK6imzTBgdbmEEy+an5OiY9 bCtY9AEx6d9LQnChbDS2KNxgNsMSzXGoBbMhkTJrri7JVcECKif9FrdFdW4igNsLU0Pi iMkg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=itRSbnLivBQUHj6k8cpuuwCj/HhQ5FsuEMevJKAj58c=; fh=lvevkgSbkTNnDXYf4j/JzVJ9+yGYkng27xoCMMl1e/k=; b=VeNxVj83fnfmYJMOPn5SxJZloH4ZtIuIsFVrx05kxI4NPejrafBaC4pXf6kUWN5dXm D6Zw8zj+kcZRtdqfXXDFQBBH+CKZI4W0umqiflO0+LiUkShS8hHAmLqLjqVPQh5vNgtn 8yotmlz2YCqUn+sfJo8oCi6ypYn9YJVzBkyI6ypEsa3QckEpOZA/ChcHGg8Fj0hdmo1U n/c+aKdzS60mp/Z0qO9Lw3/GGrpn5BMOu4PcFj1ZTGA2TVsaUYKcSHX/1QLmoDoTn1Fc +1F/cDA/202cd/mntNLa/AFX2NGQ5dzsm5p22spOaWh2Lgod0q6/fjS+t6ql8/e53f4Y Q4PQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=puVrGSra; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-199327-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199327-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31c77055si3896055a12.443.2024.06.03.07.57.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 07:57:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199327-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=puVrGSra; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-199327-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199327-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A06ED1F22594 for ; Mon, 3 Jun 2024 14:57:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 353951304AA; Mon, 3 Jun 2024 14:57:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="puVrGSra" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCDEC4A12; Mon, 3 Jun 2024 14:57:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717426655; cv=none; b=cp0hGji7PB+PF/R06SsQOkucp7zG9NbvwVzgvcldyIsI4NkFuebC8cujqDpaD6eVErfPWXdOdy5s13Qbl3T/k+yWPRK+eXaONiCRCqVIuVfXHVEWvviF2IqtQSHU1V5ucKKKJW4js5qNycCZlfDexyI5ptO+6DEdreHRrfzl7Dk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717426655; c=relaxed/simple; bh=XxQOFTFoETaApC1cOL3VI9vHYDh/3zcRncz7EKtboyY=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=jaJF2jkgqc5Uxkhj5ds4T4WXMImN7kSbixl9K0wP77HxpfGShASuqloPJopwOzBRrOL6xRFQ96GQB+Rm5WlxsleHkFGRPdDVgolgP84blhS77yhoCx5NmVb2PwsjeMYNYN8wIlQ1y8Ok5Hg1+AnoFNYSPCacbqGO2zN0j6glwIc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=puVrGSra; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1717426651; bh=XxQOFTFoETaApC1cOL3VI9vHYDh/3zcRncz7EKtboyY=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=puVrGSraQ2BTNhqJXtmrCAtWWnWOGs84SAif9IB6w1H/VwBBhw/C4RSdSUgieT69D 01D2VwK9btyiIcmFQf8JJXJhfjbG2hvER1bSnGGkcCNpOW0ELhoXJVFtNThvFriwO5 QqzoVl7/NLPubt7e4aOfJ4pIMtIdbAx3wbZgttEiYyVA/RnIgAjoIwnRkrjvvXgpnD wvyelex7+9RYkhUsct/ljpH1GhEsh6mBG8vvYZgyw+tMsNsAPF7XYNTkdeWu7fO+2v d8lJ8mpP6kQ3SVOw3OcI0OmJGCELXtbiPfTfgPJ3Kst3MUcMuT6VukeGLJLHCtMpBC Z/8yk2gSEh8sA== Received: from smtpclient.apple (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: dwlsalmeida) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 1539B378216D; Mon, 3 Jun 2024 14:57:28 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: [PATCH] media: mediatek: jpeg: support 34bits From: Daniel Almeida In-Reply-To: <20240327040145.7155-1-jianhua.lin@mediatek.com> Date: Mon, 3 Jun 2024 11:57:15 -0300 Cc: Mauro Carvalho Chehab , matthias.bgg@gmail.com, AngeloGioacchino Del Regno , Linux Media Mailing List , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Project_Global_Chrome_Upstream_Group@mediatek.com Content-Transfer-Encoding: quoted-printable Message-Id: References: <20240327040145.7155-1-jianhua.lin@mediatek.com> To: Jianhua Lin X-Mailer: Apple Mail (2.3774.600.62) Hi Jianhua, > + ret =3D of_property_read_u32(pdev->dev.of_node, "mediatek,34bits", > + &jpeg->support_34bit); > + if (ret !=3D 0) { > + dev_info(&pdev->dev, "default for 32bits"); > + jpeg->support_34bit =3D 0; > + } > + dev_info(&pdev->dev, "use 34bits: %d", jpeg->support_34bit); > + Please use of_property_read_bool instead. > enc_get_file_size(void __iomem *base, u32 support_34bit) > { > - return readl(base + JPEG_ENC_DMA_ADDR0) - > + u32 value =3D 1; > + > + if (support_34bit) > + value =3D 4; > + > + return readl(base + JPEG_ENC_DMA_ADDR0) * value - > readl(base + JPEG_ENC_DST_ADDR0); > } Please use the ternary operator instead, there=E2=80=99s no need for two = assignments. Can you please add a comment inline to explain why this multiplier is = needed? > EXPORT_SYMBOL_GPL(mtk_jpeg_enc_get_file_size); > @@ -75,6 +80,9 @@ void mtk_jpeg_enc_start(void __iomem *base) >=20 > value =3D readl(base + JPEG_ENC_CTRL); > value |=3D JPEG_ENC_CTRL_INT_EN_BIT | JPEG_ENC_CTRL_ENABLE_BIT; > + value |=3D JPEG_ENC_CTRL_RDMA_PADDING_EN; > + value |=3D JPEG_ENC_CTRL_RDMA_RIGHT_PADDING_EN; > + value &=3D ~JPEG_ENC_CTRL_RDMA_PADDING_0_EN; > writel(value, base + JPEG_ENC_CTRL); > } These do not have to be gated by =E2=80=9Csupport_34bit=E2=80=9D ? =E2=80=94 Daniel=