From patchwork Fri Jan 29 09:22:07 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: 12055519 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 4088BC433E0 for ; Fri, 29 Jan 2021 09:24:38 +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 EF68A64E24 for ; Fri, 29 Jan 2021 09:24:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF68A64E24 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=86iN1hWZ4xMz0Xlx+ixZzvDa6rNF6585JSx+K327ojU=; b=MlQ2cSFc74W4ezom0etB03b2k ckM4EtbfRps09iu7sa+U7J4/jce+/tXbVp5/sZpAkODhV9HRPyrV2fdyUlWKKBZS7EcjxohwtN9kd bYWP7DFB4JQyOzfntSjmHrURaHOUFBaFcJV0JDSG41IxpzzlTbiU5dVOvKqXdnQcJ/5xVZ5+N2skD HXaN6Wct+dR5yl2b4N8oXHP6iKRxeJ7UJRINeb0FHzVGPTWsJcEMiEFOMQw7K60JeZskyiLGhtvL4 lLpPasg0DFY8bZdCBe2rsdNT/XvW41Ed/pCm5pUEc5/mFz7KuJyScE36ICKuTqCwx5nLFVN4rsmoR 3yzskh7lA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l5Pzv-0005dm-Fx; Fri, 29 Jan 2021 09:23:23 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l5Pz6-0005Hd-JJ for linux-arm-kernel@lists.infradead.org; Fri, 29 Jan 2021 09:22:38 +0000 Received: by mail-pf1-x42c.google.com with SMTP id w14so5872021pfi.2 for ; Fri, 29 Jan 2021 01:22:31 -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=GAxvV7R4/vTpyFlTAS6Pj5shqaEt+L+HnuJKV7F1rVo=; b=Ror+4QerXQjaE2vsEtt/+J6Osk5wHvps9k7IL561MxxrR0M8AlpNXUTXL7GSZcEmIa sGXI1Pk8qyQWP2g3mUunqAmPL2czr29hlfaAkss9eMjS2WmmhBLBicT3gcjqEfOH7qFD P37bkpKSfyXEaMLWmGCnk/e0dElc79D15tfe8= 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=GAxvV7R4/vTpyFlTAS6Pj5shqaEt+L+HnuJKV7F1rVo=; b=jGtvIG2JpV9RojlRjohvWsIghvpoDc5W0mqAVRDrB8J7fHjA+MRsvWkS8BTcx9IQYe u9/ixEnJoIIXluHWolSHJxx4U7+6WRk4jqz24m1GYIyxhguuuhRR+IUU+xRZQlKrahpG 3C8v6CLfmUB8M0tTMFzhraXlET2Xb6jcPLSFQb9liq0EBzaX7xye/o/7pv1KsleVK4H6 NJ++OK9myo0EzZBm4wdYf7cIBXuDB4Wa8udv5lhrtly2tEDbbjE5AGKovGxDNPp0igAJ RRzy6q5W433o7kyiNNllJc4wOn8YMgb1SH/iLPUx1oxldYmqW7gCzLXutoM3uBW2M92D puDQ== X-Gm-Message-State: AOAM530UnA4cRih8JSVEzyxwxJCaydtvxpcqZYNETjipWVdUceDQOJkp rmm0JuPgEUmFWQuycZcHWV2Nhw== X-Google-Smtp-Source: ABdhPJy4+2S1A2x1ndwikJR7JIysE1W0izSM4nTbR8FztfNfzjanB9rfmcVpcKhsDDrm7mJ2NRd+CA== X-Received: by 2002:a63:1c09:: with SMTP id c9mr3869976pgc.185.1611912150169; Fri, 29 Jan 2021 01:22:30 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:51f1:c468:a70b:7c09]) by smtp.gmail.com with ESMTPSA id p7sm8032776pfn.52.2021.01.29.01.22.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 01:22:29 -0800 (PST) From: Hsin-Yi Wang To: CK Hu , Philipp Zabel , Matthias Brugger Subject: [PATCH v13 6/8] drm/mediatek: enable dither function Date: Fri, 29 Jan 2021 17:22:07 +0800 Message-Id: <20210129092209.2584718-7-hsinyi@chromium.org> X-Mailer: git-send-email 2.30.0.365.g02bc693789-goog In-Reply-To: <20210129092209.2584718-1-hsinyi@chromium.org> References: <20210129092209.2584718-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210129_042232_923902_65611760 X-CRM114-Status: GOOD ( 14.65 ) 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 Enable dither function to improve the display quality for dither supported bpc 4, 6, 8. For not supported bpc, use relay mode. Signed-off-by: Yongqiang Niu Signed-off-by: Hsin-Yi Wang --- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 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..5761dd15eedf2 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,17 @@ 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); - - 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); + bool valid_bpc = (bpc == 4 || bpc == 6 || bpc == 8); + + mtk_ddp_write(cmdq_pkt, h << 16 | w, &priv->cmdq_reg, priv->regs, + DISP_DITHER_SIZE); + if (valid_bpc) + 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); } static void mtk_dither_start(struct device *dev)