diff mbox series

[2/5] soundwire: qcom: enable runtime pm before controller is registered

Message ID 20230209131336.18252-3-srinivas.kandagatla@linaro.org (mailing list archive)
State New, archived
Headers show
Series soundwire: qcom: stablity fixes | expand

Commit Message

Srinivas Kandagatla Feb. 9, 2023, 1:13 p.m. UTC
Registering controller even before pm runtime is enabled will result
in pm runtime underflow warnings. Fix this by properly moving
the runtime pm enable before registering controller.

Fixes: 74e79da9fd46 ("soundwire: qcom: add runtime pm support")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Pierre-Louis Bossart Feb. 9, 2023, 3:21 p.m. UTC | #1
On 2/9/23 07:13, Srinivas Kandagatla wrote:
> Registering controller even before pm runtime is enabled will result
> in pm runtime underflow warnings. Fix this by properly moving
> the runtime pm enable before registering controller.

That seems very odd. The Intel code configures the pm_runtime stuff
*after* the call to sdw_bus_master_add(), and we've not seen any
underflow warnings? We even configure pm_runtime after starting the bus.
Likewise for peripherals the pm_runtime part is enabled after the device
is initialized.

Not following the problem and suggested solution.

> Fixes: 74e79da9fd46 ("soundwire: qcom: add runtime pm support")
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  drivers/soundwire/qcom.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index 9d8ae77bad0a..b2363839624c 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
> @@ -1417,6 +1417,12 @@ static int qcom_swrm_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> +	pm_runtime_set_autosuspend_delay(dev, 3000);
> +	pm_runtime_use_autosuspend(dev);
> +	pm_runtime_mark_last_busy(dev);
> +	pm_runtime_set_active(dev);
> +	pm_runtime_enable(dev);
> +
>  	ret = sdw_bus_master_add(&ctrl->bus, dev, dev->fwnode);
>  	if (ret) {
>  		dev_err(dev, "Failed to register Soundwire controller (%d)\n",
> @@ -1435,12 +1441,6 @@ static int qcom_swrm_probe(struct platform_device *pdev)
>  		 (ctrl->version >> 24) & 0xff, (ctrl->version >> 16) & 0xff,
>  		 ctrl->version & 0xffff);
>  
> -	pm_runtime_set_autosuspend_delay(dev, 3000);
> -	pm_runtime_use_autosuspend(dev);
> -	pm_runtime_mark_last_busy(dev);
> -	pm_runtime_set_active(dev);
> -	pm_runtime_enable(dev);
> -
>  	/* Clk stop is not supported on WSA Soundwire masters */
>  	if (ctrl->version <= 0x01030000) {
>  		ctrl->clock_stop_not_supported = true;
Srinivas Kandagatla Feb. 9, 2023, 3:49 p.m. UTC | #2
On 09/02/2023 15:21, Pierre-Louis Bossart wrote:
> 
> 
> On 2/9/23 07:13, Srinivas Kandagatla wrote:
>> Registering controller even before pm runtime is enabled will result
>> in pm runtime underflow warnings. Fix this by properly moving
>> the runtime pm enable before registering controller.
> 
> That seems very odd. The Intel code configures the pm_runtime stuff
> *after* the call to sdw_bus_master_add(), and we've not seen any
> underflow warnings? We even configure pm_runtime after starting the bus.
> Likewise for peripherals the pm_runtime part is enabled after the device
> is initialized.
> 
This was very random during bootup, Let me see if I can collect a back 
trace after reverting this patch..

--srini

> Not following the problem and suggested solution.
> 
>> Fixes: 74e79da9fd46 ("soundwire: qcom: add runtime pm support")
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>> ---
>>   drivers/soundwire/qcom.c | 12 ++++++------
>>   1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
>> index 9d8ae77bad0a..b2363839624c 100644
>> --- a/drivers/soundwire/qcom.c
>> +++ b/drivers/soundwire/qcom.c
>> @@ -1417,6 +1417,12 @@ static int qcom_swrm_probe(struct platform_device *pdev)
>>   		}
>>   	}
>>   
>> +	pm_runtime_set_autosuspend_delay(dev, 3000);
>> +	pm_runtime_use_autosuspend(dev);
>> +	pm_runtime_mark_last_busy(dev);
>> +	pm_runtime_set_active(dev);
>> +	pm_runtime_enable(dev);
>> +
>>   	ret = sdw_bus_master_add(&ctrl->bus, dev, dev->fwnode);
>>   	if (ret) {
>>   		dev_err(dev, "Failed to register Soundwire controller (%d)\n",
>> @@ -1435,12 +1441,6 @@ static int qcom_swrm_probe(struct platform_device *pdev)
>>   		 (ctrl->version >> 24) & 0xff, (ctrl->version >> 16) & 0xff,
>>   		 ctrl->version & 0xffff);
>>   
>> -	pm_runtime_set_autosuspend_delay(dev, 3000);
>> -	pm_runtime_use_autosuspend(dev);
>> -	pm_runtime_mark_last_busy(dev);
>> -	pm_runtime_set_active(dev);
>> -	pm_runtime_enable(dev);
>> -
>>   	/* Clk stop is not supported on WSA Soundwire masters */
>>   	if (ctrl->version <= 0x01030000) {
>>   		ctrl->clock_stop_not_supported = true;
diff mbox series

Patch

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 9d8ae77bad0a..b2363839624c 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1417,6 +1417,12 @@  static int qcom_swrm_probe(struct platform_device *pdev)
 		}
 	}
 
+	pm_runtime_set_autosuspend_delay(dev, 3000);
+	pm_runtime_use_autosuspend(dev);
+	pm_runtime_mark_last_busy(dev);
+	pm_runtime_set_active(dev);
+	pm_runtime_enable(dev);
+
 	ret = sdw_bus_master_add(&ctrl->bus, dev, dev->fwnode);
 	if (ret) {
 		dev_err(dev, "Failed to register Soundwire controller (%d)\n",
@@ -1435,12 +1441,6 @@  static int qcom_swrm_probe(struct platform_device *pdev)
 		 (ctrl->version >> 24) & 0xff, (ctrl->version >> 16) & 0xff,
 		 ctrl->version & 0xffff);
 
-	pm_runtime_set_autosuspend_delay(dev, 3000);
-	pm_runtime_use_autosuspend(dev);
-	pm_runtime_mark_last_busy(dev);
-	pm_runtime_set_active(dev);
-	pm_runtime_enable(dev);
-
 	/* Clk stop is not supported on WSA Soundwire masters */
 	if (ctrl->version <= 0x01030000) {
 		ctrl->clock_stop_not_supported = true;