From patchwork Sun Sep 11 15:37:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 12972915 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 29EB8ECAAD3 for ; Sun, 11 Sep 2022 15:39:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=htw2I1PQMJXLryno0wuNOAInkOs/iCEH3VWu6utb9RM=; b=egfBjDvQU1GBNa 0KHPgxJZY58cmF6M4ll0ZNK/ULdcuIa7RHNplEb4ZcuPa00Mb8Def7E0kq/UfYRexr/UcbbONACbf trf/LxYlLjVk5FsaT/c+HBYvpoPayp+E3S70gpG4vPhbKV0t36VPOMD3p+V0UFlbkTVTlPWo8HBCg Yf0bjeM8I2F1oNKGgbLc7NBU0ox+GGy3Fh/8LIbJAaoxyA+CefQCU6Pk2sYgiy9AysEYAKAfPRdVD grao9ZgJ67qKm3uNwCdrsUEmwXv24sAmJ/KQDq39cdB5nc7ZpEtWrafzDHGH2tgetwX+tJuheHoUY euUSY6IzTWeBbmyCKIyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXP2E-002ptp-U4; Sun, 11 Sep 2022 15:38:15 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXP1s-002pkq-F5; Sun, 11 Sep 2022 15:37:54 +0000 X-UUID: d1c0846aa2834314bc85a36aa49fa374-20220911 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=O3LUqg31O+VB4iMjWdOGL0PoqlmvD6Jw/XCEotzP8UA=; b=KUtoAG0kPVzGShEQvq2stZosvsSPlYgH158DDnir1xV0XMrLyntPjMCFWcl8gnqMj8pVW1dO0srtUSPeysumslMvVMqvGmYvyisWhJwIKG4ugXr4XwKPOjRk2NNYBv6hXVlkLbd6ifE8ug17omk7dtboA2RgnDLNnkaXxfS0Bos=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.10,REQID:14adf1cc-577d-4dbd-af19-ef4be6966387,OB:0,L OB:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_ Ham,ACTION:release,TS:0 X-CID-META: VersionHash:84eae18,CLOUDID:62503e5d-5ed4-4e28-8b00-66ed9f042fbd,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: d1c0846aa2834314bc85a36aa49fa374-20220911 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1081668493; Sun, 11 Sep 2022 08:37:46 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Sun, 11 Sep 2022 23:37:43 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Sun, 11 Sep 2022 23:37:43 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno CC: CK Hu , Rex-BC Chen , "Singo Chang" , , , , , , , zheng-yan.chen , "Jason-JH . Lin" Subject: [PATCH v3 1/9] dt-bindings: mediatek: modify item formatting for gamma Date: Sun, 11 Sep 2022 23:37:26 +0800 Message-ID: <20220911153734.24243-2-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220911153734.24243-1-jason-jh.lin@mediatek.com> References: <20220911153734.24243-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220911_083752_527324_38892148 X-CRM114-Status: GOOD ( 10.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "zheng-yan.chen" Since the items with only one const should be dedicated as enum, merge all such items into one enum item. Fixes: 4ed545e7d100 ("dt-bindings: display: mediatek: disp: split each block to individual yaml") Signed-off-by: zheng-yan.chen Signed-off-by: Jason-JH.Lin --- .../bindings/display/mediatek/mediatek,gamma.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,gamma.yaml b/Documentation/devicetree/bindings/display/mediatek/mediatek,gamma.yaml index a89ea0ea7542..c3631a3e3f05 100644 --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,gamma.yaml +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,gamma.yaml @@ -22,9 +22,9 @@ properties: compatible: oneOf: - items: - - const: mediatek,mt8173-disp-gamma - - items: - - const: mediatek,mt8183-disp-gamma + - enum: + - mediatek,mt8173-disp-gamma + - mediatek,mt8183-disp-gamma - items: - enum: - mediatek,mt8186-disp-gamma From patchwork Sun Sep 11 15:37:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 12972913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8C166C54EE9 for ; Sun, 11 Sep 2022 15:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KzmJl+IhF61LO5I4jPVHCaSv/d6YGV+zDCpPRC0dnaM=; b=OPyltm2vsSg0SK YYq6EfHwGZKz14FUtX5W7fOJoXtLoUK5RWMLmkn0JbdBK+aCQNWPPw27Gh5OEvLp1lMfYHsSLeF2B wQHhtiC0f/RSlhMujbjq2jfTDu9nZhHZsGeX5FfkAKw4EKbfnLsGzbFDwZo2HXldQ0sJO3qtYSuXz 8Hy0TRSSeG70SXC65AykLo48r+skkU/UYLwhrXfqcvucLtNLUOkVM1sbC6WDNXbpcBFP1XvsBeejV DNKJ2x4gHbZn0KIFaG0i7/ImYiLqg0sc5BKnSPQtvs2/tsK2/qAwx9G3SMJI9PwKUiZftxFUUceY9 uBSY7DrBUAohFZMVwViA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXP1u-002plx-Qt; Sun, 11 Sep 2022 15:37:55 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXP1r-002pje-KL; Sun, 11 Sep 2022 15:37:53 +0000 X-UUID: 5cdec04106d342b4aa62ae96ce2e3a2b-20220911 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=IDXTI4k18EJfx3l923GepQjG7TruZcdsfijbeW9PjtI=; b=aWkdGOwbIEUGvmPrZmoVdxe8qIQLjTAKWs+Nxcp5DTN/QBKKrkC6MYuTtEfL+k4ynVIELzaPvlddLQKbq+Vl7sdzTMazHAwWcTjLce2MzKGOnjfe+ejsl5tldFEn99kch8Y4UbjdzWvafQUaX4GvlPSioXcg0ClYboLrdz2IHmo=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.10,REQID:147902e1-a222-4c48-8f2e-c15d57af9703,OB:0,L OB:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_ Ham,ACTION:release,TS:0 X-CID-META: VersionHash:84eae18,CLOUDID:404f06ec-2856-4fce-b125-09d4c7ebe045,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 5cdec04106d342b4aa62ae96ce2e3a2b-20220911 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1596431197; Sun, 11 Sep 2022 08:37:47 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Sun, 11 Sep 2022 23:37:43 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Sun, 11 Sep 2022 23:37:43 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno CC: CK Hu , Rex-BC Chen , "Singo Chang" , , , , , , , zheng-yan.chen , "Jason-JH . Lin" Subject: [PATCH v3 2/9] dt-bindings: mediatek: Add gamma compatible for mt8195 Date: Sun, 11 Sep 2022 23:37:27 +0800 Message-ID: <20220911153734.24243-3-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220911153734.24243-1-jason-jh.lin@mediatek.com> References: <20220911153734.24243-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220911_083751_787211_E382D144 X-CRM114-Status: GOOD ( 12.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "zheng-yan.chen" mt8195 uses 10bit-to-12bit gamma-LUT, which is not compatible with current 9bit-to-10bit gamma-LUT. This patch thus add constant compatible for mt8195, which means that mt8195 should only use specified mt8195 gamma driver data. Also, delete related compatible from enum, to ensure that mt8195 will not accidentally get others' gamma driver data and thus cause fatal error. Signed-off-by: zheng-yan.chen Signed-off-by: Jason-JH.Lin Reviewed-by: AngeloGioacchino Del Regno --- .../devicetree/bindings/display/mediatek/mediatek,gamma.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,gamma.yaml b/Documentation/devicetree/bindings/display/mediatek/mediatek,gamma.yaml index c3631a3e3f05..bc20160d6b68 100644 --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,gamma.yaml +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,gamma.yaml @@ -25,11 +25,11 @@ properties: - enum: - mediatek,mt8173-disp-gamma - mediatek,mt8183-disp-gamma + - mediatek,mt8195-disp-gamma - items: - enum: - mediatek,mt8186-disp-gamma - mediatek,mt8192-disp-gamma - - mediatek,mt8195-disp-gamma - const: mediatek,mt8183-disp-gamma reg: From patchwork Sun Sep 11 15:37:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 12972920 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C4156C54EE9 for ; Sun, 11 Sep 2022 15:41:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Mp59+6/r5/ReJ6IeCaxlbI26yPZVeadJWv36QwQA0TY=; b=0XvVPPYVRY2kj8 C0BD+CBISm9UBEZh+kxJjVzTZn7sMiFwytwY8/Cllw+A0KTb7dxHnYUs4pnpdElFTy/SSmC3DGDrv InG+GvYA3Hb6qXwhg0D4vLfTTNWMaPiEq12fvyrf/1ujZPR5SwvzI/HUldbeAmZRYMCxIJlkY0LPb y/viFKqhVPJczq7Kxfiu28+CHm9oqNYSKan9Bd19eB7q2GIuvJ+z1PqVRcjNNLwweiGpswsylfOtd 7OnRJeHEph11W7gkUNycD2ACojZUf8UzVpU3RIvCP6O62nea1skAgk1yuomS13CAeQgrUwijCPy/o iOtwjmiQxKD/czTqshMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXP43-002rEp-8n; Sun, 11 Sep 2022 15:40:07 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXP2P-002py3-VR; Sun, 11 Sep 2022 15:38:28 +0000 X-UUID: 7579f9d339524b26af8dff3f499eadda-20220911 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=LnbwG8vLYdipjrIEGvc9cv2a6+JfLpowbLKnOMVitAg=; b=jjIVqDq3UtbaM87OoOuMSzCJKXNJV4jeblNYG3JQ6ur3m2UhJh2mXNCtQ/nT2I57kas4s2MsFAiaTMgG7HZKhdELkk7ESRslsZlBZvTaaqBLBUyqyn5Iqm5cElxkecbk9uV6frAXIGntPZktBNB8Ci1/R8Fmy1TfU3i+AAmrUoo=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.10,REQID:c1eb891d-de82-46c7-b7db-8b89e53867a5,OB:0,L OB:0,IP:0,URL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release _Ham,ACTION:release,TS:-5 X-CID-META: VersionHash:84eae18,CLOUDID:645006ec-2856-4fce-b125-09d4c7ebe045,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 7579f9d339524b26af8dff3f499eadda-20220911 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 94645064; Sun, 11 Sep 2022 08:38:18 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Sun, 11 Sep 2022 23:37:43 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Sun, 11 Sep 2022 23:37:43 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno CC: CK Hu , Rex-BC Chen , Singo Chang , , , , , , , Jason-JH.Lin Subject: [PATCH v3 3/9] drm/mediatek: Adjust mtk_drm_gamma_set_common parameters Date: Sun, 11 Sep 2022 23:37:28 +0800 Message-ID: <20220911153734.24243-4-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220911153734.24243-1-jason-jh.lin@mediatek.com> References: <20220911153734.24243-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220911_083826_037276_F5741D4D X-CRM114-Status: GOOD ( 13.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Fixes: 051524cbe62d ("FROMGIT: drm/mediatek: Add lut diff flag for new gamma hardware support") Signed-off-by: Jason-JH.Lin --- 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 | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_aal.c b/drivers/gpu/drm/mediatek/mtk_disp_aal.c index 0f9d7efb61d7..6517e0a5a7d8 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_aal.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_aal.c @@ -66,7 +66,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 33e61a136bbc..a83e5fbc8724 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h @@ -52,7 +52,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 bbd558a036ec..f54a6a618348 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c @@ -54,14 +54,19 @@ 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 = dev_get_drvdata(dev); + bool lut_diff = false; unsigned int i, reg; struct drm_color_lut *lut; void __iomem *lut_base; u32 word; u32 diff[3] = {0}; + if (gamma && gamma->data) + lut_diff = gamma->data->lut_diff; + if (state->gamma_lut) { reg = readl(regs + DISP_GAMMA_CFG); reg = reg | GAMMA_LUT_EN; @@ -91,12 +96,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, From patchwork Sun Sep 11 15:37:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 12972947 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5D785ECAAD3 for ; Sun, 11 Sep 2022 16:39:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hlRVqlxBfekpTkSL3/U7huH5U0s9+OqNRJgyWO6gTIY=; b=KqGJ0Ebkj+RXpp r9U4RdAdgdkt+M40uZZ1gPk1NyMb9L+ii/gwYKAoduRntwXKIg0FWsIvRyfv/Gj6DIOLDQrUBmz3k tdIkAM7ogr6mZvIHmi0cLfk0B17/YwEqFN15UQUqD0kW178CNL8yrUh+5TwZyJT7Od8m/5CxEZXG3 V5fYZe7OHHgLFrYRg5v1ZEoquxidiResvhuBruYcUWnMGNcuI1weoWprh4GTwJeGy02aWsW4uYeOg /ut9BIba8U2D73I2Baau/g7fBOnYzGtLVWui/WFTS8gvzHswbCNT2/oVspk2pfwxcMY5ClNnOz01d oLD8wZ7ma5ThltlZQs6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXPyd-003E6Q-Tr; Sun, 11 Sep 2022 16:38:36 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXPya-003E2o-UT; Sun, 11 Sep 2022 16:38:34 +0000 X-UUID: e14d979e11904cd8980bd40c1ad4a356-20220911 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=NBnaUFj8SikC+RBz0WDLDbc+oWz+RzE/yMVlKiNJczY=; b=ks22hFLX9/+5YU3odVRaTkP9aNHilT9EITreJnwgnAt4YjFYqb4azW4SSoGTpQGngaktBgZGISQTCP90jZPACbVdXZ1vnG9vmBRHRjzryCQSLmcS7RMCWlSVGtmXFLcrHE4yzTFgBiOi790NpfSxBTKkb1gqlm/lDo1HgYX0d24=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.10,REQID:f9f8472b-9722-41f3-9a67-a7d76fd1263f,OB:0,L OB:0,IP:0,URL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release _Ham,ACTION:release,TS:-5 X-CID-META: VersionHash:84eae18,CLOUDID:34063f5d-5ed4-4e28-8b00-66ed9f042fbd,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: e14d979e11904cd8980bd40c1ad4a356-20220911 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1113302961; Sun, 11 Sep 2022 09:38:22 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Sun, 11 Sep 2022 23:37:43 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Sun, 11 Sep 2022 23:37:43 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno CC: CK Hu , Rex-BC Chen , Singo Chang , , , , , , , Jason-JH.Lin Subject: [PATCH v3 4/9] drm/mediatek: Add gamma support different lut_size for other SoC Date: Sun, 11 Sep 2022 23:37:29 +0800 Message-ID: <20220911153734.24243-5-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220911153734.24243-1-jason-jh.lin@mediatek.com> References: <20220911153734.24243-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220911_093833_005765_49BCD9AC X-CRM114-Status: GOOD ( 21.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 1. Add mtk_drm_gamma_get_lut_size() and remove MTK_LUT_SIZE macro. 2. Add lut_size to gamma driver data for different SoC. Signed-off-by: Jason-JH.Lin Reported-by: kernel test robot --- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 1 + drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 22 +++++++++++++++++++-- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 4 ++-- drivers/gpu/drm/mediatek/mtk_drm_crtc.h | 1 - drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 9 +++++++++ 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_drv.h b/drivers/gpu/drm/mediatek/mtk_disp_drv.h index a83e5fbc8724..6a05bb56e693 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h @@ -51,6 +51,7 @@ void mtk_gamma_clk_disable(struct device *dev); void mtk_gamma_config(struct device *dev, unsigned int w, unsigned int h, unsigned int vrefresh, unsigned int bpc, struct cmdq_pkt *cmdq_pkt); +unsigned int mtk_gamma_get_lut_size(struct device *dev); void mtk_gamma_set(struct device *dev, struct drm_crtc_state *state); void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crtc_state *state); void mtk_gamma_start(struct device *dev); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c index f54a6a618348..e69d0b205b9a 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c @@ -24,10 +24,12 @@ #define DISP_GAMMA_LUT 0x0700 #define LUT_10BIT_MASK 0x03ff +#define LUT_SIZE_DEFAULT 512 /* for setting gamma lut from AAL */ struct mtk_disp_gamma_data { bool has_dither; bool lut_diff; + u16 lut_size; }; /* @@ -54,18 +56,32 @@ void mtk_gamma_clk_disable(struct device *dev) clk_disable_unprepare(gamma->clk); } +unsigned int mtk_gamma_get_size(struct device *dev) +{ + struct mtk_disp_gamma *gamma = dev_get_drvdata(dev); + unsigned int lut_size = LUT_SIZE_DEFAULT; + + if (gamma && gamma->data) + lut_size = gamma->data->lut_size; + + return lut_size; +} + void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crtc_state *state) { struct mtk_disp_gamma *gamma = dev_get_drvdata(dev); bool lut_diff = false; + u16 lut_size = LUT_SIZE_DEFAULT; unsigned int i, reg; struct drm_color_lut *lut; void __iomem *lut_base; u32 word; u32 diff[3] = {0}; - if (gamma && gamma->data) + if (gamma && gamma->data) { lut_diff = gamma->data->lut_diff; + lut_size = gamma->data->lut_size; + } if (state->gamma_lut) { reg = readl(regs + DISP_GAMMA_CFG); @@ -73,7 +89,7 @@ void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crt writel(reg, regs + DISP_GAMMA_CFG); lut_base = regs + DISP_GAMMA_LUT; lut = (struct drm_color_lut *)state->gamma_lut->data; - for (i = 0; i < MTK_LUT_SIZE; i++) { + for (i = 0; i < lut_size; i++) { if (!lut_diff || (i % 2 == 0)) { word = (((lut[i].red >> 6) & LUT_10BIT_MASK) << 20) + @@ -192,10 +208,12 @@ static int mtk_disp_gamma_remove(struct platform_device *pdev) static const struct mtk_disp_gamma_data mt8173_gamma_driver_data = { .has_dither = true, + .lut_size = 512, }; static const struct mtk_disp_gamma_data mt8183_gamma_driver_data = { .lut_diff = true, + .lut_size = 512, }; static const struct of_device_id mtk_disp_gamma_driver_dt_match[] = { diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index 112615817dcb..fc845490fbb4 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -929,8 +929,8 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, mtk_crtc->ddp_comp[i] = comp; if (comp->funcs) { - if (comp->funcs->gamma_set) - gamma_lut_size = MTK_LUT_SIZE; + if (comp->funcs->gamma_set && comp->funcs->gamma_get_lut_size) + gamma_lut_size = mtk_ddp_gamma_get_lut_size(comp); if (comp->funcs->ctm_set) has_ctm = true; diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.h b/drivers/gpu/drm/mediatek/mtk_drm_crtc.h index cb9a36c48d4f..1799853ef89a 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.h @@ -10,7 +10,6 @@ #include "mtk_drm_ddp_comp.h" #include "mtk_drm_plane.h" -#define MTK_LUT_SIZE 512 #define MTK_MAX_BPC 10 #define MTK_MIN_BPC 3 diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h index 2d0052c23dcb..ab589ea11ba7 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h @@ -65,6 +65,7 @@ struct mtk_ddp_comp_funcs { void (*layer_config)(struct device *dev, unsigned int idx, struct mtk_plane_state *state, struct cmdq_pkt *cmdq_pkt); + unsigned int (*gamma_get_lut_size)(struct device *dev); void (*gamma_set)(struct device *dev, struct drm_crtc_state *state); void (*bgclr_in_on)(struct device *dev); @@ -177,6 +178,14 @@ static inline void mtk_ddp_comp_layer_config(struct mtk_ddp_comp *comp, comp->funcs->layer_config(comp->dev, idx, state, cmdq_pkt); } +static inline unsigned int mtk_ddp_gamma_get_lut_size(struct mtk_ddp_comp *comp) +{ + if (comp->funcs && comp->funcs->gamma_get_lut_size) + return comp->funcs->gamma_get_lut_size(comp->dev); + + return 0; +} + static inline void mtk_ddp_gamma_set(struct mtk_ddp_comp *comp, struct drm_crtc_state *state) { From patchwork Sun Sep 11 15:37:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 12972916 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB65FECAAD3 for ; Sun, 11 Sep 2022 15:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=w8RsouxaUz/1zN0cxIuJMVr9p7oGKFV5LLHN6pHDalk=; b=qpK5sVJLbO5e7a X9HfpGl5xlH14mIuOzdDnwcMaqApkT1aI+t2FI8DAzVT9DUO43eWvI/maNvJs+iN6+QFfmOBV3AFu waEy6job6LAGVyqW2H6RGH2POJO87Emhq48RBOO01qIyQ9mjbcv2glxhy6VVTGZ6vZyT2fYYarqgi ZtY2S7Ira6wQeE6sDTpZ7utpB6k7FlY8av25Tu7F0o1rPD48vk+Vjns9LmpzrLZTUGWRF6BKsOmuT 3Inme2RYr021hJ5tedFPfnwLI+O+M7Ng+G7no1TJs8cQpCCdIzqzANgzEzezhYhQuPbflcUPsda0F 5+T2sMUhjALkT5tsMPQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXP2R-002q1Y-T0; Sun, 11 Sep 2022 15:38:28 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXP1t-002phw-4a; Sun, 11 Sep 2022 15:37:55 +0000 X-UUID: 833ab40d996b4999b8b60d638e4a3b33-20220911 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=/+Zi11NGz7yszxzsbPjLx/MnS4sftnpzTZ58eCD7bdo=; b=SFHdu7NtsS/bnqN57PK0OhXf02jbMGAPFuMX1vVpzUBydEQ5mPkb7gJNlJ+JQUmkOgB4zNCBAp2zoyzpa9isdQAnjflN+QCJlWr28YwrEfPMGmfDgZirZhjluaeGGbzfpVjRYZRkr0zRR8Gfx/Hj9EJ0fARPi4FEo8uRwhyZlvY=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.10,REQID:c28f52d6-3732-41c1-a123-3a385502d50d,OB:0,L OB:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_ Ham,ACTION:release,TS:0 X-CID-META: VersionHash:84eae18,CLOUDID:414f06ec-2856-4fce-b125-09d4c7ebe045,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 833ab40d996b4999b8b60d638e4a3b33-20220911 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1754142363; Sun, 11 Sep 2022 08:37:47 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Sun, 11 Sep 2022 23:37:43 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Sun, 11 Sep 2022 23:37:43 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno CC: CK Hu , Rex-BC Chen , "Singo Chang" , , , , , , , Jason-JH.Lin Subject: [PATCH v3 5/9] drm/mediatek: Add gamma support different lut_bits for other SoC Date: Sun, 11 Sep 2022 23:37:30 +0800 Message-ID: <20220911153734.24243-6-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220911153734.24243-1-jason-jh.lin@mediatek.com> References: <20220911153734.24243-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220911_083753_316977_B65E194D X-CRM114-Status: GOOD ( 16.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add lut_bits in gamma driver data for each SoC and adjust the usage of lut_bits in mtk_drm_gamma_set_common(). Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 36 ++++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c index e69d0b205b9a..155fb5d94d79 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c @@ -25,11 +25,14 @@ #define LUT_10BIT_MASK 0x03ff #define LUT_SIZE_DEFAULT 512 /* for setting gamma lut from AAL */ +#define LUT_BITS_DEFAULT 10 +#define LUT_INPUT_BITS 16 /* input lut bit from application */ struct mtk_disp_gamma_data { bool has_dither; bool lut_diff; u16 lut_size; + u8 lut_bits; }; /* @@ -72,17 +75,23 @@ void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crt struct mtk_disp_gamma *gamma = dev_get_drvdata(dev); bool lut_diff = false; u16 lut_size = LUT_SIZE_DEFAULT; + u8 lut_bits = LUT_BITS_DEFAULT; + u8 shift_bits; unsigned int i, reg; struct drm_color_lut *lut; void __iomem *lut_base; - u32 word; + u32 word, mask; u32 diff[3] = {0}; if (gamma && gamma->data) { lut_diff = gamma->data->lut_diff; lut_size = gamma->data->lut_size; + lut_bits = gamma->data->lut_bits; } + shift_bits = LUT_INPUT_BITS - lut_bits; + mask = GENMASK(lut_bits - 1, 0); + if (state->gamma_lut) { reg = readl(regs + DISP_GAMMA_CFG); reg = reg | GAMMA_LUT_EN; @@ -92,17 +101,20 @@ void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crt for (i = 0; i < lut_size; i++) { if (!lut_diff || (i % 2 == 0)) { - word = (((lut[i].red >> 6) & LUT_10BIT_MASK) << 20) + - (((lut[i].green >> 6) & LUT_10BIT_MASK) << 10) + - ((lut[i].blue >> 6) & LUT_10BIT_MASK); + word = (((lut[i].red >> shift_bits) & mask) << 20) + + (((lut[i].green >> shift_bits) & mask) << 10) + + ((lut[i].blue >> shift_bits) & mask); } else { - diff[0] = (lut[i].red >> 6) - (lut[i - 1].red >> 6); - diff[1] = (lut[i].green >> 6) - (lut[i - 1].green >> 6); - diff[2] = (lut[i].blue >> 6) - (lut[i - 1].blue >> 6); - - word = ((diff[0] & LUT_10BIT_MASK) << 20) + - ((diff[1] & LUT_10BIT_MASK) << 10) + - (diff[2] & LUT_10BIT_MASK); + diff[0] = (lut[i].red >> shift_bits) - + (lut[i - 1].red >> shift_bits); + diff[1] = (lut[i].green >> shift_bits) - + (lut[i - 1].green >> shift_bits); + diff[2] = (lut[i].blue >> shift_bits) - + (lut[i - 1].blue >> shift_bits); + + word = ((diff[0] & mask) << 20) + + ((diff[1] & mask) << 10) + + (diff[2] & mask); } writel(word, (lut_base + i * 4)); } @@ -209,11 +221,13 @@ static int mtk_disp_gamma_remove(struct platform_device *pdev) static const struct mtk_disp_gamma_data mt8173_gamma_driver_data = { .has_dither = true, .lut_size = 512, + .lut_bits = 10, }; static const struct mtk_disp_gamma_data mt8183_gamma_driver_data = { .lut_diff = true, .lut_size = 512, + .lut_bits = 10, }; static const struct of_device_id mtk_disp_gamma_driver_dt_match[] = { From patchwork Sun Sep 11 15:37:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 12972917 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D248ECAAD3 for ; Sun, 11 Sep 2022 15:39:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3MHhJqdHEdHUPiDGub5MK6Hrw2p0to5I7tm85Re8ZxM=; b=WP1Jr1ehAMy0yQ mzp5t96V1GWobQSZ5rG3aUdSyZ1MkRal+Xi37gzkUN9T01BtI5zp43POx21Je7Vd/SrIrYiD4MlQx 9mKbcOya6Y5ltCtYEi3XTTf6Y9kEUADOAk9zm4/tcdI+Fv4yIh16SqNbfl8FMK6E+qShtLB8Oc9JV 9Y/9U2gI4LjJIJtiSytdonl7OptILb7SxakPhmjblB0Yz+uxP9C5ckaSqoTODg4Iue459UDOuTUAf fqV1fNsTVNSVzSuPvOVeSBIDOS0Z+V6og43CQT5Iig4HFjFyatwC+FNET4E2UpOEugpa/RzHGCJBf kIV5BbHTtidvLC8ZIjow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXP2i-002qCZ-NA; Sun, 11 Sep 2022 15:38:44 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXP1r-002pjQ-KK; Sun, 11 Sep 2022 15:37:54 +0000 X-UUID: ed550ad7259249f08d6ddcd9526a4b4e-20220911 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=oAvQ607/aY4vDYDpBvbK7U5/HWXwEVR2GiLNFSXONBE=; b=VZYWXA5U+v+tdakhA1d9Qj4BumVoJV3wMgxoDs0OdWkue7FtPkiFofH3LovO4zB/SWJNW430ThXvMmy8M/gblPJQlN6VmGBe3XgOTQNpfIAVdArf7n8mjnZx/SC+QQv0htWt4buzUAStC3cklKhhY4p9BhVRsYAlr9AbbhQ1CPw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.10,REQID:c41401fc-e23c-440b-9080-14dfa8957989,OB:0,L OB:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_ Ham,ACTION:release,TS:0 X-CID-META: VersionHash:84eae18,CLOUDID:63503e5d-5ed4-4e28-8b00-66ed9f042fbd,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: ed550ad7259249f08d6ddcd9526a4b4e-20220911 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 897147119; Sun, 11 Sep 2022 08:37:48 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Sun, 11 Sep 2022 23:37:43 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Sun, 11 Sep 2022 23:37:43 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno CC: CK Hu , Rex-BC Chen , "Singo Chang" , , , , , , , Jason-JH.Lin Subject: [PATCH v3 6/9] drm/mediatek: Add gamma support different bank_size for other SoC Date: Sun, 11 Sep 2022 23:37:31 +0800 Message-ID: <20220911153734.24243-7-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220911153734.24243-1-jason-jh.lin@mediatek.com> References: <20220911153734.24243-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220911_083751_789291_5173E0DF X-CRM114-Status: GOOD ( 14.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add multiple bank support for mt8195. If bank size is 0 which means no bank support. Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 45 +++++++++++++---------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c index 155fb5d94d79..9983318e8e3e 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c @@ -21,6 +21,7 @@ #define GAMMA_LUT_EN BIT(1) #define GAMMA_DITHERING BIT(2) #define DISP_GAMMA_SIZE 0x0030 +#define DISP_GAMMA_BANK 0x0100 #define DISP_GAMMA_LUT 0x0700 #define LUT_10BIT_MASK 0x03ff @@ -33,6 +34,7 @@ struct mtk_disp_gamma_data { bool lut_diff; u16 lut_size; u8 lut_bits; + u16 bank_size; }; /* @@ -75,9 +77,10 @@ void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crt struct mtk_disp_gamma *gamma = dev_get_drvdata(dev); bool lut_diff = false; u16 lut_size = LUT_SIZE_DEFAULT; + u16 bank_size = lut_size; u8 lut_bits = LUT_BITS_DEFAULT; u8 shift_bits; - unsigned int i, reg; + unsigned int i, j, reg, bank_num; struct drm_color_lut *lut; void __iomem *lut_base; u32 word, mask; @@ -87,8 +90,10 @@ void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crt lut_diff = gamma->data->lut_diff; lut_size = gamma->data->lut_size; lut_bits = gamma->data->lut_bits; + bank_size = gamma->data->bank_size; } + bank_num = lut_size / bank_size; shift_bits = LUT_INPUT_BITS - lut_bits; mask = GENMASK(lut_bits - 1, 0); @@ -98,25 +103,27 @@ void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crt writel(reg, regs + DISP_GAMMA_CFG); lut_base = regs + DISP_GAMMA_LUT; lut = (struct drm_color_lut *)state->gamma_lut->data; - for (i = 0; i < lut_size; i++) { - - if (!lut_diff || (i % 2 == 0)) { - word = (((lut[i].red >> shift_bits) & mask) << 20) + - (((lut[i].green >> shift_bits) & mask) << 10) + - ((lut[i].blue >> shift_bits) & mask); - } else { - diff[0] = (lut[i].red >> shift_bits) - - (lut[i - 1].red >> shift_bits); - diff[1] = (lut[i].green >> shift_bits) - - (lut[i - 1].green >> shift_bits); - diff[2] = (lut[i].blue >> shift_bits) - - (lut[i - 1].blue >> shift_bits); - - word = ((diff[0] & mask) << 20) + - ((diff[1] & mask) << 10) + - (diff[2] & mask); + for (j = 0; j < bank_num; j++) { + writel(j, regs + DISP_GAMMA_BANK); + for (i = 0; i < bank_size; i++) { + if (!lut_diff || (i % 2 == 0)) { + word = (((lut[i].red >> shift_bits) & mask) << 20) + + (((lut[i].green >> shift_bits) & mask) << 10) + + ((lut[i].blue >> shift_bits) & mask); + } else { + diff[0] = (lut[i].red >> shift_bits) - + (lut[i - 1].red >> shift_bits); + diff[1] = (lut[i].green >> shift_bits) - + (lut[i - 1].green >> shift_bits); + diff[2] = (lut[i].blue >> shift_bits) - + (lut[i - 1].blue >> shift_bits); + + word = ((diff[0] & mask) << 20) + + ((diff[1] & mask) << 10) + + (diff[2] & mask); + } + writel(word, (lut_base + i * 4)); } - writel(word, (lut_base + i * 4)); } } } From patchwork Sun Sep 11 15:37:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 12972918 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A707FC54EE9 for ; Sun, 11 Sep 2022 15:40:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5KYzTWMN7vkXVUSPSqG3XlTZBqofVZdOHZiR7gjt5ac=; b=nKpPgmq2eXgcpv iTnuNrXEY6B/Q6O3CtJjbF+86Ysjxga5V+0Ht4kuVlW6DIcERXg7rXadP8kBiUoTQYbSNLU8f03TF sW0TEn27yB6N3y5MEEwmh+F20upNmaTS5R+TuwG+0PuPYU0naS4zaLFB51d6rciy/cJ9Si7Ilhi3R A5j1D7igONZvOila3BY/yHNSzki3qVFyfweVab3jLHSgRqnnZauz0Ahzi6X+21S9m2b2lCjtbHrIw rGgSpain+5oXma5xPz/p0QPKsrjE7ByKvA2Yvynp9HwjVqaPzXi8s9lN6VtZdRDTetnFv/z6Rn7q+ cWyWNk4yurwnmSeRqhsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXP35-002qUo-9w; Sun, 11 Sep 2022 15:39:07 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXP1t-002pje-4Y; Sun, 11 Sep 2022 15:37:55 +0000 X-UUID: 740b19ca3d3e4fadb16e61f8525d2f99-20220911 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=mtkIyGPAyg0zzGjeCvJwRJfp37NCLyih+frhrusZjg0=; b=A15ougl3Xcxo/wF7va9eZapAn89bWfy9v9KRdNyzb6+Z9KrshtDkMVfHGGaxfXCV/3asnrRZxb2bpSdVnIGy3MswliuKoTtrkn3cNBMApiwD5f3uMt4XV44mvFARhSahhvqBMCc2L5TleuaGDvWMFOalohf6dp4v4OIgCCGM10c=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.10,REQID:c4e882b0-b2e5-4ce5-99a3-0cd18d9ab10e,OB:0,L OB:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_ Ham,ACTION:release,TS:0 X-CID-META: VersionHash:84eae18,CLOUDID:4e66fef5-6e85-48d9-afd8-0504bbfe04cb,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:11|1,File: nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 740b19ca3d3e4fadb16e61f8525d2f99-20220911 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 378678794; Sun, 11 Sep 2022 08:37:49 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Sun, 11 Sep 2022 23:37:44 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Sun, 11 Sep 2022 23:37:44 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno CC: CK Hu , Rex-BC Chen , "Singo Chang" , , , , , , , zheng-yan.chen , "Jason-JH . Lin" Subject: [PATCH v3 7/9] drm/mediatek: Add gamma lut support for mt8195 Date: Sun, 11 Sep 2022 23:37:32 +0800 Message-ID: <20220911153734.24243-8-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220911153734.24243-1-jason-jh.lin@mediatek.com> References: <20220911153734.24243-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220911_083753_294750_A31CB98D X-CRM114-Status: GOOD ( 16.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "zheng-yan.chen" Since the previous gamma_set_common() function is designed for 9bit-to-10bit conversion, which is not feasible for the 10bit-to-12bit conversion in mt8195. 1. Update the function to fit the need of mt8195. 2. Add gamma driver data for mt8195. Signed-off-by: zheng-yan.chen Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 57 ++++++++++++++++------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c index 9983318e8e3e..4e67f1503b9a 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c @@ -23,6 +23,7 @@ #define DISP_GAMMA_SIZE 0x0030 #define DISP_GAMMA_BANK 0x0100 #define DISP_GAMMA_LUT 0x0700 +#define DISP_GAMMA_LUT1 0x0b00 #define LUT_10BIT_MASK 0x03ff #define LUT_SIZE_DEFAULT 512 /* for setting gamma lut from AAL */ @@ -82,9 +83,8 @@ void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crt u8 shift_bits; unsigned int i, j, reg, bank_num; struct drm_color_lut *lut; - void __iomem *lut_base; - u32 word, mask; - u32 diff[3] = {0}; + void __iomem *lut_base, *lut1_base; + u32 word, word1, mask; if (gamma && gamma->data) { lut_diff = gamma->data->lut_diff; @@ -102,27 +102,41 @@ void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crt reg = reg | GAMMA_LUT_EN; writel(reg, regs + DISP_GAMMA_CFG); lut_base = regs + DISP_GAMMA_LUT; + lut1_base = regs + DISP_GAMMA_LUT1; lut = (struct drm_color_lut *)state->gamma_lut->data; for (j = 0; j < bank_num; j++) { writel(j, regs + DISP_GAMMA_BANK); for (i = 0; i < bank_size; i++) { - if (!lut_diff || (i % 2 == 0)) { - word = (((lut[i].red >> shift_bits) & mask) << 20) + - (((lut[i].green >> shift_bits) & mask) << 10) + - ((lut[i].blue >> shift_bits) & mask); + struct drm_color_lut input; + + input.red = (lut[i].red >> shift_bits) & mask; + input.green = (lut[i].green >> shift_bits) & mask; + input.blue = (lut[i].blue >> shift_bits) & mask; + if (!lut_diff || i % 2 == 0) { + word = (lut_bits == 12) ? + (input.red + (input.green << 12)) : + ((input.red << 20) + (input.green << 10) + + input.blue); + word1 = input.blue; } else { - diff[0] = (lut[i].red >> shift_bits) - - (lut[i - 1].red >> shift_bits); - diff[1] = (lut[i].green >> shift_bits) - - (lut[i - 1].green >> shift_bits); - diff[2] = (lut[i].blue >> shift_bits) - - (lut[i - 1].blue >> shift_bits); - - word = ((diff[0] & mask) << 20) + - ((diff[1] & mask) << 10) + - (diff[2] & mask); + struct drm_color_lut diff; + + diff.red = input.red - + ((lut[i - 1].red >> shift_bits) & mask); + diff.green = input.green - + ((lut[i - 1].green >> shift_bits & mask)); + diff.blue = input.blue - + ((lut[i - 1].blue >> shift_bits) & mask); + + word = (lut_bits == 12) ? + (input.red + (input.green << 12)) : + (diff.red << 20) + (diff.green << 10) + diff.blue; + word1 = input.blue; } + writel(word, (lut_base + i * 4)); + if (lut_bits == 12) + writel(word1, (lut1_base + i * 4)); } } } @@ -237,11 +251,20 @@ static const struct mtk_disp_gamma_data mt8183_gamma_driver_data = { .lut_bits = 10, }; +static const struct mtk_disp_gamma_data mt8195_gamma_driver_data = { + .lut_diff = true, + .lut_size = 512, + .lut_bits = 10, + .bank_size = 256, +}; + static const struct of_device_id mtk_disp_gamma_driver_dt_match[] = { { .compatible = "mediatek,mt8173-disp-gamma", .data = &mt8173_gamma_driver_data}, { .compatible = "mediatek,mt8183-disp-gamma", .data = &mt8183_gamma_driver_data}, + { .compatible = "mediatek,mt8195-disp-gamma", + .data = &mt8195_gamma_driver_data}, {}, }; MODULE_DEVICE_TABLE(of, mtk_disp_gamma_driver_dt_match); From patchwork Sun Sep 11 15:37:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 12972919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 57DDBECAAD3 for ; Sun, 11 Sep 2022 15:40:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Vd/jVEsjVxxPkLBNPltwdz5/MsK7AFwiVx2Kb3Qq/BU=; b=NjJMtEOHc1VQYF T+OPwB0sGlaqPQp2xAPZdR7GgstSVM++e+5wmhAc7TooxnrKhN9Zz4fqLdqkhpKKK+IIRXPfL7lyQ yb7nSnpCh8y7UHTQEb0fbS7kqofFREP6PaNRl8B8igRU3oCGD7GZ+eAIjuFyNq2gKVHkh7AbeFmNf H9dtaYc9VQHm3Vs4z9x+GjPBHQgn/1PWRHwwGIYFdxyBpEX9pRHZmPDKx9PujjCZw1Ir5/uoVzrzr aepfoWlxzriFSqHlOcevpEkjfNDqIVvMJKNRaY+dqShWZF8799XgdATETmvbfmTTTyXRhFjPGKqyz kal9fyVAwyn/nJFFIJNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXP3W-002qoP-Eh; Sun, 11 Sep 2022 15:39:34 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXP2P-002pzx-V8; Sun, 11 Sep 2022 15:38:27 +0000 X-UUID: 391031ee435441d89fbefb72a4b7df31-20220911 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=ul9i8erPB1DoaRLOoK8QSUHMoEYMlUQuYgsmBM/7Fug=; b=UkYXEwhB973pRL3TE9kFOeHSuKyCrWtvlq5oJ9jS/2tm+AYPMRJHcKwOuOgH45TY2mZBjYm4f9yapYJ7+lLiMBoWDSb6zPM+5JKl0k3ze1TuI5+Q8CgPWTtT+r0sluNI8E26Efgj8DaDnKs4CMF50YdiVI3dY51DsN1DyosllSk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.10,REQID:a6307fed-e38a-4576-ba5c-5add8029697a,OB:0,L OB:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_ Ham,ACTION:release,TS:0 X-CID-META: VersionHash:84eae18,CLOUDID:7f5006ec-2856-4fce-b125-09d4c7ebe045,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 391031ee435441d89fbefb72a4b7df31-20220911 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1962756775; Sun, 11 Sep 2022 08:38:19 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Sun, 11 Sep 2022 23:37:44 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Sun, 11 Sep 2022 23:37:44 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno CC: CK Hu , Rex-BC Chen , Singo Chang , , , , , , , Jason-JH.Lin Subject: [PATCH v3 8/9] drm/mediatek: Add clear RELAY_MODE bit to set gamma Date: Sun, 11 Sep 2022 23:37:33 +0800 Message-ID: <20220911153734.24243-9-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220911153734.24243-1-jason-jh.lin@mediatek.com> References: <20220911153734.24243-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220911_083826_034216_621E5BB0 X-CRM114-Status: GOOD ( 11.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since the bootlaoder may set the RELAY_MODE to gamma be for the kerenl, we have to clear the RELAY_MODE bit to make sure that the gamma is enabled correctly. Fixes: b10023b03082 ("FROMGIT: drm/mediatek: Separate gamma module") Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c index 4e67f1503b9a..77cc344b9c02 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c @@ -18,6 +18,7 @@ #define DISP_GAMMA_EN 0x0000 #define GAMMA_EN BIT(0) #define DISP_GAMMA_CFG 0x0020 +#define RELAY_MODE BIT(0) #define GAMMA_LUT_EN BIT(1) #define GAMMA_DITHERING BIT(2) #define DISP_GAMMA_SIZE 0x0030 @@ -99,6 +100,7 @@ void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crt if (state->gamma_lut) { reg = readl(regs + DISP_GAMMA_CFG); + reg = reg & ~RELAY_MODE; reg = reg | GAMMA_LUT_EN; writel(reg, regs + DISP_GAMMA_CFG); lut_base = regs + DISP_GAMMA_LUT; From patchwork Sun Sep 11 15:37:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFzb24tSkggTGluICjmnpfnnb/npaUp?= X-Patchwork-Id: 12972941 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14926C54EE9 for ; Sun, 11 Sep 2022 16:11:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TCZKJbxl55ub9OYM0JsUAkrHNibsmDh6/9As+4BKxh4=; b=ALop4ccdEw3gxz 6E+rKS3DGk3tzrVdHNeVABEE8voPYTr6aT9vmcGS24CQM6W9tgFYmBdUpn8anSqf8VdsbXM41VshW gynsH70VUZCi9sQHd7xexhG0zYJEzi+oKL73p/fKZVEWg7LSpvSDMHyzvjUgaYFWZvHd/QdFIIO7p 3D4TAXr29o8cUKjirvTB1JFHT+SKFFE3KXRtFp+7mOi7tQQzsZGlbATC42AwHEsKfk6N+dU/HZbvT 8tIwDtOnzcxphIJGwqnoaTvbPNRu6Q3h3MlzxKz6CKKomo2NWVwtz/P35tzgB6jjguF/6hem8caC+ /UdrAmqLxuqDr5h/e+MA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXPWU-0033TH-Ic; Sun, 11 Sep 2022 16:09:30 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXPWR-0033S0-IT; Sun, 11 Sep 2022 16:09:28 +0000 X-UUID: 2f841598d864477683059c81c2c1c6f1-20220911 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=8dXiDlITRRdV1fryZ6x6Kqua0WndoPmtkLh2DFTBuNo=; b=Fx3Z9oN4zHszhaBJndVpMawOsRsRKu7KhuQEKZsNiU6wpcTG2yxgFYxdghgtBl1oryCu/nH8LoybwY+SIX14lR9XAz429iLZXT/nhf+bBpDAIYZ3NfamVZiwbXTIJUl75rkuwfACuHHsm9EfZza3dkYiI05wSdR2bVe93BGLhD4=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.10,REQID:9ab1d23b-6317-4015-8bb6-7d210d249fec,OB:0,L OB:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_ Ham,ACTION:release,TS:0 X-CID-META: VersionHash:84eae18,CLOUDID:17cefef5-6e85-48d9-afd8-0504bbfe04cb,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 2f841598d864477683059c81c2c1c6f1-20220911 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 472050551; Sun, 11 Sep 2022 09:09:21 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Sun, 11 Sep 2022 23:37:44 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Sun, 11 Sep 2022 23:37:44 +0800 From: Jason-JH.Lin To: Chun-Kuang Hu , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno CC: CK Hu , Rex-BC Chen , Singo Chang , , , , , , , zheng-yan.chen , "Jason-JH . Lin" Subject: [PATCH v3 9/9] arm64: dts: Modify gamma compatible for mt8195 Date: Sun, 11 Sep 2022 23:37:34 +0800 Message-ID: <20220911153734.24243-10-jason-jh.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220911153734.24243-1-jason-jh.lin@mediatek.com> References: <20220911153734.24243-1-jason-jh.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220911_090927_627646_A46AD52F X-CRM114-Status: GOOD ( 11.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "zheng-yan.chen" Modify gamma compatible for mt8195. This modification is because of that mt8183 gamma driver data is not compatible with mt8195 gamma. Thus, need to delete mt8183 gamma compatible from mt8195 gamma. Signed-off-by: zheng-yan.chen Signed-off-by: Jason-JH.Lin Reviewed-by: AngeloGioacchino Del Regno --- arch/arm64/boot/dts/mediatek/mt8195.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8195.dtsi b/arch/arm64/boot/dts/mediatek/mt8195.dtsi index 905d1a90b406..6b01ebc0db8f 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi @@ -2032,7 +2032,7 @@ }; gamma0: gamma@1c006000 { - compatible = "mediatek,mt8195-disp-gamma", "mediatek,mt8183-disp-gamma"; + compatible = "mediatek,mt8195-disp-gamma"; reg = <0 0x1c006000 0 0x1000>; interrupts = ; power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS0>;