From patchwork Tue Jun 20 11:29:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 13285719 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 1A97BEB64D7 for ; Tue, 20 Jun 2023 11:30:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 89ACB10E2CA; Tue, 20 Jun 2023 11:30:12 +0000 (UTC) Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by gabe.freedesktop.org (Postfix) with ESMTPS id DED3110E17F for ; Tue, 20 Jun 2023 11:30:05 +0000 (UTC) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4f841b7a697so5575492e87.3 for ; Tue, 20 Jun 2023 04:30:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687260603; x=1689852603; 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=mvj4Ws5lfpRkepZDTp/39wphy6EdJ013fn+mBz94DMg=; b=MbGQYduFNJMlpq71oNbfIylCEuMuMKZ2l0XzU8mFm+OFEGcP3WDjjh67j0j1jC87C8 pYTHIQ/yvYrTj2pV4dMUjTJ6UTZXnbiWSQ8Bcqd5BEDSrCkiXMSYAGlCH9JFLDwe2Q7Y mFCRwPSLgLb5cvi1gzHZgJ+N4txzBsG/JA5MZbQ+3z6ZLyd9KK3U4BOT+yMswRus/yR3 rsqZMTMW3mA+7fLlIRTcYW+jhhL8ZNAl9/zAZDWhWD7YgcIAm5rWZ+XC1P5AZvvYcyyU 2uIaTnnDWx8PtkZFzMshkywp4fa254N2NrXrHNJNMC5bCB9I0vwDSuLrBYweWNSdDVKl fmSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687260603; x=1689852603; 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=mvj4Ws5lfpRkepZDTp/39wphy6EdJ013fn+mBz94DMg=; b=AW2J6CGaVJT2YnwOuxUSZPKqn4pjt9jHS3h7imv81PiAWmsegapbfzZpgIbOUQ5LDl 4ubwqRpPYQjov7EO3/q0CT2+Jp1EbTn36cGHjTg++9urp+Puo8KNfYbMX8mDYVkFwcnW bJWVA5cVGUKWWOdj7pHBpVT3Tml2ROc1l3iRavBab7q+F5tQcCWmfxN1N8ev8poJFwMA RWoje2KPMMQArhXtL+Daoqna77/F04RBW9uZOFW1coEQpo0lrFOhIfd+9l9OOtVg4Oaf 6jMnpMCmHOFPW6AW/b+Jv+NbDfQ3I4LG2QT6DZubJ/zsE8nUiekyY68dCmREMZ0dQ/zU w2RA== X-Gm-Message-State: AC+VfDwT1A59Wm5/vZ/DG4lJGr8njabLAW0mlVSizUaf2TnAYMbf2NIm wUBowJKSgiuQDLlNiL2wBAGdyA== X-Google-Smtp-Source: ACHHUZ6ED/zWchOlt8YalqHTrP43Ype8jf/mpfCxQFHrsHIEf3K8XmAOEKaItoY4Q9L1P78PA+TQUA== X-Received: by 2002:a05:6512:b0e:b0:4f8:54f3:a6c0 with SMTP id w14-20020a0565120b0e00b004f854f3a6c0mr7225414lfu.11.1687260603553; Tue, 20 Jun 2023 04:30:03 -0700 (PDT) Received: from [192.168.1.101] (abxj193.neoplus.adsl.tpnet.pl. [83.9.3.193]) by smtp.gmail.com with ESMTPSA id 8-20020ac24828000000b004eed8de597csm335709lft.32.2023.06.20.04.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 04:30:03 -0700 (PDT) From: Konrad Dybcio Date: Tue, 20 Jun 2023 13:29:58 +0200 Subject: [PATCH 1/2] drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks MIME-Version: 1.0 Message-Id: <20230620-topic-dsiphy_rpm-v1-1-446a7fd0ce43@linaro.org> References: <20230620-topic-dsiphy_rpm-v1-0-446a7fd0ce43@linaro.org> In-Reply-To: <20230620-topic-dsiphy_rpm-v1-0-446a7fd0ce43@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1687260601; l=756; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=p+WuOmdprSDjusI/rvtFLxmtLwQxfj48jFs663vX5YQ=; b=FXvuUQg/5YWokhed8hsEyalTU7MwztoQeLbEK29H7mFag8FeR7dCHiJpMDyZtqenlstrvvDDB So/552dSW3VCVmtxh0gCXhw3vbmoCQ+QGVZWY9PrHc42lkTyes+CkvM X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= 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: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Konrad Dybcio , Marijn Suijten , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This helper has been introduced to avoid programmer errors when using pm_runtime_get, use it. Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c index 9d5795c58a98..0a8e1dd4509e 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c @@ -516,7 +516,7 @@ static int dsi_phy_enable_resource(struct msm_dsi_phy *phy) struct device *dev = &phy->pdev->dev; int ret; - pm_runtime_get_sync(dev); + pm_runtime_resume_and_get(dev); ret = clk_prepare_enable(phy->ahb_clk); if (ret) { From patchwork Tue Jun 20 11:29:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 13285718 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 88802EB64DB for ; Tue, 20 Jun 2023 11:30:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D016C10E2CE; Tue, 20 Jun 2023 11:30:10 +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 747E010E2C6 for ; Tue, 20 Jun 2023 11:30:06 +0000 (UTC) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-4f86a7a5499so3618604e87.2 for ; Tue, 20 Jun 2023 04:30:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687260604; x=1689852604; 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=IWQwth2ZmkJYuqsTZ6NO6uB8o+eUJ5P2P1gJl8kPmvY=; b=XlMVVpRa4u3fhb4RQs+wh+2Y7tMaaHJBAsv4tTGoU2N7ig1FAkCYXYn4A+k5Iyu4Sq 9KGZXgAbs/GnZco6r8C3P0toXcJPX/0LqJ827XvzeiKRh31Rc/nZP90yknzlBmZjO/bV TtmyDaMZESSJRgXHfEKqBpWz2JdZS9dnM2XQnJ8pJI8EW9bPwcv5X6kkO8N4Uvl2nlwO /gNnZPjnZIkz4FNRZ+C9JdVFx6pOqswU2URrNR+W7hPok2ek8Sug89dX62uaUhY4ANT6 KA6jy5tKXwdbLrhWXsQqfOlDNVhJAX3eDEevkjgp9OeDAs8SvIHVijL3q66duaFii9g2 Qw3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687260604; x=1689852604; 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=IWQwth2ZmkJYuqsTZ6NO6uB8o+eUJ5P2P1gJl8kPmvY=; b=O1ccsvXyFimgG18+UDmdPChCpSR35WjQ4JslbZE9BSsuIlZfIt5VQnfeGTGbXrm+cG urp7o8Io73hNRwBVDMk0VwOWk2hndfdBgQnkft3hvGaPjaN1pR5fbK8cReCn51gkfwaP Nkrd5yMia3X2nsVfv3Y1Hnz7zaAK3RJ1tzz13KFCdvTbvm0bOlqXbtZnfdwWD16jZCp8 ZxQcNKSvNNNLpDQbBHFDNJ1WQjYN+f6yzDyIVyhVSaNEYAy+jlUysnJLaU8FA3AUToR0 SkVmj/20md5zPAnLuK3uCFo/8VT6ejlA1egLiGGXhiKbZ1gSqNMEwrx86x1If/m142I5 NdAQ== X-Gm-Message-State: AC+VfDyCjyMyd5usIh+sUQO7lRwFeC8S1IEzAwLPrOTofcdpO9G2o999 INrU7l2gFDu9MkmnmkFhn1K5MA== X-Google-Smtp-Source: ACHHUZ6clc6Lz3GUg0edmf5UrkMmoSlJ2/O39o0yGVunTiVcpA5+xgkN9zqt9xLWpL9WNovT/NflSw== X-Received: by 2002:a05:6512:3c4:b0:4f6:140b:743 with SMTP id w4-20020a05651203c400b004f6140b0743mr6962300lfp.25.1687260604748; Tue, 20 Jun 2023 04:30:04 -0700 (PDT) Received: from [192.168.1.101] (abxj193.neoplus.adsl.tpnet.pl. [83.9.3.193]) by smtp.gmail.com with ESMTPSA id 8-20020ac24828000000b004eed8de597csm335709lft.32.2023.06.20.04.30.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 04:30:04 -0700 (PDT) From: Konrad Dybcio Date: Tue, 20 Jun 2023 13:29:59 +0200 Subject: [PATCH 2/2] drm/msm/dsi: Enable runtime PM MIME-Version: 1.0 Message-Id: <20230620-topic-dsiphy_rpm-v1-2-446a7fd0ce43@linaro.org> References: <20230620-topic-dsiphy_rpm-v1-0-446a7fd0ce43@linaro.org> In-Reply-To: <20230620-topic-dsiphy_rpm-v1-0-446a7fd0ce43@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1687260601; l=898; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=1cWWrhlZ0Hiex7ffMzQSl8xGBl+Dmf8ZnYPKI8QvzmU=; b=Rxf/R7lwV/VjnaZUBbyleX/36anDB/8YdzqjLCTn+vLf9T4VCV1JNySe1o/sOmyE/k4Ji5ClS YtUktVaBtcuDIdwFCQSc+bxJ+0LyhfAGpALqAfUulinnaE6EVrOs42Q X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= 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: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Konrad Dybcio , Marijn Suijten , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Some devices power the DSI PHY/PLL through a power rail that we model as a GENPD. Enable runtime PM to make it suspendable. Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c index 0a8e1dd4509e..323498237ef4 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c @@ -687,6 +687,10 @@ static int dsi_phy_driver_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(phy->ahb_clk), "Unable to get ahb clk\n"); + ret = devm_pm_runtime_enable(&pdev->dev); + if (ret) + return ret; + /* PLL init will call into clk_register which requires * register access, so we need to enable power and ahb clock. */