Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2663771pxb; Thu, 10 Feb 2022 02:48:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzdDk1xgaos99g08+zXw75odYVdzvaj0GXLWACwvv7AB2xkCd4YNuA9qiZrP/LARmbF1lvd X-Received: by 2002:a63:6b43:: with SMTP id g64mr5575177pgc.396.1644490081669; Thu, 10 Feb 2022 02:48:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644490081; cv=none; d=google.com; s=arc-20160816; b=bk84ITiCbAke8yWMtkUveRqLs+mlH9mVtTTH/ft0sHwTUgj39uhSadeheg/hXbQCbH vKqPGmFAvIV/a/hjBpVWvenYtsZ6gXFIBCqJtHNcIJznGS2dFQHk7bn7bnZKJmnxoHUn M+Kao+4+ci5fP5hZG/ZKt5Mz3NTk3a/kWW1wOPa8JRteg7lvPkZwxr+SOfvygh7LdBXu 1a5YRPN4H5dNPs166hr9qv7osJk4lFlnDrMMXGyXfuCQMZ7e0PupRBOV6gseEgV8mw5k voSzo87XDOX43tH/KosXhKjiPloz7s/ErPI7WMrJ6b0C2n4Scig9j/W0Rrt9/eDy2w8R BhvQ== 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=RhSRXAMaSyKjneMWxm3uQ9Q3+gE+H599q/JPITrKG0A=; b=LRwPAc2nqtevkdImAk1XU7w6TMYzEIfrd0g7PnShl3dsi6Fm5Kunl6ZCXwEc2yMYZs I3oABF4e+SrsxOX14KvbFRHJduU1FSj6J3gOLl4X117mDMrDHrJWQm1pqNdDXidIrFC9 lKXkbd8l4BKDDD+2zcPZUSQUZyOs4Um9kwb1DQpel8R+qFr+lENW7hDJ7RZ/kWKIQV98 PBMSo3vyEvgEiEkY0twCGTWuLM1KLo97Cu8K9XSiuALYWit4Gb96Qulf3uR4+OIMjzsY bk3OM+aMHree+I3mg4KFqf/diwylPsHoyvZ0LlCVxCaOubwIGqPAZ7I9SRW8YfNaJxX7 qqKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J+wfPf6I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k1si1906035plk.424.2022.02.10.02.47.49; Thu, 10 Feb 2022 02:48:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J+wfPf6I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239767AbiBJKe7 (ORCPT + 99 others); Thu, 10 Feb 2022 05:34:59 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:46900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239751AbiBJKev (ORCPT ); Thu, 10 Feb 2022 05:34:51 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9E40B9B; Thu, 10 Feb 2022 02:34:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A1914B8247A; Thu, 10 Feb 2022 10:34:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C67FAC004E1; Thu, 10 Feb 2022 10:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644489290; bh=WDoD2IWuN+dSHlVHH7SgTftB5cke0BrFUNUt4U6trWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J+wfPf6I3uIRDjzR6a+Bdex5880kr34x4yMNg51viDZwWf0Fsr0fvehUba+ZtIan3 TaeqBtutbGQJXQDzd+eAkCTAL/D4FW8CyHMP6xQ1TnPdwFvTcccilbhNAF0q6lTOok 8ytiP2anAxMcm+fkd+qlEHA2jgCs71ShLCgmdVTUZcd+lfk0gkOXffmvt92F4Apy99 AHTM5XLyVtVDj13lBijA5rApV+3JaBHaV0biQTyreusdNU7TW9qxp1Chi9Sahkv+qj h3Gl/c1XUsyizPyH4EmqWlME7WM2RfW0qM5snaUnxCGb9kWTsXfB8yfruu1isAVI1D KSNCxDGIzxyBg== 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 , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [REPOST PATCH v4 04/13] drm/msm/disp/dpu1: Add support for DSC in pingpong block Date: Thu, 10 Feb 2022 16:04:14 +0530 Message-Id: <20220210103423.271016-5-vkoul@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220210103423.271016-1-vkoul@kernel.org> References: <20220210103423.271016-1-vkoul@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 In SDM845, DSC can be enabled by writing to pingpong block registers, so add support for DSC in hw_pp Reviewed-by: Abhinav Kumar Reviewed-by: Dmitry Baryshkov 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(+) 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; -- 2.31.1