aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/media/platform
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2020-03-25 13:14:55 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-04-14 12:46:34 +0200
commitb6959ca031ab6a86a86947f4ce495b07b03ea22e (patch)
treee82d9cb9009f33fafe24261a423b2523cc8c04ff /drivers/media/platform
parentmedia: ti-vpe: cal: fix use of wrong macro (diff)
downloadwireguard-linux-b6959ca031ab6a86a86947f4ce495b07b03ea22e.tar.xz
wireguard-linux-b6959ca031ab6a86a86947f4ce495b07b03ea22e.zip
media: ti-vpe: cal: use runtime_resume for errata handling
We need to do errata handling every time CAL is being enabled. The code is currently in cal_runtime_get(), which is not the correct place for it. Move the code to cal_runtime_resume, which is called every time CAL is enabled. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Reviewed-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r--drivers/media/platform/ti-vpe/cal.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
index c418296df0f8..4fe37f284b54 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -653,20 +653,7 @@ static void i913_errata(struct cal_dev *dev, unsigned int port)
static int cal_runtime_get(struct cal_dev *dev)
{
- int r;
-
- r = pm_runtime_get_sync(&dev->pdev->dev);
-
- if (dev->flags & DRA72_CAL_PRE_ES2_LDO_DISABLE) {
- /*
- * Apply errata on both port eveytime we (re-)enable
- * the clock
- */
- i913_errata(dev, 0);
- i913_errata(dev, 1);
- }
-
- return r;
+ return pm_runtime_get_sync(&dev->pdev->dev);
}
static inline void cal_runtime_put(struct cal_dev *dev)
@@ -2409,11 +2396,32 @@ static const struct of_device_id cal_of_match[] = {
MODULE_DEVICE_TABLE(of, cal_of_match);
#endif
+static int cal_runtime_resume(struct device *dev)
+{
+ struct cal_dev *caldev = dev_get_drvdata(dev);
+
+ if (caldev->flags & DRA72_CAL_PRE_ES2_LDO_DISABLE) {
+ /*
+ * Apply errata on both port everytime we (re-)enable
+ * the clock
+ */
+ i913_errata(caldev, 0);
+ i913_errata(caldev, 1);
+ }
+
+ return 0;
+}
+
+static const struct dev_pm_ops cal_pm_ops = {
+ .runtime_resume = cal_runtime_resume,
+};
+
static struct platform_driver cal_pdrv = {
.probe = cal_probe,
.remove = cal_remove,
.driver = {
.name = CAL_MODULE_NAME,
+ .pm = &cal_pm_ops,
.of_match_table = of_match_ptr(cal_of_match),
},
};