Message ID | 20230803110214.163645-8-angelogioacchino.delregno@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp1082655vqx; Thu, 3 Aug 2023 04:35:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlHNbny/qVdvBcIQIrDL06NzDJVc0q0JtkAfjsohlgC0+tC3w5+GvHChSfNov6/5s84uE0eq X-Received: by 2002:a19:5e14:0:b0:4fb:772a:af13 with SMTP id s20-20020a195e14000000b004fb772aaf13mr6176398lfb.28.1691062506850; Thu, 03 Aug 2023 04:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691062506; cv=none; d=google.com; s=arc-20160816; b=fbJLwmw0k947N2C5z7CFEShPqtPe/HBz5ii2mftl9ek4DDebufXYdGRHhudbL26sMw ZcPw/UuMXFHcPA7yxxBSuD/WQdL1+YiCYW2i3Qh7xacfHCALV2cq/Pxz+PWqQgRDl/F9 xDgoc/XQQmpjN+GxwWFPxnuV7tjXSQj9iGZ1bWguiL2zUAfDMwFRwRz2hWYpG/pHqqEP 3AOiIB21rsUjbQu37rfw10wEkoAppM52fy6CXnJQ9KIvtShWgdDpyTvs4pCj6FFZ9Zev +fFp3H1WdRnCL7cRTyTRRXsZGT3E6amgRZnhnISH1TCfJiu+lQwR1gqza6ScV2M8F0TO EngQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GrtmEdZ5tGCLyarIHvFnE+rps5OjJ0dwieFTzLn2FGY=; fh=9Aon3jQEVE1p+dS8p5fghxMOlPjmNOu/O0E5mCMmCJg=; b=oVDtzhsT//1wp3lgR1dlrN0d2NvhWWLKlsukk/jfRyIhU1+G08JrT7l9cIsbWfA7Mh HAHDnHnsKnjLEzno5KUDZ1n1OMwt4TVdSxY/7ywoZ6OHAdNM+cJrxbv49hBQb8KL/1sE dvroD0kwRZumkUe47yY0PYIof1/nfteaJIIX5ZyIg0gIy6TzHrb5Q4MqGoCyr3x2SJsq Yr/aiDldXyNHTwjGxeYHtz4vyMipoGCiLufmQFdUkS2ntqlQ375yVY7enkbInLNSqb6c L3UDSWnrQrhZCCOebY5IjbLdj9jFk/b2qM0pAe0mq+z1X32Vw5vyyAD2cYNJEy0J+vTd U9Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="C3gfGe/I"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i20-20020a170906115400b0099b49483261si2134659eja.311.2023.08.03.04.34.35; Thu, 03 Aug 2023 04:35: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=@collabora.com header.s=mail header.b="C3gfGe/I"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232895AbjHCLDQ (ORCPT <rfc822;jeff.pang.chn@gmail.com> + 99 others); Thu, 3 Aug 2023 07:03:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234891AbjHCLCa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Aug 2023 07:02:30 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF65830ED for <linux-kernel@vger.kernel.org>; Thu, 3 Aug 2023 04:02:28 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 208ED66071A3; Thu, 3 Aug 2023 12:02:27 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1691060547; bh=ozW4byw7zGTKaXL8BQX+fQ96tzc29duKFdiPZzdm3yo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C3gfGe/IZJORkDKC1SAjovki/4zP/YwX2c7qYeKxY/wsSpaFFtE4N36/CnSsQEd7c O1FRXDn0wJRKIEa78Kw9ZpnypykA8qz0oa5pfUmSnXc+kbnto+syVj7MQ1oB1AoiA1 SASjNvSlaiLjMCoRvkGasYM5buYhXnNO1ESfMbtFKz8dvId1+7IC3as6PMqsLv95+H +8QP91+OPxPKyLbB+asc+Ey6eS9dWmDUH0iDLmUTi+29TeGymHry4jmlwpLwu/zXmf iY9eL8ILqgGsF4DxgdA2jEo3Ly8SsPN42oIh4wLULGD2Rh9wkA5eqpIKCJq3HxHjB2 mhxUnrUDu3Yqw== From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> To: chunkuang.hu@kernel.org Cc: p.zabel@pengutronix.de, airlied@gmail.com, daniel@ffwll.ch, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, wenst@chromium.org, kernel@collabora.com, ehristev@collabora.com Subject: [PATCH v9 07/16] drm/mediatek: aal: Use bitfield macros Date: Thu, 3 Aug 2023 13:02:05 +0200 Message-ID: <20230803110214.163645-8-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230803110214.163645-1-angelogioacchino.delregno@collabora.com> References: <20230803110214.163645-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773207559110099787 X-GMAIL-MSGID: 1773207559110099787 |
Series |
MediaTek DDP GAMMA - 12-bit LUT support
|
|
Commit Message
AngeloGioacchino Del Regno
Aug. 3, 2023, 11:02 a.m. UTC
Make the code more robust and improve readability by using bitfield
macros instead of open coding bit operations.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/gpu/drm/mediatek/mtk_disp_aal.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
Comments
Hi AngeloGioacchino, kernel test robot noticed the following build errors: [auto build test ERROR on drm-misc/drm-misc-next] [also build test ERROR on pza/reset/next] [cannot apply to pza/imx-drm/next mbgg-mediatek/for-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/AngeloGioacchino-Del-Regno/drm-mediatek-gamma-Adjust-mtk_drm_gamma_set_common-parameters/20230803-190918 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20230803110214.163645-8-angelogioacchino.delregno%40collabora.com patch subject: [PATCH v9 07/16] drm/mediatek: aal: Use bitfield macros config: arm-allmodconfig (https://download.01.org/0day-ci/archive/20230804/202308041431.xXkaXQ8u-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 12.3.0 reproduce: (https://download.01.org/0day-ci/archive/20230804/202308041431.xXkaXQ8u-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202308041431.xXkaXQ8u-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/gpu/drm/mediatek/mtk_disp_aal.c: In function 'mtk_aal_config': >> drivers/gpu/drm/mediatek/mtk_disp_aal.c:63:14: error: implicit declaration of function 'FIELD_PREP' [-Werror=implicit-function-declaration] 63 | sz = FIELD_PREP(DISP_GAMMA_SIZE_HSIZE, w); | ^~~~~~~~~~ drivers/gpu/drm/mediatek/mtk_disp_aal.c:63:25: error: 'DISP_GAMMA_SIZE_HSIZE' undeclared (first use in this function); did you mean 'DISP_AAL_SIZE_HSIZE'? 63 | sz = FIELD_PREP(DISP_GAMMA_SIZE_HSIZE, w); | ^~~~~~~~~~~~~~~~~~~~~ | DISP_AAL_SIZE_HSIZE drivers/gpu/drm/mediatek/mtk_disp_aal.c:63:25: note: each undeclared identifier is reported only once for each function it appears in drivers/gpu/drm/mediatek/mtk_disp_aal.c:64:26: error: 'DISP_GAMMA_SIZE_VSIZE' undeclared (first use in this function); did you mean 'DISP_AAL_SIZE_VSIZE'? 64 | sz |= FIELD_PREP(DISP_GAMMA_SIZE_VSIZE, h); | ^~~~~~~~~~~~~~~~~~~~~ | DISP_AAL_SIZE_VSIZE cc1: some warnings being treated as errors vim +/FIELD_PREP +63 drivers/gpu/drm/mediatek/mtk_disp_aal.c 55 56 void mtk_aal_config(struct device *dev, unsigned int w, 57 unsigned int h, unsigned int vrefresh, 58 unsigned int bpc, struct cmdq_pkt *cmdq_pkt) 59 { 60 struct mtk_disp_aal *aal = dev_get_drvdata(dev); 61 u32 sz; 62 > 63 sz = FIELD_PREP(DISP_GAMMA_SIZE_HSIZE, w); 64 sz |= FIELD_PREP(DISP_GAMMA_SIZE_VSIZE, h); 65 66 mtk_ddp_write(cmdq_pkt, sz, &aal->cmdq_reg, aal->regs, DISP_AAL_SIZE); 67 mtk_ddp_write(cmdq_pkt, sz, &aal->cmdq_reg, aal->regs, DISP_AAL_OUTPUT_SIZE); 68 } 69
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_aal.c b/drivers/gpu/drm/mediatek/mtk_disp_aal.c index e2e4155faf01..05790b444e17 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_aal.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_aal.c @@ -18,6 +18,8 @@ #define DISP_AAL_EN 0x0000 #define AAL_EN BIT(0) #define DISP_AAL_SIZE 0x0030 +#define DISP_AAL_SIZE_HSIZE GENMASK(28, 16) +#define DISP_AAL_SIZE_VSIZE GENMASK(12, 0) #define DISP_AAL_OUTPUT_SIZE 0x04d8 #define DISP_AAL_LUT_SIZE 512 @@ -56,9 +58,13 @@ void mtk_aal_config(struct device *dev, unsigned int w, unsigned int bpc, struct cmdq_pkt *cmdq_pkt) { struct mtk_disp_aal *aal = dev_get_drvdata(dev); + u32 sz; - mtk_ddp_write(cmdq_pkt, w << 16 | h, &aal->cmdq_reg, aal->regs, DISP_AAL_SIZE); - mtk_ddp_write(cmdq_pkt, w << 16 | h, &aal->cmdq_reg, aal->regs, DISP_AAL_OUTPUT_SIZE); + sz = FIELD_PREP(DISP_GAMMA_SIZE_HSIZE, w); + sz |= FIELD_PREP(DISP_GAMMA_SIZE_VSIZE, h); + + mtk_ddp_write(cmdq_pkt, sz, &aal->cmdq_reg, aal->regs, DISP_AAL_SIZE); + mtk_ddp_write(cmdq_pkt, sz, &aal->cmdq_reg, aal->regs, DISP_AAL_OUTPUT_SIZE); } /**