summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/rcar-du
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>2023-01-23 13:47:38 +0300
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2023-01-23 18:56:51 +0300
commit7df2524bd69e10f4c8f0c7346bcad57903329e85 (patch)
treeddb58fa2a3017618b38824f307f8a71554e1776f /drivers/gpu/drm/rcar-du
parent0e3a3d553f0c5d832d016207a8a2e3f67195bbcc (diff)
downloadlinux-7df2524bd69e10f4c8f0c7346bcad57903329e85.tar.xz
drm: rcar-du: lvds: Add reset control
Reset LVDS using the reset control as CPG reset/release is required in the hardware manual sequence. Based on a BSP patch from Koji Matsuoka <koji.matsuoka.xm@renesas.com>. Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Diffstat (limited to 'drivers/gpu/drm/rcar-du')
-rw-r--r--drivers/gpu/drm/rcar-du/Kconfig1
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_lvds.c20
2 files changed, 20 insertions, 1 deletions
diff --git a/drivers/gpu/drm/rcar-du/Kconfig b/drivers/gpu/drm/rcar-du/Kconfig
index dc5d663ed884..53c356aed5d5 100644
--- a/drivers/gpu/drm/rcar-du/Kconfig
+++ b/drivers/gpu/drm/rcar-du/Kconfig
@@ -44,6 +44,7 @@ config DRM_RCAR_LVDS
depends on PM
select DRM_KMS_HELPER
select DRM_PANEL
+ select RESET_CONTROLLER
config DRM_RCAR_USE_MIPI_DSI
bool "R-Car DU MIPI DSI Encoder Support"
diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c
index 7cf515e43079..a11201e4d31b 100644
--- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
+++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
@@ -17,6 +17,7 @@
#include <linux/of_graph.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/sys_soc.h>
@@ -61,6 +62,7 @@ struct rcar_lvds_device_info {
struct rcar_lvds {
struct device *dev;
const struct rcar_lvds_device_info *info;
+ struct reset_control *rstc;
struct drm_bridge bridge;
@@ -845,6 +847,11 @@ static int rcar_lvds_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
+ lvds->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
+ if (IS_ERR(lvds->rstc))
+ return dev_err_probe(&pdev->dev, PTR_ERR(lvds->rstc),
+ "failed to get cpg reset\n");
+
pm_runtime_enable(&pdev->dev);
drm_bridge_add(&lvds->bridge);
@@ -924,6 +931,8 @@ static int rcar_lvds_runtime_suspend(struct device *dev)
clk_disable_unprepare(lvds->clocks.mod);
+ reset_control_assert(lvds->rstc);
+
return 0;
}
@@ -932,11 +941,20 @@ static int rcar_lvds_runtime_resume(struct device *dev)
struct rcar_lvds *lvds = dev_get_drvdata(dev);
int ret;
+ ret = reset_control_deassert(lvds->rstc);
+ if (ret)
+ return ret;
+
ret = clk_prepare_enable(lvds->clocks.mod);
if (ret < 0)
- return ret;
+ goto err_reset_assert;
return 0;
+
+err_reset_assert:
+ reset_control_assert(lvds->rstc);
+
+ return ret;
}
static const struct dev_pm_ops rcar_lvds_pm_ops = {