Re: [PATCH 11/25] drm/exynos: introduce exynos_drm_plane_state structure

2015-11-13 Thread Gustavo Padovan
drm_plane_funcs exynos_plane_funcs = {
>   .update_plane   = drm_atomic_helper_update_plane,
>   .disable_plane  = drm_atomic_helper_disable_plane,
>   .destroy= drm_plane_cleanup,
> - .reset = drm_atomic_helper_plane_reset,
> - .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
> - .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> + .reset  = exynos_drm_plane_reset,
> + .atomic_duplicate_state = exynos_drm_plane_duplicate_state,
> + .atomic_destroy_state = exynos_drm_plane_destroy_state,
>  };
>  
>  static int exynos_plane_atomic_check(struct drm_plane *plane,
>struct drm_plane_state *state)
>  {
>   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
> + struct exynos_drm_plane_state *exynos_state =
> + to_exynos_plane_state(state);
> + int ret = 0;
>  
> - if (!state->fb)
> + if (!state->crtc || !state->fb)
>   return 0;
>  
> - return 0;
> + /* translate state into exynos_state */
> + exynos_plane_mode_set(exynos_state);
> +
> + return ret;
>  }
>  
>  static void exynos_plane_atomic_update(struct drm_plane *plane,
> @@ -137,12 +200,7 @@ static void exynos_plane_atomic_update(struct drm_plane 
> *plane,
>   if (!state->crtc)
>   return;
>  
> - exynos_plane_mode_set(plane, state->crtc, state->fb,
> -   state->crtc_x, state->crtc_y,
> -   state->crtc_w, state->crtc_h,
> -   state->src_x >> 16, state->src_y >> 16,
> -   state->src_w >> 16, state->src_h >> 16);
> -
> + plane->crtc = state->crtc;
>   exynos_plane->pending_fb = state->fb;
>  
>   if (exynos_crtc->ops->update_plane)
> @@ -159,8 +217,7 @@ static void exynos_plane_atomic_disable(struct drm_plane 
> *plane,
>   return;
>  
>   if (exynos_crtc->ops->disable_plane)
> - exynos_crtc->ops->disable_plane(exynos_crtc,
> - exynos_plane);
> + exynos_crtc->ops->disable_plane(exynos_crtc, exynos_plane);

Just a nitpick here: this change doesn't belong to this patch. Otherwise
looks good:

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 12/25] drm/exynos: mixer: use crtc->state->adjusted_mode instead of crtc->mode

2015-11-13 Thread Gustavo Padovan
Hi Marek,

2015-11-10 Marek Szyprowski <m.szyprow...@samsung.com>:

> This patch replaces usage of crtc->mode with crtc->state->adjusted_mode
> like it is already done in common plane code.
> 
> Signed-off-by: Marek Szyprowski <m.szyprow...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_mixer.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 14/25] drm/exynos: introduce exynos_drm_plane_config structure

2015-11-13 Thread Gustavo Padovan
Hi Marek,

2015-11-10 Marek Szyprowski :

> This patch adds common structure for keeping plane configuration and
> capabilities data. This patch is inspired by similar code developed by
> Tobias Jakobi.
> 
> Signed-off-by: Marek Szyprowski 
> ---
>  drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 18 +++---
>  drivers/gpu/drm/exynos/exynos7_drm_decon.c| 23 +++-
>  drivers/gpu/drm/exynos/exynos_drm_drv.h   | 22 
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c  | 25 -
>  drivers/gpu/drm/exynos/exynos_drm_plane.c | 34 --
>  drivers/gpu/drm/exynos/exynos_drm_plane.h |  7 ++--
>  drivers/gpu/drm/exynos/exynos_drm_vidi.c  | 25 -
>  drivers/gpu/drm/exynos/exynos_mixer.c | 51 
> ---
>  8 files changed, 131 insertions(+), 74 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
> b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> index 27039468364b..3c8b8e0240fe 100644
> --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> @@ -26,7 +26,6 @@
>  #include "exynos_drm_iommu.h"
>  
>  #define WINDOWS_NR   3
> -#define CURSOR_WIN   2
>  #define MIN_FB_WIDTH_FOR_16WORD_BURST128
>  
>  static const char * const decon_clks_name[] = {
> @@ -57,6 +56,7 @@ struct decon_context {
>   struct drm_device   *drm_dev;
>   struct exynos_drm_crtc  *crtc;
>   struct exynos_drm_plane planes[WINDOWS_NR];
> + struct exynos_drm_plane_config  configs[WINDOWS_NR];
>   void __iomem*addr;
>   struct clk  *clks[ARRAY_SIZE(decon_clks_name)];
>   int pipe;
> @@ -72,6 +72,12 @@ static const uint32_t decon_formats[] = {
>   DRM_FORMAT_ARGB,
>  };
>  
> +static const enum drm_plane_type decon_win_types[WINDOWS_NR] = {
> + DRM_PLANE_TYPE_PRIMARY,
> + DRM_PLANE_TYPE_OVERLAY,
> + DRM_PLANE_TYPE_CURSOR,
> +};
> +
>  static inline void decon_set_bits(struct decon_context *ctx, u32 reg, u32 
> mask,
> u32 val)
>  {
> @@ -499,7 +505,6 @@ static int decon_bind(struct device *dev, struct device 
> *master, void *data)
>   struct exynos_drm_private *priv = drm_dev->dev_private;
>   struct exynos_drm_plane *exynos_plane;
>   enum exynos_drm_output_type out_type;
> - enum drm_plane_type type;
>   unsigned int win;
>   int ret;
>  
> @@ -509,10 +514,13 @@ static int decon_bind(struct device *dev, struct device 
> *master, void *data)
>   for (win = ctx->first_win; win < WINDOWS_NR; win++) {
>   int tmp = (win == ctx->first_win) ? 0 : win;
>  
> - type = exynos_plane_get_type(tmp, CURSOR_WIN);
> + ctx->configs[win].pixel_formats = decon_formats;
> + ctx->configs[win].num_pixel_formats = ARRAY_SIZE(decon_formats);
> + ctx->configs[win].zpos = win;
> + ctx->configs[win].type = decon_win_types[tmp];
> +
>   ret = exynos_plane_init(drm_dev, >planes[win],
> - 1 << ctx->pipe, type, decon_formats,
> - ARRAY_SIZE(decon_formats), win);
> + 1 << ctx->pipe, >configs[win]);
>   if (ret)
>   return ret;
>   }
> diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
> b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> index 7868d30d8eac..6b28e3f73e4e 100644
> --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> @@ -41,13 +41,13 @@
>  #define MIN_FB_WIDTH_FOR_16WORD_BURST 128
>  
>  #define WINDOWS_NR   2
> -#define CURSOR_WIN   1
>  
>  struct decon_context {
>   struct device   *dev;
>   struct drm_device   *drm_dev;
>   struct exynos_drm_crtc  *crtc;
>   struct exynos_drm_plane planes[WINDOWS_NR];
> + struct exynos_drm_plane_config  configs[WINDOWS_NR];
>   struct clk  *pclk;
>   struct clk  *aclk;
>   struct clk  *eclk;
> @@ -82,6 +82,11 @@ static const uint32_t decon_formats[] = {
>   DRM_FORMAT_BGRA,
>  };
>  
> +static const enum drm_plane_type decon_win_types[WINDOWS_NR] = {
> + DRM_PLANE_TYPE_PRIMARY,
> + DRM_PLANE_TYPE_CURSOR,
> +};
> +
>  static void decon_wait_for_vblank(struct exynos_drm_crtc *crtc)
>  {
>   struct decon_context *ctx = crtc->ctx;
> @@ -672,8 +677,7 @@ static int decon_bind(struct device *dev, struct device 
> *master, void *data)
>   struct decon_context *ctx = dev_get_drvdata(dev);
>   struct drm_device *drm_dev = data;
>   struct exynos_drm_plane *exynos_plane;
> - enum drm_plane_type type;
> - unsigned int zpos;
> + unsigned int i;
>   int ret;
>  
>   ret = 

Re: [PATCH 13/25] drm/exynos: mixer: enable video overlay plane only when VP is available

2015-11-13 Thread Gustavo Padovan
Hi Marek,

2015-11-10 Marek Szyprowski <m.szyprow...@samsung.com>:

> Video overlay plane should be registered only when suitable hardware
> sub-block (Video Processor) is available.
> 
> Signed-off-by: Marek Szyprowski <m.szyprow...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_mixer.c | 3 +++
>  1 file changed, 3 insertions(+)

Good catch.

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] drm/atomic: only run atomic_check() if crtc is active

2015-11-13 Thread Gustavo Padovan
Hi Ville,

2015-11-13 Ville Syrjälä <ville.syrj...@linux.intel.com>:

> On Fri, Nov 13, 2015 at 11:45:58AM -0200, Gustavo Padovan wrote:
> > From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
> > 
> > Fixes an regression added by 3ae2436 (drm/exynos/mixer: replace
> > direct cross-driver call with drm mode) and while this regression was
> > caused by a change in the exynos driver it makes sense to add the
> > check on atomic core to benefit other drivers as well.
> > 
> > The whole atomic update fails if the exynos hdmi display is not
> > present/active.  Add a test to only run atomic_check() if the CRTC is
> > active.
> 
> The check must be performed even when the crtc is not active.
> 
> Especially important for the (enabled && !active) case (ie. DPMS off)
> since "DPMS on" must not fail, so any state change while in DPMS off
> must be checked as if the crtc was active.
> 
> But even for the !enabled case we want to do the check so that
> everything gets properly recomputed when fully disabling a crtc.

You are right. I'll fix this locally in exynos for now.

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] drm/atomic: only run atomic_check() if crtc is active

2015-11-13 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Fixes an regression added by 3ae2436 (drm/exynos/mixer: replace
direct cross-driver call with drm mode) and while this regression was
caused by a change in the exynos driver it makes sense to add the
check on atomic core to benefit other drivers as well.

The whole atomic update fails if the exynos hdmi display is not
present/active.  Add a test to only run atomic_check() if the CRTC is
active.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/drm_atomic_helper.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 0c6f621..7e3cb48 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -510,6 +510,9 @@ drm_atomic_helper_check_planes(struct drm_device *dev,
for_each_crtc_in_state(state, crtc, crtc_state, i) {
const struct drm_crtc_helper_funcs *funcs;
 
+   if (!crtc_state->active)
+   continue;
+
funcs = crtc->helper_private;
 
if (!funcs || !funcs->atomic_check)
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 15/25] drm/exynos: add generic check for plane state

2015-11-13 Thread Gustavo Padovan
Hi Marek,

2015-11-10 Marek Szyprowski <m.szyprow...@samsung.com>:

> This patch adds generic check for plane state: pixel format and display
> area dimensions, so drivers can always assume that they get valid plane
> state to set.
> 
> Signed-off-by: Marek Szyprowski <m.szyprow...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_drv.h   |  2 ++
>  drivers/gpu/drm/exynos/exynos_drm_plane.c | 51 
> +++
>  2 files changed, 53 insertions(+)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 16/25] drm/exynos: mixer: use ratio precalculated in exynos_state

2015-11-13 Thread Gustavo Padovan
Hi Marek,

2015-11-10 Marek Szyprowski <m.szyprow...@samsung.com>:

> Common plane code already calculates and checks for supported scalling
> modes, so additional code in mixer driver can be now removed.
> 
> Signed-off-by: Marek Szyprowski <m.szyprow...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_mixer.c | 33 +++--
>  1 file changed, 3 insertions(+), 30 deletions(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] drm/exynos: only run atomic_check() if crtc is active

2015-11-12 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Fixes an regression added by 3ae2436 (drm/exynos/mixer: replace
direct cross-driver call with drm mode). The whole atomic update
was failing if the hdmi display is not present/active. Add a test
to only run atomic_check() if the CRTC is active.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index b3ba27f..1d3ca0a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -55,6 +55,9 @@ static int exynos_crtc_atomic_check(struct drm_crtc *crtc,
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
+   if (!state->active)
+   return 0;
+
if (exynos_crtc->ops->atomic_check)
return exynos_crtc->ops->atomic_check(exynos_crtc, state);
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/25] drm/exynos: gsc: fix wrong pm_runtime state

2015-11-12 Thread Gustavo Padovan
Hi Marek,

2015-11-10 Marek Szyprowski <m.szyprow...@samsung.com>:

> From: Seung-Woo Kim <sw0312@samsung.com>
> 
> At probe time, gsc clock is not enabled, so pm_runtime state should
> be deactive. So this patch removes pm_runtime_set_active() from
> gsc_probe().
> 
> Signed-off-by: Seung-Woo Kim <sw0312@samsung.com>
> Signed-off-by: Marek Szyprowski <m.szyprow...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_gsc.c | 1 -
>  1 file changed, 1 deletion(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/25] drm/exynos: gsc: prepare and unprepare gsc clock

2015-11-12 Thread Gustavo Padovan
Hi Marek,

2015-11-10 Marek Szyprowski <m.szyprow...@samsung.com>:

> From: Seung-Woo Kim <sw0312@samsung.com>
> 
> Ths patch changes the clk_enable and clk_disable call in gsc driver
> into clk_prepare_enable and clk_disable_unprepare.
> 
> Signed-off-by: Seung-Woo Kim <sw0312@samsung.com>
> Signed-off-by: Marek Szyprowski <m.szyprow...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_gsc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/25] drm/exynos: rotator: convert to common clock framework

2015-11-12 Thread Gustavo Padovan
Hi Marek,

2015-11-10 Marek Szyprowski <m.szyprow...@samsung.com>:

> This driver was not used after introduction of common clock framework.
> This patch adds missing prepare/unprepare calls and allows to use it
> again with current kernel code.
> 
> Signed-off-by: Marek Szyprowski <m.szyprow...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_rotator.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/25] drm/exynos: exynos7-decon: remove excessive check

2015-11-12 Thread Gustavo Padovan
Hi Marek,

2015-11-10 Marek Szyprowski <m.szyprow...@samsung.com>:

> Display area is already checked by exynos plane core, so there is no
> need for such check in driver code.
> 
> Signed-off-by: Marek Szyprowski <m.szyprow...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos7_drm_decon.c | 10 --
>  1 file changed, 10 deletions(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/25] drm/exynos: move dma_addr attribute from exynos plane to exynos fb

2015-11-12 Thread Gustavo Padovan
Hi Marek,

2015-11-10 Marek Szyprowski <m.szyprow...@samsung.com>:

> DMA address is a framebuffer attribute and the right place for it is
> exynos_drm_framebuffer not exynos_drm_plane. This patch also introduces
> helper function for getting dma address of the given framebuffer.
> 
> Signed-off-by: Marek Szyprowski <m.szyprow...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 13 -
>  drivers/gpu/drm/exynos/exynos7_drm_decon.c| 16 +---
>  drivers/gpu/drm/exynos/exynos_drm_drv.h   |  3 ---
>  drivers/gpu/drm/exynos/exynos_drm_fb.c| 16 ++--
>  drivers/gpu/drm/exynos/exynos_drm_fb.h|  3 +--
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c  | 10 ++
>  drivers/gpu/drm/exynos/exynos_drm_plane.c | 18 --
>  drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  5 -
>  drivers/gpu/drm/exynos/exynos_mixer.c |  7 ---
>  9 files changed, 38 insertions(+), 53 deletions(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 05/79] exynos_drm.h: use __u64 from linux/types.h

2015-10-15 Thread Gustavo Padovan
2015-10-15 Mikko Rapeli <mikko.rap...@iki.fi>:

> Fixes userspace compilation error:
> 
> drm/exynos_drm.h:30:2: error: unknown type name ‘uint64_t’
> 
> Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
> ---
>  include/uapi/drm/exynos_drm.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] drm/exynos: fimd: actually disable dp clock

2015-09-30 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

fimd_dp_clock_enable() was setting the always to enabled,
this patch fix this to actually use the value that is set to 'val'.

Reported-by: Emilio López <emilio.lo...@collabora.co.uk>
Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 03ad549..3d1aba6 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -871,7 +871,7 @@ static void fimd_dp_clock_enable(struct exynos_drm_crtc 
*crtc, bool enable)
return;
 
val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE;
-   writel(DP_MIE_CLK_DP_ENABLE, ctx->regs + DP_MIE_CLKCON);
+   writel(val, ctx->regs + DP_MIE_CLKCON);
 }
 
 static const struct exynos_drm_crtc_ops fimd_crtc_ops = {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] drm/exynos: dp: remove suspend/resume functions

2015-09-30 Thread Gustavo Padovan
Hi Inki,

2015-09-30 Inki Dae <inki@samsung.com>:

> This patch removes unnecessary pm suspend/resume functions.
> 
> All kms sub drivers will be controlled by top of Exynos drm driver
> and connector dpms so these sub drivers shouldn't have their own
> pm interfaces.
> 
> Signed-off-by: Inki Dae <inki@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_dp_core.c | 23 ---
>  1 file changed, 23 deletions(-)

This sounds reasonable to me.

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/16] drm/exynos/hdmi: move PLL stabilization check code to separate function

2015-09-30 Thread Gustavo Padovan
Hi Andrzej,

2015-09-25 Andrzej Hajda <a.ha...@samsung.com>:

> The patch moves PLL stabilization check to separate function, adjust timeout
> parameters and de-duplicates code common for both HW variants.
> 
> Signed-off-by: Andrzej Hajda <a.ha...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c | 68 
> ++--
>  1 file changed, 26 insertions(+), 42 deletions(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/16] drm/exynos/hdmi: remove support for deprecated compatible

2015-09-30 Thread Gustavo Padovan
Hi Andrzej,

2015-09-25 Andrzej Hajda <a.ha...@samsung.com>:

> This compatible was marked as deprecated in Jun 2013 and it is not used since
> then. Additionally its driver data points to wrong pll settings, so it
> cannot work anyway.
> 
> Signed-off-by: Andrzej Hajda <a.ha...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c | 10 --
>  1 file changed, 10 deletions(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/16] dt-bindings: remove deprecated compatible string from exynos-hdmi

2015-09-30 Thread Gustavo Padovan
Hi Andrzej,

2015-09-25 Andrzej Hajda <a.ha...@samsung.com>:

> samsung,exynos5-hdmi compatible was marked as deprecated in Jun 2013.
> It was never used since then.
> 
> Signed-off-by: Andrzej Hajda <a.ha...@samsung.com>
> ---
>  Documentation/devicetree/bindings/video/exynos_hdmi.txt | 7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/16] drm/exynos/hdmi: use mappings for registers with IP dependent address

2015-09-30 Thread Gustavo Padovan
Hi Andrzej,

2015-09-25 Andrzej Hajda <a.ha...@samsung.com>:

> Some registers resides at different offsets depending on device version.
> This patch adds infrastructure for mapping such registers to proper address
> based on hdmi_type. It adds also mappings to some registers.
> 
> Signed-off-by: Andrzej Hajda <a.ha...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c | 56 
> +++-
>  drivers/gpu/drm/exynos/regs-hdmi.h   |  4 +--
>  2 files changed, 38 insertions(+), 22 deletions(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/16] drm/exynos/hdmi: simplify HDMI-PHY power sequence

2015-09-30 Thread Gustavo Padovan
Hi Andrzej,

2015-09-25 Andrzej Hajda <a.ha...@samsung.com>:

> Currently driver tries to set specific HDMI-PHY registers in three situations:
> - before reset,
> - before power off,
> - after applying HDMI-PHY configuration.
> 
> First two cases seems to be unnecessary - register contents will be lost
> anyway. The third case can be merged with HDMI-PHY configuration by fixing
> the last byte of configuration data.
> 
> The patch has been tested with following platforms:
> - exynos4210-universal_c210,
> - exynos4412-odroidu3,
> - exynos5422-odroidxu3.
> 
> Signed-off-by: Andrzej Hajda <a.ha...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c | 93 
> 
>  1 file changed, 8 insertions(+), 85 deletions(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 06/16] drm/exynos/hdmi: replace all writeb with writel

2015-09-30 Thread Gustavo Padovan
Hi Andrzej,

2015-09-25 Andrzej Hajda <a.ha...@samsung.com>:

> Registers are 32-bit, even if only lower 8-bits are used.
> 
> Signed-off-by: Andrzej Hajda <a.ha...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 15/16] drm/exynos/hdmi: remove unused field

2015-09-30 Thread Gustavo Padovan
Hi Andrzej,

2015-09-25 Andrzej Hajda <a.ha...@samsung.com>:

> The patch removes unused hdmi_context field.
> 
> Signed-off-by: Andrzej Hajda <a.ha...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c | 1 -
>  1 file changed, 1 deletion(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/16] drm/exynos/hdmi: use constant size array for regulators

2015-09-30 Thread Gustavo Padovan
Hi Andrzej,

2015-09-25 Andrzej Hajda <a.ha...@samsung.com>:

> Driver always uses the same number of regulators, so there is no point in
> dynamic allocation.
> 
> Signed-off-by: Andrzej Hajda <a.ha...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c | 25 +
>  1 file changed, 9 insertions(+), 16 deletions(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 13/16] drm/exynos/hdmi: convert container_of macro to inline function

2015-09-30 Thread Gustavo Padovan
Hi Andrzej,

2015-09-25 Andrzej Hajda <a.ha...@samsung.com>:

> Inline function is safer than macro, also the name has been changed to
> be consistent with other inline function encoder_to_hdmi.
> 
> Signed-off-by: Andrzej Hajda <a.ha...@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c | 15 +--
>  1 file changed, 9 insertions(+), 6 deletions(-)

Reviewed-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] drm/exynos: remove unused mode_fixup() code

2015-09-29 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

CRTC's mode_fixup() isn't used anymore in exynos, remove it.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 15 ---
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |  4 
 2 files changed, 19 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 0872aa2f..ed28823 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -41,20 +41,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
exynos_crtc->ops->disable(exynos_crtc);
 }
 
-static bool
-exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-
-   if (exynos_crtc->ops->mode_fixup)
-   return exynos_crtc->ops->mode_fixup(exynos_crtc, mode,
-   adjusted_mode);
-
-   return true;
-}
-
 static void
 exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
 {
@@ -99,7 +85,6 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
 static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
.enable = exynos_drm_crtc_enable,
.disable= exynos_drm_crtc_disable,
-   .mode_fixup = exynos_drm_crtc_mode_fixup,
.mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
.atomic_begin   = exynos_crtc_atomic_begin,
.atomic_flush   = exynos_crtc_atomic_flush,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index b7ba21d..6c717ba 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -82,7 +82,6 @@ struct exynos_drm_plane {
  *
  * @enable: enable the device
  * @disable: disable the device
- * @mode_fixup: fix mode data before applying it
  * @commit: set current hw specific display mode to hw.
  * @enable_vblank: specific driver callback for enabling vblank interrupt.
  * @disable_vblank: specific driver callback for disabling vblank interrupt.
@@ -103,9 +102,6 @@ struct exynos_drm_crtc;
 struct exynos_drm_crtc_ops {
void (*enable)(struct exynos_drm_crtc *crtc);
void (*disable)(struct exynos_drm_crtc *crtc);
-   bool (*mode_fixup)(struct exynos_drm_crtc *crtc,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode);
void (*commit)(struct exynos_drm_crtc *crtc);
int (*enable_vblank)(struct exynos_drm_crtc *crtc);
void (*disable_vblank)(struct exynos_drm_crtc *crtc);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] drm/exynos: remove decon_mode_fixup()

2015-09-29 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

The only thing mode_fixup was doing was set the adjusted_mode->vrefresh to
60, but it already has the value of 60 when the decon_mode_fixup() is
called. That means this call is actually pointless and can be removed.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

---
This is untested as I don't have any decon device, but I assume the
behaviour is similar to FIMD and it that case, I'm proposing the
the removal in decon_mode_fixup() as well.
---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index cbdb78e..e6cbaca 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -37,7 +37,6 @@
  * DECON stands for Display and Enhancement controller.
  */
 
-#define DECON_DEFAULT_FRAMERATE 60
 #define MIN_FB_WIDTH_FOR_16WORD_BURST 128
 
 #define WINDOWS_NR 2
@@ -165,16 +164,6 @@ static u32 decon_calc_clkdiv(struct decon_context *ctx,
return (clkdiv < 0x100) ? clkdiv : 0xff;
 }
 
-static bool decon_mode_fixup(struct exynos_drm_crtc *crtc,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   if (adjusted_mode->vrefresh == 0)
-   adjusted_mode->vrefresh = DECON_DEFAULT_FRAMERATE;
-
-   return true;
-}
-
 static void decon_commit(struct exynos_drm_crtc *crtc)
 {
struct decon_context *ctx = crtc->ctx;
@@ -637,7 +626,6 @@ static void decon_disable(struct exynos_drm_crtc *crtc)
 static const struct exynos_drm_crtc_ops decon_crtc_ops = {
.enable = decon_enable,
.disable = decon_disable,
-   .mode_fixup = decon_mode_fixup,
.commit = decon_commit,
.enable_vblank = decon_enable_vblank,
.disable_vblank = decon_disable_vblank,
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] drm/exynos: Remove useless EXPORT_SYMBOL_GPLs

2015-09-09 Thread Gustavo Padovan
From: Daniel Kurtz <djku...@chromium.org>

All the user of these functions are inside exynos-drm driver and
you don't need to export the symbols for that case.

Signed-off-by: Daniel Kurtz <djku...@chromium.org>
Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_core.c | 6 --
 drivers/gpu/drm/exynos/exynos_drm_g2d.c  | 3 ---
 2 files changed, 9 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c 
b/drivers/gpu/drm/exynos/exynos_drm_core.c
index c68a6a2..7f55ba6 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_core.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_core.c
@@ -28,7 +28,6 @@ int exynos_drm_subdrv_register(struct exynos_drm_subdrv 
*subdrv)
 
return 0;
 }
-EXPORT_SYMBOL_GPL(exynos_drm_subdrv_register);
 
 int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv *subdrv)
 {
@@ -39,7 +38,6 @@ int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv 
*subdrv)
 
return 0;
 }
-EXPORT_SYMBOL_GPL(exynos_drm_subdrv_unregister);
 
 int exynos_drm_device_subdrv_probe(struct drm_device *dev)
 {
@@ -69,7 +67,6 @@ int exynos_drm_device_subdrv_probe(struct drm_device *dev)
 
return 0;
 }
-EXPORT_SYMBOL_GPL(exynos_drm_device_subdrv_probe);
 
 int exynos_drm_device_subdrv_remove(struct drm_device *dev)
 {
@@ -87,7 +84,6 @@ int exynos_drm_device_subdrv_remove(struct drm_device *dev)
 
return 0;
 }
-EXPORT_SYMBOL_GPL(exynos_drm_device_subdrv_remove);
 
 int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file)
 {
@@ -111,7 +107,6 @@ err:
}
return ret;
 }
-EXPORT_SYMBOL_GPL(exynos_drm_subdrv_open);
 
 void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file)
 {
@@ -122,4 +117,3 @@ void exynos_drm_subdrv_close(struct drm_device *dev, struct 
drm_file *file)
subdrv->close(dev, subdrv->dev, file);
}
 }
-EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c 
b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index 535b4ad..0a596f1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -1090,7 +1090,6 @@ int exynos_g2d_get_ver_ioctl(struct drm_device *drm_dev, 
void *data,
 
return 0;
 }
-EXPORT_SYMBOL_GPL(exynos_g2d_get_ver_ioctl);
 
 int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data,
 struct drm_file *file)
@@ -1261,7 +1260,6 @@ err:
g2d_put_cmdlist(g2d, node);
return ret;
 }
-EXPORT_SYMBOL_GPL(exynos_g2d_set_cmdlist_ioctl);
 
 int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data,
  struct drm_file *file)
@@ -1324,7 +1322,6 @@ int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, 
void *data,
 out:
return 0;
 }
-EXPORT_SYMBOL_GPL(exynos_g2d_exec_ioctl);
 
 static int g2d_subdrv_probe(struct drm_device *drm_dev, struct device *dev)
 {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/10] drm/exynos: add pm_runtime to HDMI

2015-09-04 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Let pm_runtime handle the enabling/disabling of the device with proper
refcnt instead of rely on specific flags to track the enabled state.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 56 +---
 1 file changed, 39 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 932f7fa..5fcbdda 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -92,7 +92,6 @@ struct hdmi_context {
struct drm_device   *drm_dev;
struct drm_connectorconnector;
boolhpd;
-   boolpowered;
booldvi_mode;
 
void __iomem*regs;
@@ -1726,11 +1725,6 @@ static void hdmi_enable(struct drm_encoder *encoder)
struct hdmi_context *hdata = encoder_to_hdmi(encoder);
struct hdmi_resources *res = >res;
 
-   if (hdata->powered)
-   return;
-
-   hdata->powered = true;
-
pm_runtime_get_sync(hdata->dev);
 
if (regulator_bulk_enable(res->regul_count, res->regul_bulk))
@@ -1740,9 +1734,6 @@ static void hdmi_enable(struct drm_encoder *encoder)
regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL,
PMU_HDMI_PHY_ENABLE_BIT, 1);
 
