From patchwork Sun Dec 31 00:43:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13507067 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7868EC46CD2 for ; Sun, 31 Dec 2023 00:44:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8E86610E04A; Sun, 31 Dec 2023 00:44:00 +0000 (UTC) Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1A1E610E04A for ; Sun, 31 Dec 2023 00:43:58 +0000 (UTC) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-50e7e55c0f6so4730418e87.0 for ; Sat, 30 Dec 2023 16:43:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703983437; x=1704588237; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3oS3e08i9+4napyM4Cx2ITHLfZ0NtaHlzp9IZJ5e4DI=; b=qTc9FexcP0mwKsZ+uptbYnIpDuLTGnZeI0Vnt0nWsnn/Z/WUXWJKwRXnHY1nVV6HMJ IUJSU7YCCl9nEQ729J9rWiIXuXTb2hh1Io8vEs0Lj9tdWHLoJ7lXWmrszztmtLveqJHw pKIvbpWHFNrl2ebZ5zgLV1mITl3ycMQnUAFW4V/dponhMGRa9/zwJJGleWo392b0Ynjj 94z0wi3vzOy622qxISIbthum1ws74oNVm/vqi0hXDEwZwJCUaftXb2pYTnWi0bOZy0PY nw/kyDPDL/8lNZNdXr4y4VL3Z7PAxZrX9oOzRu59ccHn1XTSE+8GDuIlevkC1jdv83R+ TgbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703983437; x=1704588237; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3oS3e08i9+4napyM4Cx2ITHLfZ0NtaHlzp9IZJ5e4DI=; b=Y+FhAoaWnQvavsODQsDoZDSOrEu1bRWXWM5MbJBNZhyP5qjcZ68LdYKquDFAN/xkMA Wxi8vzngXo3Nw0gF16D20kgFkcjldieUrfFiTE+srHLBd4UfweCW7VLsyS7dMCOkzlN6 wOqkDQJbZpct9e0ysfUcBE4SdjmkrGJvSTPjqYLr04VGfmbOXhPkXMWD1lwbLmhl4ph2 XvqBUUUpkRMHcNwc07ojhsiqR1VfMnkBS9MC8TQe7M8vwMsFw1xJ0GhHc867lHrnC/p0 +UBTzygOwKNnHLBmfpIx1HTQb6AnDVdxIupcXn1Rb1wg+2S0vkJkaXLnAk5CyPJ5EhhU GwQg== X-Gm-Message-State: AOJu0Yx2fZJnIi3B+fjn/EhVeFL0psN0E2UWW3BRjDZFjqsumQCfL03X RMrFx9w7n0NcqQq0QMq9KX3/TP0M5cl0lA== X-Google-Smtp-Source: AGHT+IG/BQ6GApy4H/SeCJffIMC1S1kURQGtN4k5+GaCdaX81KwQ4RajZwmthCVAOZU1lksWe59Oag== X-Received: by 2002:ac2:4245:0:b0:50e:7e38:6e09 with SMTP id m5-20020ac24245000000b0050e7e386e09mr1639786lfl.192.1703983437145; Sat, 30 Dec 2023 16:43:57 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id n13-20020a05651203ed00b0050e84be8127sm1295995lfq.101.2023.12.30.16.43.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 16:43:56 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 31 Dec 2023 02:43:48 +0200 Subject: [PATCH v2 01/15] drm/msm/dp: drop unused parser definitions MIME-Version: 1.0 Message-Id: <20231231-dp-power-parser-cleanup-v2-1-fc3e902a6f5b@linaro.org> References: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> In-Reply-To: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , Stephen Boyd X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2918; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=yVyRmmNda9mfXwPWksVdLkO9SsjdUAzlZBACGcKQbRg=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlkLlJxDusX/Mwxoi5Za1T0xN6tZBtKSS46fvKj rES0TQ+n66JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZZC5SQAKCRCLPIo+Aiko 1eZ3B/wPO1Rh++PAEXQawRFR2VwvctoM9Rzvn8dCISWUeFJz1zWbzPN/xFw3qtzU4v+syJ+ZZjK GLjFkyYfL1j2TrBpYuu6UywJJmAqy1TXzY1d6osF9ioPaRNW43UHcAvMMm/KfmDDAvfnlmiSif5 qHdFbNcbL9gQd71SnrA6uy1QBI2deU8TBfW4Z9YJveUBH1AeXOFqAPPD2YxiiF+Lb020lRdvE6p lohRtzNcD+QBHk3rIxFfGEo405nZAfCDoNUKw/Roec/DWv3FtmngQl3n9CnWrUO36w4X8EOUHgv XCjLDS3RNZdTTFGzTKHpBoJ/k4cjTriRR3ZbJN6s8YwmgoYM X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: Konrad Dybcio , linux-arm-msm@vger.kernel.org, Bjorn Andersson , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Drop several unused and obsolete definitions from the dp_parser module. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_parser.h | 46 -------------------------------------- 1 file changed, 46 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h index 1f068626d445..90a2cdbbe344 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ b/drivers/gpu/drm/msm/dp/dp_parser.h @@ -12,7 +12,6 @@ #include "msm_drv.h" -#define DP_LABEL "MDSS DP DISPLAY" #define DP_MAX_PIXEL_CLK_KHZ 675000 #define DP_MAX_NUM_DP_LANES 4 #define DP_LINK_RATE_HBR2 540000 /* kbytes */ @@ -21,7 +20,6 @@ enum dp_pm_type { DP_CORE_PM, DP_CTRL_PM, DP_STREAM_PM, - DP_PHY_PM, DP_MAX_PM }; @@ -43,28 +41,10 @@ static inline const char *dp_parser_pm_name(enum dp_pm_type module) case DP_CORE_PM: return "DP_CORE_PM"; case DP_CTRL_PM: return "DP_CTRL_PM"; case DP_STREAM_PM: return "DP_STREAM_PM"; - case DP_PHY_PM: return "DP_PHY_PM"; default: return "???"; } } -/** - * struct dp_display_data - display related device tree data. - * - * @ctrl_node: referece to controller device - * @phy_node: reference to phy device - * @is_active: is the controller currently active - * @name: name of the display - * @display_type: type of the display - */ -struct dp_display_data { - struct device_node *ctrl_node; - struct device_node *phy_node; - bool is_active; - const char *name; - const char *display_type; -}; - /** * struct dp_ctrl_resource - controller's IO related data * @@ -77,28 +57,6 @@ struct dp_io { union phy_configure_opts phy_opts; }; -/** - * struct dp_pinctrl - DP's pin control - * - * @pin: pin-controller's instance - * @state_active: active state pin control - * @state_hpd_active: hpd active state pin control - * @state_suspend: suspend state pin control - */ -struct dp_pinctrl { - struct pinctrl *pin; - struct pinctrl_state *state_active; - struct pinctrl_state *state_hpd_active; - struct pinctrl_state *state_suspend; -}; - -/* Regulators for DP devices */ -struct dp_reg_entry { - char name[32]; - int enable_load; - int disable_load; -}; - struct dss_module_power { unsigned int num_clk; struct clk_bulk_data *clocks; @@ -109,16 +67,12 @@ struct dss_module_power { * * @pdev: platform data of the client * @mp: gpio, regulator and clock related data - * @pinctrl: pin-control related data - * @disp_data: controller's display related data * @parse: function to be called by client to parse device tree. */ struct dp_parser { struct platform_device *pdev; struct dss_module_power mp[DP_MAX_PM]; - struct dp_pinctrl pinctrl; struct dp_io io; - struct dp_display_data disp_data; u32 max_dp_lanes; u32 max_dp_link_rate; struct drm_bridge *next_bridge; From patchwork Sun Dec 31 00:43:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13507072 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CBA7BC47077 for ; Sun, 31 Dec 2023 00:44:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7A8A310E0E2; Sun, 31 Dec 2023 00:44:11 +0000 (UTC) Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by gabe.freedesktop.org (Postfix) with ESMTPS id CA9EB10E03E for ; Sun, 31 Dec 2023 00:43:59 +0000 (UTC) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-50e7ddd999bso4921254e87.1 for ; Sat, 30 Dec 2023 16:43:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703983438; x=1704588238; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=i0o+ygDvKgdzg84z/yGD97dQg8nwAd++RNbp4iSd1H4=; b=cEi+O9LgOZj3kMOayDhVV4+lobkpPFYDQN2ATLkIclSX5e8Ac9NlNBGp6W1P+5Ughp sk9RnmgeZ9RAripnWHh11pIKqBZCUAe/8WZCoZNfu37gMkJocY0L5cy+Gs2DtO+Is7Q8 O9+GuWRjn7hVWmyHXyGzNFvFSD7YUCJ76hIB1nqpGgEWfrHfAsPnIgBlXgWWn+3ovFP3 wmU5sf+SG3oLe49IPuwZ1/PYJrC/y6HX+ueH+Wt3Xbm64nqqqxpWvEzb7oBJrygjDk2Q YvJsloc1nXQz0OXaySqfQu6NfIgvEKN89r5YRVHXACi9fSXXKw1kfs4j/kGHtk+jxNJG usIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703983438; x=1704588238; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i0o+ygDvKgdzg84z/yGD97dQg8nwAd++RNbp4iSd1H4=; b=nObM9UQkTeDBVW67XjpgcMEmkwoT4wio5xGoTx+twX/l6hMr9joFnfNdvFwFnanZOY Ws3OzvQq+UJjHC89UMlAak1Es3FPztNQesVvP3aKp2DOPp05sYWCekcfcdBznK3ugXoM PrNRna/zHzWpLMSfAHQh/2UZYOxVdyqXTgm24sUo9W+L1M6vrVgEIgJ6XrkoWUQD3Tlm 3ULOHfH8tJnXHoM9JabMBw+HJYTQ0PE9XnFfv95S4tQJgKLiUDtuEfyTek7sKJ5tS3vx sddmafs+lJZbrSVRoX6n1lgF6wcQl85dbhfSMRo9jSN+F1LFJmHAlqFDJ9/bNP4nMHp7 pAQA== X-Gm-Message-State: AOJu0YzLNj8YWUdNp96V8taeh7pR7Kp+EaSa84KwkglWevkKbQlSMS2W zw7mxDqR5bimWbR+SnRcH1s42pbTm5NdxWW0I22E4ewurgG2Zw== X-Google-Smtp-Source: AGHT+IFuKsyNeRIsb9xygH5jZjhnVEd6acR8l9kvPpcafsGNAEuVd0LqVjSdqOhwjSmp/ANF2Hm3Gg== X-Received: by 2002:a05:6512:60c:b0:50b:f7bb:4545 with SMTP id b12-20020a056512060c00b0050bf7bb4545mr5260316lfe.68.1703983438024; Sat, 30 Dec 2023 16:43:58 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id n13-20020a05651203ed00b0050e84be8127sm1295995lfq.101.2023.12.30.16.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 16:43:57 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 31 Dec 2023 02:43:49 +0200 Subject: [PATCH v2 02/15] drm/msm/dp: drop unused fields from dp_power_private MIME-Version: 1.0 Message-Id: <20231231-dp-power-parser-cleanup-v2-2-fc3e902a6f5b@linaro.org> References: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> In-Reply-To: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , Stephen Boyd X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=744; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=mPuJ0sdVtb49CzPgC03wOi5IYVOAPxO/LgrDoWoA7+M=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlkLlJ9pxCr+cfMbT52vEps1uINtOzZDFA5Bp0S JE02LmKf9GJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZZC5SQAKCRCLPIo+Aiko 1YJUB/9HzfmJqtMbNuXniEQKlE2aau8EdIcJfrVD8jFUc21yySAuaqy5QLLHxYT/qktPDubQ/t2 K0e852gS8v0R1ich+98jsWgae9PwbL2w8snsZIWP+G6sNVgGUF2n8AXyjR46zvvB+mKv7dsTTtt BYasWqlRqT6Oqn3TG60BzA80543KWt8nH9dJkfJ7VRIImfqPpsdQxDNaHIwHkJ/iAZl184uc8rM 1VCLBSqF7xAVYgfDJcYX+m5bVKdh/4lKiIi4b1YF2+eNoT0AsCAtqYaxQ9p+f2ONIaetLQG0sQK qmKjg4QMfBkcENhDGoZPebtasnsAGMSI8EfaQTgOZexEkzz8 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: Konrad Dybcio , linux-arm-msm@vger.kernel.org, Bjorn Andersson , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Drop unused and obsolete fields from struct dp_power_private. Reviewed-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_power.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_power.c b/drivers/gpu/drm/msm/dp/dp_power.c index c4843dd69f47..b095a5b47c8b 100644 --- a/drivers/gpu/drm/msm/dp/dp_power.c +++ b/drivers/gpu/drm/msm/dp/dp_power.c @@ -16,9 +16,6 @@ struct dp_power_private { struct dp_parser *parser; struct device *dev; struct drm_device *drm_dev; - struct clk *link_clk_src; - struct clk *pixel_provider; - struct clk *link_provider; struct dp_power dp_power; }; From patchwork Sun Dec 31 00:43:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13507070 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD2EDC47077 for ; Sun, 31 Dec 2023 00:44:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D475A10E0E8; Sun, 31 Dec 2023 00:44:04 +0000 (UTC) Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by gabe.freedesktop.org (Postfix) with ESMTPS id 86AC910E043 for ; Sun, 31 Dec 2023 00:44:00 +0000 (UTC) Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2ccc6e509c8so43451001fa.0 for ; Sat, 30 Dec 2023 16:44:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703983439; x=1704588239; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=WsClFXjXZL1/cgwwi1vtRBjWGBqeVxIEF70yOJflqhU=; b=ok7cRCAbtpW9+l6uMPTuivC4+d5NaNVRzvqvco2JCfyY03dt+J2fyJ+lKH4tP3uf9t CKp/BR7rcJQ+VC4DACVmGavZWMA60B4G9uo1+j8Zt0sfyiI18BKKusLLzXD0IGHBkP9b zLKkHvLJkmhfxWmHk8AsuSO0CFMjd9kLITdT4Dt/bR2+rlkL2RfIMLM6FRZBbAJuvDY5 4aF88JBL8z2ij4R5BP9RABglEnLS/Lf+5GQKltPABuYQkX0+C5wjM7FNek/NskSLedLc T0VMy7tEGjjkVL0pZ+oAeFAdYB9fVxa88j06ulik7j27iLkyIoFnuIAzbOFW8FSV4lI7 cV8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703983439; x=1704588239; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WsClFXjXZL1/cgwwi1vtRBjWGBqeVxIEF70yOJflqhU=; b=s2wPEzpMHefy0yQgsc6KW1T8UebUKPbCRFbXjmpSIUcxAhp2W+DVXnP/YaEqveDHch 0Vl8QMvDmyEgKBwAi54VqF7iyKEJ6bILYE7acXsoOu3o9XmB2nWLnoS/9YbIszer+lUT hpLvXI0SYG+e9LA7iWinm2vNB4ViOYtlJC88mkZzCmxzko4HDH9FVMnxmhWGNCHZ88mb CQswHYbs/qy38++KERU1QbLpQzlX+GNu8eCj+k/s4h3CVrrqGT0aHeQk9bVzTbmRbpXN 2deyCXWohI0ZsdUcELA0yV+RdFK0TJQJ0DP//utwxNaggxnQI2Oh/hN3SCVcnaXoGNG2 F0VA== X-Gm-Message-State: AOJu0Yyjs8+JB3E2oVt3jqmhMyK7XP4aLpt9LmPqWexqQwgcdl1CYrYu mvwR7qkyf0t2pNFzbqPpOvatJ+OeKA6zdw== X-Google-Smtp-Source: AGHT+IFj+ETuYeyccWGVEOUFdVJpyDVzBfxtMFjrfs+4rnbGgjA7Pql4p2q+zrzbJLFbmClJO/Lx9w== X-Received: by 2002:a05:6512:12d2:b0:50e:9a16:103 with SMTP id p18-20020a05651212d200b0050e9a160103mr89205lfg.31.1703983438874; Sat, 30 Dec 2023 16:43:58 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id n13-20020a05651203ed00b0050e84be8127sm1295995lfq.101.2023.12.30.16.43.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 16:43:58 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 31 Dec 2023 02:43:50 +0200 Subject: [PATCH v2 03/15] drm/msm/dp: parse DT from dp_parser_get MIME-Version: 1.0 Message-Id: <20231231-dp-power-parser-cleanup-v2-3-fc3e902a6f5b@linaro.org> References: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> In-Reply-To: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , Stephen Boyd X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2495; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=nbI6O2jVJmJKDcIwmvwKvAtsadxXm7JZt5ZEib+SKuc=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlkLlJot5ruSYBM2dWO8mK76xKYFScuAQwatTME 7msN1ztCbWJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZZC5SQAKCRCLPIo+Aiko 1dYyCACxhk++LQcxDQ33qtIafnZZqojTBqhcEN2pKX+xCPd8oJKgD3bGBJJQ5a1M4SMe1M4DrIt dcQ0IkcShE23vffDIpoSXXDrtFrpGbvdr754m/ww+7sQMfED1+rTwJYGRnytelca4chMBl6tqDk tgaqxO2tv0F2K3u1QLwVX7LTJm1lxVrC8iLnOzDECksGyBiO9M+bC8FDb1KgOdXx1SPUh8oJbQA gizgtfGN7nobo+ExnWNlp0Phq1I34yTyXgn1L5SZ9ndk5/M/tZdPzSJIxApqxfM8r5U1gW+Id/4 vCOmsAY4+Qdf/fS+5FdcV5po+maMzR6scUT74maLvy6myLka X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: Konrad Dybcio , linux-arm-msm@vger.kernel.org, Bjorn Andersson , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It makes little sense to split the submodule get and actual DT parsing. Call dp_parser_parse() directly from dp_parser_get(), so that the parser data is fully initialised once it is returned to the caller. Reviewed-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_display.c | 6 ------ drivers/gpu/drm/msm/dp/dp_parser.c | 8 +++++++- drivers/gpu/drm/msm/dp/dp_parser.h | 3 --- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index d37d599aec27..67b48f0a6c83 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -1266,12 +1266,6 @@ static int dp_display_probe(struct platform_device *pdev) return -EPROBE_DEFER; } - rc = dp->parser->parse(dp->parser); - if (rc) { - DRM_ERROR("device tree parsing failed\n"); - goto err; - } - rc = dp_power_client_init(dp->power); if (rc) { DRM_ERROR("Power client create failed\n"); diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index 7032dcc8842b..2d9d126c119b 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -315,13 +315,19 @@ static int dp_parser_parse(struct dp_parser *parser) struct dp_parser *dp_parser_get(struct platform_device *pdev) { struct dp_parser *parser; + int ret; parser = devm_kzalloc(&pdev->dev, sizeof(*parser), GFP_KERNEL); if (!parser) return ERR_PTR(-ENOMEM); - parser->parse = dp_parser_parse; parser->pdev = pdev; + ret = dp_parser_parse(parser); + if (ret) { + dev_err(&pdev->dev, "device tree parsing failed\n"); + return ERR_PTR(ret); + } + return parser; } diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h index 90a2cdbbe344..4ccc432b4142 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ b/drivers/gpu/drm/msm/dp/dp_parser.h @@ -67,7 +67,6 @@ struct dss_module_power { * * @pdev: platform data of the client * @mp: gpio, regulator and clock related data - * @parse: function to be called by client to parse device tree. */ struct dp_parser { struct platform_device *pdev; @@ -76,8 +75,6 @@ struct dp_parser { u32 max_dp_lanes; u32 max_dp_link_rate; struct drm_bridge *next_bridge; - - int (*parse)(struct dp_parser *parser); }; /** From patchwork Sun Dec 31 00:43:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13507081 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A032BC4707B for ; Sun, 31 Dec 2023 00:44:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AA01710E173; Sun, 31 Dec 2023 00:44:26 +0000 (UTC) Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by gabe.freedesktop.org (Postfix) with ESMTPS id 283D710E043 for ; Sun, 31 Dec 2023 00:44:01 +0000 (UTC) Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2cc9fa5e8e1so83713961fa.3 for ; Sat, 30 Dec 2023 16:44:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703983439; x=1704588239; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=W/0vQlu3/zRSTNUc/QWsRNBkw7wsjD404h/u9X2qZl0=; b=ACInSekdIKQPfG+oxdUxLiIzUQiMv9pPVbCEmWD/8kQygmJDf63d11N8VWnXAdsvzR +dnB3OpOr+s4QGRvNy+5todnOKedCOYnxmrRilcAl1A6VXiCGImXMW5ZjQGOEFByxbYz 9ZB5NyCxxcyJnSpsCMawnV20BYD5NNSTlnVatnDgFuDose8hJnMer0YfpfcrTaaO/SPt yMJVnyfLWSFA/hMTBo4F1x7oR8nP/pm1qK1+lVHu8Pz2D1g/z+PQRVjez2v+urmrD0/u bTtFlMIX8RYWVfcMFkRw55wxlJXnbLSeBVuGqEiqK1KUdzdc2a3RLu6fgAN0qWTCnJVq Q7TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703983439; x=1704588239; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W/0vQlu3/zRSTNUc/QWsRNBkw7wsjD404h/u9X2qZl0=; b=N4/ISS4NJUHZFWTQq8RAm8IUTz4dLJwNSelFYPqZKUtghQyiSJ1FU5mG7roLD+Z/P2 J14avSCS9f7/fEyd57QBX61Jlb6Vs/IfLkgNM0bvw8Es13C2sbgplLo+veOdy4UeX4CW 6z2an7G/WIdN6UBl6EDjrKMr8NPQHFuv7AIlsO5Dq2SJBqJfDTUUY0T9rCkIkd3qvLS5 /DuinrBJXnJELqudLqwPnSNKb/mEcT0com/vkpDhENa9/Wq+sNJ0N7dr4fv4AKV09i7I nxJVUAa7ugLdvkrOHD8diAGa9O8TzuJqq5m54VYscB9gLv9Spt54WqK+1dAVLF5jpiF1 TyvA== X-Gm-Message-State: AOJu0YyBC98SotA7+EeqBaYc857GyLIh9feMSaqD6whtjdomcrxdChJl GHwkN6LylavAMusZVlzKIDf5Kk2aokXtPg== X-Google-Smtp-Source: AGHT+IEoyXx61x3+MguUboypWgx0K/Gx6rd7o3hHzROIyVLOr3aJhUpVy6la2L/HMi2ho2EfeqKlwQ== X-Received: by 2002:ac2:4350:0:b0:50e:7f5e:24ac with SMTP id o16-20020ac24350000000b0050e7f5e24acmr3114902lfl.0.1703983439511; Sat, 30 Dec 2023 16:43:59 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id n13-20020a05651203ed00b0050e84be8127sm1295995lfq.101.2023.12.30.16.43.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 16:43:59 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 31 Dec 2023 02:43:51 +0200 Subject: [PATCH v2 04/15] drm/msm/dp: inline dp_power_(de)init MIME-Version: 1.0 Message-Id: <20231231-dp-power-parser-cleanup-v2-4-fc3e902a6f5b@linaro.org> References: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> In-Reply-To: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , Stephen Boyd X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2942; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=0tPYPq9OqCyaK2qdciiqePf9VS3u8McIRcRAIy4vqEY=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlkLlJ2ZPFfupZiPqo8YG7EvZ0wKX1rP2V88/pF PtnI/yKXByJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZZC5SQAKCRCLPIo+Aiko 1d+JB/9IA31potJBGv1YIX+5583YFgZ/0CkpvfUD7xcDfFN2l+wTelr5+rYEHo0nlmZ2QXwAZQw Npr5xIAelyEYrBLOZESwNlhbjVs3i7cyF2XjCx2NgcEOp80ify0G5Iy7aj+oSsuwBdSGndJADX0 vOVttfATA53O6PnEcIure4bdPg22urOYUkDpkYPTYC94Ut834MnF1My5YvThanS3CVOH/B4Nnc3 d2oR5M0RPGPUCUhiThF0FmsO2kkUDCXok/PUBV5caR6z8bBV74OQSvP2X7o7HWFiWxJVgOrsDk/ fJR8MOO7fVL2Sa877BkPq2Hjt9dgrJnoeL2/HUSoqu++DFEs X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: Konrad Dybcio , linux-arm-msm@vger.kernel.org, Bjorn Andersson , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In preparation to cleanup of the dp_power module, inline dp_power_init() and dp_power_deinit() functions, which are now just turning the clocks on and off. Reviewed-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_display.c | 4 ++-- drivers/gpu/drm/msm/dp/dp_power.c | 10 ---------- drivers/gpu/drm/msm/dp/dp_power.h | 21 --------------------- 3 files changed, 2 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 67b48f0a6c83..8cd18705740f 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -434,7 +434,7 @@ static void dp_display_host_init(struct dp_display_private *dp) dp->dp_display.connector_type, dp->core_initialized, dp->phy_initialized); - dp_power_init(dp->power); + dp_power_clk_enable(dp->power, DP_CORE_PM, true); dp_ctrl_reset_irq_ctrl(dp->ctrl, true); dp_aux_init(dp->aux); dp->core_initialized = true; @@ -448,7 +448,7 @@ static void dp_display_host_deinit(struct dp_display_private *dp) dp_ctrl_reset_irq_ctrl(dp->ctrl, false); dp_aux_deinit(dp->aux); - dp_power_deinit(dp->power); + dp_power_clk_enable(dp->power, DP_CORE_PM, false); dp->core_initialized = false; } diff --git a/drivers/gpu/drm/msm/dp/dp_power.c b/drivers/gpu/drm/msm/dp/dp_power.c index b095a5b47c8b..f49e3aede308 100644 --- a/drivers/gpu/drm/msm/dp/dp_power.c +++ b/drivers/gpu/drm/msm/dp/dp_power.c @@ -152,16 +152,6 @@ int dp_power_client_init(struct dp_power *dp_power) return dp_power_clk_init(power); } -int dp_power_init(struct dp_power *dp_power) -{ - return dp_power_clk_enable(dp_power, DP_CORE_PM, true); -} - -int dp_power_deinit(struct dp_power *dp_power) -{ - return dp_power_clk_enable(dp_power, DP_CORE_PM, false); -} - struct dp_power *dp_power_get(struct device *dev, struct dp_parser *parser) { struct dp_power_private *power; diff --git a/drivers/gpu/drm/msm/dp/dp_power.h b/drivers/gpu/drm/msm/dp/dp_power.h index 55ada51edb57..eb836b5aa24a 100644 --- a/drivers/gpu/drm/msm/dp/dp_power.h +++ b/drivers/gpu/drm/msm/dp/dp_power.h @@ -22,27 +22,6 @@ struct dp_power { bool stream_clks_on; }; -/** - * dp_power_init() - enable power supplies for display controller - * - * @power: instance of power module - * return: 0 if success or error if failure. - * - * This API will turn on the regulators and configures gpio's - * aux/hpd. - */ -int dp_power_init(struct dp_power *power); - -/** - * dp_power_deinit() - turn off regulators and gpios. - * - * @power: instance of power module - * return: 0 for success - * - * This API turns off power and regulators. - */ -int dp_power_deinit(struct dp_power *power); - /** * dp_power_clk_status() - display controller clocks status * From patchwork Sun Dec 31 00:43:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13507068 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E6360C47073 for ; Sun, 31 Dec 2023 00:44:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A01EC10E0CA; Sun, 31 Dec 2023 00:44:03 +0000 (UTC) Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by gabe.freedesktop.org (Postfix) with ESMTPS id F3BCE10E07B for ; Sun, 31 Dec 2023 00:44:01 +0000 (UTC) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-50e67f70f34so6782227e87.0 for ; Sat, 30 Dec 2023 16:44:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703983440; x=1704588240; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=nJWE1GkcFImEj2DxRPKAZs3b3f9vVuqQlVDaF+/qbvU=; b=Rp8CeCiTQ7NbKka1xUhqWylii/NsvzAWvCqBP+xrk6tqeNkJhnFa0O7wIuD0rdbtab 3PoO482GyOc3gmJiOWPEpZ1OSBXASrTQqpi8hCtlMywLt9Dupu4OqsHAi8qGF79Y6IvB NAdB64eBaBGGClTWFsEDW+oqoVO6vm1RBOWOG/mYdvLqotcuhmwoIoyhMa4n24XBwWPB 90xphoymPkkPDB8gZXjXlXjR/6DIU55vaD9xttTat5dct4hz2kodP9pSWDllJey7OgAu IcwOAXg+Qu38r44gTumhjm+2SNRW1zpzdUD0tVJ5/ZqkPV0whcG56FQYtEErSIa4tp0j vIVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703983440; x=1704588240; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nJWE1GkcFImEj2DxRPKAZs3b3f9vVuqQlVDaF+/qbvU=; b=p3S2T1ta9/Kk5caqjSzuCRao0pPvFbtqez0U3s48IjMtPC30OP3znb2rHnseRmZLkv Sa8TCSgoBN5jjqvH/UHiWUbqFYe6KwsL2WPlRGh2E9q/JPS2CV+TJSDk+0K6W+B9+3pL W1XEu/AazOv2qXAW7J9f4g40QzPoL9ZOgcWCNZ/NLs7bMSe8Re8HARC2F5/I7H7e8BD+ bUuGrSMQfacJhawH3QUBMjKxO8ONwJEXTc8895QB6ZcykExZoc9oA4xXTih+KpI0GKtt bDXynLlShk2ap/WoeaBVEl/yhqTfsjZKwybbFjIW1ePG2skRdvNHQhKFEdBt7Cf51W9w akOQ== X-Gm-Message-State: AOJu0YxmNuBZhQk+gdlg09UkFQLt/WAo9bIs4eP2spxUdusc/bhcHXJh n1RSzLfd/EUBNf20n3grk403YB4ytkVyAA== X-Google-Smtp-Source: AGHT+IGrYsXJpqHhSAZjAiRzO+IpcocDSm0Ddmw9dH7oGgonTvhIWUaxW1caF85xx3A15tWmZYSSKg== X-Received: by 2002:a05:6512:3ba8:b0:50e:754c:84f8 with SMTP id g40-20020a0565123ba800b0050e754c84f8mr5747294lfv.67.1703983440215; Sat, 30 Dec 2023 16:44:00 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id n13-20020a05651203ed00b0050e84be8127sm1295995lfq.101.2023.12.30.16.43.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 16:43:59 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 31 Dec 2023 02:43:52 +0200 Subject: [PATCH v2 05/15] drm/msm/dp: fold dp_power into dp_ctrl module MIME-Version: 1.0 Message-Id: <20231231-dp-power-parser-cleanup-v2-5-fc3e902a6f5b@linaro.org> References: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> In-Reply-To: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , Stephen Boyd X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=20838; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=dCw0JTAvwTm3wGka2zU3RC0fLmOOYChcuRvVrtRzN5I=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ+qEnV5bVM9rrqz4q7BAvM9P7ngLk3P/HUEFZ3uVF1zGz 3oai/Q6GY1ZGBi5GGTFFFl8ClqmxmxKDvuwY2o9zCBWJpApDFycAjCR4tXsf2VzjA6VblbuiHcR tMlubOaN/h/lZPA5bNW8XRpbxV2ZvF9H3uL51N/Tf3/PayODjRqpS+fbM6YXnPzp2pFg3xgQcMn J4wqf4vcopfvssdu6szmtlsyOmnHM3uDAjxOVUsHWZxcdKjvJUfY11zPWx3yh87r6BboL2mWULx TpWm+a35RuKvmG69L7SZvsftQm7dqfGrjxmNN65os2mjU632T8PUoWntPPmbWb1y5hz9b8JQtSo kp8yoJyVz3ksuExZD/hfeyK2KEpjHyaE/Y19x3dwBEqUfwnv8Bghuvz2Tp5tTNXH3rBuUr2wvHT P68/PX2v+ZbI/DnRoSFbBXOmbPfvnWBzfHrKBOXOV02rAQ== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: Konrad Dybcio , linux-arm-msm@vger.kernel.org, Bjorn Andersson , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The dp_power submodule is limited to handling the clocks only following previous cleanups. Fold it into the dp_ctrl submodule, removing one unnecessary level of indirection. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/Makefile | 1 - drivers/gpu/drm/msm/dp/dp_ctrl.c | 150 +++++++++++++++++++++++++++---- drivers/gpu/drm/msm/dp/dp_ctrl.h | 6 +- drivers/gpu/drm/msm/dp/dp_display.c | 24 +---- drivers/gpu/drm/msm/dp/dp_power.c | 170 ------------------------------------ drivers/gpu/drm/msm/dp/dp_power.h | 74 ---------------- 6 files changed, 142 insertions(+), 283 deletions(-) diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile index b1173128b5b9..8dbdf3fba69e 100644 --- a/drivers/gpu/drm/msm/Makefile +++ b/drivers/gpu/drm/msm/Makefile @@ -128,7 +128,6 @@ msm-$(CONFIG_DRM_MSM_DP)+= dp/dp_aux.o \ dp/dp_link.o \ dp/dp_panel.o \ dp/dp_parser.o \ - dp/dp_power.o \ dp/dp_audio.o msm-$(CONFIG_DRM_FBDEV_EMULATION) += msm_fbdev.o diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c index 77a8d9366ed7..da29281c575b 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c @@ -76,13 +76,16 @@ struct dp_ctrl_private { struct drm_dp_aux *aux; struct dp_panel *panel; struct dp_link *link; - struct dp_power *power; struct dp_parser *parser; struct dp_catalog *catalog; struct completion idle_comp; struct completion psr_op_comp; struct completion video_comp; + + bool core_clks_on; + bool link_clks_on; + bool stream_clks_on; }; static int dp_aux_link_configure(struct drm_dp_aux *aux, @@ -1338,6 +1341,83 @@ static void dp_ctrl_set_clock_rate(struct dp_ctrl_private *ctrl, name, rate); } +int dp_ctrl_clk_enable(struct dp_ctrl *dp_ctrl, + enum dp_pm_type pm_type, bool enable) +{ + struct dp_ctrl_private *ctrl; + struct dss_module_power *mp; + int ret = 0; + + ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); + + if (pm_type != DP_CORE_PM && + pm_type != DP_CTRL_PM && + pm_type != DP_STREAM_PM) { + DRM_ERROR("unsupported ctrl module: %s\n", + dp_parser_pm_name(pm_type)); + return -EINVAL; + } + + if (enable) { + if (pm_type == DP_CORE_PM && ctrl->core_clks_on) { + drm_dbg_dp(ctrl->drm_dev, + "core clks already enabled\n"); + return 0; + } + + if (pm_type == DP_CTRL_PM && ctrl->link_clks_on) { + drm_dbg_dp(ctrl->drm_dev, + "links clks already enabled\n"); + return 0; + } + + if (pm_type == DP_STREAM_PM && ctrl->stream_clks_on) { + drm_dbg_dp(ctrl->drm_dev, + "pixel clks already enabled\n"); + return 0; + } + + if ((pm_type == DP_CTRL_PM) && (!ctrl->core_clks_on)) { + drm_dbg_dp(ctrl->drm_dev, + "Enable core clks before link clks\n"); + mp = &ctrl->parser->mp[DP_CORE_PM]; + + ret = clk_bulk_prepare_enable(mp->num_clk, mp->clocks); + if (ret) + return ret; + + ctrl->core_clks_on = true; + } + } + + mp = &ctrl->parser->mp[pm_type]; + if (enable) { + ret = clk_bulk_prepare_enable(mp->num_clk, mp->clocks); + if (ret) + return ret; + } else { + clk_bulk_disable_unprepare(mp->num_clk, mp->clocks); + } + + if (pm_type == DP_CORE_PM) + ctrl->core_clks_on = enable; + else if (pm_type == DP_STREAM_PM) + ctrl->stream_clks_on = enable; + else + ctrl->link_clks_on = enable; + + drm_dbg_dp(ctrl->drm_dev, "%s clocks for %s\n", + enable ? "enable" : "disable", + dp_parser_pm_name(pm_type)); + drm_dbg_dp(ctrl->drm_dev, + "stream_clks:%s link_clks:%s core_clks:%s\n", + ctrl->stream_clks_on ? "on" : "off", + ctrl->link_clks_on ? "on" : "off", + ctrl->core_clks_on ? "on" : "off"); + + return 0; +} + static int dp_ctrl_enable_mainlink_clocks(struct dp_ctrl_private *ctrl) { int ret = 0; @@ -1354,7 +1434,7 @@ static int dp_ctrl_enable_mainlink_clocks(struct dp_ctrl_private *ctrl) phy_power_on(phy); dev_pm_opp_set_rate(ctrl->dev, ctrl->link->link_params.rate * 1000); - ret = dp_power_clk_enable(ctrl->power, DP_CTRL_PM, true); + ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_CTRL_PM, true); if (ret) DRM_ERROR("Unable to start link clocks. ret=%d\n", ret); @@ -1502,7 +1582,7 @@ static int dp_ctrl_reinitialize_mainlink(struct dp_ctrl_private *ctrl) * link maintenance. */ dev_pm_opp_set_rate(ctrl->dev, 0); - ret = dp_power_clk_enable(ctrl->power, DP_CTRL_PM, false); + ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_CTRL_PM, false); if (ret) { DRM_ERROR("Failed to disable clocks. ret=%d\n", ret); return ret; @@ -1534,7 +1614,7 @@ static int dp_ctrl_deinitialize_mainlink(struct dp_ctrl_private *ctrl) dp_catalog_ctrl_reset(ctrl->catalog); dev_pm_opp_set_rate(ctrl->dev, 0); - ret = dp_power_clk_enable(ctrl->power, DP_CTRL_PM, false); + ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_CTRL_PM, false); if (ret) { DRM_ERROR("Failed to disable link clocks. ret=%d\n", ret); } @@ -1656,7 +1736,7 @@ static int dp_ctrl_process_phy_test_request(struct dp_ctrl_private *ctrl) pixel_rate = ctrl->panel->dp_mode.drm_mode.clock; dp_ctrl_set_clock_rate(ctrl, DP_STREAM_PM, "stream_pixel", pixel_rate * 1000); - ret = dp_power_clk_enable(ctrl->power, DP_STREAM_PM, true); + ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_STREAM_PM, true); if (ret) { DRM_ERROR("Failed to start pixel clocks. ret=%d\n", ret); return ret; @@ -1752,7 +1832,7 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl) rate = ctrl->panel->link_info.rate; pixel_rate = ctrl->panel->dp_mode.drm_mode.clock; - dp_power_clk_enable(ctrl->power, DP_CORE_PM, true); + dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_CORE_PM, true); if (ctrl->link->sink_request & DP_TEST_LINK_PHY_TEST_PATTERN) { drm_dbg_dp(ctrl->drm_dev, @@ -1885,7 +1965,11 @@ int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train) ctrl->link->link_params.rate, ctrl->link->link_params.num_lanes, pixel_rate); - if (!dp_power_clk_status(ctrl->power, DP_CTRL_PM)) { /* link clk is off */ + drm_dbg_dp(ctrl->drm_dev, + "core_clk_on=%d link_clk_on=%d stream_clk_on=%d\n", + ctrl->core_clks_on, ctrl->link_clks_on, ctrl->stream_clks_on); + + if (!ctrl->link_clks_on) { /* link clk is off */ ret = dp_ctrl_enable_mainlink_clocks(ctrl); if (ret) { DRM_ERROR("Failed to start link clocks. ret=%d\n", ret); @@ -1895,7 +1979,7 @@ int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train) dp_ctrl_set_clock_rate(ctrl, DP_STREAM_PM, "stream_pixel", pixel_rate * 1000); - ret = dp_power_clk_enable(ctrl->power, DP_STREAM_PM, true); + ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_STREAM_PM, true); if (ret) { DRM_ERROR("Unable to start pixel clocks. ret=%d\n", ret); goto end; @@ -1951,8 +2035,8 @@ int dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl) dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, false); - if (dp_power_clk_status(ctrl->power, DP_STREAM_PM)) { - ret = dp_power_clk_enable(ctrl->power, DP_STREAM_PM, false); + if (ctrl->stream_clks_on) { + ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_STREAM_PM, false); if (ret) { DRM_ERROR("Failed to disable pclk. ret=%d\n", ret); return ret; @@ -1960,7 +2044,7 @@ int dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl) } dev_pm_opp_set_rate(ctrl->dev, 0); - ret = dp_power_clk_enable(ctrl->power, DP_CTRL_PM, false); + ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_CTRL_PM, false); if (ret) { DRM_ERROR("Failed to disable link clocks. ret=%d\n", ret); return ret; @@ -1990,7 +2074,7 @@ int dp_ctrl_off_link(struct dp_ctrl *dp_ctrl) dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, false); - ret = dp_power_clk_enable(ctrl->power, DP_CTRL_PM, false); + ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_CTRL_PM, false); if (ret) { DRM_ERROR("Failed to disable link clocks. ret=%d\n", ret); } @@ -2024,12 +2108,12 @@ int dp_ctrl_off(struct dp_ctrl *dp_ctrl) dp_catalog_ctrl_reset(ctrl->catalog); - ret = dp_power_clk_enable(ctrl->power, DP_STREAM_PM, false); + ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_STREAM_PM, false); if (ret) DRM_ERROR("Failed to disable pixel clocks. ret=%d\n", ret); dev_pm_opp_set_rate(ctrl->dev, 0); - ret = dp_power_clk_enable(ctrl->power, DP_CTRL_PM, false); + ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_CTRL_PM, false); if (ret) { DRM_ERROR("Failed to disable link clocks. ret=%d\n", ret); } @@ -2086,9 +2170,38 @@ irqreturn_t dp_ctrl_isr(struct dp_ctrl *dp_ctrl) return ret; } +static int dp_ctrl_clk_init(struct dp_ctrl *dp_ctrl) +{ + struct dp_ctrl_private *ctrl_private; + int rc = 0; + struct dss_module_power *core, *ctrl, *stream; + struct device *dev; + + ctrl_private = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); + dev = ctrl_private->dev; + + core = &ctrl_private->parser->mp[DP_CORE_PM]; + ctrl = &ctrl_private->parser->mp[DP_CTRL_PM]; + stream = &ctrl_private->parser->mp[DP_STREAM_PM]; + + rc = devm_clk_bulk_get(dev, core->num_clk, core->clocks); + if (rc) + return rc; + + rc = devm_clk_bulk_get(dev, ctrl->num_clk, ctrl->clocks); + if (rc) + return -ENODEV; + + rc = devm_clk_bulk_get(dev, stream->num_clk, stream->clocks); + if (rc) + return -ENODEV; + + return 0; +} + struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link, struct dp_panel *panel, struct drm_dp_aux *aux, - struct dp_power *power, struct dp_catalog *catalog, + struct dp_catalog *catalog, struct dp_parser *parser) { struct dp_ctrl_private *ctrl; @@ -2125,11 +2238,16 @@ struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link, /* in parameters */ ctrl->parser = parser; ctrl->panel = panel; - ctrl->power = power; ctrl->aux = aux; ctrl->link = link; ctrl->catalog = catalog; ctrl->dev = dev; + ret = dp_ctrl_clk_init(&ctrl->dp_ctrl); + if (ret) { + dev_err(dev, "failed to init clocks\n"); + return ERR_PTR(ret); + } + return &ctrl->dp_ctrl; } diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.h b/drivers/gpu/drm/msm/dp/dp_ctrl.h index b2c27d3532bf..85da5a7e5307 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.h +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.h @@ -10,7 +10,6 @@ #include "dp_panel.h" #include "dp_link.h" #include "dp_parser.h" -#include "dp_power.h" #include "dp_catalog.h" struct dp_ctrl { @@ -28,7 +27,7 @@ irqreturn_t dp_ctrl_isr(struct dp_ctrl *dp_ctrl); void dp_ctrl_handle_sink_request(struct dp_ctrl *dp_ctrl); struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link, struct dp_panel *panel, struct drm_dp_aux *aux, - struct dp_power *power, struct dp_catalog *catalog, + struct dp_catalog *catalog, struct dp_parser *parser); void dp_ctrl_reset_irq_ctrl(struct dp_ctrl *dp_ctrl, bool enable); @@ -39,4 +38,7 @@ void dp_ctrl_irq_phy_exit(struct dp_ctrl *dp_ctrl); void dp_ctrl_set_psr(struct dp_ctrl *dp_ctrl, bool enable); void dp_ctrl_config_psr(struct dp_ctrl *dp_ctrl); +int dp_ctrl_clk_enable(struct dp_ctrl *ctrl, enum dp_pm_type pm_type, + bool enable); + #endif /* _DP_CTRL_H_ */ diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 8cd18705740f..33e9d7deb3f8 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -15,13 +15,12 @@ #include "msm_drv.h" #include "msm_kms.h" #include "dp_parser.h" -#include "dp_power.h" +#include "dp_ctrl.h" #include "dp_catalog.h" #include "dp_aux.h" #include "dp_reg.h" #include "dp_link.h" #include "dp_panel.h" -#include "dp_ctrl.h" #include "dp_display.h" #include "dp_drm.h" #include "dp_audio.h" @@ -89,7 +88,6 @@ struct dp_display_private { struct dentry *root; struct dp_parser *parser; - struct dp_power *power; struct dp_catalog *catalog; struct drm_dp_aux *aux; struct dp_link *link; @@ -434,7 +432,7 @@ static void dp_display_host_init(struct dp_display_private *dp) dp->dp_display.connector_type, dp->core_initialized, dp->phy_initialized); - dp_power_clk_enable(dp->power, DP_CORE_PM, true); + dp_ctrl_clk_enable(dp->ctrl, DP_CORE_PM, true); dp_ctrl_reset_irq_ctrl(dp->ctrl, true); dp_aux_init(dp->aux); dp->core_initialized = true; @@ -448,7 +446,7 @@ static void dp_display_host_deinit(struct dp_display_private *dp) dp_ctrl_reset_irq_ctrl(dp->ctrl, false); dp_aux_deinit(dp->aux); - dp_power_clk_enable(dp->power, DP_CORE_PM, false); + dp_ctrl_clk_enable(dp->ctrl, DP_CORE_PM, false); dp->core_initialized = false; } @@ -731,14 +729,6 @@ static int dp_init_sub_modules(struct dp_display_private *dp) goto error; } - dp->power = dp_power_get(dev, dp->parser); - if (IS_ERR(dp->power)) { - rc = PTR_ERR(dp->power); - DRM_ERROR("failed to initialize power, rc = %d\n", rc); - dp->power = NULL; - goto error; - } - dp->aux = dp_aux_get(dev, dp->catalog, dp->dp_display.is_edp); if (IS_ERR(dp->aux)) { rc = PTR_ERR(dp->aux); @@ -768,7 +758,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp) } dp->ctrl = dp_ctrl_get(dev, dp->link, dp->panel, dp->aux, - dp->power, dp->catalog, dp->parser); + dp->catalog, dp->parser); if (IS_ERR(dp->ctrl)) { rc = PTR_ERR(dp->ctrl); DRM_ERROR("failed to initialize ctrl, rc = %d\n", rc); @@ -1266,12 +1256,6 @@ static int dp_display_probe(struct platform_device *pdev) return -EPROBE_DEFER; } - rc = dp_power_client_init(dp->power); - if (rc) { - DRM_ERROR("Power client create failed\n"); - goto err; - } - /* setup event q */ mutex_init(&dp->event_mutex); init_waitqueue_head(&dp->event_q); diff --git a/drivers/gpu/drm/msm/dp/dp_power.c b/drivers/gpu/drm/msm/dp/dp_power.c deleted file mode 100644 index f49e3aede308..000000000000 --- a/drivers/gpu/drm/msm/dp/dp_power.c +++ /dev/null @@ -1,170 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. - */ - -#define pr_fmt(fmt) "[drm-dp] %s: " fmt, __func__ - -#include -#include -#include -#include -#include "dp_power.h" -#include "msm_drv.h" - -struct dp_power_private { - struct dp_parser *parser; - struct device *dev; - struct drm_device *drm_dev; - - struct dp_power dp_power; -}; - -static int dp_power_clk_init(struct dp_power_private *power) -{ - int rc = 0; - struct dss_module_power *core, *ctrl, *stream; - struct device *dev = power->dev; - - core = &power->parser->mp[DP_CORE_PM]; - ctrl = &power->parser->mp[DP_CTRL_PM]; - stream = &power->parser->mp[DP_STREAM_PM]; - - rc = devm_clk_bulk_get(dev, core->num_clk, core->clocks); - if (rc) - return rc; - - rc = devm_clk_bulk_get(dev, ctrl->num_clk, ctrl->clocks); - if (rc) - return -ENODEV; - - rc = devm_clk_bulk_get(dev, stream->num_clk, stream->clocks); - if (rc) - return -ENODEV; - - return 0; -} - -int dp_power_clk_status(struct dp_power *dp_power, enum dp_pm_type pm_type) -{ - struct dp_power_private *power; - - power = container_of(dp_power, struct dp_power_private, dp_power); - - drm_dbg_dp(power->drm_dev, - "core_clk_on=%d link_clk_on=%d stream_clk_on=%d\n", - dp_power->core_clks_on, dp_power->link_clks_on, dp_power->stream_clks_on); - - if (pm_type == DP_CORE_PM) - return dp_power->core_clks_on; - - if (pm_type == DP_CTRL_PM) - return dp_power->link_clks_on; - - if (pm_type == DP_STREAM_PM) - return dp_power->stream_clks_on; - - return 0; -} - -int dp_power_clk_enable(struct dp_power *dp_power, - enum dp_pm_type pm_type, bool enable) -{ - int rc = 0; - struct dp_power_private *power; - struct dss_module_power *mp; - - power = container_of(dp_power, struct dp_power_private, dp_power); - - if (pm_type != DP_CORE_PM && pm_type != DP_CTRL_PM && - pm_type != DP_STREAM_PM) { - DRM_ERROR("unsupported power module: %s\n", - dp_parser_pm_name(pm_type)); - return -EINVAL; - } - - if (enable) { - if (pm_type == DP_CORE_PM && dp_power->core_clks_on) { - drm_dbg_dp(power->drm_dev, - "core clks already enabled\n"); - return 0; - } - - if (pm_type == DP_CTRL_PM && dp_power->link_clks_on) { - drm_dbg_dp(power->drm_dev, - "links clks already enabled\n"); - return 0; - } - - if (pm_type == DP_STREAM_PM && dp_power->stream_clks_on) { - drm_dbg_dp(power->drm_dev, - "pixel clks already enabled\n"); - return 0; - } - - if ((pm_type == DP_CTRL_PM) && (!dp_power->core_clks_on)) { - drm_dbg_dp(power->drm_dev, - "Enable core clks before link clks\n"); - mp = &power->parser->mp[DP_CORE_PM]; - - rc = clk_bulk_prepare_enable(mp->num_clk, mp->clocks); - if (rc) - return rc; - - dp_power->core_clks_on = true; - } - } - - mp = &power->parser->mp[pm_type]; - if (enable) { - rc = clk_bulk_prepare_enable(mp->num_clk, mp->clocks); - if (rc) - return rc; - } else { - clk_bulk_disable_unprepare(mp->num_clk, mp->clocks); - } - - if (pm_type == DP_CORE_PM) - dp_power->core_clks_on = enable; - else if (pm_type == DP_STREAM_PM) - dp_power->stream_clks_on = enable; - else - dp_power->link_clks_on = enable; - - drm_dbg_dp(power->drm_dev, "%s clocks for %s\n", - enable ? "enable" : "disable", - dp_parser_pm_name(pm_type)); - drm_dbg_dp(power->drm_dev, - "strem_clks:%s link_clks:%s core_clks:%s\n", - dp_power->stream_clks_on ? "on" : "off", - dp_power->link_clks_on ? "on" : "off", - dp_power->core_clks_on ? "on" : "off"); - - return 0; -} - -int dp_power_client_init(struct dp_power *dp_power) -{ - struct dp_power_private *power; - - power = container_of(dp_power, struct dp_power_private, dp_power); - - return dp_power_clk_init(power); -} - -struct dp_power *dp_power_get(struct device *dev, struct dp_parser *parser) -{ - struct dp_power_private *power; - struct dp_power *dp_power; - - power = devm_kzalloc(dev, sizeof(*power), GFP_KERNEL); - if (!power) - return ERR_PTR(-ENOMEM); - - power->parser = parser; - power->dev = dev; - - dp_power = &power->dp_power; - - return dp_power; -} diff --git a/drivers/gpu/drm/msm/dp/dp_power.h b/drivers/gpu/drm/msm/dp/dp_power.h deleted file mode 100644 index eb836b5aa24a..000000000000 --- a/drivers/gpu/drm/msm/dp/dp_power.h +++ /dev/null @@ -1,74 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. - */ - -#ifndef _DP_POWER_H_ -#define _DP_POWER_H_ - -#include "dp_parser.h" - -/** - * sruct dp_power - DisplayPort's power related data - * - * @init: initializes the regulators/core clocks/GPIOs/pinctrl - * @deinit: turns off the regulators/core clocks/GPIOs/pinctrl - * @clk_enable: enable/disable the DP clocks - * @set_pixel_clk_parent: set the parent of DP pixel clock - */ -struct dp_power { - bool core_clks_on; - bool link_clks_on; - bool stream_clks_on; -}; - -/** - * dp_power_clk_status() - display controller clocks status - * - * @power: instance of power module - * @pm_type: type of pm, core/ctrl/phy - * return: status of power clocks - * - * This API return status of DP clocks - */ - -int dp_power_clk_status(struct dp_power *dp_power, enum dp_pm_type pm_type); - -/** - * dp_power_clk_enable() - enable display controller clocks - * - * @power: instance of power module - * @pm_type: type of pm, core/ctrl/phy - * @enable: enables or disables - * return: pointer to allocated power module data - * - * This API will call setrate and enable for DP clocks - */ - -int dp_power_clk_enable(struct dp_power *power, enum dp_pm_type pm_type, - bool enable); - -/** - * dp_power_client_init() - initialize clock and regulator modules - * - * @power: instance of power module - * return: 0 for success, error for failure. - * - * This API will configure the DisplayPort's clocks and regulator - * modules. - */ -int dp_power_client_init(struct dp_power *power); - -/** - * dp_power_get() - configure and get the DisplayPort power module data - * - * @parser: instance of parser module - * return: pointer to allocated power module data - * - * This API will configure the DisplayPort's power module and provides - * methods to be called by the client to configure the power related - * modules. - */ -struct dp_power *dp_power_get(struct device *dev, struct dp_parser *parser); - -#endif /* _DP_POWER_H_ */ From patchwork Sun Dec 31 00:43:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13507069 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9852CC46CD2 for ; Sun, 31 Dec 2023 00:44:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 960AE10E0D2; Sun, 31 Dec 2023 00:44:04 +0000 (UTC) Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by gabe.freedesktop.org (Postfix) with ESMTPS id D18E410E07B for ; Sun, 31 Dec 2023 00:44:02 +0000 (UTC) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-50e67e37661so8238345e87.0 for ; Sat, 30 Dec 2023 16:44:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703983441; x=1704588241; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=becAfxylwmZejS0VIfTonRkPwt9DcFnsVmjDJA3q3c4=; b=uFVcz47dEYfA0IaZk9bWOuuz6uSMaeqQOn2rKLmqzt9G+SxfY/02TYoi4T8EY8gKTK aqG5XM3UPJHLLwa69vd//dnMuxg8jiUQTXX9qmLJpbtFaOZHifNEaYi6j46/Qc4q84uF RUg/2Ou8FjXS4M0iKR9geQXMPtEfaPcxLjF6bK3v+KFmXSs0zPrx0irF2agMLrylLGGr fft6eaZk576Ke7339rv5FuQ44r7IMa4og7+QAYahe8s+6BJT4O8z5wbZLiRapPKHioY+ Ypa9c+V35ZUleJP6+4i1JXLtCNDNuE76UGbJyJXmrM0/br2q8MrlHuWf6NnFDeKENhrI kUaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703983441; x=1704588241; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=becAfxylwmZejS0VIfTonRkPwt9DcFnsVmjDJA3q3c4=; b=SnHrdZTClsnYdYg+Q7a19ZoIu9B+84nIayKUKDhZuN+qfVnkyXohLzwdt5aXwYVPCV 6YzRwGvLR7jiQrYCdawZJ+lI6QNpfdznlThSqBWxzDVCZuOQMHIlFJ7S1PMmTaFKmwy4 u+LxCyvMLB4oWbL+WMaXZ+zSrIORQfeG6nSxV949dKDrZqKBOBdfTArXZo8uWyV/r5ip Oj0pZaVlbo+WPvj2BeKYqpR0Uf6jq+ufNEL5Jqdp9POWotv1g3Z3Kr1m8PsaeIR0RxiT Bshzk9KERFPmtsyuqt+CU3QrUrra/ZpERWRwRRbf+I5iFgY3un6NjPbDXJxqXz+2WNYw 4XQg== X-Gm-Message-State: AOJu0YyYPe6g8wYnfZA7zyIo37rRwVyJ4WKQHgp8fwNLPYQAWramzC3o VGWAmLcV1686rw0u4boINSKzT6cV2wpquQ== X-Google-Smtp-Source: AGHT+IHuW3QgLgCJA7oefEzIW2fqq27QZ/rINRI3UmdwnBZIHNbNfBENJfiPSH5rpips+d4C8s+tXg== X-Received: by 2002:a05:6512:401d:b0:50e:7d27:f930 with SMTP id br29-20020a056512401d00b0050e7d27f930mr5333958lfb.29.1703983441106; Sat, 30 Dec 2023 16:44:01 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id n13-20020a05651203ed00b0050e84be8127sm1295995lfq.101.2023.12.30.16.44.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 16:44:00 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 31 Dec 2023 02:43:53 +0200 Subject: [PATCH v2 06/15] drm/msm/dp: simplify stream clocks handling MIME-Version: 1.0 Message-Id: <20231231-dp-power-parser-cleanup-v2-6-fc3e902a6f5b@linaro.org> References: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> In-Reply-To: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , Stephen Boyd X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=10486; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=hNPMvZ0gaSY5MPKRR/EBckDQolNgLCvX0skn+OxZNXs=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlkLlKyJwE9kbx2m5jIaXScnlda8Tcu+A1MexiL sMPKNRNOvaJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZZC5SgAKCRCLPIo+Aiko 1aQUB/9HlGuZ1ew9NkmC1q95mi79bxIbjS4y5ZAsgaZru0Aeqh0KAE+7JTC/6a/cBDm2V/mAzLG gdi0Jgl7xJgmFfkGeSaAD7mV/ddkgAcNSAFypdowj0SmbiC+P673Ulc/RKY5aaSzQiAKNj55cK4 OprL4YaH/HnkeaUu2uJLJZKRsVAnZ6qSFBQ41l9qmkgUv9UCvHtwz/NeoGzGB2EhI588V0K/nGQ kAu38pgK1wh6MMQCKTjVxKV+EnFBIseQgfzpJ2pu2oi6AVK0pJZ6xqy80l91PXo8gp6ZU6VsOAE W6DAWZFKgbEvMas757mewE7pu9NvcXirCoJR8tMRFYX9V0IH X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: Konrad Dybcio , linux-arm-msm@vger.kernel.org, Bjorn Andersson , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There is only a single DP_STREAM_PM clock, stream_pixel. Instead of using a separate dss_module_power instance for this single clock, handle this clock directly. This allows us to drop several wrapping functions. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_ctrl.c | 91 ++++++++++++++++---------------------- drivers/gpu/drm/msm/dp/dp_parser.c | 41 ++++------------- drivers/gpu/drm/msm/dp/dp_parser.h | 2 - 3 files changed, 47 insertions(+), 87 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c index da29281c575b..56a424a82a1b 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c @@ -79,6 +79,8 @@ struct dp_ctrl_private { struct dp_parser *parser; struct dp_catalog *catalog; + struct clk *pixel_clk; + struct completion idle_comp; struct completion psr_op_comp; struct completion video_comp; @@ -1320,27 +1322,6 @@ static int dp_ctrl_setup_main_link(struct dp_ctrl_private *ctrl, return ret; } -static void dp_ctrl_set_clock_rate(struct dp_ctrl_private *ctrl, - enum dp_pm_type module, char *name, unsigned long rate) -{ - u32 num = ctrl->parser->mp[module].num_clk; - struct clk_bulk_data *cfg = ctrl->parser->mp[module].clocks; - - while (num && strcmp(cfg->id, name)) { - num--; - cfg++; - } - - drm_dbg_dp(ctrl->drm_dev, "setting rate=%lu on clk=%s\n", - rate, name); - - if (num) - clk_set_rate(cfg->clk, rate); - else - DRM_ERROR("%s clock doesn't exit to set rate %lu\n", - name, rate); -} - int dp_ctrl_clk_enable(struct dp_ctrl *dp_ctrl, enum dp_pm_type pm_type, bool enable) { @@ -1351,8 +1332,7 @@ int dp_ctrl_clk_enable(struct dp_ctrl *dp_ctrl, ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); if (pm_type != DP_CORE_PM && - pm_type != DP_CTRL_PM && - pm_type != DP_STREAM_PM) { + pm_type != DP_CTRL_PM) { DRM_ERROR("unsupported ctrl module: %s\n", dp_parser_pm_name(pm_type)); return -EINVAL; @@ -1371,12 +1351,6 @@ int dp_ctrl_clk_enable(struct dp_ctrl *dp_ctrl, return 0; } - if (pm_type == DP_STREAM_PM && ctrl->stream_clks_on) { - drm_dbg_dp(ctrl->drm_dev, - "pixel clks already enabled\n"); - return 0; - } - if ((pm_type == DP_CTRL_PM) && (!ctrl->core_clks_on)) { drm_dbg_dp(ctrl->drm_dev, "Enable core clks before link clks\n"); @@ -1401,8 +1375,6 @@ int dp_ctrl_clk_enable(struct dp_ctrl *dp_ctrl, if (pm_type == DP_CORE_PM) ctrl->core_clks_on = enable; - else if (pm_type == DP_STREAM_PM) - ctrl->stream_clks_on = enable; else ctrl->link_clks_on = enable; @@ -1734,14 +1706,23 @@ static int dp_ctrl_process_phy_test_request(struct dp_ctrl_private *ctrl) } pixel_rate = ctrl->panel->dp_mode.drm_mode.clock; - dp_ctrl_set_clock_rate(ctrl, DP_STREAM_PM, "stream_pixel", pixel_rate * 1000); - - ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_STREAM_PM, true); + ret = clk_set_rate(ctrl->pixel_clk, pixel_rate * 1000); if (ret) { - DRM_ERROR("Failed to start pixel clocks. ret=%d\n", ret); + DRM_ERROR("Failed to set pixel clock rate. ret=%d\n", ret); return ret; } + if (ctrl->stream_clks_on) { + drm_dbg_dp(ctrl->drm_dev, "pixel clks already enabled\n"); + } else { + ret = clk_prepare_enable(ctrl->pixel_clk); + if (ret) { + DRM_ERROR("Failed to start pixel clocks. ret=%d\n", ret); + return ret; + } + ctrl->stream_clks_on = true; + } + dp_ctrl_send_phy_test_pattern(ctrl); return 0; @@ -1977,14 +1958,23 @@ int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train) } } - dp_ctrl_set_clock_rate(ctrl, DP_STREAM_PM, "stream_pixel", pixel_rate * 1000); - - ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_STREAM_PM, true); + ret = clk_set_rate(ctrl->pixel_clk, pixel_rate * 1000); if (ret) { - DRM_ERROR("Unable to start pixel clocks. ret=%d\n", ret); + DRM_ERROR("Failed to set pixel clock rate. ret=%d\n", ret); goto end; } + if (ctrl->stream_clks_on) { + drm_dbg_dp(ctrl->drm_dev, "pixel clks already enabled\n"); + } else { + ret = clk_prepare_enable(ctrl->pixel_clk); + if (ret) { + DRM_ERROR("Failed to start pixel clocks. ret=%d\n", ret); + goto end; + } + ctrl->stream_clks_on = true; + } + if (force_link_train || !dp_ctrl_channel_eq_ok(ctrl)) dp_ctrl_link_retrain(ctrl); @@ -2036,11 +2026,8 @@ int dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl) dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, false); if (ctrl->stream_clks_on) { - ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_STREAM_PM, false); - if (ret) { - DRM_ERROR("Failed to disable pclk. ret=%d\n", ret); - return ret; - } + clk_disable_unprepare(ctrl->pixel_clk); + ctrl->stream_clks_on = false; } dev_pm_opp_set_rate(ctrl->dev, 0); @@ -2108,9 +2095,10 @@ int dp_ctrl_off(struct dp_ctrl *dp_ctrl) dp_catalog_ctrl_reset(ctrl->catalog); - ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_STREAM_PM, false); - if (ret) - DRM_ERROR("Failed to disable pixel clocks. ret=%d\n", ret); + if (ctrl->stream_clks_on) { + clk_disable_unprepare(ctrl->pixel_clk); + ctrl->stream_clks_on = false; + } dev_pm_opp_set_rate(ctrl->dev, 0); ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_CTRL_PM, false); @@ -2174,7 +2162,7 @@ static int dp_ctrl_clk_init(struct dp_ctrl *dp_ctrl) { struct dp_ctrl_private *ctrl_private; int rc = 0; - struct dss_module_power *core, *ctrl, *stream; + struct dss_module_power *core, *ctrl; struct device *dev; ctrl_private = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); @@ -2182,7 +2170,6 @@ static int dp_ctrl_clk_init(struct dp_ctrl *dp_ctrl) core = &ctrl_private->parser->mp[DP_CORE_PM]; ctrl = &ctrl_private->parser->mp[DP_CTRL_PM]; - stream = &ctrl_private->parser->mp[DP_STREAM_PM]; rc = devm_clk_bulk_get(dev, core->num_clk, core->clocks); if (rc) @@ -2192,9 +2179,9 @@ static int dp_ctrl_clk_init(struct dp_ctrl *dp_ctrl) if (rc) return -ENODEV; - rc = devm_clk_bulk_get(dev, stream->num_clk, stream->clocks); - if (rc) - return -ENODEV; + ctrl_private->pixel_clk = devm_clk_get(dev, "stream_pixel"); + if (IS_ERR(ctrl_private->pixel_clk)) + return PTR_ERR(ctrl_private->pixel_clk); return 0; } diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index 2d9d126c119b..fe2b75f7555a 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -150,12 +150,11 @@ static inline bool dp_parser_check_prefix(const char *clk_prefix, static int dp_parser_init_clk_data(struct dp_parser *parser) { int num_clk, i, rc; - int core_clk_count = 0, ctrl_clk_count = 0, stream_clk_count = 0; + int core_clk_count = 0, ctrl_clk_count = 0; const char *clk_name; struct device *dev = &parser->pdev->dev; struct dss_module_power *core_power = &parser->mp[DP_CORE_PM]; struct dss_module_power *ctrl_power = &parser->mp[DP_CTRL_PM]; - struct dss_module_power *stream_power = &parser->mp[DP_STREAM_PM]; num_clk = of_property_count_strings(dev->of_node, "clock-names"); if (num_clk <= 0) { @@ -174,9 +173,6 @@ static int dp_parser_init_clk_data(struct dp_parser *parser) if (dp_parser_check_prefix("ctrl", clk_name)) ctrl_clk_count++; - - if (dp_parser_check_prefix("stream", clk_name)) - stream_clk_count++; } /* Initialize the CORE power module */ @@ -207,47 +203,30 @@ static int dp_parser_init_clk_data(struct dp_parser *parser) return -ENOMEM; } - /* Initialize the STREAM power module */ - if (stream_clk_count == 0) { - DRM_ERROR("no stream (pixel) clocks are defined\n"); - return -EINVAL; - } - - stream_power->num_clk = stream_clk_count; - stream_power->clocks = devm_kcalloc(dev, - stream_power->num_clk, sizeof(struct clk_bulk_data), - GFP_KERNEL); - if (!stream_power->clocks) { - stream_power->num_clk = 0; - return -ENOMEM; - } - - return 0; + return num_clk; } static int dp_parser_clock(struct dp_parser *parser) { int rc = 0, i = 0; int num_clk = 0; - int core_clk_index = 0, ctrl_clk_index = 0, stream_clk_index = 0; - int core_clk_count = 0, ctrl_clk_count = 0, stream_clk_count = 0; + int core_clk_index = 0, ctrl_clk_index = 0; + int core_clk_count = 0, ctrl_clk_count = 0; const char *clk_name; struct device *dev = &parser->pdev->dev; struct dss_module_power *core_power = &parser->mp[DP_CORE_PM]; struct dss_module_power *ctrl_power = &parser->mp[DP_CTRL_PM]; - struct dss_module_power *stream_power = &parser->mp[DP_STREAM_PM]; rc = dp_parser_init_clk_data(parser); - if (rc) { + if (rc < 0) { DRM_ERROR("failed to initialize power data %d\n", rc); - return -EINVAL; + return rc; } + num_clk = rc; + core_clk_count = core_power->num_clk; ctrl_clk_count = ctrl_power->num_clk; - stream_clk_count = stream_power->num_clk; - - num_clk = core_clk_count + ctrl_clk_count + stream_clk_count; for (i = 0; i < num_clk; i++) { rc = of_property_read_string_index(dev->of_node, "clock-names", @@ -260,10 +239,6 @@ static int dp_parser_clock(struct dp_parser *parser) core_clk_index < core_clk_count) { core_power->clocks[core_clk_index].id = devm_kstrdup(dev, clk_name, GFP_KERNEL); core_clk_index++; - } else if (dp_parser_check_prefix("stream", clk_name) && - stream_clk_index < stream_clk_count) { - stream_power->clocks[stream_clk_index].id = devm_kstrdup(dev, clk_name, GFP_KERNEL); - stream_clk_index++; } else if (dp_parser_check_prefix("ctrl", clk_name) && ctrl_clk_index < ctrl_clk_count) { ctrl_power->clocks[ctrl_clk_index].id = devm_kstrdup(dev, clk_name, GFP_KERNEL); diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h index 4ccc432b4142..c6fe26602e07 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ b/drivers/gpu/drm/msm/dp/dp_parser.h @@ -19,7 +19,6 @@ enum dp_pm_type { DP_CORE_PM, DP_CTRL_PM, - DP_STREAM_PM, DP_MAX_PM }; @@ -40,7 +39,6 @@ static inline const char *dp_parser_pm_name(enum dp_pm_type module) switch (module) { case DP_CORE_PM: return "DP_CORE_PM"; case DP_CTRL_PM: return "DP_CTRL_PM"; - case DP_STREAM_PM: return "DP_STREAM_PM"; default: return "???"; } } From patchwork Sun Dec 31 00:43:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13507075 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 562E4C46CD2 for ; Sun, 31 Dec 2023 00:44:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 07AB910E0FD; Sun, 31 Dec 2023 00:44:12 +0000 (UTC) Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by gabe.freedesktop.org (Postfix) with ESMTPS id DE54510E0D8 for ; Sun, 31 Dec 2023 00:44:03 +0000 (UTC) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2ccc7d7e399so47862461fa.0 for ; Sat, 30 Dec 2023 16:44:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703983442; x=1704588242; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=LV6p00KhO1LDwvwQC4F9WJVNdeFMCAAEui1qxHdo5Cw=; b=YvKyHM9Iw/dP7oDKyw7Df2R/Ud5xApsVt8hIaHrIcpOvUqcGtsrBBTWGB7OUpml/RE UgPwRBzujwXRtuIu3NuNpPO2CgsF1fJTgNpcIT1tOXIyuvOPivqOsJ4UthjD7GCMz+8x Lji9nwydMmK744bDIuZ70uc1HVkOSjP8a5nFNwbDk2mUONE/Vq+4g1U2BaglQlBY2GYE JxW5ZBOxVgf+O2a+DnjjzlFecRB0M5MiD5iTmSUt2cPWVHphtJbm3VDzgcLIZt4cIp9U D8GZaKYAu6ZN08KsiaplADucltSsYQwZwb9M2XHoaEE/ne9mvYZdhRTSGgDy3oUWay5v 1Qfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703983442; x=1704588242; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LV6p00KhO1LDwvwQC4F9WJVNdeFMCAAEui1qxHdo5Cw=; b=N6nK1rZHil9k9abGnS7r+PEMM/D+IIHoMQgqOcwkfzBuL/Qio+nqf0E3ba+l9GZkKT JlVVGTp0R/0wptk/0le21wUWwzv+7K7qswOCtp/XcQUfJD3gfbbd4PYGCnPWQPBQ4zc7 68o/iGCPV9hv6t/06cqT8PUi6xRhlPiGGKQ2oN23ZnPgAxUGNHn9lr/u0XkRrYTHw62y +J6ipt9S/DiLZ0XEVV0hBdI+uoPIYCPhOj+AUwqz9e6omCPvVPtKScL006bPZGeKVUle PJZA0awOAOyGzXObXV7+NFWAOL0rqPZg9O3cy67uJHVFzFKAdi+yDvKI5zUDpRjL3TTp +Z+g== X-Gm-Message-State: AOJu0YyizcnbSEHduwcXBVtI29WDTsCS+VcZLT+emX3XkO4Lh9O1ojql Ir9hBSrisIY7ow8cPqpreQi8m7mzDi/Zug== X-Google-Smtp-Source: AGHT+IHjhxHpi8na5LQNUWWkyfUpqtkvJ0aWCQui/Ruz0j9InZ1UUmL8rI/WWN6bixt49R4mxIYHKQ== X-Received: by 2002:a05:6512:201a:b0:50e:7b5e:b64b with SMTP id a26-20020a056512201a00b0050e7b5eb64bmr3177558lfb.49.1703983442163; Sat, 30 Dec 2023 16:44:02 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id n13-20020a05651203ed00b0050e84be8127sm1295995lfq.101.2023.12.30.16.44.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 16:44:01 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 31 Dec 2023 02:43:54 +0200 Subject: [PATCH v2 07/15] drm/msm/dp: stop parsing clock names from DT MIME-Version: 1.0 Message-Id: <20231231-dp-power-parser-cleanup-v2-7-fc3e902a6f5b@linaro.org> References: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> In-Reply-To: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , Stephen Boyd X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=10440; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=jlCbwCtXmASgMzTIlxwNTO3EoGrFovMlywq9Nb9Ul3Y=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlkLlKuagVnMFZ+Evay3GENhbTJx3ItS0d/VlwT g8v0m4RPnmJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZZC5SgAKCRCLPIo+Aiko 1R2wB/4rvRbGn+fpsULl0PZGNxZVrchMDAQyPGPGtAHy4Q/BcpEwMUJLvtagykdSRrIZ7Yephbj uTWZPwI9dqihub0ntIsf8oaC+1v7oFqj94xwcaLrNlzkf+6B7pRbg1SXrDxVEYajrXSRqAFTnAl 8qWHbV9qtK/8WoA6GGRUOa/U3+GP6qXZ4OJM281Ks4PFavjwnh3n5uzhTf1TZpNskQg4Zxje1df CdR4fDkmL71w+5XhLKQ5m9gDH79nX3/OTMLjNqxZPe7hsozHYIQ+2yhMXfA3RtJl7eGr4GNUnH1 wC5QAr4X7VWFy3rUHXb3vlbZmGQM12Lclj6oZzVvnJTxTRkQ X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: Konrad Dybcio , linux-arm-msm@vger.kernel.org, Bjorn Andersson , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" All supported platforms use the same clocks configuration. Instead of parsing names from DT in a pretty complex manner, use the static configuration. If at some point newer (or older) platforms have different clock configuration, this clock config can be moved to the device data. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_ctrl.c | 73 ++++++++++++++++++------ drivers/gpu/drm/msm/dp/dp_ctrl.h | 6 ++ drivers/gpu/drm/msm/dp/dp_parser.c | 112 ------------------------------------- drivers/gpu/drm/msm/dp/dp_parser.h | 22 -------- 4 files changed, 63 insertions(+), 150 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c index 56a424a82a1b..cfcf6136ffa6 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c @@ -69,6 +69,11 @@ struct dp_vc_tu_mapping_table { u8 tu_size_minus1; }; +struct dss_module_power { + unsigned int num_clk; + struct clk_bulk_data *clocks; +}; + struct dp_ctrl_private { struct dp_ctrl dp_ctrl; struct drm_device *drm_dev; @@ -79,6 +84,7 @@ struct dp_ctrl_private { struct dp_parser *parser; struct dp_catalog *catalog; + struct dss_module_power mp[DP_MAX_PM]; struct clk *pixel_clk; struct completion idle_comp; @@ -90,6 +96,15 @@ struct dp_ctrl_private { bool stream_clks_on; }; +static inline const char *dp_pm_name(enum dp_pm_type module) +{ + switch (module) { + case DP_CORE_PM: return "DP_CORE_PM"; + case DP_CTRL_PM: return "DP_CTRL_PM"; + default: return "???"; + } +} + static int dp_aux_link_configure(struct drm_dp_aux *aux, struct dp_link_info *link) { @@ -1334,7 +1349,7 @@ int dp_ctrl_clk_enable(struct dp_ctrl *dp_ctrl, if (pm_type != DP_CORE_PM && pm_type != DP_CTRL_PM) { DRM_ERROR("unsupported ctrl module: %s\n", - dp_parser_pm_name(pm_type)); + dp_pm_name(pm_type)); return -EINVAL; } @@ -1354,7 +1369,7 @@ int dp_ctrl_clk_enable(struct dp_ctrl *dp_ctrl, if ((pm_type == DP_CTRL_PM) && (!ctrl->core_clks_on)) { drm_dbg_dp(ctrl->drm_dev, "Enable core clks before link clks\n"); - mp = &ctrl->parser->mp[DP_CORE_PM]; + mp = &ctrl->mp[DP_CORE_PM]; ret = clk_bulk_prepare_enable(mp->num_clk, mp->clocks); if (ret) @@ -1364,7 +1379,7 @@ int dp_ctrl_clk_enable(struct dp_ctrl *dp_ctrl, } } - mp = &ctrl->parser->mp[pm_type]; + mp = &ctrl->mp[pm_type]; if (enable) { ret = clk_bulk_prepare_enable(mp->num_clk, mp->clocks); if (ret) @@ -1380,7 +1395,7 @@ int dp_ctrl_clk_enable(struct dp_ctrl *dp_ctrl, drm_dbg_dp(ctrl->drm_dev, "%s clocks for %s\n", enable ? "enable" : "disable", - dp_parser_pm_name(pm_type)); + dp_pm_name(pm_type)); drm_dbg_dp(ctrl->drm_dev, "stream_clks:%s link_clks:%s core_clks:%s\n", ctrl->stream_clks_on ? "on" : "off", @@ -2158,30 +2173,56 @@ irqreturn_t dp_ctrl_isr(struct dp_ctrl *dp_ctrl) return ret; } +static const char *core_clks[] = { + "core_iface", + "core_aux", +}; + +static const char *ctrl_clks[] = { + "ctrl_link", + "ctrl_link_iface", +}; + static int dp_ctrl_clk_init(struct dp_ctrl *dp_ctrl) { - struct dp_ctrl_private *ctrl_private; - int rc = 0; - struct dss_module_power *core, *ctrl; + struct dp_ctrl_private *ctrl; + struct dss_module_power *core, *link; struct device *dev; + int i, rc; + + ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); + dev = ctrl->dev; - ctrl_private = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); - dev = ctrl_private->dev; + core = &ctrl->mp[DP_CORE_PM]; + link = &ctrl->mp[DP_CTRL_PM]; - core = &ctrl_private->parser->mp[DP_CORE_PM]; - ctrl = &ctrl_private->parser->mp[DP_CTRL_PM]; + core->num_clk = ARRAY_SIZE(core_clks); + core->clocks = devm_kcalloc(dev, core->num_clk, sizeof(*core->clocks), GFP_KERNEL); + if (!core->clocks) + return -ENOMEM; + + for (i = 0; i < core->num_clk; i++) + core->clocks[i].id = core_clks[i]; rc = devm_clk_bulk_get(dev, core->num_clk, core->clocks); if (rc) return rc; - rc = devm_clk_bulk_get(dev, ctrl->num_clk, ctrl->clocks); + link->num_clk = ARRAY_SIZE(ctrl_clks); + link->clocks = devm_kcalloc(dev, link->num_clk, sizeof(*link->clocks), GFP_KERNEL); + if (!link->clocks) + return -ENOMEM; + + for (i = 0; i < link->num_clk; i++) + link->clocks[i].id = ctrl_clks[i]; + + rc = devm_clk_bulk_get(dev, link->num_clk, link->clocks); if (rc) - return -ENODEV; + return rc; - ctrl_private->pixel_clk = devm_clk_get(dev, "stream_pixel"); - if (IS_ERR(ctrl_private->pixel_clk)) - return PTR_ERR(ctrl_private->pixel_clk); + ctrl->pixel_clk = devm_clk_get(dev, "stream_pixel"); + if (IS_ERR(ctrl->pixel_clk)) + return PTR_ERR(ctrl->pixel_clk); return 0; } diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.h b/drivers/gpu/drm/msm/dp/dp_ctrl.h index 85da5a7e5307..d8007a9d8260 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.h +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.h @@ -17,6 +17,12 @@ struct dp_ctrl { bool wide_bus_en; }; +enum dp_pm_type { + DP_CORE_PM, + DP_CTRL_PM, + DP_MAX_PM +}; + int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl); int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train); int dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl); diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index fe2b75f7555a..de7cfc340f0c 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -141,114 +141,6 @@ static int dp_parser_misc(struct dp_parser *parser) return 0; } -static inline bool dp_parser_check_prefix(const char *clk_prefix, - const char *clk_name) -{ - return !strncmp(clk_prefix, clk_name, strlen(clk_prefix)); -} - -static int dp_parser_init_clk_data(struct dp_parser *parser) -{ - int num_clk, i, rc; - int core_clk_count = 0, ctrl_clk_count = 0; - const char *clk_name; - struct device *dev = &parser->pdev->dev; - struct dss_module_power *core_power = &parser->mp[DP_CORE_PM]; - struct dss_module_power *ctrl_power = &parser->mp[DP_CTRL_PM]; - - num_clk = of_property_count_strings(dev->of_node, "clock-names"); - if (num_clk <= 0) { - DRM_ERROR("no clocks are defined\n"); - return -EINVAL; - } - - for (i = 0; i < num_clk; i++) { - rc = of_property_read_string_index(dev->of_node, - "clock-names", i, &clk_name); - if (rc < 0) - return rc; - - if (dp_parser_check_prefix("core", clk_name)) - core_clk_count++; - - if (dp_parser_check_prefix("ctrl", clk_name)) - ctrl_clk_count++; - } - - /* Initialize the CORE power module */ - if (core_clk_count == 0) { - DRM_ERROR("no core clocks are defined\n"); - return -EINVAL; - } - - core_power->num_clk = core_clk_count; - core_power->clocks = devm_kcalloc(dev, - core_power->num_clk, sizeof(struct clk_bulk_data), - GFP_KERNEL); - if (!core_power->clocks) - return -ENOMEM; - - /* Initialize the CTRL power module */ - if (ctrl_clk_count == 0) { - DRM_ERROR("no ctrl clocks are defined\n"); - return -EINVAL; - } - - ctrl_power->num_clk = ctrl_clk_count; - ctrl_power->clocks = devm_kcalloc(dev, - ctrl_power->num_clk, sizeof(struct clk_bulk_data), - GFP_KERNEL); - if (!ctrl_power->clocks) { - ctrl_power->num_clk = 0; - return -ENOMEM; - } - - return num_clk; -} - -static int dp_parser_clock(struct dp_parser *parser) -{ - int rc = 0, i = 0; - int num_clk = 0; - int core_clk_index = 0, ctrl_clk_index = 0; - int core_clk_count = 0, ctrl_clk_count = 0; - const char *clk_name; - struct device *dev = &parser->pdev->dev; - struct dss_module_power *core_power = &parser->mp[DP_CORE_PM]; - struct dss_module_power *ctrl_power = &parser->mp[DP_CTRL_PM]; - - rc = dp_parser_init_clk_data(parser); - if (rc < 0) { - DRM_ERROR("failed to initialize power data %d\n", rc); - return rc; - } - - num_clk = rc; - - core_clk_count = core_power->num_clk; - ctrl_clk_count = ctrl_power->num_clk; - - for (i = 0; i < num_clk; i++) { - rc = of_property_read_string_index(dev->of_node, "clock-names", - i, &clk_name); - if (rc) { - DRM_ERROR("error reading clock-names %d\n", rc); - return rc; - } - if (dp_parser_check_prefix("core", clk_name) && - core_clk_index < core_clk_count) { - core_power->clocks[core_clk_index].id = devm_kstrdup(dev, clk_name, GFP_KERNEL); - core_clk_index++; - } else if (dp_parser_check_prefix("ctrl", clk_name) && - ctrl_clk_index < ctrl_clk_count) { - ctrl_power->clocks[ctrl_clk_index].id = devm_kstrdup(dev, clk_name, GFP_KERNEL); - ctrl_clk_index++; - } - } - - return 0; -} - int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser) { struct platform_device *pdev = parser->pdev; @@ -280,10 +172,6 @@ static int dp_parser_parse(struct dp_parser *parser) if (rc) return rc; - rc = dp_parser_clock(parser); - if (rc) - return rc; - return 0; } diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h index c6fe26602e07..cad82c4d07da 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ b/drivers/gpu/drm/msm/dp/dp_parser.h @@ -16,12 +16,6 @@ #define DP_MAX_NUM_DP_LANES 4 #define DP_LINK_RATE_HBR2 540000 /* kbytes */ -enum dp_pm_type { - DP_CORE_PM, - DP_CTRL_PM, - DP_MAX_PM -}; - struct dss_io_region { size_t len; void __iomem *base; @@ -34,15 +28,6 @@ struct dss_io_data { struct dss_io_region p0; }; -static inline const char *dp_parser_pm_name(enum dp_pm_type module) -{ - switch (module) { - case DP_CORE_PM: return "DP_CORE_PM"; - case DP_CTRL_PM: return "DP_CTRL_PM"; - default: return "???"; - } -} - /** * struct dp_ctrl_resource - controller's IO related data * @@ -55,20 +40,13 @@ struct dp_io { union phy_configure_opts phy_opts; }; -struct dss_module_power { - unsigned int num_clk; - struct clk_bulk_data *clocks; -}; - /** * struct dp_parser - DP parser's data exposed to clients * * @pdev: platform data of the client - * @mp: gpio, regulator and clock related data */ struct dp_parser { struct platform_device *pdev; - struct dss_module_power mp[DP_MAX_PM]; struct dp_io io; u32 max_dp_lanes; u32 max_dp_link_rate; From patchwork Sun Dec 31 00:43:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13507076 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9466CC47073 for ; Sun, 31 Dec 2023 00:44:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6F7C010E106; Sun, 31 Dec 2023 00:44:12 +0000 (UTC) Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by gabe.freedesktop.org (Postfix) with ESMTPS id B5E3110E0E6 for ; Sun, 31 Dec 2023 00:44:04 +0000 (UTC) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-50e68e93be1so7003082e87.0 for ; Sat, 30 Dec 2023 16:44:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703983443; x=1704588243; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=FDjngIAgyaNOEXPfDUMIuujOfmjvFlpOeLVhFSGQ3io=; b=Mg4e6+EwPJGVpvFALa+scZj1iI9bONnjdycjyNSn0JFapnSac+16SwyutsJZXxPKjh Y5/vI990+ZYNcdEc31tSawvo0Oo+VvmkCkd0EgHRhT+ClaA9xV0bUDA7jNgNO5cA6KHm nUrcPkzX+US4vUeiPa1H9tgztqjiuSracbaHZ/iw4TLLXIoXEkCn6EKoKKKL5frSSNc/ qfPvlFYSgDLlVTSt43zM2fVA0B6+H3sUNs71fKPUbE8C/jyu1ISdgru6DXHpnoK3yhrZ g7aRNx1muc91rovDRpYWR1LYEWs47MoDH/ujKyEdYETLiFHPPAvGevNtBddT7w+WEn00 bLdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703983443; x=1704588243; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FDjngIAgyaNOEXPfDUMIuujOfmjvFlpOeLVhFSGQ3io=; b=GePjhilh1mw0j6S6E7HMTcR1LHrTAZvQNWaAhJ2O+KcHKlplo5HwbikX5rxkpRYGEJ TQIrbwnlLl4zcHP8CKaT71Cc4VWY/SKZuXeAtYSu4eUZ8ut66iPzsJFxsUr2wcTH0+VR GEEihEfTxjkH/hbOTj1wWADsTwBpnfykK3cbdyXLUPWam/pW3y+pH2PhlVZ4XB/F5kHu NJEF0/P7JkWpSEUaPtn52HeUePFLX1HG3BmRFGwls4m5u+VETmfgiIBVxoW7ly8arSWK CFkWskNJjWrgQrQbJAxxhBineYSHksb6uOSo1Ds3LgPnbddgafZfkIQFconKi48hZpRC 2tpg== X-Gm-Message-State: AOJu0YxJVPXQcm1wJBwPoYhem+z/yHJ1lHGV4x6EKaqU2CJbumc3jok9 q0JtZ9HFtC/9eRw8B9ybNizU6UhPR5RJkg== X-Google-Smtp-Source: AGHT+IG2Dmq005vFZQacVNihz3kjkXTIw6fEUE/vqK2TYzyt+fFrP8NiaBuS7lsgmWOsdDAjbmD8bg== X-Received: by 2002:a05:6512:1109:b0:50e:76ca:8d28 with SMTP id l9-20020a056512110900b0050e76ca8d28mr4825016lfg.34.1703983442962; Sat, 30 Dec 2023 16:44:02 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id n13-20020a05651203ed00b0050e84be8127sm1295995lfq.101.2023.12.30.16.44.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 16:44:02 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 31 Dec 2023 02:43:55 +0200 Subject: [PATCH v2 08/15] drm/msm/dp: split dp_ctrl_clk_enable into four functuions MIME-Version: 1.0 Message-Id: <20231231-dp-power-parser-cleanup-v2-8-fc3e902a6f5b@linaro.org> References: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> In-Reply-To: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , Stephen Boyd X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=15067; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=CuOUcUYoOW9aEzG7k566U8KJoISzql09wErRpuOUKaE=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlkLlKDWR08VDjNPqcsHj2WrSBgWkR+IXxUx674 BPw4rD6KeqJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZZC5SgAKCRCLPIo+Aiko 1dZpB/9dat5uBA0Spg0tVDJXyxWClaBN5J/ZM4mOIB5qnh+pmRjmX6tleUSYQcoeqCACFP2eq09 ikE3xEo3QIs7mk2UpgOwdtlx15x/8nEHvhOpLWkYTYgV4mKJfGnXqLIEIn3V6BoZK4OvZuAxn12 eK9ihmVb1k/2ZEAtPmmueRqSRYzSyevG+KbokiXyfCBJELNJZFwBRbNbN4F6f0YoXf65nKknG+H +XD/6NQYCs73KYLHyaPmiqQW962RvY/75xQs7lgmS+VqKO9Zt5sjXSZJZDsI9WbBAKge6Bcl3YQ OlndYqbUTvz/z0T3KElzOxImaQVjWhRKVRZaufolgIJzRR8L X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: Konrad Dybcio , linux-arm-msm@vger.kernel.org, Bjorn Andersson , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Split the dp_ctrl_clk_enable() beast into four functions, each of them doing just a single item: enabling or disabling core or link clocks. This allows us to cleanup the dss_module_power structure and makes several dp_ctrl functions return void. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_ctrl.c | 220 +++++++++++++++++------------------- drivers/gpu/drm/msm/dp/dp_ctrl.h | 16 +-- drivers/gpu/drm/msm/dp/dp_display.c | 4 +- 3 files changed, 108 insertions(+), 132 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c index cfcf6136ffa6..e367eb8e5bea 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c @@ -69,11 +69,6 @@ struct dp_vc_tu_mapping_table { u8 tu_size_minus1; }; -struct dss_module_power { - unsigned int num_clk; - struct clk_bulk_data *clocks; -}; - struct dp_ctrl_private { struct dp_ctrl dp_ctrl; struct drm_device *drm_dev; @@ -84,7 +79,12 @@ struct dp_ctrl_private { struct dp_parser *parser; struct dp_catalog *catalog; - struct dss_module_power mp[DP_MAX_PM]; + unsigned int num_core_clks; + struct clk_bulk_data *core_clks; + + unsigned int num_link_clks; + struct clk_bulk_data *link_clks; + struct clk *pixel_clk; struct completion idle_comp; @@ -96,15 +96,6 @@ struct dp_ctrl_private { bool stream_clks_on; }; -static inline const char *dp_pm_name(enum dp_pm_type module) -{ - switch (module) { - case DP_CORE_PM: return "DP_CORE_PM"; - case DP_CTRL_PM: return "DP_CTRL_PM"; - default: return "???"; - } -} - static int dp_aux_link_configure(struct drm_dp_aux *aux, struct dp_link_info *link) { @@ -1337,67 +1328,76 @@ static int dp_ctrl_setup_main_link(struct dp_ctrl_private *ctrl, return ret; } -int dp_ctrl_clk_enable(struct dp_ctrl *dp_ctrl, - enum dp_pm_type pm_type, bool enable) +int dp_ctrl_core_clk_enable(struct dp_ctrl *dp_ctrl) { struct dp_ctrl_private *ctrl; - struct dss_module_power *mp; int ret = 0; ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); - if (pm_type != DP_CORE_PM && - pm_type != DP_CTRL_PM) { - DRM_ERROR("unsupported ctrl module: %s\n", - dp_pm_name(pm_type)); - return -EINVAL; + if (ctrl->core_clks_on) { + drm_dbg_dp(ctrl->drm_dev, "core clks already enabled\n"); + return 0; } - if (enable) { - if (pm_type == DP_CORE_PM && ctrl->core_clks_on) { - drm_dbg_dp(ctrl->drm_dev, - "core clks already enabled\n"); - return 0; - } + ret = clk_bulk_prepare_enable(ctrl->num_core_clks, ctrl->core_clks); + if (ret) + return ret; - if (pm_type == DP_CTRL_PM && ctrl->link_clks_on) { - drm_dbg_dp(ctrl->drm_dev, - "links clks already enabled\n"); - return 0; - } + ctrl->core_clks_on = true; - if ((pm_type == DP_CTRL_PM) && (!ctrl->core_clks_on)) { - drm_dbg_dp(ctrl->drm_dev, - "Enable core clks before link clks\n"); - mp = &ctrl->mp[DP_CORE_PM]; + drm_dbg_dp(ctrl->drm_dev, "enable core clocks \n"); + drm_dbg_dp(ctrl->drm_dev, "stream_clks:%s link_clks:%s core_clks:%s\n", + ctrl->stream_clks_on ? "on" : "off", + ctrl->link_clks_on ? "on" : "off", + ctrl->core_clks_on ? "on" : "off"); - ret = clk_bulk_prepare_enable(mp->num_clk, mp->clocks); - if (ret) - return ret; + return 0; +} - ctrl->core_clks_on = true; - } +void dp_ctrl_core_clk_disable(struct dp_ctrl *dp_ctrl) +{ + struct dp_ctrl_private *ctrl; + + ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); + + clk_bulk_disable_unprepare(ctrl->num_core_clks, ctrl->core_clks); + + ctrl->core_clks_on = false; + + drm_dbg_dp(ctrl->drm_dev, "disable core clocks \n"); + drm_dbg_dp(ctrl->drm_dev, "stream_clks:%s link_clks:%s core_clks:%s\n", + ctrl->stream_clks_on ? "on" : "off", + ctrl->link_clks_on ? "on" : "off", + ctrl->core_clks_on ? "on" : "off"); +} + +static int dp_ctrl_link_clk_enable(struct dp_ctrl *dp_ctrl) +{ + struct dp_ctrl_private *ctrl; + int ret = 0; + + ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); + + if (ctrl->link_clks_on) { + drm_dbg_dp(ctrl->drm_dev, "links clks already enabled\n"); + return 0; } - mp = &ctrl->mp[pm_type]; - if (enable) { - ret = clk_bulk_prepare_enable(mp->num_clk, mp->clocks); - if (ret) - return ret; - } else { - clk_bulk_disable_unprepare(mp->num_clk, mp->clocks); + if (!ctrl->core_clks_on) { + drm_dbg_dp(ctrl->drm_dev, "Enable core clks before link clks\n"); + + dp_ctrl_core_clk_enable(dp_ctrl); } - if (pm_type == DP_CORE_PM) - ctrl->core_clks_on = enable; - else - ctrl->link_clks_on = enable; + ret = clk_bulk_prepare_enable(ctrl->num_link_clks, ctrl->link_clks); + if (ret) + return ret; - drm_dbg_dp(ctrl->drm_dev, "%s clocks for %s\n", - enable ? "enable" : "disable", - dp_pm_name(pm_type)); - drm_dbg_dp(ctrl->drm_dev, - "stream_clks:%s link_clks:%s core_clks:%s\n", + ctrl->link_clks_on = true; + + drm_dbg_dp(ctrl->drm_dev, "enale link clocks\n"); + drm_dbg_dp(ctrl->drm_dev, "stream_clks:%s link_clks:%s core_clks:%s\n", ctrl->stream_clks_on ? "on" : "off", ctrl->link_clks_on ? "on" : "off", ctrl->core_clks_on ? "on" : "off"); @@ -1405,6 +1405,23 @@ int dp_ctrl_clk_enable(struct dp_ctrl *dp_ctrl, return 0; } +static void dp_ctrl_link_clk_disable(struct dp_ctrl *dp_ctrl) +{ + struct dp_ctrl_private *ctrl; + + ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); + + clk_bulk_disable_unprepare(ctrl->num_link_clks, ctrl->link_clks); + + ctrl->link_clks_on = false; + + drm_dbg_dp(ctrl->drm_dev, "disabled link clocks\n"); + drm_dbg_dp(ctrl->drm_dev, "stream_clks:%s link_clks:%s core_clks:%s\n", + ctrl->stream_clks_on ? "on" : "off", + ctrl->link_clks_on ? "on" : "off", + ctrl->core_clks_on ? "on" : "off"); +} + static int dp_ctrl_enable_mainlink_clocks(struct dp_ctrl_private *ctrl) { int ret = 0; @@ -1421,7 +1438,7 @@ static int dp_ctrl_enable_mainlink_clocks(struct dp_ctrl_private *ctrl) phy_power_on(phy); dev_pm_opp_set_rate(ctrl->dev, ctrl->link->link_params.rate * 1000); - ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_CTRL_PM, true); + ret = dp_ctrl_link_clk_enable(&ctrl->dp_ctrl); if (ret) DRM_ERROR("Unable to start link clocks. ret=%d\n", ret); @@ -1569,11 +1586,9 @@ static int dp_ctrl_reinitialize_mainlink(struct dp_ctrl_private *ctrl) * link maintenance. */ dev_pm_opp_set_rate(ctrl->dev, 0); - ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_CTRL_PM, false); - if (ret) { - DRM_ERROR("Failed to disable clocks. ret=%d\n", ret); - return ret; - } + + dp_ctrl_link_clk_disable(&ctrl->dp_ctrl); + phy_power_off(phy); /* hw recommended delay before re-enabling clocks */ msleep(20); @@ -1591,7 +1606,6 @@ static int dp_ctrl_deinitialize_mainlink(struct dp_ctrl_private *ctrl) { struct dp_io *dp_io; struct phy *phy; - int ret; dp_io = &ctrl->parser->io; phy = dp_io->phy; @@ -1601,10 +1615,7 @@ static int dp_ctrl_deinitialize_mainlink(struct dp_ctrl_private *ctrl) dp_catalog_ctrl_reset(ctrl->catalog); dev_pm_opp_set_rate(ctrl->dev, 0); - ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_CTRL_PM, false); - if (ret) { - DRM_ERROR("Failed to disable link clocks. ret=%d\n", ret); - } + dp_ctrl_link_clk_disable(&ctrl->dp_ctrl); phy_power_off(phy); @@ -1708,11 +1719,7 @@ static int dp_ctrl_process_phy_test_request(struct dp_ctrl_private *ctrl) * running. Add the global reset just before disabling the * link clocks and core clocks. */ - ret = dp_ctrl_off(&ctrl->dp_ctrl); - if (ret) { - DRM_ERROR("failed to disable DP controller\n"); - return ret; - } + dp_ctrl_off(&ctrl->dp_ctrl); ret = dp_ctrl_on_link(&ctrl->dp_ctrl); if (ret) { @@ -1828,7 +1835,7 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl) rate = ctrl->panel->link_info.rate; pixel_rate = ctrl->panel->dp_mode.drm_mode.clock; - dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_CORE_PM, true); + dp_ctrl_core_clk_enable(&ctrl->dp_ctrl); if (ctrl->link->sink_request & DP_TEST_LINK_PHY_TEST_PATTERN) { drm_dbg_dp(ctrl->drm_dev, @@ -2024,12 +2031,11 @@ int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train) return ret; } -int dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl) +void dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl) { struct dp_ctrl_private *ctrl; struct dp_io *dp_io; struct phy *phy; - int ret; ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); dp_io = &ctrl->parser->io; @@ -2046,11 +2052,7 @@ int dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl) } dev_pm_opp_set_rate(ctrl->dev, 0); - ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_CTRL_PM, false); - if (ret) { - DRM_ERROR("Failed to disable link clocks. ret=%d\n", ret); - return ret; - } + dp_ctrl_link_clk_disable(&ctrl->dp_ctrl); phy_power_off(phy); @@ -2060,15 +2062,13 @@ int dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl) drm_dbg_dp(ctrl->drm_dev, "phy=%p init=%d power_on=%d\n", phy, phy->init_count, phy->power_count); - return ret; } -int dp_ctrl_off_link(struct dp_ctrl *dp_ctrl) +void dp_ctrl_off_link(struct dp_ctrl *dp_ctrl) { struct dp_ctrl_private *ctrl; struct dp_io *dp_io; struct phy *phy; - int ret; ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); dp_io = &ctrl->parser->io; @@ -2076,10 +2076,7 @@ int dp_ctrl_off_link(struct dp_ctrl *dp_ctrl) dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, false); - ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_CTRL_PM, false); - if (ret) { - DRM_ERROR("Failed to disable link clocks. ret=%d\n", ret); - } + dp_ctrl_link_clk_disable(&ctrl->dp_ctrl); DRM_DEBUG_DP("Before, phy=%p init_count=%d power_on=%d\n", phy, phy->init_count, phy->power_count); @@ -2088,19 +2085,13 @@ int dp_ctrl_off_link(struct dp_ctrl *dp_ctrl) DRM_DEBUG_DP("After, phy=%p init_count=%d power_on=%d\n", phy, phy->init_count, phy->power_count); - - return ret; } -int dp_ctrl_off(struct dp_ctrl *dp_ctrl) +void dp_ctrl_off(struct dp_ctrl *dp_ctrl) { struct dp_ctrl_private *ctrl; struct dp_io *dp_io; struct phy *phy; - int ret = 0; - - if (!dp_ctrl) - return -EINVAL; ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); dp_io = &ctrl->parser->io; @@ -2116,16 +2107,11 @@ int dp_ctrl_off(struct dp_ctrl *dp_ctrl) } dev_pm_opp_set_rate(ctrl->dev, 0); - ret = dp_ctrl_clk_enable(&ctrl->dp_ctrl, DP_CTRL_PM, false); - if (ret) { - DRM_ERROR("Failed to disable link clocks. ret=%d\n", ret); - } + dp_ctrl_link_clk_disable(&ctrl->dp_ctrl); phy_power_off(phy); drm_dbg_dp(ctrl->drm_dev, "phy=%p init=%d power_on=%d\n", phy, phy->init_count, phy->power_count); - - return ret; } irqreturn_t dp_ctrl_isr(struct dp_ctrl *dp_ctrl) @@ -2186,37 +2172,33 @@ static const char *ctrl_clks[] = { static int dp_ctrl_clk_init(struct dp_ctrl *dp_ctrl) { struct dp_ctrl_private *ctrl; - struct dss_module_power *core, *link; struct device *dev; int i, rc; ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); dev = ctrl->dev; - core = &ctrl->mp[DP_CORE_PM]; - link = &ctrl->mp[DP_CTRL_PM]; - - core->num_clk = ARRAY_SIZE(core_clks); - core->clocks = devm_kcalloc(dev, core->num_clk, sizeof(*core->clocks), GFP_KERNEL); - if (!core->clocks) + ctrl->num_core_clks = ARRAY_SIZE(core_clks); + ctrl->core_clks = devm_kcalloc(dev, ctrl->num_core_clks, sizeof(*ctrl->core_clks), GFP_KERNEL); + if (!ctrl->core_clks) return -ENOMEM; - for (i = 0; i < core->num_clk; i++) - core->clocks[i].id = core_clks[i]; + for (i = 0; i < ctrl->num_core_clks; i++) + ctrl->core_clks[i].id = core_clks[i]; - rc = devm_clk_bulk_get(dev, core->num_clk, core->clocks); + rc = devm_clk_bulk_get(dev, ctrl->num_core_clks, ctrl->core_clks); if (rc) return rc; - link->num_clk = ARRAY_SIZE(ctrl_clks); - link->clocks = devm_kcalloc(dev, link->num_clk, sizeof(*link->clocks), GFP_KERNEL); - if (!link->clocks) + ctrl->num_link_clks = ARRAY_SIZE(ctrl_clks); + ctrl->link_clks = devm_kcalloc(dev, ctrl->num_link_clks, sizeof(*ctrl->link_clks), GFP_KERNEL); + if (!ctrl->link_clks) return -ENOMEM; - for (i = 0; i < link->num_clk; i++) - link->clocks[i].id = ctrl_clks[i]; + for (i = 0; i < ctrl->num_link_clks; i++) + ctrl->link_clks[i].id = ctrl_clks[i]; - rc = devm_clk_bulk_get(dev, link->num_clk, link->clocks); + rc = devm_clk_bulk_get(dev, ctrl->num_link_clks, ctrl->link_clks); if (rc) return rc; diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.h b/drivers/gpu/drm/msm/dp/dp_ctrl.h index d8007a9d8260..023f14d0b021 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.h +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.h @@ -17,17 +17,11 @@ struct dp_ctrl { bool wide_bus_en; }; -enum dp_pm_type { - DP_CORE_PM, - DP_CTRL_PM, - DP_MAX_PM -}; - int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl); int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train); -int dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl); -int dp_ctrl_off_link(struct dp_ctrl *dp_ctrl); -int dp_ctrl_off(struct dp_ctrl *dp_ctrl); +void dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl); +void dp_ctrl_off_link(struct dp_ctrl *dp_ctrl); +void dp_ctrl_off(struct dp_ctrl *dp_ctrl); void dp_ctrl_push_idle(struct dp_ctrl *dp_ctrl); irqreturn_t dp_ctrl_isr(struct dp_ctrl *dp_ctrl); void dp_ctrl_handle_sink_request(struct dp_ctrl *dp_ctrl); @@ -44,7 +38,7 @@ void dp_ctrl_irq_phy_exit(struct dp_ctrl *dp_ctrl); void dp_ctrl_set_psr(struct dp_ctrl *dp_ctrl, bool enable); void dp_ctrl_config_psr(struct dp_ctrl *dp_ctrl); -int dp_ctrl_clk_enable(struct dp_ctrl *ctrl, enum dp_pm_type pm_type, - bool enable); +int dp_ctrl_core_clk_enable(struct dp_ctrl *dp_ctrl); +void dp_ctrl_core_clk_disable(struct dp_ctrl *dp_ctrl); #endif /* _DP_CTRL_H_ */ diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 33e9d7deb3f8..6fbbd0f93d13 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -432,7 +432,7 @@ static void dp_display_host_init(struct dp_display_private *dp) dp->dp_display.connector_type, dp->core_initialized, dp->phy_initialized); - dp_ctrl_clk_enable(dp->ctrl, DP_CORE_PM, true); + dp_ctrl_core_clk_enable(dp->ctrl); dp_ctrl_reset_irq_ctrl(dp->ctrl, true); dp_aux_init(dp->aux); dp->core_initialized = true; @@ -446,7 +446,7 @@ static void dp_display_host_deinit(struct dp_display_private *dp) dp_ctrl_reset_irq_ctrl(dp->ctrl, false); dp_aux_deinit(dp->aux); - dp_ctrl_clk_enable(dp->ctrl, DP_CORE_PM, false); + dp_ctrl_core_clk_disable(dp->ctrl); dp->core_initialized = false; } From patchwork Sun Dec 31 00:43:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13507082 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 97CB6C47077 for ; Sun, 31 Dec 2023 00:44:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 04BDD10E174; Sun, 31 Dec 2023 00:44:27 +0000 (UTC) Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6320610E0E2 for ; Sun, 31 Dec 2023 00:44:05 +0000 (UTC) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-50e759ece35so5662324e87.3 for ; Sat, 30 Dec 2023 16:44:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703983443; x=1704588243; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=f23f6k2NURR3hjj9IxLe37rVyBQBMzjyoSIDJiZdG1c=; b=EKRfQBPNULsCJPtRJ/t6EdCCTLSog2vP07lQK/lY379bZ5DUUr2FssOOnqcdQDj5nl WF4+2FsISSIeqcNG2fW3C8ThoMIjL3NrKjniASdkaP7q7Mr7QOEV7J4a2gfh6GadsGL8 Rctxm5RVw7FluRgbMwCKaCg2rONrXtu2DQhdUBX0WbxFkkkI32OCO5jMNf6YTg9igYC/ mwXjUbBzDK7Kt6XkD5lEKGFDAdsuNGlW6dNV1K66siLjs2hfm5ucx0oXZm+T/7to9Prl OJGqlhehHl739OgxI8UM12/xgobJrMUiWFkV/eVEbiHcY17WvtCFfJrKnCM8GDF8EREK 1uLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703983443; x=1704588243; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f23f6k2NURR3hjj9IxLe37rVyBQBMzjyoSIDJiZdG1c=; b=TtJutnaDJC7t2WnD1mk+ZrInbYXLERlhh/uHlsjKKAvB2LrE6UQYiNqLR23dt3vueE 5DUePb4HoHtrWhyFl/AWoGtBIDMRqtn/OSBaVVCy4SuZB8PUJs3rXULWOu1ZO93/cra9 xtZdeUn8yBo1ZDEOdYVxq9R2odsnQ6fSQNGbMhEdGRM/PWk+ooR9b3YT+HsnfPUB9GsF 81Eg0xzUiOp7/KxSitUQ6uxI+kYMoygkgNicesrlGa9j2i7H4vBhTw/dl4fgeg3z83+7 8WVLSUCGwok2VHo1OidpzSw+07VrATPIKo/6izJJDUfSGdqmIGSxlC+IM2jqlGmHHwD6 Y6XQ== X-Gm-Message-State: AOJu0YzDxY2NRwdSLm1Y5uJcFBfQZ2Y9RFWYw2nh5otcN2eW8UOyOisD r7qX8xJ3cJFhGcHrcoSWWE4qvC/2lj71Aw== X-Google-Smtp-Source: AGHT+IGo3QVbbuztsYi/hkw7G7J2Q7A7Wjez+g7zFg/0SAjx4ORvy+3ZbCef4K3kR93437TeWEbP1Q== X-Received: by 2002:a19:6549:0:b0:50e:558e:1259 with SMTP id c9-20020a196549000000b0050e558e1259mr5058894lfj.19.1703983443757; Sat, 30 Dec 2023 16:44:03 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id n13-20020a05651203ed00b0050e84be8127sm1295995lfq.101.2023.12.30.16.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 16:44:03 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 31 Dec 2023 02:43:56 +0200 Subject: [PATCH v2 09/15] drm/msm/dp: move phy_configure_opts to dp_ctrl MIME-Version: 1.0 Message-Id: <20231231-dp-power-parser-cleanup-v2-9-fc3e902a6f5b@linaro.org> References: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> In-Reply-To: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , Stephen Boyd X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=6449; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=JHMCbSPE7gZXRzZ8Yh8uYk+Fdg3YzXkUqA/+AlXGaYM=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlkLlKHK7IATSmw6bh0J/WgmalOpsadKPT+lVOo 2Vd8ZEHEHiJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZZC5SgAKCRCLPIo+Aiko 1SRKB/9OTjUhJi3PtlZUs+9HvdLVY9H3o+ZsUSwd2PWuq81ipwfpsICrlCdZqQ+2jZ8qd2gcQM7 c3ihVMqCs73XElAlVBbKBSwswP1XVM63TyKnQs3K2IKaFTrDQ1ON3/FSATz05djdq5mJGvWWMT3 WK4upsYVckKgMKxQHkQumi+XeiXA5YXPPoEbpRwuzIy/LvkdbqIGpo6roRLAQldSZYU20wy6BjI ei0xAr1UKWaKOabbV5hZjFuooMDMDSvDj81ZDrzgkut7eb266e/FU/nM3ncscRUGHrfsVQfoOg1 VzGFcy6i8Laa2y6V5A+YfYi9TcWuihF+8/tbQ3/bqukO1N2J X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: Konrad Dybcio , linux-arm-msm@vger.kernel.org, Bjorn Andersson , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There is little point in sharing phy configuration structure between several modules. Move it to dp_ctrl, which becomes the only submodule re-configuring the PHY. Signed-off-by: Dmitry Baryshkov Reviewed-by: Konrad Dybcio --- drivers/gpu/drm/msm/dp/dp_catalog.c | 19 ----------------- drivers/gpu/drm/msm/dp/dp_catalog.h | 2 -- drivers/gpu/drm/msm/dp/dp_ctrl.c | 41 ++++++++++++++++++++++++------------- drivers/gpu/drm/msm/dp/dp_parser.h | 3 --- 4 files changed, 27 insertions(+), 38 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index 5142aeb705a4..e07651768805 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -765,25 +765,6 @@ void dp_catalog_ctrl_phy_reset(struct dp_catalog *dp_catalog) dp_write_ahb(catalog, REG_DP_PHY_CTRL, 0x0); } -int dp_catalog_ctrl_update_vx_px(struct dp_catalog *dp_catalog, - u8 v_level, u8 p_level) -{ - struct dp_catalog_private *catalog = container_of(dp_catalog, - struct dp_catalog_private, dp_catalog); - struct dp_io *dp_io = catalog->io; - struct phy *phy = dp_io->phy; - struct phy_configure_opts_dp *opts_dp = &dp_io->phy_opts.dp; - - /* TODO: Update for all lanes instead of just first one */ - opts_dp->voltage[0] = v_level; - opts_dp->pre[0] = p_level; - opts_dp->set_voltages = 1; - phy_configure(phy, &dp_io->phy_opts); - opts_dp->set_voltages = 0; - - return 0; -} - void dp_catalog_ctrl_send_phy_pattern(struct dp_catalog *dp_catalog, u32 pattern) { diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h b/drivers/gpu/drm/msm/dp/dp_catalog.h index 38786e855b51..ba7c62ba7ca3 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.h +++ b/drivers/gpu/drm/msm/dp/dp_catalog.h @@ -111,8 +111,6 @@ void dp_catalog_ctrl_set_psr(struct dp_catalog *dp_catalog, bool enter); u32 dp_catalog_link_is_connected(struct dp_catalog *dp_catalog); u32 dp_catalog_hpd_get_intr_status(struct dp_catalog *dp_catalog); void dp_catalog_ctrl_phy_reset(struct dp_catalog *dp_catalog); -int dp_catalog_ctrl_update_vx_px(struct dp_catalog *dp_catalog, u8 v_level, - u8 p_level); int dp_catalog_ctrl_get_interrupt(struct dp_catalog *dp_catalog); u32 dp_catalog_ctrl_read_psr_interrupt_status(struct dp_catalog *dp_catalog); void dp_catalog_ctrl_update_transfer_unit(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 e367eb8e5bea..4aea72a2b8e8 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c @@ -87,6 +87,8 @@ struct dp_ctrl_private { struct clk *pixel_clk; + union phy_configure_opts phy_opts; + struct completion idle_comp; struct completion psr_op_comp; struct completion video_comp; @@ -1017,6 +1019,21 @@ static int dp_ctrl_wait4video_ready(struct dp_ctrl_private *ctrl) return ret; } +static int dp_ctrl_set_vx_px(struct dp_ctrl_private *ctrl, + u8 v_level, u8 p_level) +{ + union phy_configure_opts *phy_opts = &ctrl->phy_opts; + + /* TODO: Update for all lanes instead of just first one */ + phy_opts->dp.voltage[0] = v_level; + phy_opts->dp.pre[0] = p_level; + phy_opts->dp.set_voltages = 1; + phy_configure(ctrl->parser->io.phy, phy_opts); + phy_opts->dp.set_voltages = 0; + + return 0; +} + static int dp_ctrl_update_vx_px(struct dp_ctrl_private *ctrl) { struct dp_link *link = ctrl->link; @@ -1029,7 +1046,7 @@ static int dp_ctrl_update_vx_px(struct dp_ctrl_private *ctrl) drm_dbg_dp(ctrl->drm_dev, "voltage level: %d emphasis level: %d\n", voltage_swing_level, pre_emphasis_level); - ret = dp_catalog_ctrl_update_vx_px(ctrl->catalog, + ret = dp_ctrl_set_vx_px(ctrl, voltage_swing_level, pre_emphasis_level); if (ret) @@ -1425,16 +1442,14 @@ static void dp_ctrl_link_clk_disable(struct dp_ctrl *dp_ctrl) static int dp_ctrl_enable_mainlink_clocks(struct dp_ctrl_private *ctrl) { int ret = 0; - struct dp_io *dp_io = &ctrl->parser->io; - struct phy *phy = dp_io->phy; - struct phy_configure_opts_dp *opts_dp = &dp_io->phy_opts.dp; + struct phy *phy = ctrl->parser->io.phy; const u8 *dpcd = ctrl->panel->dpcd; - opts_dp->lanes = ctrl->link->link_params.num_lanes; - opts_dp->link_rate = ctrl->link->link_params.rate / 100; - opts_dp->ssc = drm_dp_max_downspread(dpcd); + ctrl->phy_opts.dp.lanes = ctrl->link->link_params.num_lanes; + ctrl->phy_opts.dp.link_rate = ctrl->link->link_params.rate / 100; + ctrl->phy_opts.dp.ssc = drm_dp_max_downspread(dpcd); - phy_configure(phy, &dp_io->phy_opts); + phy_configure(phy, &ctrl->phy_opts); phy_power_on(phy); dev_pm_opp_set_rate(ctrl->dev, ctrl->link->link_params.rate * 1000); @@ -1572,14 +1587,12 @@ static bool dp_ctrl_use_fixed_nvid(struct dp_ctrl_private *ctrl) static int dp_ctrl_reinitialize_mainlink(struct dp_ctrl_private *ctrl) { + struct phy *phy = ctrl->parser->io.phy; int ret = 0; - struct dp_io *dp_io = &ctrl->parser->io; - struct phy *phy = dp_io->phy; - struct phy_configure_opts_dp *opts_dp = &dp_io->phy_opts.dp; dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, false); - opts_dp->lanes = ctrl->link->link_params.num_lanes; - phy_configure(phy, &dp_io->phy_opts); + ctrl->phy_opts.dp.lanes = ctrl->link->link_params.num_lanes; + phy_configure(phy, &ctrl->phy_opts); /* * Disable and re-enable the mainlink clock since the * link clock might have been adjusted as part of the @@ -1659,7 +1672,7 @@ static bool dp_ctrl_send_phy_test_pattern(struct dp_ctrl_private *ctrl) drm_dbg_dp(ctrl->drm_dev, "request: 0x%x\n", pattern_requested); - if (dp_catalog_ctrl_update_vx_px(ctrl->catalog, + if (dp_ctrl_set_vx_px(ctrl, ctrl->link->phy_params.v_level, ctrl->link->phy_params.p_level)) { DRM_ERROR("Failed to set v/p levels\n"); diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h index cad82c4d07da..b28052e87101 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ b/drivers/gpu/drm/msm/dp/dp_parser.h @@ -7,8 +7,6 @@ #define _DP_PARSER_H_ #include -#include -#include #include "msm_drv.h" @@ -37,7 +35,6 @@ struct dss_io_data { struct dp_io { struct dss_io_data dp_controller; struct phy *phy; - union phy_configure_opts phy_opts; }; /** From patchwork Sun Dec 31 00:43:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13507077 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CAFB6C47079 for ; Sun, 31 Dec 2023 00:44:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8400910E116; Sun, 31 Dec 2023 00:44:12 +0000 (UTC) Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 23CB910E0E2 for ; Sun, 31 Dec 2023 00:44:06 +0000 (UTC) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-50e7dff3e9fso5003908e87.2 for ; Sat, 30 Dec 2023 16:44:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703983444; x=1704588244; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=IQTuJ8wNeg68JOx46UjSbtRu40sdbbzeiAcOLYDTPCw=; b=J0LQc9MRmnHYZwEi6QtdFpiXL0RztbVS5jBV9WvDumwaArlDUqro8y+A5VbEYWKj+1 DHljxESpYhEJfYgmlozYvGfYB7u+dQ7Ag7ZEC/jD4eLWyL8H+98mDCfCXM0J/DLV1Ay1 sqH3RxTwgjai+qLsPT6zplHp7xeCC9GMKmKs2Oqp8+2Kjoyy1Tj5G5q40AuzpWwJgDB4 yyD4EBEBM5inUr5Dot6I29SfJepGVaX2ukBwn43uVkyCWVztSnPnfmN0d+5Z+rEgw3pl /es/EQRWatI8YW+xr6K4SC4hyWkdFbxwYH55o7P3iE8chNoizXSX0HstzihngTnxXfTx KekQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703983444; x=1704588244; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IQTuJ8wNeg68JOx46UjSbtRu40sdbbzeiAcOLYDTPCw=; b=UIZvNjyjxgiOcwJnrCJPf6EdXuMfD0zmGKXkH6TzHvlK8DrNkbyVssBybVWxQBA0ZD l3FV8yuDhkR6tqnUHdB7gG6670BIV7qGJXXQPfZ+VrVtd3UjYgUgl215B7OTAJDBbzDY tdPFv2JXBlAJD6JGYrVhTaoFtNF3q5EY8dZOI0du8GLTObCiFYS2LG7te7wYjAHfMuWE vR4TSFyd4mAgHPgXmgPznX4howJJ5B0MNDPKe2bMDLXe2WQ77tYR89GrEWEQ6huj8oNz 97BYqCJuC3NjNws4O0O3nqMrBSyAgQh3mYCZZAvM5CepGwcOwI8dw9oOnT+VHs2CuGeE qwBQ== X-Gm-Message-State: AOJu0YwerU1qgcUoV54EcwSrmVgPQZ+zYHoboq8yeNv5wo1Mx+eQXjst psnPJ0m2B9FhUSsASYpVaTReBtrc7YIuwA== X-Google-Smtp-Source: AGHT+IE8dowWpxKdGXhG1NOkCLp5/Vfmg9ZKW6b7JYn9T++S2dPfTnmj4gonQ35t63XBmCABXA+vuw== X-Received: by 2002:a19:f814:0:b0:50e:76f8:4fd3 with SMTP id a20-20020a19f814000000b0050e76f84fd3mr3551391lff.67.1703983444399; Sat, 30 Dec 2023 16:44:04 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id n13-20020a05651203ed00b0050e84be8127sm1295995lfq.101.2023.12.30.16.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 16:44:04 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 31 Dec 2023 02:43:57 +0200 Subject: [PATCH v2 10/15] drm/msm/dp: remove PHY handling from dp_catalog.c MIME-Version: 1.0 Message-Id: <20231231-dp-power-parser-cleanup-v2-10-fc3e902a6f5b@linaro.org> References: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> In-Reply-To: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , Stephen Boyd X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=4868; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=lj8fVAqF9xjHx1KrBL3A1/vTOxjI6sPTTzeJIEKTWus=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlkLlKYtIjSUKrW19STyvBa5h1Xgv60wgPPKTjg /AtG1iv5PGJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZZC5SgAKCRCLPIo+Aiko 1RhFCACyezgIjytPk7U3WDOoF8PK48MbzZXjnp7nOLOpYWqQc/WJmWSTwNUc1NHw2foawFseq5D QXTzPmfQEgF3+ndIsvv/YwS7uQJMi/Poy+Q7Ae7qPWWJa3lFz4Gus1FdHjFG+hqyYlw2cZS/ADr xWJQ48r1AjorSSo3HLUygzx67QiRHOX4wjKNqsx1x/IzRdQ6aGFKQBQrcp2MpO2KNQFXXPgnYjk 7Rms6aUzD1nw5qBXu2CCmjBjTkF6R4i7US2KYrdDC96YPuY+PCY/wByDz2AFWI0/SvnH8/I2ZMd F+maun5E26iEgPc1qEVZ/9x03OnnFYWFEINw0IiemP259NKF X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: Konrad Dybcio , linux-arm-msm@vger.kernel.org, Bjorn Andersson , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Inline dp_catalog_aux_update_cfg() and call phy_calibrate() from dp_aux functions directly. Signed-off-by: Dmitry Baryshkov Reviewed-by: Konrad Dybcio --- drivers/gpu/drm/msm/dp/dp_aux.c | 9 +++++++-- drivers/gpu/drm/msm/dp/dp_aux.h | 1 + drivers/gpu/drm/msm/dp/dp_catalog.c | 12 ------------ drivers/gpu/drm/msm/dp/dp_catalog.h | 1 - drivers/gpu/drm/msm/dp/dp_display.c | 4 +++- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_aux.c b/drivers/gpu/drm/msm/dp/dp_aux.c index 03f4951c49f4..adbd5a367395 100644 --- a/drivers/gpu/drm/msm/dp/dp_aux.c +++ b/drivers/gpu/drm/msm/dp/dp_aux.c @@ -4,6 +4,7 @@ */ #include +#include #include #include "dp_reg.h" @@ -23,6 +24,8 @@ struct dp_aux_private { struct device *dev; struct dp_catalog *catalog; + struct phy *phy; + struct mutex mutex; struct completion comp; @@ -336,7 +339,7 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux, if (aux->native) { aux->retry_cnt++; if (!(aux->retry_cnt % MAX_AUX_RETRIES)) - dp_catalog_aux_update_cfg(aux->catalog); + phy_calibrate(aux->phy); } /* reset aux if link is in connected state */ if (dp_catalog_link_is_connected(aux->catalog)) @@ -439,7 +442,7 @@ void dp_aux_reconfig(struct drm_dp_aux *dp_aux) aux = container_of(dp_aux, struct dp_aux_private, dp_aux); - dp_catalog_aux_update_cfg(aux->catalog); + phy_calibrate(aux->phy); dp_catalog_aux_reset(aux->catalog); } @@ -517,6 +520,7 @@ static int dp_wait_hpd_asserted(struct drm_dp_aux *dp_aux, } struct drm_dp_aux *dp_aux_get(struct device *dev, struct dp_catalog *catalog, + struct phy *phy, bool is_edp) { struct dp_aux_private *aux; @@ -537,6 +541,7 @@ struct drm_dp_aux *dp_aux_get(struct device *dev, struct dp_catalog *catalog, aux->dev = dev; aux->catalog = catalog; + aux->phy = phy; aux->retry_cnt = 0; /* diff --git a/drivers/gpu/drm/msm/dp/dp_aux.h b/drivers/gpu/drm/msm/dp/dp_aux.h index 511305da4f66..16d9b1758748 100644 --- a/drivers/gpu/drm/msm/dp/dp_aux.h +++ b/drivers/gpu/drm/msm/dp/dp_aux.h @@ -17,6 +17,7 @@ void dp_aux_deinit(struct drm_dp_aux *dp_aux); void dp_aux_reconfig(struct drm_dp_aux *dp_aux); struct drm_dp_aux *dp_aux_get(struct device *dev, struct dp_catalog *catalog, + struct phy *phy, bool is_edp); void dp_aux_put(struct drm_dp_aux *aux); diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index e07651768805..4c6207797c99 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -7,8 +7,6 @@ #include #include -#include -#include #include #include #include @@ -243,16 +241,6 @@ void dp_catalog_aux_enable(struct dp_catalog *dp_catalog, bool enable) dp_write_aux(catalog, REG_DP_AUX_CTRL, aux_ctrl); } -void dp_catalog_aux_update_cfg(struct dp_catalog *dp_catalog) -{ - struct dp_catalog_private *catalog = container_of(dp_catalog, - struct dp_catalog_private, dp_catalog); - struct dp_io *dp_io = catalog->io; - struct phy *phy = dp_io->phy; - - phy_calibrate(phy); -} - int dp_catalog_aux_wait_for_hpd_connect_state(struct dp_catalog *dp_catalog) { u32 state; diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h b/drivers/gpu/drm/msm/dp/dp_catalog.h index ba7c62ba7ca3..1f3f58d4b8de 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.h +++ b/drivers/gpu/drm/msm/dp/dp_catalog.h @@ -84,7 +84,6 @@ 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); void dp_catalog_aux_enable(struct dp_catalog *dp_catalog, bool enable); -void dp_catalog_aux_update_cfg(struct dp_catalog *dp_catalog); int dp_catalog_aux_wait_for_hpd_connect_state(struct dp_catalog *dp_catalog); u32 dp_catalog_aux_get_irq(struct dp_catalog *dp_catalog); diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 6fbbd0f93d13..c1a51c498e01 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -729,7 +729,9 @@ static int dp_init_sub_modules(struct dp_display_private *dp) goto error; } - dp->aux = dp_aux_get(dev, dp->catalog, dp->dp_display.is_edp); + dp->aux = dp_aux_get(dev, dp->catalog, + dp->parser->io.phy, + dp->dp_display.is_edp); if (IS_ERR(dp->aux)) { rc = PTR_ERR(dp->aux); DRM_ERROR("failed to initialize aux, rc = %d\n", rc); From patchwork Sun Dec 31 00:43:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13507079 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF7F9C47077 for ; Sun, 31 Dec 2023 00:44:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F113010E16A; Sun, 31 Dec 2023 00:44:24 +0000 (UTC) Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by gabe.freedesktop.org (Postfix) with ESMTPS id B998610E0F9 for ; Sun, 31 Dec 2023 00:44:06 +0000 (UTC) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-50e49a0b5caso8843187e87.0 for ; Sat, 30 Dec 2023 16:44:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703983445; x=1704588245; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=JBWEWQ1lHx25M39T9M547AD4gOAvWiz91uIbsab7PCM=; b=vqU6qQNmrtpY5wX7hLa75oWWIulSR8yxPdzj3tixGUKsHn3jtDYNHXy+8Y5ct7jSWP +7Ct3vQmVOoStyKNRAApDizaUXd9yXnrMq6DUS4gq+SzYYJ9oeDwLiSvOSOpf+FdvxQJ Ujs7mMFfG1k+9NyA5w5fXGAd6nC6JacarIe/HFakHHGv2DHLqvOh92UvqUydQPyG7LF5 4+2K5+TEWQhNqlopSKQpDMiIo7KwJygNHQbSWVmCSlCTMogyT+nQzePLIC6P70rxIP3D FSURwGpRLYxUVpKbb+3PuYKUSAr+A3Qn5/c8gj//iLOykMKmFtI7EsmUPmQIUxJ/TZAL z48Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703983445; x=1704588245; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JBWEWQ1lHx25M39T9M547AD4gOAvWiz91uIbsab7PCM=; b=Q1PqUedq459+5wbcE35MCCx9qhpSREpmCTh2MBIfLYE9OSaOYBF0lNWdFOawIAop7f LMZOeV/cj7Hli3Xwkr48ixiWWslD2jcwtYsL9TMda2MOlYAqBhjhnL3hX62RrSmDNHzv uE0xDPBTzgXHdOmaV+IMRL642biRRmWLPVynn84aK6C8dD64N0bDUOiN5q863EyVrQ17 NyIMl7q1OgqPVnk0QGYu7Tsa/2lYJHhK0WyFWNVA/eNdhoPfQGVu51FQWwDOUh5sT7K1 bwq01NA22xohTS6XCMqa7WvSbwPjIDVLw6IxNeUjVoL5Lu3MieVEl7TJbegWhjtoZ/9H 2DPg== X-Gm-Message-State: AOJu0YyvkxkYHgd3/ADguQdo5U/sde28Pk/vD/TP089OhOkLlzUjZ1Zr PSKCnytroeyuWWC0xQx7g4qzWvb379Tnmg== X-Google-Smtp-Source: AGHT+IF6+CrY0KegZGrhyQK+eam1f/nMg7Bi30B3i1s0LSz4MQUOMJF8AawDrJx8Jqp/UjsP7mFgJA== X-Received: by 2002:a05:6512:3282:b0:50e:7314:e79e with SMTP id p2-20020a056512328200b0050e7314e79emr4219919lfe.110.1703983445066; Sat, 30 Dec 2023 16:44:05 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id n13-20020a05651203ed00b0050e84be8127sm1295995lfq.101.2023.12.30.16.44.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 16:44:04 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 31 Dec 2023 02:43:58 +0200 Subject: [PATCH v2 11/15] drm/msm/dp: handle PHY directly in dp_ctrl MIME-Version: 1.0 Message-Id: <20231231-dp-power-parser-cleanup-v2-11-fc3e902a6f5b@linaro.org> References: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> In-Reply-To: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , Stephen Boyd X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=6372; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=wVNyfHlk6qxMhT/7/ZVII3sNHgLBjpEAI4YnszPdTtw=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlkLlLVifYbvJJNcxQiZKcI3+qtmEV6O9DtsUYk r7DI63Vm9SJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZZC5SwAKCRCLPIo+Aiko 1b/zCACHOYolBtPtcPzNNvcL3ff2W1ynA8aJSDzoUn4Y3I9tTQcsXMPx5u4qZ3OMUcIEvYuASkb tU8NJ5g2CHpc3MqExkTiCUJwFfibdBYZqtPEGAdfb2HSIr0Qm13HB/jNRCCA9voTB9HVsqoTZhD ZBhccf/m1gvVLo1jGrc1kY6vf0tX+oPeYgvkDIX0nKVtsAqVFxBOumXgOBW9LIGt6p09sgblAX7 2L3GIwAprxU+xhQmphhzgI5M/PYdOzzRBe0Sl4rHoKQ4IBCGykQFURCdGZE1B76EWk9tcDw0c3/ cEWmtJAjYX7FEDJWpArDJ3RHgiC+xwNBDEU21A2LyUsXoo7i X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: Konrad Dybcio , linux-arm-msm@vger.kernel.org, Bjorn Andersson , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There is little point in going trough dp_parser->io indirection each time the driver needs to access the PHY. Store the pointer directly in dp_ctrl_private. Signed-off-by: Dmitry Baryshkov Reviewed-by: Konrad Dybcio --- drivers/gpu/drm/msm/dp/dp_ctrl.c | 37 +++++++++++++------------------------ drivers/gpu/drm/msm/dp/dp_ctrl.h | 2 +- drivers/gpu/drm/msm/dp/dp_display.c | 3 ++- 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c index 4aea72a2b8e8..fc7ce315ae41 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c @@ -76,9 +76,10 @@ struct dp_ctrl_private { struct drm_dp_aux *aux; struct dp_panel *panel; struct dp_link *link; - struct dp_parser *parser; struct dp_catalog *catalog; + struct phy *phy; + unsigned int num_core_clks; struct clk_bulk_data *core_clks; @@ -1028,7 +1029,7 @@ static int dp_ctrl_set_vx_px(struct dp_ctrl_private *ctrl, phy_opts->dp.voltage[0] = v_level; phy_opts->dp.pre[0] = p_level; phy_opts->dp.set_voltages = 1; - phy_configure(ctrl->parser->io.phy, phy_opts); + phy_configure(ctrl->phy, phy_opts); phy_opts->dp.set_voltages = 0; return 0; @@ -1442,7 +1443,7 @@ static void dp_ctrl_link_clk_disable(struct dp_ctrl *dp_ctrl) static int dp_ctrl_enable_mainlink_clocks(struct dp_ctrl_private *ctrl) { int ret = 0; - struct phy *phy = ctrl->parser->io.phy; + struct phy *phy = ctrl->phy; const u8 *dpcd = ctrl->panel->dpcd; ctrl->phy_opts.dp.lanes = ctrl->link->link_params.num_lanes; @@ -1540,12 +1541,10 @@ void dp_ctrl_set_psr(struct dp_ctrl *dp_ctrl, bool enter) void dp_ctrl_phy_init(struct dp_ctrl *dp_ctrl) { struct dp_ctrl_private *ctrl; - struct dp_io *dp_io; struct phy *phy; ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); - dp_io = &ctrl->parser->io; - phy = dp_io->phy; + phy = ctrl->phy; dp_catalog_ctrl_phy_reset(ctrl->catalog); phy_init(phy); @@ -1557,12 +1556,10 @@ void dp_ctrl_phy_init(struct dp_ctrl *dp_ctrl) void dp_ctrl_phy_exit(struct dp_ctrl *dp_ctrl) { struct dp_ctrl_private *ctrl; - struct dp_io *dp_io; struct phy *phy; ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); - dp_io = &ctrl->parser->io; - phy = dp_io->phy; + phy = ctrl->phy; dp_catalog_ctrl_phy_reset(ctrl->catalog); phy_exit(phy); @@ -1587,7 +1584,7 @@ static bool dp_ctrl_use_fixed_nvid(struct dp_ctrl_private *ctrl) static int dp_ctrl_reinitialize_mainlink(struct dp_ctrl_private *ctrl) { - struct phy *phy = ctrl->parser->io.phy; + struct phy *phy = ctrl->phy; int ret = 0; dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, false); @@ -1617,11 +1614,9 @@ static int dp_ctrl_reinitialize_mainlink(struct dp_ctrl_private *ctrl) static int dp_ctrl_deinitialize_mainlink(struct dp_ctrl_private *ctrl) { - struct dp_io *dp_io; struct phy *phy; - dp_io = &ctrl->parser->io; - phy = dp_io->phy; + phy = ctrl->phy; dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, false); @@ -2047,12 +2042,10 @@ int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train) void dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl) { struct dp_ctrl_private *ctrl; - struct dp_io *dp_io; struct phy *phy; ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); - dp_io = &ctrl->parser->io; - phy = dp_io->phy; + phy = ctrl->phy; /* set dongle to D3 (power off) mode */ dp_link_psm_config(ctrl->link, &ctrl->panel->link_info, true); @@ -2080,12 +2073,10 @@ void dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl) void dp_ctrl_off_link(struct dp_ctrl *dp_ctrl) { struct dp_ctrl_private *ctrl; - struct dp_io *dp_io; struct phy *phy; ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); - dp_io = &ctrl->parser->io; - phy = dp_io->phy; + phy = ctrl->phy; dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, false); @@ -2103,12 +2094,10 @@ void dp_ctrl_off_link(struct dp_ctrl *dp_ctrl) void dp_ctrl_off(struct dp_ctrl *dp_ctrl) { struct dp_ctrl_private *ctrl; - struct dp_io *dp_io; struct phy *phy; ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); - dp_io = &ctrl->parser->io; - phy = dp_io->phy; + phy = ctrl->phy; dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, false); @@ -2225,7 +2214,7 @@ static int dp_ctrl_clk_init(struct dp_ctrl *dp_ctrl) struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link, struct dp_panel *panel, struct drm_dp_aux *aux, struct dp_catalog *catalog, - struct dp_parser *parser) + struct phy *phy) { struct dp_ctrl_private *ctrl; int ret; @@ -2259,12 +2248,12 @@ struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link, init_completion(&ctrl->video_comp); /* in parameters */ - ctrl->parser = parser; ctrl->panel = panel; ctrl->aux = aux; ctrl->link = link; ctrl->catalog = catalog; ctrl->dev = dev; + ctrl->phy = phy; ret = dp_ctrl_clk_init(&ctrl->dp_ctrl); if (ret) { diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.h b/drivers/gpu/drm/msm/dp/dp_ctrl.h index 023f14d0b021..6e9f375b856a 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.h +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.h @@ -28,7 +28,7 @@ void dp_ctrl_handle_sink_request(struct dp_ctrl *dp_ctrl); struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link, struct dp_panel *panel, struct drm_dp_aux *aux, struct dp_catalog *catalog, - struct dp_parser *parser); + struct phy *phy); void dp_ctrl_reset_irq_ctrl(struct dp_ctrl *dp_ctrl, bool enable); void dp_ctrl_phy_init(struct dp_ctrl *dp_ctrl); diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index c1a51c498e01..b8388e04bd0f 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -760,7 +760,8 @@ static int dp_init_sub_modules(struct dp_display_private *dp) } dp->ctrl = dp_ctrl_get(dev, dp->link, dp->panel, dp->aux, - dp->catalog, dp->parser); + dp->catalog, + dp->parser->io.phy); if (IS_ERR(dp->ctrl)) { rc = PTR_ERR(dp->ctrl); DRM_ERROR("failed to initialize ctrl, rc = %d\n", rc); From patchwork Sun Dec 31 00:43:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13507078 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BFE60C47073 for ; Sun, 31 Dec 2023 00:44:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1CC9310E16C; Sun, 31 Dec 2023 00:44:25 +0000 (UTC) Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7410010E0F9 for ; Sun, 31 Dec 2023 00:44:07 +0000 (UTC) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-50e7e55c0f6so4730467e87.0 for ; Sat, 30 Dec 2023 16:44:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703983446; x=1704588246; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=RQQ9ATVd7VfBQUqKuKta60Fr98a+Dv89kNqnWW4Q8MI=; b=MYJt6TBDkTp1cXweQYbaPWVdY4HltEx8C/Dme4QlqnIB+zV96EL+Z60HqNwjxX2Kf8 EchU9n68tfxHtZTh0xSBsadf0hCoAG1Fn9YyEO09eu5emNpGdw88KeymJPf0FqKvly6R I3iYp10jLOMsJGLBn9mtGLstOg+U3qyRn3E4zxA2KOK3D0zVRU2T1DeXXYwE6diTjh86 6VOK8GMRuQKRY0Zw3LUXry4n4I7DBoJrf8PiMiHQgLTLBq0ZmaaEZ2yPbbdx41LRa3U2 cP6XD/sbi5peZ9rDthbHr/2mu1U2N4hGfFORphAxTw5E8iEPJUQvJNvIz7U8nGYllT38 Ly4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703983446; x=1704588246; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RQQ9ATVd7VfBQUqKuKta60Fr98a+Dv89kNqnWW4Q8MI=; b=ErdRvry1pay/F6mlxMaUBNT77MyZfUECd1SODJpciGTKc01yDubJWE4GTeFPUHI6nx WCxqgmkYUo2kYpPVTqJQfZki4N5s23udhpcoFjYCpiFhNWKpYM+++bG7NeIBt3RR5VsE 0qrMwTQ85eVLBU4aGOaoOZfcezW+OlptptlSFL5oH4g848jRMCePAb0a8IjgNFA7tPLo 2+2o4jaZBMdNxzVqAD4CbYh8ZYOwuZYDoZD8cfDS3CiqyHo2LdUsvHCIbteMJfND3t4a hg5LBYYkK7mJ+V6Subno9AYtOUsnZmoYHgOIZIwbN7CxvhCb19EgdvR/zBg7wSb86qKW emEQ== X-Gm-Message-State: AOJu0YwUi0SUT7S1Uw6x7D2iuJSvhH7B+Y4OsIvzENGKXImOiVZn4aVu pfEhkI8/HFnot5XrbTBMVHkxMpYJhL+p2A== X-Google-Smtp-Source: AGHT+IE+zSSl/K/80t0QvuiS4GMcDMOCUU3/xK4ifOO7ocZ+/jTCEdhDdScNadGUyVb4TW4GmYDGgw== X-Received: by 2002:a05:6512:3912:b0:50d:6249:17cc with SMTP id a18-20020a056512391200b0050d624917ccmr2663767lfu.245.1703983445766; Sat, 30 Dec 2023 16:44:05 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id n13-20020a05651203ed00b0050e84be8127sm1295995lfq.101.2023.12.30.16.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 16:44:05 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 31 Dec 2023 02:43:59 +0200 Subject: [PATCH v2 12/15] drm/msm/dp: move all IO handling to dp_catalog MIME-Version: 1.0 Message-Id: <20231231-dp-power-parser-cleanup-v2-12-fc3e902a6f5b@linaro.org> References: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> In-Reply-To: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , Stephen Boyd X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=15739; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=RVLDduDFSJzfd6PjlCkfVWPfroslvd26lG+KLnLFDlQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlkLlLGM1lApWygVwc8Xf0BjniwVqrXnrYByVZb 6aW7Tgzf1qJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZZC5SwAKCRCLPIo+Aiko 1XjxCACPKrT6b130Dg45+5/B8cAfCelVGPrGFk48gsTELt3am3OrhV0KxMGooqituZzc6SB+aia YcYWux989gSZgTuJjeaIE3k3Overx2bFryGML9FUviLDiPyFEKqzHztjBRBFcMlEyLow1HCWZqV OHCJLWXVeqFoAsgnzhqUB/4qcWywb5OWe3c3bAY4iX3vbdP/YEvIjUXllnyDjThSJ1ZM2yNjYZ3 OFXF3V7hQIeVEHQT0EQDT3P5IshpdoHA0iIhUcXcVVubM5kw7uczOEhNxPlnKGyBLaXzqt9ZZKQ kT09rt58f41GEmqSuELQrhKVYoAmzHrZqGaV35kYP5ToT6Cb X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: Konrad Dybcio , linux-arm-msm@vger.kernel.org, Bjorn Andersson , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Rather than parsing the I/O addresses from dp_parser and then passing them via a struct pointer to dp_catalog, handle I/O region parsing in dp_catalog and drop it from dp_parser. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_catalog.c | 125 ++++++++++++++++++++++++++++++------ drivers/gpu/drm/msm/dp/dp_catalog.h | 2 +- drivers/gpu/drm/msm/dp/dp_display.c | 6 +- drivers/gpu/drm/msm/dp/dp_parser.c | 73 +-------------------- drivers/gpu/drm/msm/dp/dp_parser.h | 27 +------- 5 files changed, 115 insertions(+), 118 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index 4c6207797c99..541aac2cb246 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -53,10 +54,31 @@ (PSR_UPDATE_MASK | PSR_CAPTURE_MASK | PSR_EXIT_MASK | \ PSR_UPDATE_ERROR_MASK | PSR_WAKE_ERROR_MASK) +#define DP_DEFAULT_AHB_OFFSET 0x0000 +#define DP_DEFAULT_AHB_SIZE 0x0200 +#define DP_DEFAULT_AUX_OFFSET 0x0200 +#define DP_DEFAULT_AUX_SIZE 0x0200 +#define DP_DEFAULT_LINK_OFFSET 0x0400 +#define DP_DEFAULT_LINK_SIZE 0x0C00 +#define DP_DEFAULT_P0_OFFSET 0x1000 +#define DP_DEFAULT_P0_SIZE 0x0400 + +struct dss_io_region { + size_t len; + void __iomem *base; +}; + +struct dss_io_data { + struct dss_io_region ahb; + struct dss_io_region aux; + struct dss_io_region link; + struct dss_io_region p0; +}; + struct dp_catalog_private { struct device *dev; struct drm_device *drm_dev; - struct dp_io *io; + 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]; @@ -66,7 +88,7 @@ void dp_catalog_snapshot(struct dp_catalog *dp_catalog, struct msm_disp_state *d { struct dp_catalog_private *catalog = container_of(dp_catalog, struct dp_catalog_private, dp_catalog); - struct dss_io_data *dss = &catalog->io->dp_controller; + struct dss_io_data *dss = &catalog->io; msm_disp_snapshot_add_block(disp_state, dss->ahb.len, dss->ahb.base, "dp_ahb"); msm_disp_snapshot_add_block(disp_state, dss->aux.len, dss->aux.base, "dp_aux"); @@ -76,7 +98,7 @@ void dp_catalog_snapshot(struct dp_catalog *dp_catalog, struct msm_disp_state *d static inline u32 dp_read_aux(struct dp_catalog_private *catalog, u32 offset) { - return readl_relaxed(catalog->io->dp_controller.aux.base + offset); + return readl_relaxed(catalog->io.aux.base + offset); } static inline void dp_write_aux(struct dp_catalog_private *catalog, @@ -86,12 +108,12 @@ static inline void dp_write_aux(struct dp_catalog_private *catalog, * To make sure aux reg writes happens before any other operation, * this function uses writel() instread of writel_relaxed() */ - writel(data, catalog->io->dp_controller.aux.base + offset); + writel(data, catalog->io.aux.base + offset); } static inline u32 dp_read_ahb(const struct dp_catalog_private *catalog, u32 offset) { - return readl_relaxed(catalog->io->dp_controller.ahb.base + offset); + return readl_relaxed(catalog->io.ahb.base + offset); } static inline void dp_write_ahb(struct dp_catalog_private *catalog, @@ -101,7 +123,7 @@ static inline void dp_write_ahb(struct dp_catalog_private *catalog, * To make sure phy reg writes happens before any other operation, * this function uses writel() instread of writel_relaxed() */ - writel(data, catalog->io->dp_controller.ahb.base + offset); + writel(data, catalog->io.ahb.base + offset); } static inline void dp_write_p0(struct dp_catalog_private *catalog, @@ -111,7 +133,7 @@ static inline void dp_write_p0(struct dp_catalog_private *catalog, * To make sure interface reg writes happens before any other operation, * this function uses writel() instread of writel_relaxed() */ - writel(data, catalog->io->dp_controller.p0.base + offset); + writel(data, catalog->io.p0.base + offset); } static inline u32 dp_read_p0(struct dp_catalog_private *catalog, @@ -121,12 +143,12 @@ static inline u32 dp_read_p0(struct dp_catalog_private *catalog, * To make sure interface reg writes happens before any other operation, * this function uses writel() instread of writel_relaxed() */ - return readl_relaxed(catalog->io->dp_controller.p0.base + offset); + return readl_relaxed(catalog->io.p0.base + offset); } static inline u32 dp_read_link(struct dp_catalog_private *catalog, u32 offset) { - return readl_relaxed(catalog->io->dp_controller.link.base + offset); + return readl_relaxed(catalog->io.link.base + offset); } static inline void dp_write_link(struct dp_catalog_private *catalog, @@ -136,7 +158,7 @@ static inline void dp_write_link(struct dp_catalog_private *catalog, * To make sure link reg writes happens before any other operation, * this function uses writel() instread of writel_relaxed() */ - writel(data, catalog->io->dp_controller.link.base + offset); + writel(data, catalog->io.link.base + offset); } /* aux related catalog functions */ @@ -248,7 +270,7 @@ int dp_catalog_aux_wait_for_hpd_connect_state(struct dp_catalog *dp_catalog) struct dp_catalog_private, dp_catalog); /* poll for hpd connected status every 2ms and timeout after 500ms */ - return readl_poll_timeout(catalog->io->dp_controller.aux.base + + return readl_poll_timeout(catalog->io.aux.base + REG_DP_DP_HPD_INT_STATUS, state, state & DP_DP_HPD_STATE_STATUS_CONNECTED, 2000, 500000); @@ -276,7 +298,7 @@ void dp_catalog_dump_regs(struct dp_catalog *dp_catalog) { struct dp_catalog_private *catalog = container_of(dp_catalog, struct dp_catalog_private, dp_catalog); - struct dss_io_data *io = &catalog->io->dp_controller; + struct dss_io_data *io = &catalog->io; pr_info("AHB regs\n"); dump_regs(io->ahb.base, io->ahb.len); @@ -500,7 +522,7 @@ int dp_catalog_ctrl_set_pattern_state_bit(struct dp_catalog *dp_catalog, bit = BIT(state_bit - 1) << DP_MAINLINK_READY_LINK_TRAINING_SHIFT; /* Poll for mainlink ready status */ - ret = readx_poll_timeout(readl, catalog->io->dp_controller.link.base + + ret = readx_poll_timeout(readl, catalog->io.link.base + REG_DP_MAINLINK_READY, data, data & bit, POLLING_SLEEP_US, POLLING_TIMEOUT_US); @@ -563,7 +585,7 @@ bool dp_catalog_ctrl_mainlink_ready(struct dp_catalog *dp_catalog) struct dp_catalog_private, dp_catalog); /* Poll for mainlink ready status */ - ret = readl_poll_timeout(catalog->io->dp_controller.link.base + + ret = readl_poll_timeout(catalog->io.link.base + REG_DP_MAINLINK_READY, data, data & DP_MAINLINK_READY_FOR_VIDEO, POLLING_SLEEP_US, POLLING_TIMEOUT_US); @@ -945,21 +967,84 @@ void dp_catalog_panel_tpg_disable(struct dp_catalog *dp_catalog) dp_write_p0(catalog, MMSS_DP_TIMING_ENGINE_EN, 0x0); } -struct dp_catalog *dp_catalog_get(struct device *dev, struct dp_io *io) +static void __iomem *dp_ioremap(struct platform_device *pdev, int idx, size_t *len) { - struct dp_catalog_private *catalog; + struct resource *res; + void __iomem *base; + + base = devm_platform_get_and_ioremap_resource(pdev, idx, &res); + if (!IS_ERR(base)) + *len = resource_size(res); + + return base; +} + +static int dp_catalog_get_io(struct dp_catalog_private *catalog) +{ + struct platform_device *pdev = to_platform_device(catalog->dev); + struct dss_io_data *dss = &catalog->io; + + dss->ahb.base = dp_ioremap(pdev, 0, &dss->ahb.len); + if (IS_ERR(dss->ahb.base)) + return PTR_ERR(dss->ahb.base); - if (!io) { - DRM_ERROR("invalid input\n"); - return ERR_PTR(-EINVAL); + dss->aux.base = dp_ioremap(pdev, 1, &dss->aux.len); + if (IS_ERR(dss->aux.base)) { + /* + * The initial binding had a single reg, but in order to + * support variation in the sub-region sizes this was split. + * dp_ioremap() will fail with -EINVAL here if only a single + * reg is specified, so fill in the sub-region offsets and + * lengths based on this single region. + */ + if (PTR_ERR(dss->aux.base) == -EINVAL) { + if (dss->ahb.len < DP_DEFAULT_P0_OFFSET + DP_DEFAULT_P0_SIZE) { + DRM_ERROR("legacy memory region not large enough\n"); + return -EINVAL; + } + + dss->ahb.len = DP_DEFAULT_AHB_SIZE; + dss->aux.base = dss->ahb.base + DP_DEFAULT_AUX_OFFSET; + dss->aux.len = DP_DEFAULT_AUX_SIZE; + dss->link.base = dss->ahb.base + DP_DEFAULT_LINK_OFFSET; + dss->link.len = DP_DEFAULT_LINK_SIZE; + dss->p0.base = dss->ahb.base + DP_DEFAULT_P0_OFFSET; + dss->p0.len = DP_DEFAULT_P0_SIZE; + } else { + DRM_ERROR("unable to remap aux region: %pe\n", dss->aux.base); + return PTR_ERR(dss->aux.base); + } + } else { + dss->link.base = dp_ioremap(pdev, 2, &dss->link.len); + if (IS_ERR(dss->link.base)) { + DRM_ERROR("unable to remap link region: %pe\n", dss->link.base); + return PTR_ERR(dss->link.base); + } + + dss->p0.base = dp_ioremap(pdev, 3, &dss->p0.len); + if (IS_ERR(dss->p0.base)) { + DRM_ERROR("unable to remap p0 region: %pe\n", dss->p0.base); + return PTR_ERR(dss->p0.base); + } } + return 0; +} + +struct dp_catalog *dp_catalog_get(struct device *dev) +{ + struct dp_catalog_private *catalog; + int ret; + catalog = devm_kzalloc(dev, sizeof(*catalog), GFP_KERNEL); if (!catalog) return ERR_PTR(-ENOMEM); catalog->dev = dev; - catalog->io = io; + + ret = dp_catalog_get_io(catalog); + if (ret) + return ERR_PTR(ret); return &catalog->dp_catalog; } diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h b/drivers/gpu/drm/msm/dp/dp_catalog.h index 1f3f58d4b8de..989e4c4fd6fa 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.h +++ b/drivers/gpu/drm/msm/dp/dp_catalog.h @@ -126,7 +126,7 @@ void dp_catalog_panel_tpg_enable(struct dp_catalog *dp_catalog, struct drm_display_mode *drm_mode); void dp_catalog_panel_tpg_disable(struct dp_catalog *dp_catalog); -struct dp_catalog *dp_catalog_get(struct device *dev, struct dp_io *io); +struct dp_catalog *dp_catalog_get(struct device *dev); /* DP Audio APIs */ void dp_catalog_audio_get_header(struct dp_catalog *catalog); diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index b8388e04bd0f..5ad96989c5f2 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -721,7 +721,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp) goto error; } - dp->catalog = dp_catalog_get(dev, &dp->parser->io); + dp->catalog = dp_catalog_get(dev); if (IS_ERR(dp->catalog)) { rc = PTR_ERR(dp->catalog); DRM_ERROR("failed to initialize catalog, rc = %d\n", rc); @@ -730,7 +730,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp) } dp->aux = dp_aux_get(dev, dp->catalog, - dp->parser->io.phy, + dp->parser->phy, dp->dp_display.is_edp); if (IS_ERR(dp->aux)) { rc = PTR_ERR(dp->aux); @@ -761,7 +761,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp) dp->ctrl = dp_ctrl_get(dev, dp->link, dp->panel, dp->aux, dp->catalog, - dp->parser->io.phy); + dp->parser->phy); if (IS_ERR(dp->ctrl)) { rc = PTR_ERR(dp->ctrl); DRM_ERROR("failed to initialize ctrl, rc = %d\n", rc); diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index de7cfc340f0c..2d0dd4353cdf 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -13,80 +13,13 @@ #include "dp_parser.h" #include "dp_reg.h" -#define DP_DEFAULT_AHB_OFFSET 0x0000 -#define DP_DEFAULT_AHB_SIZE 0x0200 -#define DP_DEFAULT_AUX_OFFSET 0x0200 -#define DP_DEFAULT_AUX_SIZE 0x0200 -#define DP_DEFAULT_LINK_OFFSET 0x0400 -#define DP_DEFAULT_LINK_SIZE 0x0C00 -#define DP_DEFAULT_P0_OFFSET 0x1000 -#define DP_DEFAULT_P0_SIZE 0x0400 - -static void __iomem *dp_ioremap(struct platform_device *pdev, int idx, size_t *len) -{ - struct resource *res; - void __iomem *base; - - base = devm_platform_get_and_ioremap_resource(pdev, idx, &res); - if (!IS_ERR(base)) - *len = resource_size(res); - - return base; -} - static int dp_parser_ctrl_res(struct dp_parser *parser) { struct platform_device *pdev = parser->pdev; - struct dp_io *io = &parser->io; - struct dss_io_data *dss = &io->dp_controller; - - dss->ahb.base = dp_ioremap(pdev, 0, &dss->ahb.len); - if (IS_ERR(dss->ahb.base)) - return PTR_ERR(dss->ahb.base); - - dss->aux.base = dp_ioremap(pdev, 1, &dss->aux.len); - if (IS_ERR(dss->aux.base)) { - /* - * The initial binding had a single reg, but in order to - * support variation in the sub-region sizes this was split. - * dp_ioremap() will fail with -EINVAL here if only a single - * reg is specified, so fill in the sub-region offsets and - * lengths based on this single region. - */ - if (PTR_ERR(dss->aux.base) == -EINVAL) { - if (dss->ahb.len < DP_DEFAULT_P0_OFFSET + DP_DEFAULT_P0_SIZE) { - DRM_ERROR("legacy memory region not large enough\n"); - return -EINVAL; - } - - dss->ahb.len = DP_DEFAULT_AHB_SIZE; - dss->aux.base = dss->ahb.base + DP_DEFAULT_AUX_OFFSET; - dss->aux.len = DP_DEFAULT_AUX_SIZE; - dss->link.base = dss->ahb.base + DP_DEFAULT_LINK_OFFSET; - dss->link.len = DP_DEFAULT_LINK_SIZE; - dss->p0.base = dss->ahb.base + DP_DEFAULT_P0_OFFSET; - dss->p0.len = DP_DEFAULT_P0_SIZE; - } else { - DRM_ERROR("unable to remap aux region: %pe\n", dss->aux.base); - return PTR_ERR(dss->aux.base); - } - } else { - dss->link.base = dp_ioremap(pdev, 2, &dss->link.len); - if (IS_ERR(dss->link.base)) { - DRM_ERROR("unable to remap link region: %pe\n", dss->link.base); - return PTR_ERR(dss->link.base); - } - - dss->p0.base = dp_ioremap(pdev, 3, &dss->p0.len); - if (IS_ERR(dss->p0.base)) { - DRM_ERROR("unable to remap p0 region: %pe\n", dss->p0.base); - return PTR_ERR(dss->p0.base); - } - } - io->phy = devm_phy_get(&pdev->dev, "dp"); - if (IS_ERR(io->phy)) - return PTR_ERR(io->phy); + parser->phy = devm_phy_get(&pdev->dev, "dp"); + if (IS_ERR(parser->phy)) + return PTR_ERR(parser->phy); return 0; } diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h index b28052e87101..1e2ca4efb029 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ b/drivers/gpu/drm/msm/dp/dp_parser.h @@ -14,37 +14,16 @@ #define DP_MAX_NUM_DP_LANES 4 #define DP_LINK_RATE_HBR2 540000 /* kbytes */ -struct dss_io_region { - size_t len; - void __iomem *base; -}; - -struct dss_io_data { - struct dss_io_region ahb; - struct dss_io_region aux; - struct dss_io_region link; - struct dss_io_region p0; -}; - -/** - * struct dp_ctrl_resource - controller's IO related data - * - * @dp_controller: Display Port controller mapped memory address - * @phy_io: phy's mapped memory address - */ -struct dp_io { - struct dss_io_data dp_controller; - struct phy *phy; -}; - /** * struct dp_parser - DP parser's data exposed to clients * * @pdev: platform data of the client + * @io: Display Port controller mapped memory address + * @phy: PHY handle */ struct dp_parser { struct platform_device *pdev; - struct dp_io io; + struct phy *phy; u32 max_dp_lanes; u32 max_dp_link_rate; struct drm_bridge *next_bridge; From patchwork Sun Dec 31 00:44:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13507080 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CD5E7C46CD2 for ; Sun, 31 Dec 2023 00:44:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E6BC410E169; Sun, 31 Dec 2023 00:44:24 +0000 (UTC) Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 10CB110E0F8 for ; Sun, 31 Dec 2023 00:44:08 +0000 (UTC) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-50e7b51b0ceso4515927e87.1 for ; Sat, 30 Dec 2023 16:44:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703983446; x=1704588246; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=YmzxiDtfIj9ufHxF00tEh02Gm3cNvE43DWsuO5/QTNA=; b=qXut0HMK0r3X30CMzObD94tIVaNWmA3iFVdFBFeZMBNy/3Ojk/4r57Kt0Q3buV9lRm nWe+cpogKcb9DlYoUCVMyn+SkeZnLfSVrFIzg4VPsEE3ct96AkMwU1hwtShYvDUKfk0B RItFbs11A4PSelzfgBWXJy51IMnfvZbz4eZwBgtbPATz8eRBvUdli5kfDgUcndUUA3ky yeQSyZ1A2zC+z1zIl4A4H7iG4tlBISYAfK1EiFF36I4vWDbMBUHr8BQiMXfq7iw3wASg +rpgLCQeZIvibZzcShchjvHz9T8gwLauiGvH6tKhjsGrQoo0UKvuKB3Jhy0cSafJnWA0 hIbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703983446; x=1704588246; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YmzxiDtfIj9ufHxF00tEh02Gm3cNvE43DWsuO5/QTNA=; b=X0DOiz3QFJIuNPBWAfNULXQdN7a9Sruignx4OnchQwsHI3s/arA83054v3MgAhJr+q jA33fQkxW2d1K4SgSTu35xHiCGJ5OB9MFP5SDHOsAU1QPG7zcAbaUMruiQLx6rrlRUQM nM6ivstMlW9CRJuXWJFsts0oPJGxDpJaH/uX5eM0vBDBBKCk+14ITnNi2kW03Rr2jXOB qs9Crl38pRThxzGuGYGQao2xpdSXzH/6ipeRQZmmR4XbPBL+nGRnq/vmubT1B4SBuOBF 2zLCGHQK0xi5EhY1uHJK+lzCSQnwFqfRVYxEbzG09/jXXbdEv7Kc44yPc/hrsYrpnJPf l57w== X-Gm-Message-State: AOJu0YzuQMO0zfWRpH68j7IPWjnGZJz+u9b99lwC6zjzuPZrHytPCcsP XckAdmY4qTwSUabGa+OfYH0XpwQnM9Qp0Q== X-Google-Smtp-Source: AGHT+IEFDu++j9wwDKrWytuUZnRSvpg4SN5GmtQAwI5911iEJdNvaGxrORHrc6uD5vO2CUCXzhzW3w== X-Received: by 2002:a05:6512:38c1:b0:50e:5770:718b with SMTP id p1-20020a05651238c100b0050e5770718bmr6978860lft.11.1703983446410; Sat, 30 Dec 2023 16:44:06 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id n13-20020a05651203ed00b0050e84be8127sm1295995lfq.101.2023.12.30.16.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 16:44:06 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 31 Dec 2023 02:44:00 +0200 Subject: [PATCH v2 13/15] drm/msm/dp: move link property handling to dp_panel MIME-Version: 1.0 Message-Id: <20231231-dp-power-parser-cleanup-v2-13-fc3e902a6f5b@linaro.org> References: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> In-Reply-To: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , Stephen Boyd X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=7400; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=a/dqsh/DEIltXYPrbLQ9upGy63erTmReZAb/0kas5zo=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlkLlLbKm4jpRfV1QaZHTjtUtMkgLsC0pnYhLWm EUxcOt3ekiJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZZC5SwAKCRCLPIo+Aiko 1R/VB/9TF7J/kg40388SB1VD/yMYThWvCMxBT2xUbF2kMh/J0NPG+kpNi73HlrsjblnchlXY4Dp xXcXftnoBrz+zEOrAg0PhyTD8AkR3F6c5LgtwzaH9OLv03yq6opWB6vJxWlc/vtrFr9iLswpxLe 6At8qRY6nKSvbVCWmBAMVloI6N/MxAjSnTjVbZWNufhPn5PZVDqCcluguDKaVwhNDhgkIOnJ72p kNHnwbmqi66Ej5JubjHA454QaNxIBFv3Ijs9d2xUYdSxTzCeG/ZElVPRkZBiHHV2cW0RgHQWfNK L1leUnonPCxtafmEO0hlc7O8sKQ9A6HIhu8fTBN4ivPgr+6K X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: Konrad Dybcio , linux-arm-msm@vger.kernel.org, Bjorn Andersson , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Instead of passing link properties through the separate struct, parse them directly in the dp_panel. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_display.c | 8 ----- drivers/gpu/drm/msm/dp/dp_display.h | 1 - drivers/gpu/drm/msm/dp/dp_panel.c | 66 +++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/msm/dp/dp_parser.c | 54 ------------------------------ drivers/gpu/drm/msm/dp/dp_parser.h | 4 --- 5 files changed, 66 insertions(+), 67 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 5ad96989c5f2..f19cb8c7e8cb 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -356,12 +356,6 @@ static int dp_display_process_hpd_high(struct dp_display_private *dp) int rc = 0; struct edid *edid; - dp->panel->max_dp_lanes = dp->parser->max_dp_lanes; - dp->panel->max_dp_link_rate = dp->parser->max_dp_link_rate; - - drm_dbg_dp(dp->drm_dev, "max_lanes=%d max_link_rate=%d\n", - dp->panel->max_dp_lanes, dp->panel->max_dp_link_rate); - rc = dp_panel_read_sink_caps(dp->panel, dp->dp_display.connector); if (rc) goto end; @@ -381,8 +375,6 @@ static int dp_display_process_hpd_high(struct dp_display_private *dp) dp->audio_supported = drm_detect_monitor_audio(edid); dp_panel_handle_sink_request(dp->panel); - dp->dp_display.max_dp_lanes = dp->parser->max_dp_lanes; - /* * set sink to normal operation mode -- D0 * before dpcd read diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h index 102f3507d824..70759dd1bfd0 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.h +++ b/drivers/gpu/drm/msm/dp/dp_display.h @@ -28,7 +28,6 @@ struct msm_dp { bool wide_bus_en; - u32 max_dp_lanes; struct dp_audio *dp_audio; bool psr_supported; }; diff --git a/drivers/gpu/drm/msm/dp/dp_panel.c b/drivers/gpu/drm/msm/dp/dp_panel.c index 127f6af995cd..8242541a81b9 100644 --- a/drivers/gpu/drm/msm/dp/dp_panel.c +++ b/drivers/gpu/drm/msm/dp/dp_panel.c @@ -7,8 +7,12 @@ #include #include +#include #include +#define DP_MAX_NUM_DP_LANES 4 +#define DP_LINK_RATE_HBR2 540000 /* kbytes */ + struct dp_panel_private { struct device *dev; struct drm_device *drm_dev; @@ -138,6 +142,9 @@ int dp_panel_read_sink_caps(struct dp_panel *dp_panel, panel = container_of(dp_panel, struct dp_panel_private, dp_panel); + drm_dbg_dp(panel->drm_dev, "max_lanes=%d max_link_rate=%d\n", + dp_panel->max_dp_lanes, dp_panel->max_dp_link_rate); + rc = dp_panel_read_dpcd(dp_panel); if (rc) { DRM_ERROR("read dpcd failed %d\n", rc); @@ -386,10 +393,65 @@ int dp_panel_init_panel_info(struct dp_panel *dp_panel) return 0; } +static u32 dp_panel_link_frequencies(struct device_node *of_node) +{ + struct device_node *endpoint; + u64 frequency = 0; + int cnt; + + endpoint = of_graph_get_endpoint_by_regs(of_node, 1, 0); /* port@1 */ + if (!endpoint) + return 0; + + cnt = of_property_count_u64_elems(endpoint, "link-frequencies"); + + if (cnt > 0) + of_property_read_u64_index(endpoint, "link-frequencies", + cnt - 1, &frequency); + of_node_put(endpoint); + + do_div(frequency, + 10 * /* from symbol rate to link rate */ + 1000); /* kbytes */ + + return frequency; +} + +static int dp_panel_parse_dt(struct dp_panel *dp_panel) +{ + struct dp_panel_private *panel; + struct device_node *of_node; + int cnt; + + panel = container_of(dp_panel, struct dp_panel_private, dp_panel); + of_node = panel->dev->of_node; + + /* + * data-lanes is the property of dp_out endpoint + */ + cnt = drm_of_get_data_lanes_count_ep(of_node, 1, 0, 1, DP_MAX_NUM_DP_LANES); + if (cnt < 0) { + /* legacy code, data-lanes is the property of mdss_dp node */ + cnt = drm_of_get_data_lanes_count(of_node, 1, DP_MAX_NUM_DP_LANES); + } + + if (cnt > 0) + dp_panel->max_dp_lanes = cnt; + else + dp_panel->max_dp_lanes = DP_MAX_NUM_DP_LANES; /* 4 lanes */ + + dp_panel->max_dp_link_rate = dp_panel_link_frequencies(of_node); + if (!dp_panel->max_dp_link_rate) + dp_panel->max_dp_link_rate = DP_LINK_RATE_HBR2; + + return 0; +} + struct dp_panel *dp_panel_get(struct dp_panel_in *in) { struct dp_panel_private *panel; struct dp_panel *dp_panel; + int ret; if (!in->dev || !in->catalog || !in->aux || !in->link) { DRM_ERROR("invalid input\n"); @@ -408,6 +470,10 @@ struct dp_panel *dp_panel_get(struct dp_panel_in *in) dp_panel = &panel->dp_panel; dp_panel->max_bw_code = DP_LINK_BW_8_1; + ret = dp_panel_parse_dt(dp_panel); + if (ret) + return ERR_PTR(ret); + return dp_panel; } diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index 2d0dd4353cdf..aa135d5cedbd 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -24,56 +24,6 @@ static int dp_parser_ctrl_res(struct dp_parser *parser) return 0; } -static u32 dp_parser_link_frequencies(struct device_node *of_node) -{ - struct device_node *endpoint; - u64 frequency = 0; - int cnt; - - endpoint = of_graph_get_endpoint_by_regs(of_node, 1, 0); /* port@1 */ - if (!endpoint) - return 0; - - cnt = of_property_count_u64_elems(endpoint, "link-frequencies"); - - if (cnt > 0) - of_property_read_u64_index(endpoint, "link-frequencies", - cnt - 1, &frequency); - of_node_put(endpoint); - - do_div(frequency, - 10 * /* from symbol rate to link rate */ - 1000); /* kbytes */ - - return frequency; -} - -static int dp_parser_misc(struct dp_parser *parser) -{ - struct device_node *of_node = parser->pdev->dev.of_node; - int cnt; - - /* - * data-lanes is the property of dp_out endpoint - */ - cnt = drm_of_get_data_lanes_count_ep(of_node, 1, 0, 1, DP_MAX_NUM_DP_LANES); - if (cnt < 0) { - /* legacy code, data-lanes is the property of mdss_dp node */ - cnt = drm_of_get_data_lanes_count(of_node, 1, DP_MAX_NUM_DP_LANES); - } - - if (cnt > 0) - parser->max_dp_lanes = cnt; - else - parser->max_dp_lanes = DP_MAX_NUM_DP_LANES; /* 4 lanes */ - - parser->max_dp_link_rate = dp_parser_link_frequencies(of_node); - if (!parser->max_dp_link_rate) - parser->max_dp_link_rate = DP_LINK_RATE_HBR2; - - return 0; -} - int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser) { struct platform_device *pdev = parser->pdev; @@ -101,10 +51,6 @@ static int dp_parser_parse(struct dp_parser *parser) if (rc) return rc; - rc = dp_parser_misc(parser); - if (rc) - return rc; - return 0; } diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h index 1e2ca4efb029..bc56e0e8c446 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ b/drivers/gpu/drm/msm/dp/dp_parser.h @@ -11,8 +11,6 @@ #include "msm_drv.h" #define DP_MAX_PIXEL_CLK_KHZ 675000 -#define DP_MAX_NUM_DP_LANES 4 -#define DP_LINK_RATE_HBR2 540000 /* kbytes */ /** * struct dp_parser - DP parser's data exposed to clients @@ -24,8 +22,6 @@ struct dp_parser { struct platform_device *pdev; struct phy *phy; - u32 max_dp_lanes; - u32 max_dp_link_rate; struct drm_bridge *next_bridge; }; From patchwork Sun Dec 31 00:44:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13507074 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EFA1CC47073 for ; Sun, 31 Dec 2023 00:44:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C919E10E0FA; Sun, 31 Dec 2023 00:44:11 +0000 (UTC) Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD5B510E0E2 for ; Sun, 31 Dec 2023 00:44:08 +0000 (UTC) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-50e7aed08f4so4590645e87.0 for ; Sat, 30 Dec 2023 16:44:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703983447; x=1704588247; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=bXNUAPUyws9nRp+7b+SgQf1i68d95gYxHEa6JErERqE=; b=kX8hpu92nuokQmNpmRb67LY+P7LjAIYVS6Dsw7Oqu05dJ/1o09C5Fz1QxbLfqStugy BI3Hu30XiY33MwVpeEh7Grmdbre4AAusDvrEacO93NWN91AsMsKLYDVKDXR4kkN42h2z Bzn2PU5doe9431djbnYionLKT3TtvqvZ+ci01+6rJftNFChlOg4DaY3OaDOlYYxRiruw Re/C7J26gO6TsXcdy+8aQy0UeuOTJtPJ6ZjZLL6ZHUxfpO3zHMctckI9rALuDqZ2sQVv 2iTejjRF4IQkeHnkCb6jFgRL1Fde4hEnVhGSssB2HG+EKFAEsJr248Ao9BadNM7AJ/KQ 7Zhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703983447; x=1704588247; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bXNUAPUyws9nRp+7b+SgQf1i68d95gYxHEa6JErERqE=; b=eM7bZiWANVh1L1IVHHGeG2qS3dDo4rLn44pN8sxMoxkd0UoPuA/pmXSaCKkwqKMRIp 5RqDXyq0aIj7+9zmkZeOTx1PH6hAMYOV37PMM/OsO9yLj4jARHhhzmOSNsUzl3OZwyt8 5aR5vgPLcKeENuhKqgBuFI74ETx/P1PjSKHdqtvYaF8DfrbkGw/VJArLIxrW9dihnWn/ 4FZixWOjqALrb9FX7mZsbLs5Wu5Sl6coHNpF3HHhJzZ5aEIAUHzLcxNpbDYWGSFrA03q +NrX2qD5ftQUL9q4yNbX6yV44oeTldDuPZxn0XF1YgQ1fAMiIXAYkRF+2GUd8fVeVufP j5tg== X-Gm-Message-State: AOJu0YyinNlIPP+qQte3n2lyrYT2kHxVnW9PC9dV5s6tMebdnslZfu6r oJCyY2ulE+HE8O4U5uCJHDmvQku4585NAg== X-Google-Smtp-Source: AGHT+IF3iJzT8BeiySgqwzDdIVv+O23SqQQaXFoEHjt878qwWaWYVWSdFrqdk9cXJN7a0NbACW7w7A== X-Received: by 2002:a05:6512:3d1e:b0:50e:778e:d525 with SMTP id d30-20020a0565123d1e00b0050e778ed525mr7993261lfv.29.1703983447080; Sat, 30 Dec 2023 16:44:07 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id n13-20020a05651203ed00b0050e84be8127sm1295995lfq.101.2023.12.30.16.44.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 16:44:06 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 31 Dec 2023 02:44:01 +0200 Subject: [PATCH v2 14/15] drm/msm/dp: move next_bridge handling to dp_display MIME-Version: 1.0 Message-Id: <20231231-dp-power-parser-cleanup-v2-14-fc3e902a6f5b@linaro.org> References: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> In-Reply-To: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , Stephen Boyd X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=4225; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Av5WVteP7ncWawE8RZ3W1B+eFtmDOi/cz6ZeobkOPuo=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBlkLlLmaGU3QPxUUVm4mCRDYiPBHshmXOC694rh ycUy/9jr4CJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZZC5SwAKCRCLPIo+Aiko 1Xr4B/9Al/MB7TRr66l3Vz3E2PofDpDX02FtxReaTE7CcUulRVxXPsANXlGUKfOuCHFR6m4Dqzg XJzDrdOpIcdP/TnrpWJ/XEywyBlzC+LzamMz9g/zd6JQi988nvY8hNUrE3QidjGdeYWDHxsC25i 1eVk1UWZTx6whasg1t8A1natoRZpl0Gvb79CXxXK5OwzXrSZ09VL0O5pzVzbCpGZcLvbuQkelDo ysPd5F1Ocmy7GrdvWS+4o3DzYHgbmYkGbmRnFQg/Y5ooD1s0yCvFt6Q/2VdXWXw47FuJLUXPTUu nmUIimkS/WWv+h8+oiBvB1VrHbKRrT8kxdTP/TNF79AH0/4C X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: Konrad Dybcio , linux-arm-msm@vger.kernel.org, Bjorn Andersson , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Remove two levels of indirection and fetch next bridge directly in dp_display_probe_tail(). Signed-off-by: Dmitry Baryshkov Reviewed-by: Konrad Dybcio --- drivers/gpu/drm/msm/dp/dp_display.c | 42 ++++++++++++------------------------- drivers/gpu/drm/msm/dp/dp_parser.c | 14 ------------- drivers/gpu/drm/msm/dp/dp_parser.h | 14 ------------- 3 files changed, 13 insertions(+), 57 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index f19cb8c7e8cb..03e9c5c3bd46 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -1195,16 +1195,24 @@ static const struct msm_dp_desc *dp_display_get_desc(struct platform_device *pde return NULL; } -static int dp_display_get_next_bridge(struct msm_dp *dp); - static int dp_display_probe_tail(struct device *dev) { struct msm_dp *dp = dev_get_drvdata(dev); int ret; - ret = dp_display_get_next_bridge(dp); - if (ret) - return ret; + /* + * External bridges are mandatory for eDP interfaces: one has to + * provide at least an eDP panel (which gets wrapped into panel-bridge). + * + * For DisplayPort interfaces external bridges are optional, so + * silently ignore an error if one is not present (-ENODEV). + */ + dp->next_bridge = devm_drm_of_get_bridge(&dp->pdev->dev, dp->pdev->dev.of_node, 1, 0); + if (IS_ERR(dp->next_bridge)) { + ret = PTR_ERR(dp->next_bridge); + if (dp->is_edp || ret != -ENODEV) + return ret; + } ret = component_add(dev, &dp_display_comp_ops); if (ret) @@ -1397,30 +1405,6 @@ void dp_display_debugfs_init(struct msm_dp *dp_display, struct dentry *root, boo } } -static int dp_display_get_next_bridge(struct msm_dp *dp) -{ - int rc; - struct dp_display_private *dp_priv; - - dp_priv = container_of(dp, struct dp_display_private, dp_display); - - /* - * External bridges are mandatory for eDP interfaces: one has to - * provide at least an eDP panel (which gets wrapped into panel-bridge). - * - * For DisplayPort interfaces external bridges are optional, so - * silently ignore an error if one is not present (-ENODEV). - */ - rc = devm_dp_parser_find_next_bridge(&dp->pdev->dev, dp_priv->parser); - if (!dp->is_edp && rc == -ENODEV) - return 0; - - if (!rc) - dp->next_bridge = dp_priv->parser->next_bridge; - - return rc; -} - int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, struct drm_encoder *encoder) { diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index aa135d5cedbd..f95ab3c5c72c 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -24,20 +24,6 @@ static int dp_parser_ctrl_res(struct dp_parser *parser) return 0; } -int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser) -{ - struct platform_device *pdev = parser->pdev; - struct drm_bridge *bridge; - - bridge = devm_drm_of_get_bridge(dev, pdev->dev.of_node, 1, 0); - if (IS_ERR(bridge)) - return PTR_ERR(bridge); - - parser->next_bridge = bridge; - - return 0; -} - static int dp_parser_parse(struct dp_parser *parser) { int rc = 0; diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h index bc56e0e8c446..2b39b1c394ae 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ b/drivers/gpu/drm/msm/dp/dp_parser.h @@ -22,7 +22,6 @@ struct dp_parser { struct platform_device *pdev; struct phy *phy; - struct drm_bridge *next_bridge; }; /** @@ -38,17 +37,4 @@ struct dp_parser { */ struct dp_parser *dp_parser_get(struct platform_device *pdev); -/** - * devm_dp_parser_find_next_bridge() - find an additional bridge to DP - * - * @dev: device to tie bridge lifetime to - * @parser: dp_parser data from client - * - * This function is used to find any additional bridge attached to - * the DP controller. The eDP interface requires a panel bridge. - * - * Return: 0 if able to get the bridge, otherwise negative errno for failure. - */ -int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser); - #endif From patchwork Sun Dec 31 00:44:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13507073 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 683ADC46CD2 for ; Sun, 31 Dec 2023 00:44:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A8EE610E0F8; Sun, 31 Dec 2023 00:44:11 +0000 (UTC) Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9C1B210E0E2 for ; Sun, 31 Dec 2023 00:44:09 +0000 (UTC) Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2cca8eb0509so66856431fa.3 for ; Sat, 30 Dec 2023 16:44:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703983448; x=1704588248; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=GfYzeOHgcS5rMFRaftvfFpeZQ1V5yhlJ0V9zRKLNji8=; b=OlEGynb3LuoZinXJ9AtMFiXh1TeIn/xBOfiK4J5uZ3RiOBvVXevo+GvcprXQSbUaRU WH3CU7adKMYxucEm/WYWH8eTqVTxSXM4eMFJBnpbgFrBdRaeXkKLHBsoKGYGG7mS6VX+ x78h2j0FVffjJRFZ2J8DVIol5LHSfQ9uV7ea0ypc6Yp/vL2Dakpbwzd2wCpLFheJQdHA E5710sHGFgPYIU4ELRlPXPV8R65xk39EDKwIPkGfeMdrlZL4aPfzrQmFhEEbNFBb4xS6 lYyXJGotg0j4mtMtxdUyxMvkzfjlltd0E9FLC6JZvgVAtvHTLnoUNUywCtb29TYdCPgJ KoMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703983448; x=1704588248; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GfYzeOHgcS5rMFRaftvfFpeZQ1V5yhlJ0V9zRKLNji8=; b=A1BNt7ujsTznEeTNQXZQp3LrJQg4rxIocK8RSFL0BCpDD6boNZUjVsRoFKRp92tHca orCFOXKRCZQ/gxIOZQS3H29GLi3adiKjZr3ksIcVmyvlo4/9va9Hshs20BxTqXcfA/1o HoCMva+smzBPtia2pB6bx32sxgvknqy3kq+/IxcL3vMKRUqqFJY4Je0ap4A07lG3+Bxh hbTB3zbGJmNaLivPSCV+Ni1M7r7K9rEUcMfdrkRQpKFADokc5iTsq+dZxG5IA8shNb2x GhJbyDTezMjGM4Fs64/B4sDcWBJET2IKrO8C7S7ez/txc+NyMvJV4bv+gzAbGepdgPhL LCRw== X-Gm-Message-State: AOJu0YwgHDH2lFl0LJJZEb//lUWE4qOnaIWZQq2cVoCkaQrpbf7a+578 yDTftAF7Ymb0rAQuV9E4knDGL5tbGzgzPQ== X-Google-Smtp-Source: AGHT+IFySGzQRGCSjG6ixBApkOm4Lcta1ozEWXk5N6wglQTrBh35tc4J3enyNJ4mmr9B72346GKhiA== X-Received: by 2002:ac2:548b:0:b0:50e:1a9f:3c36 with SMTP id t11-20020ac2548b000000b0050e1a9f3c36mr5745924lfk.15.1703983447955; Sat, 30 Dec 2023 16:44:07 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id n13-20020a05651203ed00b0050e84be8127sm1295995lfq.101.2023.12.30.16.44.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 16:44:07 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 31 Dec 2023 02:44:02 +0200 Subject: [PATCH v2 15/15] drm/msm/dp: drop dp_parser MIME-Version: 1.0 Message-Id: <20231231-dp-power-parser-cleanup-v2-15-fc3e902a6f5b@linaro.org> References: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> In-Reply-To: <20231231-dp-power-parser-cleanup-v2-0-fc3e902a6f5b@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Kuogee Hsieh , Stephen Boyd X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=8110; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=TOKAUj7wqAQ9xZhC70Z8FjrR1dl4xCheaCIfCLWs5m0=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ+qEnd4mH14Uu/WZ52axRwgVzrnncZRNVk659HH2idMOs 9rChfZ3MhqzMDByMciKKbL4FLRMjdmUHPZhx9R6mEGsTCBTGLg4BWAi6y+y/4/f9tGpSe7bs8WP ZReq8/PEc5VLWFSvz7uedLDtjX2b6MQJWbf/z41R9Uhp33s8UOai1vqbSRGrFq+8Ijjpd5VzWeM iMatr/CqCirOizZPlapVCAh/nHd+3rEbr/HXrs6L3ghJlzNlVtPQ4D4ZZmKUeeHWlZ4ma54ST7f tbVnPuOXj57qaTnx8eZ9w+a7+pgYxOdk9rnGVA/ssZM5tm+7SU3Dj47oHFs5aQg7c21novm9mv2 ipk0xwW+4P5xrIm5v/KWXuuia45Ev5/X3yEAYf/TWllmbtJNiW8Jt25gdZxikFFbkXXoiRrVXfY dJSfflbL/alFKVlPsr1If69C0e4j9dyXBZiE7bniFDcCAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: Konrad Dybcio , linux-arm-msm@vger.kernel.org, Bjorn Andersson , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Finally drop separate "parsing" submodule. There is no need in it anymore. All submodules handle DT properties directly rather than passing them via the separate structure pointer. Signed-off-by: Dmitry Baryshkov Reviewed-by: Konrad Dybcio --- drivers/gpu/drm/msm/Makefile | 1 - drivers/gpu/drm/msm/dp/dp_aux.h | 1 + drivers/gpu/drm/msm/dp/dp_catalog.h | 1 - drivers/gpu/drm/msm/dp/dp_ctrl.h | 3 +- drivers/gpu/drm/msm/dp/dp_debug.c | 1 - drivers/gpu/drm/msm/dp/dp_display.c | 18 +++++------ drivers/gpu/drm/msm/dp/dp_display.h | 2 ++ drivers/gpu/drm/msm/dp/dp_parser.c | 61 ------------------------------------- drivers/gpu/drm/msm/dp/dp_parser.h | 40 ------------------------ 9 files changed, 12 insertions(+), 116 deletions(-) diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile index 8dbdf3fba69e..543e04fa72e3 100644 --- a/drivers/gpu/drm/msm/Makefile +++ b/drivers/gpu/drm/msm/Makefile @@ -127,7 +127,6 @@ msm-$(CONFIG_DRM_MSM_DP)+= dp/dp_aux.o \ dp/dp_drm.o \ dp/dp_link.o \ dp/dp_panel.o \ - dp/dp_parser.o \ dp/dp_audio.o msm-$(CONFIG_DRM_FBDEV_EMULATION) += msm_fbdev.o diff --git a/drivers/gpu/drm/msm/dp/dp_aux.h b/drivers/gpu/drm/msm/dp/dp_aux.h index 16d9b1758748..f47d591c1f54 100644 --- a/drivers/gpu/drm/msm/dp/dp_aux.h +++ b/drivers/gpu/drm/msm/dp/dp_aux.h @@ -16,6 +16,7 @@ void dp_aux_init(struct drm_dp_aux *dp_aux); void dp_aux_deinit(struct drm_dp_aux *dp_aux); void dp_aux_reconfig(struct drm_dp_aux *dp_aux); +struct phy; struct drm_dp_aux *dp_aux_get(struct device *dev, struct dp_catalog *catalog, struct phy *phy, bool is_edp); diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h b/drivers/gpu/drm/msm/dp/dp_catalog.h index 989e4c4fd6fa..a724a986b6ee 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.h +++ b/drivers/gpu/drm/msm/dp/dp_catalog.h @@ -8,7 +8,6 @@ #include -#include "dp_parser.h" #include "disp/msm_disp_snapshot.h" /* interrupts */ diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.h b/drivers/gpu/drm/msm/dp/dp_ctrl.h index 6e9f375b856a..fa014cee7e21 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.h +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.h @@ -9,7 +9,6 @@ #include "dp_aux.h" #include "dp_panel.h" #include "dp_link.h" -#include "dp_parser.h" #include "dp_catalog.h" struct dp_ctrl { @@ -17,6 +16,8 @@ struct dp_ctrl { bool wide_bus_en; }; +struct phy; + int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl); int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train); void dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl); diff --git a/drivers/gpu/drm/msm/dp/dp_debug.c b/drivers/gpu/drm/msm/dp/dp_debug.c index 6c281dc095b9..ac68554801a4 100644 --- a/drivers/gpu/drm/msm/dp/dp_debug.c +++ b/drivers/gpu/drm/msm/dp/dp_debug.c @@ -9,7 +9,6 @@ #include #include -#include "dp_parser.h" #include "dp_catalog.h" #include "dp_aux.h" #include "dp_ctrl.h" diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 03e9c5c3bd46..5df6d9761c31 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -9,12 +9,12 @@ #include #include #include +#include #include #include #include "msm_drv.h" #include "msm_kms.h" -#include "dp_parser.h" #include "dp_ctrl.h" #include "dp_catalog.h" #include "dp_aux.h" @@ -87,7 +87,6 @@ struct dp_display_private { struct drm_device *drm_dev; struct dentry *root; - struct dp_parser *parser; struct dp_catalog *catalog; struct drm_dp_aux *aux; struct dp_link *link; @@ -704,14 +703,11 @@ static int dp_init_sub_modules(struct dp_display_private *dp) struct dp_panel_in panel_in = { .dev = dev, }; + struct phy *phy; - dp->parser = dp_parser_get(dp->dp_display.pdev); - if (IS_ERR(dp->parser)) { - rc = PTR_ERR(dp->parser); - DRM_ERROR("failed to initialize parser, rc = %d\n", rc); - dp->parser = NULL; - goto error; - } + phy = devm_phy_get(dev, "dp"); + if (IS_ERR(phy)) + return PTR_ERR(phy); dp->catalog = dp_catalog_get(dev); if (IS_ERR(dp->catalog)) { @@ -722,7 +718,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp) } dp->aux = dp_aux_get(dev, dp->catalog, - dp->parser->phy, + phy, dp->dp_display.is_edp); if (IS_ERR(dp->aux)) { rc = PTR_ERR(dp->aux); @@ -753,7 +749,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp) dp->ctrl = dp_ctrl_get(dev, dp->link, dp->panel, dp->aux, dp->catalog, - dp->parser->phy); + phy); if (IS_ERR(dp->ctrl)) { rc = PTR_ERR(dp->ctrl); DRM_ERROR("failed to initialize ctrl, rc = %d\n", rc); diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h index 70759dd1bfd0..234dada88687 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.h +++ b/drivers/gpu/drm/msm/dp/dp_display.h @@ -10,6 +10,8 @@ #include #include "disp/msm_disp_snapshot.h" +#define DP_MAX_PIXEL_CLK_KHZ 675000 + struct msm_dp { struct drm_device *drm_dev; struct platform_device *pdev; diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c deleted file mode 100644 index f95ab3c5c72c..000000000000 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ /dev/null @@ -1,61 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. - */ - -#include -#include - -#include -#include -#include - -#include "dp_parser.h" -#include "dp_reg.h" - -static int dp_parser_ctrl_res(struct dp_parser *parser) -{ - struct platform_device *pdev = parser->pdev; - - parser->phy = devm_phy_get(&pdev->dev, "dp"); - if (IS_ERR(parser->phy)) - return PTR_ERR(parser->phy); - - return 0; -} - -static int dp_parser_parse(struct dp_parser *parser) -{ - int rc = 0; - - if (!parser) { - DRM_ERROR("invalid input\n"); - return -EINVAL; - } - - rc = dp_parser_ctrl_res(parser); - if (rc) - return rc; - - return 0; -} - -struct dp_parser *dp_parser_get(struct platform_device *pdev) -{ - struct dp_parser *parser; - int ret; - - parser = devm_kzalloc(&pdev->dev, sizeof(*parser), GFP_KERNEL); - if (!parser) - return ERR_PTR(-ENOMEM); - - parser->pdev = pdev; - - ret = dp_parser_parse(parser); - if (ret) { - dev_err(&pdev->dev, "device tree parsing failed\n"); - return ERR_PTR(ret); - } - - return parser; -} diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h deleted file mode 100644 index 2b39b1c394ae..000000000000 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ /dev/null @@ -1,40 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. - */ - -#ifndef _DP_PARSER_H_ -#define _DP_PARSER_H_ - -#include - -#include "msm_drv.h" - -#define DP_MAX_PIXEL_CLK_KHZ 675000 - -/** - * struct dp_parser - DP parser's data exposed to clients - * - * @pdev: platform data of the client - * @io: Display Port controller mapped memory address - * @phy: PHY handle - */ -struct dp_parser { - struct platform_device *pdev; - struct phy *phy; -}; - -/** - * dp_parser_get() - get the DP's device tree parser module - * - * @pdev: platform data of the client - * return: pointer to dp_parser structure. - * - * This function provides client capability to parse the - * device tree and populate the data structures. The data - * related to clock, regulators, pin-control and other - * can be parsed using this module. - */ -struct dp_parser *dp_parser_get(struct platform_device *pdev); - -#endif