From patchwork Thu Oct 12 09:57:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 151880 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1104597vqb; Thu, 12 Oct 2023 02:57:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGT5HB8tcVB0YCCh4FVckIuAMpMnNmVZyXNyRNC4qQ51zGjfMiiNJ8w6+WnMo6OIbBx7KJS X-Received: by 2002:a17:90b:4b04:b0:27d:1593:2b08 with SMTP id lx4-20020a17090b4b0400b0027d15932b08mr2691809pjb.0.1697104674389; Thu, 12 Oct 2023 02:57:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697104674; cv=none; d=google.com; s=arc-20160816; b=qBsNDqH7ZNHAiTozxPu4twCWVG8YfkrtIjj/HcLNQpYZfxvinzku3strgjq2BUZ2bN /eCROllg5OV6d5J63qZ/qCftEs0QrfsXDj9uDSgeeNG92FRHGX/WkhdW6QPDnKrr49E2 r9i543z0TUjl1CGGAzjMoSqjeE4CMsAjGDvtaaWd58GaxWIc5ev+/pdzPivpPbffUiB9 DKzmEqdJoOfDkhxdLeicMhYXjQukJzXVE8F0b3JsHvnSk4G2t1OkZnf/+30Q5x/O/9W4 G6MWSLIMcawR9GV9XzlYHAMhtW72wtGTI88UmJLmGrxgR9yQjKKtLfFQ9+SfCuTtlern 6lUg== 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=DFefsVgmgjLB4yMZa90wgbdmkb88qZAAWjL3dRxFInk=; fh=R9mr2cxBBEMSJzqHrGitWEOhhYfSd6gyjcbv25zKR+Q=; b=QrN5h8ED2m2L4adPiJMF4EiHo+h6hgnEF/u9iZTX3tq86K3vxfOBhl5zCddI2JtfPv nEwU9LmFjCsungvdJw75yh7BUJHm15btAnPP/sIlZ1Rj+GKxu5ODbH2X5Wwvo6lJWyt/ XRgrWul4DjzDrLlsE8ilhJuiICZ8/d8GgU2MUVHhMhczBV5z4dOXt8wTmCw4Xi7Xh9qW mAwX0x+zboUumaKKqzLUNJn/QHN8OvlnVU8piv5wR2M+udkC9Co0zmz2FwgMwtbp3GJZ azINgZuV0934VhIp0Eaf4ckIUhHvPvttqz34E7l3RHs97ghsFCfTnhEjUb8MooJ2xQAf m7PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=eVltjlch; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z14-20020a17090a66ce00b002791d2ce94asi1989285pjl.81.2023.10.12.02.57.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 02:57:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=eVltjlch; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id CA7E58218E50; Thu, 12 Oct 2023 02:57:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235586AbjJLJ5s (ORCPT + 19 others); Thu, 12 Oct 2023 05:57:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229757AbjJLJ5q (ORCPT ); Thu, 12 Oct 2023 05:57:46 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06C38C0 for ; Thu, 12 Oct 2023 02:57:44 -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 B2AD06607346; Thu, 12 Oct 2023 10:57:42 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697104663; bh=rJh9dq2zg8Xp2mCThXqt5EFMAevJSGKGnsZ1ZKAX+pQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eVltjlchZ7V33dLGRpRPA+P+A/oWfDcoJyl7sJIlONTqojqblnHSO9dYgIMuusYkY Cm5ZbQqmiQXyqobohmVZk9Rf+QkWAalbA8JMlAJsWkcaVTsudgPq4vJJI/TcHVCX2F 4fBrTt5YcFTe6nIC/6a+Wra/YS3p8nFaTNBPZdvT0UWZ1KXdi9R6nEvPdk2FjkWtG8 KnD9O6XE/h2JYF2Qx2+OEpp5hW1JZ6Flpt+jeAwuUVN69uVoIGyZKcOEbIcbmYnJ/Q ZD80DMAE5JNI2LgbTfUI3YLHEbv+eShP9gzFwrvrFdD2pleYBfOIfwFJ5xaXY/EltO nbmSCyRxYa0nA== From: AngeloGioacchino Del Regno 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, nfraprado@collabora.com, "Jason-JH.Lin" , Alexandre Mergnat , CK Hu Subject: [PATCH v11 01/16] drm/mediatek: gamma: Adjust mtk_drm_gamma_set_common parameters Date: Thu, 12 Oct 2023 11:57:21 +0200 Message-ID: <20231012095736.100784-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231012095736.100784-1-angelogioacchino.delregno@collabora.com> References: <20231012095736.100784-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 12 Oct 2023 02:57:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779543231322813621 X-GMAIL-MSGID: 1779543231322813621 From: "Jason-JH.Lin" Adjust the parameters in mtk_drm_gamma_set_common() - add (struct device *dev) to get lut_diff from gamma's driver data - remove (bool lut_diff) and use false as default value in the function Signed-off-by: Jason-JH.Lin Reviewed-by: Alexandre Mergnat Reviewed-by: CK Hu Signed-off-by: AngeloGioacchino Del Regno --- drivers/gpu/drm/mediatek/mtk_disp_aal.c | 2 +- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 2 +- drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_aal.c b/drivers/gpu/drm/mediatek/mtk_disp_aal.c index ce2da1ccec6f..662c5d03ee43 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_aal.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_aal.c @@ -61,7 +61,7 @@ void mtk_aal_gamma_set(struct device *dev, struct drm_crtc_state *state) struct mtk_disp_aal *aal = dev_get_drvdata(dev); if (aal->data && aal->data->has_gamma) - mtk_gamma_set_common(aal->regs, state, false); + mtk_gamma_set_common(NULL, aal->regs, state); } void mtk_aal_start(struct device *dev) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_drv.h b/drivers/gpu/drm/mediatek/mtk_disp_drv.h index 2254038519e1..75045932353e 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h @@ -54,7 +54,7 @@ void mtk_gamma_config(struct device *dev, unsigned int w, unsigned int h, unsigned int vrefresh, unsigned int bpc, struct cmdq_pkt *cmdq_pkt); void mtk_gamma_set(struct device *dev, struct drm_crtc_state *state); -void mtk_gamma_set_common(void __iomem *regs, struct drm_crtc_state *state, bool lut_diff); +void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crtc_state *state); void mtk_gamma_start(struct device *dev); void mtk_gamma_stop(struct device *dev); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c index e9242249884b..68e2565b88a5 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c @@ -54,14 +54,24 @@ void mtk_gamma_clk_disable(struct device *dev) clk_disable_unprepare(gamma->clk); } -void mtk_gamma_set_common(void __iomem *regs, struct drm_crtc_state *state, bool lut_diff) +void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crtc_state *state) { + struct mtk_disp_gamma *gamma; unsigned int i, reg; struct drm_color_lut *lut; void __iomem *lut_base; + bool lut_diff; u32 word; u32 diff[3] = {0}; + /* If we're called from AAL, dev is NULL */ + gamma = dev ? dev_get_drvdata(dev) : NULL; + + if (gamma && gamma->data) + lut_diff = gamma->data->lut_diff; + else + lut_diff = false; + if (state->gamma_lut) { reg = readl(regs + DISP_GAMMA_CFG); reg = reg | GAMMA_LUT_EN; @@ -91,12 +101,8 @@ void mtk_gamma_set_common(void __iomem *regs, struct drm_crtc_state *state, bool void mtk_gamma_set(struct device *dev, struct drm_crtc_state *state) { struct mtk_disp_gamma *gamma = dev_get_drvdata(dev); - bool lut_diff = false; - - if (gamma->data) - lut_diff = gamma->data->lut_diff; - mtk_gamma_set_common(gamma->regs, state, lut_diff); + mtk_gamma_set_common(dev, gamma->regs, state); } void mtk_gamma_config(struct device *dev, unsigned int w,