[PATCH v5 01/12] drm/exynos: add Exynos5433 decon driver

2015-04-10 Thread Hyungwon Hwang
Dear Varka Bhadram,

On Fri, 10 Apr 2015 11:35:02 +0530
Varka Bhadram  wrote:

> On 04/10/2015 11:25 AM, Hyungwon Hwang wrote:
> 
> > From: Joonyoung Shim 
> >
> > DECON(Display and Enhancement Controller) is new IP replacing FIMD
> > in Exynos5433. This patch adds Exynos5433 decon driver.
> >
> > Signed-off-by: Joonyoung Shim 
> > Signed-off-by: Hyungwon Hwang 
> > ---
> > Changes for v2:
> > - change file names and variable names of decon to represnt
> > exynos5433 instead of exynos to distinguish them from exynos7 decon
> >
> > Changes for v3:
> > - fail fast when the proper image format is not set
> > - remove unnecessary checking code
> > - add and modify the function to make DPMS work well
> >
> > Changes for v4:
> > - rebased to exynos-drm-next with the clean-up patchset by Gustavo
> > Padovan.
> >
> > Changes for v5:
> > - None
> >  .../devicetree/bindings/video/exynos5433-decon.txt |  65 +++
> >  drivers/gpu/drm/exynos/Kconfig |   6 +
> >  drivers/gpu/drm/exynos/Makefile|   1 +
> >  drivers/gpu/drm/exynos/exynos5433_drm_decon.c  | 617
> > +
> > drivers/gpu/drm/exynos/exynos_drm_drv.c|   3 +
> > drivers/gpu/drm/exynos/exynos_drm_drv.h|   1 +
> > include/video/exynos5433_decon.h   | 163 ++ 7
> > files changed, 856 insertions(+) create mode 100644
> > Documentation/devicetree/bindings/video/exynos5433-decon.txt create
> > mode 100644 drivers/gpu/drm/exynos/exynos5433_drm_decon.c create
> > mode 100644 include/video/exynos5433_decon.h
> >
> (...)
> 
> > +   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > +   if (!res) {
> > +   dev_err(dev, "cannot find IO resource\n");
> > +   return -ENXIO;
> > +   }
> > +
> 
> Remove the above check. Check one *res* will be done by
> *devm_ioremap_resource()*

OK.

> 
> > +   ctx->addr = devm_ioremap_resource(dev, res);
> > +   if (IS_ERR(ctx->addr)) {
> > +   dev_err(dev, "ioremap failed\n");
> > +   return PTR_ERR(ctx->addr);
> > +   }
> > +
> > +   res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
> > +   ctx->i80_if ? "lcd_sys" : "vsync");
> > +   if (!res) {
> > +   dev_err(dev, "cannot find IRQ resource\n");
> > +   return -ENXIO;
> > +   }
> > +
> > +   ret = devm_request_irq(dev, res->start, ctx->i80_if ?
> > +   decon_lcd_sys_irq_handler :
> > decon_vsync_irq_handler, 0,
> > +   "drm_decon", ctx);
> > +   if (ret < 0) {
> > +   dev_err(dev, "lcd_sys irq request failed\n");
> > +   return ret;
> > +   }
> > +
> > +   ret = exynos_drm_component_add(dev,
> > EXYNOS_DEVICE_TYPE_CRTC,
> > +  EXYNOS_DISPLAY_TYPE_LCD);
> > +   if (ret < 0)
> > +   return ret;
> > +
> > +   platform_set_drvdata(pdev, ctx);
> > +
> > +   ret = component_add(dev, _component_ops);
> > +   if (ret < 0) {
> > +   exynos_drm_component_del(dev,
> > EXYNOS_DEVICE_TYPE_CRTC);
> > +   return ret;
> > +   }
> > +
> > +   return 0;
> > +}
> > +
> > +static int exynos5433_decon_remove(struct platform_device *pdev)
> > +{
> > +   component_del(>dev, _component_ops);
> > +   exynos_drm_component_del(>dev,
> > EXYNOS_DEVICE_TYPE_CRTC); +
> > +   return 0;
> > +}
> > +
> > +static const struct of_device_id
> > exynos5433_decon_driver_dt_match[] = {
> > +   { .compatible = "samsung,exynos5433-decon" },
> > +   {},
> > +};
> > +MODULE_DEVICE_TABLE(of, exynos5433_decon_driver_dt_match);
> > +
> > +struct platform_driver exynos5433_decon_driver = {
> > +   .probe  = exynos5433_decon_probe,
> > +   .remove = exynos5433_decon_remove,
> > +   .driver = {
> > +   .name   = "exynos5433-decon",
> > +   .owner  = THIS_MODULE,
> 
> Remove this field. It will be updated by platform core.
> 

OK.

Thanks for your review.

Best regards,
Hyungwon Hwang

> > +   .of_match_table = exynos5433_decon_driver_dt_match,
> > +   },
> > +};
> 



[PATCH v5 01/12] drm/exynos: add Exynos5433 decon driver

2015-04-10 Thread Hyungwon Hwang
From: Joonyoung Shim 

DECON(Display and Enhancement Controller) is new IP replacing FIMD in
Exynos5433. This patch adds Exynos5433 decon driver.

Signed-off-by: Joonyoung Shim 
Signed-off-by: Hyungwon Hwang 
---
Changes for v2:
- change file names and variable names of decon to represnt exynos5433 instead
of exynos to distinguish them from exynos7 decon

Changes for v3:
- fail fast when the proper image format is not set
- remove unnecessary checking code
- add and modify the function to make DPMS work well

Changes for v4:
- rebased to exynos-drm-next with the clean-up patchset by Gustavo Padovan.

Changes for v5:
- None
 .../devicetree/bindings/video/exynos5433-decon.txt |  65 +++
 drivers/gpu/drm/exynos/Kconfig |   6 +
 drivers/gpu/drm/exynos/Makefile|   1 +
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c  | 617 +
 drivers/gpu/drm/exynos/exynos_drm_drv.c|   3 +
 drivers/gpu/drm/exynos/exynos_drm_drv.h|   1 +
 include/video/exynos5433_decon.h   | 163 ++
 7 files changed, 856 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/exynos5433-decon.txt
 create mode 100644 drivers/gpu/drm/exynos/exynos5433_drm_decon.c
 create mode 100644 include/video/exynos5433_decon.h

diff --git a/Documentation/devicetree/bindings/video/exynos5433-decon.txt 
b/Documentation/devicetree/bindings/video/exynos5433-decon.txt
new file mode 100644
index 000..377afbf
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/exynos5433-decon.txt
@@ -0,0 +1,65 @@
+Device-Tree bindings for Samsung Exynos SoC display controller (DECON)
+
+DECON (Display and Enhancement Controller) is the Display Controller for the
+Exynos series of SoCs which transfers the image data from a video memory
+buffer to an external LCD interface.
+
+Required properties:
+- compatible: value should be "samsung,exynos5433-decon";
+- reg: physical base address and length of the DECON registers set.
+- interrupts: should contain a list of all DECON IP block interrupts in the
+ order: VSYNC, LCD_SYSTEM. The interrupt specifier format
+ depends on the interrupt controller used.
+- interrupt-names: should contain the interrupt names: "vsync", "lcd_sys"
+  in the same order as they were listed in the interrupts
+  property.
+- clocks: must include clock specifiers corresponding to entries in the
+ clock-names property.
+- clock-names: list of clock names sorted in the same order as the clocks
+  property. Must contain "aclk_decon", "aclk_smmu_decon0x",
+  "aclk_xiu_decon0x", "pclk_smmu_decon0x", clk_decon_vclk",
+  "sclk_decon_eclk"
+- ports: contains a port which is connected to mic node. address-cells and
+size-cells must 1 and 0, respectively.
+- port: contains an endpoint node which is connected to the endpoint in the mic
+   node. The reg value muset be 0.
+- i80-if-timings: specify whether the panel which is connected to decon uses
+ i80 lcd interface or mipi video interface. This node contains
+ no timing information as that of fimd does. Because there is
+ no register in decon to specify i80 interface timing value,
+ it is not needed, but make it remain to use same kind of node
+ in fimd and exynos7 decon.
+
+Example:
+SoC specific DT entry:
+decon: decon at 1380 {
+   compatible = "samsung,exynos5433-decon";
+   reg = <0x1380 0x2104>;
+   clocks = <_disp CLK_ACLK_DECON>, <_disp CLK_ACLK_SMMU_DECON0X>,
+   <_disp CLK_ACLK_XIU_DECON0X>,
+   <_disp CLK_PCLK_SMMU_DECON0X>,
+   <_disp CLK_SCLK_DECON_VCLK>,
+   <_disp CLK_SCLK_DECON_ECLK>;
+   clock-names = "aclk_decon", "aclk_smmu_decon0x", "aclk_xiu_decon0x",
+   "pclk_smmu_decon0x", "sclk_decon_vclk", "sclk_decon_eclk";
+   interrupt-names = "vsync", "lcd_sys";
+   interrupts = <0 202 0>, <0 203 0>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port at 0 {
+   reg = <0>;
+   decon_to_mic: endpoint {
+   remote-endpoint = <_to_decon>;
+   };
+   };
+   };
+};
+
+Board specific DT entry:
+ {
+   i80-if-timings {
+   };
+};
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
index 0a67803..dd6ae21 100644
--- a/drivers/gpu/drm/exynos/Kconfig
+++ b/drivers/gpu/drm/exynos/Kconfig
@@ -24,6 +24,12 @@ config DRM_EXYNOS_FIMD
help
  Choose this option if you want to use Exynos FIMD for DRM.

