From patchwork Thu Oct 7 07:08:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 515441 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp1022387ime; Thu, 7 Oct 2021 00:09:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCDBujl5YOPm06hLgpPYUvUtgK7hu/RZCwhbyHI6w4CFrEwVzMAB+3kWUvpaoy1PupGFlY X-Received: by 2002:a17:90a:53:: with SMTP id 19mr3479126pjb.159.1633590570345; Thu, 07 Oct 2021 00:09:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633590570; cv=none; d=google.com; s=arc-20160816; b=VPznKvOVi9057I334PutCmeEG2MFi04pvWz2/439lXLObU5frMvS/dt+WSnD9uhNxj 1eRHnY5qW/+zLlcmhvy1bvZ/n+iQNPmoiK4wDswH9pJPviAAXglY7Z8fmC7ZainXXVcm Nh9m047h+W91c1LeUdcF1NIC5VLMNrIy+3diGuR6wKA0MVt442KyBoFjtmwFvJjuJ6h5 HGvndy3EN6n2hankVTlga4uNmJ4c3WDaI8/kHSf2AHXCo2Yd6/IRSkCVnNblhL2gltCa xhpLXU+LbIM1KqbTI0Ih7WdrZgUtBK9JLjmnWcu+LpgGMsdUaPWG5cIKAecGdVVCnWEx eoIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:delivered-to; bh=EzE9KX7E3d4nq7aEwi2dKMKgSPPkRp/A36O4vUbXGo0=; b=RXBRkno81zhJm9fjt+iqiABHW92TOX02UslXc1qjgpWjL+RPJKWdu7zxh0KQ8AMgVa ZCuWFlBL8v3BIRfEUckOHS4q2hRvGDO4KNCOkS+Oa55Gx6lDJf9cE80DQinfhYu0UpWZ t2T3YRWkCRgsrcBGUIvLD7halkqN/z27HBafQQwLiTRMkuLoASaZApuODndhocepBRaG dRaHj++xKv/O9z8X9h0T53CF8+Zb2scgyFacmsW6jeJTiwxd1F3wCdSugH+bDBT03/SE saa/eh1+2XgfavkN9T3UV+lMu69+C5i+/WuviL7JrcmkFt9Wiv6guofrChQ/6764d/ix TPvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CRRBoGnt; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id z11si3324387pge.484.2021.10.07.00.09.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 00:09:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CRRBoGnt; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 01C086F393; Thu, 7 Oct 2021 07:09:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 53DBE6F393; Thu, 7 Oct 2021 07:09:28 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 97A8061130; Thu, 7 Oct 2021 07:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633590568; bh=Ahbq9CwUJJPhOVAStHbbA5PmPgeVLFt5m1zvh6QwfnY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CRRBoGntoaJo3FxcCERE4Lwrohs8b8cNId5+QdAxmnTNvtAPbhElcjeHl5kAhKw42 lE2APv0PpSRlz7N6IwhulkCUXiK2U7KnrqgUau2XkaD507BsS3lGx/+tqrWgczpUEC uqC4vkjxNGl3ttkUmhYVA8UzH4+1HtKDZhA6ufJmGGEXiGuCfLLwnt0NlriGKjXyyG HVJJmBczz2ppmb2mlCJq4wsu9S8+734CxPhN2pxph/XkE95BiVKtdoLJmR6IpzqEol /MGuW6GRM4M9Okk9491H1ofBWAJ1TiDou/NIMjtS5wRvZ+rtJITNLMpBcpyez1hiiE CoFX6VVx4fCdw== From: Vinod Koul To: Rob Clark Cc: linux-arm-msm@vger.kernel.org, Bjorn Andersson , Vinod Koul , David Airlie , Daniel Vetter , Jonathan Marek , Dmitry Baryshkov , Abhinav Kumar , Jeffrey Hugo , Sumit Semwal , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 03/11] drm/msm/disp/dpu1: Add support for DSC in pingpong block Date: Thu, 7 Oct 2021 12:38:52 +0530 Message-Id: <20211007070900.456044-4-vkoul@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007070900.456044-1-vkoul@kernel.org> References: <20211007070900.456044-1-vkoul@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In SDM845, DSC can be enabled by writing to pingpong block registers, so add support for DSC in hw_pp Reviewed-by: Abhinav Kumar Signed-off-by: Vinod Koul Reviewed-by: Dmitry Baryshkov --- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 32 +++++++++++++++++++ .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h | 14 ++++++++ 2 files changed, 46 insertions(+) -- 2.31.1 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c index 55766c97c4c8..47c6ab6caf95 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c @@ -28,6 +28,9 @@ #define PP_FBC_MODE 0x034 #define PP_FBC_BUDGET_CTL 0x038 #define PP_FBC_LOSSY_MODE 0x03C +#define PP_DSC_MODE 0x0a0 +#define PP_DCE_DATA_IN_SWAP 0x0ac +#define PP_DCE_DATA_OUT_SWAP 0x0c8 #define PP_DITHER_EN 0x000 #define PP_DITHER_BITDEPTH 0x004 @@ -245,6 +248,32 @@ static u32 dpu_hw_pp_get_line_count(struct dpu_hw_pingpong *pp) return line; } +static int dpu_hw_pp_dsc_enable(struct dpu_hw_pingpong *pp) +{ + struct dpu_hw_blk_reg_map *c = &pp->hw; + + DPU_REG_WRITE(c, PP_DSC_MODE, 1); + return 0; +} + +static void dpu_hw_pp_dsc_disable(struct dpu_hw_pingpong *pp) +{ + struct dpu_hw_blk_reg_map *c = &pp->hw; + + DPU_REG_WRITE(c, PP_DSC_MODE, 0); +} + +static int dpu_hw_pp_setup_dsc(struct dpu_hw_pingpong *pp) +{ + struct dpu_hw_blk_reg_map *pp_c = &pp->hw; + int data; + + data = DPU_REG_READ(pp_c, PP_DCE_DATA_OUT_SWAP); + data |= BIT(18); /* endian flip */ + DPU_REG_WRITE(pp_c, PP_DCE_DATA_OUT_SWAP, data); + return 0; +} + static void _setup_pingpong_ops(struct dpu_hw_pingpong *c, unsigned long features) { @@ -256,6 +285,9 @@ static void _setup_pingpong_ops(struct dpu_hw_pingpong *c, c->ops.get_autorefresh = dpu_hw_pp_get_autorefresh_config; c->ops.poll_timeout_wr_ptr = dpu_hw_pp_poll_timeout_wr_ptr; c->ops.get_line_count = dpu_hw_pp_get_line_count; + c->ops.setup_dsc = dpu_hw_pp_setup_dsc; + c->ops.enable_dsc = dpu_hw_pp_dsc_enable; + c->ops.disable_dsc = dpu_hw_pp_dsc_disable; if (test_bit(DPU_PINGPONG_DITHER, &features)) c->ops.setup_dither = dpu_hw_pp_setup_dither; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h index 89d08a715c16..12758468d9ca 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h @@ -124,6 +124,20 @@ struct dpu_hw_pingpong_ops { */ void (*setup_dither)(struct dpu_hw_pingpong *pp, struct dpu_hw_dither_cfg *cfg); + /** + * Enable DSC + */ + int (*enable_dsc)(struct dpu_hw_pingpong *pp); + + /** + * Disable DSC + */ + void (*disable_dsc)(struct dpu_hw_pingpong *pp); + + /** + * Setup DSC + */ + int (*setup_dsc)(struct dpu_hw_pingpong *pp); }; struct dpu_hw_merge_3d;