Commit f93500f4 authored by Stefan Agner's avatar Stefan Agner

drm/fsl-dcu: add extra clock for pixel clock

The Vybrid DCU variant has two independent clock inputs, one
for the registers (IPG bus clock) and one for the pixel clock.
Support this distinction in the DCU DRM driver while staying
backward compatible for old device trees.
Acked-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
parent 73fa3033
...@@ -6,8 +6,11 @@ Required properties: ...@@ -6,8 +6,11 @@ Required properties:
* "fsl,vf610-dcu". * "fsl,vf610-dcu".
- reg: Address and length of the register set for dcu. - reg: Address and length of the register set for dcu.
- clocks: From common clock binding: handle to dcu clock. - clocks: Handle to "dcu" and "pix" clock (in the order below)
- clock-names: From common clock binding: Shall be "dcu". This can be the same clock (e.g. LS1021a)
See ../clocks/clock-bindings.txt for details.
- clock-names: Should be "dcu" and "pix"
See ../clocks/clock-bindings.txt for details.
- big-endian Boolean property, LS1021A DCU registers are big-endian. - big-endian Boolean property, LS1021A DCU registers are big-endian.
- fsl,panel: The phandle to panel node. - fsl,panel: The phandle to panel node.
...@@ -15,8 +18,8 @@ Examples: ...@@ -15,8 +18,8 @@ Examples:
dcu: dcu@2ce0000 { dcu: dcu@2ce0000 {
compatible = "fsl,ls1021a-dcu"; compatible = "fsl,ls1021a-dcu";
reg = <0x0 0x2ce0000 0x0 0x10000>; reg = <0x0 0x2ce0000 0x0 0x10000>;
clocks = <&platform_clk 0>; clocks = <&platform_clk 0>, <&platform_clk 0>;
clock-names = "dcu"; clock-names = "dcu", "pix";
big-endian; big-endian;
fsl,panel = <&panel>; fsl,panel = <&panel>;
}; };
...@@ -71,7 +71,7 @@ static void fsl_dcu_drm_crtc_mode_set_nofb(struct drm_crtc *crtc) ...@@ -71,7 +71,7 @@ static void fsl_dcu_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
unsigned long dcuclk; unsigned long dcuclk;
index = drm_crtc_index(crtc); index = drm_crtc_index(crtc);
dcuclk = clk_get_rate(fsl_dev->clk); dcuclk = clk_get_rate(fsl_dev->pix_clk);
div = dcuclk / mode->clock / 1000; div = dcuclk / mode->clock / 1000;
/* Configure timings: */ /* Configure timings: */
......
...@@ -331,10 +331,21 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev) ...@@ -331,10 +331,21 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
return ret; return ret;
} }
fsl_dev->pix_clk = devm_clk_get(dev, "pix");
if (IS_ERR(fsl_dev->pix_clk)) {
/* legancy binding, use dcu clock as pixel clock */
fsl_dev->pix_clk = fsl_dev->clk;
}
ret = clk_prepare_enable(fsl_dev->pix_clk);
if (ret < 0) {
dev_err(dev, "failed to enable pix clk\n");
goto disable_clk;
}
drm = drm_dev_alloc(driver, dev); drm = drm_dev_alloc(driver, dev);
if (!drm) { if (!drm) {
ret = -ENOMEM; ret = -ENOMEM;
goto disable_clk; goto disable_pix_clk;
} }
fsl_dev->dev = dev; fsl_dev->dev = dev;
...@@ -355,6 +366,8 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev) ...@@ -355,6 +366,8 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
unref: unref:
drm_dev_unref(drm); drm_dev_unref(drm);
disable_pix_clk:
clk_disable_unprepare(fsl_dev->pix_clk);
disable_clk: disable_clk:
clk_disable_unprepare(fsl_dev->clk); clk_disable_unprepare(fsl_dev->clk);
return ret; return ret;
...@@ -365,6 +378,7 @@ static int fsl_dcu_drm_remove(struct platform_device *pdev) ...@@ -365,6 +378,7 @@ static int fsl_dcu_drm_remove(struct platform_device *pdev)
struct fsl_dcu_drm_device *fsl_dev = platform_get_drvdata(pdev); struct fsl_dcu_drm_device *fsl_dev = platform_get_drvdata(pdev);
clk_disable_unprepare(fsl_dev->clk); clk_disable_unprepare(fsl_dev->clk);
clk_disable_unprepare(fsl_dev->pix_clk);
drm_put_dev(fsl_dev->drm); drm_put_dev(fsl_dev->drm);
return 0; return 0;
......
...@@ -183,6 +183,7 @@ struct fsl_dcu_drm_device { ...@@ -183,6 +183,7 @@ struct fsl_dcu_drm_device {
struct regmap *regmap; struct regmap *regmap;
int irq; int irq;
struct clk *clk; struct clk *clk;
struct clk *pix_clk;
/*protects hardware register*/ /*protects hardware register*/
spinlock_t irq_lock; spinlock_t irq_lock;
struct drm_device *drm; struct drm_device *drm;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment