Patch "clk: qcom: lpass-sc7180: Fix pm_runtime usage" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    clk: qcom: lpass-sc7180: Fix pm_runtime usage

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     clk-qcom-lpass-sc7180-fix-pm_runtime-usage.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 1ec4d9a7559f494d6e7cc5986ab15bf9875c1948
Author: Douglas Anderson <dianders@xxxxxxxxxxxx>
Date:   Fri Nov 4 06:56:29 2022 -0700

    clk: qcom: lpass-sc7180: Fix pm_runtime usage
    
    [ Upstream commit ff1ccf59eaffd192efe21f7de9fb0c130faf1b1b ]
    
    The sc7180 lpass clock controller's pm_runtime usage wasn't broken
    quite as spectacularly as the sc7280's pm_runtime usage, but it was
    still broken. Putting some printouts in at boot showed me this (with
    serial console enabled, which makes the prints slow and thus changes
    timing):
      [    3.109951] DOUG: my_pm_clk_resume, usage=1
      [    3.114767] DOUG: my_pm_clk_resume, usage=1
      [    3.664443] DOUG: my_pm_clk_suspend, usage=0
      [    3.897566] DOUG: my_pm_clk_suspend, usage=0
      [    3.910137] DOUG: my_pm_clk_resume, usage=1
      [    3.923217] DOUG: my_pm_clk_resume, usage=0
      [    4.440116] DOUG: my_pm_clk_suspend, usage=-1
      [    4.444982] DOUG: my_pm_clk_suspend, usage=0
      [   14.170501] DOUG: my_pm_clk_resume, usage=1
      [   14.176245] DOUG: my_pm_clk_resume, usage=0
    
    ...or this w/out serial console:
      [    0.556139] DOUG: my_pm_clk_resume, usage=1
      [    0.556279] DOUG: my_pm_clk_resume, usage=1
      [    1.058422] DOUG: my_pm_clk_suspend, usage=-1
      [    1.058464] DOUG: my_pm_clk_suspend, usage=0
      [    1.186250] DOUG: my_pm_clk_resume, usage=1
      [    1.186292] DOUG: my_pm_clk_resume, usage=0
      [    1.731536] DOUG: my_pm_clk_suspend, usage=-1
      [    1.731557] DOUG: my_pm_clk_suspend, usage=0
      [   10.288910] DOUG: my_pm_clk_resume, usage=1
      [   10.289496] DOUG: my_pm_clk_resume, usage=0
    
    It seems to be doing roughly the right sequence of calls, but just
    like with sc7280 this is more by luck than anything. Having a usage of
    -1 is just not OK.
    
    Let's fix this like we did with sc7280.
    
    Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
    Fixes: ce8c195e652f ("clk: qcom: lpasscc: Introduce pm autosuspend for SC7180")
    Reviewed-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>
    Signed-off-by: Bjorn Andersson <andersson@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221104064055.2.I49b25b9bda9430fc7ea21e5a708ca5a0aced2798@changeid
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/clk/qcom/lpasscorecc-sc7180.c b/drivers/clk/qcom/lpasscorecc-sc7180.c
index ac09b7b840ab..a5731994cbed 100644
--- a/drivers/clk/qcom/lpasscorecc-sc7180.c
+++ b/drivers/clk/qcom/lpasscorecc-sc7180.c
@@ -356,7 +356,7 @@ static const struct qcom_cc_desc lpass_audio_hm_sc7180_desc = {
 	.num_gdscs = ARRAY_SIZE(lpass_audio_hm_sc7180_gdscs),
 };
 
-static int lpass_create_pm_clks(struct platform_device *pdev)
+static int lpass_setup_runtime_pm(struct platform_device *pdev)
 {
 	int ret;
 
@@ -375,7 +375,7 @@ static int lpass_create_pm_clks(struct platform_device *pdev)
 	if (ret < 0)
 		dev_err(&pdev->dev, "failed to acquire iface clock\n");
 
-	return ret;
+	return pm_runtime_resume_and_get(&pdev->dev);
 }
 
 static int lpass_core_cc_sc7180_probe(struct platform_device *pdev)
@@ -384,7 +384,7 @@ static int lpass_core_cc_sc7180_probe(struct platform_device *pdev)
 	struct regmap *regmap;
 	int ret;
 
-	ret = lpass_create_pm_clks(pdev);
+	ret = lpass_setup_runtime_pm(pdev);
 	if (ret)
 		return ret;
 
@@ -392,12 +392,14 @@ static int lpass_core_cc_sc7180_probe(struct platform_device *pdev)
 	desc = &lpass_audio_hm_sc7180_desc;
 	ret = qcom_cc_probe_by_index(pdev, 1, desc);
 	if (ret)
-		return ret;
+		goto exit;
 
 	lpass_core_cc_sc7180_regmap_config.name = "lpass_core_cc";
 	regmap = qcom_cc_map(pdev, &lpass_core_cc_sc7180_desc);
-	if (IS_ERR(regmap))
-		return PTR_ERR(regmap);
+	if (IS_ERR(regmap)) {
+		ret = PTR_ERR(regmap);
+		goto exit;
+	}
 
 	/*
 	 * Keep the CLK always-ON
@@ -415,6 +417,7 @@ static int lpass_core_cc_sc7180_probe(struct platform_device *pdev)
 	ret = qcom_cc_really_probe(pdev, &lpass_core_cc_sc7180_desc, regmap);
 
 	pm_runtime_mark_last_busy(&pdev->dev);
+exit:
 	pm_runtime_put_autosuspend(&pdev->dev);
 
 	return ret;
@@ -425,14 +428,19 @@ static int lpass_hm_core_probe(struct platform_device *pdev)
 	const struct qcom_cc_desc *desc;
 	int ret;
 
-	ret = lpass_create_pm_clks(pdev);
+	ret = lpass_setup_runtime_pm(pdev);
 	if (ret)
 		return ret;
 
 	lpass_core_cc_sc7180_regmap_config.name = "lpass_hm_core";
 	desc = &lpass_core_hm_sc7180_desc;
 
-	return qcom_cc_probe_by_index(pdev, 0, desc);
+	ret = qcom_cc_probe_by_index(pdev, 0, desc);
+
+	pm_runtime_mark_last_busy(&pdev->dev);
+	pm_runtime_put_autosuspend(&pdev->dev);
+
+	return ret;
 }
 
 static const struct of_device_id lpass_hm_sc7180_match_table[] = {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux