[PATCH V3 3/3] drm: Add new driver for MXSFB controller

2016-12-09 Thread Ying Liu
Hi Marek,

MXSFB can connect with LDB(LVDS display bridge) on i.MX6SX.
We have an existing LDB drm driver which works with IPUv3
embedded in i.MX6Q/DL and i.MX53.
Do you see a clear picture how all of these stuffs work together?

Adding Philipp also.

Regards,
Liu Ying


On Fri, Dec 2, 2016 at 2:02 AM, Marek Vasut  wrote:
> On 11/29/2016 09:15 PM, Daniel Vetter wrote:
>> On Tue, Nov 29, 2016 at 06:27:30PM +0100, Marek Vasut wrote:
>>> On 11/14/2016 12:47 PM, Daniel Vetter wrote:
 On Mon, Nov 14, 2016 at 11:10:36AM +0100, Marek Vasut wrote:
> Add new driver for the MXSFB controller found in i.MX23/28/6SX .
> The MXSFB controller is a simple framebuffer controller with one
> parallel LCD output. Unlike the MXSFB fbdev driver that is used
> on these systems now, this driver uses the DRM/KMS framework.
>
> Signed-off-by: Marek Vasut 
> Cc: Lucas Stach 
> Cc: Fabio Estevam 
> Cc: Shawn Guo 
> Cc: Daniel Vetter 
> --
> V2: - Use drm_simple_kms_helper to reduce amount of common code
> - Add dedicated OF compatible for i.MX6SX
> V3: - Update to latest next/master

 Imo looks all pretty. Please wrap up in a pull request as soon as you have
 acks from dt and all that and then send a pull request to Dave.
>>>
>>> I finally got an ACK from Rob on 2/3 , which Dave do you mean, Airlie ?
>>
>> Yup. We only have 1 drm maintainer ;-)
>
> OK, PR is out.
>
> --
> Best regards,
> Marek Vasut
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH V3 3/3] drm: Add new driver for MXSFB controller

2016-12-09 Thread Daniel Vetter
On Fri, Dec 09, 2016 at 01:24:07PM +0800, Ying Liu wrote:
> Hi Marek,
> 
> MXSFB can connect with LDB(LVDS display bridge) on i.MX6SX.
> We have an existing LDB drm driver which works with IPUv3
> embedded in i.MX6Q/DL and i.MX53.
> Do you see a clear picture how all of these stuffs work together?

As long as that lvds display bridge is implemented as a drm_bridge driver
it should be all fine. MXSFB is using the simple display pipe helpers,
which fully support bridge drivers.
-Daniel

> 
> Adding Philipp also.
> 
> Regards,
> Liu Ying
> 
> 
> On Fri, Dec 2, 2016 at 2:02 AM, Marek Vasut  wrote:
> > On 11/29/2016 09:15 PM, Daniel Vetter wrote:
> >> On Tue, Nov 29, 2016 at 06:27:30PM +0100, Marek Vasut wrote:
> >>> On 11/14/2016 12:47 PM, Daniel Vetter wrote:
>  On Mon, Nov 14, 2016 at 11:10:36AM +0100, Marek Vasut wrote:
> > Add new driver for the MXSFB controller found in i.MX23/28/6SX .
> > The MXSFB controller is a simple framebuffer controller with one
> > parallel LCD output. Unlike the MXSFB fbdev driver that is used
> > on these systems now, this driver uses the DRM/KMS framework.
> >
> > Signed-off-by: Marek Vasut 
> > Cc: Lucas Stach 
> > Cc: Fabio Estevam 
> > Cc: Shawn Guo 
> > Cc: Daniel Vetter 
> > --
> > V2: - Use drm_simple_kms_helper to reduce amount of common code
> > - Add dedicated OF compatible for i.MX6SX
> > V3: - Update to latest next/master
> 
>  Imo looks all pretty. Please wrap up in a pull request as soon as you 
>  have
>  acks from dt and all that and then send a pull request to Dave.
> >>>
> >>> I finally got an ACK from Rob on 2/3 , which Dave do you mean, Airlie ?
> >>
> >> Yup. We only have 1 drm maintainer ;-)
> >
> > OK, PR is out.
> >
> > --
> > Best regards,
> > Marek Vasut
> > ___
> > dri-devel mailing list
> > dri-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH V3 3/3] drm: Add new driver for MXSFB controller

2016-12-01 Thread Marek Vasut
On 11/29/2016 09:15 PM, Daniel Vetter wrote:
> On Tue, Nov 29, 2016 at 06:27:30PM +0100, Marek Vasut wrote:
>> On 11/14/2016 12:47 PM, Daniel Vetter wrote:
>>> On Mon, Nov 14, 2016 at 11:10:36AM +0100, Marek Vasut wrote:
 Add new driver for the MXSFB controller found in i.MX23/28/6SX .
 The MXSFB controller is a simple framebuffer controller with one
 parallel LCD output. Unlike the MXSFB fbdev driver that is used
 on these systems now, this driver uses the DRM/KMS framework.

 Signed-off-by: Marek Vasut 
 Cc: Lucas Stach 
 Cc: Fabio Estevam 
 Cc: Shawn Guo 
 Cc: Daniel Vetter 
 --
 V2: - Use drm_simple_kms_helper to reduce amount of common code
 - Add dedicated OF compatible for i.MX6SX
 V3: - Update to latest next/master
>>>
>>> Imo looks all pretty. Please wrap up in a pull request as soon as you have
>>> acks from dt and all that and then send a pull request to Dave.
>>
>> I finally got an ACK from Rob on 2/3 , which Dave do you mean, Airlie ?
> 
> Yup. We only have 1 drm maintainer ;-)

OK, PR is out.

-- 
Best regards,
Marek Vasut


[PATCH V3 3/3] drm: Add new driver for MXSFB controller

2016-11-29 Thread Daniel Vetter
On Tue, Nov 29, 2016 at 06:27:30PM +0100, Marek Vasut wrote:
> On 11/14/2016 12:47 PM, Daniel Vetter wrote:
> > On Mon, Nov 14, 2016 at 11:10:36AM +0100, Marek Vasut wrote:
> >> Add new driver for the MXSFB controller found in i.MX23/28/6SX .
> >> The MXSFB controller is a simple framebuffer controller with one
> >> parallel LCD output. Unlike the MXSFB fbdev driver that is used
> >> on these systems now, this driver uses the DRM/KMS framework.
> >>
> >> Signed-off-by: Marek Vasut 
> >> Cc: Lucas Stach 
> >> Cc: Fabio Estevam 
> >> Cc: Shawn Guo 
> >> Cc: Daniel Vetter 
> >> --
> >> V2: - Use drm_simple_kms_helper to reduce amount of common code
> >> - Add dedicated OF compatible for i.MX6SX
> >> V3: - Update to latest next/master
> > 
> > Imo looks all pretty. Please wrap up in a pull request as soon as you have
> > acks from dt and all that and then send a pull request to Dave.
> 
> I finally got an ACK from Rob on 2/3 , which Dave do you mean, Airlie ?

Yup. We only have 1 drm maintainer ;-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH V3 3/3] drm: Add new driver for MXSFB controller

2016-11-29 Thread Marek Vasut
On 11/14/2016 12:47 PM, Daniel Vetter wrote:
> On Mon, Nov 14, 2016 at 11:10:36AM +0100, Marek Vasut wrote:
>> Add new driver for the MXSFB controller found in i.MX23/28/6SX .
>> The MXSFB controller is a simple framebuffer controller with one
>> parallel LCD output. Unlike the MXSFB fbdev driver that is used
>> on these systems now, this driver uses the DRM/KMS framework.
>>
>> Signed-off-by: Marek Vasut 
>> Cc: Lucas Stach 
>> Cc: Fabio Estevam 
>> Cc: Shawn Guo 
>> Cc: Daniel Vetter 
>> --
>> V2: - Use drm_simple_kms_helper to reduce amount of common code
>> - Add dedicated OF compatible for i.MX6SX
>> V3: - Update to latest next/master
> 
> Imo looks all pretty. Please wrap up in a pull request as soon as you have
> acks from dt and all that and then send a pull request to Dave.

I finally got an ACK from Rob on 2/3 , which Dave do you mean, Airlie ?

-- 
Best regards,
Marek Vasut


[PATCH V3 3/3] drm: Add new driver for MXSFB controller

2016-11-14 Thread Daniel Vetter
On Mon, Nov 14, 2016 at 11:10:36AM +0100, Marek Vasut wrote:
> Add new driver for the MXSFB controller found in i.MX23/28/6SX .
> The MXSFB controller is a simple framebuffer controller with one
> parallel LCD output. Unlike the MXSFB fbdev driver that is used
> on these systems now, this driver uses the DRM/KMS framework.
> 
> Signed-off-by: Marek Vasut 
> Cc: Lucas Stach 
> Cc: Fabio Estevam 
> Cc: Shawn Guo 
> Cc: Daniel Vetter 
> --
> V2: - Use drm_simple_kms_helper to reduce amount of common code
> - Add dedicated OF compatible for i.MX6SX
> V3: - Update to latest next/master

Imo looks all pretty. Please wrap up in a pull request as soon as you have
acks from dt and all that and then send a pull request to Dave.

Thanks, Daniel

> ---
>  MAINTAINERS|   6 +
>  drivers/gpu/drm/Kconfig|   2 +
>  drivers/gpu/drm/Makefile   |   1 +
>  drivers/gpu/drm/mxsfb/Kconfig  |  18 ++
>  drivers/gpu/drm/mxsfb/Makefile |   2 +
>  drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 241 
>  drivers/gpu/drm/mxsfb/mxsfb_drv.c  | 444 
> +
>  drivers/gpu/drm/mxsfb/mxsfb_drv.h  |  54 +
>  drivers/gpu/drm/mxsfb/mxsfb_out.c  | 131 +++
>  drivers/gpu/drm/mxsfb/mxsfb_regs.h | 114 ++
>  10 files changed, 1013 insertions(+)
>  create mode 100644 drivers/gpu/drm/mxsfb/Kconfig
>  create mode 100644 drivers/gpu/drm/mxsfb/Makefile
>  create mode 100644 drivers/gpu/drm/mxsfb/mxsfb_crtc.c
>  create mode 100644 drivers/gpu/drm/mxsfb/mxsfb_drv.c
>  create mode 100644 drivers/gpu/drm/mxsfb/mxsfb_drv.h
>  create mode 100644 drivers/gpu/drm/mxsfb/mxsfb_out.c
>  create mode 100644 drivers/gpu/drm/mxsfb/mxsfb_regs.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3f3f60b..f32b5df 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -8339,6 +8339,12 @@ T: git git://linuxtv.org/mkrufky/tuners.git
>  S:   Maintained
>  F:   drivers/media/tuners/mxl5007t.*
>  
> +MXSFB DRM DRIVER
> +M:   Marek Vasut 
> +S:   Supported
> +F:   drivers/gpu/drm/mxsfb/
> +F:   Documentation/devicetree/bindings/display/mxsfb-drm.txt
> +
>  MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
>  M:   Hyong-Youb Kim 
>  L:   netdev at vger.kernel.org
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 863cdca..fbcb984 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -239,6 +239,8 @@ source "drivers/gpu/drm/mediatek/Kconfig"
>  
>  source "drivers/gpu/drm/zte/Kconfig"
>  
> +source "drivers/gpu/drm/mxsfb/Kconfig"
> +
>  # Keep legacy drivers last
>  
>  menuconfig DRM_LEGACY
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index f217274..ac5e115 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -88,3 +88,4 @@ obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/
>  obj-$(CONFIG_DRM_ARCPGU)+= arc/
>  obj-y+= hisilicon/
>  obj-$(CONFIG_DRM_ZTE)+= zte/
> +obj-$(CONFIG_DRM_MXSFB)  += mxsfb/
> diff --git a/drivers/gpu/drm/mxsfb/Kconfig b/drivers/gpu/drm/mxsfb/Kconfig
> new file mode 100644
> index 000..0b6cb59
> --- /dev/null
> +++ b/drivers/gpu/drm/mxsfb/Kconfig
> @@ -0,0 +1,18 @@
> +config DRM_MXS
> + bool
> + help
> +   Choose this option to select drivers for MXS FB devices
> +
> +config DRM_MXSFB
> + tristate "i.MX23/i.MX28/i.MX6SX MXSFB LCD controller"
> + depends on DRM && OF
> + depends on COMMON_CLK
> + select DRM_MXS
> + select DRM_KMS_HELPER
> + select DRM_KMS_FB_HELPER
> + select DRM_KMS_CMA_HELPER
> + help
> +   Choose this option if you have an i.MX23/i.MX28/i.MX6SX MXSFB
> +   LCD controller.
> +
> +   If M is selected the module will be called mxsfb.
> diff --git a/drivers/gpu/drm/mxsfb/Makefile b/drivers/gpu/drm/mxsfb/Makefile
> new file mode 100644
> index 000..857f3a4
> --- /dev/null
> +++ b/drivers/gpu/drm/mxsfb/Makefile
> @@ -0,0 +1,2 @@
> +mxsfb-y := mxsfb_drv.o mxsfb_crtc.o mxsfb_out.o
> +obj-$(CONFIG_DRM_MXSFB)  += mxsfb.o
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c 
> b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
> new file mode 100644
> index 000..0818903
> --- /dev/null
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
> @@ -0,0 +1,241 @@
> +/*
> + * Copyright (C) 2016 Marek Vasut 
> + *
> + * This code is based on drivers/video/fbdev/mxsfb.c :
> + * Copyright (C) 2010 Juergen Beisert, Pengutronix
> + * Copyright (C) 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
> + * Copyright (C) 2008 Embedded Alley Solutions, Inc All Rights Reserved.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * 

[PATCH V3 3/3] drm: Add new driver for MXSFB controller

2016-11-14 Thread Marek Vasut
Add new driver for the MXSFB controller found in i.MX23/28/6SX .
The MXSFB controller is a simple framebuffer controller with one
parallel LCD output. Unlike the MXSFB fbdev driver that is used
on these systems now, this driver uses the DRM/KMS framework.

Signed-off-by: Marek Vasut 
Cc: Lucas Stach 
Cc: Fabio Estevam 
Cc: Shawn Guo 
Cc: Daniel Vetter 
--
V2: - Use drm_simple_kms_helper to reduce amount of common code
- Add dedicated OF compatible for i.MX6SX
V3: - Update to latest next/master
---
 MAINTAINERS|   6 +
 drivers/gpu/drm/Kconfig|   2 +
 drivers/gpu/drm/Makefile   |   1 +
 drivers/gpu/drm/mxsfb/Kconfig  |  18 ++
 drivers/gpu/drm/mxsfb/Makefile |   2 +
 drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 241 
 drivers/gpu/drm/mxsfb/mxsfb_drv.c  | 444 +
 drivers/gpu/drm/mxsfb/mxsfb_drv.h  |  54 +
 drivers/gpu/drm/mxsfb/mxsfb_out.c  | 131 +++
 drivers/gpu/drm/mxsfb/mxsfb_regs.h | 114 ++
 10 files changed, 1013 insertions(+)
 create mode 100644 drivers/gpu/drm/mxsfb/Kconfig
 create mode 100644 drivers/gpu/drm/mxsfb/Makefile
 create mode 100644 drivers/gpu/drm/mxsfb/mxsfb_crtc.c
 create mode 100644 drivers/gpu/drm/mxsfb/mxsfb_drv.c
 create mode 100644 drivers/gpu/drm/mxsfb/mxsfb_drv.h
 create mode 100644 drivers/gpu/drm/mxsfb/mxsfb_out.c
 create mode 100644 drivers/gpu/drm/mxsfb/mxsfb_regs.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 3f3f60b..f32b5df 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8339,6 +8339,12 @@ T:   git git://linuxtv.org/mkrufky/tuners.git
 S: Maintained
 F: drivers/media/tuners/mxl5007t.*

+MXSFB DRM DRIVER
+M: Marek Vasut 
+S: Supported
+F: drivers/gpu/drm/mxsfb/
+F: Documentation/devicetree/bindings/display/mxsfb-drm.txt
+
 MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
 M: Hyong-Youb Kim 
 L: netdev at vger.kernel.org
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 863cdca..fbcb984 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -239,6 +239,8 @@ source "drivers/gpu/drm/mediatek/Kconfig"

 source "drivers/gpu/drm/zte/Kconfig"

+source "drivers/gpu/drm/mxsfb/Kconfig"
+
 # Keep legacy drivers last

 menuconfig DRM_LEGACY
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index f217274..ac5e115 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -88,3 +88,4 @@ obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/
 obj-$(CONFIG_DRM_ARCPGU)+= arc/
 obj-y  += hisilicon/
 obj-$(CONFIG_DRM_ZTE)  += zte/
+obj-$(CONFIG_DRM_MXSFB)+= mxsfb/
diff --git a/drivers/gpu/drm/mxsfb/Kconfig b/drivers/gpu/drm/mxsfb/Kconfig
new file mode 100644
index 000..0b6cb59
--- /dev/null
+++ b/drivers/gpu/drm/mxsfb/Kconfig
@@ -0,0 +1,18 @@
+config DRM_MXS
+   bool
+   help
+ Choose this option to select drivers for MXS FB devices
+
+config DRM_MXSFB
+   tristate "i.MX23/i.MX28/i.MX6SX MXSFB LCD controller"
+   depends on DRM && OF
+   depends on COMMON_CLK
+   select DRM_MXS
+   select DRM_KMS_HELPER
+   select DRM_KMS_FB_HELPER
+   select DRM_KMS_CMA_HELPER
+   help
+ Choose this option if you have an i.MX23/i.MX28/i.MX6SX MXSFB
+ LCD controller.
+
+ If M is selected the module will be called mxsfb.
diff --git a/drivers/gpu/drm/mxsfb/Makefile b/drivers/gpu/drm/mxsfb/Makefile
new file mode 100644
index 000..857f3a4
--- /dev/null
+++ b/drivers/gpu/drm/mxsfb/Makefile
@@ -0,0 +1,2 @@
+mxsfb-y := mxsfb_drv.o mxsfb_crtc.o mxsfb_out.o
+obj-$(CONFIG_DRM_MXSFB)+= mxsfb.o
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c 
b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
new file mode 100644
index 000..0818903
--- /dev/null
+++ b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) 2016 Marek Vasut 
+ *
+ * This code is based on drivers/video/fbdev/mxsfb.c :
+ * Copyright (C) 2010 Juergen Beisert, Pengutronix
+ * Copyright (C) 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2008 Embedded Alley Solutions, Inc All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "mxsfb_drv.h"
+#include "mxsfb_regs.h"
+
+static u32 set_hsync_pulse_width(struct mxsfb_drm_private *mxsfb, u32 val)
+{
+   return (val &