media: i2c: hi846: use pm_runtime_force_suspend/resume for system suspend
authorMartin Kepplinger <martin.kepplinger@puri.sm>
Tue, 9 Nov 2021 13:10:13 +0000 (14:10 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Thu, 16 Dec 2021 19:54:53 +0000 (20:54 +0100)
In cases like this when controlling regulators and clocks the suspend()
and resume() functions are meant to be called balanced toggling the behaviour.

It's wrong to use the same suspend function for runtime and system suspend
in this case and leads to errors like

[   77.718890] Failed to disable vddd: -EIO

Use pm_runtime_force_* helpers in order to support system suspend properly
when runtime pm is already implemented and fix this.

Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/i2c/hi846.c

index 47fa0324f7fbe824a414681e46574d9210edb5ee..ad35c3ff3611589c19ddf0441770fcac4fa14f59 100644 (file)
@@ -2162,7 +2162,11 @@ static int hi846_remove(struct i2c_client *client)
        return 0;
 }
 
-static UNIVERSAL_DEV_PM_OPS(hi846_pm_ops, hi846_suspend, hi846_resume, NULL);
+static const struct dev_pm_ops hi846_pm_ops = {
+       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+                               pm_runtime_force_resume)
+       SET_RUNTIME_PM_OPS(hi846_suspend, hi846_resume, NULL)
+};
 
 static const struct of_device_id hi846_of_match[] = {
        { .compatible = "hynix,hi846", },