[PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver

2015-03-26 Thread jianwei.w...@freescale.com
Hi Stefan,

I have tested recently, this driver also works on Vybrid twr board. I
send V3 patches just now, Please help test it on Vybrid board if necessary.

Regards,

Jianwei

> -Original Message-
> From: Stefan Agner [mailto:stefan at agner.ch]
> Sent: Wednesday, March 04, 2015 11:04 PM
> To: Wang Jianwei-B52261
> Cc: dri-devel at lists.freedesktop.org; jbarnes at virtuousgeek.org; Wood 
> Scott-
> B07421; Xiubo Li; Wang Huan-B18965; linux-kernel at vger.kernel.org; linux-
> arm-kernel at lists.infradead.org
> Subject: Re: [PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver
> 
> On 2015-02-13 12:03, Jianwei Wang wrote:
> > This patch add support for Two Dimensional Animation and Compositing
> > Engine (2D-ACE) on the Freescale LS102x SoCs.
> >
> > 2D-ACE is a Freescale display controller. It supports at most four
> > plane and provide an hardware cursor.
> >
> > This is a simplified version, only a primary plane, a fb created for
> > fbdev, a crtc, a connector for TFT LCD panel, an encoder, and the
> > encoder is not in use. Now this drver support fbdev only.
> 
> Hi,
> 
> Do you know if that driver also works on Vybrid devices? Vybrid has also
> DCU4 module with 2D-ACE functionality, also the registers look pretty
> similar. I was thinking about creating a driver for Vybrid anyway...
> 
> Some remarks below...
> 
> 
> >
> > Signed-off-by: Alison Wang 
> > Signed-off-by: Xiubo Li 
> > Signed-off-by: Jianwei Wang 
> > ---
> >  .../devicetree/bindings/video/fsl,dcfb.txt |  50 +++
> >  drivers/gpu/drm/Kconfig|   2 +
> >  drivers/gpu/drm/Makefile   |   1 +
> >  drivers/gpu/drm/fsl/Kconfig|  17 +
> >  drivers/gpu/drm/fsl/Makefile   |   7 +
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c | 412
> +
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h |  40 ++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c  | 323
> 
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h  | 167 +
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c|  43 +++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c  |  45 +++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h  |  22 ++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c| 124 +++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h|  28 ++
> >  14 files changed, 1281 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/video/fsl,dcfb.txt
> >  create mode 100644 drivers/gpu/drm/fsl/Kconfig  create mode 100644
> > drivers/gpu/drm/fsl/Makefile  create mode 100644
> > drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h
> >
> > diff --git a/Documentation/devicetree/bindings/video/fsl,dcfb.txt
> > b/Documentation/devicetree/bindings/video/fsl,dcfb.txt
> > new file mode 100644
> > index 000..de7da97
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/video/fsl,dcfb.txt
> > @@ -0,0 +1,50 @@
> > +* Freescale Simple Display Controller FB Driver
> 
> "FB Driver" probably refers more to a fbdev driver in the Linux kernel
> sense, but since this is a DRM driver this is somewhat confusing. The
> binding should describe the hardware, in the Vybrid RM mentions the IP as
> "Display Control Unit (DCU4)", so maybe
> 
> Freescale Display Controller Unit (DCU4) module
> 
> Also, instead of using dcfb, I would use somewhat more hardware describing,
> e.g. dcu4?
> 
> > +
> > +Required properties:
> > +- compatible:  Should be one of "fsl,ls1021a-dcfb".
> 
> If the driver also works for Vybrid, be favorable to have a generic
> compatible string, e.g. fsl,dcu4?
> 
> > +- reg: Address and length of the register set for dcfb.
> > +- clocks:  From common clock binding: handle to dcfb clock.
> > +- clock-names: From common clock binding: Shall be "dcfb".
> > +- display: The phandle to display node.
> > +
> > +Optio

[PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver

2015-03-19 Thread Daniel Vetter
On Fri, Mar 13, 2015 at 05:44:17PM +0800, Jianwei Wang wrote:
> This patch add support for Two Dimensional Animation and Compositing
> Engine (2D-ACE) on Freescale SoCs.
> 
> 2D-ACE is a Freescale display controller. It provide an hardware
> cursor.
> 
> This is a simplified version, only a primary plane, a fb created for
> fbdev, a crtc, a connector for TFT LCD panel, an encoder, and the
> encoder is not in use.
> 
> Signed-off-by: Alison Wang 
> Signed-off-by: Xiubo Li 
> Signed-off-by: Jianwei Wang 

I've spotted two more places where you need to upgrade to atomic functions
for legacy entry points. Otherwise it looks good from that pov. See
comments below.

Thanks, Daniel

> ---
> 
> Changed in v2: 
> - Add atomic support
> - Modify bindings file
> - Rename node for compatibility
> - Move platform related code out for compatibility
> 
> Added in v1: 
> - Add support for DCU display controller on the Freescale LS102x SoCs.
> - Create a primary plane, a fb created for fbdev, a crtc, a connector
> for TFT LCD panel, an encoder.
> 
>  arch/arm/mach-imx/mach-ls1021a.c|  36 
>  drivers/gpu/drm/Kconfig |   2 +
>  drivers/gpu/drm/Makefile|   1 +
>  drivers/gpu/drm/fsl/Kconfig |  17 ++
>  drivers/gpu/drm/fsl/Makefile|   8 +
>  drivers/gpu/drm/fsl/fsl_dcu_drm_connector.c | 203 
>  drivers/gpu/drm/fsl/fsl_dcu_drm_connector.h |  28 +++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c  | 164 
>  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h  |  26 +++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c   | 288 
> 
>  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h   | 168 
>  drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c |  26 +++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c   |  42 
>  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h   |  17 ++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c | 187 ++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h |  23 +++
>  include/linux/fsl/dcu.h |  22 +++
>  17 files changed, 1258 insertions(+)
>  create mode 100644 drivers/gpu/drm/fsl/Kconfig
>  create mode 100644 drivers/gpu/drm/fsl/Makefile
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_connector.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_connector.h
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h
>  create mode 100644 include/linux/fsl/dcu.h
> 
> diff --git a/arch/arm/mach-imx/mach-ls1021a.c 
> b/arch/arm/mach-imx/mach-ls1021a.c
> index b89c858..4fb346d 100644
> --- a/arch/arm/mach-imx/mach-ls1021a.c
> +++ b/arch/arm/mach-imx/mach-ls1021a.c
> @@ -8,9 +8,44 @@
>   */
>  
>  #include 
> +#include 
> +#include 
> +#include 
> +#include 
>  
>  #include "common.h"
>  
> +void dcu_pixclk_disable(void)
> +{
> + struct regmap *scfg_regmap;
> +
> + scfg_regmap = syscon_regmap_lookup_by_compatible("fsl,ls1021a-scfg");
> + if (IS_ERR(scfg_regmap)) {
> + pr_err("No syscfg phandle specified\n");
> + return;
> + }
> +
> + regmap_write(scfg_regmap, SCFG_PIXCLKCR, PXCK_DISABLE);
> +}
> +
> +void dcu_pixclk_enable(void)
> +{
> + struct regmap *scfg_regmap;
> +
> + scfg_regmap = syscon_regmap_lookup_by_compatible("fsl,ls1021a-scfg");
> + if (IS_ERR(scfg_regmap)) {
> + pr_err("No syscfg phandle specified\n");
> + return;
> + }
> +
> + regmap_write(scfg_regmap, SCFG_PIXCLKCR, PXCK_ENABLE);
> +}
> +
> +static void __init ls1021a_init_machine(void)
> +{
> + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> + dcu_pixclk_enable();
> +}
>  static const char * const ls1021a_dt_compat[] __initconst = {
>   "fsl,ls1021a",
>   NULL,
> @@ -18,5 +53,6 @@ static const char * const ls1021a_dt_compat[] __initconst = 
> {
>  
>  DT_MACHINE_START(LS1021A, "Freescale LS1021A")
>   .smp= smp_ops(ls1021a_smp_ops),
> + .init_machine   = ls1021a_init_machine,
>   .dt_compat  = ls1021a_dt_compat,
>  MACHINE_END
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 151a050..a6957aa 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -199,6 +199,8 @@ source "drivers/gpu/drm/bochs/Kconfig"
>  
>  source "drivers/gpu/drm/msm/Kconfig"
>  
> +source "drivers/gpu/drm/fsl/Kconfig"
> +
>  source "drivers/gpu/drm/tegra/Kconfig"
>  
>  source "drivers/gpu/drm/panel/Kconfig"
> diff --git 

[PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver

2015-03-19 Thread jianwei.w...@freescale.com
Hi Stefan,

Thank you for your comment. I'll correct this next time.


> -Original Message-
> From: Stefan Agner [mailto:stefan at agner.ch]
> Sent: Thursday, March 19, 2015 6:58 AM
> To: Wang Jianwei-B52261
> Cc: Wood Scott-B07421; airlied at linux.ie; jbarnes at virtuousgeek.org; dri-
> devel at lists.freedesktop.org; Xiubo Li; Wang Huan-B18965; linux-
> kernel at vger.kernel.org; Jin Zhengxiong-R64188; linux-arm-
> kernel at lists.infradead.org
> Subject: Re: [PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver
> 
> Hi Jianwei,
> 
> Normally, for the second and higher iteration of a patchset, developers
> add the version to the subject (e.g. PATCH v2). You can use the --reroll-
> count option when creating the patches with git format-patch.
> 
> On 2015-03-13 10:44, Jianwei Wang wrote:
> > This patch add support for Two Dimensional Animation and Compositing
> > Engine (2D-ACE) on Freescale SoCs.
> >
> > 2D-ACE is a Freescale display controller. It provide an hardware
> > cursor.
> >
> > This is a simplified version, only a primary plane, a fb created for
> > fbdev, a crtc, a connector for TFT LCD panel, an encoder, and the
> > encoder is not in use.
> >
> > Signed-off-by: Alison Wang 
> > Signed-off-by: Xiubo Li 
> > Signed-off-by: Jianwei Wang 
> > ---
> >
> > Changed in v2:
> > - Add atomic support
> > - Modify bindings file
> > - Rename node for compatibility
> > - Move platform related code out for compatibility
> >
> > Added in v1:
> > - Add support for DCU display controller on the Freescale LS102x SoCs.
> > - Create a primary plane, a fb created for fbdev, a crtc, a connector
> > for TFT LCD panel, an encoder.
> >
> >  arch/arm/mach-imx/mach-ls1021a.c|  36 
> >  drivers/gpu/drm/Kconfig |   2 +
> >  drivers/gpu/drm/Makefile|   1 +
> >  drivers/gpu/drm/fsl/Kconfig |  17 ++
> >  drivers/gpu/drm/fsl/Makefile|   8 +
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_connector.c | 203
> >   drivers/gpu/drm/fsl/fsl_dcu_drm_connector.h |  28
> +++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c  | 164 
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h  |  26 +++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c   | 288
> 
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h   | 168 
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c |  26 +++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c   |  42 
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h   |  17 ++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c | 187 ++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h |  23 +++
> >  include/linux/fsl/dcu.h |  22 +++
> >  17 files changed, 1258 insertions(+)
> >  create mode 100644 drivers/gpu/drm/fsl/Kconfig  create mode 100644
> > drivers/gpu/drm/fsl/Makefile  create mode 100644
> > drivers/gpu/drm/fsl/fsl_dcu_drm_connector.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_connector.h
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h
> >  create mode 100644 include/linux/fsl/dcu.h
> >
> > diff --git a/arch/arm/mach-imx/mach-ls1021a.c
> > b/arch/arm/mach-imx/mach-ls1021a.c
> > index b89c858..4fb346d 100644
> > --- a/arch/arm/mach-imx/mach-ls1021a.c
> > +++ b/arch/arm/mach-imx/mach-ls1021a.c
> > @@ -8,9 +8,44 @@
> >   */
> >
> >  #include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> >
> >  #include "common.h"
> >
> > +void dcu_pixclk_disable(void)
> > +{
> > +   struct regmap *scfg_regmap;
> > +
> > +   scfg_regmap = syscon_regmap_lookup_by_compatible("fsl,ls1021a-scfg");
> > +   if (IS_ERR(scfg_regmap)) {
> > +   pr_err("No syscfg phandle specified\n");
> > +   return;
> > +   }
> > +
> > +   regmap_write(scfg_regmap, SCFG_PIXCLKCR, PXCK_DISABLE); }
> > +
> > +void dc

[PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver

2015-03-19 Thread Stefan Agner
Hi Jianwei,

Normally, for the second and higher iteration of a patchset, developers
add the version to the subject (e.g. PATCH v2). You can use the
--reroll-count option when creating the patches with git format-patch.

On 2015-03-13 10:44, Jianwei Wang wrote:
> This patch add support for Two Dimensional Animation and Compositing
> Engine (2D-ACE) on Freescale SoCs.
> 
> 2D-ACE is a Freescale display controller. It provide an hardware
> cursor.
> 
> This is a simplified version, only a primary plane, a fb created for
> fbdev, a crtc, a connector for TFT LCD panel, an encoder, and the
> encoder is not in use.
> 
> Signed-off-by: Alison Wang 
> Signed-off-by: Xiubo Li 
> Signed-off-by: Jianwei Wang 
> ---
> 
> Changed in v2: 
> - Add atomic support
> - Modify bindings file
> - Rename node for compatibility
> - Move platform related code out for compatibility
> 
> Added in v1: 
> - Add support for DCU display controller on the Freescale LS102x SoCs.
> - Create a primary plane, a fb created for fbdev, a crtc, a connector
> for TFT LCD panel, an encoder.
> 
>  arch/arm/mach-imx/mach-ls1021a.c|  36 
>  drivers/gpu/drm/Kconfig |   2 +
>  drivers/gpu/drm/Makefile|   1 +
>  drivers/gpu/drm/fsl/Kconfig |  17 ++
>  drivers/gpu/drm/fsl/Makefile|   8 +
>  drivers/gpu/drm/fsl/fsl_dcu_drm_connector.c | 203 
>  drivers/gpu/drm/fsl/fsl_dcu_drm_connector.h |  28 +++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c  | 164 
>  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h  |  26 +++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c   | 288 
> 
>  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h   | 168 
>  drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c |  26 +++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c   |  42 
>  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h   |  17 ++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c | 187 ++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h |  23 +++
>  include/linux/fsl/dcu.h |  22 +++
>  17 files changed, 1258 insertions(+)
>  create mode 100644 drivers/gpu/drm/fsl/Kconfig
>  create mode 100644 drivers/gpu/drm/fsl/Makefile
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_connector.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_connector.h
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h
>  create mode 100644 include/linux/fsl/dcu.h
> 
> diff --git a/arch/arm/mach-imx/mach-ls1021a.c 
> b/arch/arm/mach-imx/mach-ls1021a.c
> index b89c858..4fb346d 100644
> --- a/arch/arm/mach-imx/mach-ls1021a.c
> +++ b/arch/arm/mach-imx/mach-ls1021a.c
> @@ -8,9 +8,44 @@
>   */
>  
>  #include 
> +#include 
> +#include 
> +#include 
> +#include 
>  
>  #include "common.h"
>  
> +void dcu_pixclk_disable(void)
> +{
> + struct regmap *scfg_regmap;
> +
> + scfg_regmap = syscon_regmap_lookup_by_compatible("fsl,ls1021a-scfg");
> + if (IS_ERR(scfg_regmap)) {
> + pr_err("No syscfg phandle specified\n");
> + return;
> + }
> +
> + regmap_write(scfg_regmap, SCFG_PIXCLKCR, PXCK_DISABLE);
> +}
> +
> +void dcu_pixclk_enable(void)
> +{
> + struct regmap *scfg_regmap;
> +
> + scfg_regmap = syscon_regmap_lookup_by_compatible("fsl,ls1021a-scfg");
> + if (IS_ERR(scfg_regmap)) {
> + pr_err("No syscfg phandle specified\n");
> + return;
> + }
> +
> + regmap_write(scfg_regmap, SCFG_PIXCLKCR, PXCK_ENABLE);
> +}
> +
> +static void __init ls1021a_init_machine(void)
> +{
> + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> + dcu_pixclk_enable();
> +}

This change should be in a separate patch. However, I'm not convinced
that the current code is the right solution. You should try to avoid
calling from the driver directly into arch code.

I don't have access to the reference manual, hence I can't lookup that
module. But this register looks just like a clock gate...

On Vybrid, the Pixelclock is enabled through CCM_CSCDR3 and friends, and
the CCM module makes use of the common clock framework. In the end, the
clock is assigned to the nodes (e.g. DCU node in this case) and
requested during runtime. The framework makes sure the clock and the
relevant gates get enabled. See:
http://lxr.free-electrons.com/source/arch/arm/mach-imx/clk-vf610.c?v=3.12#L241

--
Stefan

>  static const char * const ls1021a_dt_compat[] __initconst = {
>   

[PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver

2015-03-13 Thread Jianwei Wang
This patch add support for Two Dimensional Animation and Compositing
Engine (2D-ACE) on Freescale SoCs.

2D-ACE is a Freescale display controller. It provide an hardware
cursor.

This is a simplified version, only a primary plane, a fb created for
fbdev, a crtc, a connector for TFT LCD panel, an encoder, and the
encoder is not in use.

Signed-off-by: Alison Wang 
Signed-off-by: Xiubo Li 
Signed-off-by: Jianwei Wang 
---

Changed in v2: 
- Add atomic support
- Modify bindings file
- Rename node for compatibility
- Move platform related code out for compatibility

Added in v1: 
- Add support for DCU display controller on the Freescale LS102x SoCs.
- Create a primary plane, a fb created for fbdev, a crtc, a connector
for TFT LCD panel, an encoder.

 arch/arm/mach-imx/mach-ls1021a.c|  36 
 drivers/gpu/drm/Kconfig |   2 +
 drivers/gpu/drm/Makefile|   1 +
 drivers/gpu/drm/fsl/Kconfig |  17 ++
 drivers/gpu/drm/fsl/Makefile|   8 +
 drivers/gpu/drm/fsl/fsl_dcu_drm_connector.c | 203 
 drivers/gpu/drm/fsl/fsl_dcu_drm_connector.h |  28 +++
 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c  | 164 
 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h  |  26 +++
 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c   | 288 
 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h   | 168 
 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c |  26 +++
 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c   |  42 
 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h   |  17 ++
 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c | 187 ++
 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h |  23 +++
 include/linux/fsl/dcu.h |  22 +++
 17 files changed, 1258 insertions(+)
 create mode 100644 drivers/gpu/drm/fsl/Kconfig
 create mode 100644 drivers/gpu/drm/fsl/Makefile
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_connector.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_connector.h
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h
 create mode 100644 include/linux/fsl/dcu.h

diff --git a/arch/arm/mach-imx/mach-ls1021a.c b/arch/arm/mach-imx/mach-ls1021a.c
index b89c858..4fb346d 100644
--- a/arch/arm/mach-imx/mach-ls1021a.c
+++ b/arch/arm/mach-imx/mach-ls1021a.c
@@ -8,9 +8,44 @@
  */

 #include 
+#include 
+#include 
+#include 
+#include 

 #include "common.h"

+void dcu_pixclk_disable(void)
+{
+   struct regmap *scfg_regmap;
+
+   scfg_regmap = syscon_regmap_lookup_by_compatible("fsl,ls1021a-scfg");
+   if (IS_ERR(scfg_regmap)) {
+   pr_err("No syscfg phandle specified\n");
+   return;
+   }
+
+   regmap_write(scfg_regmap, SCFG_PIXCLKCR, PXCK_DISABLE);
+}
+
+void dcu_pixclk_enable(void)
+{
+   struct regmap *scfg_regmap;
+
+   scfg_regmap = syscon_regmap_lookup_by_compatible("fsl,ls1021a-scfg");
+   if (IS_ERR(scfg_regmap)) {
+   pr_err("No syscfg phandle specified\n");
+   return;
+   }
+
+   regmap_write(scfg_regmap, SCFG_PIXCLKCR, PXCK_ENABLE);
+}
+
+static void __init ls1021a_init_machine(void)
+{
+   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+   dcu_pixclk_enable();
+}
 static const char * const ls1021a_dt_compat[] __initconst = {
"fsl,ls1021a",
NULL,
@@ -18,5 +53,6 @@ static const char * const ls1021a_dt_compat[] __initconst = {

 DT_MACHINE_START(LS1021A, "Freescale LS1021A")
.smp= smp_ops(ls1021a_smp_ops),
+   .init_machine   = ls1021a_init_machine,
.dt_compat  = ls1021a_dt_compat,
 MACHINE_END
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 151a050..a6957aa 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -199,6 +199,8 @@ source "drivers/gpu/drm/bochs/Kconfig"

 source "drivers/gpu/drm/msm/Kconfig"

+source "drivers/gpu/drm/fsl/Kconfig"
+
 source "drivers/gpu/drm/tegra/Kconfig"

 source "drivers/gpu/drm/panel/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 2c239b9..ab5b9ef 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -56,6 +56,7 @@ obj-$(CONFIG_DRM_UDL) += udl/
 obj-$(CONFIG_DRM_AST) += ast/
 obj-$(CONFIG_DRM_ARMADA) += armada/
 obj-$(CONFIG_DRM_ATMEL_HLCDC)  += atmel-hlcdc/
+obj-$(CONFIG_DRM_FSL_DCU) += fsl/
 obj-$(CONFIG_DRM_RCAR_DU) += rcar-du/
 obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/
 obj-$(CONFIG_DRM_OMAP) += omapdrm/
diff --git 

[PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver

2015-03-06 Thread jianwei.w...@freescale.com


> -Original Message-
> From: Stefan Agner [mailto:stefan at agner.ch]
> Sent: Wednesday, March 04, 2015 11:04 PM
> To: Wang Jianwei-B52261
> Cc: dri-devel at lists.freedesktop.org; jbarnes at virtuousgeek.org; Wood
> Scott-B07421; Xiubo Li; Wang Huan-B18965; linux-kernel at vger.kernel.org;
> linux-arm-kernel at lists.infradead.org
> Subject: Re: [PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver
> 
> On 2015-02-13 12:03, Jianwei Wang wrote:
> > This patch add support for Two Dimensional Animation and Compositing
> > Engine (2D-ACE) on the Freescale LS102x SoCs.
> >
> > 2D-ACE is a Freescale display controller. It supports at most four
> > plane and provide an hardware cursor.
> >
> > This is a simplified version, only a primary plane, a fb created for
> > fbdev, a crtc, a connector for TFT LCD panel, an encoder, and the
> > encoder is not in use. Now this drver support fbdev only.
> 
> Hi,
> 
> Do you know if that driver also works on Vybrid devices? Vybrid has also
> DCU4 module with 2D-ACE functionality, also the registers look pretty
> similar. I was thinking about creating a driver for Vybrid anyway...
> 
> Some remarks below...
> 

Hi,

As you say the display IP module on ls1021a and Vybrid device are all 2D-ACE, 
so I think this driver also works on Vybrid devices. I'd like to do something
for the compatibility.

> "FB Driver" probably refers more to a fbdev driver in the Linux kernel
> sense, but since this is a DRM driver this is somewhat confusing. The
> binding should describe the hardware, in the Vybrid RM mentions the IP as
> "Display Control Unit (DCU4)", so maybe
> 
> Freescale Display Controller Unit (DCU4) module
> 
> Also, instead of using dcfb, I would use somewhat more hardware
> describing, e.g. dcu4?
> 
> > +
> > +Required properties:
> > +- compatible:  Should be one of "fsl,ls1021a-dcfb".
> 
> If the driver also works for Vybrid, be favorable to have a generic
> compatible string, e.g. fsl,dcu4?

Thank you for your comments, I'll modify it.

> > +   regmap_write(fsl_dev->scfg_regmap, 0x28, 0x8000);
> 
> What does this actually do? I don't think this exists in Vybrid, but I
> guess we could easily make the property optional which would then not
> call this function...
> 
> --
> Stefan

This is a platform related register. I would move it to platform related
file (arch/arm/mach-imx/mach-ls1021a.c).

Regards,
Jianwei

> 
> >
> > Signed-off-by: Alison Wang 
> > Signed-off-by: Xiubo Li 
> > Signed-off-by: Jianwei Wang 
> > ---
> >  .../devicetree/bindings/video/fsl,dcfb.txt |  50 +++
> >  drivers/gpu/drm/Kconfig|   2 +
> >  drivers/gpu/drm/Makefile   |   1 +
> >  drivers/gpu/drm/fsl/Kconfig|  17 +
> >  drivers/gpu/drm/fsl/Makefile   |   7 +
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c | 412
> +
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h |  40 ++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c  | 323
> 
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h  | 167 +
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c|  43 +++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c  |  45 +++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h  |  22 ++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c| 124 +++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h|  28 ++
> >  14 files changed, 1281 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/video/fsl,dcfb.txt
> >  create mode 100644 drivers/gpu/drm/fsl/Kconfig  create mode 100644
> > drivers/gpu/drm/fsl/Makefile  create mode 100644
> > drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h
> >
> > diff --git a/Documentation/devicetree/bindings/video/fsl,dcfb.txt
> > b/Documentation/devicetree/bindings/video/fsl,dcfb.txt
> > new file mode 100644
> > index 000..de7da97
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/vid

[PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver

2015-03-04 Thread Stefan Agner
On 2015-02-13 12:03, Jianwei Wang wrote:
> This patch add support for Two Dimensional Animation and Compositing
> Engine (2D-ACE) on the Freescale LS102x SoCs.
> 
> 2D-ACE is a Freescale display controller. It supports at most four
> plane and provide an hardware cursor.
> 
> This is a simplified version, only a primary plane, a fb created for
> fbdev, a crtc, a connector for TFT LCD panel, an encoder, and the
> encoder is not in use. Now this drver support fbdev only.

Hi,

Do you know if that driver also works on Vybrid devices? Vybrid has also
DCU4 module with 2D-ACE functionality, also the registers look pretty
similar. I was thinking about creating a driver for Vybrid anyway...

Some remarks below...


> 
> Signed-off-by: Alison Wang 
> Signed-off-by: Xiubo Li 
> Signed-off-by: Jianwei Wang 
> ---
>  .../devicetree/bindings/video/fsl,dcfb.txt |  50 +++
>  drivers/gpu/drm/Kconfig|   2 +
>  drivers/gpu/drm/Makefile   |   1 +
>  drivers/gpu/drm/fsl/Kconfig|  17 +
>  drivers/gpu/drm/fsl/Makefile   |   7 +
>  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c | 412 
> +
>  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h |  40 ++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c  | 323 
>  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h  | 167 +
>  drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c|  43 +++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c  |  45 +++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h  |  22 ++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c| 124 +++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h|  28 ++
>  14 files changed, 1281 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/video/fsl,dcfb.txt
>  create mode 100644 drivers/gpu/drm/fsl/Kconfig
>  create mode 100644 drivers/gpu/drm/fsl/Makefile
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h
> 
> diff --git a/Documentation/devicetree/bindings/video/fsl,dcfb.txt
> b/Documentation/devicetree/bindings/video/fsl,dcfb.txt
> new file mode 100644
> index 000..de7da97
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/video/fsl,dcfb.txt
> @@ -0,0 +1,50 @@
> +* Freescale Simple Display Controller FB Driver

"FB Driver" probably refers more to a fbdev driver in the Linux kernel
sense, but since this is a DRM driver this is somewhat confusing. The
binding should describe the hardware, in the Vybrid RM mentions the IP
as "Display Control Unit (DCU4)", so maybe

Freescale Display Controller Unit (DCU4) module

Also, instead of using dcfb, I would use somewhat more hardware
describing, e.g. dcu4?

> +
> +Required properties:
> +- compatible:Should be one of "fsl,ls1021a-dcfb".

If the driver also works for Vybrid, be favorable to have a generic
compatible string, e.g. fsl,dcu4?

> +- reg:   Address and length of the register set for dcfb.
> +- clocks:From common clock binding: handle to dcfb clock.
> +- clock-names:   From common clock binding: Shall be "dcfb".
> +- display:   The phandle to display node.
> +
> +Optional properties:
> +- scfg-controller:   The phandle of scfg node.
> +
> +Required properties:
> +- bits-per-pixel:<16> for RGB565,
> + <24> for RGB888,
> + <32> for RGB.
> +
> +Required timing node for dispplay sub-node:
> +- display-timings:   Refer to binding doc display-timing.txt for details.
> +
> +Examples:
> +dcfb: dcfb at 2ce {
> + compatible = "fsl,ls1021a-dcfb";
> + reg = <0x0 0x2ce 0x0 0x1>;
> + clocks = <_clk 0>;
> + clock-names = "dcfb";
> + scfg-controller = <>;
> + display = <>;
> +
> + display: display at 0 {
> + bits-per-pixel = <24>;
> +
> + display-timings {
> + native-mode = <>;
> + timing0: nl4827hc19 {
> + clock-frequency = <1087>;
> + hactive = <480>;
> + vactive = <272>;
> + hback-porch = <2>;
> + hfront-porch = <2>;
> + vback-porch = <1>;
> + vfront-porch = <1>;
> + hsync-len = <41>;
> + vsync-len = <2>;
> +   

[PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver

2015-03-04 Thread jianwei.w...@freescale.com
> -Original Message-
> From: Daniel Vetter [mailto:daniel.vetter at ffwll.ch] On Behalf Of Daniel
> Vetter
> Sent: Tuesday, March 03, 2015 6:54 PM
> To: Wang Jianwei-B52261
> Cc: Daniel Vetter; dri-devel at lists.freedesktop.org;
> jbarnes at virtuousgeek.org; Wood Scott-B07421; Xiubo Li; Wang Huan-B18965;
> linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> Subject: Re: [PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver
> 
> On Tue, Mar 03, 2015 at 10:06:57AM +, Jianwei.Wang at freescale.com
> wrote:
> > > -Original Message-
> > > From: Daniel Vetter [mailto:daniel.vetter at ffwll.ch] On Behalf Of
> Daniel
> > > Vetter
> > > Sent: Sunday, February 22, 2015 7:35 PM
> > > To: Wang Jianwei-B52261
> > > Cc: dri-devel at lists.freedesktop.org; jbarnes at virtuousgeek.org; Wood
> > > Scott-B07421; Xiubo Li; Wang Huan-B18965; linux-
> kernel at vger.kernel.org;
> > > linux-arm-kernel at lists.infradead.org
> > > Subject: Re: [PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver
> > >
> > > On Fri, Feb 13, 2015 at 07:03:54PM +0800, Jianwei Wang wrote:
> > > > This patch add support for Two Dimensional Animation and
> Compositing
> > > > Engine (2D-ACE) on the Freescale LS102x SoCs.
> > > >
> > > > 2D-ACE is a Freescale display controller. It supports at most four
> > > > plane and provide an hardware cursor.
> > > >
> > > > This is a simplified version, only a primary plane, a fb created
> for
> > > > fbdev, a crtc, a connector for TFT LCD panel, an encoder, and the
> > > > encoder is not in use. Now this drver support fbdev only.
> > > >
> > > > Signed-off-by: Alison Wang 
> > > > Signed-off-by: Xiubo Li 
> > > > Signed-off-by: Jianwei Wang 
> > >
> > > Imo adding a new driver without primary plane support (use
> > > drm_crtc_init_with_planes) and without atomic support doesn't make
> sense
> > > any more.
> > >
> > > Also, what do you mean with "support fbdev only"?
> > > -Daniel
> > >
> >
> > Daniel,
> >
> > This driver has supported primary plane (use drm_crtc_init_with_planes)
> > Already.
> > If atomic support is a must? 2D-ACE is a simple display Controller and
> > this is a simplified version. If atomic support is not a must, I want
> to add
> > it with patches, is it ok?
> 
> atomic is the new way the drm display subsystem works, not supporting it
> in new drivers makes this transition even longer. Since I guess if you
> don't want to do the conversion now no one else will do it anytime later,
> and then we're stuck with this driver as-is. On top of that atomic should
> simplify testing for your driver a lot (since a few things are take care
> of for you in the generic atomic code).
> -Daniel
> 

Okey! I'll add atomic support in this driver.

Regards,
Wang Jianwei

> >
> > " Now this drver support fbdev only." if this sentence confuses you,
> > I'd like remove it. In fact I mean that this driver only create a
> framebuffer
> > dev (use drm_fbdev_cma_init).
> >
> > Thanks
> > Regards,
> > Wang Jianwei
> >
> > > > ---
> > > >  .../devicetree/bindings/video/fsl,dcfb.txt |  50 +++
> > > >  drivers/gpu/drm/Kconfig|   2 +
> > > >  drivers/gpu/drm/Makefile   |   1 +
> > > >  drivers/gpu/drm/fsl/Kconfig|  17 +
> > > >  drivers/gpu/drm/fsl/Makefile   |   7 +
> > > >  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c | 412
> > > +
> > > >  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h |  40 ++
> > > >  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c  | 323
> > > 
> > > >  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h  | 167 +
> > > >  drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c|  43 +++
> > > >  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c  |  45 +++
> > > >  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h  |  22 ++
> > > >  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c| 124 +++
> > > >  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h|  28 ++
> > > >  14 files changed, 1281 insertions(+)
> > > >  create mode 100644
> > > > Documentation/devicetree/bindings/video/fsl,dcfb.txt
> > > >  create mode 100644 drivers/gpu/d

[PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver

2015-03-03 Thread Daniel Vetter
On Tue, Mar 03, 2015 at 10:06:57AM +, Jianwei.Wang at freescale.com wrote:
> > -Original Message-
> > From: Daniel Vetter [mailto:daniel.vetter at ffwll.ch] On Behalf Of Daniel
> > Vetter
> > Sent: Sunday, February 22, 2015 7:35 PM
> > To: Wang Jianwei-B52261
> > Cc: dri-devel at lists.freedesktop.org; jbarnes at virtuousgeek.org; Wood
> > Scott-B07421; Xiubo Li; Wang Huan-B18965; linux-kernel at vger.kernel.org;
> > linux-arm-kernel at lists.infradead.org
> > Subject: Re: [PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver
> > 
> > On Fri, Feb 13, 2015 at 07:03:54PM +0800, Jianwei Wang wrote:
> > > This patch add support for Two Dimensional Animation and Compositing
> > > Engine (2D-ACE) on the Freescale LS102x SoCs.
> > >
> > > 2D-ACE is a Freescale display controller. It supports at most four
> > > plane and provide an hardware cursor.
> > >
> > > This is a simplified version, only a primary plane, a fb created for
> > > fbdev, a crtc, a connector for TFT LCD panel, an encoder, and the
> > > encoder is not in use. Now this drver support fbdev only.
> > >
> > > Signed-off-by: Alison Wang 
> > > Signed-off-by: Xiubo Li 
> > > Signed-off-by: Jianwei Wang 
> > 
> > Imo adding a new driver without primary plane support (use
> > drm_crtc_init_with_planes) and without atomic support doesn't make sense
> > any more.
> > 
> > Also, what do you mean with "support fbdev only"?
> > -Daniel
> > 
>  
> Daniel,
> 
> This driver has supported primary plane (use drm_crtc_init_with_planes) 
> Already. 
> If atomic support is a must? 2D-ACE is a simple display Controller and
> this is a simplified version. If atomic support is not a must, I want to add 
> it with patches, is it ok?

atomic is the new way the drm display subsystem works, not supporting it
in new drivers makes this transition even longer. Since I guess if you
don't want to do the conversion now no one else will do it anytime later,
and then we're stuck with this driver as-is. On top of that atomic should
simplify testing for your driver a lot (since a few things are take care
of for you in the generic atomic code).
-Daniel

> 
> " Now this drver support fbdev only." if this sentence confuses you,
> I'd like remove it. In fact I mean that this driver only create a framebuffer
> dev (use drm_fbdev_cma_init).
> 
> Thanks
> Regards,
> Wang Jianwei
> 
> > > ---
> > >  .../devicetree/bindings/video/fsl,dcfb.txt |  50 +++
> > >  drivers/gpu/drm/Kconfig|   2 +
> > >  drivers/gpu/drm/Makefile   |   1 +
> > >  drivers/gpu/drm/fsl/Kconfig|  17 +
> > >  drivers/gpu/drm/fsl/Makefile   |   7 +
> > >  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c | 412
> > +
> > >  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h |  40 ++
> > >  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c  | 323
> > 
> > >  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h  | 167 +
> > >  drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c|  43 +++
> > >  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c  |  45 +++
> > >  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h  |  22 ++
> > >  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c| 124 +++
> > >  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h|  28 ++
> > >  14 files changed, 1281 insertions(+)
> > >  create mode 100644
> > > Documentation/devicetree/bindings/video/fsl,dcfb.txt
> > >  create mode 100644 drivers/gpu/drm/fsl/Kconfig  create mode 100644
> > > drivers/gpu/drm/fsl/Makefile  create mode 100644
> > > drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c
> > >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h
> > >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c
> > >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h
> > >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c
> > >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c
> > >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h
> > >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c
> > >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h
> > >
> > > diff --git a/Documentation/devicetree/bindings/video/fsl,dcfb.txt
> > > b/Documentation/devicetree/bindings/video/fsl,dcfb.txt
> > > new file mode 100644
> > > index 000..de7da97
> &g

[PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver

2015-03-03 Thread jianwei.w...@freescale.com
> -Original Message-
> From: Daniel Vetter [mailto:daniel.vetter at ffwll.ch] On Behalf Of Daniel
> Vetter
> Sent: Sunday, February 22, 2015 7:35 PM
> To: Wang Jianwei-B52261
> Cc: dri-devel at lists.freedesktop.org; jbarnes at virtuousgeek.org; Wood
> Scott-B07421; Xiubo Li; Wang Huan-B18965; linux-kernel at vger.kernel.org;
> linux-arm-kernel at lists.infradead.org
> Subject: Re: [PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver
> 
> On Fri, Feb 13, 2015 at 07:03:54PM +0800, Jianwei Wang wrote:
> > This patch add support for Two Dimensional Animation and Compositing
> > Engine (2D-ACE) on the Freescale LS102x SoCs.
> >
> > 2D-ACE is a Freescale display controller. It supports at most four
> > plane and provide an hardware cursor.
> >
> > This is a simplified version, only a primary plane, a fb created for
> > fbdev, a crtc, a connector for TFT LCD panel, an encoder, and the
> > encoder is not in use. Now this drver support fbdev only.
> >
> > Signed-off-by: Alison Wang 
> > Signed-off-by: Xiubo Li 
> > Signed-off-by: Jianwei Wang 
> 
> Imo adding a new driver without primary plane support (use
> drm_crtc_init_with_planes) and without atomic support doesn't make sense
> any more.
> 
> Also, what do you mean with "support fbdev only"?
> -Daniel
> 

Daniel,

This driver has supported primary plane (use drm_crtc_init_with_planes) 
Already. 
If atomic support is a must? 2D-ACE is a simple display Controller and
this is a simplified version. If atomic support is not a must, I want to add 
it with patches, is it ok?

" Now this drver support fbdev only." if this sentence confuses you,
I'd like remove it. In fact I mean that this driver only create a framebuffer
dev (use drm_fbdev_cma_init).

Thanks
Regards,
Wang Jianwei

> > ---
> >  .../devicetree/bindings/video/fsl,dcfb.txt |  50 +++
> >  drivers/gpu/drm/Kconfig|   2 +
> >  drivers/gpu/drm/Makefile   |   1 +
> >  drivers/gpu/drm/fsl/Kconfig|  17 +
> >  drivers/gpu/drm/fsl/Makefile   |   7 +
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c | 412
> +
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h |  40 ++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c  | 323
> 
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h  | 167 +
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c|  43 +++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c  |  45 +++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h  |  22 ++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c| 124 +++
> >  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h|  28 ++
> >  14 files changed, 1281 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/video/fsl,dcfb.txt
> >  create mode 100644 drivers/gpu/drm/fsl/Kconfig  create mode 100644
> > drivers/gpu/drm/fsl/Makefile  create mode 100644
> > drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c
> >  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h
> >
> > diff --git a/Documentation/devicetree/bindings/video/fsl,dcfb.txt
> > b/Documentation/devicetree/bindings/video/fsl,dcfb.txt
> > new file mode 100644
> > index 000..de7da97
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/video/fsl,dcfb.txt
> > @@ -0,0 +1,50 @@
> > +* Freescale Simple Display Controller FB Driver
> > +
> > +Required properties:
> > +- compatible:  Should be one of "fsl,ls1021a-dcfb".
> > +- reg: Address and length of the register set for dcfb.
> > +- clocks:  From common clock binding: handle to dcfb clock.
> > +- clock-names: From common clock binding: Shall be "dcfb".
> > +- display: The phandle to display node.
> > +
> > +Optional properties:
> > +- scfg-controller: The phandle of scfg node.
> > +
> > +Required properties:
> > +- bits-per-pixel:  <16> for RGB565,
> > +   <24> for RGB888,
> > + 

[PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver

2015-02-22 Thread Daniel Vetter
On Fri, Feb 13, 2015 at 07:03:54PM +0800, Jianwei Wang wrote:
> This patch add support for Two Dimensional Animation and Compositing
> Engine (2D-ACE) on the Freescale LS102x SoCs.
> 
> 2D-ACE is a Freescale display controller. It supports at most four
> plane and provide an hardware cursor.
> 
> This is a simplified version, only a primary plane, a fb created for
> fbdev, a crtc, a connector for TFT LCD panel, an encoder, and the
> encoder is not in use. Now this drver support fbdev only.
> 
> Signed-off-by: Alison Wang 
> Signed-off-by: Xiubo Li 
> Signed-off-by: Jianwei Wang 

Imo adding a new driver without primary plane support (use
drm_crtc_init_with_planes) and without atomic support doesn't make sense
any more.

Also, what do you mean with "support fbdev only"?
-Daniel

> ---
>  .../devicetree/bindings/video/fsl,dcfb.txt |  50 +++
>  drivers/gpu/drm/Kconfig|   2 +
>  drivers/gpu/drm/Makefile   |   1 +
>  drivers/gpu/drm/fsl/Kconfig|  17 +
>  drivers/gpu/drm/fsl/Makefile   |   7 +
>  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c | 412 
> +
>  drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h |  40 ++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c  | 323 
>  drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h  | 167 +
>  drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c|  43 +++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c  |  45 +++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h  |  22 ++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c| 124 +++
>  drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h|  28 ++
>  14 files changed, 1281 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/video/fsl,dcfb.txt
>  create mode 100644 drivers/gpu/drm/fsl/Kconfig
>  create mode 100644 drivers/gpu/drm/fsl/Makefile
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c
>  create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h
> 
> diff --git a/Documentation/devicetree/bindings/video/fsl,dcfb.txt 
> b/Documentation/devicetree/bindings/video/fsl,dcfb.txt
> new file mode 100644
> index 000..de7da97
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/video/fsl,dcfb.txt
> @@ -0,0 +1,50 @@
> +* Freescale Simple Display Controller FB Driver
> +
> +Required properties:
> +- compatible:Should be one of "fsl,ls1021a-dcfb".
> +- reg:   Address and length of the register set for dcfb.
> +- clocks:From common clock binding: handle to dcfb clock.
> +- clock-names:   From common clock binding: Shall be "dcfb".
> +- display:   The phandle to display node.
> +
> +Optional properties:
> +- scfg-controller:   The phandle of scfg node.
> +
> +Required properties:
> +- bits-per-pixel:<16> for RGB565,
> + <24> for RGB888,
> + <32> for RGB.
> +
> +Required timing node for dispplay sub-node:
> +- display-timings:   Refer to binding doc display-timing.txt for details.
> +
> +Examples:
> +dcfb: dcfb at 2ce {
> + compatible = "fsl,ls1021a-dcfb";
> + reg = <0x0 0x2ce 0x0 0x1>;
> + clocks = <_clk 0>;
> + clock-names = "dcfb";
> + scfg-controller = <>;
> + display = <>;
> +
> + display: display at 0 {
> + bits-per-pixel = <24>;
> +
> + display-timings {
> + native-mode = <>;
> + timing0: nl4827hc19 {
> + clock-frequency = <1087>;
> + hactive = <480>;
> + vactive = <272>;
> + hback-porch = <2>;
> + hfront-porch = <2>;
> + vback-porch = <1>;
> + vfront-porch = <1>;
> + hsync-len = <41>;
> + vsync-len = <2>;
> + hsync-active = <1>;
> + vsync-active = <1>;
> + };
> + };
> + };
> +};
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 151a050..a6957aa 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -199,6 +199,8 @@ source "drivers/gpu/drm/bochs/Kconfig"
>  
>  source "drivers/gpu/drm/msm/Kconfig"
>  
> +source "drivers/gpu/drm/fsl/Kconfig"
> +
>  source "drivers/gpu/drm/tegra/Kconfig"
>  
>  source 

[PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver

2015-02-13 Thread Jianwei Wang
This patch add support for Two Dimensional Animation and Compositing
Engine (2D-ACE) on the Freescale LS102x SoCs.

2D-ACE is a Freescale display controller. It supports at most four
plane and provide an hardware cursor.

This is a simplified version, only a primary plane, a fb created for
fbdev, a crtc, a connector for TFT LCD panel, an encoder, and the
encoder is not in use. Now this drver support fbdev only.

Signed-off-by: Alison Wang 
Signed-off-by: Xiubo Li 
Signed-off-by: Jianwei Wang 
---
 .../devicetree/bindings/video/fsl,dcfb.txt |  50 +++
 drivers/gpu/drm/Kconfig|   2 +
 drivers/gpu/drm/Makefile   |   1 +
 drivers/gpu/drm/fsl/Kconfig|  17 +
 drivers/gpu/drm/fsl/Makefile   |   7 +
 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c | 412 +
 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h |  40 ++
 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c  | 323 
 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h  | 167 +
 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c|  43 +++
 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c  |  45 +++
 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h  |  22 ++
 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c| 124 +++
 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h|  28 ++
 14 files changed, 1281 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/fsl,dcfb.txt
 create mode 100644 drivers/gpu/drm/fsl/Kconfig
 create mode 100644 drivers/gpu/drm/fsl/Makefile
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c
 create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h

diff --git a/Documentation/devicetree/bindings/video/fsl,dcfb.txt 
b/Documentation/devicetree/bindings/video/fsl,dcfb.txt
new file mode 100644
index 000..de7da97
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/fsl,dcfb.txt
@@ -0,0 +1,50 @@
+* Freescale Simple Display Controller FB Driver
+
+Required properties:
+- compatible:  Should be one of "fsl,ls1021a-dcfb".
+- reg: Address and length of the register set for dcfb.
+- clocks:  From common clock binding: handle to dcfb clock.
+- clock-names: From common clock binding: Shall be "dcfb".
+- display: The phandle to display node.
+
+Optional properties:
+- scfg-controller: The phandle of scfg node.
+
+Required properties:
+- bits-per-pixel:  <16> for RGB565,
+   <24> for RGB888,
+   <32> for RGB.
+
+Required timing node for dispplay sub-node:
+- display-timings: Refer to binding doc display-timing.txt for details.
+
+Examples:
+dcfb: dcfb at 2ce {
+   compatible = "fsl,ls1021a-dcfb";
+   reg = <0x0 0x2ce 0x0 0x1>;
+   clocks = <_clk 0>;
+   clock-names = "dcfb";
+   scfg-controller = <>;
+   display = <>;
+
+   display: display at 0 {
+   bits-per-pixel = <24>;
+
+   display-timings {
+   native-mode = <>;
+   timing0: nl4827hc19 {
+   clock-frequency = <1087>;
+   hactive = <480>;
+   vactive = <272>;
+   hback-porch = <2>;
+   hfront-porch = <2>;
+   vback-porch = <1>;
+   vfront-porch = <1>;
+   hsync-len = <41>;
+   vsync-len = <2>;
+   hsync-active = <1>;
+   vsync-active = <1>;
+   };
+   };
+   };
+};
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 151a050..a6957aa 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -199,6 +199,8 @@ source "drivers/gpu/drm/bochs/Kconfig"

 source "drivers/gpu/drm/msm/Kconfig"

+source "drivers/gpu/drm/fsl/Kconfig"
+
 source "drivers/gpu/drm/tegra/Kconfig"

 source "drivers/gpu/drm/panel/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 2c239b9..ab5b9ef 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -56,6 +56,7 @@ obj-$(CONFIG_DRM_UDL) += udl/
 obj-$(CONFIG_DRM_AST) += ast/
 obj-$(CONFIG_DRM_ARMADA) += armada/
 obj-$(CONFIG_DRM_ATMEL_HLCDC)  += atmel-hlcdc/
+obj-$(CONFIG_DRM_FSL_DCU) += fsl/
 obj-$(CONFIG_DRM_RCAR_DU) += rcar-du/
 obj-$(CONFIG_DRM_SHMOBILE)