* [PATCH 0/3] media: Fix pm_runtime_set_suspended() with runtime pm enabled
@ 2024-09-23 3:51 Jinjie Ruan
2024-09-23 3:51 ` [PATCH 1/3] media: i2c: dw9768: " Jinjie Ruan
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Jinjie Ruan @ 2024-09-23 3:51 UTC (permalink / raw)
To: sakari.ailus, mchehab, ming.qian, eagle.zhou, stanimir.k.varbanov,
quic_vgarodia, bryan.odonoghue, hans.verkuil, linux-media,
linux-kernel, linux-arm-msm
Cc: ruanjinjie
Fix pm_runtime_set_suspended() with runtime pm enabled.
Jinjie Ruan (3):
media: i2c: dw9768: Fix pm_runtime_set_suspended() with runtime pm
enabled
media: amphion: Fix pm_runtime_set_suspended() with runtime pm enabled
media: venus: Fix pm_runtime_set_suspended() with runtime pm enabled
drivers/media/i2c/dw9768.c | 6 +++---
drivers/media/platform/amphion/vpu_drv.c | 2 +-
drivers/media/platform/qcom/venus/core.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] media: i2c: dw9768: Fix pm_runtime_set_suspended() with runtime pm enabled
2024-09-23 3:51 [PATCH 0/3] media: Fix pm_runtime_set_suspended() with runtime pm enabled Jinjie Ruan
@ 2024-09-23 3:51 ` Jinjie Ruan
2024-11-01 8:08 ` Sakari Ailus
2024-09-23 3:51 ` [PATCH 2/3] media: amphion: " Jinjie Ruan
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Jinjie Ruan @ 2024-09-23 3:51 UTC (permalink / raw)
To: sakari.ailus, mchehab, ming.qian, eagle.zhou, stanimir.k.varbanov,
quic_vgarodia, bryan.odonoghue, hans.verkuil, linux-media,
linux-kernel, linux-arm-msm
Cc: ruanjinjie
It is not valid to call pm_runtime_set_suspended() and
pm_runtime_set_active() for devices with runtime PM enabled because it
returns -EAGAIN if it is enabled already and working. So, adjust the
order to fix it.
Fixes: 5f9a089b6de3 ("dw9768: Enable low-power probe on ACPI")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/media/i2c/dw9768.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/dw9768.c b/drivers/media/i2c/dw9768.c
index 18ef2b35c9aa..61db1e8d2727 100644
--- a/drivers/media/i2c/dw9768.c
+++ b/drivers/media/i2c/dw9768.c
@@ -471,7 +471,6 @@ static int dw9768_probe(struct i2c_client *client)
* to be powered on in an ACPI system. Similarly for power off in
* remove.
*/
- pm_runtime_enable(dev);
full_power = (is_acpi_node(dev_fwnode(dev)) &&
acpi_dev_state_d0(dev)) ||
(is_of_node(dev_fwnode(dev)) && !pm_runtime_enabled(dev));
@@ -484,6 +483,7 @@ static int dw9768_probe(struct i2c_client *client)
pm_runtime_set_active(dev);
}
+ pm_runtime_enable(dev);
ret = v4l2_async_register_subdev(&dw9768->sd);
if (ret < 0) {
dev_err(dev, "failed to register V4L2 subdev: %d", ret);
@@ -495,12 +495,12 @@ static int dw9768_probe(struct i2c_client *client)
return 0;
err_power_off:
+ pm_runtime_disable(dev);
if (full_power) {
dw9768_runtime_suspend(dev);
pm_runtime_set_suspended(dev);
}
err_clean_entity:
- pm_runtime_disable(dev);
media_entity_cleanup(&dw9768->sd.entity);
err_free_handler:
v4l2_ctrl_handler_free(&dw9768->ctrls);
@@ -517,12 +517,12 @@ static void dw9768_remove(struct i2c_client *client)
v4l2_async_unregister_subdev(&dw9768->sd);
v4l2_ctrl_handler_free(&dw9768->ctrls);
media_entity_cleanup(&dw9768->sd.entity);
+ pm_runtime_disable(dev);
if ((is_acpi_node(dev_fwnode(dev)) && acpi_dev_state_d0(dev)) ||
(is_of_node(dev_fwnode(dev)) && !pm_runtime_enabled(dev))) {
dw9768_runtime_suspend(dev);
pm_runtime_set_suspended(dev);
}
- pm_runtime_disable(dev);
}
static const struct of_device_id dw9768_of_table[] = {
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] media: amphion: Fix pm_runtime_set_suspended() with runtime pm enabled
2024-09-23 3:51 [PATCH 0/3] media: Fix pm_runtime_set_suspended() with runtime pm enabled Jinjie Ruan
2024-09-23 3:51 ` [PATCH 1/3] media: i2c: dw9768: " Jinjie Ruan
@ 2024-09-23 3:51 ` Jinjie Ruan
2024-09-23 3:51 ` [PATCH 3/3] media: venus: " Jinjie Ruan
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Jinjie Ruan @ 2024-09-23 3:51 UTC (permalink / raw)
To: sakari.ailus, mchehab, ming.qian, eagle.zhou, stanimir.k.varbanov,
quic_vgarodia, bryan.odonoghue, hans.verkuil, linux-media,
linux-kernel, linux-arm-msm
Cc: ruanjinjie
It is not valid to call pm_runtime_set_suspended() for devices
with runtime PM enabled because it returns -EAGAIN if it is enabled
already and working. So, call pm_runtime_disable() before to fix it.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/media/platform/amphion/vpu_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/amphion/vpu_drv.c b/drivers/media/platform/amphion/vpu_drv.c
index 2bf70aafd2ba..51d5234869f5 100644
--- a/drivers/media/platform/amphion/vpu_drv.c
+++ b/drivers/media/platform/amphion/vpu_drv.c
@@ -151,8 +151,8 @@ static int vpu_probe(struct platform_device *pdev)
media_device_cleanup(&vpu->mdev);
v4l2_device_unregister(&vpu->v4l2_dev);
err_vpu_deinit:
- pm_runtime_set_suspended(dev);
pm_runtime_disable(dev);
+ pm_runtime_set_suspended(dev);
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] media: venus: Fix pm_runtime_set_suspended() with runtime pm enabled
2024-09-23 3:51 [PATCH 0/3] media: Fix pm_runtime_set_suspended() with runtime pm enabled Jinjie Ruan
2024-09-23 3:51 ` [PATCH 1/3] media: i2c: dw9768: " Jinjie Ruan
2024-09-23 3:51 ` [PATCH 2/3] media: amphion: " Jinjie Ruan
@ 2024-09-23 3:51 ` Jinjie Ruan
2024-11-01 8:09 ` Sakari Ailus
2024-10-08 2:38 ` [PATCH 0/3] media: " Jinjie Ruan
2024-10-31 2:58 ` Chen Ridong
4 siblings, 1 reply; 8+ messages in thread
From: Jinjie Ruan @ 2024-09-23 3:51 UTC (permalink / raw)
To: sakari.ailus, mchehab, ming.qian, eagle.zhou, stanimir.k.varbanov,
quic_vgarodia, bryan.odonoghue, hans.verkuil, linux-media,
linux-kernel, linux-arm-msm
Cc: ruanjinjie
It is not valid to call pm_runtime_set_suspended() for devices
with runtime PM enabled because it returns -EAGAIN if it is enabled
already and working. So, call pm_runtime_disable() before to fix it.
Fixes: af2c3834c8ca ("[media] media: venus: adding core part and helper functions")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/media/platform/qcom/venus/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 165c947a6703..2d5966f5ce97 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -412,8 +412,8 @@ static int venus_probe(struct platform_device *pdev)
of_platform_depopulate(dev);
err_runtime_disable:
pm_runtime_put_noidle(dev);
- pm_runtime_set_suspended(dev);
pm_runtime_disable(dev);
+ pm_runtime_set_suspended(dev);
hfi_destroy(core);
err_core_deinit:
hfi_core_deinit(core, false);
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] media: Fix pm_runtime_set_suspended() with runtime pm enabled
2024-09-23 3:51 [PATCH 0/3] media: Fix pm_runtime_set_suspended() with runtime pm enabled Jinjie Ruan
` (2 preceding siblings ...)
2024-09-23 3:51 ` [PATCH 3/3] media: venus: " Jinjie Ruan
@ 2024-10-08 2:38 ` Jinjie Ruan
2024-10-31 2:58 ` Chen Ridong
4 siblings, 0 replies; 8+ messages in thread
From: Jinjie Ruan @ 2024-10-08 2:38 UTC (permalink / raw)
To: sakari.ailus, mchehab, ming.qian, eagle.zhou, stanimir.k.varbanov,
quic_vgarodia, bryan.odonoghue, hans.verkuil, linux-media,
linux-kernel, linux-arm-msm
Ping.
On 2024/9/23 11:51, Jinjie Ruan wrote:
> Fix pm_runtime_set_suspended() with runtime pm enabled.
>
> Jinjie Ruan (3):
> media: i2c: dw9768: Fix pm_runtime_set_suspended() with runtime pm
> enabled
> media: amphion: Fix pm_runtime_set_suspended() with runtime pm enabled
> media: venus: Fix pm_runtime_set_suspended() with runtime pm enabled
>
> drivers/media/i2c/dw9768.c | 6 +++---
> drivers/media/platform/amphion/vpu_drv.c | 2 +-
> drivers/media/platform/qcom/venus/core.c | 2 +-
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] media: Fix pm_runtime_set_suspended() with runtime pm enabled
2024-09-23 3:51 [PATCH 0/3] media: Fix pm_runtime_set_suspended() with runtime pm enabled Jinjie Ruan
` (3 preceding siblings ...)
2024-10-08 2:38 ` [PATCH 0/3] media: " Jinjie Ruan
@ 2024-10-31 2:58 ` Chen Ridong
4 siblings, 0 replies; 8+ messages in thread
From: Chen Ridong @ 2024-10-31 2:58 UTC (permalink / raw)
To: Jinjie Ruan, sakari.ailus, mchehab, ming.qian, eagle.zhou,
stanimir.k.varbanov, quic_vgarodia, bryan.odonoghue, hans.verkuil,
linux-media, linux-kernel, linux-arm-msm
On 2024/9/23 11:51, Jinjie Ruan wrote:
> Fix pm_runtime_set_suspended() with runtime pm enabled.
>
> Jinjie Ruan (3):
> media: i2c: dw9768: Fix pm_runtime_set_suspended() with runtime pm
> enabled
> media: amphion: Fix pm_runtime_set_suspended() with runtime pm enabled
> media: venus: Fix pm_runtime_set_suspended() with runtime pm enabled
>
> drivers/media/i2c/dw9768.c | 6 +++---
> drivers/media/platform/amphion/vpu_drv.c | 2 +-
> drivers/media/platform/qcom/venus/core.c | 2 +-
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
LGTM.
Thanks,
Ridong
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] media: i2c: dw9768: Fix pm_runtime_set_suspended() with runtime pm enabled
2024-09-23 3:51 ` [PATCH 1/3] media: i2c: dw9768: " Jinjie Ruan
@ 2024-11-01 8:08 ` Sakari Ailus
0 siblings, 0 replies; 8+ messages in thread
From: Sakari Ailus @ 2024-11-01 8:08 UTC (permalink / raw)
To: Jinjie Ruan
Cc: mchehab, ming.qian, eagle.zhou, stanimir.k.varbanov,
quic_vgarodia, bryan.odonoghue, hans.verkuil, linux-media,
linux-kernel, linux-arm-msm
Hi Jinjie,
Thanks for the patch.
On Mon, Sep 23, 2024 at 11:51:13AM +0800, Jinjie Ruan wrote:
> It is not valid to call pm_runtime_set_suspended() and
> pm_runtime_set_active() for devices with runtime PM enabled because it
> returns -EAGAIN if it is enabled already and working. So, adjust the
> order to fix it.
>
> Fixes: 5f9a089b6de3 ("dw9768: Enable low-power probe on ACPI")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
> drivers/media/i2c/dw9768.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/i2c/dw9768.c b/drivers/media/i2c/dw9768.c
> index 18ef2b35c9aa..61db1e8d2727 100644
> --- a/drivers/media/i2c/dw9768.c
> +++ b/drivers/media/i2c/dw9768.c
> @@ -471,7 +471,6 @@ static int dw9768_probe(struct i2c_client *client)
> * to be powered on in an ACPI system. Similarly for power off in
> * remove.
> */
> - pm_runtime_enable(dev);
> full_power = (is_acpi_node(dev_fwnode(dev)) &&
> acpi_dev_state_d0(dev)) ||
> (is_of_node(dev_fwnode(dev)) && !pm_runtime_enabled(dev));
pm_runtime_enabled() should be replaced by IS_ENABLED(CONFIG_PM) here.
> @@ -484,6 +483,7 @@ static int dw9768_probe(struct i2c_client *client)
> pm_runtime_set_active(dev);
> }
>
> + pm_runtime_enable(dev);
> ret = v4l2_async_register_subdev(&dw9768->sd);
> if (ret < 0) {
> dev_err(dev, "failed to register V4L2 subdev: %d", ret);
> @@ -495,12 +495,12 @@ static int dw9768_probe(struct i2c_client *client)
> return 0;
>
> err_power_off:
> + pm_runtime_disable(dev);
> if (full_power) {
> dw9768_runtime_suspend(dev);
> pm_runtime_set_suspended(dev);
> }
> err_clean_entity:
> - pm_runtime_disable(dev);
> media_entity_cleanup(&dw9768->sd.entity);
> err_free_handler:
> v4l2_ctrl_handler_free(&dw9768->ctrls);
> @@ -517,12 +517,12 @@ static void dw9768_remove(struct i2c_client *client)
> v4l2_async_unregister_subdev(&dw9768->sd);
> v4l2_ctrl_handler_free(&dw9768->ctrls);
> media_entity_cleanup(&dw9768->sd.entity);
> + pm_runtime_disable(dev);
> if ((is_acpi_node(dev_fwnode(dev)) && acpi_dev_state_d0(dev)) ||
> (is_of_node(dev_fwnode(dev)) && !pm_runtime_enabled(dev))) {
And similarly here. The patch seems fine with that change.
> dw9768_runtime_suspend(dev);
> pm_runtime_set_suspended(dev);
> }
> - pm_runtime_disable(dev);
> }
>
> static const struct of_device_id dw9768_of_table[] = {
--
Kind regards,
Sakari Ailus
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] media: venus: Fix pm_runtime_set_suspended() with runtime pm enabled
2024-09-23 3:51 ` [PATCH 3/3] media: venus: " Jinjie Ruan
@ 2024-11-01 8:09 ` Sakari Ailus
0 siblings, 0 replies; 8+ messages in thread
From: Sakari Ailus @ 2024-11-01 8:09 UTC (permalink / raw)
To: Jinjie Ruan
Cc: mchehab, ming.qian, eagle.zhou, stanimir.k.varbanov,
quic_vgarodia, bryan.odonoghue, hans.verkuil, linux-media,
linux-kernel, linux-arm-msm
Hi Jinjie,
On Mon, Sep 23, 2024 at 11:51:15AM +0800, Jinjie Ruan wrote:
> It is not valid to call pm_runtime_set_suspended() for devices
> with runtime PM enabled because it returns -EAGAIN if it is enabled
> already and working. So, call pm_runtime_disable() before to fix it.
>
> Fixes: af2c3834c8ca ("[media] media: venus: adding core part and helper functions")
Patches with Fixes: tag(s) need to include Cc: stable nowadays. Same for
the 1st patch actually.
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
> drivers/media/platform/qcom/venus/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 165c947a6703..2d5966f5ce97 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -412,8 +412,8 @@ static int venus_probe(struct platform_device *pdev)
> of_platform_depopulate(dev);
> err_runtime_disable:
> pm_runtime_put_noidle(dev);
> - pm_runtime_set_suspended(dev);
> pm_runtime_disable(dev);
> + pm_runtime_set_suspended(dev);
> hfi_destroy(core);
> err_core_deinit:
> hfi_core_deinit(core, false);
--
Kind regards,
Sakari Ailus
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-11-01 8:09 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-23 3:51 [PATCH 0/3] media: Fix pm_runtime_set_suspended() with runtime pm enabled Jinjie Ruan
2024-09-23 3:51 ` [PATCH 1/3] media: i2c: dw9768: " Jinjie Ruan
2024-11-01 8:08 ` Sakari Ailus
2024-09-23 3:51 ` [PATCH 2/3] media: amphion: " Jinjie Ruan
2024-09-23 3:51 ` [PATCH 3/3] media: venus: " Jinjie Ruan
2024-11-01 8:09 ` Sakari Ailus
2024-10-08 2:38 ` [PATCH 0/3] media: " Jinjie Ruan
2024-10-31 2:58 ` Chen Ridong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox