Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp193090rdg; Thu, 12 Oct 2023 02:59:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFwCcsl0ZqU8fxy3/FFXeG1HD3OPncSVArBadvExnt+RW3kpBX8uj0Fyrdsj/3oW0fML6oJ X-Received: by 2002:a25:698a:0:b0:d9a:bd06:f252 with SMTP id e132-20020a25698a000000b00d9abd06f252mr1737761ybc.57.1697104739857; Thu, 12 Oct 2023 02:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697104739; cv=none; d=google.com; s=arc-20160816; b=CwtWTvkb/Mv2qVIwUbKtlVIG6w5I+6BbLI9+gHFPR2ylNqigT0VeSq0np8JIF1Xypb rA+EHcj7dbxZm7v6xz1ileVdzd5y4CCxJsWdYob3Vh3oTyqoqODiB2z0J1Ctut8kSoPs R5VQtRQ8EScgMovoQzhtfBACOzL/GqgvIxRQhYNStN5GaUZ30Yp7Pso1n06lDodu7DjY kOtIZIJwMrmjW1bH9NMOzo57mYOZ0aqKBG9Ir7CzNkT9ft0RoNb/cq8NjFigPgg8JBb9 rzT31nUdlJucowuS13EY3BUl2qCOxE6h9pjk1S1GBQfmSTup92gCSrn9oWABG2YkSSGT J+WQ== 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=FJzKBxqQPBO/X/mfBXuQpi3PlOrt6qw31uT/6YMQtWM=; fh=KhamMcu+afW+JcycbJwsIN7GCvQjQBx356VRODtXooA=; b=C0JOC9xkKk27omEf+slMCR+1bKB/r3GlEi5odyL94ejKXF+S8eAUvni8T/7sdX8EJc UFWsC3u8WvfnIC5101nUP7zhOtcx3Lo3i4PUF3u4Pi/vHSa6J0IpVQrdn7iWXoLBc5WS QhufT3Wsaf2sJIuDyE1S7vrLsrOFXyVRICKwa/be5u9yROfEKs90yEyk9dA29L3XyCiw moE9eITvcakhRg8ztVbkIhLQPHNmQdGrWcZph0+REP/k0577n+XN5M23lVwVKQgdR6Pk WrYem1oIOGB5tzQpFxApfSOx0V6WtV9eE+Js75WFk4HGblBqdehFxcVMtFwSTX46/Udq gm6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=G+R5v+WP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id z64-20020a633343000000b00565eccbc52fsi1899975pgz.303.2023.10.12.02.58.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 02:58:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=G+R5v+WP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 A59DD821A14B; Thu, 12 Oct 2023 02:58:58 -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 S1343572AbjJLJ6u (ORCPT + 99 others); Thu, 12 Oct 2023 05:58:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235583AbjJLJ55 (ORCPT ); Thu, 12 Oct 2023 05:57:57 -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 AA589C9 for ; Thu, 12 Oct 2023 02:57:55 -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 9F24B660735D; Thu, 12 Oct 2023 10:57:53 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697104674; bh=gUWo3dRRaH++g0myacHkp7Vdu/naNGAgWJ0AG8LeCwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G+R5v+WP/rjQf/596VINkvDzEj3wACEIOVKJ2m3YCyFG4JpySZxkrPqMxJjhy7X9H 5XS2xnUPZgpX3nan9lVtgepFWBT3TPoIWq6OAVEs67m0f/XG+E50YqVLqEO5vZ59EE qJOvnWbcQMI0w1ou9eKNsFM3ZeSB0iUmra8hhUH9+bkXGSXH1lQD53u1fOrLjA1GHW rnSAC4ubzWSUh8oubz7Ckuj2t249HCdAmDwtnC+jFZS8dbhZDix7dk6aVHXE9+uOyB LFuO5UGr6b3xB4pj9K7wMxcK0A8IaN+38V7GnBdkEJJEnamhvyCd2yuk37eiXQodOR viVgRger7qUPg== 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 12/16] drm/mediatek: gamma: Make sure relay mode is disabled Date: Thu, 12 Oct 2023 11:57:32 +0200 Message-ID: <20231012095736.100784-13-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 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,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:58:58 -0700 (PDT) Disable relay mode at the end of LUT programming to make sure that the processed image goes through in both DISP_GAMMA and DISP_AAL for gamma setting. Reviewed-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 | 4 ++++ drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_aal.c b/drivers/gpu/drm/mediatek/mtk_disp_aal.c index a618be9b3dba..15f91cea9f20 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_aal.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_aal.c @@ -18,6 +18,7 @@ #define DISP_AAL_EN 0x0000 #define AAL_EN BIT(0) #define DISP_AAL_CFG 0x0020 +#define AAL_RELAY_MODE BIT(0) #define AAL_GAMMA_LUT_EN BIT(1) #define DISP_AAL_SIZE 0x0030 #define DISP_AAL_SIZE_HSIZE GENMASK(28, 16) @@ -119,6 +120,9 @@ void mtk_aal_gamma_set(struct device *dev, struct drm_crtc_state *state) /* Enable the gamma table */ cfg_val |= FIELD_PREP(AAL_GAMMA_LUT_EN, 1); + /* Disable RELAY mode to pass the processed image */ + cfg_val &= ~AAL_RELAY_MODE; + writel(cfg_val, aal->regs + DISP_AAL_CFG); } diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c index bcc33aeca885..6746033615db 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c @@ -19,6 +19,7 @@ #define DISP_GAMMA_EN 0x0000 #define GAMMA_EN BIT(0) #define DISP_GAMMA_CFG 0x0020 +#define GAMMA_RELAY_MODE BIT(0) #define GAMMA_LUT_EN BIT(1) #define GAMMA_DITHERING BIT(2) #define DISP_GAMMA_SIZE 0x0030 @@ -175,6 +176,9 @@ void mtk_gamma_set(struct device *dev, struct drm_crtc_state *state) /* Enable the gamma table */ cfg_val |= FIELD_PREP(GAMMA_LUT_EN, 1); + /* Disable RELAY mode to pass the processed image */ + cfg_val &= ~GAMMA_RELAY_MODE; + writel(cfg_val, gamma->regs + DISP_GAMMA_CFG); } -- 2.42.0