From patchwork Tue Mar 26 15:11:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 783260 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EF8113C800; Tue, 26 Mar 2024 15:06:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711465603; cv=none; b=rZm+Kn/HHsPCd46HjgT8LzUUoZsNY0evxLoR5MWPa0Z3WGMV+QilGU1GAsiJYT8It0ivbHJ+b+p32usu/W3PUpd0JHeDPjGZCNJbmJwR/Zy+4zY+cNxAFJX0CQNmUqYywi1vCOgxCANQm7f9M2jZ0cLTKaWjH0pxbAiLAUfTKd4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711465603; c=relaxed/simple; bh=F74sSb1TUT1wdavk14eo4VvZEROfyAVRNFw7tDHtFsc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Z8T/FYtlxr2QLpty5R26X66PV8o9HH8BBDvLrLDyUxDSYVMOuBdr649FgV+qEeVva5BbP+fcKjXnQApQUmvR3m3hJ++sMOxQW6WYe8jYFAVvA8WPiO26off4l+mf1qCq4Oh11pQoSD8vx9kqo0xtBii/tYdUHuxIzXvwbSQFtD4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RbjlGWWx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RbjlGWWx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D485C43390; Tue, 26 Mar 2024 15:06:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711465603; bh=F74sSb1TUT1wdavk14eo4VvZEROfyAVRNFw7tDHtFsc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=RbjlGWWxz1Q0bTbF1cr625dy8ZLo4E+JnnlnA511SMawYZIFtK5x+5cwvtNFuJg35 v4OW8aXBZQGfzd+DIMKwTj/jsQcFuO8QSkEfMPYeIj60WYkC9Csa+EUS6bYBEDPVVy 4nH3KwoYqRuqT/GOQg2/nh2yrqndl8RaZs2z2ARQshQiJhrpwguypCRdETPgiTVKDf GzUjzacCP8gRuif2yCi4JnRJBIa6d1Ge1K7f3ButxLIakmAmM7VSPiaOAsDjcGHaR7 kMqzGGpW5APzXFDEAdZziZs30tvqmqVmNFZja5noQ7fLo6P4KFWO5H50GjX8NYhsqi fy2edAqshlQow== From: Bjorn Andersson Date: Tue, 26 Mar 2024 08:11:29 -0700 Subject: [PATCH 1/6] drm/msm/dp: Drop unused dp_debug struct Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240326-msm-dp-cleanup-v1-1-e775556ecec0@quicinc.com> References: <20240326-msm-dp-cleanup-v1-0-e775556ecec0@quicinc.com> In-Reply-To: <20240326-msm-dp-cleanup-v1-0-e775556ecec0@quicinc.com> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Bjorn Andersson X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=5546; i=quic_bjorande@quicinc.com; h=from:subject:message-id; bh=3M3qSEuc5xZbhZocgufvkSxT1oRUyTPG9hEV+dTs68o=; b=owEBgwJ8/ZANAwAIAQsfOT8Nma3FAcsmYgBmAuWiytUIeRdX1FXogzeoEOBMSa7Q5ATTd+erT u7ieVErYuGJAkkEAAEIADMWIQQF3gPMXzXqTwlm1SULHzk/DZmtxQUCZgLlohUcYW5kZXJzc29u QGtlcm5lbC5vcmcACgkQCx85Pw2ZrcUFXg//dEX3ua3NRihGVTS7nlhv1GQh2i2xUCWHe774Zak bxJhrgvdR3iQYQ1M4a+ydUybhehrAcyB4pfB9ubJz0j+I0aLRv8rAIaLtYXSPCeel5xhpED0X4F fV5M3sp/JXu9cQZE4pfFenbQbWRflWpCu+7Jr8B1hcpWr/xYo6aEduqqjJbBpFpv8/kdHwX4wSJ zOsIbaHfTpT3Xwc++o5w28KuDRCZ4ANBtxvkvITLlt/kP+E6g6vlNK1slHKfzYtp3lYbU88kAc2 pAiS+0ho/NpTp0qkr4m8zn/J2he4Z5QlSjzfSmhxAUQAzclLguBolf/UL8OI016buaC/GQz386q aZFspCFbG81cwJXkquf/+PInZfD9bQxc6NlKoxQv9BixIAAMZagCKPfTZaQ/VsSspFxPa7glQnI kB6RW6sCzMswz/4MfK6mZmG8Vr8bv/ZYzNhfpRsOcT8DIfHXRSZLw5Ehvd/+wLu2+oMEeV0+tBR vGWsGdSC9viG5zhjB172cgpcn7YGEDCxAvg3N14NV7AqALqPMSRu1j+h4Bz09jnsWxfZNesQfkU S3WUrXexY/aqIsbDIgWtjfhy4P8eeFNCZEaRFIUEcViKzwc7crKnUMS/nokb+4vsiVu4tY2RZ9r qvCt6B+erPs2/kl9iXzWpnPvoRLDuR/bUEN922kzrruU= X-Developer-Key: i=quic_bjorande@quicinc.com; a=openpgp; fpr=05DE03CC5F35EA4F0966D5250B1F393F0D99ADC5 From: Bjorn Andersson The members of struct dp_debug are no longer used, so the only purpose of this struct is as a type of the return value of dp_debug_get(), to signal success/error. Drop the struct in favor of signalling the result of initialization using an int. Signed-off-by: Bjorn Andersson --- drivers/gpu/drm/msm/dp/dp_debug.c | 38 ++++++++++--------------------------- drivers/gpu/drm/msm/dp/dp_debug.h | 38 +++++++++++-------------------------- drivers/gpu/drm/msm/dp/dp_display.c | 10 ++-------- 3 files changed, 23 insertions(+), 63 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_debug.c b/drivers/gpu/drm/msm/dp/dp_debug.c index eca5a02f9003..a631cbe0e599 100644 --- a/drivers/gpu/drm/msm/dp/dp_debug.c +++ b/drivers/gpu/drm/msm/dp/dp_debug.c @@ -21,8 +21,6 @@ struct dp_debug_private { struct dp_link *link; struct dp_panel *panel; struct drm_connector *connector; - - struct dp_debug dp_debug; }; static int dp_debug_show(struct seq_file *seq, void *p) @@ -199,11 +197,8 @@ static const struct file_operations test_active_fops = { .write = dp_test_active_write }; -static void dp_debug_init(struct dp_debug *dp_debug, struct dentry *root, bool is_edp) +static void dp_debug_init(struct dp_debug_private *debug, struct dentry *root, bool is_edp) { - struct dp_debug_private *debug = container_of(dp_debug, - struct dp_debug_private, dp_debug); - debugfs_create_file("dp_debug", 0444, root, debug, &dp_debug_fops); @@ -222,39 +217,26 @@ static void dp_debug_init(struct dp_debug *dp_debug, struct dentry *root, bool i } } -struct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel, - struct dp_link *link, - struct drm_connector *connector, - struct dentry *root, bool is_edp) +int dp_debug_get(struct device *dev, struct dp_panel *panel, + struct dp_link *link, + struct drm_connector *connector, + struct dentry *root, bool is_edp) { struct dp_debug_private *debug; - struct dp_debug *dp_debug; - int rc; if (!dev || !panel || !link) { DRM_ERROR("invalid input\n"); - rc = -EINVAL; - goto error; + return -EINVAL; } debug = devm_kzalloc(dev, sizeof(*debug), GFP_KERNEL); - if (!debug) { - rc = -ENOMEM; - goto error; - } + if (!debug) + return -ENOMEM; - debug->dp_debug.debug_en = false; debug->link = link; debug->panel = panel; - dp_debug = &debug->dp_debug; - dp_debug->vdisplay = 0; - dp_debug->hdisplay = 0; - dp_debug->vrefresh = 0; - - dp_debug_init(dp_debug, root, is_edp); + dp_debug_init(debug, root, is_edp); - return dp_debug; - error: - return ERR_PTR(rc); + return 0; } diff --git a/drivers/gpu/drm/msm/dp/dp_debug.h b/drivers/gpu/drm/msm/dp/dp_debug.h index 9b3b2e702f65..c57200751c9f 100644 --- a/drivers/gpu/drm/msm/dp/dp_debug.h +++ b/drivers/gpu/drm/msm/dp/dp_debug.h @@ -9,22 +9,6 @@ #include "dp_panel.h" #include "dp_link.h" -/** - * struct dp_debug - * @debug_en: specifies whether debug mode enabled - * @vdisplay: used to filter out vdisplay value - * @hdisplay: used to filter out hdisplay value - * @vrefresh: used to filter out vrefresh value - * @tpg_state: specifies whether tpg feature is enabled - */ -struct dp_debug { - bool debug_en; - int aspect_ratio; - int vdisplay; - int hdisplay; - int vrefresh; -}; - #if defined(CONFIG_DEBUG_FS) /** @@ -41,22 +25,22 @@ struct dp_debug { * This function sets up the debug module and provides a way * for debugfs input to be communicated with existing modules */ -struct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel, - struct dp_link *link, - struct drm_connector *connector, - struct dentry *root, - bool is_edp); +int dp_debug_get(struct device *dev, struct dp_panel *panel, + struct dp_link *link, + struct drm_connector *connector, + struct dentry *root, + bool is_edp); #else static inline -struct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel, - struct dp_link *link, - struct drm_connector *connector, - struct dentry *root, - bool is_edp) +int dp_debug_get(struct device *dev, struct dp_panel *panel, + struct dp_link *link, + struct drm_connector *connector, + struct dentry *root, + bool is_edp) { - return ERR_PTR(-EINVAL); + return -EINVAL; } #endif /* defined(CONFIG_DEBUG_FS) */ diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index c4cb82af5c2f..a9187be95166 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -93,7 +93,6 @@ struct dp_display_private { struct dp_link *link; struct dp_panel *panel; struct dp_ctrl *ctrl; - struct dp_debug *debug; struct dp_display_mode dp_mode; struct msm_dp dp_display; @@ -1431,14 +1430,9 @@ void dp_display_debugfs_init(struct msm_dp *dp_display, struct dentry *root, boo dp = container_of(dp_display, struct dp_display_private, dp_display); dev = &dp->dp_display.pdev->dev; - dp->debug = dp_debug_get(dev, dp->panel, - dp->link, dp->dp_display.connector, - root, is_edp); - if (IS_ERR(dp->debug)) { - rc = PTR_ERR(dp->debug); + rc = dp_debug_get(dev, dp->panel, dp->link, dp->dp_display.connector, root, is_edp); + if (rc) DRM_ERROR("failed to initialize debug, rc = %d\n", rc); - dp->debug = NULL; - } } int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, From patchwork Tue Mar 26 15:11:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 782728 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA16613C81C; Tue, 26 Mar 2024 15:06:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711465604; cv=none; b=g1U5HXoozWTvANi4Z/vnBPf8UPdlWAMY7meh2LKh2uXhvK1ExDKLyekJYVrA0KNhg58svI6+HTx/HV4t4YuMOt9PlAVPapi8vd0E1SuP8oxXULPHlvXKGjP9TEtI4YVaQcTCFhXyuJWEZC8qWmueUy/4aiY5hJx58we4d4oGUOg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711465604; c=relaxed/simple; bh=oEL9QHuRjaF8oclNwKr4lsV4jXuopDx5ZyED4A8zK+M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gwcabR2Q5gpjJWK3UQoynqiQ0/a4WBXOZXoWumgi7xLDJUZlHQYSGl88r4cdWYWF2/hYYnD3VuDmeRV/MejpS/auKI7hKAm9qPjFsATvOAdKdxn939AOOE4aZqYI0kivmi4nIRaQDkwPBUGbCkpB4TG82WrkkJibQXXKhZqOMcw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ed4hVGyY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ed4hVGyY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87CD6C43330; Tue, 26 Mar 2024 15:06:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711465604; bh=oEL9QHuRjaF8oclNwKr4lsV4jXuopDx5ZyED4A8zK+M=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Ed4hVGyYIVwp8s6P9scRKIQ9872S3tS11Qx/SLDBDxDxtCwjjyfllHk49gSHQpFzW UTztQuJwXtUdtOYTjvq9yr6aOt0hUJ08sMJrZ+ng8PhF9tHi+dGaJL7tpuNtoJtzU2 uSi+YYk90nLYMK2dL8CHd0ZoXQb+L1IlXGZzY3EW4uLIIADdMcNsVUeNWPvk8iMJVc IIziTPM/A6cbCdL1DhlOtQpx1sB1kM5p3UU7ag3BuuWiFvWuidaeM7ZaPOf2S2hP4C KW72wfQaMBihMrgm66Zt0UASNxMyG8cS9eDdxK5Vwy80l8rP+bF9GclI3JSrtzpRoW WV9KHl7OSkyVQ== From: Bjorn Andersson Date: Tue, 26 Mar 2024 08:11:30 -0700 Subject: [PATCH 2/6] drm/msm/dp: Removed fixed nvid "support" Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240326-msm-dp-cleanup-v1-2-e775556ecec0@quicinc.com> References: <20240326-msm-dp-cleanup-v1-0-e775556ecec0@quicinc.com> In-Reply-To: <20240326-msm-dp-cleanup-v1-0-e775556ecec0@quicinc.com> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Bjorn Andersson X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=3667; i=quic_bjorande@quicinc.com; h=from:subject:message-id; bh=qycwTDe39/z7P5q+0zY5dlx4BRy8hlXGCuCcnrwdKSM=; b=owEBgwJ8/ZANAwAIAQsfOT8Nma3FAcsmYgBmAuWinRfj+eExKLVCRJV0/h3saaFlb4+B6/tpz 2wwKt06kLGJAkkEAAEIADMWIQQF3gPMXzXqTwlm1SULHzk/DZmtxQUCZgLlohUcYW5kZXJzc29u QGtlcm5lbC5vcmcACgkQCx85Pw2ZrcUtjRAArx5w2fq0qfDxaDJMXvcm8nhp3W0WeW47zEeLl6v Lf4ftSWe81XS8YIV2fSPYv3C0Ks9kAlgvJp4fLcdmBUB0O/D4C5j5WHSLlNPm4j8Hee5DMf5NN8 s6ac5C21RzRU1eeMKhasyTOYfXRHZGrChsCbK8v2oVtBJSj5/gMVQ9TZjC8QYnOFFdxr1+Ob8G7 b7V3v3KmGRG0Z5bdk2uz2FnLzEtBXyGnIfHWbJZ5aYJ71zycMO3dtYtQ6QVR6V44a8r34oib344 IlrRPn97ym0xoVeH82Crgv042z8pdVeOfJmowehorKrJbq0Pt+RMAEMN3l6B4fQpRReRwXmsoSX by+XbtsEl0UJ5RM1I7V1ImWTuGXvxf2sc+rbnZkLl35xw3k/eUGMvHehhS+nxIRqg390Cc7bbJS uzR33PWtrnn+vY1x6TrhgV/nFQMn+kN9Gt8cjtF7auGSU+RYmK2ln4T5hfv4UUnnQGO75lUmdlo FmMmVhHQxCUUS1H7ZElm17m5oUKkFoR8ApbbeDRObfKI/XG+1Z3W2ub96T9av8jl+ri2U3ZSvRT EpB347YxCEgFMIj0g+k9m4Jch0+gr1NO81RAf5gJ2qvp3yFVzZT8ILOre0IbHzQSVi0lpoptrYe xFPedah0j0p8LArgKmKbxYfoEm2ObRDRZYuL3AzV7pec= X-Developer-Key: i=quic_bjorande@quicinc.com; a=openpgp; fpr=05DE03CC5F35EA4F0966D5250B1F393F0D99ADC5 From: Bjorn Andersson The "desc" member of struct dp_panel is zero-initialized during allocation and never assigned, resulting in dp_ctrl_use_fixed_nvid() never returning true. This returned boolean value is passed around but never acted upon. Perform constant propagation and remove the traces of "fixed nvid". Signed-off-by: Bjorn Andersson --- drivers/gpu/drm/msm/dp/dp_catalog.c | 2 +- drivers/gpu/drm/msm/dp/dp_catalog.h | 2 +- drivers/gpu/drm/msm/dp/dp_ctrl.c | 17 +---------------- drivers/gpu/drm/msm/dp/dp_panel.h | 1 - 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index 3e7c84cdef47..8c72d532d96b 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -469,7 +469,7 @@ void dp_catalog_setup_peripheral_flush(struct dp_catalog *dp_catalog) void dp_catalog_ctrl_config_msa(struct dp_catalog *dp_catalog, u32 rate, u32 stream_rate_khz, - bool fixed_nvid, bool is_ycbcr_420) + bool is_ycbcr_420) { u32 pixel_m, pixel_n; u32 mvid, nvid, pixel_div = 0, dispcc_input_rate; diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h b/drivers/gpu/drm/msm/dp/dp_catalog.h index 75ec290127c7..b85ad6bdb2e7 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.h +++ b/drivers/gpu/drm/msm/dp/dp_catalog.h @@ -99,7 +99,7 @@ void dp_catalog_ctrl_psr_mainlink_enable(struct dp_catalog *dp_catalog, bool ena void dp_catalog_setup_peripheral_flush(struct dp_catalog *dp_catalog); void dp_catalog_ctrl_config_misc(struct dp_catalog *dp_catalog, u32 cc, u32 tb); void dp_catalog_ctrl_config_msa(struct dp_catalog *dp_catalog, u32 rate, - u32 stream_rate_khz, bool fixed_nvid, bool is_ycbcr_420); + u32 stream_rate_khz, bool is_ycbcr_420); int dp_catalog_ctrl_set_pattern_state_bit(struct dp_catalog *dp_catalog, u32 pattern); u32 dp_catalog_hw_revision(const struct dp_catalog *dp_catalog); void dp_catalog_ctrl_reset(struct dp_catalog *dp_catalog); diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c index c4dda1faef67..e65a460fb52d 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c @@ -1566,21 +1566,6 @@ void dp_ctrl_phy_exit(struct dp_ctrl *dp_ctrl) phy, phy->init_count, phy->power_count); } -static bool dp_ctrl_use_fixed_nvid(struct dp_ctrl_private *ctrl) -{ - const u8 *dpcd = ctrl->panel->dpcd; - - /* - * For better interop experience, used a fixed NVID=0x8000 - * whenever connected to a VGA dongle downstream. - */ - if (drm_dp_is_branch(dpcd)) - return (drm_dp_has_quirk(&ctrl->panel->desc, - DP_DPCD_QUIRK_CONSTANT_N)); - - return false; -} - static int dp_ctrl_reinitialize_mainlink(struct dp_ctrl_private *ctrl) { struct phy *phy = ctrl->phy; @@ -2022,7 +2007,7 @@ int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train) dp_catalog_ctrl_config_msa(ctrl->catalog, ctrl->link->link_params.rate, - pixel_rate_orig, dp_ctrl_use_fixed_nvid(ctrl), + pixel_rate_orig, ctrl->panel->dp_mode.out_fmt_is_yuv_420); dp_ctrl_setup_tr_unit(ctrl); diff --git a/drivers/gpu/drm/msm/dp/dp_panel.h b/drivers/gpu/drm/msm/dp/dp_panel.h index e843f5062d1f..9afd99e00b0c 100644 --- a/drivers/gpu/drm/msm/dp/dp_panel.h +++ b/drivers/gpu/drm/msm/dp/dp_panel.h @@ -40,7 +40,6 @@ struct dp_panel { u8 downstream_ports[DP_MAX_DOWNSTREAM_PORTS]; struct dp_link_info link_info; - struct drm_dp_desc desc; struct edid *edid; struct drm_connector *connector; struct dp_display_mode dp_mode; From patchwork Tue Mar 26 15:11:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 783259 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC70C13C8E9; Tue, 26 Mar 2024 15:06:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711465605; cv=none; b=n/XTgMAsRZ6pO7wcZ8wQTxmk88Vl9KPNhJjiTyxkpF9rn8xjKLtPXr68QOUDsNWLQfvdnAd2eC+FYSAiiY1yPhk4gtDgMZ/n5qAuckE789uFCHPnmygkedO/kp86Gu1wi8JLIcJgM6izPzm++z5P4M4vzPNPSqgqvXwhHvvIr9c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711465605; c=relaxed/simple; bh=ux2gJRKYbJtB1caE8tUqKnWbosy/ET6Ap41xPNx8LYI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dFoO1xiNPFqbJ3Qsn/Vr1pyOSDVH3yCz3X3Ep596Ed5acYRtfeyZrVhNu+4GuVtJFHta+8DyttHxDHNzGpyVaDHg6PN5DbV2vB5qc0nWbfDcnMg/NNyceI3gijmz605uV5wFquwCndO59zBMtr/PSZRywE609sFkS1eTW+kzcSM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pcJ/Eo2k; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pcJ/Eo2k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FC22C43601; Tue, 26 Mar 2024 15:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711465605; bh=ux2gJRKYbJtB1caE8tUqKnWbosy/ET6Ap41xPNx8LYI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pcJ/Eo2k+G18Wwd/YTyBKqV80j6+3s0CcBfAwEvmkVwIbNqtADHOh+ljnvhyhcuTx Nhcfp32+9VXqTEbX926zg4O/QPRaTC9FmkgX/g0PkNzJl6Kt7IBfFuI8DvJ9Zo+Bk5 O2dZHLGGmsMALGo+FGrF4GRIpBGyCSgFW0rCaz9tY7RHkArYuO7ScZMCI/fuE9vUzr uUbm2IOrlsaH4ZVa34STR5PtA6d16WGer7QQpFR1Ok18vGHtBf4PTfdDiGsi25Rl6j 7jAyUDNPX2wNay5gUmvOwqfsoQV1Q2ZnGtL5bNs+rVm1XVwjRQGfbXIvcamlNmHols EfNsr7ixyeMqg== From: Bjorn Andersson Date: Tue, 26 Mar 2024 08:11:31 -0700 Subject: [PATCH 3/6] drm/msm/dp: Remove unused defines and members Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240326-msm-dp-cleanup-v1-3-e775556ecec0@quicinc.com> References: <20240326-msm-dp-cleanup-v1-0-e775556ecec0@quicinc.com> In-Reply-To: <20240326-msm-dp-cleanup-v1-0-e775556ecec0@quicinc.com> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Bjorn Andersson X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=7373; i=quic_bjorande@quicinc.com; h=from:subject:message-id; bh=1Vt/PUJRNML3XV+iy2c2v7ZwN3HbD8qAP7vs4E1jcfQ=; b=owEBgwJ8/ZANAwAIAQsfOT8Nma3FAcsmYgBmAuWinIX++PuIKhc2yR5Ugs2UtUOKKY0lovwMx EZcqxUBUdaJAkkEAAEIADMWIQQF3gPMXzXqTwlm1SULHzk/DZmtxQUCZgLlohUcYW5kZXJzc29u QGtlcm5lbC5vcmcACgkQCx85Pw2ZrcW7DRAAw8D+BmOE4fIW0XT/aRT5yVHCgRUZif87xbUEa73 uJJuWgVwPqohnGZ4++yqDm7TsyCl/7OZ+HQDWQejBR2Rqb0CQrNeXjaNYnZFziMQcImHDx1Bex+ CtHCoCaeunAteGYXIOFDWaQTuQ/eG1Pxcn3k64SF4mSR4R7agcD8Y53klFMf8n2Y/rUkmQDMzAn 1dDyxOgNRRbiJsyzzeLPHmKCL4AlgWrPqn5A1Yx7hFFi2gg0bDexoXxqyHxGMMG576jOR8QB6zt /gHZxEqgt5zhAMWYzxw3XzOmXq4YIyCqBbNs/1MNzU77d3UFSQ24lD+RnI0YI4y0llUVuI8T6u+ 2Y6XejK89iMx1jLm9zt8S/00f5I2F6wLO1rhRMsDCGsxu1hNiank44sNLCR+Qm/o8pmWGkzQKu9 AMNt9TCe8ZUL6ux47OnK1nazlnD9UEmBUDb3zbaJJQm9iq7jYL79Wit2i6/+Z1G3T+27PPNcSIA LBdTCWx37H93trT5HU/k4vGjZ9+0bVnxxjhlNZm9Ct7fuH7bfIJ+65/B6KssE6590HICKBlyQNJ +A26QOSwWrGNDGEx7VJaSeKvN+R/M+/5WyuAao/T2p6Rqros+QDsM8eJYxCZSLWhUq0BCXPEEBj ryZs7dlFK+RlIgspqRN5+l9FKFBbHYu8WUR/+XaWui2E= X-Developer-Key: i=quic_bjorande@quicinc.com; a=openpgp; fpr=05DE03CC5F35EA4F0966D5250B1F393F0D99ADC5 From: Bjorn Andersson Throughout the Qualcomm Displayport driver a number of defines and struct members has become unused, but lingers in the code. Remove these. Signed-off-by: Bjorn Andersson --- drivers/gpu/drm/msm/dp/dp_audio.c | 5 ----- drivers/gpu/drm/msm/dp/dp_catalog.c | 1 - drivers/gpu/drm/msm/dp/dp_catalog.h | 17 ----------------- drivers/gpu/drm/msm/dp/dp_ctrl.h | 1 - drivers/gpu/drm/msm/dp/dp_display.c | 5 ----- drivers/gpu/drm/msm/dp/dp_display.h | 3 --- drivers/gpu/drm/msm/dp/dp_drm.c | 2 -- drivers/gpu/drm/msm/dp/dp_link.c | 4 ---- drivers/gpu/drm/msm/dp/dp_link.h | 1 - drivers/gpu/drm/msm/dp/dp_panel.h | 2 -- 10 files changed, 41 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_audio.c b/drivers/gpu/drm/msm/dp/dp_audio.c index 7634e4b74208..7fd0c1793ba3 100644 --- a/drivers/gpu/drm/msm/dp/dp_audio.c +++ b/drivers/gpu/drm/msm/dp/dp_audio.c @@ -22,9 +22,7 @@ struct dp_audio_private { struct platform_device *pdev; struct drm_device *drm_dev; struct dp_catalog *catalog; - struct dp_panel *panel; - bool engine_on; u32 channels; struct dp_audio dp_audio; @@ -356,8 +354,6 @@ static void dp_audio_enable(struct dp_audio_private *audio, bool enable) catalog->audio_data = enable; dp_catalog_audio_enable(catalog); - - audio->engine_on = enable; } static struct dp_audio_private *dp_audio_get_data(struct platform_device *pdev) @@ -571,7 +567,6 @@ struct dp_audio *dp_audio_get(struct platform_device *pdev, } audio->pdev = pdev; - audio->panel = panel; audio->catalog = catalog; dp_audio = &audio->dp_audio; diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index 8c72d532d96b..55114a6aba7e 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -81,7 +81,6 @@ struct dp_catalog_private { struct dss_io_data io; u32 (*audio_map)[DP_AUDIO_SDP_HEADER_MAX]; struct dp_catalog dp_catalog; - u8 aux_lut_cfg_index[PHY_AUX_CFG_MAX]; }; void dp_catalog_snapshot(struct dp_catalog *dp_catalog, struct msm_disp_state *disp_state) diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h b/drivers/gpu/drm/msm/dp/dp_catalog.h index b85ad6bdb2e7..2c2dbeee7634 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.h +++ b/drivers/gpu/drm/msm/dp/dp_catalog.h @@ -28,26 +28,9 @@ #define DP_INTR_FRAME_END BIT(6) #define DP_INTR_CRC_UPDATED BIT(9) -#define DP_AUX_CFG_MAX_VALUE_CNT 3 - #define DP_HW_VERSION_1_0 0x10000000 #define DP_HW_VERSION_1_2 0x10020000 -/* PHY AUX config registers */ -enum dp_phy_aux_config_type { - PHY_AUX_CFG0, - PHY_AUX_CFG1, - PHY_AUX_CFG2, - PHY_AUX_CFG3, - PHY_AUX_CFG4, - PHY_AUX_CFG5, - PHY_AUX_CFG6, - PHY_AUX_CFG7, - PHY_AUX_CFG8, - PHY_AUX_CFG9, - PHY_AUX_CFG_MAX, -}; - enum dp_catalog_audio_sdp_type { DP_AUDIO_SDP_STREAM, DP_AUDIO_SDP_TIMESTAMP, diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.h b/drivers/gpu/drm/msm/dp/dp_ctrl.h index fa014cee7e21..ffcbd9a25748 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.h +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.h @@ -12,7 +12,6 @@ #include "dp_catalog.h" struct dp_ctrl { - atomic_t aborted; bool wide_bus_en; }; diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index a9187be95166..f7692c20bb04 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -74,7 +74,6 @@ struct dp_event { }; struct dp_display_private { - char *name; int irq; unsigned int id; @@ -82,11 +81,9 @@ struct dp_display_private { /* state variables */ bool core_initialized; bool phy_initialized; - bool hpd_irq_on; bool audio_supported; struct drm_device *drm_dev; - struct dentry *root; struct dp_catalog *catalog; struct drm_dp_aux *aux; @@ -800,7 +797,6 @@ static int dp_display_set_mode(struct msm_dp *dp_display, drm_mode_copy(&dp->panel->dp_mode.drm_mode, &mode->drm_mode); dp->panel->dp_mode.bpp = mode->bpp; - dp->panel->dp_mode.capabilities = mode->capabilities; dp->panel->dp_mode.out_fmt_is_yuv_420 = mode->out_fmt_is_yuv_420; dp_panel_init_panel_info(dp->panel); return 0; @@ -1260,7 +1256,6 @@ static int dp_display_probe(struct platform_device *pdev) return -EINVAL; dp->dp_display.pdev = pdev; - dp->name = "drm_dp"; dp->id = desc->id; dp->dp_display.connector_type = desc->connector_type; dp->wide_bus_supported = desc->wide_bus_supported; diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h index 234dada88687..ec7fa67e0569 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.h +++ b/drivers/gpu/drm/msm/dp/dp_display.h @@ -16,7 +16,6 @@ struct msm_dp { struct drm_device *drm_dev; struct platform_device *pdev; struct device *codec_dev; - struct drm_bridge *bridge; struct drm_connector *connector; struct drm_bridge *next_bridge; bool link_ready; @@ -28,8 +27,6 @@ struct msm_dp { hdmi_codec_plugged_cb plugged_cb; - bool wide_bus_en; - struct dp_audio *dp_audio; bool psr_supported; }; diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c index a819a4ff76a9..1b9be5bd97f1 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.c +++ b/drivers/gpu/drm/msm/dp/dp_drm.c @@ -347,8 +347,6 @@ int dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev, } } - dp_display->bridge = bridge; - return 0; } diff --git a/drivers/gpu/drm/msm/dp/dp_link.c b/drivers/gpu/drm/msm/dp/dp_link.c index 49dfac1fd1ef..b94da000014a 100644 --- a/drivers/gpu/drm/msm/dp/dp_link.c +++ b/drivers/gpu/drm/msm/dp/dp_link.c @@ -36,7 +36,6 @@ struct dp_link_request { struct dp_link_private { u32 prev_sink_count; - struct device *dev; struct drm_device *drm_dev; struct drm_dp_aux *aux; struct dp_link dp_link; @@ -804,8 +803,6 @@ int dp_link_psm_config(struct dp_link *dp_link, if (ret) DRM_ERROR("Failed to %s low power mode\n", enable ? "enter" : "exit"); - else - dp_link->psm_enabled = enable; mutex_unlock(&link->psm_mutex); return ret; @@ -1226,7 +1223,6 @@ struct dp_link *dp_link_get(struct device *dev, struct drm_dp_aux *aux) if (!link) return ERR_PTR(-ENOMEM); - link->dev = dev; link->aux = aux; mutex_init(&link->psm_mutex); diff --git a/drivers/gpu/drm/msm/dp/dp_link.h b/drivers/gpu/drm/msm/dp/dp_link.h index 83da170bc56b..f04407fe7375 100644 --- a/drivers/gpu/drm/msm/dp/dp_link.h +++ b/drivers/gpu/drm/msm/dp/dp_link.h @@ -74,7 +74,6 @@ struct dp_link_phy_params { struct dp_link { u32 sink_request; u32 test_response; - bool psm_enabled; u8 sink_count; struct dp_link_test_video test_video; diff --git a/drivers/gpu/drm/msm/dp/dp_panel.h b/drivers/gpu/drm/msm/dp/dp_panel.h index 9afd99e00b0c..4ea42fa936ae 100644 --- a/drivers/gpu/drm/msm/dp/dp_panel.h +++ b/drivers/gpu/drm/msm/dp/dp_panel.h @@ -15,7 +15,6 @@ struct edid; struct dp_display_mode { struct drm_display_mode drm_mode; - u32 capabilities; u32 bpp; u32 h_active_low; u32 v_active_low; @@ -47,7 +46,6 @@ struct dp_panel { bool video_test; bool vsc_sdp_supported; - u32 vic; u32 max_dp_lanes; u32 max_dp_link_rate; From patchwork Tue Mar 26 15:11:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 782727 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B10D713C90E; Tue, 26 Mar 2024 15:06:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711465606; cv=none; b=N8LxHV75quZZnezXE3eLjJDHY3qndXMHbtnLAW5Y8mFjPDA4n4mDoqrbnzpCOj5Ycb9WYqHUMVfsMuUhpUb5ZnrzXlN6sloB8VjwlHh+fQvdBkFcH1o9NahbD6wwtwI2CAda3HYfIjN4fALHkJzW5Rl+vdUk39efnq+VHzdDQaM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711465606; c=relaxed/simple; bh=01R4o89skC9mMhEqK+LcqdaFSJT7bI5I12tQM6+HOi8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NaOdHwdFmO9mtrfhtirC4YqtOBDMP9OVTUmW+LMZFxs7JJZN2o0nr7cNXflkoiM1HnMAK2Ac65pDOm5pwJv+mSP5A5pGhGLQjCi/XEMCuJtDFFFwTMzCacbe+hDOjXeTqsd4jiuwv/oLfBr6SjEqNk80COY8yLi+xsN7KSMkWEg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NikPNzag; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NikPNzag" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79C59C43390; Tue, 26 Mar 2024 15:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711465606; bh=01R4o89skC9mMhEqK+LcqdaFSJT7bI5I12tQM6+HOi8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=NikPNzagaQ+CDSMXqShgXElR3I3yb4Y5dbO540Uu6Vzcmj56Q7TnbPGxjhqYHT0Oq 0l2t81kChzsS1DS5H1Abv4IMzTMLJZ/wr7pMjF0PiSbDDaqehiU9U05HiTpJ0GtbrU HeU0d5eSswKAoq02FnD2IOEE1nAIE7DUvzOViAXlt8ADQvxT/E71pNaIM7PG8X15Xa ZkDZs3NGO/6+oyeA6L9UTXl55dmtG+IPg42mn8uL6zE+mY6gDwFJg/3z/U9bIBcLr/ Bl3mLUuIHxqVAeWXG91h/Qst/rPYkS8J35DFvgLSgxjFW+Te6Nq2owULyKqH4011+s fvkwa3CQlC4LA== From: Bjorn Andersson Date: Tue, 26 Mar 2024 08:11:32 -0700 Subject: [PATCH 4/6] drm/msm/dp: Use function arguments for aux writes Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240326-msm-dp-cleanup-v1-4-e775556ecec0@quicinc.com> References: <20240326-msm-dp-cleanup-v1-0-e775556ecec0@quicinc.com> In-Reply-To: <20240326-msm-dp-cleanup-v1-0-e775556ecec0@quicinc.com> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Bjorn Andersson X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=3889; i=quic_bjorande@quicinc.com; h=from:subject:message-id; bh=OGQGdcYpP/wYyvD9AcFcPxIGkVinB3aiEgxfZBK8ts4=; b=owEBgwJ8/ZANAwAIAQsfOT8Nma3FAcsmYgBmAuWi1kOqvXMLrq0dCKxSnv3iMCr1CKkr5hEGk EjUkd6kPUKJAkkEAAEIADMWIQQF3gPMXzXqTwlm1SULHzk/DZmtxQUCZgLlohUcYW5kZXJzc29u QGtlcm5lbC5vcmcACgkQCx85Pw2ZrcXKlA/+Psn2oZyyM5bfZYqL/17qHfBtGblE4Og7NO0Rr4R KDwYmNNRsGGR+kfKzofLIn7LyCpEbWNyvxugh3Z2XLIo8gKAf7o80w4VNP9ladmjT9qIcp80bY6 yLIb8weLoDiuTG8Jj/EvGgS5aVnZxJrxAI5DozUWPRQo6suRqNcoeljziav9RHNX0dP171fVwTt jfXqpfSJHgiBxlbBNu3bQ4tPbCqxUiqBBszLFKzJ5yMY84Ih9V7Eq5SBHjA56tufdxxPpIkzVU1 NsKw6w12ZfEIYhMOFlJFYFWCD/0fJ3B3aKrNd2le8Hzlb8F5oZupQnETFc9DnOYTu7gxznPrrFs 6xkRbMyhwxOBx/1drVwUl4Dvs2QP6laK2AzKeQLNR757HAOAZTbgKvNJ528+Mu/Z8sYQmHXQUnj v8SIGcxuSqNPQKhnkXUydNj/kha83OtyvMnLXAX4QsEgXLNmgVkMxQ7Nr4ZMHfhWDS6j4Cyjbvl 3wLFECmNSBK4wTRtLouVbzHHzQ69TsCtwqOXufV36ATfKLr38OfmEeJYaEWlE0PG6Zaxq2iACKX gWbDTTKTVdVa+8dn7JJstCY7haXF52xCRQwGle1AWn3usYPixhB1GIoZXpN6VovCBrwo7nMxsnG 6dJRTaruXIU6WSdLBakNQRKIx7bxceKHtQLSyk8Y/LZg= X-Developer-Key: i=quic_bjorande@quicinc.com; a=openpgp; fpr=05DE03CC5F35EA4F0966D5250B1F393F0D99ADC5 From: Bjorn Andersson The dp_aux write operations takes the data to be operated on through a member of struct dp_catalog, rather than as an argument to the function. No state is maintained other than across the calling of the functions, so replace this member with a function argument. Signed-off-by: Bjorn Andersson Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_aux.c | 9 +++------ drivers/gpu/drm/msm/dp/dp_catalog.c | 8 ++++---- drivers/gpu/drm/msm/dp/dp_catalog.h | 5 ++--- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_aux.c b/drivers/gpu/drm/msm/dp/dp_aux.c index adbd5a367395..2c8bcc60692a 100644 --- a/drivers/gpu/drm/msm/dp/dp_aux.c +++ b/drivers/gpu/drm/msm/dp/dp_aux.c @@ -87,8 +87,7 @@ static ssize_t dp_aux_write(struct dp_aux_private *aux, /* index = 0, write */ if (i == 0) reg |= DP_AUX_DATA_INDEX_WRITE; - aux->catalog->aux_data = reg; - dp_catalog_aux_write_data(aux->catalog); + dp_catalog_aux_write_data(aux->catalog, reg); } dp_catalog_aux_clear_trans(aux->catalog, false); @@ -106,8 +105,7 @@ static ssize_t dp_aux_write(struct dp_aux_private *aux, } reg |= DP_AUX_TRANS_CTRL_GO; - aux->catalog->aux_data = reg; - dp_catalog_aux_write_trans(aux->catalog); + dp_catalog_aux_write_trans(aux->catalog, reg); return len; } @@ -145,8 +143,7 @@ static ssize_t dp_aux_cmd_fifo_rx(struct dp_aux_private *aux, data = DP_AUX_DATA_INDEX_WRITE; /* INDEX_WRITE */ data |= DP_AUX_DATA_READ; /* read */ - aux->catalog->aux_data = data; - dp_catalog_aux_write_data(aux->catalog); + dp_catalog_aux_write_data(aux->catalog, data); dp = msg->buffer; diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index 55114a6aba7e..295bd4cb72cc 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -169,21 +169,21 @@ u32 dp_catalog_aux_read_data(struct dp_catalog *dp_catalog) return dp_read_aux(catalog, REG_DP_AUX_DATA); } -int dp_catalog_aux_write_data(struct dp_catalog *dp_catalog) +int dp_catalog_aux_write_data(struct dp_catalog *dp_catalog, u32 data) { struct dp_catalog_private *catalog = container_of(dp_catalog, struct dp_catalog_private, dp_catalog); - dp_write_aux(catalog, REG_DP_AUX_DATA, dp_catalog->aux_data); + dp_write_aux(catalog, REG_DP_AUX_DATA, data); return 0; } -int dp_catalog_aux_write_trans(struct dp_catalog *dp_catalog) +int dp_catalog_aux_write_trans(struct dp_catalog *dp_catalog, u32 data) { struct dp_catalog_private *catalog = container_of(dp_catalog, struct dp_catalog_private, dp_catalog); - dp_write_aux(catalog, REG_DP_AUX_TRANS_CTRL, dp_catalog->aux_data); + dp_write_aux(catalog, REG_DP_AUX_TRANS_CTRL, data); return 0; } diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h b/drivers/gpu/drm/msm/dp/dp_catalog.h index 2c2dbeee7634..290ef8180c12 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.h +++ b/drivers/gpu/drm/msm/dp/dp_catalog.h @@ -48,7 +48,6 @@ enum dp_catalog_audio_header_type { }; struct dp_catalog { - u32 aux_data; u32 total; u32 sync_start; u32 width_blanking; @@ -64,8 +63,8 @@ void dp_catalog_snapshot(struct dp_catalog *dp_catalog, struct msm_disp_state *d /* AUX APIs */ u32 dp_catalog_aux_read_data(struct dp_catalog *dp_catalog); -int dp_catalog_aux_write_data(struct dp_catalog *dp_catalog); -int dp_catalog_aux_write_trans(struct dp_catalog *dp_catalog); +int dp_catalog_aux_write_data(struct dp_catalog *dp_catalog, u32 data); +int dp_catalog_aux_write_trans(struct dp_catalog *dp_catalog, u32 data); int dp_catalog_aux_clear_trans(struct dp_catalog *dp_catalog, bool read); int dp_catalog_aux_clear_hw_interrupts(struct dp_catalog *dp_catalog); void dp_catalog_aux_reset(struct dp_catalog *dp_catalog); From patchwork Tue Mar 26 15:11:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 783258 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE7AD13C9AE; Tue, 26 Mar 2024 15:06:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711465607; cv=none; b=s79CRVR1cAZRbhaImKw3VO5jP3sK3S6OAGvZ1vwCJMO3FEWYg+1+RAShQZvQmN2DLPY5xj1CgQMoMEK+8JYYLWqBIX8s/12+uNa4vA+OGMnZjvAYr5ADNuCe0iYxUhRtFK79nHSluaiPb2FO3neZAhy8IibGNULbx+uZjEVpRdc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711465607; c=relaxed/simple; bh=B8qB9LxYp7aNKSjYMyDo0CeyGwOCmr2Wum7lcf6UN68=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uUEC3SSt7LF1KRpDMt/9b/YpeB1cpzA+LlbSqZgl3L6La36DQNTeaQRFDwVwbaqYyfpKLCtDMLTZkUARwePNqO7O3+6WiAHwfmFiBoJNh7VuLEcshStKkvlXovTxbQQO6ZM1blBBXNlwMOv0sMHMLkiP5LhCENo0wHXvYn2Zc5s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sZ7mBzFB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sZ7mBzFB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 730D5C433F1; Tue, 26 Mar 2024 15:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711465607; bh=B8qB9LxYp7aNKSjYMyDo0CeyGwOCmr2Wum7lcf6UN68=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=sZ7mBzFBLFf12dooN8ORVs6+Y8YzQYmspv4TjUHZQVyAGyC0jkX0QnERlhsU1ixK1 4TCk+Uy+JuxduXqVTxXW67mDT1h3qdDWwijvr8+UTf6J4Yw5HSHxUJHNmmE441mBb8 ClxJwmptyw4hlYv/o3LqgBbulq9Ry0iEa1VwhpJT/ecJBHwDpI+joO6dYOM1NOLfCz 4A9R4Zjd+Z8sKmHRJy727lu8OV7Gs6MF/3uIkEkPNJkNaz2D8MiwcUh1Va4KGqFkTX SxxBiDwevSwTB8974XGph5wAnZ5OaRLSYZuArLmdXIn7Q7UlqnnpWB4rw2AWCiToo6 hsaEbTvkXJByg== From: Bjorn Andersson Date: Tue, 26 Mar 2024 08:11:33 -0700 Subject: [PATCH 5/6] drm/msm/dp: Use function arguments for timing configuration Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240326-msm-dp-cleanup-v1-5-e775556ecec0@quicinc.com> References: <20240326-msm-dp-cleanup-v1-0-e775556ecec0@quicinc.com> In-Reply-To: <20240326-msm-dp-cleanup-v1-0-e775556ecec0@quicinc.com> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Bjorn Andersson X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=4568; i=quic_bjorande@quicinc.com; h=from:subject:message-id; bh=xZExesJNk5HfEJV3vYrPFpgGd0WDPR48SsGygxZe6Ww=; b=owEBgwJ8/ZANAwAIAQsfOT8Nma3FAcsmYgBmAuWi+J5SrwhQNjnbx2S5Y1gIXzgu0EGG2KJya FXiFCVEhX+JAkkEAAEIADMWIQQF3gPMXzXqTwlm1SULHzk/DZmtxQUCZgLlohUcYW5kZXJzc29u QGtlcm5lbC5vcmcACgkQCx85Pw2ZrcWO4w//eXXBSpZLedSHEbpDs5uQkVixX5+acoyhToUQyoR J/sYm5CJuC9YPBb4DmJnxkp3SCVXVcxfhV+QGAc2Un9VuIFy02JbhEsyqSXskKGdwyWRKCQJe63 yWa+eA73pbB21RxcFjzkaZzeV01niw98YCXKAPZvNyfwyAsJjy6eFpQQwjm/Xrq2DotfLC9lUiw bVjEJRY0cY1er4X6Ywxmpp0F0yM06LsHdRh3ZsiENcY+wF2wCKpcsekdcDRshYb68n+n/M+4WfT WF4yxFDgocFfxJRQMedeDejn+gQF25J+FdyeVQtXvkz9CRsZi+/0xcSz7QnAQFlxOfWl9I+LXwl GwAAxgUtMaIY6Uuh18DMScB/xflWXr1j530rDQ3r1S8V1CzITY8RqW9oSmbw/fwy5zNUfpilxvm kzEDlxrU0Xo+Cmlx2RMJHOcCVGnz6HLO0Gf89CBNzts1yGAHgF+pslKSau3TLtvKOPBK/fuVhBq Nb1G/Vxj4YYmbvJqGNZDQgMtJS5ahzXEXQkHq/G7SoiLyVsI4Nlk626YkbkKGD7S019nNIoQla3 Yabbt+jMl8GprKDGrc3ch/3eYKBn5vIXb/hXHNyfD/mQQ8htG6/OKbi+BxBIOBaRVz6TrVQ9Fd2 edFUDcCxVvSPWZyDp653+s1aNGKfKBJsXpgy8N9y0tbE= X-Developer-Key: i=quic_bjorande@quicinc.com; a=openpgp; fpr=05DE03CC5F35EA4F0966D5250B1F393F0D99ADC5 From: Bjorn Andersson dp_catalog_panel_timing_cfg() takes 4 arguments, which are passed from the calling function through members of struct dp_catalog. No state is maintained other than across this call, so switch to function arguments to clean up the code. Signed-off-by: Bjorn Andersson --- drivers/gpu/drm/msm/dp/dp_catalog.c | 14 ++++++-------- drivers/gpu/drm/msm/dp/dp_catalog.h | 7 ++----- drivers/gpu/drm/msm/dp/dp_panel.c | 14 +++++++++----- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index 295bd4cb72cc..00ad3ebaa5a1 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -880,19 +880,17 @@ u32 dp_catalog_ctrl_read_phy_pattern(struct dp_catalog *dp_catalog) } /* panel related catalog functions */ -int dp_catalog_panel_timing_cfg(struct dp_catalog *dp_catalog) +int dp_catalog_panel_timing_cfg(struct dp_catalog *dp_catalog, u32 total, + u32 sync_start, u32 width_blanking, u32 dp_active) { struct dp_catalog_private *catalog = container_of(dp_catalog, struct dp_catalog_private, dp_catalog); u32 reg; - dp_write_link(catalog, REG_DP_TOTAL_HOR_VER, - dp_catalog->total); - dp_write_link(catalog, REG_DP_START_HOR_VER_FROM_SYNC, - dp_catalog->sync_start); - dp_write_link(catalog, REG_DP_HSYNC_VSYNC_WIDTH_POLARITY, - dp_catalog->width_blanking); - dp_write_link(catalog, REG_DP_ACTIVE_HOR_VER, dp_catalog->dp_active); + dp_write_link(catalog, REG_DP_TOTAL_HOR_VER, total); + dp_write_link(catalog, REG_DP_START_HOR_VER_FROM_SYNC, sync_start); + dp_write_link(catalog, REG_DP_HSYNC_VSYNC_WIDTH_POLARITY, width_blanking); + dp_write_link(catalog, REG_DP_ACTIVE_HOR_VER, dp_active); reg = dp_read_p0(catalog, MMSS_DP_INTF_CONFIG); diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h b/drivers/gpu/drm/msm/dp/dp_catalog.h index 290ef8180c12..a82ab4856b50 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.h +++ b/drivers/gpu/drm/msm/dp/dp_catalog.h @@ -48,10 +48,6 @@ enum dp_catalog_audio_header_type { }; struct dp_catalog { - u32 total; - u32 sync_start; - u32 width_blanking; - u32 dp_active; enum dp_catalog_audio_sdp_type sdp_type; enum dp_catalog_audio_header_type sdp_header; u32 audio_data; @@ -106,7 +102,8 @@ void dp_catalog_ctrl_send_phy_pattern(struct dp_catalog *dp_catalog, u32 dp_catalog_ctrl_read_phy_pattern(struct dp_catalog *dp_catalog); /* DP Panel APIs */ -int dp_catalog_panel_timing_cfg(struct dp_catalog *dp_catalog); +int dp_catalog_panel_timing_cfg(struct dp_catalog *dp_catalog, u32 total, + u32 sync_start, u32 width_blanking, u32 dp_active); void dp_catalog_panel_enable_vsc_sdp(struct dp_catalog *dp_catalog, struct dp_sdp *vsc_sdp); void dp_catalog_panel_disable_vsc_sdp(struct dp_catalog *dp_catalog); void dp_catalog_dump_regs(struct dp_catalog *dp_catalog); diff --git a/drivers/gpu/drm/msm/dp/dp_panel.c b/drivers/gpu/drm/msm/dp/dp_panel.c index 8e7069453952..07db8f37cd06 100644 --- a/drivers/gpu/drm/msm/dp/dp_panel.c +++ b/drivers/gpu/drm/msm/dp/dp_panel.c @@ -353,6 +353,10 @@ int dp_panel_timing_cfg(struct dp_panel *dp_panel) struct dp_catalog *catalog; struct dp_panel_private *panel; struct drm_display_mode *drm_mode; + u32 width_blanking; + u32 sync_start; + u32 dp_active; + u32 total; panel = container_of(dp_panel, struct dp_panel_private, dp_panel); catalog = panel->catalog; @@ -376,13 +380,13 @@ int dp_panel_timing_cfg(struct dp_panel *dp_panel) data <<= 16; data |= total_hor; - catalog->total = data; + total = data; data = (drm_mode->vtotal - drm_mode->vsync_start); data <<= 16; data |= (drm_mode->htotal - drm_mode->hsync_start); - catalog->sync_start = data; + sync_start = data; data = drm_mode->vsync_end - drm_mode->vsync_start; data <<= 16; @@ -390,15 +394,15 @@ int dp_panel_timing_cfg(struct dp_panel *dp_panel) data |= drm_mode->hsync_end - drm_mode->hsync_start; data |= (panel->dp_panel.dp_mode.h_active_low << 15); - catalog->width_blanking = data; + width_blanking = data; data = drm_mode->vdisplay; data <<= 16; data |= drm_mode->hdisplay; - catalog->dp_active = data; + dp_active = data; - dp_catalog_panel_timing_cfg(catalog); + dp_catalog_panel_timing_cfg(catalog, total, sync_start, width_blanking, dp_active); if (dp_panel->dp_mode.out_fmt_is_yuv_420) dp_panel_setup_vsc_sdp_yuv_420(dp_panel); From patchwork Tue Mar 26 15:11:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 782726 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6A8713C9C9; Tue, 26 Mar 2024 15:06:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711465608; cv=none; b=Fv+eGdYC6rRAMJrGcr1WdILVJCpinQoMheGBJqx03dsMcM0QlSmmCO41vBNeeW0zyh8UcDBxzJRJcMz4e9SBMpFg6Ym+xHXZqhLIK/hmrEqpB4qi1V1lp2aa1mLlcFXpCtPVljHt5dOiLzRTZu0hZtynpTw4sG8jUVqL4fgJshs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711465608; c=relaxed/simple; bh=VZkbxJstwSPISSjebtghTsFMzbcGY1Gg49TU66g37Zo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=APA2VaYEK3PaovSsU5ije9kuAmbBTbblQfXbt0qZntN4QdYELopvWOKYn7n8bnI+czTbFDpUsdmCWI1tOIB+RYZ5rwB/UPj1EF23kpEZfJxxEWuic1gyZhC6JXJDnD6ni/dW7vEZ5Z8RiW5hSHrjjGvT1BZZD0oc7O+dZlyNFio= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Xicm2wkG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Xicm2wkG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CC6EC4166B; Tue, 26 Mar 2024 15:06:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711465608; bh=VZkbxJstwSPISSjebtghTsFMzbcGY1Gg49TU66g37Zo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Xicm2wkGcgKxv40fIqLn5ecM0mu273FOSfH+JEzZk54ips0Slq3E1+wHk1LeqGman i94Pe+1fHoaPB8937WLJMsCwl6oACoMSXaJEAFqqdwQTwVnNBZz4bM8LRl05Z3NWxv QTbxCTtDpCtkz36ZraLHNE56X6r1koaB+PQKLL3J+JSR+XcOkgoufrUs8BL9eJcsfk Y7ut7mu9cJ++VyKWbEJtt048cRfPpMfR7Lvq/lcY5lgKSEnsVO7zJxJ0GIDOTSgzWY YT7GK44loq95Non81dEoHboBK2FDuaM5Pv2iXUGXGwlaLhGijjdyRqDjQvDA5OQ86W bAnkE0g+9JsAg== From: Bjorn Andersson Date: Tue, 26 Mar 2024 08:11:34 -0700 Subject: [PATCH 6/6] drm/msm/dp: Use function arguments for audio operations Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240326-msm-dp-cleanup-v1-6-e775556ecec0@quicinc.com> References: <20240326-msm-dp-cleanup-v1-0-e775556ecec0@quicinc.com> In-Reply-To: <20240326-msm-dp-cleanup-v1-0-e775556ecec0@quicinc.com> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Bjorn Andersson X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=8282; i=quic_bjorande@quicinc.com; h=from:subject:message-id; bh=BcOYwhP7HynBIuV3UQKuBFCsaFgtfuW2v5qo9WikuOU=; b=owEBgwJ8/ZANAwAIAQsfOT8Nma3FAcsmYgBmAuWigAT7Voi3Pa6Z9JYLj6PQspagIJviNa3KL zO5hD5FK42JAkkEAAEIADMWIQQF3gPMXzXqTwlm1SULHzk/DZmtxQUCZgLlohUcYW5kZXJzc29u QGtlcm5lbC5vcmcACgkQCx85Pw2ZrcUmCg/+OBS1X4s/HW/NVbz79/qB0NxNG4p43zMPeDwd/L6 nv7j6zBJ4JDsaW5MEunohTC2WCHrNkFlAk3gjf4eUVEJMBtwNkL7CHMjSutFXc5wJ11oWV6lxso 6QN9A93EjoJMrEvWEW2ldlHjaCOGqq67aFZ/qwK6yA/bda0L1ZeuwGQkAlAMpQfOQfqj+iLmlZs XDmQMgyQ9cN/38/iSYn9oBwi2L9GlowtdorLvN/VPqlwYfvPiYPQpaXJSGZ283BizMqMLYuoqSN l+Mhm1hVkSEAI2rC0N7JYK3x/tTg79KKVwqbp8Z3Z2kTakyrht2DumATzjgKpIX8gMtYTthvHvO ZceDSUbIsYZ07MbpAfMkHCWoj4oUzpnISg32FgdUhlW0Xcz6kAzaFc2ji0vCNcV9FKMV6iEEMMz fz7/QFJmxcEnHSRPsI9osststIcjBwrpvSosX1bbuEePkLJEvywB0OlQXJG8ex+l+t0pQBTrmi9 HfcaOfsZte4D0tcVV+mfXXX1wXc/+GzPxlwog0Gr6G2zTXuQQeiDLlqwICOqX5fmgMkqMP2iqr1 H7qK9bENb7soJ1120f8UImjlIRu6wXFMzzkzYfDnwpTXoYHuyoco7sVHbe7PNAcBBRADjWNnSyD iGQS0FifTT6cD8/y/vVAEopPZitDOmW+1lYV8a2tBVDI= X-Developer-Key: i=quic_bjorande@quicinc.com; a=openpgp; fpr=05DE03CC5F35EA4F0966D5250B1F393F0D99ADC5 From: Bjorn Andersson The dp_audio read and write operations uses members in struct dp_catalog for passing arguments and return values. This adds unnecessary complexity to the implementation, as it turns out after detangling the logic that no state is actually held in these variables. Clean this up by using function arguments and return values for passing the data. Signed-off-by: Bjorn Andersson --- drivers/gpu/drm/msm/dp/dp_audio.c | 20 +++++-------------- drivers/gpu/drm/msm/dp/dp_catalog.c | 39 +++++++++++++------------------------ drivers/gpu/drm/msm/dp/dp_catalog.h | 18 +++++++++-------- 3 files changed, 28 insertions(+), 49 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_audio.c b/drivers/gpu/drm/msm/dp/dp_audio.c index 7fd0c1793ba3..a599fc5d63c5 100644 --- a/drivers/gpu/drm/msm/dp/dp_audio.c +++ b/drivers/gpu/drm/msm/dp/dp_audio.c @@ -32,11 +32,7 @@ static u32 dp_audio_get_header(struct dp_catalog *catalog, enum dp_catalog_audio_sdp_type sdp, enum dp_catalog_audio_header_type header) { - catalog->sdp_type = sdp; - catalog->sdp_header = header; - dp_catalog_audio_get_header(catalog); - - return catalog->audio_data; + return dp_catalog_audio_get_header(catalog, sdp, header); } static void dp_audio_set_header(struct dp_catalog *catalog, @@ -44,10 +40,7 @@ static void dp_audio_set_header(struct dp_catalog *catalog, enum dp_catalog_audio_sdp_type sdp, enum dp_catalog_audio_header_type header) { - catalog->sdp_type = sdp; - catalog->sdp_header = header; - catalog->audio_data = data; - dp_catalog_audio_set_header(catalog); + dp_catalog_audio_set_header(catalog, sdp, header, data); } static void dp_audio_stream_sdp(struct dp_audio_private *audio) @@ -317,8 +310,7 @@ static void dp_audio_setup_acr(struct dp_audio_private *audio) break; } - catalog->audio_data = select; - dp_catalog_audio_config_acr(catalog); + dp_catalog_audio_config_acr(catalog, select); } static void dp_audio_safe_to_exit_level(struct dp_audio_private *audio) @@ -344,16 +336,14 @@ static void dp_audio_safe_to_exit_level(struct dp_audio_private *audio) break; } - catalog->audio_data = safe_to_exit_level; - dp_catalog_audio_sfe_level(catalog); + dp_catalog_audio_sfe_level(catalog, safe_to_exit_level); } static void dp_audio_enable(struct dp_audio_private *audio, bool enable) { struct dp_catalog *catalog = audio->catalog; - catalog->audio_data = enable; - dp_catalog_audio_enable(catalog); + dp_catalog_audio_enable(catalog, enable); } static struct dp_audio_private *dp_audio_get_data(struct platform_device *pdev) diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index 00ad3ebaa5a1..970d62e1610c 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -1159,34 +1159,28 @@ struct dp_catalog *dp_catalog_get(struct device *dev) return &catalog->dp_catalog; } -void dp_catalog_audio_get_header(struct dp_catalog *dp_catalog) +u32 dp_catalog_audio_get_header(struct dp_catalog *dp_catalog, + enum dp_catalog_audio_sdp_type sdp, + enum dp_catalog_audio_header_type header) { struct dp_catalog_private *catalog; u32 (*sdp_map)[DP_AUDIO_SDP_HEADER_MAX]; - enum dp_catalog_audio_sdp_type sdp; - enum dp_catalog_audio_header_type header; - - if (!dp_catalog) - return; catalog = container_of(dp_catalog, struct dp_catalog_private, dp_catalog); sdp_map = catalog->audio_map; - sdp = dp_catalog->sdp_type; - header = dp_catalog->sdp_header; - dp_catalog->audio_data = dp_read_link(catalog, - sdp_map[sdp][header]); + return dp_read_link(catalog, sdp_map[sdp][header]); } -void dp_catalog_audio_set_header(struct dp_catalog *dp_catalog) +void dp_catalog_audio_set_header(struct dp_catalog *dp_catalog, + enum dp_catalog_audio_sdp_type sdp, + enum dp_catalog_audio_header_type header, + u32 data) { struct dp_catalog_private *catalog; u32 (*sdp_map)[DP_AUDIO_SDP_HEADER_MAX]; - enum dp_catalog_audio_sdp_type sdp; - enum dp_catalog_audio_header_type header; - u32 data; if (!dp_catalog) return; @@ -1195,17 +1189,14 @@ void dp_catalog_audio_set_header(struct dp_catalog *dp_catalog) struct dp_catalog_private, dp_catalog); sdp_map = catalog->audio_map; - sdp = dp_catalog->sdp_type; - header = dp_catalog->sdp_header; - data = dp_catalog->audio_data; dp_write_link(catalog, sdp_map[sdp][header], data); } -void dp_catalog_audio_config_acr(struct dp_catalog *dp_catalog) +void dp_catalog_audio_config_acr(struct dp_catalog *dp_catalog, u32 select) { struct dp_catalog_private *catalog; - u32 acr_ctrl, select; + u32 acr_ctrl; if (!dp_catalog) return; @@ -1213,7 +1204,6 @@ void dp_catalog_audio_config_acr(struct dp_catalog *dp_catalog) catalog = container_of(dp_catalog, struct dp_catalog_private, dp_catalog); - select = dp_catalog->audio_data; acr_ctrl = select << 4 | BIT(31) | BIT(8) | BIT(14); drm_dbg_dp(catalog->drm_dev, "select: %#x, acr_ctrl: %#x\n", @@ -1222,10 +1212,9 @@ void dp_catalog_audio_config_acr(struct dp_catalog *dp_catalog) dp_write_link(catalog, MMSS_DP_AUDIO_ACR_CTRL, acr_ctrl); } -void dp_catalog_audio_enable(struct dp_catalog *dp_catalog) +void dp_catalog_audio_enable(struct dp_catalog *dp_catalog, bool enable) { struct dp_catalog_private *catalog; - bool enable; u32 audio_ctrl; if (!dp_catalog) @@ -1234,7 +1223,6 @@ void dp_catalog_audio_enable(struct dp_catalog *dp_catalog) catalog = container_of(dp_catalog, struct dp_catalog_private, dp_catalog); - enable = !!dp_catalog->audio_data; audio_ctrl = dp_read_link(catalog, MMSS_DP_AUDIO_CFG); if (enable) @@ -1329,10 +1317,10 @@ void dp_catalog_audio_init(struct dp_catalog *dp_catalog) catalog->audio_map = sdp_map; } -void dp_catalog_audio_sfe_level(struct dp_catalog *dp_catalog) +void dp_catalog_audio_sfe_level(struct dp_catalog *dp_catalog, u32 safe_to_exit_level) { struct dp_catalog_private *catalog; - u32 mainlink_levels, safe_to_exit_level; + u32 mainlink_levels; if (!dp_catalog) return; @@ -1340,7 +1328,6 @@ void dp_catalog_audio_sfe_level(struct dp_catalog *dp_catalog) catalog = container_of(dp_catalog, struct dp_catalog_private, dp_catalog); - safe_to_exit_level = dp_catalog->audio_data; mainlink_levels = dp_read_link(catalog, REG_DP_MAINLINK_LEVELS); mainlink_levels &= 0xFE0; mainlink_levels |= safe_to_exit_level; diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h b/drivers/gpu/drm/msm/dp/dp_catalog.h index a82ab4856b50..cd1ad046a953 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.h +++ b/drivers/gpu/drm/msm/dp/dp_catalog.h @@ -48,9 +48,6 @@ enum dp_catalog_audio_header_type { }; struct dp_catalog { - enum dp_catalog_audio_sdp_type sdp_type; - enum dp_catalog_audio_header_type sdp_header; - u32 audio_data; bool wide_bus_en; }; @@ -114,12 +111,17 @@ void dp_catalog_panel_tpg_disable(struct dp_catalog *dp_catalog); struct dp_catalog *dp_catalog_get(struct device *dev); /* DP Audio APIs */ -void dp_catalog_audio_get_header(struct dp_catalog *catalog); -void dp_catalog_audio_set_header(struct dp_catalog *catalog); -void dp_catalog_audio_config_acr(struct dp_catalog *catalog); -void dp_catalog_audio_enable(struct dp_catalog *catalog); +u32 dp_catalog_audio_get_header(struct dp_catalog *dp_catalog, + enum dp_catalog_audio_sdp_type sdp, + enum dp_catalog_audio_header_type header); +void dp_catalog_audio_set_header(struct dp_catalog *dp_catalog, + enum dp_catalog_audio_sdp_type sdp, + enum dp_catalog_audio_header_type header, + u32 data); +void dp_catalog_audio_config_acr(struct dp_catalog *catalog, u32 select); +void dp_catalog_audio_enable(struct dp_catalog *catalog, bool enable); void dp_catalog_audio_config_sdp(struct dp_catalog *catalog); void dp_catalog_audio_init(struct dp_catalog *catalog); -void dp_catalog_audio_sfe_level(struct dp_catalog *catalog); +void dp_catalog_audio_sfe_level(struct dp_catalog *catalog, u32 safe_to_exit_level); #endif /* _DP_CATALOG_H_ */