summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c2
-rw-r--r--drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c4
-rw-r--r--drivers/gpu/drm/fsl-dcu/fsl_tcon.c48
-rw-r--r--drivers/gpu/drm/fsl-dcu/fsl_tcon.h8
4 files changed, 15 insertions, 47 deletions
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index c82963f72e71..84b8d7265087 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -251,7 +251,6 @@ static int fsl_dcu_drm_pm_suspend(struct device *dev)
return PTR_ERR(fsl_dev->state);
}
- fsl_tcon_suspend(fsl_dev->tcon);
clk_disable_unprepare(fsl_dev->clk);
return 0;
@@ -271,7 +270,6 @@ static int fsl_dcu_drm_pm_resume(struct device *dev)
return ret;
}
- fsl_tcon_resume(fsl_dev->tcon);
fsl_dcu_drm_init_planes(fsl_dev->drm);
drm_atomic_helper_resume(fsl_dev->drm, fsl_dev->state);
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
index 9081086d8f21..f64a0723bda3 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
@@ -34,7 +34,7 @@ static void fsl_dcu_drm_encoder_disable(struct drm_encoder *encoder)
struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
if (fsl_dev->tcon)
- fsl_tcon_disable(fsl_dev->tcon);
+ fsl_tcon_bypass_disable(fsl_dev->tcon);
}
static void fsl_dcu_drm_encoder_enable(struct drm_encoder *encoder)
@@ -43,7 +43,7 @@ static void fsl_dcu_drm_encoder_enable(struct drm_encoder *encoder)
struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
if (fsl_dev->tcon)
- fsl_tcon_enable(fsl_dev->tcon);
+ fsl_tcon_bypass_enable(fsl_dev->tcon);
}
static const struct drm_encoder_helper_funcs encoder_helper_funcs = {
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_tcon.c b/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
index de3c58b59ba5..e5001a186850 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
@@ -20,38 +20,14 @@
#include "fsl_tcon.h"
-void fsl_tcon_disable(struct fsl_tcon *tcon)
+void fsl_tcon_bypass_disable(struct fsl_tcon *tcon)
{
regmap_update_bits(tcon->regs, FSL_TCON_CTRL1,
FSL_TCON_CTRL1_TCON_BYPASS, 0);
-
- tcon->enabled = false;
-}
-
-void fsl_tcon_enable(struct fsl_tcon *tcon)
-{
- regmap_update_bits(tcon->regs, FSL_TCON_CTRL1,
- FSL_TCON_CTRL1_TCON_BYPASS,
- FSL_TCON_CTRL1_TCON_BYPASS);
-
- tcon->enabled = true;
-}
-
-void fsl_tcon_suspend(struct fsl_tcon *tcon)
-{
- regmap_update_bits(tcon->regs, FSL_TCON_CTRL1,
- FSL_TCON_CTRL1_TCON_BYPASS, 0);
-
- clk_disable_unprepare(tcon->ipg_clk);
}
-void fsl_tcon_resume(struct fsl_tcon *tcon)
+void fsl_tcon_bypass_enable(struct fsl_tcon *tcon)
{
- clk_prepare_enable(tcon->ipg_clk);
-
- if (!tcon->enabled)
- return;
-
regmap_update_bits(tcon->regs, FSL_TCON_CTRL1,
FSL_TCON_CTRL1_TCON_BYPASS,
FSL_TCON_CTRL1_TCON_BYPASS);
@@ -71,21 +47,18 @@ static int fsl_tcon_init_regmap(struct device *dev,
{
struct resource res;
void __iomem *regs;
- int ret;
- ret = of_address_to_resource(np, 0, &res);
+ if (of_address_to_resource(np, 0, &res))
+ return -EINVAL;
+
regs = devm_ioremap_resource(dev, &res);
- if (IS_ERR(regs)) {
- dev_err(dev, "Couldn't map the TCON registers\n");
+ if (IS_ERR(regs))
return PTR_ERR(regs);
- }
tcon->regs = devm_regmap_init_mmio(dev, regs,
&fsl_tcon_regmap_config);
- if (IS_ERR(tcon->regs)) {
- dev_err(dev, "Couldn't create the TCON regmap\n");
+ if (IS_ERR(tcon->regs))
return PTR_ERR(tcon->regs);
- }
return 0;
}
@@ -107,20 +80,21 @@ struct fsl_tcon *fsl_tcon_init(struct device *dev)
}
ret = fsl_tcon_init_regmap(dev, tcon, np);
- if (ret)
+ if (ret) {
+ dev_err(dev, "Couldn't create the TCON regmap\n");
goto err_node_put;
+ }
tcon->ipg_clk = of_clk_get_by_name(np, "ipg");
if (IS_ERR(tcon->ipg_clk)) {
dev_err(dev, "Couldn't get the TCON bus clock\n");
- goto err_free_regmap;
+ goto err_node_put;
}
clk_prepare_enable(tcon->ipg_clk);
return tcon;
-err_free_regmap:
err_node_put:
of_node_put(np);
return NULL;
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_tcon.h b/drivers/gpu/drm/fsl-dcu/fsl_tcon.h
index 199e6a1f0d69..80a7617de58f 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_tcon.h
+++ b/drivers/gpu/drm/fsl-dcu/fsl_tcon.h
@@ -22,16 +22,12 @@
struct fsl_tcon {
struct regmap *regs;
struct clk *ipg_clk;
-
- bool enabled;
};
struct fsl_tcon *fsl_tcon_init(struct device *dev);
void fsl_tcon_free(struct fsl_tcon *tcon);
-void fsl_tcon_disable(struct fsl_tcon *tcon);
-void fsl_tcon_enable(struct fsl_tcon *tcon);
-void fsl_tcon_suspend(struct fsl_tcon *tcon);
-void fsl_tcon_resume(struct fsl_tcon *tcon);
+void fsl_tcon_bypass_disable(struct fsl_tcon *tcon);
+void fsl_tcon_bypass_enable(struct fsl_tcon *tcon);
#endif /* __FSL_TCON_H__ */