[PATCH 03/11] drm: add driver for simple vga encoders

2015-03-23 Thread Heiko Stuebner
Hi Laurent,

Am Samstag, 28. Februar 2015, 01:42:45 schrieb Heiko Stübner:
> thanks for the comments
> 
> Am Donnerstag, 26. Februar 2015, 20:33:33 schrieb Laurent Pinchart:
> > On Saturday 31 January 2015 17:32:56 Heiko Stuebner wrote:
> > > There exist simple vga encoders without any type of management interface
> > > and just maybe a simple gpio for turning it on or off. Examples for
> > > these
> > > are the Analog Devices ADV7123, Chipsea CS7123 or Micronas SDA7123.
> > > 
> > > Add a generic encoder driver for those that can be used by drm drivers
> > > using the component framework.
> > 
> > The rcar-du driver already handles the adi,adv7123 compatible string used
> > by this driver. A generic driver is in my opinion a very good idea, but
> > we can't break the existing support. Porting the rcar-du driver to the
> > component model is needed.
> 
> is this in someones plans already? Because I'm still having trouble
> understanding parts of the rockchip driver sometimes, so feel in no way
> qualified to try to get this tackled in some reasonable timeframe :-)

currently my idea is to simply do something like the following for this :-)

static const struct of_device_id rcar_du_of_table[] = {
{ .compatible = "renesas,du-r8a7779" },
{ .compatible = "renesas,du-r8a7790" },
{ .compatible = "renesas,du-r8a7791" },
{ }
};

static int __init vga_encoder_init(void)
{
struct device_node *np;

/*
 * Play nice with rcar-du that is having its own implementation
 * of the adv7123 binding implementation and is not yet
 * converted to using components.
 */
np = of_find_matching_node(NULL, rcar_du_of_table);
if (np) {
of_node_put(np);
return 0;
}

return platform_driver_register(_encoder_driver);
}


slightly similar to what some iommus do


> > > Signed-off-by: Heiko Stuebner 
> > > ---
> > > 
> > >  drivers/gpu/drm/i2c/Kconfig  |   6 +
> > >  drivers/gpu/drm/i2c/Makefile |   2 +
> > >  drivers/gpu/drm/i2c/vga-simple.c | 325
> > >  
> > 
> > drivers/gpu/drm/i2c/ feels wrong for a platform device.
> 
> yep, i2c probably being the wrong place was one of the caveats in the cover
> letter and I was hoping some more seasoned drm people could suggest where
> this should live after all.
> 
> As your comments further down suggest that we might introduce some different
> components, simply congregate them in a "components" subdir or something
> splitting them more?

so does a "components" subdir look reasonable?


