From patchwork Fri May 21 12:49:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 444675 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp946964jac; Fri, 21 May 2021 05:50:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6mJDGajLJ6rnV50uN1/Qv/HOOIXz68vYsERFWTh6bDdlDWRWl1yNKVeQ21gzRwz1/tdkr X-Received: by 2002:a63:9d43:: with SMTP id i64mr9603521pgd.205.1621601434867; Fri, 21 May 2021 05:50:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621601434; cv=none; d=google.com; s=arc-20160816; b=MYGBnKpE7FSMc/SleoaIo0YM3LrAmBu82bCLwkhp9Yo2+364hOo5FyUQ237zUAtLRI RLRVauYssujxhjUrzLx9GXaQrdoOFnYqIQuMZksB28e5QSYWFPdvGEDBlBWUW3dzUc6V axkYPoQiW9nD+6c9pd/g4+Ipfyfafc9TlhG8LyY4BklYOrjN70/sAlDzIQ9Kqdw4CDwi KbT/oDI7Gu6fGVavdUf7lJXFSt46fDrQNqQanfU+ADEJQm1sTr9CcjF9bcqhB0yBBGmW he2rD6TMSQVT/aMRCDc8KVIke6FaCWYxN9p8lZxfwxI+j2LcTlcCOd14TriL8LAs8tQX WuCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature:delivered-to; bh=sKLBX4jBLVQvnyMr1Ww7CASagKoijpefcDJjIzYZaM4=; b=j42ZMu0jB/eenzC+KZmao+XPi/gUNC++dFWanXkQE3ybmlil9K9yseG7D7npvZLNFD GTU/IqK8Q2SKnmsGXI/WWFx09qAIQ5lJAYfdmrlcwvmUkUCwZKWi7MA5CbFd/1RbmJko sguBojGhyotXAiy3SqhzrU8kU9Wiwi2vxmjJQchxFC2K/A27CG3oJXmGJIFvlfvI6FnB yU73vqHYNS/VhYZ8oMGXm8EnHZpGqkXQ+p5Iu+2UhWlD1StLpXMYTwMZ9d9f6vKMvwR4 zkzaclvrJhh5Ze6UIeoS16mto4DEyVauwK0G7tCgWLD2grthpCPH1lFGt7lFM5GDU9/h Bf+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=luYjJoBF; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id a18si6708186pfv.201.2021.05.21.05.50.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 05:50:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=luYjJoBF; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (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 B7B476F63A; Fri, 21 May 2021 12:50:33 +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 A75886F642; Fri, 21 May 2021 12:50:30 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id A3785613DD; Fri, 21 May 2021 12:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621601430; bh=9SoiHu6HAdAusAoi4raCnnFpxv209nzRo5hMIPpogYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=luYjJoBFcbJhXdTdXk91nmy8D+bkW55GlJ1Fapbom7SmYDPDaG4LnSHTEgjinWE2E u8z017tCiorCmZIdrezco+ICasdezJLrbGg6cKL7Y5rJgjTZvuBcHnCqDpTq/3Fim4 qUkYq2kybXkw++PLjWwRoLg3RHWA73Q0Sf+BIb6x4ht0SvQZEiZNpLPTB/TgpBGWIh gZee1kTcFUOWIzZZtxr4ddwEJJbNnrNGadGy0ZUH3eR9WJ+5CO7y2+z2mgEeEgSf3V gA2HD/L/PGtwcv7Nr8OUkPNv+9fR3SMHe9sofWtlOEpXGdu0EFGJVkA6KIVW4kPJTj Cs9Un/+Qo82hQ== From: Vinod Koul To: Rob Clark Subject: [RFC PATCH 05/13] drm/msm/disp/dpu1: Add support for DSC in pingpong block Date: Fri, 21 May 2021 18:19:36 +0530 Message-Id: <20210521124946.3617862-8-vkoul@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210521124946.3617862-1-vkoul@kernel.org> References: <20210521124946.3617862-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: , Cc: Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abhinav Kumar , Bjorn Andersson , Vinod Koul , dri-devel@lists.freedesktop.org, Dmitry Baryshkov , freedreno@lists.freedesktop.org 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 Signed-off-by: Vinod Koul --- .../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.26.3 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 245a7a62b5c6..07fc131ca9aa 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 845b9ce80e31..5058e41ffbc0 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_pingpong {