From patchwork Thu Jan 28 11:23:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12053401 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4209C433DB for ; Thu, 28 Jan 2021 11:26:00 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7F68C64DDA for ; Thu, 28 Jan 2021 11:26:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F68C64DDA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=llCbny3v+MRVc18IZJSoNC+Fzdu7zmaCyoo6L6pWnxs=; b=Mv4xTQXn/4o4OFoOiRzNcBnXR 0kDlyEj3JfXrJo0IZeD6vdTD6s5wNzBG7Tgef8PKeLMO4CZg9ZGQXEcCpOvtfvom/2ckDCahrTMcd kx5mg5glrpkb2nhbZcqtaBDCv04kZ6ykBUnwKq4jHJRjNLUhAX2e2cK8aNFvjAeDy68RIrXNQMvEs NuRpG+kSdMu3XsmpuWaVLVz42P+fl4KM/oNVclXPlJ0DTg5AFk4yKxWQZ4Ih2bhMyPW+pQuIDdJe1 DrzZEmOh9otCR6GMAF33bg2TO48a4B462bMuXXbnGQcq8b0hSgUkHd37FgblichqS3Px0ETVfBYv3 o2znT4zEw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l55Po-00015R-4w; Thu, 28 Jan 2021 11:24:44 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l55Oj-0000Wj-JL for linux-arm-kernel@lists.infradead.org; Thu, 28 Jan 2021 11:23:42 +0000 Received: by mail-pl1-x634.google.com with SMTP id u11so3129991plg.13 for ; Thu, 28 Jan 2021 03:23:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JFDIHF7A4xcJQCMZd2qVFd4aLKExesv1nCxMC8zcGnE=; b=oCMMsElsQjsYPCn7s2OLoPRchtAGewDclcCB5Q6GrqZA5TKeMKJPxdvzz6h5bJ889o dwktzpXo1aQ3vUb5IXfxY18SRSetXL1DRLDBttfCpGcP2Y+vDLMHzjjdVmmDqQSE70ed iHV7J2Vf+J+/L9+HQcJ6smMrv1O8bdvOxxEEo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JFDIHF7A4xcJQCMZd2qVFd4aLKExesv1nCxMC8zcGnE=; b=pXfY7iqyh7fYkXP7dV74xYtr8MhYk0Vl/w8yqvUvR4/UycmyTFfInz7ZYhEYNQU9aS q7HiOGfI6GZZnDyPbqM+RaM0uJlQpNhntdgj9qU9lgvI6UuzQCzrQfI+3MqZp41EfY7a MwrU+qNJ5nZ+9t1R0WLYakZ8KMVlXkO0wfMhnlueOki2hc2fj1coPlsa4+4hE9Rhhkiw yrjCcr0biCtq4YTL1r8OtSb2EsHjGVkoE47TO74x/BQoXN0s5inkG9elZITtF+NISkvK jSFFcTeRcDix9mRUAiSnYckyrrNYckgPOtyyIAm7U6mww5qukchcCH+wCh5rCqIWUfxn /CiA== X-Gm-Message-State: AOAM532X2RH0hg9KWRAGEp4G+Dj7QaNYHHOny1/69e05qeiqJo/3n3dl Tqu7e4qj8Dn7pHjtu77jPhu8oQ== X-Google-Smtp-Source: ABdhPJxvKZHW3iC9gdjoGC9Ej9lSJzioxFB5NLyQI/sXvEHdrcLtbheh/V1Xf/BpFNPjD0XrWJfwgg== X-Received: by 2002:a17:902:8342:b029:e1:6aa:d770 with SMTP id z2-20020a1709028342b02900e106aad770mr7671394pln.27.1611833015130; Thu, 28 Jan 2021 03:23:35 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:e0a5:d2fc:aaad:1e4a]) by smtp.gmail.com with ESMTPSA id j198sm3138315pfd.71.2021.01.28.03.23.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jan 2021 03:23:34 -0800 (PST) From: Hsin-Yi Wang To: CK Hu , Philipp Zabel , Matthias Brugger Subject: [PATCH v12 6/8] drm/mediatek: enable dither function Date: Thu, 28 Jan 2021 19:23:12 +0800 Message-Id: <20210128112314.1304160-7-hsinyi@chromium.org> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog In-Reply-To: <20210128112314.1304160-1-hsinyi@chromium.org> References: <20210128112314.1304160-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210128_062337_809002_76E3924F X-CRM114-Status: GOOD ( 15.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Yongqiang Niu , David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Daniel Vetter , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Yongqiang Niu for 5 or 6 bpc panel, we need enable dither function to improve the display quality Signed-off-by: Yongqiang Niu Signed-off-by: Hsin-Yi Wang --- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c index ac2cb25620357..6c8f246380a74 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c @@ -53,6 +53,7 @@ #define DITHER_EN BIT(0) #define DISP_DITHER_CFG 0x0020 #define DITHER_RELAY_MODE BIT(0) +#define DITHER_ENGINE_EN BIT(1) #define DISP_DITHER_SIZE 0x0030 #define LUT_10BIT_MASK 0x03ff @@ -314,9 +315,19 @@ static void mtk_dither_config(struct device *dev, unsigned int w, unsigned int bpc, struct cmdq_pkt *cmdq_pkt) { struct mtk_ddp_comp_dev *priv = dev_get_drvdata(dev); + bool enable = (bpc == 5 || bpc == 6); - mtk_ddp_write(cmdq_pkt, h << 16 | w, &priv->cmdq_reg, priv->regs, DISP_DITHER_SIZE); - mtk_ddp_write(cmdq_pkt, DITHER_RELAY_MODE, &priv->cmdq_reg, priv->regs, DISP_DITHER_CFG); + if (enable) { + mtk_dither_set_common(priv->regs, &priv->cmdq_reg, bpc, + DISP_DITHER_CFG, DITHER_ENGINE_EN, + cmdq_pkt); + } else { + mtk_ddp_write(cmdq_pkt, DITHER_RELAY_MODE, &priv->cmdq_reg, + priv->regs, DISP_DITHER_CFG); + } + + mtk_ddp_write(cmdq_pkt, h << 16 | w, &priv->cmdq_reg, priv->regs, + DISP_DITHER_SIZE); } static void mtk_dither_start(struct device *dev)