> > >  3 files changed, 333 insertions(+)
> > >  create mode 100644 drivers/gpu/drm/i2c/vga-simple.c
> > > 
> > > diff --git a/drivers/gpu/drm/i2c/Kconfig b/drivers/gpu/drm/i2c/Kconfig
> > > index 22c7ed6..319f2cb 100644
> > > --- a/drivers/gpu/drm/i2c/Kconfig
> > > +++ b/drivers/gpu/drm/i2c/Kconfig
> > > @@ -31,4 +31,10 @@ config DRM_I2C_NXP_TDA998X
> > > 
> > >   help
> > >   
> > > Support for NXP Semiconductors TDA998X HDMI encoders.
> > > 
> > > +config DRM_VGA_SIMPLE
> > > + tristate "Generic simple vga encoder"
> > > + help
> > > +   Support for vga encoder chips without any special settings
> > > +   and at most a power-control gpio.
> > > +
> > > 
> > >  endmenu
> > > 
> > > diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile
> > > index 2c72eb5..858961f 100644
> > > --- a/drivers/gpu/drm/i2c/Makefile
> > > +++ b/drivers/gpu/drm/i2c/Makefile
> > > @@ -10,3 +10,5 @@ obj-$(CONFIG_DRM_I2C_SIL164) += sil164.o
> > > 
> > >  tda998x-y := tda998x_drv.o
> > >  obj-$(CONFIG_DRM_I2C_NXP_TDA998X) += tda998x.o
> > > 
> > > +
> > > +obj-$(CONFIG_DRM_VGA_SIMPLE) += vga-simple.o
> > > diff --git a/drivers/gpu/drm/i2c/vga-simple.c
> > > b/drivers/gpu/drm/i2c/vga-simple.c new file mode 100644
> > > index 000..bb9d19c
> > > --- /dev/null
> > > +++ b/drivers/gpu/drm/i2c/vga-simple.c
> > > @@ -0,0 +1,325 @@
> > > +/*
> > > + * Simple vga encoder driver
> > > + *
> > > + * Copyright (C) 2014 Heiko Stuebner 
> > > + *
> > > + * This software is licensed under the terms of the GNU General Public
> > > + * License version 2, as published by the Free Software Foundation, and
> > > + * may be copied, distributed, and modified under those terms.
> > > + *
> > > + * 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 
> > > +
> > > +#define connector_to_vga_simple(x) container_of(x, struct vga_simple,
> > > connector) +#define encoder_to_vga_simple(x) container_of(x, struct
> > > vga_simple, encoder) +
> > > 

[PATCH 03/11] drm: add driver for simple vga encoders

2015-02-28 Thread Heiko Stübner
Hi Laurent,

thanks for the comments

Am Donnerstag, 26. Februar 2015, 20:33:33 schrieb Laurent Pinchart:
> On Saturday 31 January 2015 17:32:56 Heiko Stuebner wrote:
> > There exist simple vga encoders without any type of management interface
> > and just maybe a simple gpio for turning it on or off. Examples for these
> > are the Analog Devices ADV7123, Chipsea CS7123 or Micronas SDA7123.
> > 
> > Add a generic encoder driver for those that can be used by drm drivers
> > using the component framework.
> 
> The rcar-du driver already handles the adi,adv7123 compatible string used by
> this driver. A generic driver is in my opinion a very good idea, but we
> can't break the existing support. Porting the rcar-du driver to the
> component model is needed.

is this in someones plans already? Because I'm still having trouble 
understanding parts of the rockchip driver sometimes, so feel in no way 
qualified to try to get this tackled in some reasonable timeframe :-)


> > Signed-off-by: Heiko Stuebner 
> > ---
> > 
> >  drivers/gpu/drm/i2c/Kconfig  |   6 +
> >  drivers/gpu/drm/i2c/Makefile |   2 +
> >  drivers/gpu/drm/i2c/vga-simple.c | 325
> >  
> 
> drivers/gpu/drm/i2c/ feels wrong for a platform device.

yep, i2c probably being the wrong place was one of the caveats in the cover 
letter and I was hoping some more seasoned drm people could suggest where this 
should live after all.

As your comments further down suggest that we might introduce some different 
components, simply congregate them in a "components" subdir or something 
splitting them more?


> 
> >  3 files changed, 333 insertions(+)
> >  create mode 100644 drivers/gpu/drm/i2c/vga-simple.c
> > 
> > diff --git a/drivers/gpu/drm/i2c/Kconfig b/drivers/gpu/drm/i2c/Kconfig
> > index 22c7ed6..319f2cb 100644
> > --- a/drivers/gpu/drm/i2c/Kconfig
> > +++ b/drivers/gpu/drm/i2c/Kconfig
> > @@ -31,4 +31,10 @@ config DRM_I2C_NXP_TDA998X
> > 
> > help
> > 
> >   Support for NXP Semiconductors TDA998X HDMI encoders.
> > 
> > +config DRM_VGA_SIMPLE
> > +   tristate "Generic simple vga encoder"
> > +   help
> > + Support for vga encoder chips without any special settings
> > + and at most a power-control gpio.
> > +
> > 
> >  endmenu
> > 
> > diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile
> > index 2c72eb5..858961f 100644
> > --- a/drivers/gpu/drm/i2c/Makefile
> > +++ b/drivers/gpu/drm/i2c/Makefile
> > @@ -10,3 +10,5 @@ obj-$(CONFIG_DRM_I2C_SIL164) += sil164.o
> > 
> >  tda998x-y := tda998x_drv.o
> >  obj-$(CONFIG_DRM_I2C_NXP_TDA998X) += tda998x.o
> > 
> > +
> > +obj-$(CONFIG_DRM_VGA_SIMPLE) += vga-simple.o
> > diff --git a/drivers/gpu/drm/i2c/vga-simple.c
> > b/drivers/gpu/drm/i2c/vga-simple.c new file mode 100644
> > index 000..bb9d19c
> > --- /dev/null
> > +++ b/drivers/gpu/drm/i2c/vga-simple.c
> > @@ -0,0 +1,325 @@
> > +/*
> > + * Simple vga encoder driver
> > + *
> > + * Copyright (C) 2014 Heiko Stuebner 
> > + *
> > + * This software is licensed under the terms of the GNU General Public
> > + * License version 2, as published by the Free Software Foundation, and
> > + * may be copied, distributed, and modified under those terms.
> > + *
> > + * 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 
> > +
> > +#define connector_to_vga_simple(x) container_of(x, struct vga_simple,
> > connector) +#define encoder_to_vga_simple(x) container_of(x, struct
> > vga_simple, encoder) +
> > +struct vga_simple {
> > +   struct drm_connector connector;
> > +   struct drm_encoder encoder;
> > +
> > +   struct device *dev;
> > +   struct i2c_adapter *ddc;
> > +
> > +   struct regulator *vaa_reg;
> > +   struct gpio_desc *enable_gpio;
> > +
> > +   struct mutex enable_lock;
> > +   bool enabled;
> > +};
> > +
> > +/*
> > + * Connector functions
> > + */
> > +
> > +enum drm_connector_status vga_simple_detect(struct drm_connector
> > *connector, +   bool force)
> > +{
> > +   struct vga_simple *vga = connector_to_vga_simple(connector);
> > +
> > +   if (!vga->ddc)
> > +   return connector_status_unknown;
> > +
> > +   if (drm_probe_ddc(vga->ddc))
> > +   return connector_status_connected;
> > +
> > +   return connector_status_disconnected;
> > +}
> > +
> > +void vga_simple_connector_destroy(struct drm_connector *connector)
> > +{
> > +   drm_connector_unregister(connector);
> > +   drm_connector_cleanup(connector);
> > +}
> > +
> > +struct drm_connector_funcs vga_simple_connector_funcs = {
> > +   .dpms = drm_helper_connector_dpms,
> > +   

[PATCH 03/11] drm: add driver for simple vga encoders

2015-02-26 Thread Laurent Pinchart
Hi Heiko,

Thank you for the patch.

On Saturday 31 January 2015 17:32:56 Heiko Stuebner wrote:
> There exist simple vga encoders without any type of management interface
> and just maybe a simple gpio for turning it on or off. Examples for these
> are the Analog Devices ADV7123, Chipsea CS7123 or Micronas SDA7123.
> 
> Add a generic encoder driver for those that can be used by drm drivers
> using the component framework.

The rcar-du driver already handles the adi,adv7123 compatible string used by 
this driver. A generic driver is in my opinion a very good idea, but we can't 
break the existing support. Porting the rcar-du driver to the component model 
is needed.

> Signed-off-by: Heiko Stuebner 
> ---
>  drivers/gpu/drm/i2c/Kconfig  |   6 +
>  drivers/gpu/drm/i2c/Makefile |   2 +
>  drivers/gpu/drm/i2c/vga-simple.c | 325 

drivers/gpu/drm/i2c/ feels wrong for a platform device.

>  3 files changed, 333 insertions(+)
>  create mode 100644 drivers/gpu/drm/i2c/vga-simple.c
> 
> diff --git a/drivers/gpu/drm/i2c/Kconfig b/drivers/gpu/drm/i2c/Kconfig
> index 22c7ed6..319f2cb 100644
> --- a/drivers/gpu/drm/i2c/Kconfig
> +++ b/drivers/gpu/drm/i2c/Kconfig
> @@ -31,4 +31,10 @@ config DRM_I2C_NXP_TDA998X
>   help
> Support for NXP Semiconductors TDA998X HDMI encoders.
> 
> +config DRM_VGA_SIMPLE
> + tristate "Generic simple vga encoder"
> + help
> +   Support for vga encoder chips without any special settings
> +   and at most a power-control gpio.
> +
>  endmenu
> diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile
> index 2c72eb5..858961f 100644
> --- a/drivers/gpu/drm/i2c/Makefile
> +++ b/drivers/gpu/drm/i2c/Makefile
> @@ -10,3 +10,5 @@ obj-$(CONFIG_DRM_I2C_SIL164) += sil164.o
> 
>  tda998x-y := tda998x_drv.o
>  obj-$(CONFIG_DRM_I2C_NXP_TDA998X) += tda998x.o
> +
> +obj-$(CONFIG_DRM_VGA_SIMPLE) += vga-simple.o
> diff --git a/drivers/gpu/drm/i2c/vga-simple.c
> b/drivers/gpu/drm/i2c/vga-simple.c new file mode 100644
> index 000..bb9d19c
> --- /dev/null
> +++ b/drivers/gpu/drm/i2c/vga-simple.c
> @@ -0,0 +1,325 @@
> +/*
> + * Simple vga encoder driver
> + *
> + * Copyright (C) 2014 Heiko Stuebner 
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * 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 
> +
> +#define connector_to_vga_simple(x) container_of(x, struct vga_simple,
> connector) +#define encoder_to_vga_simple(x) container_of(x, struct
> vga_simple, encoder) +
> +struct vga_simple {
> + struct drm_connector connector;
> + struct drm_encoder encoder;
> +
> + struct device *dev;
> + struct i2c_adapter *ddc;
> +
> + struct regulator *vaa_reg;
> + struct gpio_desc *enable_gpio;
> +
> + struct mutex enable_lock;
> + bool enabled;
> +};
> +
> +/*
> + * Connector functions
> + */
> +
> +enum drm_connector_status vga_simple_detect(struct drm_connector
> *connector, + bool force)
> +{
> + struct vga_simple *vga = connector_to_vga_simple(connector);
> +
> + if (!vga->ddc)
> + return connector_status_unknown;
> +
> + if (drm_probe_ddc(vga->ddc))
> + return connector_status_connected;
> +
> + return connector_status_disconnected;
> +}
> +
> +void vga_simple_connector_destroy(struct drm_connector *connector)
> +{
> + drm_connector_unregister(connector);
> + drm_connector_cleanup(connector);
> +}
> +
> +struct drm_connector_funcs vga_simple_connector_funcs = {
> + .dpms = drm_helper_connector_dpms,
> + .fill_modes = drm_helper_probe_single_connector_modes,
> + .detect = vga_simple_detect,
> + .destroy = vga_simple_connector_destroy,
> +};
> +
> +/*
> + * Connector helper functions
> + */
> +
> +static int vga_simple_connector_get_modes(struct drm_connector *connector)
> +{
> + struct vga_simple *vga = connector_to_vga_simple(connector);
> + struct edid *edid;
> + int ret = 0;
> +
> + if (!vga->ddc)
> + return 0;
> +
> + edid = drm_get_edid(connector, vga->ddc);
> + if (edid) {
> + drm_mode_connector_update_edid_property(connector, edid);
> + ret = drm_add_edid_modes(connector, edid);
> + kfree(edid);
> + }
> +
> + return ret;
> +}
> +
> +static int vga_simple_connector_mode_valid(struct drm_connector *connector,
> + struct drm_display_mode *mode)
> +{
> +

[PATCH 03/11] drm: add driver for simple vga encoders

2015-02-26 Thread Rob Herring
On Sat, Jan 31, 2015 at 10:32 AM, Heiko Stuebner  wrote:
> There exist simple vga encoders without any type of management interface
> and just maybe a simple gpio for turning it on or off. Examples for these
> are the Analog Devices ADV7123, Chipsea CS7123 or Micronas SDA7123.
>
> Add a generic encoder driver for those that can be used by drm drivers
> using the component framework.

What makes this specific to VGA other than DRM_MODE_CONNECTOR_VGA?
Seems like with match data you could generalize this to any simple
encoder chip.

Rob

>
> Signed-off-by: Heiko Stuebner 
> ---
>  drivers/gpu/drm/i2c/Kconfig  |   6 +
>  drivers/gpu/drm/i2c/Makefile |   2 +
>  drivers/gpu/drm/i2c/vga-simple.c | 325 
> +++
>  3 files changed, 333 insertions(+)
>  create mode 100644 drivers/gpu/drm/i2c/vga-simple.c
>
> diff --git a/drivers/gpu/drm/i2c/Kconfig b/drivers/gpu/drm/i2c/Kconfig
> index 22c7ed6..319f2cb 100644
> --- a/drivers/gpu/drm/i2c/Kconfig
> +++ b/drivers/gpu/drm/i2c/Kconfig
> @@ -31,4 +31,10 @@ config DRM_I2C_NXP_TDA998X
> help
>   Support for NXP Semiconductors TDA998X HDMI encoders.
>
> +config DRM_VGA_SIMPLE
> +   tristate "Generic simple vga encoder"
> +   help
> + Support for vga encoder chips without any special settings
> + and at most a power-control gpio.
> +
>  endmenu
> diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile
> index 2c72eb5..858961f 100644
> --- a/drivers/gpu/drm/i2c/Makefile
> +++ b/drivers/gpu/drm/i2c/Makefile
> @@ -10,3 +10,5 @@ obj-$(CONFIG_DRM_I2C_SIL164) += sil164.o
>
>  tda998x-y := tda998x_drv.o
>  obj-$(CONFIG_DRM_I2C_NXP_TDA998X) += tda998x.o
> +
> +obj-$(CONFIG_DRM_VGA_SIMPLE) += vga-simple.o
> diff --git a/drivers/gpu/drm/i2c/vga-simple.c 
> b/drivers/gpu/drm/i2c/vga-simple.c
> new file mode 100644
> index 000..bb9d19c
> --- /dev/null
> +++ b/drivers/gpu/drm/i2c/vga-simple.c
> @@ -0,0 +1,325 @@
> +/*
> + * Simple vga encoder driver
> + *
> + * Copyright (C) 2014 Heiko Stuebner 
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * 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 
> +
> +#define connector_to_vga_simple(x) container_of(x, struct vga_simple, 
> connector)
> +#define encoder_to_vga_simple(x) container_of(x, struct vga_simple, encoder)
> +
> +struct vga_simple {
> +   struct drm_connector connector;
> +   struct drm_encoder encoder;
> +
> +   struct device *dev;
> +   struct i2c_adapter *ddc;
> +
> +   struct regulator *vaa_reg;
> +   struct gpio_desc *enable_gpio;
> +
> +   struct mutex enable_lock;
> +   bool enabled;
> +};
> +
> +/*
> + * Connector functions
> + */
> +
> +enum drm_connector_status vga_simple_detect(struct drm_connector *connector,
> +   bool force)
> +{
> +   struct vga_simple *vga = connector_to_vga_simple(connector);
> +
> +   if (!vga->ddc)
> +   return connector_status_unknown;
> +
> +   if (drm_probe_ddc(vga->ddc))
> +   return connector_status_connected;
> +
> +   return connector_status_disconnected;
> +}
> +
> +void vga_simple_connector_destroy(struct drm_connector *connector)
> +{
> +   drm_connector_unregister(connector);
> +   drm_connector_cleanup(connector);
> +}
> +
> +struct drm_connector_funcs vga_simple_connector_funcs = {
> +   .dpms = drm_helper_connector_dpms,
> +   .fill_modes = drm_helper_probe_single_connector_modes,
> +   .detect = vga_simple_detect,
> +   .destroy = vga_simple_connector_destroy,
> +};
> +
> +/*
> + * Connector helper functions
> + */
> +
> +static int vga_simple_connector_get_modes(struct drm_connector *connector)
> +{
> +   struct vga_simple *vga = connector_to_vga_simple(connector);
> +   struct edid *edid;
> +   int ret = 0;
> +
> +   if (!vga->ddc)
> +   return 0;
> +
> +   edid = drm_get_edid(connector, vga->ddc);
> +   if (edid) {
> +   drm_mode_connector_update_edid_property(connector, edid);
> +   ret = drm_add_edid_modes(connector, edid);
> +   kfree(edid);
> +   }
> +
> +   return ret;
> +}
> +
> +static int vga_simple_connector_mode_valid(struct drm_connector *connector,
> +   struct drm_display_mode *mode)
> +{
> +   return MODE_OK;
> +}
> +
> +static struct drm_encoder
> 

[PATCH 03/11] drm: add driver for simple vga encoders

2015-01-31 Thread Heiko Stuebner
There exist simple vga encoders without any type of management interface
and just maybe a simple gpio for turning it on or off. Examples for these
are the Analog Devices ADV7123, Chipsea CS7123 or Micronas SDA7123.

Add a generic encoder driver for those that can be used by drm drivers
using the component framework.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/i2c/Kconfig  |   6 +
 drivers/gpu/drm/i2c/Makefile |   2 +
 drivers/gpu/drm/i2c/vga-simple.c | 325 +++
 3 files changed, 333 insertions(+)
 create mode 100644 drivers/gpu/drm/i2c/vga-simple.c

diff --git a/drivers/gpu/drm/i2c/Kconfig b/drivers/gpu/drm/i2c/Kconfig
index 22c7ed6..319f2cb 100644
--- a/drivers/gpu/drm/i2c/Kconfig
+++ b/drivers/gpu/drm/i2c/Kconfig
@@ -31,4 +31,10 @@ config DRM_I2C_NXP_TDA998X
help
  Support for NXP Semiconductors TDA998X HDMI encoders.

+config DRM_VGA_SIMPLE
+   tristate "Generic simple vga encoder"
+   help
+ Support for vga encoder chips without any special settings
+ and at most a power-control gpio.
+
 endmenu
diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile
index 2c72eb5..858961f 100644
--- a/drivers/gpu/drm/i2c/Makefile
+++ b/drivers/gpu/drm/i2c/Makefile
@@ -10,3 +10,5 @@ obj-$(CONFIG_DRM_I2C_SIL164) += sil164.o

 tda998x-y := tda998x_drv.o
 obj-$(CONFIG_DRM_I2C_NXP_TDA998X) += tda998x.o
+
+obj-$(CONFIG_DRM_VGA_SIMPLE) += vga-simple.o
diff --git a/drivers/gpu/drm/i2c/vga-simple.c b/drivers/gpu/drm/i2c/vga-simple.c
new file mode 100644
index 000..bb9d19c
--- /dev/null
+++ b/drivers/gpu/drm/i2c/vga-simple.c
@@ -0,0 +1,325 @@
+/*
+ * Simple vga encoder driver
+ *
+ * Copyright (C) 2014 Heiko Stuebner 
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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 
+
+#define connector_to_vga_simple(x) container_of(x, struct vga_simple, 
connector)
+#define encoder_to_vga_simple(x) container_of(x, struct vga_simple, encoder)
+
+struct vga_simple {
+   struct drm_connector connector;
+   struct drm_encoder encoder;
+
+   struct device *dev;
+   struct i2c_adapter *ddc;
+
+   struct regulator *vaa_reg;
+   struct gpio_desc *enable_gpio;
+
+   struct mutex enable_lock;
+   bool enabled;
+};
+
+/*
+ * Connector functions
+ */
+
+enum drm_connector_status vga_simple_detect(struct drm_connector *connector,
+   bool force)
+{
+   struct vga_simple *vga = connector_to_vga_simple(connector);
+
+   if (!vga->ddc)
+   return connector_status_unknown;
+
+   if (drm_probe_ddc(vga->ddc))
+   return connector_status_connected;
+
+   return connector_status_disconnected;
+}
+
+void vga_simple_connector_destroy(struct drm_connector *connector)
+{
+   drm_connector_unregister(connector);
+   drm_connector_cleanup(connector);
+}
+
+struct drm_connector_funcs vga_simple_connector_funcs = {
+   .dpms = drm_helper_connector_dpms,
+   .fill_modes = drm_helper_probe_single_connector_modes,
+   .detect = vga_simple_detect,
+   .destroy = vga_simple_connector_destroy,
+};
+
+/*
+ * Connector helper functions
+ */
+
+static int vga_simple_connector_get_modes(struct drm_connector *connector)
+{
+   struct vga_simple *vga = connector_to_vga_simple(connector);
+   struct edid *edid;
+   int ret = 0;
+
+   if (!vga->ddc)
+   return 0;
+
+   edid = drm_get_edid(connector, vga->ddc);
+   if (edid) {
+   drm_mode_connector_update_edid_property(connector, edid);
+   ret = drm_add_edid_modes(connector, edid);
+   kfree(edid);
+   }
+
+   return ret;
+}
+
+static int vga_simple_connector_mode_valid(struct drm_connector *connector,
+   struct drm_display_mode *mode)
+{
+   return MODE_OK;
+}
+
+static struct drm_encoder
+*vga_simple_connector_best_encoder(struct drm_connector *connector)
+{
+   struct vga_simple *vga = connector_to_vga_simple(connector);
+
+   return >encoder;
+}
+
+static struct drm_connector_helper_funcs vga_simple_connector_helper_funcs = {
+   .get_modes = vga_simple_connector_get_modes,
+   .best_encoder = vga_simple_connector_best_encoder,
+   .mode_valid = vga_simple_connector_mode_valid,
+};
+
+/*
+ * Encoder functions
+ */
+
+static void vga_simple_encoder_destroy(struct drm_encoder *encoder)
+{
+