Re: [PATCH v11 08/16] drm/mediatek: De-commonize disp_aal/disp_gamma gamma_set functions

From: AngeloGioacchino Del Regno
Date: Wed Oct 25 2023 - 06:44:44 EST


Il 13/10/23 06:07, CK Hu (胡俊光) ha scritto:
Hi, Angelo:

On Thu, 2023-10-12 at 11:57 +0200, AngeloGioacchino Del Regno wrote:
In preparation for adding a 12-bits gamma support for the DISP_GAMMA
IP, remove the mtk_gamma_set_common() function and move the relevant
bits in mtk_gamma_set() for DISP_GAMMA and mtk_aal_gamma_set() for
DISP_AAL: since the latter has no more support for gamma manipulation
(being moved to a different IP) in newer revisions, those functions
are about to diverge and it makes no sense to keep a common one (with
all the complications of passing common data and making exclusions
for device driver data) for just a few bits.

This commit brings no functional changes.

Reviewed-by: CK Hu <ck.hu@xxxxxxxxxxxx>


Signed-off-by: AngeloGioacchino Del Regno <
angelogioacchino.delregno@xxxxxxxxxxxxx>

..snip..

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
index 81c04518a5eb..0929f8830d6d 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
@@ -69,41 +69,28 @@ unsigned int mtk_gamma_get_lut_size(struct device
*dev)
return 0;
}
-void mtk_gamma_set_common(struct device *dev, void __iomem *regs,
struct drm_crtc_state *state)
+void mtk_gamma_set(struct device *dev, struct drm_crtc_state *state)
{

..snip..

- cfg_val = readl(regs + DISP_GAMMA_CFG);
+ cfg_val = readl(gamma->regs + DISP_GAMMA_CFG);
/* Enable the gamma table */
cfg_val |= FIELD_PREP(GAMMA_LUT_EN, 1);
- writel(cfg_val, regs + DISP_GAMMA_CFG);
-}
-
-void mtk_gamma_set(struct device *dev, struct drm_crtc_state *state)
-{
- struct mtk_disp_gamma *gamma = dev_get_drvdata(dev);
-
- mtk_gamma_set_common(dev, gamma->regs, state);
+ writel(cfg_val, gamma->regs + DISP_GAMMA_CFG);

Hello CK,

something went wrong while you applied this patch: this writel became a readl,
breaking mtk_disp_gamma entirely. Please check:

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/gpu/drm/mediatek/mtk_disp_gamma.c?h=next-20231025&id=a6b39cd248f3321dbf066f95f95a9841f891229e

Thanks,
Angelo