+config DRM_EXYNOS5433_DECON
+   bool "Exynos5433 DRM DECON"
+   depends on DRM_EXYNOS
+   help
+ Choose this option if you want to use Exynos5433 DECON for DRM.
+
 

[PATCH v5 01/12] drm/exynos: add Exynos5433 decon driver

2015-04-10 Thread Varka Bhadram
On 04/10/2015 11:25 AM, Hyungwon Hwang wrote:

> From: Joonyoung Shim 
>
> DECON(Display and Enhancement Controller) is new IP replacing FIMD in
> Exynos5433. This patch adds Exynos5433 decon driver.
>
> Signed-off-by: Joonyoung Shim 
> Signed-off-by: Hyungwon Hwang 
> ---
> Changes for v2:
> - change file names and variable names of decon to represnt exynos5433 instead
> of exynos to distinguish them from exynos7 decon
>
> Changes for v3:
> - fail fast when the proper image format is not set
> - remove unnecessary checking code
> - add and modify the function to make DPMS work well
>
> Changes for v4:
> - rebased to exynos-drm-next with the clean-up patchset by Gustavo Padovan.
>
> Changes for v5:
> - None
>  .../devicetree/bindings/video/exynos5433-decon.txt |  65 +++
>  drivers/gpu/drm/exynos/Kconfig |   6 +
>  drivers/gpu/drm/exynos/Makefile|   1 +
>  drivers/gpu/drm/exynos/exynos5433_drm_decon.c  | 617 
> +
>  drivers/gpu/drm/exynos/exynos_drm_drv.c|   3 +
>  drivers/gpu/drm/exynos/exynos_drm_drv.h|   1 +
>  include/video/exynos5433_decon.h   | 163 ++
>  7 files changed, 856 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/video/exynos5433-decon.txt
>  create mode 100644 drivers/gpu/drm/exynos/exynos5433_drm_decon.c
>  create mode 100644 include/video/exynos5433_decon.h
>
(...)

> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res) {
> + dev_err(dev, "cannot find IO resource\n");
> + return -ENXIO;
> + }
> +

Remove the above check. Check one *res* will be done by 
*devm_ioremap_resource()*

> + ctx->addr = devm_ioremap_resource(dev, res);
> + if (IS_ERR(ctx->addr)) {
> + dev_err(dev, "ioremap failed\n");
> + return PTR_ERR(ctx->addr);
> + }
> +
> + res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
> + ctx->i80_if ? "lcd_sys" : "vsync");
> + if (!res) {
> + dev_err(dev, "cannot find IRQ resource\n");
> + return -ENXIO;
> + }
> +
> + ret = devm_request_irq(dev, res->start, ctx->i80_if ?
> + decon_lcd_sys_irq_handler : decon_vsync_irq_handler, 0,
> + "drm_decon", ctx);
> + if (ret < 0) {
> + dev_err(dev, "lcd_sys irq request failed\n");
> + return ret;
> + }
> +
> + ret = exynos_drm_component_add(dev, EXYNOS_DEVICE_TYPE_CRTC,
> +EXYNOS_DISPLAY_TYPE_LCD);
> + if (ret < 0)
> + return ret;
> +
> + platform_set_drvdata(pdev, ctx);
> +
> + ret = component_add(dev, _component_ops);
> + if (ret < 0) {
> + exynos_drm_component_del(dev, EXYNOS_DEVICE_TYPE_CRTC);
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static int exynos5433_decon_remove(struct platform_device *pdev)
> +{
> + component_del(>dev, _component_ops);
> + exynos_drm_component_del(>dev, EXYNOS_DEVICE_TYPE_CRTC);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id exynos5433_decon_driver_dt_match[] = {
> + { .compatible = "samsung,exynos5433-decon" },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, exynos5433_decon_driver_dt_match);
> +
> +struct platform_driver exynos5433_decon_driver = {
> + .probe  = exynos5433_decon_probe,
> + .remove = exynos5433_decon_remove,
> + .driver = {
> + .name   = "exynos5433-decon",
> + .owner  = THIS_MODULE,

Remove this field. It will be updated by platform core.

> + .of_match_table = exynos5433_decon_driver_dt_match,
> + },
> +};

-- 
Varka Bhadram