-   clk_prepare_enable(res->hdmi);
-   clk_prepare_enable(res->sclk_hdmi);
-
hdmiphy_poweron(hdata);
hdmi_conf_apply(hdata);
 }
@@ -1754,9 +1745,6 @@ static void hdmi_disable(struct drm_encoder *encoder)
struct drm_crtc *crtc = encoder->crtc;
const struct drm_crtc_helper_funcs *funcs = NULL;
 
-   if (!hdata->powered)
-   return;
-
/*
 * The SFRs of VP and Mixer are updated by Vertical Sync of
 * Timing generator which is a part of HDMI so the sequence
@@ -1778,9 +1766,6 @@ static void hdmi_disable(struct drm_encoder *encoder)
 
cancel_delayed_work(>hotplug_work);
 
-   clk_disable_unprepare(res->sclk_hdmi);
-   clk_disable_unprepare(res->hdmi);
-
/* reset pmu hdmiphy control bit to disable hdmiphy */
regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL,
PMU_HDMI_PHY_ENABLE_BIT, 0);
@@ -1788,8 +1773,6 @@ static void hdmi_disable(struct drm_encoder *encoder)
regulator_bulk_disable(res->regul_count, res->regul_bulk);
 
pm_runtime_put_sync(hdata->dev);
-
-   hdata->powered = false;
 }
 
 static struct drm_encoder_helper_funcs exynos_hdmi_encoder_helper_funcs = {
@@ -2146,12 +2129,51 @@ static int hdmi_remove(struct platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int exynos_hdmi_suspend(struct device *dev)
+{
+   struct hdmi_context *hdata = dev_get_drvdata(dev);
+   struct hdmi_resources *res = >res;
+
+   clk_disable_unprepare(res->sclk_hdmi);
+   clk_disable_unprepare(res->hdmi);
+
+   return 0;
+}
+
+static int exynos_hdmi_resume(struct device *dev)
+{
+   struct hdmi_context *hdata = dev_get_drvdata(dev);
+   struct hdmi_resources *res = >res;
+   int ret;
+
+   ret = clk_prepare_enable(res->hdmi);
+   if (ret < 0) {
+   DRM_ERROR("Failed to prepare_enable the hdmi clk [%d]\n", ret);
+   return ret;
+   }
+   ret = clk_prepare_enable(res->sclk_hdmi);
+   if (ret < 0) {
+   DRM_ERROR("Failed to prepare_enable the sclk_mixer clk [%d]\n",
+ ret);
+   return ret;
+   }
+
+   return 0;
+}
+#endif
+
+static const struct dev_pm_ops exynos_hdmi_pm_ops = {
+   SET_RUNTIME_PM_OPS(exynos_hdmi_suspend, exynos_hdmi_resume, NULL)
+};
+
 struct platform_driver hdmi_driver = {
.probe  = hdmi_probe,
.remove = hdmi_remove,
.driver = {
.name   = "exynos-hdmi",
.owner  = THIS_MODULE,
+   .pm = _hdmi_pm_ops,
.of_match_table = hdmi_match_types,
},
 };
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/10] drm/exynos: do not start enabling DP at bind() phase

2015-09-04 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

The DP device will be properly enabled at the enable() call just
after the bind call finishes.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_dp_core.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index d66ade0..c73aff1 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1289,10 +1289,6 @@ static int exynos_dp_bind(struct device *dev, struct 
device *master, void *data)
 
INIT_WORK(>hotplug_work, exynos_dp_hotplug);
 
-   phy_power_on(dp->phy);
-
-   exynos_dp_init_dp(dp);
-
ret = devm_request_irq(>dev, dp->irq, exynos_dp_irq_handler,
irq_flags, "exynos-dp", dp);
if (ret) {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/10] drm/exynos: add pm_runtime to DP

2015-09-04 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Let pm_runtime handle the enabling/disabling of the device with
proper refcnt instead of rely on specific flags to track the enabled
state.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_dp_core.c | 40 +
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index c73aff1..6794982 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1070,8 +1070,7 @@ static void exynos_dp_enable(struct drm_encoder *encoder)
struct exynos_dp_device *dp = encoder_to_dp(encoder);
struct exynos_drm_crtc *crtc = dp_to_crtc(dp);
 
-   if (dp->dpms_mode == DRM_MODE_DPMS_ON)
-   return;
+   pm_runtime_get_sync(dp->dev);
 
if (dp->panel) {
if (drm_panel_prepare(dp->panel)) {
@@ -1083,13 +1082,10 @@ static void exynos_dp_enable(struct drm_encoder 
*encoder)
if (crtc->ops->clock_enable)
crtc->ops->clock_enable(dp_to_crtc(dp), true);
 
-   clk_prepare_enable(dp->clock);
phy_power_on(dp->phy);
exynos_dp_init_dp(dp);
enable_irq(dp->irq);
exynos_dp_commit(>encoder);
-
-   dp->dpms_mode = DRM_MODE_DPMS_ON;
 }
 
 static void exynos_dp_disable(struct drm_encoder *encoder)
@@ -1097,9 +1093,6 @@ static void exynos_dp_disable(struct drm_encoder *encoder)
struct exynos_dp_device *dp = encoder_to_dp(encoder);
struct exynos_drm_crtc *crtc = dp_to_crtc(dp);
 
-   if (dp->dpms_mode != DRM_MODE_DPMS_ON)
-   return;
-
if (dp->panel) {
if (drm_panel_disable(dp->panel)) {
DRM_ERROR("failed to disable the panel\n");
@@ -1110,7 +1103,6 @@ static void exynos_dp_disable(struct drm_encoder *encoder)
disable_irq(dp->irq);
flush_work(>hotplug_work);
phy_power_off(dp->phy);
-   clk_disable_unprepare(dp->clock);
 
if (crtc->ops->clock_enable)
crtc->ops->clock_enable(dp_to_crtc(dp), false);
@@ -1120,7 +1112,7 @@ static void exynos_dp_disable(struct drm_encoder *encoder)
DRM_ERROR("failed to turnoff the panel\n");
}
 
-   dp->dpms_mode = DRM_MODE_DPMS_OFF;
+   pm_runtime_put_sync(dp->dev);
 }
 
 static struct drm_encoder_helper_funcs exynos_dp_encoder_helper_funcs = {
@@ -1216,7 +1208,6 @@ static int exynos_dp_bind(struct device *dev, struct 
device *master, void *data)
int pipe, ret = 0;
 
dp->dev = >dev;
-   dp->dpms_mode = DRM_MODE_DPMS_OFF;
 
dp->video_info = exynos_dp_dt_parse_pdata(>dev);
if (IS_ERR(dp->video_info))
@@ -1341,6 +1332,7 @@ static int exynos_dp_probe(struct platform_device *pdev)
struct device *dev = >dev;
struct device_node *panel_node, *bridge_node, *endpoint;
struct exynos_dp_device *dp;
+   int ret;
 
dp = devm_kzalloc(>dev, sizeof(struct exynos_dp_device),
GFP_KERNEL);
@@ -1369,11 +1361,23 @@ static int exynos_dp_probe(struct platform_device *pdev)
return -EPROBE_DEFER;
}
 
-   return component_add(>dev, _dp_ops);
+   pm_runtime_enable(dev);
+
+   ret = component_add(>dev, _dp_ops);
+   if (ret)
+   goto err_disable_pm_runtime;
+
+   return ret;
+
+err_disable_pm_runtime:
+   pm_runtime_disable(dev);
+
+   return ret;
 }
 
 static int exynos_dp_remove(struct platform_device *pdev)
 {
+   pm_runtime_disable(>dev);
component_del(>dev, _dp_ops);
 
return 0;
@@ -1384,21 +1388,29 @@ static int exynos_dp_suspend(struct device *dev)
 {
struct exynos_dp_device *dp = dev_get_drvdata(dev);
 
-   exynos_dp_disable(>encoder);
+   clk_disable_unprepare(dp->clock);
+
return 0;
 }
 
 static int exynos_dp_resume(struct device *dev)
 {
struct exynos_dp_device *dp = dev_get_drvdata(dev);
+   int ret;
+
+   ret = clk_prepare_enable(dp->clock);
+   if (ret < 0) {
+   DRM_ERROR("Failed to prepare_enable the clock clk [%d]\n", ret);
+   return ret;
+   }
 
-   exynos_dp_enable(>encoder);
return 0;
 }
 #endif
 
 static const struct dev_pm_ops exynos_dp_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(exynos_dp_suspend, exynos_dp_resume)
+   SET_RUNTIME_PM_OPS(exynos_dp_suspend, exynos_dp_resume, NULL)
 };
 
 static const struct of_device_id exynos_dp_match[] = {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/10] drm/exynos: add pm_runtime support

2015-09-04 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Hi,

This series adds proper runtime PM suport to CRTCs and Encoders, so
now instead of relying on 'suspended' or 'enabled' flags to track when
the CRTC or Encoder is enabled we let the pm_runtime subsystem do it for us
and remove all the flags. This is a important step to the atomic suspend/resume
support that will land in drm anytime soon.

Please review!

Gustavo

Gustavo Padovan (10):
  drm/exynos: do not start enabling DP at bind() phase
  drm/exynos: add pm_runtime to DP
  drm/exynos: add pm_runtime to HDMI
  drm/exynos: add pm_runtime to Mixer
  drm/exynos: remove exynos_crtc commit() callback
  drm/exynos: Remove exynos_crtc commit() callback
  drm/exynos: add pm_runtime to FIMD
  drm/exynos: Enable DP clock directly from FIMD
  drm/exynos: add pm_runtime to DECON 5433
  drm/exynos: add pm_runtime to DECON 7

 drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  90 --
 drivers/gpu/drm/exynos/exynos7_drm_decon.c| 126 +++--
 drivers/gpu/drm/exynos/exynos_dp_core.c   |  57 ++--
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  |  10 --
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |   7 --
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  | 129 --
 drivers/gpu/drm/exynos/exynos_hdmi.c  |  56 +++
 drivers/gpu/drm/exynos/exynos_mixer.c | 125 -
 8 files changed, 275 insertions(+), 325 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/10] drm/exynos: add pm_runtime to Mixer

2015-09-04 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Let pm_runtime handle the enabling/disabling of the device with proper
refcnt instead of rely on specific flags to track the enabled state.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_mixer.c | 125 +-
 1 file changed, 61 insertions(+), 64 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index 2484277..dc48084 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -71,7 +71,6 @@ enum mixer_version_id {
 };
 
 enum mixer_flag_bits {
-   MXR_BIT_POWERED,
MXR_BIT_VSYNC,
 };
 
@@ -927,8 +926,6 @@ static int mixer_enable_vblank(struct exynos_drm_crtc *crtc)
struct mixer_resources *res = _ctx->mixer_res;
 
__set_bit(MXR_BIT_VSYNC, _ctx->flags);
-   if (!test_bit(MXR_BIT_POWERED, _ctx->flags))
-   return 0;
 
/* enable vsync interrupt */
mixer_reg_writemask(res, MXR_INT_STATUS, ~0, MXR_INT_CLEAR_VSYNC);
@@ -944,9 +941,6 @@ static void mixer_disable_vblank(struct exynos_drm_crtc 
*crtc)
 
__clear_bit(MXR_BIT_VSYNC, _ctx->flags);
 
-   if (!test_bit(MXR_BIT_POWERED, _ctx->flags))
-   return;
-
/* disable vsync interrupt */
mixer_reg_writemask(res, MXR_INT_STATUS, ~0, MXR_INT_CLEAR_VSYNC);
mixer_reg_writemask(res, MXR_INT_EN, 0, MXR_INT_EN_VSYNC);
@@ -959,9 +953,6 @@ static void mixer_update_plane(struct exynos_drm_crtc *crtc,
 
DRM_DEBUG_KMS("win: %d\n", plane->zpos);
 
-   if (!test_bit(MXR_BIT_POWERED, _ctx->flags))
-   return;
-
if (plane->zpos > 1 && mixer_ctx->vp_enabled)
vp_video_buffer(mixer_ctx, plane);
else
@@ -977,9 +968,6 @@ static void mixer_disable_plane(struct exynos_drm_crtc 
*crtc,
 
DRM_DEBUG_KMS("win: %d\n", plane->zpos);
 
-   if (!test_bit(MXR_BIT_POWERED, _ctx->flags))
-   return;
-
spin_lock_irqsave(>reg_slock, flags);
mixer_vsync_set_update(mixer_ctx, false);
 
@@ -994,9 +982,6 @@ static void mixer_wait_for_vblank(struct exynos_drm_crtc 
*crtc)
struct mixer_context *mixer_ctx = crtc->ctx;
int err;
 
-   if (!test_bit(MXR_BIT_POWERED, _ctx->flags))
-   return;
-
err = drm_vblank_get(mixer_ctx->drm_dev, mixer_ctx->pipe);
if (err < 0) {
DRM_DEBUG_KMS("failed to acquire vblank counter\n");
@@ -1021,43 +1006,9 @@ static void mixer_enable(struct exynos_drm_crtc *crtc)
 {
struct mixer_context *ctx = crtc->ctx;
struct mixer_resources *res = >mixer_res;
-   int ret;
-
-   if (test_bit(MXR_BIT_POWERED, >flags))
-   return;
 
pm_runtime_get_sync(ctx->dev);
 
-   ret = clk_prepare_enable(res->mixer);
-   if (ret < 0) {
-   DRM_ERROR("Failed to prepare_enable the mixer clk [%d]\n", ret);
-   return;
-   }
-   ret = clk_prepare_enable(res->hdmi);
-   if (ret < 0) {
-   DRM_ERROR("Failed to prepare_enable the hdmi clk [%d]\n", ret);
-   return;
-   }
-   if (ctx->vp_enabled) {
-   ret = clk_prepare_enable(res->vp);
-   if (ret < 0) {
-   DRM_ERROR("Failed to prepare_enable the vp clk [%d]\n",
- ret);
-   return;
-   }
-   if (ctx->has_sclk) {
-   ret = clk_prepare_enable(res->sclk_mixer);
-   if (ret < 0) {
-   DRM_ERROR("Failed to prepare_enable the " \
-  "sclk_mixer clk [%d]\n",
- ret);
-   return;
-   }
-   }
-   }
-
-   set_bit(MXR_BIT_POWERED, >flags);
-
mixer_reg_writemask(res, MXR_STATUS, ~0, MXR_STATUS_SOFT_RESET);
 
if (test_bit(MXR_BIT_VSYNC, >flags)) {
@@ -1070,29 +1021,15 @@ static void mixer_enable(struct exynos_drm_crtc *crtc)
 static void mixer_disable(struct exynos_drm_crtc *crtc)
 {
struct mixer_context *ctx = crtc->ctx;
-   struct mixer_resources *res = >mixer_res;
int i;
 
-   if (!test_bit(MXR_BIT_POWERED, >flags))
-   return;
-
mixer_stop(ctx);
mixer_regs_dump(ctx);
 
for (i = 0; i < MIXER_WIN_NR; i++)
mixer_disable_plane(crtc, >planes[i]);
 
-   clear_bit(MXR_BIT_POWERED, >flags);
-
-   clk_disable_unprepare(res->hdmi);
-   clk_disable_unprepare(res->mixer);
-   if (ctx->vp_enabled) {
-   

[PATCH 06/10] drm/exynos: Remove exynos_crtc commit() callback

2015-09-04 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

This callback is no longer used by any of the exynos_crtc drivers, remove
it.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 10 --
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |  2 --
 2 files changed, 12 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 0872aa2f..deff5a7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -55,15 +55,6 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,
return true;
 }
 
-static void
-exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
-{
-   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-
-   if (exynos_crtc->ops->commit)
-   exynos_crtc->ops->commit(exynos_crtc);
-}
-
 static void exynos_crtc_atomic_begin(struct drm_crtc *crtc,
 struct drm_crtc_state *old_crtc_state)
 {
@@ -100,7 +91,6 @@ static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs 
= {
.enable = exynos_drm_crtc_enable,
.disable= exynos_drm_crtc_disable,
.mode_fixup = exynos_drm_crtc_mode_fixup,
-   .mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
.atomic_begin   = exynos_crtc_atomic_begin,
.atomic_flush   = exynos_crtc_atomic_flush,
 };
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index cc56c3d..5f1a4d6 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -86,7 +86,6 @@ struct exynos_drm_plane {
  * @enable: enable the device
  * @disable: disable the device
  * @mode_fixup: fix mode data before applying it
- * @commit: set current hw specific display mode to hw.
  * @enable_vblank: specific driver callback for enabling vblank interrupt.
  * @disable_vblank: specific driver callback for disabling vblank interrupt.
  * @wait_for_vblank: wait for vblank interrupt to make sure that
@@ -109,7 +108,6 @@ struct exynos_drm_crtc_ops {
bool (*mode_fixup)(struct exynos_drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode);
-   void (*commit)(struct exynos_drm_crtc *crtc);
int (*enable_vblank)(struct exynos_drm_crtc *crtc);
void (*disable_vblank)(struct exynos_drm_crtc *crtc);
void (*wait_for_vblank)(struct exynos_drm_crtc *crtc);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/10] drm/exynos: add pm_runtime to FIMD

2015-09-04 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Let pm_runtime handle the enabling/disabling of the device with proper
refcnt instead of rely on specific flags to track the enabled state.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  1 -
 drivers/gpu/drm/exynos/exynos7_drm_decon.c|  1 -
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  | 91 +++
 3 files changed, 37 insertions(+), 56 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 79b2b22..838a9c1 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -478,7 +478,6 @@ static struct exynos_drm_crtc_ops decon_crtc_ops = {
.commit = decon_commit,
.enable_vblank  = decon_enable_vblank,
.disable_vblank = decon_disable_vblank,
-   .commit = decon_commit,
.atomic_begin   = decon_atomic_begin,
.update_plane   = decon_update_plane,
.disable_plane  = decon_disable_plane,
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index f3826dc..e4646e2 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -637,7 +637,6 @@ static const struct exynos_drm_crtc_ops decon_crtc_ops = {
.enable = decon_enable,
.disable = decon_disable,
.mode_fixup = decon_mode_fixup,
-   .commit = decon_commit,
.enable_vblank = decon_enable_vblank,
.disable_vblank = decon_disable_vblank,
.wait_for_vblank = decon_wait_for_vblank,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 0bbe537..0f17ae0 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -160,7 +160,6 @@ struct fimd_context {
u32 vidout_con;
u32 i80ifcon;
booli80_if;
-   boolsuspended;
int pipe;
wait_queue_head_t   wait_vsync_queue;
atomic_twait_vsync_event;
@@ -209,9 +208,6 @@ static int fimd_enable_vblank(struct exynos_drm_crtc *crtc)
struct fimd_context *ctx = crtc->ctx;
u32 val;
 
-   if (ctx->suspended)
-   return -EPERM;
-
if (!test_and_set_bit(0, >irq_flags)) {
val = readl(ctx->regs + VIDINTCON0);
 
@@ -241,9 +237,6 @@ static void fimd_disable_vblank(struct exynos_drm_crtc 
*crtc)
struct fimd_context *ctx = crtc->ctx;
u32 val;
 
-   if (ctx->suspended)
-   return;
-
if (test_and_clear_bit(0, >irq_flags)) {
val = readl(ctx->regs + VIDINTCON0);
 
@@ -264,9 +257,6 @@ static void fimd_wait_for_vblank(struct exynos_drm_crtc 
*crtc)
 {
struct fimd_context *ctx = crtc->ctx;
 
-   if (ctx->suspended)
-   return;
-
atomic_set(>wait_vsync_event, 1);
 
/*
@@ -339,14 +329,12 @@ static void fimd_clear_channels(struct exynos_drm_crtc 
*crtc)
int pipe = ctx->pipe;
 
/* ensure that vblank interrupt won't be reported to core */
-   ctx->suspended = false;
ctx->pipe = -1;
 
fimd_enable_vblank(ctx->crtc);
fimd_wait_for_vblank(ctx->crtc);
fimd_disable_vblank(ctx->crtc);
 
-   ctx->suspended = true;
ctx->pipe = pipe;
}
 
@@ -394,9 +382,6 @@ static void fimd_commit(struct exynos_drm_crtc *crtc)
void *timing_base = ctx->regs + driver_data->timing_base;
u32 val, clkdiv;
 
-   if (ctx->suspended)
-   return;
-
/* nothing to do if we haven't set the mode yet */
if (mode->htotal == 0 || mode->vtotal == 0)
return;
@@ -630,9 +615,6 @@ static void fimd_atomic_begin(struct exynos_drm_crtc *crtc,
 {
struct fimd_context *ctx = crtc->ctx;
 
-   if (ctx->suspended)
-   return;
-
fimd_shadow_protect_win(ctx, plane->zpos, true);
 }
 
@@ -641,9 +623,6 @@ static void fimd_atomic_flush(struct exynos_drm_crtc *crtc,
 {
struct fimd_context *ctx = crtc->ctx;
 
-   if (ctx->suspended)
-   return;
-
fimd_shadow_protect_win(ctx, plane->zpos, false);
 }
 
@@ -659,9 +638,6 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc,
unsigned int bpp = state->fb->bits_per_pixel >> 3;
unsigned int pitch = state->fb->pitches[0];
 
-   if (ctx->suspended)
-

[PATCH 05/10] drm/exynos: remove exynos_crtc commit() callback

2015-09-04 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

It turns out that .commit() was never executed, because
at the time .mode_set_nofb() called it ctx->suspended was still false
and .commit() would return. It removes the callback from FIMD DECON 7 and
DECON 5433.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 2697ebc..0bbe537 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -888,7 +888,6 @@ static const struct exynos_drm_crtc_ops fimd_crtc_ops = {
.enable = fimd_enable,
.disable = fimd_disable,
.mode_fixup = fimd_mode_fixup,
-   .commit = fimd_commit,
.enable_vblank = fimd_enable_vblank,
.disable_vblank = fimd_disable_vblank,
.wait_for_vblank = fimd_wait_for_vblank,
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/10] drm/exynos: Enable DP clock directly from FIMD

2015-09-04 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Instead of having a .clock_enable callback enable the dp clock directly
from FIMD.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_dp_core.c  | 13 ---
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |  5 
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 39 +---
 3 files changed, 21 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 6794982..aa11d18 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -37,11 +37,6 @@
 #define ctx_from_connector(c)  container_of(c, struct exynos_dp_device, \
connector)
 
-static inline struct exynos_drm_crtc *dp_to_crtc(struct exynos_dp_device *dp)
-{
-   return to_exynos_crtc(dp->encoder.crtc);
-}
-
 static inline struct exynos_dp_device *encoder_to_dp(
struct drm_encoder *e)
 {
@@ -1068,7 +1063,6 @@ static void exynos_dp_mode_set(struct drm_encoder 
*encoder,
 static void exynos_dp_enable(struct drm_encoder *encoder)
 {
struct exynos_dp_device *dp = encoder_to_dp(encoder);
-   struct exynos_drm_crtc *crtc = dp_to_crtc(dp);
 
pm_runtime_get_sync(dp->dev);
 
@@ -1079,9 +1073,6 @@ static void exynos_dp_enable(struct drm_encoder *encoder)
}
}
 
-   if (crtc->ops->clock_enable)
-   crtc->ops->clock_enable(dp_to_crtc(dp), true);
-
phy_power_on(dp->phy);
exynos_dp_init_dp(dp);
enable_irq(dp->irq);
@@ -1091,7 +1082,6 @@ static void exynos_dp_enable(struct drm_encoder *encoder)
 static void exynos_dp_disable(struct drm_encoder *encoder)
 {
struct exynos_dp_device *dp = encoder_to_dp(encoder);
-   struct exynos_drm_crtc *crtc = dp_to_crtc(dp);
 
if (dp->panel) {
if (drm_panel_disable(dp->panel)) {
@@ -1104,9 +1094,6 @@ static void exynos_dp_disable(struct drm_encoder *encoder)
flush_work(>hotplug_work);
phy_power_off(dp->phy);
 
-   if (crtc->ops->clock_enable)
-   crtc->ops->clock_enable(dp_to_crtc(dp), false);
-
if (dp->panel) {
if (drm_panel_unprepare(dp->panel))
DRM_ERROR("failed to turnoff the panel\n");
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 5f1a4d6..ee60619 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -96,10 +96,6 @@ struct exynos_drm_plane {
  * @disable_plane: disable hardware specific overlay.
  * @te_handler: trigger to transfer video image at the tearing effect
  * synchronization signal if there is a page flip request.
- * @clock_enable: optional function enabling/disabling display domain clock,
- * called from exynos-dp driver before powering up (with
- * 'enable' argument as true) and after powering down (with
- * 'enable' as false).
  */
 struct exynos_drm_crtc;
 struct exynos_drm_crtc_ops {
@@ -120,7 +116,6 @@ struct exynos_drm_crtc_ops {
void (*atomic_flush)(struct exynos_drm_crtc *crtc,
  struct exynos_drm_plane *plane);
void (*te_handler)(struct exynos_drm_crtc *crtc);
-   void (*clock_enable)(struct exynos_drm_crtc *crtc, bool enable);
 };
 
 /*
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 0f17ae0..3cf2b80 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -573,6 +573,23 @@ static void fimd_win_set_colkey(struct fimd_context *ctx, 
unsigned int win)
writel(keycon1, ctx->regs + WKEYCON1_BASE(win));
 }
 
+static void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable)
+{
+   struct fimd_context *ctx = crtc->ctx;
+   u32 val;
+
+   /*
+* Only Exynos 5250, 5260, 5410 and 542x requires enabling DP/MIE
+* clock. On these SoCs the bootloader may enable it but any
+* power domain off/on will reset it to disable state.
+*/
+   if (ctx->driver_data != _fimd_driver_data)
+   return;
+
+   val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE;
+   writel(DP_MIE_CLK_DP_ENABLE, ctx->regs + DP_MIE_CLKCON);
+}
+
 /**
  * shadow_protect_win() - disable updating values from shadow registers at 
vsync
  *
@@ -735,6 +752,8 @@ static void fimd_enable(struct exynos_drm_crtc *crtc)
if (test_and_clear_bit(0, >irq_flags))
fimd_enable_vblank(ctx->crtc);
 
+   fimd_dp_clock_enable(crtc, true);
+
fimd_commit(ctx->crtc);
 }
 
@@ -743,6 +762,8 @@ static void fimd_disable(struct exynos_drm_crtc *crtc)
  

[PATCH 09/10] drm/exynos: add pm_runtime to DECON 5433

2015-09-04 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Let pm_runtime handle the enabling/disabling of the device with
proper refcnt instead of rely on specific flags to track the enabled
state.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 89 ---
 1 file changed, 39 insertions(+), 50 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 838a9c1..f0b7804 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -35,7 +35,6 @@ struct decon_context {
struct clk  *clks[6];
unsigned long   irq_flags;
int pipe;
-   boolsuspended;
 
 #define BIT_CLKS_ENABLED   0
 #define BIT_IRQS_ENABLED   1
@@ -65,9 +64,6 @@ static int decon_enable_vblank(struct exynos_drm_crtc *crtc)
struct decon_context *ctx = crtc->ctx;
u32 val;
 
-   if (ctx->suspended)
-   return -EPERM;
-
if (test_and_set_bit(0, >irq_flags)) {
val = VIDINTCON0_INTEN;
if (ctx->i80_if)
@@ -85,9 +81,6 @@ static void decon_disable_vblank(struct exynos_drm_crtc *crtc)
 {
struct decon_context *ctx = crtc->ctx;
 
-   if (ctx->suspended)
-   return;
-
if (test_and_clear_bit(0, >irq_flags))
writel(0, ctx->addr + DECON_VIDINTCON0);
 }
@@ -105,9 +98,6 @@ static void decon_commit(struct exynos_drm_crtc *crtc)
struct drm_display_mode *mode = >base.mode;
u32 val;
 
-   if (ctx->suspended)
-   return;
-
/* enable clock gate */
val = CMU_CLKGAGE_MODE_SFR_F | CMU_CLKGAGE_MODE_MEM_F;
writel(val, ctx->addr + DECON_CMU);
@@ -230,9 +220,6 @@ static void decon_atomic_begin(struct exynos_drm_crtc *crtc,
 {
struct decon_context *ctx = crtc->ctx;
 
-   if (ctx->suspended)
-   return;
-
decon_shadow_protect_win(ctx, plane->zpos, true);
 }
 
@@ -246,9 +233,6 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc,
unsigned int pitch = state->fb->pitches[0];
u32 val;
 
-   if (ctx->suspended)
-   return;
-
val = COORDINATE_X(plane->crtc_x) | COORDINATE_Y(plane->crtc_y);
writel(val, ctx->addr + DECON_VIDOSDxA(win));
 
@@ -293,9 +277,6 @@ static void decon_disable_plane(struct exynos_drm_crtc 
*crtc,
unsigned int win = plane->zpos;
u32 val;
 
-   if (ctx->suspended)
-   return;
-
decon_shadow_protect_win(ctx, win, true);
 
/* window disable */
@@ -316,9 +297,6 @@ static void decon_atomic_flush(struct exynos_drm_crtc *crtc,
 {
struct decon_context *ctx = crtc->ctx;
 
-   if (ctx->suspended)
-   return;
-
decon_shadow_protect_win(ctx, plane->zpos, false);
 
if (ctx->i80_if)
@@ -351,22 +329,9 @@ static void decon_swreset(struct decon_context *ctx)
 static void decon_enable(struct exynos_drm_crtc *crtc)
 {
struct decon_context *ctx = crtc->ctx;
-   int ret;
-   int i;
-
-   if (!ctx->suspended)
-   return;
-
-   ctx->suspended = false;
 
pm_runtime_get_sync(ctx->dev);
 
-   for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++) {
-   ret = clk_prepare_enable(ctx->clks[i]);
-   if (ret < 0)
-   goto err;
-   }
-
set_bit(BIT_CLKS_ENABLED, >enabled);
 
/* if vblank was enabled status, enable it again. */
@@ -376,11 +341,6 @@ static void decon_enable(struct exynos_drm_crtc *crtc)
decon_commit(ctx->crtc);
 
return;
-err:
-   while (--i >= 0)
-   clk_disable_unprepare(ctx->clks[i]);
-
-   ctx->suspended = true;
 }
 
 static void decon_disable(struct exynos_drm_crtc *crtc)
@@ -388,9 +348,6 @@ static void decon_disable(struct exynos_drm_crtc *crtc)
struct decon_context *ctx = crtc->ctx;
int i;
 
-   if (ctx->suspended)
-   return;
-
/*
 * We need to make sure that all windows are disabled before we
 * suspend that connector. Otherwise we might try to scan from
@@ -401,14 +358,9 @@ static void decon_disable(struct exynos_drm_crtc *crtc)
 
decon_swreset(ctx);
 
-   for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++)
-   clk_disable_unprepare(ctx->clks[i]);
-
clear_bit(BIT_CLKS_ENABLED, >enabled);
 
pm_runtime_put_sync(ctx->dev);
-
-   ctx->suspended = true;
 }
 
 void decon_te_irq_handler(struct exynos_drm_crtc *crtc)
@@ -475,7 +427,6 @@ err:
 static struct exynos_drm_crtc_ops decon_crtc_ops 

[PATCH 10/10] drm/exynos: add pm_runtime to DECON 7

2015-09-04 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Let pm_runtime handle the enabling/disabling of the device with
proper refcnt instead of rely on specific flags to track the enabled
state.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c | 125 -
 1 file changed, 53 insertions(+), 72 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index e4646e2..517ba7a 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -54,7 +54,6 @@ struct decon_context {
void __iomem*regs;
unsigned long   irq_flags;
booli80_if;
-   boolsuspended;
int pipe;
wait_queue_head_t   wait_vsync_queue;
atomic_twait_vsync_event;
@@ -85,9 +84,6 @@ static void decon_wait_for_vblank(struct exynos_drm_crtc 
*crtc)
 {
struct decon_context *ctx = crtc->ctx;
 
-   if (ctx->suspended)
-   return;
-
atomic_set(>wait_vsync_event, 1);
 
/*
@@ -119,13 +115,8 @@ static void decon_clear_channels(struct exynos_drm_crtc 
*crtc)
}
 
/* Wait for vsync, as disable channel takes effect at next vsync */
-   if (ch_enabled) {
-   unsigned int state = ctx->suspended;
-
-   ctx->suspended = 0;
+   if (ch_enabled)
decon_wait_for_vblank(ctx->crtc);
-   ctx->suspended = state;
-   }
 }
 
 static int decon_ctx_initialize(struct decon_context *ctx,
@@ -180,9 +171,6 @@ static void decon_commit(struct exynos_drm_crtc *crtc)
struct drm_display_mode *mode = >base.state->adjusted_mode;
u32 val, clkdiv;
 
-   if (ctx->suspended)
-   return;
-
/* nothing to do if we haven't set the mode yet */
if (mode->htotal == 0 || mode->vtotal == 0)
return;
@@ -244,9 +232,6 @@ static int decon_enable_vblank(struct exynos_drm_crtc *crtc)
struct decon_context *ctx = crtc->ctx;
u32 val;
 
-   if (ctx->suspended)
-   return -EPERM;
-
if (!test_and_set_bit(0, >irq_flags)) {
val = readl(ctx->regs + VIDINTCON0);
 
@@ -269,9 +254,6 @@ static void decon_disable_vblank(struct exynos_drm_crtc 
*crtc)
struct decon_context *ctx = crtc->ctx;
u32 val;
 
-   if (ctx->suspended)
-   return;
-
if (test_and_clear_bit(0, >irq_flags)) {
val = readl(ctx->regs + VIDINTCON0);
 
@@ -399,9 +381,6 @@ static void decon_atomic_begin(struct exynos_drm_crtc *crtc,
 {
struct decon_context *ctx = crtc->ctx;
 
-   if (ctx->suspended)
-   return;
-
decon_shadow_protect_win(ctx, plane->zpos, true);
 }
 
@@ -419,9 +398,6 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc,
unsigned int bpp = state->fb->bits_per_pixel >> 3;
unsigned int pitch = state->fb->pitches[0];
 
-   if (ctx->suspended)
-   return;
-
/*
 * SHADOWCON/PRTCON register is used for enabling timing.
 *
@@ -518,9 +494,6 @@ static void decon_disable_plane(struct exynos_drm_crtc 
*crtc,
unsigned int win = plane->zpos;
u32 val;
 
-   if (ctx->suspended)
-   return;
-
/* protect windows */
decon_shadow_protect_win(ctx, win, true);
 
@@ -539,9 +512,6 @@ static void decon_atomic_flush(struct exynos_drm_crtc *crtc,
 {
struct decon_context *ctx = crtc->ctx;
 
-   if (ctx->suspended)
-   return;
-
decon_shadow_protect_win(ctx, plane->zpos, false);
 }
 
@@ -565,39 +535,9 @@ static void decon_init(struct decon_context *ctx)
 static void decon_enable(struct exynos_drm_crtc *crtc)
 {
struct decon_context *ctx = crtc->ctx;
-   int ret;
-
-   if (!ctx->suspended)
-   return;
-
-   ctx->suspended = false;
 
pm_runtime_get_sync(ctx->dev);
 
-   ret = clk_prepare_enable(ctx->pclk);
-   if (ret < 0) {
-   DRM_ERROR("Failed to prepare_enable the pclk [%d]\n", ret);
-   return;
-   }
-
-   ret = clk_prepare_enable(ctx->aclk);
-   if (ret < 0) {
-   DRM_ERROR("Failed to prepare_enable the aclk [%d]\n", ret);
-   return;
-   }
-
-   ret = clk_prepare_enable(ctx->eclk);
-   if  (ret < 0) {
-   DRM_ERROR("Failed to prepare_enable the eclk [%d]\n", ret);
-   return;
-   }
-
-   ret = clk_prepare_enable(ctx->vclk);
-   if  (ret < 0) {
-   DRM_ERROR("F

Re: [PATCH] drm/exynos: add cursor plane support

2015-09-04 Thread Gustavo Padovan
Hi Inki,

2015-09-04 Inki Dae <inki@samsung.com>:

> Hi Gustavo,
> 
> I had already a review but I didn't give any comment to you. Sorry about
> that. This patch looks good to me but one thing isn't clear. Below is my
> comment.
> 
> 
> On 2015년 09월 04일 05:14, Gustavo Padovan wrote:
> > From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
> > 
> > Set one of the planes for each crtc driver as a cursor plane enabled
> > window managers to fully work on exynos.
> > 
> > Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
> > ---
> >  drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  9 ++---
> >  drivers/gpu/drm/exynos/exynos7_drm_decon.c|  8 ++--
> >  drivers/gpu/drm/exynos/exynos_drm_drv.h   |  3 +++
> >  drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  8 ++--
> >  drivers/gpu/drm/exynos/exynos_drm_plane.c | 18 +++---
> >  drivers/gpu/drm/exynos/exynos_drm_plane.h |  5 ++---
> >  drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  9 ++---
> >  drivers/gpu/drm/exynos/exynos_mixer.c | 10 +++---
> >  8 files changed, 31 insertions(+), 39 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
> > b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> > index b3c7307..79b2b22 100644
> > --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> > +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> > @@ -33,7 +33,6 @@ struct decon_context {
> > struct exynos_drm_plane planes[WINDOWS_NR];
> > void __iomem*addr;
> > struct clk  *clks[6];
> > -   unsigned intdefault_win;
> > unsigned long   irq_flags;
> > int pipe;
> > boolsuspended;
> > @@ -493,7 +492,6 @@ static int decon_bind(struct device *dev, struct device 
> > *master, void *data)
> > struct drm_device *drm_dev = data;
> > struct exynos_drm_private *priv = drm_dev->dev_private;
> > struct exynos_drm_plane *exynos_plane;
> > -   enum drm_plane_type type;
> > unsigned int zpos;
> > int ret;
> >  
> > @@ -501,16 +499,14 @@ static int decon_bind(struct device *dev, struct 
> > device *master, void *data)
> > ctx->pipe = priv->pipe++;
> >  
> > for (zpos = 0; zpos < WINDOWS_NR; zpos++) {
> > -   type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY :
> > -   DRM_PLANE_TYPE_OVERLAY;
> > ret = exynos_plane_init(drm_dev, >planes[zpos],
> > -   1 << ctx->pipe, type, decon_formats,
> > +   1 << ctx->pipe, decon_formats,
> > ARRAY_SIZE(decon_formats), zpos);
> > if (ret)
> > return ret;
> > }
> >  
> > -   exynos_plane = >planes[ctx->default_win];
> > +   exynos_plane = >planes[DEFAULT_WIN];
> > ctx->crtc = exynos_drm_crtc_create(drm_dev, _plane->base,
> > ctx->pipe, EXYNOS_DISPLAY_TYPE_LCD,
> > _crtc_ops, ctx);
> > @@ -607,7 +603,6 @@ static int exynos5433_decon_probe(struct 
> > platform_device *pdev)
> > if (!ctx)
> > return -ENOMEM;
> >  
> > -   ctx->default_win = 0;
> > ctx->suspended = true;
> > ctx->dev = dev;
> > if (of_get_child_by_name(dev->of_node, "i80-if-timings"))
> > diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
> > b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> > index cbdb78e..f3826dc 100644
> > --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> > +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> > @@ -52,7 +52,6 @@ struct decon_context {
> > struct clk  *eclk;
> > struct clk  *vclk;
> > void __iomem*regs;
> > -   unsigned intdefault_win;
> > unsigned long   irq_flags;
> > booli80_if;
> > boolsuspended;
> > @@ -691,7 +690,6 @@ static int decon_bind(struct device *dev, struct device 
> > *master, void *data)
> > struct decon_context *ctx = dev_get_drvdata(dev);
> > struct drm_device *drm_dev = data;
> > struct exynos_drm_plane 

[PATCH 2/2] drm/exynos: add cursor plane support

2015-09-04 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Set one of the planes for each crtc driver as a cursor plane enabled
window managers to fully work on exynos.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

---
v2: use the top window for cursor on each crtc
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  4 ++--
 drivers/gpu/drm/exynos/exynos7_drm_decon.c|  4 ++--
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  4 ++--
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 11 +++
 drivers/gpu/drm/exynos/exynos_drm_plane.h |  2 ++
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  4 ++--
 drivers/gpu/drm/exynos/exynos_mixer.c |  4 ++--
 7 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 2f393b1..4b8dd7c 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -24,6 +24,7 @@
 #include "exynos_drm_iommu.h"
 
 #define WINDOWS_NR 3
+#define CURSOR_WIN 2
 #define MIN_FB_WIDTH_FOR_16WORD_BURST  128
 
 struct decon_context {
@@ -450,8 +451,7 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
ctx->pipe = priv->pipe++;
 
for (zpos = 0; zpos < WINDOWS_NR; zpos++) {
-   type = (zpos == DEFAULT_WIN) ? DRM_PLANE_TYPE_PRIMARY :
-   DRM_PLANE_TYPE_OVERLAY;
+   type = exynos_plane_get_type(zpos, CURSOR_WIN);
ret = exynos_plane_init(drm_dev, >planes[zpos],
1 << ctx->pipe, type, decon_formats,
ARRAY_SIZE(decon_formats), zpos);
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 7a6c069..aa0ae79 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -41,6 +41,7 @@
 #define MIN_FB_WIDTH_FOR_16WORD_BURST 128
 
 #define WINDOWS_NR 2
+#define CURSOR_WIN 1
 
 struct decon_context {
struct device   *dev;
@@ -630,8 +631,7 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
}
 
for (zpos = 0; zpos < WINDOWS_NR; zpos++) {
-   type = (zpos == DEFAULT_WIN) ? DRM_PLANE_TYPE_PRIMARY :
-   DRM_PLANE_TYPE_OVERLAY;
+   type = exynos_plane_get_type(zpos, CURSOR_WIN);
ret = exynos_plane_init(drm_dev, >planes[zpos],
1 << ctx->pipe, type, decon_formats,
ARRAY_SIZE(decon_formats), zpos);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 7776768..caa5255 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -88,6 +88,7 @@
 
 /* FIMD has totally five hardware windows. */
 #define WINDOWS_NR 5
+#define CURSOR_WIN 4
 
 struct fimd_driver_data {
unsigned int timing_base;
@@ -909,8 +910,7 @@ static int fimd_bind(struct device *dev, struct device 
*master, void *data)
ctx->pipe = priv->pipe++;
 
for (zpos = 0; zpos < WINDOWS_NR; zpos++) {
-   type = (zpos == DEFAULT_WIN) ? DRM_PLANE_TYPE_PRIMARY :
-   DRM_PLANE_TYPE_OVERLAY;
+   type = exynos_plane_get_type(zpos, CURSOR_WIN);
ret = exynos_plane_init(drm_dev, >planes[zpos],
1 << ctx->pipe, type, fimd_formats,
ARRAY_SIZE(fimd_formats), zpos);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 7148224..80b2151 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -208,6 +208,17 @@ static void exynos_plane_attach_zpos_property(struct 
drm_plane *plane,
drm_object_attach_property(>base, prop, zpos);
 }
 
+enum drm_plane_type exynos_plane_get_type(unsigned int zpos,
+ unsigned int cursor_win)
+{
+   if (zpos == DEFAULT_WIN)
+   return DRM_PLANE_TYPE_PRIMARY;
+   else if (zpos == cursor_win)
+   return DRM_PLANE_TYPE_CURSOR;
+   else
+   return DRM_PLANE_TYPE_OVERLAY;
+}
+
 int exynos_plane_init(struct drm_device *dev,
  struct exynos_drm_plane *exynos_plane,
  unsigned long possible_crtcs, enum drm_plane_type type,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.h 
b/drivers/gpu/drm/exynos/exynos_drm_plane.h
index 476c934..abb641e 100644
--- a/drivers/gpu/drm/exyn

[PATCH 1/2] drm/exynos: add global macro for the default primary plane

2015-09-04 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Define DEFAULT_WIN as zero to help set the primary plane on all CRTCs.
Some CRTCs were defining a variable to store the default window, but that
is not necessary as the default (primary) window is always the window zero.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 6 ++
 drivers/gpu/drm/exynos/exynos7_drm_decon.c| 5 ++---
 drivers/gpu/drm/exynos/exynos_drm_drv.h   | 2 ++
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  | 5 ++---
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  | 6 ++
 drivers/gpu/drm/exynos/exynos_mixer.c | 7 +++
 6 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 988df06..2f393b1 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -33,7 +33,6 @@ struct decon_context {
struct exynos_drm_plane planes[WINDOWS_NR];
void __iomem*addr;
struct clk  *clks[6];
-   unsigned intdefault_win;
unsigned long   irq_flags;
int pipe;
 
@@ -451,7 +450,7 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
ctx->pipe = priv->pipe++;
 
for (zpos = 0; zpos < WINDOWS_NR; zpos++) {
-   type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY :
+   type = (zpos == DEFAULT_WIN) ? DRM_PLANE_TYPE_PRIMARY :
DRM_PLANE_TYPE_OVERLAY;
ret = exynos_plane_init(drm_dev, >planes[zpos],
1 << ctx->pipe, type, decon_formats,
@@ -460,7 +459,7 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
return ret;
}
 
-   exynos_plane = >planes[ctx->default_win];
+   exynos_plane = >planes[DEFAULT_WIN];
ctx->crtc = exynos_drm_crtc_create(drm_dev, _plane->base,
ctx->pipe, EXYNOS_DISPLAY_TYPE_LCD,
_crtc_ops, ctx);
@@ -557,7 +556,6 @@ static int exynos5433_decon_probe(struct platform_device 
*pdev)
if (!ctx)
return -ENOMEM;
 
-   ctx->default_win = 0;
ctx->dev = dev;
if (of_get_child_by_name(dev->of_node, "i80-if-timings"))
ctx->i80_if = true;
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 0776f38..7a6c069 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -52,7 +52,6 @@ struct decon_context {
struct clk  *eclk;
struct clk  *vclk;
void __iomem*regs;
-   unsigned intdefault_win;
unsigned long   irq_flags;
booli80_if;
int pipe;
@@ -631,7 +630,7 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
}
 
for (zpos = 0; zpos < WINDOWS_NR; zpos++) {
-   type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY :
+   type = (zpos == DEFAULT_WIN) ? DRM_PLANE_TYPE_PRIMARY :
DRM_PLANE_TYPE_OVERLAY;
ret = exynos_plane_init(drm_dev, >planes[zpos],
1 << ctx->pipe, type, decon_formats,
@@ -640,7 +639,7 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
return ret;
}
 
-   exynos_plane = >planes[ctx->default_win];
+   exynos_plane = >planes[DEFAULT_WIN];
ctx->crtc = exynos_drm_crtc_create(drm_dev, _plane->base,
   ctx->pipe, EXYNOS_DISPLAY_TYPE_LCD,
   _crtc_ops, ctx);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 5cb9bc3..058abd1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -22,6 +22,8 @@
 #define MAX_PLANE  5
 #define MAX_FB_BUFFER  4
 
+#define DEFAULT_WIN0
+
 #define to_exynos_crtc(x)  container_of(x, struct exynos_drm_crtc, base)
 #define to_exynos_plane(x) container_of(x, struct exynos_drm_plane, base)
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index dc36e63..7776768 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exy

[PATCH] drm/exynos: add cursor plane support

2015-09-03 Thread Gustavo Padovan
From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

Set one of the planes for each crtc driver as a cursor plane enabled
window managers to fully work on exynos.

Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  9 ++---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c|  8 ++--
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  3 +++
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  8 ++--
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 18 +++---
 drivers/gpu/drm/exynos/exynos_drm_plane.h |  5 ++---
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  9 ++---
 drivers/gpu/drm/exynos/exynos_mixer.c | 10 +++---
 8 files changed, 31 insertions(+), 39 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index b3c7307..79b2b22 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -33,7 +33,6 @@ struct decon_context {
struct exynos_drm_plane planes[WINDOWS_NR];
void __iomem*addr;
struct clk  *clks[6];
-   unsigned intdefault_win;
unsigned long   irq_flags;
int pipe;
boolsuspended;
@@ -493,7 +492,6 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
struct drm_device *drm_dev = data;
struct exynos_drm_private *priv = drm_dev->dev_private;
struct exynos_drm_plane *exynos_plane;
-   enum drm_plane_type type;
unsigned int zpos;
int ret;
 
@@ -501,16 +499,14 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
ctx->pipe = priv->pipe++;
 
for (zpos = 0; zpos < WINDOWS_NR; zpos++) {
-   type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY :
-   DRM_PLANE_TYPE_OVERLAY;
ret = exynos_plane_init(drm_dev, >planes[zpos],
-   1 << ctx->pipe, type, decon_formats,
+   1 << ctx->pipe, decon_formats,
ARRAY_SIZE(decon_formats), zpos);
if (ret)
return ret;
}
 
-   exynos_plane = >planes[ctx->default_win];
+   exynos_plane = >planes[DEFAULT_WIN];
ctx->crtc = exynos_drm_crtc_create(drm_dev, _plane->base,
ctx->pipe, EXYNOS_DISPLAY_TYPE_LCD,
_crtc_ops, ctx);
@@ -607,7 +603,6 @@ static int exynos5433_decon_probe(struct platform_device 
*pdev)
if (!ctx)
return -ENOMEM;
 
-   ctx->default_win = 0;
ctx->suspended = true;
ctx->dev = dev;
if (of_get_child_by_name(dev->of_node, "i80-if-timings"))
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index cbdb78e..f3826dc 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -52,7 +52,6 @@ struct decon_context {
struct clk  *eclk;
struct clk  *vclk;
void __iomem*regs;
-   unsigned intdefault_win;
unsigned long   irq_flags;
booli80_if;
boolsuspended;
@@ -691,7 +690,6 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
struct decon_context *ctx = dev_get_drvdata(dev);
struct drm_device *drm_dev = data;
struct exynos_drm_plane *exynos_plane;
-   enum drm_plane_type type;
unsigned int zpos;
int ret;
 
@@ -702,16 +700,14 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
}
 
for (zpos = 0; zpos < WINDOWS_NR; zpos++) {
-   type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY :
-   DRM_PLANE_TYPE_OVERLAY;
ret = exynos_plane_init(drm_dev, >planes[zpos],
-   1 << ctx->pipe, type, decon_formats,
+   1 << ctx->pipe, decon_formats,
ARRAY_SIZE(decon_formats), zpos);
if (ret)
return ret;
}
 
-   exynos_plane = >planes[ctx->default_win];
+   exynos_plane = >planes[DEFAULT_WIN];
ctx->crtc = exynos_drm_crtc_create(drm_dev, _plane->base,
   ctx->pipe, EXYNOS_DISPLAY_

[PATCH v2 10/11] drm/exynos: remove wait queue for pending page flip

2015-08-26 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Exynos atomic commit procedures already does this job of waiting for
pending updates to finish, that means using pending_flip_queue is
pointless now because the disable CRTC procedure will never happen
during a page_flip.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 11 +--
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |  1 -
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index d6c2c3f..0872aa2f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -35,11 +35,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
-   /* wait for the completion of page flip. */
-   if (!wait_event_timeout(exynos_crtc-pending_flip_queue,
-   (exynos_crtc-event == NULL), HZ/20))
-   exynos_crtc-event = NULL;
-
drm_crtc_vblank_off(crtc);
 
if (exynos_crtc-ops-disable)
@@ -146,8 +141,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct 
drm_device *drm_dev,
if (!exynos_crtc)
return ERR_PTR(-ENOMEM);
 
-   init_waitqueue_head(exynos_crtc-pending_flip_queue);
-
exynos_crtc-pipe = pipe;
exynos_crtc-type = type;
exynos_crtc-ops = ops;
@@ -215,10 +208,8 @@ void exynos_drm_crtc_finish_update(struct exynos_drm_crtc 
*exynos_crtc,
wake_up(exynos_crtc-wait_update);
 
spin_lock_irqsave(crtc-dev-event_lock, flags);
-   if (exynos_crtc-event) {
+   if (exynos_crtc-event)
drm_crtc_send_vblank_event(crtc, exynos_crtc-event);
-   wake_up(exynos_crtc-pending_flip_queue);
-   }
 
exynos_crtc-event = NULL;
spin_unlock_irqrestore(crtc-dev-event_lock, flags);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 7193d94..b7ba21d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -145,7 +145,6 @@ struct exynos_drm_crtc {
struct drm_crtc base;
enum exynos_drm_output_type type;
unsigned intpipe;
-   wait_queue_head_t   pending_flip_queue;
struct drm_pending_vblank_event *event;
wait_queue_head_t   wait_update;
atomic_tpending_update;
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 11/11] drm/exynos: Enable atomic modesetting feature

2015-08-26 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Now that atomic modesetting is implemented for exynos enable the
DRIVER_ATOMIC flag on the driver's features.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 881f178..c882fd3 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -438,7 +438,8 @@ static const struct file_operations exynos_drm_driver_fops 
= {
 };
 
 static struct drm_driver exynos_drm_driver = {
-   .driver_features= DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME,
+   .driver_features= DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME
+ | DRIVER_ATOMIC,
.load   = exynos_drm_load,
.unload = exynos_drm_unload,
.open   = exynos_drm_open,
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] drm/exynos: remove legacy -suspend()/resume()

2015-08-26 Thread Gustavo Padovan
Hi,

What about this patch? We need it to avoid the WARN_ON added by patch
2/2 that was already picked up by Daniel.

Gustavo

2015-08-13 Gustavo Padovan gust...@padovan.org:

 From: Gustavo Padovan gustavo.pado...@collabora.co.uk
 
 These legacy helpers should only be used by shadow-attaching drivers.
 KMS drivers has its own way to handle suspend/resume and don't need to
 use these two helpers.
 
 Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
 ---
  drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 --
  1 file changed, 2 deletions(-)
 
 diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
 b/drivers/gpu/drm/exynos/exynos_drm_drv.c
 index f1d6966..9bcf679 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
 @@ -280,8 +280,6 @@ static struct drm_driver exynos_drm_driver = {
   .driver_features= DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME,
   .load   = exynos_drm_load,
   .unload = exynos_drm_unload,
 - .suspend= exynos_drm_suspend,
 - .resume = exynos_drm_resume,
   .open   = exynos_drm_open,
   .preclose   = exynos_drm_preclose,
   .lastclose  = exynos_drm_lastclose,
 -- 
 2.1.0
 
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/11] drm/exynos: add prepare and cleanup phases for planes

2015-08-26 Thread Gustavo Padovan
Hi Inki,

2015-08-24 Inki Dae inki@samsung.com:

 On 2015년 08월 16일 01:26, Gustavo Padovan wrote:
  From: Gustavo Padovan gustavo.pado...@collabora.co.uk
 
  .prepare_plane() and .cleanup_plane() allows to perform extra operations
  before and after the update of planes. For FIMD for example this will
  be used to enable disable the shadow protection bit.
 
  Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
  ---
   drivers/gpu/drm/exynos/exynos_drm_crtc.c | 19 +++
   drivers/gpu/drm/exynos/exynos_drm_drv.h  |  6 ++
   2 files changed, 25 insertions(+)
 
  diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
  b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
  index 5a19e16..3a89fc9 100644
  --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
  +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
  @@ -72,15 +72,34 @@ exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
   static void exynos_crtc_atomic_begin(struct drm_crtc *crtc)
   {
  struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
  +   struct drm_plane *plane;
 
  if (crtc-state-event) {
  WARN_ON(drm_crtc_vblank_get(crtc) != 0);
  exynos_crtc-event = crtc-state-event;
  }
  +
  +   drm_atomic_crtc_for_each_plane(plane, crtc) {
  +   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
  +
  +   if (exynos_crtc-ops-prepare_plane)
  +   exynos_crtc-ops-prepare_plane(exynos_crtc,
  +   exynos_plane);
 
 There is no any reason to use prepare_plane/cleanup_plane callback
 names. How about using atomic_begin/atomic_flush callback names instead
 for consistency between framework and device drivers?

Either names are fine for me. So let's go with atomic_begin/flush. I'll
send an updated patchset.

Gustavo
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 09/11] drm/exynos: wait all planes updates to finish

2015-08-26 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Add infrastructure to wait for all planes updates to finish by using
an atomic_t variable to track how many pending updates we are waiting
plus a wait_queue for the wait part.

It also changes vblank behaviour and keeps it enabled for all types
of updates

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 18 +
 drivers/gpu/drm/exynos/exynos_drm_crtc.h |  1 +
 drivers/gpu/drm/exynos/exynos_drm_drv.c  | 44 +++-
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |  4 +++
 4 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 582e041..d6c2c3f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -75,10 +75,7 @@ static void exynos_crtc_atomic_begin(struct drm_crtc *crtc,
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
struct drm_plane *plane;
 
-   if (crtc-state-event) {
-   WARN_ON(drm_crtc_vblank_get(crtc) != 0);
-   exynos_crtc-event = crtc-state-event;
-   }
+   exynos_crtc-event = crtc-state-event;
 
drm_atomic_crtc_for_each_plane(plane, crtc) {
struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
@@ -156,6 +153,8 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct 
drm_device *drm_dev,
exynos_crtc-ops = ops;
exynos_crtc-ctx = ctx;
 
+   init_waitqueue_head(exynos_crtc-wait_update);
+
crtc = exynos_crtc-base;
 
private-crtc[pipe] = crtc;
@@ -197,6 +196,13 @@ void exynos_drm_crtc_disable_vblank(struct drm_device 
*dev, int pipe)
exynos_crtc-ops-disable_vblank(exynos_crtc);
 }
 
+void exynos_drm_crtc_wait_pending_update(struct exynos_drm_crtc *exynos_crtc)
+{
+   wait_event_timeout(exynos_crtc-wait_update,
+  (atomic_read(exynos_crtc-pending_update) == 0),
+  msecs_to_jiffies(50));
+}
+
 void exynos_drm_crtc_finish_update(struct exynos_drm_crtc *exynos_crtc,
struct exynos_drm_plane *exynos_plane)
 {
@@ -205,10 +211,12 @@ void exynos_drm_crtc_finish_update(struct exynos_drm_crtc 
*exynos_crtc,
 
exynos_plane-pending_fb = NULL;
 
+   if (atomic_dec_and_test(exynos_crtc-pending_update))
+   wake_up(exynos_crtc-wait_update);
+
spin_lock_irqsave(crtc-dev-event_lock, flags);
if (exynos_crtc-event) {
drm_crtc_send_vblank_event(crtc, exynos_crtc-event);
-   drm_crtc_vblank_put(crtc);
wake_up(exynos_crtc-pending_flip_queue);
}
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index 8bedfde..f87d4ab 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -25,6 +25,7 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct 
drm_device *drm_dev,
void *context);
 int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe);
 void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe);
+void exynos_drm_crtc_wait_pending_update(struct exynos_drm_crtc *exynos_crtc);
 void exynos_drm_crtc_finish_update(struct exynos_drm_crtc *exynos_crtc,
   struct exynos_drm_plane *exynos_plane);
 void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index fc207f8..881f178 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -45,11 +45,37 @@ struct exynos_atomic_commit {
u32 crtcs;
 };
 
+static void exynos_atomic_wait_for_commit(struct drm_atomic_state *state)
+{
+   struct drm_crtc_state *crtc_state;
+   struct drm_crtc *crtc;
+   int i, ret;
+
+   for_each_crtc_in_state(state, crtc, crtc_state, i) {
+   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+
+   if (!crtc-state-enable)
+   continue;
+
+   ret = drm_crtc_vblank_get(crtc);
+   if (ret)
+   continue;
+
+   exynos_drm_crtc_wait_pending_update(exynos_crtc);
+   drm_crtc_vblank_put(crtc);
+   }
+}
+
 static void exynos_atomic_commit_complete(struct exynos_atomic_commit *commit)
 {
struct drm_device *dev = commit-dev;
struct exynos_drm_private *priv = dev-dev_private;
struct drm_atomic_state *state = commit-state;
+   struct drm_plane *plane;
+   struct drm_crtc *crtc;
+   struct drm_plane_state *plane_state;
+   struct drm_crtc_state *crtc_state;
+   int i;
 
drm_atomic_helper_commit_modeset_disables(dev

[PATCH v2 08/11] drm/exynos: add atomic asynchronous commit

2015-08-26 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

The atomic modesetting interfaces supports async commits that should be
implemented by the drivers. If drm core requests an async commit
exynos_atomic_commit() will now schedule a work task to run the update later.

It also serializes commits that needs to run on the same crtc, putting the
following commit to wait until the current one is finished.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 113 
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  11 
 drivers/gpu/drm/exynos/exynos_drm_fb.c  |  35 --
 3 files changed, 124 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 72b88c7..fc207f8 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -13,6 +13,8 @@
 
 #include linux/pm_runtime.h
 #include drm/drmP.h
+#include drm/drm_atomic.h
+#include drm/drm_atomic_helper.h
 #include drm/drm_crtc_helper.h
 
 #include linux/component.h
@@ -36,6 +38,56 @@
 #define DRIVER_MAJOR   1
 #define DRIVER_MINOR   0
 
+struct exynos_atomic_commit {
+   struct work_struct  work;
+   struct drm_device   *dev;
+   struct drm_atomic_state *state;
+   u32 crtcs;
+};
+
+static void exynos_atomic_commit_complete(struct exynos_atomic_commit *commit)
+{
+   struct drm_device *dev = commit-dev;
+   struct exynos_drm_private *priv = dev-dev_private;
+   struct drm_atomic_state *state = commit-state;
+
+   drm_atomic_helper_commit_modeset_disables(dev, state);
+
+   drm_atomic_helper_commit_modeset_enables(dev, state);
+
+   /*
+* Exynos can't update planes with CRTCs and encoders disabled,
+* its updates routines, specially for FIMD, requires the clocks
+* to be enabled. So it is necessary to handle the modeset operations
+* *before* the commit_planes() step, this way it will always
+* have the relevant clocks enabled to perform the update.
+*/
+
+   drm_atomic_helper_commit_planes(dev, state);
+
+   drm_atomic_helper_wait_for_vblanks(dev, state);
+
+   drm_atomic_helper_cleanup_planes(dev, state);
+
+   drm_atomic_state_free(state);
+
+   spin_lock(priv-lock);
+   priv-pending = ~commit-crtcs;
+   spin_unlock(priv-lock);
+
+   wake_up_all(priv-wait);
+
+   kfree(commit);
+}
+
+static void exynos_drm_atomic_work(struct work_struct *work)
+{
+   struct exynos_atomic_commit *commit = container_of(work,
+   struct exynos_atomic_commit, work);
+
+   exynos_atomic_commit_complete(commit);
+}
+
 static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
 {
struct exynos_drm_private *private;
@@ -47,6 +99,9 @@ static int exynos_drm_load(struct drm_device *dev, unsigned 
long flags)
if (!private)
return -ENOMEM;
 
+   init_waitqueue_head(private-wait);
+   spin_lock_init(private-lock);
+
dev_set_drvdata(dev-dev, dev);
dev-dev_private = (void *)private;
 
@@ -149,6 +204,64 @@ static int exynos_drm_unload(struct drm_device *dev)
return 0;
 }
 
+static int commit_is_pending(struct exynos_drm_private *priv, u32 crtcs)
+{
+   bool pending;
+
+   spin_lock(priv-lock);
+   pending = priv-pending  crtcs;
+   spin_unlock(priv-lock);
+
+   return pending;
+}
+
+int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state 
*state,
+bool async)
+{
+   struct exynos_drm_private *priv = dev-dev_private;
+   struct exynos_atomic_commit *commit;
+   int i, ret;
+
+   commit = kzalloc(sizeof(*commit), GFP_KERNEL);
+   if (!commit)
+   return -ENOMEM;
+
+   ret = drm_atomic_helper_prepare_planes(dev, state);
+   if (ret) {
+   kfree(commit);
+   return ret;
+   }
+
+   /* This is the point of no return */
+
+   INIT_WORK(commit-work, exynos_drm_atomic_work);
+   commit-dev = dev;
+   commit-state = state;
+
+   /* Wait until all affected CRTCs have completed previous commits and
+* mark them as pending.
+*/
+   for (i = 0; i  dev-mode_config.num_crtc; ++i) {
+   if (state-crtcs[i])
+   commit-crtcs |= 1  drm_crtc_index(state-crtcs[i]);
+   }
+
+   wait_event(priv-wait, !commit_is_pending(priv, commit-crtcs));
+
+   spin_lock(priv-lock);
+   priv-pending |= commit-crtcs;
+   spin_unlock(priv-lock);
+
+   drm_atomic_helper_swap_state(dev, state);
+
+   if (async)
+   schedule_work(commit-work);
+   else
+   exynos_atomic_commit_complete(commit);
+
+   return 0;
+}
+
 static int exynos_drm_suspend(struct drm_device *dev, pm_message_t state)
 {
struct

[PATCH v2 02/11] drm/exynos: fimd: unify call to exynos_drm_crtc_finish_pageflip()

2015-08-26 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Unify handling of finished plane update to prepare for a following patch
that will check for the START and START_S regs to really make sure that
the plane was updated.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 5def6bc..30c1409 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -896,15 +896,15 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
if (ctx-pipe  0 || !ctx-drm_dev)
goto out;
 
-   if (ctx-i80_if) {
-   exynos_drm_crtc_finish_pageflip(ctx-crtc);
+   if (!ctx-i80_if)
+   drm_crtc_handle_vblank(ctx-crtc-base);
+
+   exynos_drm_crtc_finish_pageflip(ctx-crtc);
 
+   if (ctx-i80_if) {
/* Exits triggering mode */
atomic_set(ctx-triggering, 0);
} else {
-   drm_crtc_handle_vblank(ctx-crtc-base);
-   exynos_drm_crtc_finish_pageflip(ctx-crtc);
-
/* set wait vsync event to zero and wake up queue. */
if (atomic_read(ctx-wait_vsync_event)) {
atomic_set(ctx-wait_vsync_event, 0);
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 04/11] drm/exynos: fimd: move window protect code to atomic_begin/flush

2015-08-26 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Only set/clear the update bit in the CRTC's .atomic_begin()/flush()
so all planes are really committed at the same time.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk

---
v2: rename prepare_plane/cleanup_plane to atomic_begin/atomic_flush
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 57 +++-
 1 file changed, 34 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 30c1409..005a996 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -591,6 +591,16 @@ static void fimd_shadow_protect_win(struct fimd_context 
*ctx,
 {
u32 reg, bits, val;
 
+   /*
+* SHADOWCON/PRTCON register is used for enabling timing.
+*
+* for example, once only width value of a register is set,
+* if the dma is started then fimd hardware could malfunction so
+* with protect window setting, the register fields with prefix '_F'
+* wouldn't be updated at vsync also but updated once unprotect window
+* is set.
+*/
+
if (ctx-driver_data-has_shadowcon) {
reg = SHADOWCON;
bits = SHADOWCON_WINx_PROTECT(win);
@@ -607,6 +617,28 @@ static void fimd_shadow_protect_win(struct fimd_context 
*ctx,
writel(val, ctx-regs + reg);
 }
 
+static void fimd_atomic_begin(struct exynos_drm_crtc *crtc,
+  struct exynos_drm_plane *plane)
+{
+   struct fimd_context *ctx = crtc-ctx;
+
+   if (ctx-suspended)
+   return;
+
+   fimd_shadow_protect_win(ctx, plane-zpos, true);
+}
+
+static void fimd_atomic_flush(struct exynos_drm_crtc *crtc,
+  struct exynos_drm_plane *plane)
+{
+   struct fimd_context *ctx = crtc-ctx;
+
+   if (ctx-suspended)
+   return;
+
+   fimd_shadow_protect_win(ctx, plane-zpos, false);
+}
+
 static void fimd_update_plane(struct exynos_drm_crtc *crtc,
  struct exynos_drm_plane *plane)
 {
@@ -622,20 +654,6 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc,
if (ctx-suspended)
return;
 
-   /*
-* SHADOWCON/PRTCON register is used for enabling timing.
-*
-* for example, once only width value of a register is set,
-* if the dma is started then fimd hardware could malfunction so
-* with protect window setting, the register fields with prefix '_F'
-* wouldn't be updated at vsync also but updated once unprotect window
-* is set.
-*/
-
-   /* protect windows */
-   fimd_shadow_protect_win(ctx, win, true);
-
-
offset = plane-src_x * bpp;
offset += plane-src_y * pitch;
 
@@ -707,9 +725,6 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc,
if (ctx-driver_data-has_shadowcon)
fimd_enable_shadow_channel_path(ctx, win, true);
 
-   /* Enable DMA channel and unprotect windows */
-   fimd_shadow_protect_win(ctx, win, false);
-
if (ctx-i80_if)
atomic_set(ctx-win_updated, 1);
 }
@@ -723,16 +738,10 @@ static void fimd_disable_plane(struct exynos_drm_crtc 
*crtc,
if (ctx-suspended)
return;
 
-   /* protect windows */
-   fimd_shadow_protect_win(ctx, win, true);
-
fimd_enable_video_output(ctx, win, false);
 
if (ctx-driver_data-has_shadowcon)
fimd_enable_shadow_channel_path(ctx, win, false);
-
-   /* unprotect windows */
-   fimd_shadow_protect_win(ctx, win, false);
 }
 
 static void fimd_enable(struct exynos_drm_crtc *crtc)
@@ -875,8 +884,10 @@ static const struct exynos_drm_crtc_ops fimd_crtc_ops = {
.enable_vblank = fimd_enable_vblank,
.disable_vblank = fimd_disable_vblank,
.wait_for_vblank = fimd_wait_for_vblank,
+   .atomic_begin = fimd_atomic_begin,
.update_plane = fimd_update_plane,
.disable_plane = fimd_disable_plane,
+   .atomic_flush = fimd_atomic_flush,
.te_handler = fimd_te_handler,
.clock_enable = fimd_dp_clock_enable,
 };
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 03/11] drm/exynos: add begin and flush phases for planes

2015-08-26 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

.atomic_begin() and .atomic_flush() allows to perform extra operations
before and after the update of planes. For FIMD for example this will
be used to enable disable the shadow protection bit.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk

---
v2: rename prepare_plane/cleanup_plane to atomic_begin/atomic_flush
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 19 +++
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |  6 ++
 2 files changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 94eb831..54485b7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -73,16 +73,35 @@ static void exynos_crtc_atomic_begin(struct drm_crtc *crtc,
 struct drm_crtc_state *old_crtc_state)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+   struct drm_plane *plane;
 
if (crtc-state-event) {
WARN_ON(drm_crtc_vblank_get(crtc) != 0);
exynos_crtc-event = crtc-state-event;
}
+
+   drm_atomic_crtc_for_each_plane(plane, crtc) {
+   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
+
+   if (exynos_crtc-ops-atomic_begin)
+   exynos_crtc-ops-atomic_begin(exynos_crtc,
+   exynos_plane);
+   }
 }
 
 static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
 struct drm_crtc_state *old_crtc_state)
 {
+   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+   struct drm_plane *plane;
+
+   drm_atomic_crtc_for_each_plane(plane, crtc) {
+   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
+
+   if (exynos_crtc-ops-atomic_flush)
+   exynos_crtc-ops-atomic_flush(exynos_crtc,
+   exynos_plane);
+   }
 }
 
 static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index a993aac..28afecc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -87,6 +87,8 @@ struct exynos_drm_plane {
  * @disable_vblank: specific driver callback for disabling vblank interrupt.
  * @wait_for_vblank: wait for vblank interrupt to make sure that
  * hardware overlay is updated.
+ * @atomic_begin: prepare a window to receive a update
+ * @atomic_flush: mark the end of a window update
  * @update_plane: apply hardware specific overlay data to registers.
  * @disable_plane: disable hardware specific overlay.
  * @te_handler: trigger to transfer video image at the tearing effect
@@ -107,10 +109,14 @@ struct exynos_drm_crtc_ops {
int (*enable_vblank)(struct exynos_drm_crtc *crtc);
void (*disable_vblank)(struct exynos_drm_crtc *crtc);
void (*wait_for_vblank)(struct exynos_drm_crtc *crtc);
+   void (*atomic_begin)(struct exynos_drm_crtc *crtc,
+ struct exynos_drm_plane *plane);
void (*update_plane)(struct exynos_drm_crtc *crtc,
 struct exynos_drm_plane *plane);
void (*disable_plane)(struct exynos_drm_crtc *crtc,
  struct exynos_drm_plane *plane);
+   void (*atomic_flush)(struct exynos_drm_crtc *crtc,
+ struct exynos_drm_plane *plane);
void (*te_handler)(struct exynos_drm_crtc *crtc);
void (*clock_enable)(struct exynos_drm_crtc *crtc, bool enable);
 };
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 00/11] drm/exynos: improve atomic modesetting

2015-08-26 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Hi,

This patchset adds a couple of changes to improve atomic modesetting:

 * add check for the START shadow register for FIMD to only finish the update
 when the screen was actually updated.
 * add asynchronous atomic commit, so now page flips can be run asynchronously.
 It also add infrastructure to serialize commits for the same CRTC and wait all
 plane updates to finish.
 * enable the DRIVER_ATOMIC feature to enable userspace to use atomic IOCTL with
 exynos.

v2: rename prepare_plane/cleanup_plane to atomic_begin/atomic_flush

Please review.

Gustavo

Gustavo Padovan (11):
  drm/exynos: don't track enabled state at exynos_crtc
  drm/exynos: fimd: unify call to exynos_drm_crtc_finish_pageflip()
  drm/exynos: add begin and flush phases for planes
  drm/exynos: fimd: move window protect code to atomic_begin/flush
  drm/exynos: check for pending fb before finish update
  drm/exynos: add macro to get the address of START_S reg
  drm/exynos: fimd: only finish update if START == START_S
  drm/exynos: add atomic asynchronous commit
  drm/exynos: wait all planes updates to finish
  drm/exynos: remove wait queue for pending page flip
  drm/exynos: Enable atomic modesetting feature

 drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  10 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c|  10 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  |  69 +--
 drivers/gpu/drm/exynos/exynos_drm_crtc.h  |   4 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c   | 158 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  24 +++-
 drivers/gpu/drm/exynos/exynos_drm_fb.c|  35 --
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  81 -
 drivers/gpu/drm/exynos/exynos_drm_plane.c |   2 +
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  10 +-
 drivers/gpu/drm/exynos/exynos_mixer.c |  10 +-
 include/video/samsung_fimd.h  |   1 +
 12 files changed, 309 insertions(+), 105 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 06/11] drm/exynos: add macro to get the address of START_S reg

2015-08-26 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

This macro is need to get the value of the START shadow register, that
will tell if an framebuffer is currently displayed on the screen or not.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 include/video/samsung_fimd.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/video/samsung_fimd.h b/include/video/samsung_fimd.h
index 0530e5a..d8fc96e 100644
--- a/include/video/samsung_fimd.h
+++ b/include/video/samsung_fimd.h
@@ -296,6 +296,7 @@
 
 /* Video buffer addresses */
 #define VIDW_BUF_START(_buff)  (0xA0 + ((_buff) * 8))
+#define VIDW_BUF_START_S(_buff)(0x40A0 + ((_buff) * 8))
 #define VIDW_BUF_START1(_buff) (0xA4 + ((_buff) * 8))
 #define VIDW_BUF_END(_buff)(0xD0 + ((_buff) * 8))
 #define VIDW_BUF_END1(_buff)   (0xD4 + ((_buff) * 8))
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] drm/exynos: fimd: move window protect code to prepare/atomic_flush

2015-08-26 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Only set/clear the update bit in the CRTC's .atomic_begin()/flush()
so all planes are really committed at the same time.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 57 +++-
 1 file changed, 34 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 30c1409..48d4fbe 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -591,6 +591,16 @@ static void fimd_shadow_protect_win(struct fimd_context 
*ctx,
 {
u32 reg, bits, val;
 
+   /*
+* SHADOWCON/PRTCON register is used for enabling timing.
+*
+* for example, once only width value of a register is set,
+* if the dma is started then fimd hardware could malfunction so
+* with protect window setting, the register fields with prefix '_F'
+* wouldn't be updated at vsync also but updated once unprotect window
+* is set.
+*/
+
if (ctx-driver_data-has_shadowcon) {
reg = SHADOWCON;
bits = SHADOWCON_WINx_PROTECT(win);
@@ -607,6 +617,28 @@ static void fimd_shadow_protect_win(struct fimd_context 
*ctx,
writel(val, ctx-regs + reg);
 }
 
+static void fimd_atomic_begin(struct exynos_drm_crtc *crtc,
+  struct exynos_drm_plane *plane)
+{
+   struct fimd_context *ctx = crtc-ctx;
+
+   if (ctx-suspended)
+   return;
+
+   fimd_shadow_protect_win(ctx, plane-zpos, true);
+}
+
+static void fimd_atomic_flush(struct exynos_drm_crtc *crtc,
+  struct exynos_drm_plane *plane)
+{
+   struct fimd_context *ctx = crtc-ctx;
+
+   if (ctx-suspended)
+   return;
+
+   fimd_shadow_protect_win(ctx, plane-zpos, false);
+}
+
 static void fimd_update_plane(struct exynos_drm_crtc *crtc,
  struct exynos_drm_plane *plane)
 {
@@ -622,20 +654,6 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc,
if (ctx-suspended)
return;
 
-   /*
-* SHADOWCON/PRTCON register is used for enabling timing.
-*
-* for example, once only width value of a register is set,
-* if the dma is started then fimd hardware could malfunction so
-* with protect window setting, the register fields with prefix '_F'
-* wouldn't be updated at vsync also but updated once unprotect window
-* is set.
-*/
-
-   /* protect windows */
-   fimd_shadow_protect_win(ctx, win, true);
-
-
offset = plane-src_x * bpp;
offset += plane-src_y * pitch;
 
@@ -707,9 +725,6 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc,
if (ctx-driver_data-has_shadowcon)
fimd_enable_shadow_channel_path(ctx, win, true);
 
-   /* Enable DMA channel and unprotect windows */
-   fimd_shadow_protect_win(ctx, win, false);
-
if (ctx-i80_if)
atomic_set(ctx-win_updated, 1);
 }
@@ -723,16 +738,10 @@ static void fimd_disable_plane(struct exynos_drm_crtc 
*crtc,
if (ctx-suspended)
return;
 
-   /* protect windows */
-   fimd_shadow_protect_win(ctx, win, true);
-
fimd_enable_video_output(ctx, win, false);
 
if (ctx-driver_data-has_shadowcon)
fimd_enable_shadow_channel_path(ctx, win, false);
-
-   /* unprotect windows */
-   fimd_shadow_protect_win(ctx, win, false);
 }
 
 static void fimd_enable(struct exynos_drm_crtc *crtc)
@@ -875,8 +884,10 @@ static const struct exynos_drm_crtc_ops fimd_crtc_ops = {
.enable_vblank = fimd_enable_vblank,
.disable_vblank = fimd_disable_vblank,
.wait_for_vblank = fimd_wait_for_vblank,
+   .atomic_begin = fimd_atomic_begin,
.update_plane = fimd_update_plane,
.disable_plane = fimd_disable_plane,
+   .atomic_flush = fimd_atomic_flush,
.te_handler = fimd_te_handler,
.clock_enable = fimd_dp_clock_enable,
 };
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 05/11] drm/exynos: check for pending fb before finish update

2015-08-26 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

The current code was ignoring the end of update for all overlay planes,
caring only for the primary plane update in case of pageflip.

This change adds a change to start to check for pending updates for all
planes through exynos_plane-pending_fb. At the start of plane update the
pending_fb is set with the fb to be shown on the screen. Then only when to
fb is already presented in the screen we set pending_fb to NULL to
signal that the update was finished.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk

fixup! drm/exynos: check for pending fb before finish update
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 10 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c| 10 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  |  7 ---
 drivers/gpu/drm/exynos/exynos_drm_crtc.h  |  3 ++-
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  1 +
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  | 10 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.c |  2 ++
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  | 10 +-
 drivers/gpu/drm/exynos/exynos_mixer.c | 10 +-
 9 files changed, 54 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 484e312..8d65e45 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -542,13 +542,21 @@ static irqreturn_t decon_lcd_sys_irq_handler(int irq, 
void *dev_id)
 {
struct decon_context *ctx = dev_id;
u32 val;
+   int win;
 
if (!test_bit(BIT_CLKS_ENABLED, ctx-enabled))
goto out;
 
val = readl(ctx-addr + DECON_VIDINTCON1);
if (val  VIDINTCON1_INTFRMDONEPEND) {
-   exynos_drm_crtc_finish_pageflip(ctx-crtc);
+   for (win = 0 ; win  WINDOWS_NR ; win++) {
+   struct exynos_drm_plane *plane = ctx-planes[win];
+
+   if (!plane-pending_fb)
+   continue;
+
+   exynos_drm_crtc_finish_update(ctx-crtc, plane);
+   }
 
/* clear */
writel(VIDINTCON1_INTFRMDONEPEND,
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 0792654..7651499 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -623,6 +623,7 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id)
 {
struct decon_context *ctx = (struct decon_context *)dev_id;
u32 val, clear_bit;
+   int win;
 
val = readl(ctx-regs + VIDINTCON1);
 
@@ -636,7 +637,14 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id)
 
if (!ctx-i80_if) {
drm_crtc_handle_vblank(ctx-crtc-base);
-   exynos_drm_crtc_finish_pageflip(ctx-crtc);
+   for (win = 0 ; win  WINDOWS_NR ; win++) {
+   struct exynos_drm_plane *plane = ctx-planes[win];
+
+   if (!plane-pending_fb)
+   continue;
+
+   exynos_drm_crtc_finish_update(ctx-crtc, plane);
+   }
 
/* set wait vsync event to zero and wake up queue. */
if (atomic_read(ctx-wait_vsync_event)) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 54485b7..582e041 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -197,18 +197,19 @@ void exynos_drm_crtc_disable_vblank(struct drm_device 
*dev, int pipe)
exynos_crtc-ops-disable_vblank(exynos_crtc);
 }
 
-void exynos_drm_crtc_finish_pageflip(struct exynos_drm_crtc *exynos_crtc)
+void exynos_drm_crtc_finish_update(struct exynos_drm_crtc *exynos_crtc,
+   struct exynos_drm_plane *exynos_plane)
 {
struct drm_crtc *crtc = exynos_crtc-base;
unsigned long flags;
 
+   exynos_plane-pending_fb = NULL;
+
spin_lock_irqsave(crtc-dev-event_lock, flags);
if (exynos_crtc-event) {
-
drm_crtc_send_vblank_event(crtc, exynos_crtc-event);
drm_crtc_vblank_put(crtc);
wake_up(exynos_crtc-pending_flip_queue);
-
}
 
exynos_crtc-event = NULL;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index 9e7027d..8bedfde 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -25,7 +25,8 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct 
drm_device *drm_dev,
void *context);
 int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe);
 void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe);
-void

[PATCH v2 01/11] drm/exynos: don't track enabled state at exynos_crtc

2015-08-26 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

struct drm_crtc already stores the enabled state of the crtc
thus we don't need to replicate enabled in exynos_drm_crtc.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 16 
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |  1 -
 2 files changed, 17 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index c478997..94eb831 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -25,14 +25,9 @@ static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
-   if (exynos_crtc-enabled)
-   return;
-
if (exynos_crtc-ops-enable)
exynos_crtc-ops-enable(exynos_crtc);
 
-   exynos_crtc-enabled = true;
-
drm_crtc_vblank_on(crtc);
 }
 
@@ -40,9 +35,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
-   if (!exynos_crtc-enabled)
-   return;
-
/* wait for the completion of page flip. */
if (!wait_event_timeout(exynos_crtc-pending_flip_queue,
(exynos_crtc-event == NULL), HZ/20))
@@ -52,8 +44,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 
if (exynos_crtc-ops-disable)
exynos_crtc-ops-disable(exynos_crtc);
-
-   exynos_crtc-enabled = false;
 }
 
 static bool
@@ -172,9 +162,6 @@ int exynos_drm_crtc_enable_vblank(struct drm_device *dev, 
int pipe)
struct exynos_drm_crtc *exynos_crtc =
to_exynos_crtc(private-crtc[pipe]);
 
-   if (!exynos_crtc-enabled)
-   return -EPERM;
-
if (exynos_crtc-ops-enable_vblank)
return exynos_crtc-ops-enable_vblank(exynos_crtc);
 
@@ -187,9 +174,6 @@ void exynos_drm_crtc_disable_vblank(struct drm_device *dev, 
int pipe)
struct exynos_drm_crtc *exynos_crtc =
to_exynos_crtc(private-crtc[pipe]);
 
-   if (!exynos_crtc-enabled)
-   return;
-
if (exynos_crtc-ops-disable_vblank)
exynos_crtc-ops-disable_vblank(exynos_crtc);
 }
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 6b8a30f..a993aac 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -136,7 +136,6 @@ struct exynos_drm_crtc {
struct drm_crtc base;
enum exynos_drm_output_type type;
unsigned intpipe;
-   boolenabled;
wait_queue_head_t   pending_flip_queue;
struct drm_pending_vblank_event *event;
const struct exynos_drm_crtc_ops*ops;
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] drm/exynos: add cursor plane support

2015-08-15 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Set one of the planes for each crtc driver as a cursor plane enabled
window managers to fully work on exynos.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  9 ++---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c|  8 ++--
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  3 +++
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  8 ++--
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 16 ++--
 drivers/gpu/drm/exynos/exynos_drm_plane.h |  3 +--
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  9 ++---
 drivers/gpu/drm/exynos/exynos_mixer.c | 10 +++---
 8 files changed, 29 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 8d65e45..fdc04d0 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -33,7 +33,6 @@ struct decon_context {
struct exynos_drm_plane planes[WINDOWS_NR];
void __iomem*addr;
struct clk  *clks[6];
-   unsigned intdefault_win;
unsigned long   irq_flags;
int pipe;
boolsuspended;
@@ -466,7 +465,6 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
struct drm_device *drm_dev = data;
struct exynos_drm_private *priv = drm_dev-dev_private;
struct exynos_drm_plane *exynos_plane;
-   enum drm_plane_type type;
unsigned int zpos;
int ret;
 
@@ -474,15 +472,13 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
ctx-pipe = priv-pipe++;
 
for (zpos = 0; zpos  WINDOWS_NR; zpos++) {
-   type = (zpos == ctx-default_win) ? DRM_PLANE_TYPE_PRIMARY :
-   DRM_PLANE_TYPE_OVERLAY;
ret = exynos_plane_init(drm_dev, ctx-planes[zpos],
-   1  ctx-pipe, type, zpos);
+   1  ctx-pipe, zpos);
if (ret)
return ret;
}
 
-   exynos_plane = ctx-planes[ctx-default_win];
+   exynos_plane = ctx-planes[DEFAULT_WIN];
ctx-crtc = exynos_drm_crtc_create(drm_dev, exynos_plane-base,
ctx-pipe, EXYNOS_DISPLAY_TYPE_LCD,
decon_crtc_ops, ctx);
@@ -579,7 +575,6 @@ static int exynos5433_decon_probe(struct platform_device 
*pdev)
if (!ctx)
return -ENOMEM;
 
-   ctx-default_win = 0;
ctx-suspended = true;
ctx-dev = dev;
if (of_get_child_by_name(dev-of_node, i80-if-timings))
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 7651499..569a666 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -52,7 +52,6 @@ struct decon_context {
struct clk  *eclk;
struct clk  *vclk;
void __iomem*regs;
-   unsigned intdefault_win;
unsigned long   irq_flags;
booli80_if;
boolsuspended;
@@ -661,7 +660,6 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
struct decon_context *ctx = dev_get_drvdata(dev);
struct drm_device *drm_dev = data;
struct exynos_drm_plane *exynos_plane;
-   enum drm_plane_type type;
unsigned int zpos;
int ret;
 
@@ -672,15 +670,13 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
}
 
for (zpos = 0; zpos  WINDOWS_NR; zpos++) {
-   type = (zpos == ctx-default_win) ? DRM_PLANE_TYPE_PRIMARY :
-   DRM_PLANE_TYPE_OVERLAY;
ret = exynos_plane_init(drm_dev, ctx-planes[zpos],
-   1  ctx-pipe, type, zpos);
+   1  ctx-pipe, zpos);
if (ret)
return ret;
}
 
-   exynos_plane = ctx-planes[ctx-default_win];
+   exynos_plane = ctx-planes[DEFAULT_WIN];
ctx-crtc = exynos_drm_crtc_create(drm_dev, exynos_plane-base,
   ctx-pipe, EXYNOS_DISPLAY_TYPE_LCD,
   decon_crtc_ops, ctx);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 5d052235..1631024 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -22,6 +22,9

[PATCH -v3 11/11] drm/exynos: remove struct exynos_drm_encoder layer

2015-08-15 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

struct exynos_drm_encoder was justing wrapping struct drm_encoder, it had
only a drm_encoder member and the internal exynos_drm_encoders ops that
was directly mapped to the drm_encoder helper funcs.

So now exynos DRM uses struct drm_encoder directly, this removes
completely the struct exynos_drm_encoder.

v2: add empty .mode_fixup() and .mode_set() to DSI and DPI to avoid null
pointer.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/Makefile |   7 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c  |   2 +-
 drivers/gpu/drm/exynos/exynos_dp_core.c |  68 --
 drivers/gpu/drm/exynos/exynos_dp_core.h |   2 +-
 drivers/gpu/drm/exynos/exynos_drm_core.c|   1 -
 drivers/gpu/drm/exynos/exynos_drm_crtc.c|   1 -
 drivers/gpu/drm/exynos/exynos_drm_dpi.c |  66 +++--
 drivers/gpu/drm/exynos/exynos_drm_drv.c |   1 -
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  47 ++---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |  88 +--
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 105 
 drivers/gpu/drm/exynos/exynos_drm_encoder.h |  22 --
 drivers/gpu/drm/exynos/exynos_drm_fimd.c|   2 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c|  71 ++-
 drivers/gpu/drm/exynos/exynos_hdmi.c|  85 +-
 15 files changed, 259 insertions(+), 309 deletions(-)
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.c
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.h

diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile
index 7de0b10..61c2906 100644
--- a/drivers/gpu/drm/exynos/Makefile
+++ b/drivers/gpu/drm/exynos/Makefile
@@ -3,10 +3,9 @@
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
 ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/exynos
-exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o \
-   exynos_drm_crtc.o exynos_drm_fbdev.o exynos_drm_fb.o \
-   exynos_drm_buf.o exynos_drm_gem.o exynos_drm_core.o \
-   exynos_drm_plane.o exynos_drm_dmabuf.o
+exynosdrm-y := exynos_drm_drv.o exynos_drm_crtc.o exynos_drm_fbdev.o \
+   exynos_drm_fb.o exynos_drm_buf.o exynos_drm_gem.o \
+   exynos_drm_core.o exynos_drm_plane.o exynos_drm_dmabuf.o
 
 exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD)+= exynos_drm_fimd.o
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index e1a2ce7..0792654 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -61,7 +61,7 @@ struct decon_context {
atomic_twait_vsync_event;
 
struct exynos_drm_panel_info panel;
-   struct exynos_drm_encoder *encoder;
+   struct drm_encoder *encoder;
 };
 
 static const struct of_device_id decon_driver_dt_match[] = {
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 67c5cd1..d66ade0 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -32,18 +32,18 @@
 #include drm/drm_panel.h
 
 #include exynos_dp_core.h
-#include exynos_drm_encoder.h
+#include exynos_drm_crtc.h
 
 #define ctx_from_connector(c)  container_of(c, struct exynos_dp_device, \
connector)
 
 static inline struct exynos_drm_crtc *dp_to_crtc(struct exynos_dp_device *dp)
 {
-   return to_exynos_crtc(dp-encoder.base.crtc);
+   return to_exynos_crtc(dp-encoder.crtc);
 }
 
 static inline struct exynos_dp_device *encoder_to_dp(
-   struct exynos_drm_encoder *e)
+   struct drm_encoder *e)
 {
return container_of(e, struct exynos_dp_device, encoder);
 }
@@ -889,7 +889,7 @@ static void exynos_dp_hotplug(struct work_struct *work)
drm_helper_hpd_irq_event(dp-drm_dev);
 }
 
-static void exynos_dp_commit(struct exynos_drm_encoder *encoder)
+static void exynos_dp_commit(struct drm_encoder *encoder)
 {
struct exynos_dp_device *dp = encoder_to_dp(encoder);
int ret;
@@ -995,7 +995,7 @@ static struct drm_encoder *exynos_dp_best_encoder(
 {
struct exynos_dp_device *dp = ctx_from_connector(connector);
 
-   return dp-encoder.base;
+   return dp-encoder;
 }
 
 static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = {
@@ -1020,10 +1020,9 @@ static int exynos_drm_attach_lcd_bridge(struct 
exynos_dp_device *dp,
return 0;
 }
 
-static int exynos_dp_create_connector(struct exynos_drm_encoder 
*exynos_encoder)
+static int exynos_dp_create_connector(struct drm_encoder *encoder)
 {
-   struct exynos_dp_device *dp = encoder_to_dp(exynos_encoder

Re: [PATCH v2 11/11] drm/exynos: remove struct exynos_drm_encoder layer

2015-08-15 Thread Gustavo Padovan
Hi Inki,

2015-08-15 Inki Dae inki@samsung.com:

 2015-08-13 0:54 GMT+09:00 Gustavo Padovan gust...@padovan.org:
  2015-08-12 Gustavo Padovan gustavo.pado...@collabora.co.uk:
 
  Hi Inki,
 
  2015-08-11 Inki Dae inki@samsung.com:
 
   On 2015년 08월 11일 09:38, Gustavo Padovan wrote:
Hi Inki,
   
2015-08-07 Inki Dae inki@samsung.com:
   
Hi Gustavo,
   
On 2015년 08월 06일 22:31, Gustavo Padovan wrote:
From: Gustavo Padovan gustavo.pado...@collabora.co.uk
   
struct exynos_drm_encoder was justing wrapping struct drm_encoder, 
it had
only a drm_encoder member and the internal exynos_drm_encoders ops 
that
was directly mapped to the drm_encoder helper funcs.
   
So now exynos DRM uses struct drm_encoder directly, this removes
completely the struct exynos_drm_encoder.
   
   
Trats2 board, which uses Exynos4412 Soc, doesn't work after this patch
is applied. Below is the booting logs,
[1.171318] console [ttySAC2] enabled
[1.175522] 1383.serial: ttySAC3 at MMIO 0x1383 (irq = 60,
base_baud = 0) is a S3C6400/10
[1.185545] [drm] Initialized drm 1.1.0 20060810
[1.194104] exynos-drm exynos-drm: bound 11c0.fimd (ops
fimd_component_ops)
[1.200352] exynos-drm exynos-drm: bound 11c8.dsi (ops
exynos_dsi_component_ops)
[1.207688] [drm] Supports vblank timestamp caching Rev 2 
(21.10.2013).
[1.214313] [drm] No driver support for vblank timestamp query.
[1.220218] [drm] Initialized exynos 1.0.0 20110530 on minor 0
   
Booting is locked up here. This patch looks good to me so I tried to
find why locked up and I found the booting is locked up as soon as
console_lock function is called. Can you and other guys look into this
issue?
   
I've realized that I left a fix for patch 01 behind, it could be the
cause of this issue. I've just resent this patch with the added v2 fix
up.
  
   With above change, still locked up. So your updated patch doesn't
   resolve this issue.
  
   Anyway, I tested it with fbdev emulation relevant patch series[1] and
   the booting was ok with disabling fbdev emulation as Daniel commented.
   However, I think the booting should also be ok with fbdev emulation so I
   don't want for your last patch to be merged to mainline until the issue
   is resolved.
 
  I've tried to reproduce your issue with these patches on a odroid-x2
  (exynos4412) but it seems to work fine for me with fbdev emulation
  enabled. In snow and peach-pi it also works fine. We would need
  to debug better on your side to figure out what is breaking for you.
 
  Can you please git bisect this? So we can figure out which commit is
  causing the issue. That would be great.
 
 I already commented above, your last patch - 11/11. Without 11/11, it
 worked well. Did you test odroid-x2 with LVDS based Display panel? If
 so, it's not different because I tested it with Trats2 board with
 MIPI-DSI + Display panel. AFAIK, Odroid-x2 board doesn't support
 MIPI-DSI panel. I will have a pull request soon without 11/11. After
 that, I think we could find and resolve the issue later.

Ah, I thougth your talking about whole patchset! I think I figured out
what was happend the .mode_fixup() and .mode_set() helpers for the DSI
drm_encoder was not set and leading to a null pointer at some pointer.
That is problably what you were experiencing. Could you please try the
new version of patch 11/11 that I've just sent to the mailing list?
And thanks for merging these patches!

Gustavo
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/11] drm/exynos: check for pending fb before finish update

2015-08-15 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

The current code was ignoring the end of update for all overlay planes,
caring only for the primary plane update in case of pageflip.

This change adds a change to start to check for pending updates for all
planes through exynos_plane-pending_fb. At the start of plane update the
pending_fb is set with the fb to be shown on the screen. Then only when to
fb is already presented in the screen we set pending_fb to NULL to
signal that the update was finished.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk

fixup! drm/exynos: check for pending fb before finish update
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 10 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c| 10 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  |  7 ---
 drivers/gpu/drm/exynos/exynos_drm_crtc.h  |  3 ++-
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  1 +
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  | 10 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.c |  2 ++
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  | 10 +-
 drivers/gpu/drm/exynos/exynos_mixer.c | 10 +-
 9 files changed, 54 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 484e312..8d65e45 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -542,13 +542,21 @@ static irqreturn_t decon_lcd_sys_irq_handler(int irq, 
void *dev_id)
 {
struct decon_context *ctx = dev_id;
u32 val;
+   int win;
 
if (!test_bit(BIT_CLKS_ENABLED, ctx-enabled))
goto out;
 
val = readl(ctx-addr + DECON_VIDINTCON1);
if (val  VIDINTCON1_INTFRMDONEPEND) {
-   exynos_drm_crtc_finish_pageflip(ctx-crtc);
+   for (win = 0 ; win  WINDOWS_NR ; win++) {
+   struct exynos_drm_plane *plane = ctx-planes[win];
+
+   if (!plane-pending_fb)
+   continue;
+
+   exynos_drm_crtc_finish_update(ctx-crtc, plane);
+   }
 
/* clear */
writel(VIDINTCON1_INTFRMDONEPEND,
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 0792654..7651499 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -623,6 +623,7 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id)
 {
struct decon_context *ctx = (struct decon_context *)dev_id;
u32 val, clear_bit;
+   int win;
 
val = readl(ctx-regs + VIDINTCON1);
 
@@ -636,7 +637,14 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id)
 
if (!ctx-i80_if) {
drm_crtc_handle_vblank(ctx-crtc-base);
-   exynos_drm_crtc_finish_pageflip(ctx-crtc);
+   for (win = 0 ; win  WINDOWS_NR ; win++) {
+   struct exynos_drm_plane *plane = ctx-planes[win];
+
+   if (!plane-pending_fb)
+   continue;
+
+   exynos_drm_crtc_finish_update(ctx-crtc, plane);
+   }
 
/* set wait vsync event to zero and wake up queue. */
if (atomic_read(ctx-wait_vsync_event)) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 3a89fc9..7a2ad3e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -195,18 +195,19 @@ void exynos_drm_crtc_disable_vblank(struct drm_device 
*dev, int pipe)
exynos_crtc-ops-disable_vblank(exynos_crtc);
 }
 
-void exynos_drm_crtc_finish_pageflip(struct exynos_drm_crtc *exynos_crtc)
+void exynos_drm_crtc_finish_update(struct exynos_drm_crtc *exynos_crtc,
+   struct exynos_drm_plane *exynos_plane)
 {
struct drm_crtc *crtc = exynos_crtc-base;
unsigned long flags;
 
+   exynos_plane-pending_fb = NULL;
+
spin_lock_irqsave(crtc-dev-event_lock, flags);
if (exynos_crtc-event) {
-
drm_crtc_send_vblank_event(crtc, exynos_crtc-event);
drm_crtc_vblank_put(crtc);
wake_up(exynos_crtc-pending_flip_queue);
-
}
 
exynos_crtc-event = NULL;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index 9e7027d..8bedfde 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -25,7 +25,8 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct 
drm_device *drm_dev,
void *context);
 int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe);
 void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe);
-void

[PATCH 01/11] drm/exynos: don't track enabled state at exynos_crtc

2015-08-15 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

struct drm_crtc already stores the enabled state of the crtc
thus we don't need to replicate enabled in exynos_drm_crtc.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 16 
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |  1 -
 2 files changed, 17 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index b9b0e9c..5a19e16 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -25,14 +25,9 @@ static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
-   if (exynos_crtc-enabled)
-   return;
-
if (exynos_crtc-ops-enable)
exynos_crtc-ops-enable(exynos_crtc);
 
-   exynos_crtc-enabled = true;
-
drm_crtc_vblank_on(crtc);
 }
 
@@ -40,9 +35,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
-   if (!exynos_crtc-enabled)
-   return;
-
/* wait for the completion of page flip. */
if (!wait_event_timeout(exynos_crtc-pending_flip_queue,
(exynos_crtc-event == NULL), HZ/20))
@@ -52,8 +44,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 
if (exynos_crtc-ops-disable)
exynos_crtc-ops-disable(exynos_crtc);
-
-   exynos_crtc-enabled = false;
 }
 
 static bool
@@ -170,9 +160,6 @@ int exynos_drm_crtc_enable_vblank(struct drm_device *dev, 
int pipe)
struct exynos_drm_crtc *exynos_crtc =
to_exynos_crtc(private-crtc[pipe]);
 
-   if (!exynos_crtc-enabled)
-   return -EPERM;
-
if (exynos_crtc-ops-enable_vblank)
return exynos_crtc-ops-enable_vblank(exynos_crtc);
 
@@ -185,9 +172,6 @@ void exynos_drm_crtc_disable_vblank(struct drm_device *dev, 
int pipe)
struct exynos_drm_crtc *exynos_crtc =
to_exynos_crtc(private-crtc[pipe]);
 
-   if (!exynos_crtc-enabled)
-   return;
-
if (exynos_crtc-ops-disable_vblank)
exynos_crtc-ops-disable_vblank(exynos_crtc);
 }
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 6b8a30f..a993aac 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -136,7 +136,6 @@ struct exynos_drm_crtc {
struct drm_crtc base;
enum exynos_drm_output_type type;
unsigned intpipe;
-   boolenabled;
wait_queue_head_t   pending_flip_queue;
struct drm_pending_vblank_event *event;
const struct exynos_drm_crtc_ops*ops;
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/11] drm/exynos: wait all planes updates to finish

2015-08-15 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Add infrastructure to wait for all planes updates to finish by using
an atomic_t variable to track how many pending updates we are waiting
plus a wait_queue for the wait part.

It also changes vblank behaviour and keeps it enabled for all types
of updates

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 18 +
 drivers/gpu/drm/exynos/exynos_drm_crtc.h |  1 +
 drivers/gpu/drm/exynos/exynos_drm_drv.c  | 44 +++-
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |  4 +++
 4 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 7a2ad3e..049ab67 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -74,10 +74,7 @@ static void exynos_crtc_atomic_begin(struct drm_crtc *crtc)
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
struct drm_plane *plane;
 
-   if (crtc-state-event) {
-   WARN_ON(drm_crtc_vblank_get(crtc) != 0);
-   exynos_crtc-event = crtc-state-event;
-   }
+   exynos_crtc-event = crtc-state-event;
 
drm_atomic_crtc_for_each_plane(plane, crtc) {
struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
@@ -154,6 +151,8 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct 
drm_device *drm_dev,
exynos_crtc-ops = ops;
exynos_crtc-ctx = ctx;
 
+   init_waitqueue_head(exynos_crtc-wait_update);
+
crtc = exynos_crtc-base;
 
private-crtc[pipe] = crtc;
@@ -195,6 +194,13 @@ void exynos_drm_crtc_disable_vblank(struct drm_device 
*dev, int pipe)
exynos_crtc-ops-disable_vblank(exynos_crtc);
 }
 
+void exynos_drm_crtc_wait_pending_update(struct exynos_drm_crtc *exynos_crtc)
+{
+   wait_event_timeout(exynos_crtc-wait_update,
+  (atomic_read(exynos_crtc-pending_update) == 0),
+  msecs_to_jiffies(50));
+}
+
 void exynos_drm_crtc_finish_update(struct exynos_drm_crtc *exynos_crtc,
struct exynos_drm_plane *exynos_plane)
 {
@@ -203,10 +209,12 @@ void exynos_drm_crtc_finish_update(struct exynos_drm_crtc 
*exynos_crtc,
 
exynos_plane-pending_fb = NULL;
 
+   if (atomic_dec_and_test(exynos_crtc-pending_update))
+   wake_up(exynos_crtc-wait_update);
+
spin_lock_irqsave(crtc-dev-event_lock, flags);
if (exynos_crtc-event) {
drm_crtc_send_vblank_event(crtc, exynos_crtc-event);
-   drm_crtc_vblank_put(crtc);
wake_up(exynos_crtc-pending_flip_queue);
}
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index 8bedfde..f87d4ab 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -25,6 +25,7 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct 
drm_device *drm_dev,
void *context);
 int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe);
 void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe);
+void exynos_drm_crtc_wait_pending_update(struct exynos_drm_crtc *exynos_crtc);
 void exynos_drm_crtc_finish_update(struct exynos_drm_crtc *exynos_crtc,
   struct exynos_drm_plane *exynos_plane);
 void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index a4937b5..241453f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -46,11 +46,37 @@ struct exynos_atomic_commit {
u32 crtcs;
 };
 
+static void exynos_atomic_wait_for_commit(struct drm_atomic_state *state)
+{
+   struct drm_crtc_state *crtc_state;
+   struct drm_crtc *crtc;
+   int i, ret;
+
+   for_each_crtc_in_state(state, crtc, crtc_state, i) {
+   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+
+   if (!crtc-state-enable)
+   continue;
+
+   ret = drm_crtc_vblank_get(crtc);
+   if (ret)
+   continue;
+
+   exynos_drm_crtc_wait_pending_update(exynos_crtc);
+   drm_crtc_vblank_put(crtc);
+   }
+}
+
 static void exynos_atomic_commit_complete(struct exynos_atomic_commit *commit)
 {
struct drm_device *dev = commit-dev;
struct exynos_drm_private *priv = dev-dev_private;
struct drm_atomic_state *state = commit-state;
+   struct drm_plane *plane;
+   struct drm_crtc *crtc;
+   struct drm_plane_state *plane_state;
+   struct drm_crtc_state *crtc_state;
+   int i;
 
drm_atomic_helper_commit_modeset_disables(dev

[PATCH 04/11] drm/exynos: fimd: move window protect code to prepare/cleanup_plane

2015-08-15 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Only set/clear the update bit in the CRTC's .atomic_begin()/flush()
so all planes are really committed at the same time.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 57 +++-
 1 file changed, 34 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 30c1409..48d4fbe 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -591,6 +591,16 @@ static void fimd_shadow_protect_win(struct fimd_context 
*ctx,
 {
u32 reg, bits, val;
 
+   /*
+* SHADOWCON/PRTCON register is used for enabling timing.
+*
+* for example, once only width value of a register is set,
+* if the dma is started then fimd hardware could malfunction so
+* with protect window setting, the register fields with prefix '_F'
+* wouldn't be updated at vsync also but updated once unprotect window
+* is set.
+*/
+
if (ctx-driver_data-has_shadowcon) {
reg = SHADOWCON;
bits = SHADOWCON_WINx_PROTECT(win);
@@ -607,6 +617,28 @@ static void fimd_shadow_protect_win(struct fimd_context 
*ctx,
writel(val, ctx-regs + reg);
 }
 
+static void fimd_prepare_plane(struct exynos_drm_crtc *crtc,
+  struct exynos_drm_plane *plane)
+{
+   struct fimd_context *ctx = crtc-ctx;
+
+   if (ctx-suspended)
+   return;
+
+   fimd_shadow_protect_win(ctx, plane-zpos, true);
+}
+
+static void fimd_cleanup_plane(struct exynos_drm_crtc *crtc,
+  struct exynos_drm_plane *plane)
+{
+   struct fimd_context *ctx = crtc-ctx;
+
+   if (ctx-suspended)
+   return;
+
+   fimd_shadow_protect_win(ctx, plane-zpos, false);
+}
+
 static void fimd_update_plane(struct exynos_drm_crtc *crtc,
  struct exynos_drm_plane *plane)
 {
@@ -622,20 +654,6 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc,
if (ctx-suspended)
return;
 
-   /*
-* SHADOWCON/PRTCON register is used for enabling timing.
-*
-* for example, once only width value of a register is set,
-* if the dma is started then fimd hardware could malfunction so
-* with protect window setting, the register fields with prefix '_F'
-* wouldn't be updated at vsync also but updated once unprotect window
-* is set.
-*/
-
-   /* protect windows */
-   fimd_shadow_protect_win(ctx, win, true);
-
-
offset = plane-src_x * bpp;
offset += plane-src_y * pitch;
 
@@ -707,9 +725,6 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc,
if (ctx-driver_data-has_shadowcon)
fimd_enable_shadow_channel_path(ctx, win, true);
 
-   /* Enable DMA channel and unprotect windows */
-   fimd_shadow_protect_win(ctx, win, false);
-
if (ctx-i80_if)
atomic_set(ctx-win_updated, 1);
 }
@@ -723,16 +738,10 @@ static void fimd_disable_plane(struct exynos_drm_crtc 
*crtc,
if (ctx-suspended)
return;
 
-   /* protect windows */
-   fimd_shadow_protect_win(ctx, win, true);
-
fimd_enable_video_output(ctx, win, false);
 
if (ctx-driver_data-has_shadowcon)
fimd_enable_shadow_channel_path(ctx, win, false);
-
-   /* unprotect windows */
-   fimd_shadow_protect_win(ctx, win, false);
 }
 
 static void fimd_enable(struct exynos_drm_crtc *crtc)
@@ -875,8 +884,10 @@ static const struct exynos_drm_crtc_ops fimd_crtc_ops = {
.enable_vblank = fimd_enable_vblank,
.disable_vblank = fimd_disable_vblank,
.wait_for_vblank = fimd_wait_for_vblank,
+   .prepare_plane = fimd_prepare_plane,
.update_plane = fimd_update_plane,
.disable_plane = fimd_disable_plane,
+   .cleanup_plane = fimd_cleanup_plane,
.te_handler = fimd_te_handler,
.clock_enable = fimd_dp_clock_enable,
 };
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/11] drm/exynos: Enable atomic modesetting feature

2015-08-15 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Now that atomic modesetting is implemented for exynos enable the
DRIVER_ATOMIC flag on the driver's features.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 241453f..0ebe04f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -439,7 +439,8 @@ static const struct file_operations exynos_drm_driver_fops 
= {
 };
 
 static struct drm_driver exynos_drm_driver = {
-   .driver_features= DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME,
+   .driver_features= DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME
+ | DRIVER_ATOMIC,
.load   = exynos_drm_load,
.unload = exynos_drm_unload,
.open   = exynos_drm_open,
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/11] drm/exynos: add atomic asynchronous commit

2015-08-15 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

The atomic modesetting interfaces supports async commits that should be
implemented by the drivers. If drm core requests an async commit
exynos_atomic_commit() will now schedule a work task to run the update later.

It also serializes commits that needs to run on the same crtc, putting the
following commit to wait until the current one is finished.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 113 
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  11 
 drivers/gpu/drm/exynos/exynos_drm_fb.c  |  35 --
 3 files changed, 124 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index e8db234..a4937b5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -13,6 +13,8 @@
 
 #include linux/pm_runtime.h
 #include drm/drmP.h
+#include drm/drm_atomic.h
+#include drm/drm_atomic_helper.h
 #include drm/drm_crtc_helper.h
 
 #include linux/component.h
@@ -37,6 +39,56 @@
 #define DRIVER_MAJOR   1
 #define DRIVER_MINOR   0
 
+struct exynos_atomic_commit {
+   struct work_struct  work;
+   struct drm_device   *dev;
+   struct drm_atomic_state *state;
+   u32 crtcs;
+};
+
+static void exynos_atomic_commit_complete(struct exynos_atomic_commit *commit)
+{
+   struct drm_device *dev = commit-dev;
+   struct exynos_drm_private *priv = dev-dev_private;
+   struct drm_atomic_state *state = commit-state;
+
+   drm_atomic_helper_commit_modeset_disables(dev, state);
+
+   drm_atomic_helper_commit_modeset_enables(dev, state);
+
+   /*
+* Exynos can't update planes with CRTCs and encoders disabled,
+* its updates routines, specially for FIMD, requires the clocks
+* to be enabled. So it is necessary to handle the modeset operations
+* *before* the commit_planes() step, this way it will always
+* have the relevant clocks enabled to perform the update.
+*/
+
+   drm_atomic_helper_commit_planes(dev, state);
+
+   drm_atomic_helper_wait_for_vblanks(dev, state);
+
+   drm_atomic_helper_cleanup_planes(dev, state);
+
+   drm_atomic_state_free(state);
+
+   spin_lock(priv-lock);
+   priv-pending = ~commit-crtcs;
+   spin_unlock(priv-lock);
+
+   wake_up_all(priv-wait);
+
+   kfree(commit);
+}
+
+static void exynos_drm_atomic_work(struct work_struct *work)
+{
+   struct exynos_atomic_commit *commit = container_of(work,
+   struct exynos_atomic_commit, work);
+
+   exynos_atomic_commit_complete(commit);
+}
+
 static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
 {
struct exynos_drm_private *private;
@@ -48,6 +100,9 @@ static int exynos_drm_load(struct drm_device *dev, unsigned 
long flags)
if (!private)
return -ENOMEM;
 
+   init_waitqueue_head(private-wait);
+   spin_lock_init(private-lock);
+
dev_set_drvdata(dev-dev, dev);
dev-dev_private = (void *)private;
 
@@ -150,6 +205,64 @@ static int exynos_drm_unload(struct drm_device *dev)
return 0;
 }
 
+static int commit_is_pending(struct exynos_drm_private *priv, u32 crtcs)
+{
+   bool pending;
+
+   spin_lock(priv-lock);
+   pending = priv-pending  crtcs;
+   spin_unlock(priv-lock);
+
+   return pending;
+}
+
+int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state 
*state,
+bool async)
+{
+   struct exynos_drm_private *priv = dev-dev_private;
+   struct exynos_atomic_commit *commit;
+   int i, ret;
+
+   commit = kzalloc(sizeof(*commit), GFP_KERNEL);
+   if (!commit)
+   return -ENOMEM;
+
+   ret = drm_atomic_helper_prepare_planes(dev, state);
+   if (ret) {
+   kfree(commit);
+   return ret;
+   }
+
+   /* This is the point of no return */
+
+   INIT_WORK(commit-work, exynos_drm_atomic_work);
+   commit-dev = dev;
+   commit-state = state;
+
+   /* Wait until all affected CRTCs have completed previous commits and
+* mark them as pending.
+*/
+   for (i = 0; i  dev-mode_config.num_crtc; ++i) {
+   if (state-crtcs[i])
+   commit-crtcs |= 1  drm_crtc_index(state-crtcs[i]);
+   }
+
+   wait_event(priv-wait, !commit_is_pending(priv, commit-crtcs));
+
+   spin_lock(priv-lock);
+   priv-pending |= commit-crtcs;
+   spin_unlock(priv-lock);
+
+   drm_atomic_helper_swap_state(dev, state);
+
+   if (async)
+   schedule_work(commit-work);
+   else
+   exynos_atomic_commit_complete(commit);
+
+   return 0;
+}
+
 static int exynos_drm_suspend(struct drm_device *dev, pm_message_t state)
 {
struct

[PATCH 10/11] drm/exynos: remove wait queue for pending page flip

2015-08-15 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Exynos atomic commit procedures already does this job of waiting for
pending updates to finish, that means using pending_flip_queue is
pointless now because the disable CRTC procedure will never happen
during a page_flip.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 11 +--
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |  1 -
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 049ab67..44bb30e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -35,11 +35,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
-   /* wait for the completion of page flip. */
-   if (!wait_event_timeout(exynos_crtc-pending_flip_queue,
-   (exynos_crtc-event == NULL), HZ/20))
-   exynos_crtc-event = NULL;
-
drm_crtc_vblank_off(crtc);
 
if (exynos_crtc-ops-disable)
@@ -144,8 +139,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct 
drm_device *drm_dev,
if (!exynos_crtc)
return ERR_PTR(-ENOMEM);
 
-   init_waitqueue_head(exynos_crtc-pending_flip_queue);
-
exynos_crtc-pipe = pipe;
exynos_crtc-type = type;
exynos_crtc-ops = ops;
@@ -213,10 +206,8 @@ void exynos_drm_crtc_finish_update(struct exynos_drm_crtc 
*exynos_crtc,
wake_up(exynos_crtc-wait_update);
 
spin_lock_irqsave(crtc-dev-event_lock, flags);
-   if (exynos_crtc-event) {
+   if (exynos_crtc-event)
drm_crtc_send_vblank_event(crtc, exynos_crtc-event);
-   wake_up(exynos_crtc-pending_flip_queue);
-   }
 
exynos_crtc-event = NULL;
spin_unlock_irqrestore(crtc-dev-event_lock, flags);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index d77dca4..5d052235 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -145,7 +145,6 @@ struct exynos_drm_crtc {
struct drm_crtc base;
enum exynos_drm_output_type type;
unsigned intpipe;
-   wait_queue_head_t   pending_flip_queue;
struct drm_pending_vblank_event *event;
wait_queue_head_t   wait_update;
atomic_tpending_update;
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/11] drm/exynos: fimd: only finish update if START == START_S

2015-08-15 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

fimd_update_plane() programs BUF_START[win] and during the update
BUF_START[win] is copied to BUF_START_S[win] (its shadow register)
and starts scanning out, then it raises a irq.

The fimd_irq_handler, in the case we have a pending_fb, will check
the fb value was copied to START_S register and finish the update
in case of success.

Based on patch from Daniel Kurtz djku...@chromium.org

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index d41aa6a..c87b791 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -59,6 +59,7 @@
 #define VIDWnALPHA1(win)   (VIDW_ALPHA + 0x04 + (win) * 8)
 
 #define VIDWx_BUF_START(win, buf)  (VIDW_BUF_START(buf) + (win) * 8)
+#define VIDWx_BUF_START_S(win, buf)(VIDW_BUF_START_S(buf) + (win) * 8)
 #define VIDWx_BUF_END(win, buf)(VIDW_BUF_END(buf) + (win) * 8)
 #define VIDWx_BUF_SIZE(win, buf)   (VIDW_BUF_SIZE(buf) + (win) * 4)
 
@@ -895,7 +896,7 @@ static const struct exynos_drm_crtc_ops fimd_crtc_ops = {
 static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
 {
struct fimd_context *ctx = (struct fimd_context *)dev_id;
-   u32 val, clear_bit;
+   u32 val, clear_bit, start, start_s;
int win;
 
val = readl(ctx-regs + VIDINTCON1);
@@ -917,7 +918,10 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
if (!plane-pending_fb)
continue;
 
-   exynos_drm_crtc_finish_update(ctx-crtc, plane);
+   start = readl(ctx-regs + VIDWx_BUF_START(win, 0));
+   start_s = readl(ctx-regs + VIDWx_BUF_START_S(win, 0));
+   if (start == start_s)
+   exynos_drm_crtc_finish_update(ctx-crtc, plane);
}
 
if (ctx-i80_if) {
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/11] drm/exynos: add macro to get the address of START_S reg

2015-08-15 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

This macro is need to get the value of the START shadow register, that
will tell if an framebuffer is currently displayed on the screen or not.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 include/video/samsung_fimd.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/video/samsung_fimd.h b/include/video/samsung_fimd.h
index 0530e5a..d8fc96e 100644
--- a/include/video/samsung_fimd.h
+++ b/include/video/samsung_fimd.h
@@ -296,6 +296,7 @@
 
 /* Video buffer addresses */
 #define VIDW_BUF_START(_buff)  (0xA0 + ((_buff) * 8))
+#define VIDW_BUF_START_S(_buff)(0x40A0 + ((_buff) * 8))
 #define VIDW_BUF_START1(_buff) (0xA4 + ((_buff) * 8))
 #define VIDW_BUF_END(_buff)(0xD0 + ((_buff) * 8))
 #define VIDW_BUF_END1(_buff)   (0xD4 + ((_buff) * 8))
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/11] drm/exynos: improve atomic modesetting

2015-08-15 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Hi,

This patchset adds a couple of changes to improve atomic modesetting:

 * add check for the START shadow register for FIMD to only finish the update
 when the screen was actually updated.
 * add asynchronous atomic commit, so now page flips can be run asynchronously.
 It also add infrastructure to serialize commits for the same CRTC and wait all
 plane updates to finish.
 * enable the DRIVER_ATOMIC feature to enable userspace to use atomic IOCTL with
 exynos.

Please review.

Gustavo

---
Gustavo Padovan (11):
  drm/exynos: don't track enabled state at exynos_crtc
  drm/exynos: fimd: unify call to exynos_drm_crtc_finish_pageflip()
  drm/exynos: add prepare and cleanup phases for planes
  drm/exynos: fimd: move window protect code to prepare/cleanup_plane
  drm/exynos: check for pending fb before finish update
  drm/exynos: add macro to get the address of START_S reg
  drm/exynos: fimd: only finish update if START == START_S
  drm/exynos: add atomic asynchronous commit
  drm/exynos: wait all planes updates to finish
  drm/exynos: remove wait queue for pending page flip
  drm/exynos: Enable atomic modesetting feature

 drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  10 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c|  10 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  |  69 +--
 drivers/gpu/drm/exynos/exynos_drm_crtc.h  |   4 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c   | 158 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  24 +++-
 drivers/gpu/drm/exynos/exynos_drm_fb.c|  35 --
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  81 -
 drivers/gpu/drm/exynos/exynos_drm_plane.c |   2 +
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  10 +-
 drivers/gpu/drm/exynos/exynos_mixer.c |  10 +-
 include/video/samsung_fimd.h  |   1 +
 12 files changed, 309 insertions(+), 105 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/11] drm/exynos: fimd: unify call to exynos_drm_crtc_finish_pageflip()

2015-08-15 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Unify handling of finished plane update to prepare for a following patch
that will check for the START and START_S regs to really make sure that
the plane was updated.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 5def6bc..30c1409 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -896,15 +896,15 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
if (ctx-pipe  0 || !ctx-drm_dev)
goto out;
 
-   if (ctx-i80_if) {
-   exynos_drm_crtc_finish_pageflip(ctx-crtc);
+   if (!ctx-i80_if)
+   drm_crtc_handle_vblank(ctx-crtc-base);
+
+   exynos_drm_crtc_finish_pageflip(ctx-crtc);
 
+   if (ctx-i80_if) {
/* Exits triggering mode */
atomic_set(ctx-triggering, 0);
} else {
-   drm_crtc_handle_vblank(ctx-crtc-base);
-   exynos_drm_crtc_finish_pageflip(ctx-crtc);
-
/* set wait vsync event to zero and wake up queue. */
if (atomic_read(ctx-wait_vsync_event)) {
atomic_set(ctx-wait_vsync_event, 0);
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/11] drm/exynos: add prepare and cleanup phases for planes

2015-08-15 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

.prepare_plane() and .cleanup_plane() allows to perform extra operations
before and after the update of planes. For FIMD for example this will
be used to enable disable the shadow protection bit.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 19 +++
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |  6 ++
 2 files changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 5a19e16..3a89fc9 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -72,15 +72,34 @@ exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
 static void exynos_crtc_atomic_begin(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+   struct drm_plane *plane;
 
if (crtc-state-event) {
WARN_ON(drm_crtc_vblank_get(crtc) != 0);
exynos_crtc-event = crtc-state-event;
}
+
+   drm_atomic_crtc_for_each_plane(plane, crtc) {
+   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
+
+   if (exynos_crtc-ops-prepare_plane)
+   exynos_crtc-ops-prepare_plane(exynos_crtc,
+   exynos_plane);
+   }
 }
 
 static void exynos_crtc_atomic_flush(struct drm_crtc *crtc)
 {
+   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+   struct drm_plane *plane;
+
+   drm_atomic_crtc_for_each_plane(plane, crtc) {
+   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
+
+   if (exynos_crtc-ops-cleanup_plane)
+   exynos_crtc-ops-cleanup_plane(exynos_crtc,
+   exynos_plane);
+   }
 }
 
 static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index a993aac..9f2b5c9 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -87,6 +87,8 @@ struct exynos_drm_plane {
  * @disable_vblank: specific driver callback for disabling vblank interrupt.
  * @wait_for_vblank: wait for vblank interrupt to make sure that
  * hardware overlay is updated.
+ * @prepare_plane: prepare a window to receive a update
+ * @cleanup_plane: mark the end of a window update
  * @update_plane: apply hardware specific overlay data to registers.
  * @disable_plane: disable hardware specific overlay.
  * @te_handler: trigger to transfer video image at the tearing effect
@@ -107,10 +109,14 @@ struct exynos_drm_crtc_ops {
int (*enable_vblank)(struct exynos_drm_crtc *crtc);
void (*disable_vblank)(struct exynos_drm_crtc *crtc);
void (*wait_for_vblank)(struct exynos_drm_crtc *crtc);
+   void (*prepare_plane)(struct exynos_drm_crtc *crtc,
+ struct exynos_drm_plane *plane);
void (*update_plane)(struct exynos_drm_crtc *crtc,
 struct exynos_drm_plane *plane);
void (*disable_plane)(struct exynos_drm_crtc *crtc,
  struct exynos_drm_plane *plane);
+   void (*cleanup_plane)(struct exynos_drm_crtc *crtc,
+ struct exynos_drm_plane *plane);
void (*te_handler)(struct exynos_drm_crtc *crtc);
void (*clock_enable)(struct exynos_drm_crtc *crtc, bool enable);
 };
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] drm: WARN_ON if a modeset driver uses legacy suspend/resume helpers

2015-08-13 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Legacy s/r hooks are only used for shadow-attaching drivers, warn
when a KMS driver tries to use them.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/drm_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index b7bf4ce..4e76193 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -567,6 +567,8 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
ret = drm_minor_alloc(dev, DRM_MINOR_CONTROL);
if (ret)
goto err_minors;
+
+   WARN_ON(driver-suspend || driver-resume);
}
 
if (drm_core_check_feature(dev, DRIVER_RENDER)) {
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] drm/exynos: remove legacy -suspend()/resume()

2015-08-13 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

These legacy helpers should only be used by shadow-attaching drivers.
KMS drivers has its own way to handle suspend/resume and don't need to
use these two helpers.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index f1d6966..9bcf679 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -280,8 +280,6 @@ static struct drm_driver exynos_drm_driver = {
.driver_features= DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME,
.load   = exynos_drm_load,
.unload = exynos_drm_unload,
-   .suspend= exynos_drm_suspend,
-   .resume = exynos_drm_resume,
.open   = exynos_drm_open,
.preclose   = exynos_drm_preclose,
.lastclose  = exynos_drm_lastclose,
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 11/11] drm/exynos: remove struct exynos_drm_encoder layer

2015-08-12 Thread Gustavo Padovan
Hi Inki,

2015-08-11 Inki Dae inki@samsung.com:

 On 2015년 08월 11일 09:38, Gustavo Padovan wrote:
  Hi Inki,
  
  2015-08-07 Inki Dae inki@samsung.com:
  
  Hi Gustavo,
 
  On 2015년 08월 06일 22:31, Gustavo Padovan wrote:
  From: Gustavo Padovan gustavo.pado...@collabora.co.uk
 
  struct exynos_drm_encoder was justing wrapping struct drm_encoder, it had
  only a drm_encoder member and the internal exynos_drm_encoders ops that
  was directly mapped to the drm_encoder helper funcs.
 
  So now exynos DRM uses struct drm_encoder directly, this removes
  completely the struct exynos_drm_encoder.
 
 
  Trats2 board, which uses Exynos4412 Soc, doesn't work after this patch
  is applied. Below is the booting logs,
  [1.171318] console [ttySAC2] enabled
  [1.175522] 1383.serial: ttySAC3 at MMIO 0x1383 (irq = 60,
  base_baud = 0) is a S3C6400/10
  [1.185545] [drm] Initialized drm 1.1.0 20060810
  [1.194104] exynos-drm exynos-drm: bound 11c0.fimd (ops
  fimd_component_ops)
  [1.200352] exynos-drm exynos-drm: bound 11c8.dsi (ops
  exynos_dsi_component_ops)
  [1.207688] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
  [1.214313] [drm] No driver support for vblank timestamp query.
  [1.220218] [drm] Initialized exynos 1.0.0 20110530 on minor 0
 
  Booting is locked up here. This patch looks good to me so I tried to
  find why locked up and I found the booting is locked up as soon as
  console_lock function is called. Can you and other guys look into this
  issue?
  
  I've realized that I left a fix for patch 01 behind, it could be the
  cause of this issue. I've just resent this patch with the added v2 fix
  up.
 
 With above change, still locked up. So your updated patch doesn't
 resolve this issue.
 
 Anyway, I tested it with fbdev emulation relevant patch series[1] and
 the booting was ok with disabling fbdev emulation as Daniel commented.
 However, I think the booting should also be ok with fbdev emulation so I
 don't want for your last patch to be merged to mainline until the issue
 is resolved.

I've tried to reproduce your issue with these patches on a odroid-x2
(exynos4412) but it seems to work fine for me with fbdev emulation
enabled. In snow and peach-pi it also works fine. We would need
to debug better on your side to figure out what is breaking for you.

Gustavo
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 11/11] drm/exynos: remove struct exynos_drm_encoder layer

2015-08-12 Thread Gustavo Padovan
2015-08-12 Gustavo Padovan gustavo.pado...@collabora.co.uk:

 Hi Inki,
 
 2015-08-11 Inki Dae inki@samsung.com:
 
  On 2015년 08월 11일 09:38, Gustavo Padovan wrote:
   Hi Inki,
   
   2015-08-07 Inki Dae inki@samsung.com:
   
   Hi Gustavo,
  
   On 2015년 08월 06일 22:31, Gustavo Padovan wrote:
   From: Gustavo Padovan gustavo.pado...@collabora.co.uk
  
   struct exynos_drm_encoder was justing wrapping struct drm_encoder, it 
   had
   only a drm_encoder member and the internal exynos_drm_encoders ops that
   was directly mapped to the drm_encoder helper funcs.
  
   So now exynos DRM uses struct drm_encoder directly, this removes
   completely the struct exynos_drm_encoder.
  
  
   Trats2 board, which uses Exynos4412 Soc, doesn't work after this patch
   is applied. Below is the booting logs,
   [1.171318] console [ttySAC2] enabled
   [1.175522] 1383.serial: ttySAC3 at MMIO 0x1383 (irq = 60,
   base_baud = 0) is a S3C6400/10
   [1.185545] [drm] Initialized drm 1.1.0 20060810
   [1.194104] exynos-drm exynos-drm: bound 11c0.fimd (ops
   fimd_component_ops)
   [1.200352] exynos-drm exynos-drm: bound 11c8.dsi (ops
   exynos_dsi_component_ops)
   [1.207688] [drm] Supports vblank timestamp caching Rev 2 
   (21.10.2013).
   [1.214313] [drm] No driver support for vblank timestamp query.
   [1.220218] [drm] Initialized exynos 1.0.0 20110530 on minor 0
  
   Booting is locked up here. This patch looks good to me so I tried to
   find why locked up and I found the booting is locked up as soon as
   console_lock function is called. Can you and other guys look into this
   issue?
   
   I've realized that I left a fix for patch 01 behind, it could be the
   cause of this issue. I've just resent this patch with the added v2 fix
   up.
  
  With above change, still locked up. So your updated patch doesn't
  resolve this issue.
  
  Anyway, I tested it with fbdev emulation relevant patch series[1] and
  the booting was ok with disabling fbdev emulation as Daniel commented.
  However, I think the booting should also be ok with fbdev emulation so I
  don't want for your last patch to be merged to mainline until the issue
  is resolved.
 
 I've tried to reproduce your issue with these patches on a odroid-x2
 (exynos4412) but it seems to work fine for me with fbdev emulation
 enabled. In snow and peach-pi it also works fine. We would need
 to debug better on your side to figure out what is breaking for you.

Can you please git bisect this? So we can figure out which commit is
causing the issue. That would be great.

Gustavo
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 11/11] drm/exynos: remove struct exynos_drm_encoder layer

2015-08-10 Thread Gustavo Padovan
Hi Inki,

2015-08-07 Inki Dae inki@samsung.com:

 Hi Gustavo,
 
 On 2015년 08월 06일 22:31, Gustavo Padovan wrote:
  From: Gustavo Padovan gustavo.pado...@collabora.co.uk
  
  struct exynos_drm_encoder was justing wrapping struct drm_encoder, it had
  only a drm_encoder member and the internal exynos_drm_encoders ops that
  was directly mapped to the drm_encoder helper funcs.
  
  So now exynos DRM uses struct drm_encoder directly, this removes
  completely the struct exynos_drm_encoder.
  
 
 Trats2 board, which uses Exynos4412 Soc, doesn't work after this patch
 is applied. Below is the booting logs,
 [1.171318] console [ttySAC2] enabled
 [1.175522] 1383.serial: ttySAC3 at MMIO 0x1383 (irq = 60,
 base_baud = 0) is a S3C6400/10
 [1.185545] [drm] Initialized drm 1.1.0 20060810
 [1.194104] exynos-drm exynos-drm: bound 11c0.fimd (ops
 fimd_component_ops)
 [1.200352] exynos-drm exynos-drm: bound 11c8.dsi (ops
 exynos_dsi_component_ops)
 [1.207688] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
 [1.214313] [drm] No driver support for vblank timestamp query.
 [1.220218] [drm] Initialized exynos 1.0.0 20110530 on minor 0
 
 Booting is locked up here. This patch looks good to me so I tried to
 find why locked up and I found the booting is locked up as soon as
 console_lock function is called. Can you and other guys look into this
 issue?

I've realized that I left a fix for patch 01 behind, it could be the
cause of this issue. I've just resent this patch with the added v2 fix
up.

Gustavo
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 00/11] drm/exynos: remove exynos_drm_display and exynos_drm_encoder

2015-08-06 Thread Gustavo Padovan
Hi Inki,

2015-08-06 Inki Dae inki@samsung.com:

 On 2015년 08월 06일 08:24, Gustavo Padovan wrote:
  From: Gustavo Padovan gustavo.pado...@collabora.co.uk
 
  Hi,
 
  This patchset is another important step in the exynos clean up, it removes
  two exynos internal structs in favor of wider use of struct drm_encoder.
 
  Structs exynos_drm_display and exynos_drm_encoder were doing exactly what
  struct drm_encoder does so remove them makes the code cleaner, easier
  to understand and less error prone.
 
  Please review,
 
 Gustavo
 
  ---
  v2:  - check ret value of hdmi_create_connector()
   - set dp-dpms_mode after enable/disable
 
 I don't see patch v2 10/11 and 11/11 in my mailbox. Did you miss them?

Hmm, yeah. I've used 000* to send my patches, which excluded 10 and 11.
I'll append them here.

Gustavo
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 11/11] drm/exynos: remove struct exynos_drm_encoder layer

2015-08-06 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

struct exynos_drm_encoder was justing wrapping struct drm_encoder, it had
only a drm_encoder member and the internal exynos_drm_encoders ops that
was directly mapped to the drm_encoder helper funcs.

So now exynos DRM uses struct drm_encoder directly, this removes
completely the struct exynos_drm_encoder.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/Makefile |   7 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c  |   2 +-
 drivers/gpu/drm/exynos/exynos_dp_core.c |  68 --
 drivers/gpu/drm/exynos/exynos_dp_core.h |   2 +-
 drivers/gpu/drm/exynos/exynos_drm_core.c|   1 -
 drivers/gpu/drm/exynos/exynos_drm_crtc.c|   1 -
 drivers/gpu/drm/exynos/exynos_drm_dpi.c |  51 --
 drivers/gpu/drm/exynos/exynos_drm_drv.c |   1 -
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  47 ++---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |  80 +++--
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 105 
 drivers/gpu/drm/exynos/exynos_drm_encoder.h |  22 --
 drivers/gpu/drm/exynos/exynos_drm_fimd.c|   2 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c|  71 ++-
 drivers/gpu/drm/exynos/exynos_hdmi.c|  85 +-
 15 files changed, 236 insertions(+), 309 deletions(-)
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.c
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.h

diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile
index 7de0b10..61c2906 100644
--- a/drivers/gpu/drm/exynos/Makefile
+++ b/drivers/gpu/drm/exynos/Makefile
@@ -3,10 +3,9 @@
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
 ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/exynos
-exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o \
-   exynos_drm_crtc.o exynos_drm_fbdev.o exynos_drm_fb.o \
-   exynos_drm_buf.o exynos_drm_gem.o exynos_drm_core.o \
-   exynos_drm_plane.o exynos_drm_dmabuf.o
+exynosdrm-y := exynos_drm_drv.o exynos_drm_crtc.o exynos_drm_fbdev.o \
+   exynos_drm_fb.o exynos_drm_buf.o exynos_drm_gem.o \
+   exynos_drm_core.o exynos_drm_plane.o exynos_drm_dmabuf.o
 
 exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD)+= exynos_drm_fimd.o
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index e1a2ce7..0792654 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -61,7 +61,7 @@ struct decon_context {
atomic_twait_vsync_event;
 
struct exynos_drm_panel_info panel;
-   struct exynos_drm_encoder *encoder;
+   struct drm_encoder *encoder;
 };
 
 static const struct of_device_id decon_driver_dt_match[] = {
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 4d49d25..92864ef 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -32,18 +32,18 @@
 #include drm/drm_panel.h
 
 #include exynos_dp_core.h
-#include exynos_drm_encoder.h
+#include exynos_drm_crtc.h
 
 #define ctx_from_connector(c)  container_of(c, struct exynos_dp_device, \
connector)
 
 static inline struct exynos_drm_crtc *dp_to_crtc(struct exynos_dp_device *dp)
 {
-   return to_exynos_crtc(dp-encoder.base.crtc);
+   return to_exynos_crtc(dp-encoder.crtc);
 }
 
 static inline struct exynos_dp_device *encoder_to_dp(
-   struct exynos_drm_encoder *e)
+   struct drm_encoder *e)
 {
return container_of(e, struct exynos_dp_device, encoder);
 }
@@ -889,7 +889,7 @@ static void exynos_dp_hotplug(struct work_struct *work)
drm_helper_hpd_irq_event(dp-drm_dev);
 }
 
-static void exynos_dp_commit(struct exynos_drm_encoder *encoder)
+static void exynos_dp_commit(struct drm_encoder *encoder)
 {
struct exynos_dp_device *dp = encoder_to_dp(encoder);
int ret;
@@ -995,7 +995,7 @@ static struct drm_encoder *exynos_dp_best_encoder(
 {
struct exynos_dp_device *dp = ctx_from_connector(connector);
 
-   return dp-encoder.base;
+   return dp-encoder;
 }
 
 static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = {
@@ -1020,10 +1020,9 @@ static int exynos_drm_attach_lcd_bridge(struct 
exynos_dp_device *dp,
return 0;
 }
 
-static int exynos_dp_create_connector(struct exynos_drm_encoder 
*exynos_encoder)
+static int exynos_dp_create_connector(struct drm_encoder *encoder)
 {
-   struct exynos_dp_device *dp = encoder_to_dp(exynos_encoder);
-   struct drm_encoder *encoder = exynos_encoder-base;
+   struct exynos_dp_device *dp

[PATCH v2 10/11] drm/exynos: fold encoder setup into exynos_drm_load()

2015-08-06 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

As we are removing the exynos encoder move the encoder setup operation
directly inside the exynos_drm_load()

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 12 ++--
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 13 -
 drivers/gpu/drm/exynos/exynos_drm_encoder.h |  1 -
 3 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index f1d6966..105f10e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -41,7 +41,9 @@
 static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
 {
struct exynos_drm_private *private;
-   int ret;
+   struct drm_encoder *encoder;
+   unsigned int clone_mask;
+   int cnt, ret;
 
private = kzalloc(sizeof(struct exynos_drm_private), GFP_KERNEL);
if (!private)
@@ -67,7 +69,13 @@ static int exynos_drm_load(struct drm_device *dev, unsigned 
long flags)
exynos_drm_mode_config_init(dev);
 
/* setup possible_clones. */
-   exynos_drm_encoder_setup(dev);
+   cnt = 0;
+   clone_mask = 0;
+   list_for_each_entry(encoder, dev-mode_config.encoder_list, head)
+   clone_mask |= (1  (cnt++));
+
+   list_for_each_entry(encoder, dev-mode_config.encoder_list, head)
+   encoder-possible_clones = clone_mask;
 
platform_set_drvdata(dev-platformdev, dev);
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c 
b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 4ed360b..d45a5c5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -78,19 +78,6 @@ static struct drm_encoder_funcs exynos_encoder_funcs = {
.destroy = drm_encoder_cleanup,
 };
 
-void exynos_drm_encoder_setup(struct drm_device *dev)
-{
-   struct drm_encoder *encoder;
-   unsigned int clone_mask = 0;
-   int cnt = 0;
-
-   list_for_each_entry(encoder, dev-mode_config.encoder_list, head)
-   clone_mask |= (1  (cnt++));
-
-   list_for_each_entry(encoder, dev-mode_config.encoder_list, head)
-   encoder-possible_clones = clone_mask;
-}
-
 int exynos_drm_encoder_create(struct drm_device *dev,
  struct exynos_drm_encoder *exynos_encoder,
  enum exynos_drm_output_type type)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.h 
b/drivers/gpu/drm/exynos/exynos_drm_encoder.h
index e998b82..6610dee 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.h
@@ -16,7 +16,6 @@
 
 #include exynos_drm_drv.h
 
-void exynos_drm_encoder_setup(struct drm_device *dev);
 int exynos_drm_encoder_create(struct drm_device *dev, struct exynos_drm_encoder
  *encoder, enum exynos_drm_output_type type);
 
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 11/11] drm/exynos: remove struct exynos_drm_encoder layer

2015-08-05 Thread Gustavo Padovan
2015-08-05 Inki Dae inki@samsung.com:

Hi Inki,

 On 2015년 08월 04일 23:47, Gustavo Padovan wrote:
  Hi Inki,
  
  2015-08-04 Inki Dae inki@samsung.com:
  
  On 2015년 08월 04일 04:09, Gustavo Padovan wrote:
  From: Gustavo Padovan gustavo.pado...@collabora.co.uk
 
  struct exynos_drm_encoder was justing wrapping struct drm_encoder, it had
  only a drm_encoder member and the internal exynos_drm_encoders ops that
  was directly mapped to the drm_encoder helper funcs.
 
  So now exynos DRM uses struct drm_encoder directly, this removes
  completely the struct exynos_drm_encoder.
 
  Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
  ---
   drivers/gpu/drm/exynos/Makefile |   7 +-
   drivers/gpu/drm/exynos/exynos7_drm_decon.c  |   2 +-
   drivers/gpu/drm/exynos/exynos_dp_core.c |  68 --
   drivers/gpu/drm/exynos/exynos_dp_core.h |   2 +-
   drivers/gpu/drm/exynos/exynos_drm_core.c|   1 -
   drivers/gpu/drm/exynos/exynos_drm_crtc.c|   1 -
   drivers/gpu/drm/exynos/exynos_drm_dpi.c |  51 --
   drivers/gpu/drm/exynos/exynos_drm_drv.c |   1 -
   drivers/gpu/drm/exynos/exynos_drm_drv.h |  47 ++---
   drivers/gpu/drm/exynos/exynos_drm_dsi.c |  80 +++--
   drivers/gpu/drm/exynos/exynos_drm_encoder.c | 105 
  
   drivers/gpu/drm/exynos/exynos_drm_encoder.h |  22 --
   drivers/gpu/drm/exynos/exynos_drm_fimd.c|   2 +-
   drivers/gpu/drm/exynos/exynos_drm_vidi.c|  71 ++-
   drivers/gpu/drm/exynos/exynos_hdmi.c|  85 +-
   15 files changed, 236 insertions(+), 309 deletions(-)
   delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.c
   delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.h
 
  [-- SNIP --]
 
  diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c 
  b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
  index d791ad4..a87d030 100644
  --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
  +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
  @@ -30,7 +30,6 @@
   #include video/videomode.h
   
   #include exynos_drm_crtc.h
  -#include exynos_drm_encoder.h
   #include exynos_drm_drv.h
   
   /* returns true iff both arguments logically differs */
  @@ -260,7 +259,7 @@ struct exynos_dsi_driver_data {
   };
   
   struct exynos_dsi {
  - struct exynos_drm_encoder encoder;
  + struct drm_encoder encoder;
struct mipi_dsi_host dsi_host;
struct drm_connector connector;
struct device_node *panel_node;
  @@ -296,7 +295,7 @@ struct exynos_dsi {
   #define host_to_dsi(host) container_of(host, struct exynos_dsi, dsi_host)
   #define connector_to_dsi(c) container_of(c, struct exynos_dsi, connector)
   
  -static inline struct exynos_dsi *encoder_to_dsi(struct 
  exynos_drm_encoder *e)
  +static inline struct exynos_dsi *encoder_to_dsi(struct drm_encoder *e)
   {
return container_of(e, struct exynos_dsi, encoder);
   }
  @@ -1273,7 +1272,7 @@ static irqreturn_t exynos_dsi_irq(int irq, void 
  *dev_id)
   static irqreturn_t exynos_dsi_te_irq_handler(int irq, void *dev_id)
   {
struct exynos_dsi *dsi = (struct exynos_dsi *)dev_id;
  - struct drm_encoder *encoder = dsi-encoder.base;
  + struct drm_encoder *encoder = dsi-encoder;
   
if (dsi-state  DSIM_STATE_VIDOUT_AVAILABLE)
exynos_drm_crtc_te_handler(encoder-crtc);
  @@ -1519,7 +1518,7 @@ static void exynos_dsi_poweroff(struct exynos_dsi 
  *dsi)
dev_err(dsi-dev, cannot disable regulators %d\n, ret);
   }
   
  -static void exynos_dsi_enable(struct exynos_drm_encoder *encoder)
  +static void exynos_dsi_enable(struct drm_encoder *encoder)
   {
struct exynos_dsi *dsi = encoder_to_dsi(encoder);
int ret;
  @@ -1555,7 +1554,7 @@ static void exynos_dsi_enable(struct 
  exynos_drm_encoder *encoder)
dsi-state |= DSIM_STATE_VIDOUT_AVAILABLE;
   }
   
  -static void exynos_dsi_disable(struct exynos_drm_encoder *encoder)
  +static void exynos_dsi_disable(struct drm_encoder *encoder)
   {
struct exynos_dsi *dsi = encoder_to_dsi(encoder);
   
  @@ -1583,7 +1582,7 @@ exynos_dsi_detect(struct drm_connector *connector, 
  bool force)
if (dsi-panel)
drm_panel_attach(dsi-panel, dsi-connector);
} else if (!dsi-panel_node) {
  - struct exynos_drm_encoder *encoder;
  + struct drm_encoder *encoder;
   
encoder = platform_get_drvdata(to_platform_device(dsi-dev));
exynos_dsi_disable(encoder);
  @@ -1629,7 +1628,7 @@ exynos_dsi_best_encoder(struct drm_connector 
  *connector)
   {
struct exynos_dsi *dsi = connector_to_dsi(connector);
   
  - return dsi-encoder.base;
  + return dsi-encoder;
   }
   
   static struct drm_connector_helper_funcs 
  exynos_dsi_connector_helper_funcs = {
  @@ -1637,11 +1636,9 @@ static struct drm_connector_helper_funcs 
  exynos_dsi_connector_helper_funcs = {
.best_encoder = exynos_dsi_best_encoder,
   };
   
  -static int

[PATCH v2 00/11] drm/exynos: remove exynos_drm_display and exynos_drm_encoder

2015-08-05 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Hi,

This patchset is another important step in the exynos clean up, it removes
two exynos internal structs in favor of wider use of struct drm_encoder.

Structs exynos_drm_display and exynos_drm_encoder were doing exactly what
struct drm_encoder does so remove them makes the code cleaner, easier
to understand and less error prone.

Please review,

   Gustavo

---
v2:  - check ret value of hdmi_create_connector()
 - set dp-dpms_mode after enable/disable   

Gustavo Padovan (11):
  drm/exynos: split display's .dpms() into .enable() and .disable()
  drm/exynos: remove wrappers for phy_power_{on,off}
  drm/exynos: remove unused .remove() and .check_mode() ops from display
  drm/exynos: simplify calculation of possible CRTCs
  drm/exynos: remove struct exynos_drm_display
  drm/exynos: remove extra call to hdmi_commit()
  drm/exynos: remove extra call to exynos_dp_commit()
  drm/exynos: remove exynos_encoder's .commit() op
  drm/exynos: remove exynos_drm_create_enc_conn()
  drm/exynos: fold encoder setup into exynos_drm_load()
  drm/exynos: remove struct exynos_drm_encoder layer

 drivers/gpu/drm/exynos/Makefile |   7 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c  |  16 +--
 drivers/gpu/drm/exynos/exynos_dp_core.c | 119 ++-
 drivers/gpu/drm/exynos/exynos_dp_core.h |   3 +-
 drivers/gpu/drm/exynos/exynos_drm_core.c|  36 --
 drivers/gpu/drm/exynos/exynos_drm_crtc.c|   3 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.h|   2 +-
 drivers/gpu/drm/exynos/exynos_drm_dpi.c |  96 ---
 drivers/gpu/drm/exynos/exynos_drm_drv.c |  13 ++-
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  65 ++-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 130 ++---
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 174 
 drivers/gpu/drm/exynos/exynos_drm_encoder.h |  23 
 drivers/gpu/drm/exynos/exynos_drm_fimd.c|  17 ++-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c|  90 --
 drivers/gpu/drm/exynos/exynos_hdmi.c| 160 -
 16 files changed, 355 insertions(+), 599 deletions(-)
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.c
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.h

-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 09/11] drm/exynos: remove exynos_drm_create_enc_conn()

2015-08-05 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

This functions was just hiding the encoder and connector creation in
a way that was less clean than if we get rid of it. For example,
exynos_encoder ops had .create_connector() defined only because we were
handing off the encoder and connector creation to
exynos_drm_create_enc_conn(). Without this function we can directly call
the create_connector function internally in the code, without the need of
any vtable access.

It also does some refactoring in the code like creating a bind function
for dpi devices.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk

---
v2: check ret value of hdmi_create_connector()
---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c  |  3 +--
 drivers/gpu/drm/exynos/exynos_dp_core.c | 20 ---
 drivers/gpu/drm/exynos/exynos_drm_core.c| 30 -
 drivers/gpu/drm/exynos/exynos_drm_dpi.c | 26 +++--
 drivers/gpu/drm/exynos/exynos_drm_drv.h | 12 ++--
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 20 ---
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 11 +++
 drivers/gpu/drm/exynos/exynos_drm_encoder.h |  4 +++-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c|  3 +--
 drivers/gpu/drm/exynos/exynos_drm_vidi.c| 20 ++-
 drivers/gpu/drm/exynos/exynos_hdmi.c| 21 +---
 11 files changed, 101 insertions(+), 69 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 1b89e94..e1a2ce7 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -682,8 +682,7 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
}
 
if (ctx-encoder)
-   exynos_drm_create_enc_conn(drm_dev, ctx-encoder,
-  EXYNOS_DISPLAY_TYPE_LCD);
+   exynos_dpi_bind(drm_dev, ctx-encoder);
 
return 0;
 
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 6d9d115..4d49d25 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -32,6 +32,7 @@
 #include drm/drm_panel.h
 
 #include exynos_dp_core.h
+#include exynos_drm_encoder.h
 
 #define ctx_from_connector(c)  container_of(c, struct exynos_dp_device, \
connector)
@@ -1107,7 +1108,6 @@ static void exynos_dp_disable(struct exynos_drm_encoder 
*encoder)
 }
 
 static struct exynos_drm_encoder_ops exynos_dp_encoder_ops = {
-   .create_connector = exynos_dp_create_connector,
.enable = exynos_dp_enable,
.disable = exynos_dp_disable,
 };
@@ -1188,6 +1188,7 @@ static int exynos_dp_bind(struct device *dev, struct 
device *master, void *data)
struct exynos_dp_device *dp = dev_get_drvdata(dev);
struct platform_device *pdev = to_platform_device(dev);
struct drm_device *drm_dev = data;
+   struct exynos_drm_encoder *exynos_encoder = dp-encoder;
struct resource *res;
unsigned int irq_flags;
int ret = 0;
@@ -1280,8 +1281,21 @@ static int exynos_dp_bind(struct device *dev, struct 
device *master, void *data)
 
dp-drm_dev = drm_dev;
 
-   return exynos_drm_create_enc_conn(drm_dev, dp-encoder,
- EXYNOS_DISPLAY_TYPE_LCD);
+   ret = exynos_drm_encoder_create(drm_dev, exynos_encoder,
+   EXYNOS_DISPLAY_TYPE_LCD);
+   if (ret) {
+   DRM_ERROR(failed to create encoder\n);
+   return ret;
+   }
+
+   ret = exynos_dp_create_connector(exynos_encoder);
+   if (ret) {
+   DRM_ERROR(failed to create connector ret = %d\n, ret);
+   drm_encoder_cleanup(exynos_encoder-base);
+   return ret;
+   }
+
+   return 0;
 }
 
 static void exynos_dp_unbind(struct device *dev, struct device *master,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c 
b/drivers/gpu/drm/exynos/exynos_drm_core.c
index e386452..1f38a44 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_core.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_core.c
@@ -20,36 +20,6 @@
 
 static LIST_HEAD(exynos_drm_subdrv_list);
 
-int exynos_drm_create_enc_conn(struct drm_device *dev,
-  struct exynos_drm_encoder *exynos_encoder,
-  enum exynos_drm_output_type type)
-{
-   int ret;
-   unsigned long possible_crtcs = 0;
-
-   ret = exynos_drm_crtc_get_pipe_from_type(dev, type);
-   if (ret  0)
-   return ret;
-
-   possible_crtcs |= 1  ret;
-
-   /* create and initialize a encoder for this sub driver. */
-   ret = exynos_drm_encoder_create(dev, exynos_encoder, possible_crtcs);
-   if (ret) {
-   DRM_ERROR(failed to create encoder\n);
-   return

[PATCH v2 03/11] drm/exynos: remove unused .remove() and .check_mode() ops from display

2015-08-05 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

These two display_ops are not used anywhere, remove them.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_drv.h | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 5c55606..47ea400 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -81,11 +81,9 @@ struct exynos_drm_plane {
  * - this structure is common to analog tv, digital tv and lcd panel.
  *
  * @create_connector: initialize and register a new connector
- * @remove: cleans up the display for removal
  * @mode_fixup: fix mode data comparing to hw specific display mode.
  * @mode_set: convert drm_display_mode to hw specific display mode and
  *   would be called by encoder-mode_set().
- * @check_mode: check if mode is valid or not.
  * @enable: display device on.
  * @disable: display device off.
  * @commit: apply changes to hw
@@ -94,15 +92,12 @@ struct exynos_drm_display;
 struct exynos_drm_display_ops {
int (*create_connector)(struct exynos_drm_display *display,
struct drm_encoder *encoder);
-   void (*remove)(struct exynos_drm_display *display);
void (*mode_fixup)(struct exynos_drm_display *display,
struct drm_connector *connector,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode);
void (*mode_set)(struct exynos_drm_display *display,
struct drm_display_mode *mode);
-   int (*check_mode)(struct exynos_drm_display *display,
-   struct drm_display_mode *mode);
void (*enable)(struct exynos_drm_display *display);
void (*disable)(struct exynos_drm_display *display);
void (*commit)(struct exynos_drm_display *display);
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 04/11] drm/exynos: simplify calculation of possible CRTCs

2015-08-05 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

All CRTCs can only be LCD, HDMI or VIDI, so basically all CRTCs will be a
possible CRTCs. This patch removes an extra function with switch that was
only checking if the CRTC type was one of those three above.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 29 +
 1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c 
b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 0aa4a58..7ba3a2d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -105,36 +105,17 @@ static struct drm_encoder_funcs exynos_encoder_funcs = {
.destroy = exynos_drm_encoder_destroy,
 };
 
-static unsigned int exynos_drm_encoder_clones(struct drm_encoder *encoder)
+void exynos_drm_encoder_setup(struct drm_device *dev)
 {
-   struct drm_encoder *clone;
-   struct drm_device *dev = encoder-dev;
-   struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
-   struct exynos_drm_display *display = exynos_encoder-display;
+   struct drm_encoder *encoder;
unsigned int clone_mask = 0;
int cnt = 0;
 
-   list_for_each_entry(clone, dev-mode_config.encoder_list, head) {
-   switch (display-type) {
-   case EXYNOS_DISPLAY_TYPE_LCD:
-   case EXYNOS_DISPLAY_TYPE_HDMI:
-   case EXYNOS_DISPLAY_TYPE_VIDI:
-   clone_mask |= (1  (cnt++));
-   break;
-   default:
-   continue;
-   }
-   }
-
-   return clone_mask;
-}
-
-void exynos_drm_encoder_setup(struct drm_device *dev)
-{
-   struct drm_encoder *encoder;
+   list_for_each_entry(encoder, dev-mode_config.encoder_list, head)
+   clone_mask |= (1  (cnt++));
 
list_for_each_entry(encoder, dev-mode_config.encoder_list, head)
-   encoder-possible_clones = exynos_drm_encoder_clones(encoder);
+   encoder-possible_clones = clone_mask;
 }
 
 struct drm_encoder *
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 07/11] drm/exynos: remove extra call to exynos_dp_commit()

2015-08-05 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

exynos_dp_commit() was getting called twice by exynos encoder core, once
inside the .enable() call and another time by .commit() itself.

The remove of the second call caused the wake of a bug, the operations
orders inside exynos_dp_commit was wrong and we had to move
exynos_dp_start_video() to be the last operation in there.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_dp_core.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 002a233..6d9d115 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -795,9 +795,6 @@ static int exynos_dp_config_video(struct exynos_dp_device 
*dp)
/* Configure video slave mode */
exynos_dp_enable_video_master(dp, 0);
 
-   /* Enable video */
-   exynos_dp_start_video(dp);
-
timeout_loop = 0;
 
for (;;) {
@@ -938,6 +935,9 @@ static void exynos_dp_commit(struct exynos_drm_encoder 
*encoder)
if (drm_panel_enable(dp-panel))
DRM_ERROR(failed to enable the panel\n);
}
+
+   /* Enable video */
+   exynos_dp_start_video(dp);
 }
 
 static enum drm_connector_status exynos_dp_detect(
@@ -1110,7 +1110,6 @@ static struct exynos_drm_encoder_ops 
exynos_dp_encoder_ops = {
.create_connector = exynos_dp_create_connector,
.enable = exynos_dp_enable,
.disable = exynos_dp_disable,
-   .commit = exynos_dp_commit,
 };
 
 static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev)
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 08/11] drm/exynos: remove exynos_encoder's .commit() op

2015-08-05 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

.commit() is not used anymore, Exynos encoders now follow the
.enable()/.disable() semantics from drm atomic core, so remove this
callback.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 --
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 3 ---
 2 files changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 4931193..76ed6a1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -87,7 +87,6 @@ struct exynos_drm_plane {
  *   would be called by encoder-mode_set().
  * @enable: display device on.
  * @disable: display device off.
- * @commit: apply changes to hw
  */
 struct exynos_drm_encoder;
 struct exynos_drm_encoder_ops {
@@ -100,7 +99,6 @@ struct exynos_drm_encoder_ops {
struct drm_display_mode *mode);
void (*enable)(struct exynos_drm_encoder *encoder);
void (*disable)(struct exynos_drm_encoder *encoder);
-   void (*commit)(struct exynos_drm_encoder *encoder);
 };
 
 /*
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c 
b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index b9a1c93..ce7b97e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -56,9 +56,6 @@ static void exynos_drm_encoder_enable(struct drm_encoder 
*encoder)
 
if (exynos_encoder-ops-enable)
exynos_encoder-ops-enable(exynos_encoder);
-
-   if (exynos_encoder-ops-commit)
-   exynos_encoder-ops-commit(exynos_encoder);
 }
 
 static void exynos_drm_encoder_disable(struct drm_encoder *encoder)
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 06/11] drm/exynos: remove extra call to hdmi_commit()

2015-08-05 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

hdmi_commit() was getting called twice by exynos encoder core, once inside
the .enable() call and another time by .commit() itself.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 1aed7ea..11bac50 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1711,16 +1711,6 @@ static void hdmi_mode_set(struct exynos_drm_encoder 
*encoder,
hdata-cea_video_id = drm_match_cea_mode(mode);
 }
 
-static void hdmi_commit(struct exynos_drm_encoder *encoder)
-{
-   struct hdmi_context *hdata = encoder_to_hdmi(encoder);
-
-   if (!hdata-powered)
-   return;
-
-   hdmi_conf_apply(hdata);
-}
-
 static void hdmi_enable(struct exynos_drm_encoder *encoder)
 {
struct hdmi_context *hdata = encoder_to_hdmi(encoder);
@@ -1744,7 +1734,7 @@ static void hdmi_enable(struct exynos_drm_encoder 
*encoder)
clk_prepare_enable(res-sclk_hdmi);
 
hdmiphy_poweron(hdata);
-   hdmi_commit(encoder);
+   hdmi_conf_apply(hdata);
 }
 
 static void hdmi_disable(struct exynos_drm_encoder *encoder)
@@ -1798,7 +1788,6 @@ static struct exynos_drm_encoder_ops hdmi_encoder_ops = {
.mode_set   = hdmi_mode_set,
.enable = hdmi_enable,
.disable= hdmi_disable,
-   .commit = hdmi_commit,
 };
 
 static void hdmi_hotplug_work_func(struct work_struct *work)
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 02/11] drm/exynos: remove wrappers for phy_power_{on,off}

2015-08-05 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

phy_power_on() and phy_power_off() already checks for NULL pointer.
This patch removes the wrappers exynos_dp_phy_init() and
exynos_dp_phy_exit() since the only think they were doing was a check for
NULL phy.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_dp_core.c | 18 +++---
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index b3bf210..54f91e7 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1054,18 +1054,6 @@ static int exynos_dp_create_connector(struct 
exynos_drm_display *display,
return ret;
 }
 
-static void exynos_dp_phy_init(struct exynos_dp_device *dp)
-{
-   if (dp-phy)
-   phy_power_on(dp-phy);
-}
-
-static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
-{
-   if (dp-phy)
-   phy_power_off(dp-phy);
-}
-
 static void exynos_dp_enable(struct exynos_drm_display *display)
 {
struct exynos_dp_device *dp = display_to_dp(display);
@@ -1085,7 +1073,7 @@ static void exynos_dp_enable(struct exynos_drm_display 
*display)
crtc-ops-clock_enable(dp_to_crtc(dp), true);
 
clk_prepare_enable(dp-clock);
-   exynos_dp_phy_init(dp);
+   phy_power_on(dp-phy);
exynos_dp_init_dp(dp);
enable_irq(dp-irq);
exynos_dp_commit(dp-display);
@@ -1108,7 +1096,7 @@ static void exynos_dp_disable(struct exynos_drm_display 
*display)
 
disable_irq(dp-irq);
flush_work(dp-hotplug_work);
-   exynos_dp_phy_exit(dp);
+   phy_power_off(dp-phy);
clk_disable_unprepare(dp-clock);
 
if (crtc-ops-clock_enable)
@@ -1281,7 +1269,7 @@ static int exynos_dp_bind(struct device *dev, struct 
device *master, void *data)
 
INIT_WORK(dp-hotplug_work, exynos_dp_hotplug);
 
-   exynos_dp_phy_init(dp);
+   phy_power_on(dp-phy);
 
exynos_dp_init_dp(dp);
 
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 05/11] drm/exynos: remove struct exynos_drm_display

2015-08-05 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

This struct was just representing encoder information, it was a member of
struct exynos_drm_encoder, so any code trying to access encoder data would
have to go through the encoder struct, get the display struct and then get
the data it want.

During this patchset we also realized that the only data
exynos_drm_encoder needs to store is the drm_encoder parent and the
exynos_drm_encoder_ops.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c  | 17 ---
 drivers/gpu/drm/exynos/exynos_dp_core.c | 46 +-
 drivers/gpu/drm/exynos/exynos_dp_core.h |  3 +-
 drivers/gpu/drm/exynos/exynos_drm_core.c| 23 -
 drivers/gpu/drm/exynos/exynos_drm_crtc.c|  2 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.h|  2 +-
 drivers/gpu/drm/exynos/exynos_drm_dpi.c | 41 
 drivers/gpu/drm/exynos/exynos_drm_drv.h | 47 --
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 58 +++---
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 75 -
 drivers/gpu/drm/exynos/exynos_drm_encoder.h |  6 +--
 drivers/gpu/drm/exynos/exynos_drm_fimd.c| 18 +++
 drivers/gpu/drm/exynos/exynos_drm_vidi.c| 43 +
 drivers/gpu/drm/exynos/exynos_hdmi.c| 48 +-
 14 files changed, 177 insertions(+), 252 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index cfd0b5e..1b89e94 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -61,7 +61,7 @@ struct decon_context {
atomic_twait_vsync_event;
 
struct exynos_drm_panel_info panel;
-   struct exynos_drm_display *display;
+   struct exynos_drm_encoder *encoder;
 };
 
 static const struct of_device_id decon_driver_dt_match[] = {
@@ -681,8 +681,9 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
return PTR_ERR(ctx-crtc);
}
 
-   if (ctx-display)
-   exynos_drm_create_enc_conn(drm_dev, ctx-display);
+   if (ctx-encoder)
+   exynos_drm_create_enc_conn(drm_dev, ctx-encoder,
+  EXYNOS_DISPLAY_TYPE_LCD);
 
return 0;
 
@@ -695,8 +696,8 @@ static void decon_unbind(struct device *dev, struct device 
*master,
 
decon_disable(ctx-crtc);
 
-   if (ctx-display)
-   exynos_dpi_remove(ctx-display);
+   if (ctx-encoder)
+   exynos_dpi_remove(ctx-encoder);
 
decon_ctx_remove(ctx);
 }
@@ -781,9 +782,9 @@ static int decon_probe(struct platform_device *pdev)
 
platform_set_drvdata(pdev, ctx);
 
-   ctx-display = exynos_dpi_probe(dev);
-   if (IS_ERR(ctx-display)) {
-   ret = PTR_ERR(ctx-display);
+   ctx-encoder = exynos_dpi_probe(dev);
+   if (IS_ERR(ctx-encoder)) {
+   ret = PTR_ERR(ctx-encoder);
goto err_iounmap;
}
 
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 54f91e7..002a233 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -38,13 +38,13 @@
 
 static inline struct exynos_drm_crtc *dp_to_crtc(struct exynos_dp_device *dp)
 {
-   return to_exynos_crtc(dp-encoder-crtc);
+   return to_exynos_crtc(dp-encoder.base.crtc);
 }
 
-static inline struct exynos_dp_device *
-display_to_dp(struct exynos_drm_display *d)
+static inline struct exynos_dp_device *encoder_to_dp(
+   struct exynos_drm_encoder *e)
 {
-   return container_of(d, struct exynos_dp_device, display);
+   return container_of(e, struct exynos_dp_device, encoder);
 }
 
 struct bridge_init {
@@ -891,9 +891,9 @@ static void exynos_dp_hotplug(struct work_struct *work)
drm_helper_hpd_irq_event(dp-drm_dev);
 }
 
-static void exynos_dp_commit(struct exynos_drm_display *display)
+static void exynos_dp_commit(struct exynos_drm_encoder *encoder)
 {
-   struct exynos_dp_device *dp = display_to_dp(display);
+   struct exynos_dp_device *dp = encoder_to_dp(encoder);
int ret;
 
/* Keep the panel disabled while we configure video */
@@ -994,7 +994,7 @@ static struct drm_encoder *exynos_dp_best_encoder(
 {
struct exynos_dp_device *dp = ctx_from_connector(connector);
 
-   return dp-encoder;
+   return dp-encoder.base;
 }
 
 static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = {
@@ -1019,15 +1019,13 @@ static int exynos_drm_attach_lcd_bridge(struct 
exynos_dp_device *dp,
return 0;
 }
 
-static int exynos_dp_create_connector(struct exynos_drm_display *display,
-   struct drm_encoder *encoder)
+static int exynos_dp_create_connector

[PATCH v2 01/11] drm/exynos: split display's .dpms() into .enable() and .disable()

2015-08-05 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

The DRM Core doesn't have a dpms() operation anymore, everything
now is enable() or disable().

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk

---
v2: set dp-dpms_mode after enable/disable
---
 drivers/gpu/drm/exynos/exynos_dp_core.c | 34 ---
 drivers/gpu/drm/exynos/exynos_drm_dpi.c | 36 
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  6 ++-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 44 ++-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c |  8 ++--
 drivers/gpu/drm/exynos/exynos_hdmi.c| 65 ++---
 6 files changed, 62 insertions(+), 131 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 172b800..b3bf210 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1066,8 +1066,9 @@ static void exynos_dp_phy_exit(struct exynos_dp_device 
*dp)
phy_power_off(dp-phy);
 }
 
-static void exynos_dp_poweron(struct exynos_dp_device *dp)
+static void exynos_dp_enable(struct exynos_drm_display *display)
 {
+   struct exynos_dp_device *dp = display_to_dp(display);
struct exynos_drm_crtc *crtc = dp_to_crtc(dp);
 
if (dp-dpms_mode == DRM_MODE_DPMS_ON)
@@ -1090,8 +1091,9 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp)
exynos_dp_commit(dp-display);
 }
 
-static void exynos_dp_poweroff(struct exynos_dp_device *dp)
+static void exynos_dp_disable(struct exynos_drm_display *display)
 {
+   struct exynos_dp_device *dp = display_to_dp(display);
struct exynos_drm_crtc *crtc = dp_to_crtc(dp);
 
if (dp-dpms_mode != DRM_MODE_DPMS_ON)
@@ -1118,28 +1120,10 @@ static void exynos_dp_poweroff(struct exynos_dp_device 
*dp)
}
 }
 
-static void exynos_dp_dpms(struct exynos_drm_display *display, int mode)
-{
-   struct exynos_dp_device *dp = display_to_dp(display);
-
-   switch (mode) {
-   case DRM_MODE_DPMS_ON:
-   exynos_dp_poweron(dp);
-   break;
-   case DRM_MODE_DPMS_STANDBY:
-   case DRM_MODE_DPMS_SUSPEND:
-   case DRM_MODE_DPMS_OFF:
-   exynos_dp_poweroff(dp);
-   break;
-   default:
-   break;
-   }
-   dp-dpms_mode = mode;
-}
-
 static struct exynos_drm_display_ops exynos_dp_display_ops = {
.create_connector = exynos_dp_create_connector,
-   .dpms = exynos_dp_dpms,
+   .enable = exynos_dp_enable,
+   .disable = exynos_dp_disable,
.commit = exynos_dp_commit,
 };
 
@@ -1319,7 +1303,7 @@ static void exynos_dp_unbind(struct device *dev, struct 
device *master,
 {
struct exynos_dp_device *dp = dev_get_drvdata(dev);
 
-   exynos_dp_dpms(dp-display, DRM_MODE_DPMS_OFF);
+   exynos_dp_disable(dp-display);
 }
 
 static const struct component_ops exynos_dp_ops = {
@@ -1377,7 +1361,7 @@ static int exynos_dp_suspend(struct device *dev)
 {
struct exynos_dp_device *dp = dev_get_drvdata(dev);
 
-   exynos_dp_dpms(dp-display, DRM_MODE_DPMS_OFF);
+   exynos_dp_disable(dp-display);
return 0;
 }
 
@@ -1385,7 +1369,7 @@ static int exynos_dp_resume(struct device *dev)
 {
struct exynos_dp_device *dp = dev_get_drvdata(dev);
 
-   exynos_dp_dpms(dp-display, DRM_MODE_DPMS_ON);
+   exynos_dp_enable(dp-display);
return 0;
 }
 #endif
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 7cb6595..e042670 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -32,7 +32,6 @@ struct exynos_dpi {
struct drm_encoder *encoder;
 
struct videomode *vm;
-   int dpms_mode;
 };
 
 #define connector_to_dpi(c) container_of(c, struct exynos_dpi, connector)
@@ -133,46 +132,30 @@ static int exynos_dpi_create_connector(struct 
exynos_drm_display *display,
return 0;
 }
 
-static void exynos_dpi_poweron(struct exynos_dpi *ctx)
+static void exynos_dpi_enable(struct exynos_drm_display *display)
 {
+   struct exynos_dpi *ctx = display_to_dpi(display);
+
if (ctx-panel) {
drm_panel_prepare(ctx-panel);
drm_panel_enable(ctx-panel);
}
 }
 
-static void exynos_dpi_poweroff(struct exynos_dpi *ctx)
+static void exynos_dpi_disable(struct exynos_drm_display *display)
 {
+   struct exynos_dpi *ctx = display_to_dpi(display);
+
if (ctx-panel) {
drm_panel_disable(ctx-panel);
drm_panel_unprepare(ctx-panel);
}
 }
 
-static void exynos_dpi_dpms(struct exynos_drm_display *display, int mode)
-{
-   struct exynos_dpi *ctx = display_to_dpi(display);
-
-   switch (mode) {
-   case DRM_MODE_DPMS_ON:
-   if (ctx-dpms_mode != DRM_MODE_DPMS_ON)
-   exynos_dpi_poweron(ctx);
-   break

Re: [PATCH 11/11] drm/exynos: remove struct exynos_drm_encoder layer

2015-08-04 Thread Gustavo Padovan
Hi Inki,

2015-08-04 Inki Dae inki@samsung.com:

 On 2015년 08월 04일 04:09, Gustavo Padovan wrote:
  From: Gustavo Padovan gustavo.pado...@collabora.co.uk
  
  struct exynos_drm_encoder was justing wrapping struct drm_encoder, it had
  only a drm_encoder member and the internal exynos_drm_encoders ops that
  was directly mapped to the drm_encoder helper funcs.
  
  So now exynos DRM uses struct drm_encoder directly, this removes
  completely the struct exynos_drm_encoder.
  
  Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
  ---
   drivers/gpu/drm/exynos/Makefile |   7 +-
   drivers/gpu/drm/exynos/exynos7_drm_decon.c  |   2 +-
   drivers/gpu/drm/exynos/exynos_dp_core.c |  68 --
   drivers/gpu/drm/exynos/exynos_dp_core.h |   2 +-
   drivers/gpu/drm/exynos/exynos_drm_core.c|   1 -
   drivers/gpu/drm/exynos/exynos_drm_crtc.c|   1 -
   drivers/gpu/drm/exynos/exynos_drm_dpi.c |  51 --
   drivers/gpu/drm/exynos/exynos_drm_drv.c |   1 -
   drivers/gpu/drm/exynos/exynos_drm_drv.h |  47 ++---
   drivers/gpu/drm/exynos/exynos_drm_dsi.c |  80 +++--
   drivers/gpu/drm/exynos/exynos_drm_encoder.c | 105 
  
   drivers/gpu/drm/exynos/exynos_drm_encoder.h |  22 --
   drivers/gpu/drm/exynos/exynos_drm_fimd.c|   2 +-
   drivers/gpu/drm/exynos/exynos_drm_vidi.c|  71 ++-
   drivers/gpu/drm/exynos/exynos_hdmi.c|  85 +-
   15 files changed, 236 insertions(+), 309 deletions(-)
   delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.c
   delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.h
 
 [-- SNIP --]
 
  diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c 
  b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
  index d791ad4..a87d030 100644
  --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
  +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
  @@ -30,7 +30,6 @@
   #include video/videomode.h
   
   #include exynos_drm_crtc.h
  -#include exynos_drm_encoder.h
   #include exynos_drm_drv.h
   
   /* returns true iff both arguments logically differs */
  @@ -260,7 +259,7 @@ struct exynos_dsi_driver_data {
   };
   
   struct exynos_dsi {
  -   struct exynos_drm_encoder encoder;
  +   struct drm_encoder encoder;
  struct mipi_dsi_host dsi_host;
  struct drm_connector connector;
  struct device_node *panel_node;
  @@ -296,7 +295,7 @@ struct exynos_dsi {
   #define host_to_dsi(host) container_of(host, struct exynos_dsi, dsi_host)
   #define connector_to_dsi(c) container_of(c, struct exynos_dsi, connector)
   
  -static inline struct exynos_dsi *encoder_to_dsi(struct exynos_drm_encoder 
  *e)
  +static inline struct exynos_dsi *encoder_to_dsi(struct drm_encoder *e)
   {
  return container_of(e, struct exynos_dsi, encoder);
   }
  @@ -1273,7 +1272,7 @@ static irqreturn_t exynos_dsi_irq(int irq, void 
  *dev_id)
   static irqreturn_t exynos_dsi_te_irq_handler(int irq, void *dev_id)
   {
  struct exynos_dsi *dsi = (struct exynos_dsi *)dev_id;
  -   struct drm_encoder *encoder = dsi-encoder.base;
  +   struct drm_encoder *encoder = dsi-encoder;
   
  if (dsi-state  DSIM_STATE_VIDOUT_AVAILABLE)
  exynos_drm_crtc_te_handler(encoder-crtc);
  @@ -1519,7 +1518,7 @@ static void exynos_dsi_poweroff(struct exynos_dsi 
  *dsi)
  dev_err(dsi-dev, cannot disable regulators %d\n, ret);
   }
   
  -static void exynos_dsi_enable(struct exynos_drm_encoder *encoder)
  +static void exynos_dsi_enable(struct drm_encoder *encoder)
   {
  struct exynos_dsi *dsi = encoder_to_dsi(encoder);
  int ret;
  @@ -1555,7 +1554,7 @@ static void exynos_dsi_enable(struct 
  exynos_drm_encoder *encoder)
  dsi-state |= DSIM_STATE_VIDOUT_AVAILABLE;
   }
   
  -static void exynos_dsi_disable(struct exynos_drm_encoder *encoder)
  +static void exynos_dsi_disable(struct drm_encoder *encoder)
   {
  struct exynos_dsi *dsi = encoder_to_dsi(encoder);
   
  @@ -1583,7 +1582,7 @@ exynos_dsi_detect(struct drm_connector *connector, 
  bool force)
  if (dsi-panel)
  drm_panel_attach(dsi-panel, dsi-connector);
  } else if (!dsi-panel_node) {
  -   struct exynos_drm_encoder *encoder;
  +   struct drm_encoder *encoder;
   
  encoder = platform_get_drvdata(to_platform_device(dsi-dev));
  exynos_dsi_disable(encoder);
  @@ -1629,7 +1628,7 @@ exynos_dsi_best_encoder(struct drm_connector 
  *connector)
   {
  struct exynos_dsi *dsi = connector_to_dsi(connector);
   
  -   return dsi-encoder.base;
  +   return dsi-encoder;
   }
   
   static struct drm_connector_helper_funcs exynos_dsi_connector_helper_funcs 
  = {
  @@ -1637,11 +1636,9 @@ static struct drm_connector_helper_funcs 
  exynos_dsi_connector_helper_funcs = {
  .best_encoder = exynos_dsi_best_encoder,
   };
   
  -static int exynos_dsi_create_connector(
  -   struct

[PATCH 01/11] drm/exynos: split display's .dpms() into .enable() and .disable()

2015-08-03 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

The DRM Core doesn't have a dpms() operation anymore, everything
now is enable() or disable().

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_dp_core.c | 37 
 drivers/gpu/drm/exynos/exynos_drm_dpi.c | 36 
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  6 ++-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 44 ++-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c |  8 ++--
 drivers/gpu/drm/exynos/exynos_hdmi.c| 65 ++---
 6 files changed, 62 insertions(+), 134 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 172b800..f2cc8f1 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1066,8 +1066,9 @@ static void exynos_dp_phy_exit(struct exynos_dp_device 
*dp)
phy_power_off(dp-phy);
 }
 
-static void exynos_dp_poweron(struct exynos_dp_device *dp)
+static void exynos_dp_enable(struct exynos_drm_display *display)
 {
+   struct exynos_dp_device *dp = display_to_dp(display);
struct exynos_drm_crtc *crtc = dp_to_crtc(dp);
 
if (dp-dpms_mode == DRM_MODE_DPMS_ON)
@@ -1090,13 +1091,11 @@ static void exynos_dp_poweron(struct exynos_dp_device 
*dp)
exynos_dp_commit(dp-display);
 }
 
-static void exynos_dp_poweroff(struct exynos_dp_device *dp)
+static void exynos_dp_disable(struct exynos_drm_display *display)
 {
+   struct exynos_dp_device *dp = display_to_dp(display);
struct exynos_drm_crtc *crtc = dp_to_crtc(dp);
 
-   if (dp-dpms_mode != DRM_MODE_DPMS_ON)
-   return;
-
if (dp-panel) {
if (drm_panel_disable(dp-panel)) {
DRM_ERROR(failed to disable the panel\n);
@@ -1118,28 +1117,10 @@ static void exynos_dp_poweroff(struct exynos_dp_device 
*dp)
}
 }
 
-static void exynos_dp_dpms(struct exynos_drm_display *display, int mode)
-{
-   struct exynos_dp_device *dp = display_to_dp(display);
-
-   switch (mode) {
-   case DRM_MODE_DPMS_ON:
-   exynos_dp_poweron(dp);
-   break;
-   case DRM_MODE_DPMS_STANDBY:
-   case DRM_MODE_DPMS_SUSPEND:
-   case DRM_MODE_DPMS_OFF:
-   exynos_dp_poweroff(dp);
-   break;
-   default:
-   break;
-   }
-   dp-dpms_mode = mode;
-}
-
 static struct exynos_drm_display_ops exynos_dp_display_ops = {
.create_connector = exynos_dp_create_connector,
-   .dpms = exynos_dp_dpms,
+   .enable = exynos_dp_enable,
+   .disable = exynos_dp_disable,
.commit = exynos_dp_commit,
 };
 
@@ -1319,7 +1300,7 @@ static void exynos_dp_unbind(struct device *dev, struct 
device *master,
 {
struct exynos_dp_device *dp = dev_get_drvdata(dev);
 
-   exynos_dp_dpms(dp-display, DRM_MODE_DPMS_OFF);
+   exynos_dp_disable(dp-display);
 }
 
 static const struct component_ops exynos_dp_ops = {
@@ -1377,7 +1358,7 @@ static int exynos_dp_suspend(struct device *dev)
 {
struct exynos_dp_device *dp = dev_get_drvdata(dev);
 
-   exynos_dp_dpms(dp-display, DRM_MODE_DPMS_OFF);
+   exynos_dp_disable(dp-display);
return 0;
 }
 
@@ -1385,7 +1366,7 @@ static int exynos_dp_resume(struct device *dev)
 {
struct exynos_dp_device *dp = dev_get_drvdata(dev);
 
-   exynos_dp_dpms(dp-display, DRM_MODE_DPMS_ON);
+   exynos_dp_enable(dp-display);
return 0;
 }
 #endif
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 7cb6595..e042670 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -32,7 +32,6 @@ struct exynos_dpi {
struct drm_encoder *encoder;
 
struct videomode *vm;
-   int dpms_mode;
 };
 
 #define connector_to_dpi(c) container_of(c, struct exynos_dpi, connector)
@@ -133,46 +132,30 @@ static int exynos_dpi_create_connector(struct 
exynos_drm_display *display,
return 0;
 }
 
-static void exynos_dpi_poweron(struct exynos_dpi *ctx)
+static void exynos_dpi_enable(struct exynos_drm_display *display)
 {
+   struct exynos_dpi *ctx = display_to_dpi(display);
+
if (ctx-panel) {
drm_panel_prepare(ctx-panel);
drm_panel_enable(ctx-panel);
}
 }
 
-static void exynos_dpi_poweroff(struct exynos_dpi *ctx)
+static void exynos_dpi_disable(struct exynos_drm_display *display)
 {
+   struct exynos_dpi *ctx = display_to_dpi(display);
+
if (ctx-panel) {
drm_panel_disable(ctx-panel);
drm_panel_unprepare(ctx-panel);
}
 }
 
-static void exynos_dpi_dpms(struct exynos_drm_display *display, int mode)
-{
-   struct exynos_dpi *ctx = display_to_dpi(display);
-
-   switch (mode) {
-   case DRM_MODE_DPMS_ON:
-   if (ctx

[PATCH 11/11] drm/exynos: remove struct exynos_drm_encoder layer

2015-08-03 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

struct exynos_drm_encoder was justing wrapping struct drm_encoder, it had
only a drm_encoder member and the internal exynos_drm_encoders ops that
was directly mapped to the drm_encoder helper funcs.

So now exynos DRM uses struct drm_encoder directly, this removes
completely the struct exynos_drm_encoder.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/Makefile |   7 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c  |   2 +-
 drivers/gpu/drm/exynos/exynos_dp_core.c |  68 --
 drivers/gpu/drm/exynos/exynos_dp_core.h |   2 +-
 drivers/gpu/drm/exynos/exynos_drm_core.c|   1 -
 drivers/gpu/drm/exynos/exynos_drm_crtc.c|   1 -
 drivers/gpu/drm/exynos/exynos_drm_dpi.c |  51 --
 drivers/gpu/drm/exynos/exynos_drm_drv.c |   1 -
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  47 ++---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |  80 +++--
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 105 
 drivers/gpu/drm/exynos/exynos_drm_encoder.h |  22 --
 drivers/gpu/drm/exynos/exynos_drm_fimd.c|   2 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c|  71 ++-
 drivers/gpu/drm/exynos/exynos_hdmi.c|  85 +-
 15 files changed, 236 insertions(+), 309 deletions(-)
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.c
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.h

diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile
index 7de0b10..61c2906 100644
--- a/drivers/gpu/drm/exynos/Makefile
+++ b/drivers/gpu/drm/exynos/Makefile
@@ -3,10 +3,9 @@
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
 ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/exynos
-exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o \
-   exynos_drm_crtc.o exynos_drm_fbdev.o exynos_drm_fb.o \
-   exynos_drm_buf.o exynos_drm_gem.o exynos_drm_core.o \
-   exynos_drm_plane.o exynos_drm_dmabuf.o
+exynosdrm-y := exynos_drm_drv.o exynos_drm_crtc.o exynos_drm_fbdev.o \
+   exynos_drm_fb.o exynos_drm_buf.o exynos_drm_gem.o \
+   exynos_drm_core.o exynos_drm_plane.o exynos_drm_dmabuf.o
 
 exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD)+= exynos_drm_fimd.o
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index e1a2ce7..0792654 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -61,7 +61,7 @@ struct decon_context {
atomic_twait_vsync_event;
 
struct exynos_drm_panel_info panel;
-   struct exynos_drm_encoder *encoder;
+   struct drm_encoder *encoder;
 };
 
 static const struct of_device_id decon_driver_dt_match[] = {
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index a4a902a..19ed422 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -32,18 +32,18 @@
 #include drm/drm_panel.h
 
 #include exynos_dp_core.h
-#include exynos_drm_encoder.h
+#include exynos_drm_crtc.h
 
 #define ctx_from_connector(c)  container_of(c, struct exynos_dp_device, \
connector)
 
 static inline struct exynos_drm_crtc *dp_to_crtc(struct exynos_dp_device *dp)
 {
-   return to_exynos_crtc(dp-encoder.base.crtc);
+   return to_exynos_crtc(dp-encoder.crtc);
 }
 
 static inline struct exynos_dp_device *encoder_to_dp(
-   struct exynos_drm_encoder *e)
+   struct drm_encoder *e)
 {
return container_of(e, struct exynos_dp_device, encoder);
 }
@@ -889,7 +889,7 @@ static void exynos_dp_hotplug(struct work_struct *work)
drm_helper_hpd_irq_event(dp-drm_dev);
 }
 
-static void exynos_dp_commit(struct exynos_drm_encoder *encoder)
+static void exynos_dp_commit(struct drm_encoder *encoder)
 {
struct exynos_dp_device *dp = encoder_to_dp(encoder);
int ret;
@@ -995,7 +995,7 @@ static struct drm_encoder *exynos_dp_best_encoder(
 {
struct exynos_dp_device *dp = ctx_from_connector(connector);
 
-   return dp-encoder.base;
+   return dp-encoder;
 }
 
 static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = {
@@ -1020,10 +1020,9 @@ static int exynos_drm_attach_lcd_bridge(struct 
exynos_dp_device *dp,
return 0;
 }
 
-static int exynos_dp_create_connector(struct exynos_drm_encoder 
*exynos_encoder)
+static int exynos_dp_create_connector(struct drm_encoder *encoder)
 {
-   struct exynos_dp_device *dp = encoder_to_dp(exynos_encoder);
-   struct drm_encoder *encoder = exynos_encoder-base;
+   struct exynos_dp_device *dp

[PATCH 02/11] drm/exynos: remove wrappers for phy_power_{on,off}

2015-08-03 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

phy_power_on() and phy_power_off() already checks for NULL pointer.
This patch removes the wrappers exynos_dp_phy_init() and
exynos_dp_phy_exit() since the only think they were doing was a check for
NULL phy.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_dp_core.c | 18 +++---
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index f2cc8f1..fe38d6f 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1054,18 +1054,6 @@ static int exynos_dp_create_connector(struct 
exynos_drm_display *display,
return ret;
 }
 
-static void exynos_dp_phy_init(struct exynos_dp_device *dp)
-{
-   if (dp-phy)
-   phy_power_on(dp-phy);
-}
-
-static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
-{
-   if (dp-phy)
-   phy_power_off(dp-phy);
-}
-
 static void exynos_dp_enable(struct exynos_drm_display *display)
 {
struct exynos_dp_device *dp = display_to_dp(display);
@@ -1085,7 +1073,7 @@ static void exynos_dp_enable(struct exynos_drm_display 
*display)
crtc-ops-clock_enable(dp_to_crtc(dp), true);
 
clk_prepare_enable(dp-clock);
-   exynos_dp_phy_init(dp);
+   phy_power_on(dp-phy);
exynos_dp_init_dp(dp);
enable_irq(dp-irq);
exynos_dp_commit(dp-display);
@@ -1105,7 +1093,7 @@ static void exynos_dp_disable(struct exynos_drm_display 
*display)
 
disable_irq(dp-irq);
flush_work(dp-hotplug_work);
-   exynos_dp_phy_exit(dp);
+   phy_power_off(dp-phy);
clk_disable_unprepare(dp-clock);
 
if (crtc-ops-clock_enable)
@@ -1278,7 +1266,7 @@ static int exynos_dp_bind(struct device *dev, struct 
device *master, void *data)
 
INIT_WORK(dp-hotplug_work, exynos_dp_hotplug);
 
-   exynos_dp_phy_init(dp);
+   phy_power_on(dp-phy);
 
exynos_dp_init_dp(dp);
 
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/11] drm/exynos: remove extra call to hdmi_commit()

2015-08-03 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

hdmi_commit() was getting called twice by exynos encoder core, once inside
the .enable() call and another time by .commit() itself.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 1aed7ea..11bac50 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1711,16 +1711,6 @@ static void hdmi_mode_set(struct exynos_drm_encoder 
*encoder,
hdata-cea_video_id = drm_match_cea_mode(mode);
 }
 
-static void hdmi_commit(struct exynos_drm_encoder *encoder)
-{
-   struct hdmi_context *hdata = encoder_to_hdmi(encoder);
-
-   if (!hdata-powered)
-   return;
-
-   hdmi_conf_apply(hdata);
-}
-
 static void hdmi_enable(struct exynos_drm_encoder *encoder)
 {
struct hdmi_context *hdata = encoder_to_hdmi(encoder);
@@ -1744,7 +1734,7 @@ static void hdmi_enable(struct exynos_drm_encoder 
*encoder)
clk_prepare_enable(res-sclk_hdmi);
 
hdmiphy_poweron(hdata);
-   hdmi_commit(encoder);
+   hdmi_conf_apply(hdata);
 }
 
 static void hdmi_disable(struct exynos_drm_encoder *encoder)
@@ -1798,7 +1788,6 @@ static struct exynos_drm_encoder_ops hdmi_encoder_ops = {
.mode_set   = hdmi_mode_set,
.enable = hdmi_enable,
.disable= hdmi_disable,
-   .commit = hdmi_commit,
 };
 
 static void hdmi_hotplug_work_func(struct work_struct *work)
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/11] drm/exynos: remove struct exynos_drm_display

2015-08-03 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

This struct was just representing encoder information, it was a member of
struct exynos_drm_encoder, so any code trying to access encoder data would
have to go through the encoder struct, get the display struct and then get
the data it want.

During this patchset we also realized that the only data
exynos_drm_encoder needs to store is the drm_encoder parent and the
exynos_drm_encoder_ops.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c  | 17 ---
 drivers/gpu/drm/exynos/exynos_dp_core.c | 46 +-
 drivers/gpu/drm/exynos/exynos_dp_core.h |  3 +-
 drivers/gpu/drm/exynos/exynos_drm_core.c| 23 -
 drivers/gpu/drm/exynos/exynos_drm_crtc.c|  2 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.h|  2 +-
 drivers/gpu/drm/exynos/exynos_drm_dpi.c | 41 
 drivers/gpu/drm/exynos/exynos_drm_drv.h | 47 --
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 58 +++---
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 75 -
 drivers/gpu/drm/exynos/exynos_drm_encoder.h |  6 +--
 drivers/gpu/drm/exynos/exynos_drm_fimd.c| 18 +++
 drivers/gpu/drm/exynos/exynos_drm_vidi.c| 43 +
 drivers/gpu/drm/exynos/exynos_hdmi.c| 48 +-
 14 files changed, 177 insertions(+), 252 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index cfd0b5e..1b89e94 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -61,7 +61,7 @@ struct decon_context {
atomic_twait_vsync_event;
 
struct exynos_drm_panel_info panel;
-   struct exynos_drm_display *display;
+   struct exynos_drm_encoder *encoder;
 };
 
 static const struct of_device_id decon_driver_dt_match[] = {
@@ -681,8 +681,9 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
return PTR_ERR(ctx-crtc);
}
 
-   if (ctx-display)
-   exynos_drm_create_enc_conn(drm_dev, ctx-display);
+   if (ctx-encoder)
+   exynos_drm_create_enc_conn(drm_dev, ctx-encoder,
+  EXYNOS_DISPLAY_TYPE_LCD);
 
return 0;
 
@@ -695,8 +696,8 @@ static void decon_unbind(struct device *dev, struct device 
*master,
 
decon_disable(ctx-crtc);
 
-   if (ctx-display)
-   exynos_dpi_remove(ctx-display);
+   if (ctx-encoder)
+   exynos_dpi_remove(ctx-encoder);
 
decon_ctx_remove(ctx);
 }
@@ -781,9 +782,9 @@ static int decon_probe(struct platform_device *pdev)
 
platform_set_drvdata(pdev, ctx);
 
-   ctx-display = exynos_dpi_probe(dev);
-   if (IS_ERR(ctx-display)) {
-   ret = PTR_ERR(ctx-display);
+   ctx-encoder = exynos_dpi_probe(dev);
+   if (IS_ERR(ctx-encoder)) {
+   ret = PTR_ERR(ctx-encoder);
goto err_iounmap;
}
 
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index fe38d6f..dd1809b 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -38,13 +38,13 @@
 
 static inline struct exynos_drm_crtc *dp_to_crtc(struct exynos_dp_device *dp)
 {
-   return to_exynos_crtc(dp-encoder-crtc);
+   return to_exynos_crtc(dp-encoder.base.crtc);
 }
 
-static inline struct exynos_dp_device *
-display_to_dp(struct exynos_drm_display *d)
+static inline struct exynos_dp_device *encoder_to_dp(
+   struct exynos_drm_encoder *e)
 {
-   return container_of(d, struct exynos_dp_device, display);
+   return container_of(e, struct exynos_dp_device, encoder);
 }
 
 struct bridge_init {
@@ -891,9 +891,9 @@ static void exynos_dp_hotplug(struct work_struct *work)
drm_helper_hpd_irq_event(dp-drm_dev);
 }
 
-static void exynos_dp_commit(struct exynos_drm_display *display)
+static void exynos_dp_commit(struct exynos_drm_encoder *encoder)
 {
-   struct exynos_dp_device *dp = display_to_dp(display);
+   struct exynos_dp_device *dp = encoder_to_dp(encoder);
int ret;
 
/* Keep the panel disabled while we configure video */
@@ -994,7 +994,7 @@ static struct drm_encoder *exynos_dp_best_encoder(
 {
struct exynos_dp_device *dp = ctx_from_connector(connector);
 
-   return dp-encoder;
+   return dp-encoder.base;
 }
 
 static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = {
@@ -1019,15 +1019,13 @@ static int exynos_drm_attach_lcd_bridge(struct 
exynos_dp_device *dp,
return 0;
 }
 
-static int exynos_dp_create_connector(struct exynos_drm_display *display,
-   struct drm_encoder *encoder)
+static int exynos_dp_create_connector

[PATCH 08/11] drm/exynos: remove exynos_encoder's .commit() op

2015-08-03 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

.commit() is not used anymore, Exynos encoders now follow the
.enable()/.disable() semantics from drm atomic core, so remove this
callback.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 --
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 3 ---
 2 files changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 4931193..76ed6a1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -87,7 +87,6 @@ struct exynos_drm_plane {
  *   would be called by encoder-mode_set().
  * @enable: display device on.
  * @disable: display device off.
- * @commit: apply changes to hw
  */
 struct exynos_drm_encoder;
 struct exynos_drm_encoder_ops {
@@ -100,7 +99,6 @@ struct exynos_drm_encoder_ops {
struct drm_display_mode *mode);
void (*enable)(struct exynos_drm_encoder *encoder);
void (*disable)(struct exynos_drm_encoder *encoder);
-   void (*commit)(struct exynos_drm_encoder *encoder);
 };
 
 /*
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c 
b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index b9a1c93..ce7b97e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -56,9 +56,6 @@ static void exynos_drm_encoder_enable(struct drm_encoder 
*encoder)
 
if (exynos_encoder-ops-enable)
exynos_encoder-ops-enable(exynos_encoder);
-
-   if (exynos_encoder-ops-commit)
-   exynos_encoder-ops-commit(exynos_encoder);
 }
 
 static void exynos_drm_encoder_disable(struct drm_encoder *encoder)
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/11] drm/exynos: simplify calculation of possible CRTCs

2015-08-03 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

All CRTCs can only be LCD, HDMI or VIDI, so basically all CRTCs will be a
possible CRTCs. This patch removes an extra function with switch that was
only checking if the CRTC type was one of those three above.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 29 +
 1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c 
b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 0aa4a58..7ba3a2d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -105,36 +105,17 @@ static struct drm_encoder_funcs exynos_encoder_funcs = {
.destroy = exynos_drm_encoder_destroy,
 };
 
-static unsigned int exynos_drm_encoder_clones(struct drm_encoder *encoder)
+void exynos_drm_encoder_setup(struct drm_device *dev)
 {
-   struct drm_encoder *clone;
-   struct drm_device *dev = encoder-dev;
-   struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
-   struct exynos_drm_display *display = exynos_encoder-display;
+   struct drm_encoder *encoder;
unsigned int clone_mask = 0;
int cnt = 0;
 
-   list_for_each_entry(clone, dev-mode_config.encoder_list, head) {
-   switch (display-type) {
-   case EXYNOS_DISPLAY_TYPE_LCD:
-   case EXYNOS_DISPLAY_TYPE_HDMI:
-   case EXYNOS_DISPLAY_TYPE_VIDI:
-   clone_mask |= (1  (cnt++));
-   break;
-   default:
-   continue;
-   }
-   }
-
-   return clone_mask;
-}
-
-void exynos_drm_encoder_setup(struct drm_device *dev)
-{
-   struct drm_encoder *encoder;
+   list_for_each_entry(encoder, dev-mode_config.encoder_list, head)
+   clone_mask |= (1  (cnt++));
 
list_for_each_entry(encoder, dev-mode_config.encoder_list, head)
-   encoder-possible_clones = exynos_drm_encoder_clones(encoder);
+   encoder-possible_clones = clone_mask;
 }
 
 struct drm_encoder *
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   3   4   5   6   >