[PATCH 2/2] ARM: dts: add exynos5420-fimd compatible

2016-02-12 Thread Chanho Park
This patch changes the compatible of exynos5420 fimd
to "exynos5420-fimd". To support mic bypass from display
path, the new compatible is introduced for exynos5420.

Cc: Inki Dae 
Cc: Kukjin Kim 
Cc: Krzysztof Kozlowski 
Signed-off-by: Chanho Park 
---
 arch/arm/boot/dts/exynos5420.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/exynos5420.dtsi 
b/arch/arm/boot/dts/exynos5420.dtsi
index 48a0a55..252c7a3 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -1151,6 +1151,7 @@
 };

  {
+   compatible = "samsung,exynos5420-fimd";
clocks = < CLK_SCLK_FIMD1>, < CLK_FIMD1>;
clock-names = "sclk_fimd", "fimd";
power-domains = <_pd>;
-- 
2.5.0



[PATCH 1/2] drm/exynos: add exynos5420 support for fimd

2016-02-12 Thread Chanho Park
This patch adds a exynos5420 driver data to support mic_bypass
option to bypass the mic from display out path.
The mic(Mobile image compressor) compresses RGB data from fimd
and send the compressed data to the mipi dsi.
The bypass option can be founded from system register and the bit
is 11. The option bit has been introduced since exynos5420. The
only difference between exynos5250 and exynos5420/exynos5422 is
existence of the bit. Until the MIC is defined and enabled from
device tree, the bypass mic will be default option.

Cc: Inki Dae 
Cc: Joonyoung Shim 
Cc: Seung-Woo Kim 
Signed-off-by: Chanho Park 
---
 .../bindings/display/exynos/samsung-fimd.txt   |  3 ++-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 31 +-
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt 
b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
index 27c3ce0..c7c6b9a 100644
--- a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
+++ b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
@@ -12,7 +12,8 @@ Required properties:
"samsung,exynos3250-fimd"; /* for Exynos3250/3472 SoCs */
"samsung,exynos4210-fimd"; /* for Exynos4 SoCs */
"samsung,exynos4415-fimd"; /* for Exynos4415 SoC */
-   "samsung,exynos5250-fimd"; /* for Exynos5 SoCs */
+   "samsung,exynos5250-fimd"; /* for Exynos5250 SoCs */
+   "samsung,exynos5420-fimd"; /* for Exynos5420/5422/5800 SoCs */

 - reg: physical base address and length of the FIMD registers set.

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 70194d0..41c3bb2 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -94,12 +94,14 @@ struct fimd_driver_data {
unsigned int lcdblk_offset;
unsigned int lcdblk_vt_shift;
unsigned int lcdblk_bypass_shift;
+   unsigned int lcdblk_mic_bypass_shift;

unsigned int has_shadowcon:1;
unsigned int has_clksel:1;
unsigned int has_limited_fmt:1;
unsigned int has_vidoutcon:1;
unsigned int has_vtsel:1;
+   unsigned int has_mic_bypass:1;
 };

 static struct fimd_driver_data s3c64xx_fimd_driver_data = {
@@ -145,6 +147,18 @@ static struct fimd_driver_data exynos5_fimd_driver_data = {
.has_vtsel = 1,
 };

+static struct fimd_driver_data exynos5420_fimd_driver_data = {
+   .timing_base = 0x2,
+   .lcdblk_offset = 0x214,
+   .lcdblk_vt_shift = 24,
+   .lcdblk_bypass_shift = 15,
+   .lcdblk_mic_bypass_shift = 11,
+   .has_shadowcon = 1,
+   .has_vidoutcon = 1,
+   .has_vtsel = 1,
+   .has_mic_bypass = 1,
+};
+
 struct fimd_context {
struct device   *dev;
struct drm_device   *drm_dev;
@@ -184,6 +198,8 @@ static const struct of_device_id fimd_driver_dt_match[] = {
  .data = _fimd_driver_data },
{ .compatible = "samsung,exynos5250-fimd",
  .data = _fimd_driver_data },
+   { .compatible = "samsung,exynos5420-fimd",
+ .data = _fimd_driver_data },
{},
 };
 MODULE_DEVICE_TABLE(of, fimd_driver_dt_match);
@@ -461,6 +477,18 @@ static void fimd_commit(struct exynos_drm_crtc *crtc)
return;
}

+   /* TODO: When MIC is enabled for display path, the lcdblk_mic_bypass
+* bit should be cleared.
+*/
+   if (driver_data->has_mic_bypass && ctx->sysreg &&
+   regmap_update_bits(ctx->sysreg,
+   driver_data->lcdblk_offset,
+   0x1 << driver_data->lcdblk_mic_bypass_shift,
+   0x1 << driver_data->lcdblk_mic_bypass_shift)) {
+   DRM_ERROR("Failed to update sysreg for bypass mic.\n");
+   return;
+   }
+
/* setup horizontal and vertical display size. */
val = VIDTCON2_LINEVAL(mode->vdisplay - 1) |
   VIDTCON2_HOZVAL(mode->hdisplay - 1) |
@@ -861,7 +889,8 @@ static void fimd_dp_clock_enable(struct exynos_drm_crtc 
*crtc, bool enable)
 * 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)
+   if (ctx->driver_data != _fimd_driver_data ||
+   ctx->driver_data != _fimd_driver_data)
return;

val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE;
-- 
2.5.0



[PATCH 0/2] Support exynos5420-fimd

2016-02-12 Thread Chanho Park
This patchset introduces exynos5420-fimd compatible to support
a mic-bypass option from display path. Since exynos5420, the
option has been introduced and controlled by system register.
The option is only available for exynos5420/exynos5422 and 5800,
we need to add the new exynos5420-fimd compatible.

Chanho Park (2):
  drm/exynos: add exynos5420 support for fimd
  ARM: dts: add exynos5420-fimd compatible

 .../bindings/display/exynos/samsung-fimd.txt   |  3 ++-
 arch/arm/boot/dts/exynos5420.dtsi  |  1 +
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 31 +-
 3 files changed, 33 insertions(+), 2 deletions(-)

-- 
2.5.0



[Intel-gfx] [PATCH v10 3/4] drm/i915: Set aux.dev to the drm_connector device, instead of drm_device.

2016-02-12 Thread Imre Deak
On Thu, 2016-01-21 at 15:10 -0800, Rafael Antognolli wrote:
> So far, the i915 driver and some other drivers set it to the
> drm_device,
> which doesn't allow one to know which DP a given aux channel is
> related
> to. Changing this to be the drm_connector provides proper nesting,
> still
> allowing one to get the drm_device from it. Some drivers already set
> it
> to the drm_connector.
> 
> This also removes the need to add a sysfs link for the i2c device
> under
> the connector, as it will already be there.

Yes, having the i2c-dev only at one place under the connector is more
logical and what we want imo. It's an ABI change but if other drivers
already have it in this way then I assume it's fine. For HDMI
connectors we still have them under the drm_device (and there is no
symlink for them under the connector device) but this was inconsistent
already before this patch and can be fixed up later.

Adding Jani, in case he has comments on this.

Below one more comment:

> v9:
>  - As a side effect, drm_dp_aux_unregister() must be called before
>  intel_connector_unregister(), as both the aux.dev and the i2c
> adapter
>  dev are children of the drm_connector device now. Calling
>  drm_dp_aux_unregister() before prevents them from being destroyed
>  twice.
> 
> v10:
>  - move aux_fini() to connector_unregister(), instead of moving
>  drm_dp_aux_unregister() outside of connector_register().
> 
> Signed-off-by: Rafael Antognolli 
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 18 ++
>  1 file changed, 2 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c
> b/drivers/gpu/drm/i915/intel_dp.c
> index e2bea710..da704c6 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1188,7 +1188,6 @@ intel_dp_aux_fini(struct intel_dp *intel_dp)
>  static int
>  intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector
> *connector)
>  {
> - struct drm_device *dev = intel_dp_to_dev(intel_dp);
>  struct intel_digital_port *intel_dig_port =
> dp_to_dig_port(intel_dp);
>  enum port port = intel_dig_port->port;
>  int ret;
> @@ -1199,7 +1198,7 @@ intel_dp_aux_init(struct intel_dp *intel_dp,
> struct intel_connector *connector)
>  if (!intel_dp->aux.name)
>  return -ENOMEM;
>  
> - intel_dp->aux.dev = dev->dev;
> + intel_dp->aux.dev = connector->base.kdev;
>  intel_dp->aux.transfer = intel_dp_aux_transfer;
>  
>  DRM_DEBUG_KMS("registering %s bus for %s\n",
> @@ -1214,16 +1213,6 @@ intel_dp_aux_init(struct intel_dp *intel_dp,
> struct intel_connector *connector)
>  return ret;
>  }
>  
> - ret = sysfs_create_link(>base.kdev->kobj,
> - _dp->aux.ddc.dev.kobj,
> - intel_dp->aux.ddc.dev.kobj.name);
> - if (ret < 0) {
> - DRM_ERROR("sysfs_create_link() for %s failed
> (%d)\n",
> -   intel_dp->aux.name, ret);
> - intel_dp_aux_fini(intel_dp);
> - return ret;
> - }
> -
>  return 0;
>  }
>  
> @@ -1232,9 +1221,7 @@ intel_dp_connector_unregister(struct
> intel_connector *intel_connector)
>  {
>  struct intel_dp *intel_dp =
> intel_attached_dp(_connector->base);
>  
> - if (!intel_connector->mst_port)
> - sysfs_remove_link(_connector->base.kdev->kobj,
> -   intel_dp->aux.ddc.dev.kobj.name);
> + intel_dp_aux_fini(intel_dp);

Hrm, the mst_port check seems to have been misplaced at some point,
this function isn't called for virtual MST connectors. So I think it's
fine to remove it. The patch looks ok:

Reviewed-by: Imre Deak 

>  intel_connector_unregister(intel_connector);
>  }
>  
> @@ -4868,7 +4855,6 @@ void intel_dp_encoder_destroy(struct
> drm_encoder *encoder)
>  struct intel_digital_port *intel_dig_port =
> enc_to_dig_port(encoder);
>  struct intel_dp *intel_dp = _dig_port->dp;
>  
> - intel_dp_aux_fini(intel_dp);
>  intel_dp_mst_encoder_cleanup(intel_dig_port);
>  if (is_edp(intel_dp)) {
>  cancel_delayed_work_sync(_dp->panel_vdd_work);


[PATCH 6/6] drm/nouveau/display: Enable vblank irqs after display engine is on again.

2016-02-12 Thread Mario Kleiner
In the display resume path, move the calls to drm_vblank_on()
after the point when the display engine is running again.

Since changes were made to drm_update_vblank_count() in Linux 4.4+
to emulate hw vblank counters via vblank timestamping, the function
drm_vblank_on() now needs working high precision vblank timestamping
and therefore working scanout position queries at time of call.
These don't work before the display engine gets restarted, causing
miscalculation of vblank counter increments and thereby large forward
jumps in vblank count at display resume. These jumps can cause client
hangs on resume, or desktop hangs in the case of composited desktops.

Fix this Linux 4.4 regression by reordering calls accordingly.

Signed-off-by: Mario Kleiner 
Cc:  # 4.4+
Cc: Ben Skeggs 
Cc: ville.syrjala at linux.intel.com
Cc: daniel.vetter at ffwll.ch
Cc: dri-devel at lists.freedesktop.org
---
 drivers/gpu/drm/nouveau/nouveau_display.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c 
b/drivers/gpu/drm/nouveau/nouveau_display.c
index 18676b8..1f8e51b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -634,10 +634,6 @@ nouveau_display_resume(struct drm_device *dev, bool 
runtime)
nv_crtc->lut.depth = 0;
}

-   /* Make sure that drm and hw vblank irqs get resumed if needed. */
-   for (head = 0; head < dev->mode_config.num_crtc; head++)
-   drm_vblank_on(dev, head);
-
/* This should ensure we don't hit a locking problem when someone
 * wakes us up via a connector.  We should never go into suspend
 * while the display is on anyways.
@@ -647,6 +643,10 @@ nouveau_display_resume(struct drm_device *dev, bool 
runtime)

drm_helper_resume_force_mode(dev);

+   /* Make sure that drm and hw vblank irqs get resumed if needed. */
+   for (head = 0; head < dev->mode_config.num_crtc; head++)
+   drm_vblank_on(dev, head);
+
list_for_each_entry(crtc, >mode_config.crtc_list, head) {
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);

-- 
1.9.1



[PATCH 5/6] drm/radeon/pm: Handle failure of drm_vblank_get.

2016-02-12 Thread Mario Kleiner
Make sure that drm_vblank_get/put() stay balanced in
case drm_vblank_get fails, by skipping the corresponding
put.

Signed-off-by: Mario Kleiner 
Reviewed-by: Daniel Vetter 
Cc: michel at daenzer.net
Cc: dri-devel at lists.freedesktop.org
Cc: alexander.deucher at amd.com
Cc: christian.koenig at amd.com
---
 drivers/gpu/drm/radeon/radeon_pm.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_pm.c 
b/drivers/gpu/drm/radeon/radeon_pm.c
index 59abebd..a94979f 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -276,8 +276,12 @@ static void radeon_pm_set_clocks(struct radeon_device 
*rdev)
if (rdev->irq.installed) {
for (i = 0; i < rdev->num_crtc; i++) {
if (rdev->pm.active_crtcs & (1 << i)) {
-   rdev->pm.req_vblank |= (1 << i);
-   drm_vblank_get(rdev->ddev, i);
+   /* This can fail if a modeset is in progress */
+   if (drm_vblank_get(rdev->ddev, i) == 0)
+   rdev->pm.req_vblank |= (1 << i);
+   else
+   DRM_DEBUG_DRIVER("crtc %d no vblank, 
can glitch\n",
+i);
}
}
}
-- 
1.9.1



[PATCH 4/6] drm: Fix treatment of drm_vblank_offdelay in drm_vblank_on() (v2)

2016-02-12 Thread Mario Kleiner
drm_vblank_offdelay can have three different types of values:

< 0 is to be always treated the same as dev->vblank_disable_immediate
= 0 is to be treated as "never disable vblanks"
> 0 is to be treated as disable immediate if kms driver wants it
that way via dev->vblank_disable_immediate. Otherwise it is
a disable timeout in msecs.

This got broken in Linux 3.18+ for the implementation of
drm_vblank_on. If the user specified a value of zero which should
always reenable vblank irqs in this function, a kms driver could
override the users choice by setting vblank_disable_immediate
to true. This patch fixes the regression and keeps the user in
control.

v2: Only reenable vblank if there are clients left or the user
requested to "never disable vblanks" via offdelay 0. Enabling
vblanks even in the "delayed disable" case (offdelay > 0) was
specifically added by Ville in commit cd19e52aee922
("drm: Kick start vblank interrupts at drm_vblank_on()"),
but after discussion it turns out that this was done by accident.

Citing Ville: "I think it just ended up as a mess due to changing
some of the semantics of offdelay<0 vs. offdelay==0 vs.
disable_immediate during the review of the series. So yeah, given
how drm_vblank_put() works now, I'd just make this check for
offdelay==0."

Signed-off-by: Mario Kleiner 
Reviewed-by: Daniel Vetter 

Cc:  # 3.18+
Cc: michel at daenzer.net
Cc: vbabka at suse.cz
Cc: ville.syrjala at linux.intel.com
Cc: daniel.vetter at ffwll.ch
Cc: dri-devel at lists.freedesktop.org
Cc: alexander.deucher at amd.com
Cc: christian.koenig at amd.com
---
 drivers/gpu/drm/drm_irq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 055b0fa..8090989 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1494,8 +1494,7 @@ void drm_vblank_on(struct drm_device *dev, unsigned int 
pipe)
 * re-enable interrupts if there are users left, or the
 * user wishes vblank interrupts to be enabled all the time.
 */
-   if (atomic_read(>refcount) != 0 ||
-   (!dev->vblank_disable_immediate && drm_vblank_offdelay == 0))
+   if (atomic_read(>refcount) != 0 || drm_vblank_offdelay == 0)
WARN_ON(drm_vblank_enable(dev, pipe));
spin_unlock_irqrestore(>vbl_lock, irqflags);
 }
-- 
1.9.1



[PATCH 3/6] drm: Fix drm_vblank_pre/post_modeset regression from Linux 4.4

2016-02-12 Thread Mario Kleiner
Changes to drm_update_vblank_count() in Linux 4.4 broke the
behaviour of the pre/post modeset functions as the new update
code doesn't deal with hw vblank counter resets inbetween calls
to drm_vblank_pre_modeset an drm_vblank_post_modeset, as it
should.

This causes mistreatment of such hw counter resets as counter
wraparound, and thereby large forward jumps of the software
vblank counter which in turn cause vblank event dispatching
and vblank waits to fail/hang --> userspace clients hang.

This symptom was reported on radeon-kms to cause a infinite
hang of KDE Plasma 5 shell's login procedure, preventing users
from logging in.

Fix this by detecting when drm_update_vblank_count() is called
inside a pre->post modeset interval. If so, clamp valid vblank
increments to the safe values 0 and 1, pretty much restoring
the update behavior of the old update code of Linux 4.3 and
earlier. Also reset the last recorded hw vblank count at call
to drm_vblank_post_modeset() to be safe against hw that after
modesetting, dpms on etc. only fires its first vblank irq after
drm_vblank_post_modeset() was already called.

Reported-by: Vlastimil Babka 
Signed-off-by: Mario Kleiner 
Reviewed-by: Daniel Vetter 
Tested-by: Vlastimil Babka 

Cc:  # 4.4+
Cc: michel at daenzer.net
Cc: vbabka at suse.cz
Cc: ville.syrjala at linux.intel.com
Cc: daniel.vetter at ffwll.ch
Cc: dri-devel at lists.freedesktop.org
Cc: alexander.deucher at amd.com
Cc: christian.koenig at amd.com
---
 drivers/gpu/drm/drm_irq.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 92ad62f..055b0fa 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -222,6 +222,21 @@ static void drm_update_vblank_count(struct drm_device 
*dev, unsigned int pipe,
}

/*
+* Within a drm_vblank_pre_modeset - drm_vblank_post_modeset
+* interval? If so then vblank irqs keep running and it will likely
+* happen that the hardware vblank counter is not trustworthy as it
+* might reset at some point in that interval and vblank timestamps
+* are not trustworthy either in that interval. Iow. this can result
+* in a bogus diff >> 1 which must be avoided as it would cause
+* random large forward jumps of the software vblank counter.
+*/
+   if (diff > 1 && (vblank->inmodeset & 0x2)) {
+   DRM_DEBUG_VBL("clamping vblank bump to 1 on crtc %u: diffr=%u"
+ " due to pre-modeset.\n", pipe, diff);
+   diff = 1;
+   }
+
+   /*
 * FIMXE: Need to replace this hack with proper seqlocks.
 *
 * Restrict the bump of the software vblank counter to a safe maximum
@@ -1575,6 +1590,7 @@ void drm_vblank_post_modeset(struct drm_device *dev, 
unsigned int pipe)
if (vblank->inmodeset) {
spin_lock_irqsave(>vbl_lock, irqflags);
dev->vblank_disable_allowed = true;
+   drm_reset_vblank_timestamp(dev, pipe);
spin_unlock_irqrestore(>vbl_lock, irqflags);

if (vblank->inmodeset & 0x2)
-- 
1.9.1



[PATCH 2/6] drm: Prevent vblank counter bumps > 1 with active vblank clients. (v2)

2016-02-12 Thread Mario Kleiner
This fixes a regression introduced by the new drm_update_vblank_count()
implementation in Linux 4.4:

Restrict the bump of the software vblank counter in drm_update_vblank_count()
to a safe maximum value of +1 whenever there is the possibility that
concurrent readers of vblank timestamps could be active at the moment,
as the current implementation of the timestamp caching and updating is
not safe against concurrent readers for calls to store_vblank() with a
bump of anything but +1. A bump != 1 would very likely return corrupted
timestamps to userspace, because the same slot in the cache could
be concurrently written by store_vblank() and read by one of those
readers in a non-atomic fashion and without the read-retry logic
detecting this collision.

Concurrent readers can exist while drm_update_vblank_count() is called
from the drm_vblank_off() or drm_vblank_on() functions or other non-vblank-
irq callers. However, all those calls are happening with the vbl_lock
locked thereby preventing a drm_vblank_get(), so the vblank refcount
can't increase while drm_update_vblank_count() is executing. Therefore
a zero vblank refcount during execution of that function signals that
is safe for arbitrary counter bumps if called from outside vblank irq,
whereas a non-zero count is not safe.

Whenever the function is called from vblank irq, we have to assume concurrent
readers could show up any time during its execution, even if the refcount
is currently zero, as vblank irqs are usually only enabled due to the
presence of readers, and because when it is called from vblank irq it
can't hold the vbl_lock to protect it from sudden bumps in vblank refcount.
Therefore also restrict bumps to +1 when the function is called from vblank
irq.

Such bumps of more than +1 can happen at other times than reenabling
vblank irqs, e.g., when regular vblank interrupts get delayed by more
than 1 frame due to long held locks, long irq off periods, realtime
preemption on RT kernels, or system management interrupts.

A better solution would be to rewrite the timestamp caching to use
full seqlocks to allow concurrent writes and reads for arbitrary
vblank counter increments.

v2: Add code comment that this is essentially a hack and should
be replaced by a full seqlock implementation for caching of
timestamps.

Signed-off-by: Mario Kleiner 
Reviewed-by: Daniel Vetter 

Cc:  # 4.4+
Cc: michel at daenzer.net
Cc: vbabka at suse.cz
Cc: ville.syrjala at linux.intel.com
Cc: daniel.vetter at ffwll.ch
Cc: dri-devel at lists.freedesktop.org
Cc: alexander.deucher at amd.com
Cc: christian.koenig at amd.com
---
 drivers/gpu/drm/drm_irq.c | 43 +++
 1 file changed, 43 insertions(+)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 1a18033..92ad62f 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -221,6 +221,49 @@ static void drm_update_vblank_count(struct drm_device 
*dev, unsigned int pipe,
diff = (flags & DRM_CALLED_FROM_VBLIRQ) != 0;
}

+   /*
+* FIMXE: Need to replace this hack with proper seqlocks.
+*
+* Restrict the bump of the software vblank counter to a safe maximum
+* value of +1 whenever there is the possibility that concurrent readers
+* of vblank timestamps could be active at the moment, as the current
+* implementation of the timestamp caching and updating is not safe
+* against concurrent readers for calls to store_vblank() with a bump
+* of anything but +1. A bump != 1 would very likely return corrupted
+* timestamps to userspace, because the same slot in the cache could
+* be concurrently written by store_vblank() and read by one of those
+* readers without the read-retry logic detecting the collision.
+*
+* Concurrent readers can exist when we are called from the
+* drm_vblank_off() or drm_vblank_on() functions and other non-vblank-
+* irq callers. However, all those calls to us are happening with the
+* vbl_lock locked to prevent drm_vblank_get(), so the vblank refcount
+* can't increase while we are executing. Therefore a zero refcount at
+* this point is safe for arbitrary counter bumps if we are called
+* outside vblank irq, a non-zero count is not 100% safe. Unfortunately
+* we must also accept a refcount of 1, as whenever we are called from
+* drm_vblank_get() -> drm_vblank_enable() the refcount will be 1 and
+* we must let that one pass through in order to not lose vblank counts
+* during vblank irq off - which would completely defeat the whole
+* point of this routine.
+*
+* Whenever we are called from vblank irq, we have to assume concurrent
+* readers exist or can show up any time during our execution, even if
+* the refcount is currently zero, as vblank irqs are usually only
+* 

[PATCH 1/6] drm: No-Op redundant calls to drm_vblank_off() (v2)

2016-02-12 Thread Mario Kleiner
Otherwise if a kms driver calls into drm_vblank_off() more than once
before calling drm_vblank_on() again, the redundant calls to
vblank_disable_and_save() will call drm_update_vblank_count()
while hw vblank counters and vblank timestamping are in a undefined
state during modesets, dpms off etc.

At least with the legacy drm helpers it is not unusual to
get multiple calls to drm_vblank_off and drm_vblank_on, e.g.,
half a dozen calls to drm_vblank_off and two calls to drm_vblank_on
were observed on radeon-kms during dpms-off -> dpms-on transition.

We don't no-op calls from atomic modesetting drivers, as they
should do a proper job of tracking hw state.

Fixes large jumps of the software maintained vblank counter due to
the hardware vblank counter resetting to zero during dpms off or
modeset, e.g., if radeon-kms is modified to use drm_vblank_off/on
instead of drm_vblank_pre/post_modeset().

This fixes a regression caused by the changes made to
drm_update_vblank_count() in Linux 4.4.

v2: Don't no-op on atomic modesetting drivers, per suggestion
of Daniel Vetter.

Signed-off-by: Mario Kleiner 
Reviewed-by: Daniel Vetter 

Cc:  # 4.4+
Cc: michel at daenzer.net
Cc: vbabka at suse.cz
Cc: ville.syrjala at linux.intel.com
Cc: daniel.vetter at ffwll.ch
Cc: dri-devel at lists.freedesktop.org
Cc: alexander.deucher at amd.com
Cc: christian.koenig at amd.com
---
 drivers/gpu/drm/drm_irq.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 607f493..1a18033 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1313,7 +1313,13 @@ void drm_vblank_off(struct drm_device *dev, unsigned int 
pipe)
spin_lock_irqsave(>event_lock, irqflags);

spin_lock(>vbl_lock);
-   vblank_disable_and_save(dev, pipe);
+   DRM_DEBUG_VBL("crtc %d, vblank enabled %d, inmodeset %d\n",
+ pipe, vblank->enabled, vblank->inmodeset);
+
+   /* Avoid redundant vblank disables without previous drm_vblank_on(). */
+   if (drm_core_check_feature(dev, DRIVER_ATOMIC) || !vblank->inmodeset)
+   vblank_disable_and_save(dev, pipe);
+
wake_up(>queue);

/*
@@ -1415,6 +1421,9 @@ void drm_vblank_on(struct drm_device *dev, unsigned int 
pipe)
return;

spin_lock_irqsave(>vbl_lock, irqflags);
+   DRM_DEBUG_VBL("crtc %d, vblank enabled %d, inmodeset %d\n",
+ pipe, vblank->enabled, vblank->inmodeset);
+
/* Drop our private "prevent drm_vblank_get" refcount */
if (vblank->inmodeset) {
atomic_dec(>refcount);
-- 
1.9.1



Respin: drm vblank regression fixes for Linux 4.4+ (v2)

2016-02-12 Thread Mario Kleiner
Here the respin of my series of vblank bug fixes for stable
Linux 4.4/4.5 with all review comments by Daniel and Ville
taken into account and reviewd-by's and tested-by's added.

I've removed the stable patch "drm: Prevent vblank counter jumps
with timestamp based update method." for the moment. I'll send a
respin of that patch later for drm-next / Linux 4.6, taking
Daniels and Villes comments into account.

Instead a stable patch 6/6 for nouveau now solves the problem of large
vblank counter jumps for that driver on suspend/resume. As nouveau is
currently the only user of the timestamping based vblank counter path,
this should fix that regression properly for Linux 4.4/4.5. Tested with
a couple of suspend/resume cycles composited/non-composited, with/without
vblank clients on a laptop with nv-50.

thanks,
-mario



[PATCH RFC] drm/atomic: Fall back to legacy call back in *_connector_dpms()

2016-02-12 Thread Ville Syrjälä
On Fri, Feb 12, 2016 at 07:08:46PM +0200, Tomi Valkeinen wrote:
> On 12/02/16 17:34, Daniel Vetter wrote:
> > On Fri, Feb 12, 2016 at 05:17:19PM +0200, Jyri Sarha wrote:
> >> Fall back to legacy drm_helper_connector_dpms() call back in
> >> drm_atomic_helper_connector_dpms() if DRIVER_ATOMIC feature is not
> >> present.
> >>
> >> Calling drm_atomic_helper_connector_dpms() from non atomic driver
> >> causes undefined behavior. This is a problem with componentized
> >> encoder/connector drivers that may be bound to both atomic and
> >> non atomic drivers.
> >>
> >> Signed-off-by: Jyri Sarha 
> >> ---
> >> This is just an alternative to this:
> >> https://lists.freedesktop.org/archives/dri-devel/2016-January/098867.html
> > 
> > I like the linked patch much better, since non-atomic really should die.
> > Inflicting non-atomic on atomic helpers is bad imo, so nack from me on
> > this patch here.
> 
> I mostly agree, but we are in a transition period from non-atomic to
> atomic. When all drivers have been converted to atomic, it should be
> easy to grep for code using DRIVER_ATOMIC (or similar), and remove all
> the non-atomic support code.
> 
> In my opinion it should be considered case by case if the
> non-atomic/atomic compat code should be added to the generic functions
> or to all the drivers using that functionality.
> 
> In this case, if it only affects tda998x (but does it?), perhaps the
> patch in the link is better.

Maybe we need a hybrid helper that just calls the atomic
or non-atomic helper approppriately.

-- 
Ville Syrjälä
Intel OTC


[PATCH RFC] drm/atomic: Fall back to legacy call back in *_connector_dpms()

2016-02-12 Thread Tomi Valkeinen
On 12/02/16 17:34, Daniel Vetter wrote:
> On Fri, Feb 12, 2016 at 05:17:19PM +0200, Jyri Sarha wrote:
>> Fall back to legacy drm_helper_connector_dpms() call back in
>> drm_atomic_helper_connector_dpms() if DRIVER_ATOMIC feature is not
>> present.
>>
>> Calling drm_atomic_helper_connector_dpms() from non atomic driver
>> causes undefined behavior. This is a problem with componentized
>> encoder/connector drivers that may be bound to both atomic and
>> non atomic drivers.
>>
>> Signed-off-by: Jyri Sarha 
>> ---
>> This is just an alternative to this:
>> https://lists.freedesktop.org/archives/dri-devel/2016-January/098867.html
> 
> I like the linked patch much better, since non-atomic really should die.
> Inflicting non-atomic on atomic helpers is bad imo, so nack from me on
> this patch here.

I mostly agree, but we are in a transition period from non-atomic to
atomic. When all drivers have been converted to atomic, it should be
easy to grep for code using DRIVER_ATOMIC (or similar), and remove all
the non-atomic support code.

In my opinion it should be considered case by case if the
non-atomic/atomic compat code should be added to the generic functions
or to all the drivers using that functionality.

In this case, if it only affects tda998x (but does it?), perhaps the
patch in the link is better.

 Tomi

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160212/8f8152c9/attachment-0001.sig>


[PATCH 4/4] drm/exynos: use arch independent types in uapi header

2016-02-12 Thread Emil Velikov
On 12 February 2016 at 12:13, Andrzej Hajda  wrote:
> User API structs should not use types which size/alignment/padding depends
> on architecture. The patch fixes it for all structures except
> drm_exynos_g2d_userptr, as g2d related stuff seems to be more complicated
> and will be reviewed/adjusted later.
>
> Signed-off-by: Andrzej Hajda 

Andrzej for President ;-)

But seriously, thank you very much. There is an open question about
the license miss-match of the file (libdrm version is X11/MIT while
this one is GPL) , although we'll need Inki's input on that one.

Love the whole series, but my exynos foo isn't that great. So this patch is
Reviewed-by: Emil Velikov 

Thanks
Emil


[PATCH] drm/exynos: add mic_bypass option for exynos542x fimd

2016-02-12 Thread Chanho Park
Hi,

On Fri, Feb 12, 2016 at 5:04 PM, Inki Dae  wrote:
> Hi Chanho,
>
> 2016년 02월 12일 16:39에 Chanho Park 이(가) 쓴 글:
>> Hi,
>>
>> On Fri, Feb 12, 2016 at 1:56 PM, Inki Dae  wrote:
>>> Hi Chanho,
>>>
>>> There was a missing one so below is my review again.
>>>
>>> 2016년 02월 11일 22:59에 Chanho Park 이(가) 쓴 글:
 Hi Inki,

 On Thu, Feb 11, 2016 at 7:37 PM, Inki Dae  wrote:
> Hi Chanho,
>
> 2016년 01월 30일 22:58에 Chanho Park 이(가) 쓴 글:
>> From: Chanho Park 
>>
>> This patch adds a mic_bypass option to bypass the mic
>> from display out path. The mic(Mobile image compressor) compresses
>> RGB data from fimd and send the compressed data to the mipi dsi.
>> The bypass option can be founded from system register and the bit
>> of the option is 11.
>>
>> Cc: Inki Dae 
>> Cc: Joonyoung Shim 
>> Cc: Seung-Woo Kim 
>> Signed-off-by: Chanho Park 
>> ---
>>  .../devicetree/bindings/display/exynos/samsung-fimd.txt|  2 ++
>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 14 
>> ++
>>  2 files changed, 16 insertions(+)
>>
>> diff --git 
>> a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt 
>> b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
>> index 27c3ce0..7f90c4a 100644
>> --- a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
>> +++ b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
>> @@ -45,6 +45,8 @@ Optional Properties:
>>   Can be used in case timings cannot be provided otherwise
>>   or to override timings provided by the panel.
>>  - samsung,sysreg: handle to syscon used to control the system registers
>> +- samsung,mic-bypass: bypass mic(mobile image compressor) from display 
>> path.
>>>
>>> mic-bypass is not really common property for fimd family so it's not 
>>> correct for fimd device node has mic-bypass property.
>>
>> According to user manual of exynos, the option has been introduced
>> since exynos5420.
>
> That is why samsung-fimd.txt is not correct place. samsung-fimd.txt describes 
> hardware information for s3c24xx, s3c64xx also, which don't have mic ip.

Yes. I just described the option's limitation like below.

>
>> The exynos5420 and exynos5422(5800) have a fimd controller not decon
>> display controller.
>>
>>>
>> +   This option is only available since exynos5420.

I described the limitation in here.

>>  - i80-if-timings: timing configuration for lcd i80 interface support.
>>- cs-setup: clock cycles for the active period of address signal is 
>> enabled
>>until chip select is enabled.
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index 70194d0..4fb2952 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> @@ -94,6 +94,7 @@ struct fimd_driver_data {
>>   unsigned int lcdblk_offset;
>>   unsigned int lcdblk_vt_shift;
>>   unsigned int lcdblk_bypass_shift;
>> + unsigned int lcdblk_mic_bypass_shift;
>>
>>   unsigned int has_shadowcon:1;
>>   unsigned int has_clksel:1;
>> @@ -140,6 +141,7 @@ static struct fimd_driver_data 
>> exynos5_fimd_driver_data = {
>>   .lcdblk_offset = 0x214,
>>   .lcdblk_vt_shift = 24,
>>   .lcdblk_bypass_shift = 15,
>> + .lcdblk_mic_bypass_shift = 11,
>>   .has_shadowcon = 1,
>>   .has_vidoutcon = 1,
>>   .has_vtsel = 1,
>> @@ -162,6 +164,7 @@ struct fimd_context {
>>   u32 i80ifcon;
>>   booli80_if;
>>   boolsuspended;
>> + boolmic_bypass;
>>   int pipe;
>>   wait_queue_head_t   wait_vsync_queue;
>>   atomic_twait_vsync_event;
>> @@ -461,6 +464,14 @@ static void fimd_commit(struct exynos_drm_crtc 
>> *crtc)
>>   return;
>>   }
>>
>> + if (ctx->mic_bypass && ctx->sysreg && 
>> regmap_update_bits(ctx->sysreg,
>> + driver_data->lcdblk_offset,
>> + 0x1 << 
>> driver_data->lcdblk_mic_bypass_shift,
>> + 0x1 << 
>> driver_data->lcdblk_mic_bypass_shift)) {
>> + DRM_ERROR("Failed to update sysreg for bypass mic.\n");
>> + return;
>> + }
>
> It'd better to consider mic path also because mic bypass bit of lcdblk 
> could be true by bootloader. In this case, fimd driver wouldn't do 
> anything if mic_bypass property isn't declared but the 

[PATCH RFC] drm/atomic: Fall back to legacy call back in *_connector_dpms()

2016-02-12 Thread Jyri Sarha
Fall back to legacy drm_helper_connector_dpms() call back in
drm_atomic_helper_connector_dpms() if DRIVER_ATOMIC feature is not
present.

Calling drm_atomic_helper_connector_dpms() from non atomic driver
causes undefined behavior. This is a problem with componentized
encoder/connector drivers that may be bound to both atomic and
non atomic drivers.

Signed-off-by: Jyri Sarha 
---
This is just an alternative to this:
https://lists.freedesktop.org/archives/dri-devel/2016-January/098867.html

Either one of the patches should be taken for Beaglebone-black, or any
other non atomic driver using tda998x, to work.

 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 57cccd6..6ad0303 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2344,6 +2344,9 @@ int drm_atomic_helper_connector_dpms(struct drm_connector 
*connector,
bool active = false;
int old_mode = connector->dpms;

+   if (!drm_core_check_feature(connector->dev, DRIVER_ATOMIC))
+   return drm_helper_connector_dpms(connector, mode);
+
if (mode != DRM_MODE_DPMS_ON)
mode = DRM_MODE_DPMS_OFF;

-- 
1.9.1



[Bug 94119] playback of AVC Baseline@L3 video with vdpau hardware decoding on Radeon 5450 (Cedar) flickers

2016-02-12 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=94119

Bug ID: 94119
   Summary: playback of AVC Baseline at L3 video with vdpau hardware
decoding on Radeon 5450 (Cedar) flickers
   Product: Mesa
   Version: 11.1
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Gallium/r600
  Assignee: dri-devel at lists.freedesktop.org
  Reporter: arthur.marsh at internode.on.net
QA Contact: dri-devel at lists.freedesktop.org

Video playback of file at
http://www.users.on.net/~arthur.marsh/2013-07-13-Adelaide-Chamber-Singers-Llangollen-28-3.mp4
using:

vlc
mpv --vo=vdpau --hwdec=vdpau

with mesa-vdpau-drivers installed caused flickering of video using a Radeon HD
5450 (CEDAR) video card

mpv --vo=vdpau 
*without* --hwdec=vdpau played back fine

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160212/de43f5c5/attachment.html>


[PATCH] drm/exynos: add mic_bypass option for exynos542x fimd

2016-02-12 Thread Inki Dae
Hi Chanho,

2016년 02월 12일 16:39에 Chanho Park 이(가) 쓴 글:
> Hi,
> 
> On Fri, Feb 12, 2016 at 1:56 PM, Inki Dae  wrote:
>> Hi Chanho,
>>
>> There was a missing one so below is my review again.
>>
>> 2016년 02월 11일 22:59에 Chanho Park 이(가) 쓴 글:
>>> Hi Inki,
>>>
>>> On Thu, Feb 11, 2016 at 7:37 PM, Inki Dae  wrote:
 Hi Chanho,

 2016년 01월 30일 22:58에 Chanho Park 이(가) 쓴 글:
> From: Chanho Park 
>
> This patch adds a mic_bypass option to bypass the mic
> from display out path. The mic(Mobile image compressor) compresses
> RGB data from fimd and send the compressed data to the mipi dsi.
> The bypass option can be founded from system register and the bit
> of the option is 11.
>
> Cc: Inki Dae 
> Cc: Joonyoung Shim 
> Cc: Seung-Woo Kim 
> Signed-off-by: Chanho Park 
> ---
>  .../devicetree/bindings/display/exynos/samsung-fimd.txt|  2 ++
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 14 
> ++
>  2 files changed, 16 insertions(+)
>
> diff --git 
> a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt 
> b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
> index 27c3ce0..7f90c4a 100644
> --- a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
> +++ b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
> @@ -45,6 +45,8 @@ Optional Properties:
>   Can be used in case timings cannot be provided otherwise
>   or to override timings provided by the panel.
>  - samsung,sysreg: handle to syscon used to control the system registers
> +- samsung,mic-bypass: bypass mic(mobile image compressor) from display 
> path.
>>
>> mic-bypass is not really common property for fimd family so it's not correct 
>> for fimd device node has mic-bypass property.
> 
> According to user manual of exynos, the option has been introduced
> since exynos5420.

That is why samsung-fimd.txt is not correct place. samsung-fimd.txt describes 
hardware information for s3c24xx, s3c64xx also, which don't have mic ip.

> The exynos5420 and exynos5422(5800) have a fimd controller not decon
> display controller.
> 
>>
> +   This option is only available since exynos5420.
>  - i80-if-timings: timing configuration for lcd i80 interface support.
>- cs-setup: clock cycles for the active period of address signal is 
> enabled
>until chip select is enabled.
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 70194d0..4fb2952 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -94,6 +94,7 @@ struct fimd_driver_data {
>   unsigned int lcdblk_offset;
>   unsigned int lcdblk_vt_shift;
>   unsigned int lcdblk_bypass_shift;
> + unsigned int lcdblk_mic_bypass_shift;
>
>   unsigned int has_shadowcon:1;
>   unsigned int has_clksel:1;
> @@ -140,6 +141,7 @@ static struct fimd_driver_data 
> exynos5_fimd_driver_data = {
>   .lcdblk_offset = 0x214,
>   .lcdblk_vt_shift = 24,
>   .lcdblk_bypass_shift = 15,
> + .lcdblk_mic_bypass_shift = 11,
>   .has_shadowcon = 1,
>   .has_vidoutcon = 1,
>   .has_vtsel = 1,
> @@ -162,6 +164,7 @@ struct fimd_context {
>   u32 i80ifcon;
>   booli80_if;
>   boolsuspended;
> + boolmic_bypass;
>   int pipe;
>   wait_queue_head_t   wait_vsync_queue;
>   atomic_twait_vsync_event;
> @@ -461,6 +464,14 @@ static void fimd_commit(struct exynos_drm_crtc *crtc)
>   return;
>   }
>
> + if (ctx->mic_bypass && ctx->sysreg && 
> regmap_update_bits(ctx->sysreg,
> + driver_data->lcdblk_offset,
> + 0x1 << driver_data->lcdblk_mic_bypass_shift,
> + 0x1 << 
> driver_data->lcdblk_mic_bypass_shift)) {
> + DRM_ERROR("Failed to update sysreg for bypass mic.\n");
> + return;
> + }

 It'd better to consider mic path also because mic bypass bit of lcdblk 
 could be true by bootloader. In this case, fimd driver wouldn't do 
 anything if mic_bypass property isn't declared but the mic_bypass bit of 
 lcdblk register is still set to 1.
>>>
>>> Actually, I wanted to set the bit on kernel side even though it's not
>>> assigned from bootloader.
>>> If the bootloader already set the bit, that means mic will be by-pass
>>> and we don't care about it from kernel 

[PATCH] drm/exynos: add mic_bypass option for exynos542x fimd

2016-02-12 Thread Chanho Park
Hi,

On Fri, Feb 12, 2016 at 1:56 PM, Inki Dae  wrote:
> Hi Chanho,
>
> There was a missing one so below is my review again.
>
> 2016년 02월 11일 22:59에 Chanho Park 이(가) 쓴 글:
>> Hi Inki,
>>
>> On Thu, Feb 11, 2016 at 7:37 PM, Inki Dae  wrote:
>>> Hi Chanho,
>>>
>>> 2016년 01월 30일 22:58에 Chanho Park 이(가) 쓴 글:
 From: Chanho Park 

 This patch adds a mic_bypass option to bypass the mic
 from display out path. The mic(Mobile image compressor) compresses
 RGB data from fimd and send the compressed data to the mipi dsi.
 The bypass option can be founded from system register and the bit
 of the option is 11.

 Cc: Inki Dae 
 Cc: Joonyoung Shim 
 Cc: Seung-Woo Kim 
 Signed-off-by: Chanho Park 
 ---
  .../devicetree/bindings/display/exynos/samsung-fimd.txt|  2 ++
  drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 14 
 ++
  2 files changed, 16 insertions(+)

 diff --git 
 a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt 
 b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
 index 27c3ce0..7f90c4a 100644
 --- a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
 +++ b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
 @@ -45,6 +45,8 @@ Optional Properties:
   Can be used in case timings cannot be provided otherwise
   or to override timings provided by the panel.
  - samsung,sysreg: handle to syscon used to control the system registers
 +- samsung,mic-bypass: bypass mic(mobile image compressor) from display 
 path.
>
> mic-bypass is not really common property for fimd family so it's not correct 
> for fimd device node has mic-bypass property.

According to user manual of exynos, the option has been introduced
since exynos5420.
The exynos5420 and exynos5422(5800) have a fimd controller not decon
display controller.

>
 +   This option is only available since exynos5420.
  - i80-if-timings: timing configuration for lcd i80 interface support.
- cs-setup: clock cycles for the active period of address signal is 
 enabled
until chip select is enabled.
 diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
 b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 index 70194d0..4fb2952 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 @@ -94,6 +94,7 @@ struct fimd_driver_data {
   unsigned int lcdblk_offset;
   unsigned int lcdblk_vt_shift;
   unsigned int lcdblk_bypass_shift;
 + unsigned int lcdblk_mic_bypass_shift;

   unsigned int has_shadowcon:1;
   unsigned int has_clksel:1;
 @@ -140,6 +141,7 @@ static struct fimd_driver_data 
 exynos5_fimd_driver_data = {
   .lcdblk_offset = 0x214,
   .lcdblk_vt_shift = 24,
   .lcdblk_bypass_shift = 15,
 + .lcdblk_mic_bypass_shift = 11,
   .has_shadowcon = 1,
   .has_vidoutcon = 1,
   .has_vtsel = 1,
 @@ -162,6 +164,7 @@ struct fimd_context {
   u32 i80ifcon;
   booli80_if;
   boolsuspended;
 + boolmic_bypass;
   int pipe;
   wait_queue_head_t   wait_vsync_queue;
   atomic_twait_vsync_event;
 @@ -461,6 +464,14 @@ static void fimd_commit(struct exynos_drm_crtc *crtc)
   return;
   }

 + if (ctx->mic_bypass && ctx->sysreg && regmap_update_bits(ctx->sysreg,
 + driver_data->lcdblk_offset,
 + 0x1 << driver_data->lcdblk_mic_bypass_shift,
 + 0x1 << 
 driver_data->lcdblk_mic_bypass_shift)) {
 + DRM_ERROR("Failed to update sysreg for bypass mic.\n");
 + return;
 + }
>>>
>>> It'd better to consider mic path also because mic bypass bit of lcdblk 
>>> could be true by bootloader. In this case, fimd driver wouldn't do anything 
>>> if mic_bypass property isn't declared but the mic_bypass bit of lcdblk 
>>> register is still set to 1.
>>
>> Actually, I wanted to set the bit on kernel side even though it's not
>> assigned from bootloader.
>> If the bootloader already set the bit, that means mic will be by-pass
>> and we don't care about it from kernel side.
>> The option is useful when I want to skip the mic on the kernel side.
>>
>>>
>>> For this, I think you could check lcdblk_mic_pypass_shift to identify 
>>> whether mic path is supported or not like below,
>>> if (ctx->lcdblk_mic_bypass_shift) {
>>
>> It causes all exynos5 fimd driver skips the mic from display path.
>> How about below patch 

[PATCH] radeon: Define SI_TILE_MODE_COLOR_2D_SCANOUT_8BPP for consistency and readability

2016-02-12 Thread Michel Dänzer
On 12.02.2016 09:29, Alexandre Demers wrote:
> ---
>  drivers/gpu/drm/radeon/atombios_crtc.c | 2 +-
>  include/uapi/drm/radeon_drm.h  | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c 
> b/drivers/gpu/drm/radeon/atombios_crtc.c
> index 801dd60..c88f9fe 100644
> --- a/drivers/gpu/drm/radeon/atombios_crtc.c
> +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
> @@ -1287,7 +1287,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
>   } else {
>   switch (target_fb->bits_per_pixel) {
>   case 8:
> - index = 10;
> + index = 
> SI_TILE_MODE_COLOR_2D_SCANOUT_8BPP;
>   break;
>   case 16:
>   index = 
> SI_TILE_MODE_COLOR_2D_SCANOUT_16BPP;
> diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
> index ccb9bcd..407a092 100644
> --- a/include/uapi/drm/radeon_drm.h
> +++ b/include/uapi/drm/radeon_drm.h
> @@ -1057,6 +1057,7 @@ struct drm_radeon_info {
>  #define SI_TILE_MODE_COLOR_2D_16BPP  15
>  #define SI_TILE_MODE_COLOR_2D_32BPP  16
>  #define SI_TILE_MODE_COLOR_2D_64BPP  17
> +#define SI_TILE_MODE_COLOR_2D_SCANOUT_8BPP   10
>  #define SI_TILE_MODE_COLOR_2D_SCANOUT_16BPP  11
>  #define SI_TILE_MODE_COLOR_2D_SCANOUT_32BPP  12
>  #define SI_TILE_MODE_DEPTH_STENCIL_1D4
> 

The shortlog (subject line) is a bit long, but other than that,

Reviewed-by: Michel Dänzer 


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer


[PATCH RFC] drm/atomic: Fall back to legacy call back in *_connector_dpms()

2016-02-12 Thread Daniel Vetter
On Fri, Feb 12, 2016 at 05:17:19PM +0200, Jyri Sarha wrote:
> Fall back to legacy drm_helper_connector_dpms() call back in
> drm_atomic_helper_connector_dpms() if DRIVER_ATOMIC feature is not
> present.
> 
> Calling drm_atomic_helper_connector_dpms() from non atomic driver
> causes undefined behavior. This is a problem with componentized
> encoder/connector drivers that may be bound to both atomic and
> non atomic drivers.
> 
> Signed-off-by: Jyri Sarha 
> ---
> This is just an alternative to this:
> https://lists.freedesktop.org/archives/dri-devel/2016-January/098867.html

I like the linked patch much better, since non-atomic really should die.
Inflicting non-atomic on atomic helpers is bad imo, so nack from me on
this patch here.
-Daniel
> 
> Either one of the patches should be taken for Beaglebone-black, or any
> other non atomic driver using tda998x, to work.
> 
>  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 57cccd6..6ad0303 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2344,6 +2344,9 @@ int drm_atomic_helper_connector_dpms(struct 
> drm_connector *connector,
>   bool active = false;
>   int old_mode = connector->dpms;
>  
> + if (!drm_core_check_feature(connector->dev, DRIVER_ATOMIC))
> + return drm_helper_connector_dpms(connector, mode);
> +
>   if (mode != DRM_MODE_DPMS_ON)
>   mode = DRM_MODE_DPMS_OFF;
>  
> -- 
> 1.9.1
> 

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


[PATCH] radeon: Define SI_TILE_MODE_COLOR_2D_SCANOUT_8BPP for consistency and readability - libdrm

2016-02-12 Thread Michel Dänzer
On 12.02.2016 09:32, Alexandre Demers wrote:
> ---
>  include/drm/radeon_drm.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
> index cd31794..e57640a 100644
> --- a/include/drm/radeon_drm.h
> +++ b/include/drm/radeon_drm.h
> @@ -1026,6 +1026,7 @@ struct drm_radeon_info {
>  #define SI_TILE_MODE_COLOR_2D_16BPP  15
>  #define SI_TILE_MODE_COLOR_2D_32BPP  16
>  #define SI_TILE_MODE_COLOR_2D_64BPP  17
> +#define SI_TILE_MODE_COLOR_2D_SCANOUT_8BPP   10
>  #define SI_TILE_MODE_COLOR_2D_SCANOUT_16BPP  11
>  #define SI_TILE_MODE_COLOR_2D_SCANOUT_32BPP  12
>  #define SI_TILE_MODE_DEPTH_STENCIL_1D4
> 

The define itself looks good, thanks, but please don't append " -
libdrm" to the subject, or that'll get preserved in the Git shortlog.
The way to indicate the repository a patch is for is in the [PATCH]
prefix, e.g. in this case [PATCH libdrm].


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer


[PATCH v9] dma-buf: Add ioctls to allow userspace to flush

2016-02-12 Thread Daniel Vetter
On Fri, Feb 12, 2016 at 03:50:02PM +0100, David Herrmann wrote:
> Hi
> 
> On Thu, Feb 11, 2016 at 11:04 PM, Tiago Vignatti
>  wrote:
> > From: Daniel Vetter 
> >
> > The userspace might need some sort of cache coherency management e.g. when 
> > CPU
> > and GPU domains are being accessed through dma-buf at the same time. To
> > circumvent this problem there are begin/end coherency markers, that forward
> > directly to existing dma-buf device drivers vfunc hooks. Userspace can make 
> > use
> > of those markers through the DMA_BUF_IOCTL_SYNC ioctl. The sequence would be
> > used like following:
> >  - mmap dma-buf fd
> >  - for each drawing/upload cycle in CPU 1. SYNC_START ioctl, 2. 
> > read/write
> >to mmap area 3. SYNC_END ioctl. This can be repeated as often as you
> >want (with the new data being consumed by the GPU or say scanout 
> > device)
> >  - munmap once you don't need the buffer any more
> >
> > v2 (Tiago): Fix header file type names (u64 -> __u64)
> > v3 (Tiago): Add documentation. Use enum dma_buf_sync_flags to the begin/end
> > dma-buf functions. Check for overflows in start/length.
> > v4 (Tiago): use 2d regions for sync.
> > v5 (Tiago): forget about 2d regions (v4); use _IOW in DMA_BUF_IOCTL_SYNC and
> > remove range information from struct dma_buf_sync.
> > v6 (Tiago): use __u64 structured padded flags instead enum. Adjust
> > documentation about the recommendation on using sync ioctls.
> > v7 (Tiago): Alex' nit on flags definition and being even more wording in the
> > doc about sync usage.
> > v9 (Tiago): remove useless is_dma_buf_file check. Fix sync.flags 
> > conditionals
> > and its mask order check. Add  include in dma-buf.h.
> >
> > Cc: Ville Syrjälä 
> > Cc: David Herrmann 
> > Cc: Sumit Semwal 
> > Reviewed-by: Stéphane Marchesin 
> > Signed-off-by: Daniel Vetter 
> > Signed-off-by: Tiago Vignatti 
> > ---
> >
> > I left SYNC_START and SYNC_END exclusive, just how the logic was before. If 
> > we
> > see an useful use case, maybe like the way David said, to store two frames
> > next to each other in the same BO, we can patch up later fairly easily.
> >
> > About the ioctl direction, just like Ville pointed, we're doing only
> > copy_from_user at the moment and seems that _IOW is all we need. So I also
> > didn't touch anything on that.
> 
> Fair enough.
> 
> All I have left are comments on coding-style, and I'll refrain from
> verbalizing them.. (gnah, it is so tempting).
> 
> Reviewed-by: David Herrmann 

Merged to drm-misc, thanks.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH v10 4/4] drm/radeon: Fix WARN_ON if DRM_DP_AUX_CHARDEV is enabled

2016-02-12 Thread Alex Deucher
On Thu, Jan 21, 2016 at 6:10 PM, Rafael Antognolli
 wrote:
> From: Lukas Wunner 
>
> Rafael Antognolli's new DRM_DP_AUX_CHARDEV feature causes a WARN_ON
> if drm_dp_aux->dev == drm_connector->kdev and drm_dp_aux_unregister()
> is called after drm_connector_unregister(). radeon is the only driver
> affected by this besides i915. (amdgpu calls drm_dp_aux_unregister()
> before drm_connector_unregister().)
>
> Cc: Rafael Antognolli 
> Cc: Ville Syrjälä 
> Cc: Alex Deucher 
> Signed-off-by: Lukas Wunner 

Applied.  thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_display.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
> b/drivers/gpu/drm/radeon/radeon_display.c
> index b3bb923..a885dae 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1684,6 +1684,9 @@ void radeon_modeset_fini(struct radeon_device *rdev)
> radeon_fbdev_fini(rdev);
> kfree(rdev->mode_info.bios_hardcoded_edid);
>
> +   /* free i2c buses */
> +   radeon_i2c_fini(rdev);
> +
> if (rdev->mode_info.mode_config_initialized) {
> radeon_afmt_fini(rdev);
> drm_kms_helper_poll_fini(rdev->ddev);
> @@ -1691,8 +1694,6 @@ void radeon_modeset_fini(struct radeon_device *rdev)
> drm_mode_config_cleanup(rdev->ddev);
> rdev->mode_info.mode_config_initialized = false;
> }
> -   /* free i2c buses */
> -   radeon_i2c_fini(rdev);
>  }
>
>  static bool is_hdtv_mode(const struct drm_display_mode *mode)
> --
> 2.4.3
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v9] dma-buf: Add ioctls to allow userspace to flush

2016-02-12 Thread David Herrmann
Hi

On Thu, Feb 11, 2016 at 11:04 PM, Tiago Vignatti
 wrote:
> From: Daniel Vetter 
>
> The userspace might need some sort of cache coherency management e.g. when CPU
> and GPU domains are being accessed through dma-buf at the same time. To
> circumvent this problem there are begin/end coherency markers, that forward
> directly to existing dma-buf device drivers vfunc hooks. Userspace can make 
> use
> of those markers through the DMA_BUF_IOCTL_SYNC ioctl. The sequence would be
> used like following:
>  - mmap dma-buf fd
>  - for each drawing/upload cycle in CPU 1. SYNC_START ioctl, 2. read/write
>to mmap area 3. SYNC_END ioctl. This can be repeated as often as you
>want (with the new data being consumed by the GPU or say scanout 
> device)
>  - munmap once you don't need the buffer any more
>
> v2 (Tiago): Fix header file type names (u64 -> __u64)
> v3 (Tiago): Add documentation. Use enum dma_buf_sync_flags to the begin/end
> dma-buf functions. Check for overflows in start/length.
> v4 (Tiago): use 2d regions for sync.
> v5 (Tiago): forget about 2d regions (v4); use _IOW in DMA_BUF_IOCTL_SYNC and
> remove range information from struct dma_buf_sync.
> v6 (Tiago): use __u64 structured padded flags instead enum. Adjust
> documentation about the recommendation on using sync ioctls.
> v7 (Tiago): Alex' nit on flags definition and being even more wording in the
> doc about sync usage.
> v9 (Tiago): remove useless is_dma_buf_file check. Fix sync.flags conditionals
> and its mask order check. Add  include in dma-buf.h.
>
> Cc: Ville Syrjälä 
> Cc: David Herrmann 
> Cc: Sumit Semwal 
> Reviewed-by: Stéphane Marchesin 
> Signed-off-by: Daniel Vetter 
> Signed-off-by: Tiago Vignatti 
> ---
>
> I left SYNC_START and SYNC_END exclusive, just how the logic was before. If we
> see an useful use case, maybe like the way David said, to store two frames
> next to each other in the same BO, we can patch up later fairly easily.
>
> About the ioctl direction, just like Ville pointed, we're doing only
> copy_from_user at the moment and seems that _IOW is all we need. So I also
> didn't touch anything on that.

Fair enough.

All I have left are comments on coding-style, and I'll refrain from
verbalizing them.. (gnah, it is so tempting).

Reviewed-by: David Herrmann 

Thanks!
David

>  Documentation/dma-buf-sharing.txt | 21 +-
>  drivers/dma-buf/dma-buf.c | 45 
> +++
>  include/uapi/linux/dma-buf.h  | 40 ++
>  3 files changed, 105 insertions(+), 1 deletion(-)
>  create mode 100644 include/uapi/linux/dma-buf.h
>
> diff --git a/Documentation/dma-buf-sharing.txt 
> b/Documentation/dma-buf-sharing.txt
> index 4f4a84b..32ac32e 100644
> --- a/Documentation/dma-buf-sharing.txt
> +++ b/Documentation/dma-buf-sharing.txt
> @@ -350,7 +350,26 @@ Being able to mmap an export dma-buf buffer object has 2 
> main use-cases:
> handles, too). So it's beneficial to support this in a similar fashion on
> dma-buf to have a good transition path for existing Android userspace.
>
> -   No special interfaces, userspace simply calls mmap on the dma-buf fd.
> +   No special interfaces, userspace simply calls mmap on the dma-buf fd, 
> making
> +   sure that the cache synchronization ioctl (DMA_BUF_IOCTL_SYNC) is *always*
> +   used when the access happens. This is discussed next paragraphs.
> +
> +   Some systems might need some sort of cache coherency management e.g. when
> +   CPU and GPU domains are being accessed through dma-buf at the same time. 
> To
> +   circumvent this problem there are begin/end coherency markers, that 
> forward
> +   directly to existing dma-buf device drivers vfunc hooks. Userspace can 
> make
> +   use of those markers through the DMA_BUF_IOCTL_SYNC ioctl. The sequence
> +   would be used like following:
> + - mmap dma-buf fd
> + - for each drawing/upload cycle in CPU 1. SYNC_START ioctl, 2. 
> read/write
> +   to mmap area 3. SYNC_END ioctl. This can be repeated as often as you
> +   want (with the new data being consumed by the GPU or say scanout 
> device)
> + - munmap once you don't need the buffer any more
> +
> +Therefore, for correctness and optimal performance, systems with the 
> memory
> +cache shared by the GPU and CPU i.e. the "coherent" and also the
> +"incoherent" are always required to use SYNC_START and SYNC_END before 
> and
> +after, respectively, when accessing the mapped address.
>
>  2. Supporting existing mmap interfaces in importers
>
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index b2ac13b..9810d1d 100644
> --- a/drivers/dma-buf/dma-buf.c
> +++ b/drivers/dma-buf/dma-buf.c
> @@ -34,6 +34,8 @@
>  #include 
>  #include 
>
> +#include 
> +
>  static inline int is_dma_buf_file(struct file *);
>
>  struct dma_buf_list {
> @@ -251,11 +253,54 @@ out:
> return events;
>  }
>
> +static long 

[PATCH] drm/exynos: fix incorrect cpu address for dma_mmap_attrs()

2016-02-12 Thread Inki Dae
Picked it up.

Thanks,
Inki Dae

2016년 02월 11일 20:32에 Marek Szyprowski 이(가) 쓴 글:
> dma_mmap_attrs() should be called with cpu address returned by
> dma_alloc_attrs(). Existing code however passed pages array base as cpu
> address. This worked only by a pure luck on ARM architecture. This patch
> fixes this issue.
> 
> Signed-off-by: Marek Szyprowski 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 2 +-
>  drivers/gpu/drm/exynos/exynos_drm_gem.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> index f6118ba..8baabd8 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> @@ -50,7 +50,7 @@ static int exynos_drm_fb_mmap(struct fb_info *info,
>   if (vm_size > exynos_gem->size)
>   return -EINVAL;
>  
> - ret = dma_mmap_attrs(helper->dev->dev, vma, exynos_gem->pages,
> + ret = dma_mmap_attrs(helper->dev->dev, vma, exynos_gem->cookie,
>exynos_gem->dma_addr, exynos_gem->size,
>_gem->dma_attrs);
>   if (ret < 0) {
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c 
> b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> index 47d126a..26b5e4b 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> @@ -335,7 +335,7 @@ static int exynos_drm_gem_mmap_buffer(struct 
> exynos_drm_gem *exynos_gem,
>   if (vm_size > exynos_gem->size)
>   return -EINVAL;
>  
> - ret = dma_mmap_attrs(drm_dev->dev, vma, exynos_gem->pages,
> + ret = dma_mmap_attrs(drm_dev->dev, vma, exynos_gem->cookie,
>exynos_gem->dma_addr, exynos_gem->size,
>_gem->dma_attrs);
>   if (ret < 0) {
> 


[PATCH] drm/exynos/decon: fix disable clocks order

2016-02-12 Thread Inki Dae
Picked it up.

Thanks,
Inki Dae

2016년 02월 11일 20:25에 Andrzej Hajda 이(가) 쓴 글:
> Decon requires that clocks should be disabled in reverse order. Otherwise
> system hangs.
> 
> Signed-off-by: Andrzej Hajda 
> ---
>  drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
> b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> index 1bf6a21..98615e2 100644
> --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> @@ -582,9 +582,9 @@ out:
>  static int exynos5433_decon_suspend(struct device *dev)
>  {
>   struct decon_context *ctx = dev_get_drvdata(dev);
> - int i;
> + int i = ARRAY_SIZE(decon_clks_name);
>  
> - for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++)
> + while (--i >= 0)
>   clk_disable_unprepare(ctx->clks[i]);
>  
>   return 0;
> 


[PATCH 08/10] drm/exynos: initialize DMA ops for virtual Exynos DRM device

2016-02-12 Thread Inki Dae
Hi Marek,

2016년 02월 03일 21:42에 Marek Szyprowski 이(가) 쓴 글:
> Virtual DRM device is used for memory allocation for GEM objects. On
> some architectures null dma operations are assigned for virtual devices
> if no explicit initialization has been made.
> 
> Signed-off-by: Marek Szyprowski 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
> b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 68f0f36..a33ea44 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -144,6 +144,7 @@ static int exynos_drm_load(struct drm_device *dev, 
> unsigned long flags)
>   init_waitqueue_head(>wait);
>   spin_lock_init(>lock);
>  
> + arch_setup_dma_ops(dev->dev, 0, DMA_BIT_MASK(32), false, false);

As you got the report, above function incurrs build error below,
ERROR: "arch_setup_dma_ops" [drivers/gpu/drm/exynos/exynosdrm.ko] undefined!

Exynos drm can be built as a module. In this case, arch_setup_dma_ops cannot be 
accessed by the module.

I could fix it easily like below but I'm not sure that it's reasonable.

+extern void arch_setup_dma_ops(struct device *dev, u64 dma_base,
+ u64 size, struct iommu_ops *iommu,
+ bool coherent) { };

Thanks,
Inki Dae

>   dev_set_drvdata(dev->dev, dev);
>   dev->dev_private = (void *)private;
>  
> 


[PATCH v5 5/5] drm/dsi: Get DSI host by DT device node

2016-02-12 Thread Archit Taneja
MIPI DSI devices are inherently aware of their host because they share a
parent-child hierarchy in the device tree.

Non-DSI drivers that create DSI device don't have this data. In order to
get this information, they require to a phandle to the DSI host in the
device tree.

Maintain a list of all the hosts DSI that are currently registered. This
list will be used to find the mipi_dsi_host corresponding to the
device_node passed in of_find_mipi_dsi_host_by_node.

Reviewed-by: Andrzej Hajda 
Signed-off-by: Archit Taneja 
---
 drivers/gpu/drm/drm_mipi_dsi.c | 39 +++
 include/drm/drm_mipi_dsi.h |  3 +++
 2 files changed, 42 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index f2f5a6d..f5d8083 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -235,6 +235,37 @@ void mipi_dsi_device_unregister(struct mipi_dsi_device 
*dsi)
 }
 EXPORT_SYMBOL(mipi_dsi_device_unregister);

+static DEFINE_MUTEX(host_lock);
+static LIST_HEAD(host_list);
+
+/**
+ * of_find_mipi_dsi_host_by_node() - find the MIPI DSI host matching a
+ *  device tree node
+ * @node: device tree node
+ *
+ * Returns:
+ * A pointer to the MIPI DSI host corresponding to @node or NULL if no
+ * such device exists (or has not been registered yet).
+ */
+struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node)
+{
+   struct mipi_dsi_host *host;
+
+   mutex_lock(_lock);
+
+   list_for_each_entry(host, _list, list) {
+   if (host->dev->of_node == node) {
+   mutex_unlock(_lock);
+   return host;
+   }
+   }
+
+   mutex_unlock(_lock);
+
+   return NULL;
+}
+EXPORT_SYMBOL(of_find_mipi_dsi_host_by_node);
+
 int mipi_dsi_host_register(struct mipi_dsi_host *host)
 {
struct device_node *node;
@@ -246,6 +277,10 @@ int mipi_dsi_host_register(struct mipi_dsi_host *host)
of_mipi_dsi_device_add(host, node);
}

+   mutex_lock(_lock);
+   list_add_tail(>list, _list);
+   mutex_unlock(_lock);
+
return 0;
 }
 EXPORT_SYMBOL(mipi_dsi_host_register);
@@ -262,6 +297,10 @@ static int mipi_dsi_remove_device_fn(struct device *dev, 
void *priv)
 void mipi_dsi_host_unregister(struct mipi_dsi_host *host)
 {
device_for_each_child(host->dev, NULL, mipi_dsi_remove_device_fn);
+
+   mutex_lock(_lock);
+   list_del_init(>list);
+   mutex_unlock(_lock);
 }
 EXPORT_SYMBOL(mipi_dsi_host_unregister);

diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 06e0a93..7a9840f 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -96,14 +96,17 @@ struct mipi_dsi_host_ops {
  * struct mipi_dsi_host - DSI host device
  * @dev: driver model device node for this DSI host
  * @ops: DSI host operations
+ * @list: list management
  */
 struct mipi_dsi_host {
struct device *dev;
const struct mipi_dsi_host_ops *ops;
+   struct list_head list;
 };

 int mipi_dsi_host_register(struct mipi_dsi_host *host);
 void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
+struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);

 /* DSI mode flags */

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation



[PATCH v5 4/5] drm/dsi: Add routine to unregister a DSI device

2016-02-12 Thread Archit Taneja
A driver calling mipi_dsi_device_register_full might want to unregister
the device once it's done. It might also require it in an error handling
path in case something didn't go right.

Create mipi_dsi_device_unregister for this purpse, use it within
mipi_dsi_remove_device_fn as it does the same thing.

Reviewed-by: Andrzej Hajda 
Signed-off-by: Archit Taneja 
---
 drivers/gpu/drm/drm_mipi_dsi.c | 12 +++-
 include/drm/drm_mipi_dsi.h |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 42a7aac..f2f5a6d 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -225,6 +225,16 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
 }
 EXPORT_SYMBOL(mipi_dsi_device_register_full);

+/**
+ * mipi_dsi_device_unregister - unregister MIPI DSI device
+ * @dsi: DSI peripheral device
+ */
+void mipi_dsi_device_unregister(struct mipi_dsi_device *dsi)
+{
+   device_unregister(>dev);
+}
+EXPORT_SYMBOL(mipi_dsi_device_unregister);
+
 int mipi_dsi_host_register(struct mipi_dsi_host *host)
 {
struct device_node *node;
@@ -244,7 +254,7 @@ static int mipi_dsi_remove_device_fn(struct device *dev, 
void *priv)
 {
struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);

-   device_unregister(>dev);
+   mipi_dsi_device_unregister(dsi);

return 0;
 }
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index a914116..06e0a93 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -210,6 +210,7 @@ static inline int mipi_dsi_pixel_format_to_bpp(enum 
mipi_dsi_pixel_format fmt)
 struct mipi_dsi_device *
 mipi_dsi_device_register_full(struct mipi_dsi_host *host,
  const struct mipi_dsi_device_info *info);
+void mipi_dsi_device_unregister(struct mipi_dsi_device *dsi);
 struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node 
*np);
 int mipi_dsi_attach(struct mipi_dsi_device *dsi);
 int mipi_dsi_detach(struct mipi_dsi_device *dsi);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation



[PATCH v5 3/5] drm/dsi: Try to match non-DT DSI devices

2016-02-12 Thread Archit Taneja
Add a device name field in mipi_dsi_device. This name is different from
the actual dev name (which is of the format "hostname.reg"). When the
device is created via DT, this name is set to the modalias string.
In the non-DT case, the driver creating the DSI device provides the
name by populating a filed in mipi_dsi_device_info.

Matching for DT case would be as it was before. For the non-DT case,
we compare the device and driver names. Other buses (like I2C/SPI)
perform a non-DT match by comparing the device name and entries in the
driver's id_table. Such a mechanism isn't used for the DSI bus.

Reviewed-by: Andrzej Hajda 
Signed-off-by: Archit Taneja 
---
 drivers/gpu/drm/drm_mipi_dsi.c | 18 +-
 include/drm/drm_mipi_dsi.h | 10 --
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 5d7243d..42a7aac 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -47,7 +47,17 @@

 static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv)
 {
-   return of_driver_match_device(dev, drv);
+   struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
+
+   /* attempt OF style match */
+   if (of_driver_match_device(dev, drv))
+   return 1;
+
+   /* compare DSI device and driver names */
+   if (!strcmp(dsi->name, drv->name))
+   return 1;
+
+   return 0;
 }

 static const struct dev_pm_ops mipi_dsi_device_pm_ops = {
@@ -138,6 +148,11 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct 
device_node *node)
int ret;
u32 reg;

+   if (of_modalias_node(node, info.type, sizeof(info.type)) < 0) {
+   dev_err(dev, "modalias failure on %s\n", node->full_name);
+   return ERR_PTR(-EINVAL);
+   }
+
ret = of_property_read_u32(node, "reg", );
if (ret) {
dev_err(dev, "device node %s has no valid reg property: %d\n",
@@ -197,6 +212,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,

dsi->dev.of_node = info->node;
dsi->channel = info->channel;
+   strlcpy(dsi->name, info->type, sizeof(dsi->name));

ret = mipi_dsi_device_add(dsi);
if (ret) {
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index ce5eae43..a914116 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -139,15 +139,19 @@ enum mipi_dsi_pixel_format {
MIPI_DSI_FMT_RGB565,
 };

- /**
+#define DSI_DEV_NAME_SIZE  20
+
+/**
  * struct mipi_dsi_device_info - template for creating a mipi_dsi_device
+ * @type: DSI peripheral chip type
  * @channel: DSI virtual channel assigned to peripheral
- * @node: pointer to OF device node
+ * @node: pointer to OF device node or NULL
  *
  * This is populated and passed to mipi_dsi_device_new to create a new
  * DSI device
  */
 struct mipi_dsi_device_info {
+   char type[DSI_DEV_NAME_SIZE];
u32 channel;
struct device_node *node;
 };
@@ -156,6 +160,7 @@ struct mipi_dsi_device_info {
  * struct mipi_dsi_device - DSI peripheral device
  * @host: DSI host for this peripheral
  * @dev: driver model device node for this peripheral
+ * @name: DSI peripheral chip type
  * @channel: virtual channel assigned to the peripheral
  * @format: pixel format for video mode
  * @lanes: number of active data lanes
@@ -165,6 +170,7 @@ struct mipi_dsi_device {
struct mipi_dsi_host *host;
struct device dev;

+   char name[DSI_DEV_NAME_SIZE];
unsigned int channel;
unsigned int lanes;
enum mipi_dsi_pixel_format format;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation



[PATCH v5 2/5] drm/dsi: Use mipi_dsi_device_register_full for DSI device creation

2016-02-12 Thread Archit Taneja
Use mipi_dsi_device_register_full for device creation. This takes in
mipi_dsi_device_info as a template to populate the DSI device information.

The reason to introduce this is to have a way to create DSI devices not
available via DT. Drivers that want to create a DSI device can populate
mipi_dsi_device_info and call this function. For DSI devices available
via DT, of_mipi_dsi_device_add is used as before, but this now calls
mipi_dsi_device_register_full internally.

Signed-off-by: Archit Taneja 
---
 drivers/gpu/drm/drm_mipi_dsi.c | 64 +++---
 include/drm/drm_mipi_dsi.h | 16 +++
 2 files changed, 63 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 4f2a704..5d7243d 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -133,8 +133,8 @@ static int mipi_dsi_device_add(struct mipi_dsi_device *dsi)
 static struct mipi_dsi_device *
 of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
 {
-   struct mipi_dsi_device *dsi;
struct device *dev = host->dev;
+   struct mipi_dsi_device_info info = { };
int ret;
u32 reg;

@@ -145,39 +145,69 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct 
device_node *node)
return ERR_PTR(-EINVAL);
}

-   if (reg > 3) {
-   dev_err(dev, "device node %s has invalid reg property: %u\n",
-   node->full_name, reg);
+   info.channel = reg;
+   info.node = of_node_get(node);
+
+   return mipi_dsi_device_register_full(host, );
+}
+#else
+static struct mipi_dsi_device *
+of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
+{
+   return ERR_PTR(-ENODEV);
+}
+#endif
+
+/**
+ * mipi_dsi_device_register_full - create a MIPI DSI device
+ * @host: DSI host to which this device is connected
+ * @info: pointer to template containing DSI device information
+ *
+ * Create a MIPI DSI device by using the device information provided by
+ * mipi_dsi_device_info template
+ *
+ * Returns:
+ * A pointer to the newly created MIPI DSI device, or, a pointer encoded
+ * with an error
+ */
+struct mipi_dsi_device *
+mipi_dsi_device_register_full(struct mipi_dsi_host *host,
+ const struct mipi_dsi_device_info *info)
+{
+   struct mipi_dsi_device *dsi;
+   struct device *dev = host->dev;
+   int ret;
+
+   if (!info) {
+   dev_err(dev, "invalid mipi_dsi_device_info pointer\n");
+   return ERR_PTR(-EINVAL);
+   }
+
+   if (info->channel > 3) {
+   dev_err(dev, "invalid virtual channel: %u\n", info->channel);
return ERR_PTR(-EINVAL);
}

dsi = mipi_dsi_device_alloc(host);
if (IS_ERR(dsi)) {
-   dev_err(dev, "failed to allocate DSI device %s: %ld\n",
-   node->full_name, PTR_ERR(dsi));
+   dev_err(dev, "failed to allocate DSI device %ld\n",
+   PTR_ERR(dsi));
return dsi;
}

-   dsi->dev.of_node = of_node_get(node);
-   dsi->channel = reg;
+   dsi->dev.of_node = info->node;
+   dsi->channel = info->channel;

ret = mipi_dsi_device_add(dsi);
if (ret) {
-   dev_err(dev, "failed to add DSI device %s: %d\n",
-   node->full_name, ret);
+   dev_err(dev, "failed to add DSI device %d\n", ret);
kfree(dsi);
return ERR_PTR(ret);
}

return dsi;
 }
-#else
-static struct mipi_dsi_device *
-of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
-{
-   return ERR_PTR(-ENODEV);
-}
-#endif
+EXPORT_SYMBOL(mipi_dsi_device_register_full);

 int mipi_dsi_host_register(struct mipi_dsi_host *host)
 {
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 1b3b1f8..ce5eae43 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -139,6 +139,19 @@ enum mipi_dsi_pixel_format {
MIPI_DSI_FMT_RGB565,
 };

+ /**
+ * struct mipi_dsi_device_info - template for creating a mipi_dsi_device
+ * @channel: DSI virtual channel assigned to peripheral
+ * @node: pointer to OF device node
+ *
+ * This is populated and passed to mipi_dsi_device_new to create a new
+ * DSI device
+ */
+struct mipi_dsi_device_info {
+   u32 channel;
+   struct device_node *node;
+};
+
 /**
  * struct mipi_dsi_device - DSI peripheral device
  * @host: DSI host for this peripheral
@@ -188,6 +201,9 @@ static inline int mipi_dsi_pixel_format_to_bpp(enum 
mipi_dsi_pixel_format fmt)
return -EINVAL;
 }

+struct mipi_dsi_device *
+mipi_dsi_device_register_full(struct mipi_dsi_host *host,
+ const struct mipi_dsi_device_info *info);
 struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node 
*np);
 int 

[PATCH v5 1/5] drm/dsi: check for CONFIG_OF when defining of_mipi_dsi_device_add

2016-02-12 Thread Archit Taneja
of_mipi_dsi_device_add is used only when CONFIG_OF is enabled. It
currently works if OF support is disabled, but this will change
when we add more functionality to it.

Define the original func if CONFIG_OF is enabled. Define a dummy func
otherwise.

Signed-off-by: Archit Taneja 
---
 drivers/gpu/drm/drm_mipi_dsi.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 6e6a9c5..4f2a704 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -129,6 +129,7 @@ static int mipi_dsi_device_add(struct mipi_dsi_device *dsi)
return device_add(>dev);
 }

+#if IS_ENABLED(CONFIG_OF)
 static struct mipi_dsi_device *
 of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
 {
@@ -170,6 +171,13 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct 
device_node *node)

return dsi;
 }
+#else
+static struct mipi_dsi_device *
+of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
+{
+   return ERR_PTR(-ENODEV);
+}
+#endif

 int mipi_dsi_host_register(struct mipi_dsi_host *host)
 {
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation



[PATCH v5 0/5] drm/dsi: DSI for devices with different control bus

2016-02-12 Thread Archit Taneja
We are currently restricted when it comes to supporting DSI on devices
that have a non-DSI control bus. For example, DSI encoder chips are
available in the market that are configured via i2c. Configuring their
registers via DSI bus is either optional or not available at all.

These devices still need to pass DSI parameters (data lanes, mode flags
etc) to the DSI host they are connected to. We don't have a way to do
that at the moment.

After some discussions on the previous RFC[1], we decided to support this
by providing additional API in drm_mipi_dsi.c which lets us create new DSI
devices without the need of them to have a DT node.

[1]: https://lkml.org/lkml/2015/6/30/42

Changes in v5:
- Simplify refactoring as suggested by Thierry.
- Use abbreviations correctly.
- Drop "drm/dsi: Check for used channels"
- Return the correct encoded error code for of_mipi_dsi_device_add
  when CONFIG_OF is disabled.
- Use mipi_dsi_device_unregister to implement mipi_dsi_remove_device_fn()
  too.

Changes in v4:
- Added a new patch that fixes build issues when CONFIG_OF is not set.

Changes in v3:

- Incorporated misc comments by Andrzej. Changed from RFC to a PATCH set.
- Fixed htmldocs warnings.


Archit Taneja (5):
  drm/dsi: check for CONFIG_OF when defining of_mipi_dsi_device_add
  drm/dsi: Use mipi_dsi_device_register_full for DSI device creation
  drm/dsi: Try to match non-DT DSI devices
  drm/dsi: Add routine to unregister a DSI device
  drm/dsi: Get DSI host by DT device node

 drivers/gpu/drm/drm_mipi_dsi.c | 127 +
 include/drm/drm_mipi_dsi.h |  26 +
 2 files changed, 141 insertions(+), 12 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation



[PATCH 06/29] drm/amd/dal: Adapter Service

2016-02-12 Thread Wentland, Harry
Hi Dave,

There should be one instance of amdgpu per GPU, so one instance of DAL per GPU, 
hence this should be per GPU.

We haven't really done any multi-GPU testing with this code, though, but I 
briefly tried and can light up with two displays connected to a Tonga and 
Bonaire (Bonaire is supported on our internal tree but hasn't been merged into 
these patches yet).

Harry

-Original Message-
From: Dave Airlie [mailto:airl...@gmail.com] 
Sent: February 11, 2016 7:26 PM
To: Wentland, Harry 
Cc: dri-devel 
Subject: Re: [PATCH 06/29] drm/amd/dal: Adapter Service

> +
> +/* Stores entire ASIC features by sets */ uint32_t 
> +adapter_feature_set[FEATURE_MAXIMUM/32];

Is this global, what about multiple GPUs in one machine, is this per GPU or per 
system?

Dave.


[Intel-gfx] [PATCH v10 2/4] drm/dp: Add a drm_aux-dev module for reading/writing dpcd registers.

2016-02-12 Thread Daniel Vetter
On Fri, Feb 12, 2016 at 01:53:10PM +0200, Ville Syrjälä wrote:
> On Thu, Jan 21, 2016 at 03:10:19PM -0800, Rafael Antognolli wrote:
> > This module is heavily based on i2c-dev. Once loaded, it provides one
> > dev node per DP AUX channel, named drm_dp_auxN, where N is an integer.
> > 
> > It's possible to know which connector owns this aux channel by looking
> > at the respective sysfs /sys/class/drm_aux_dev/drm_dp_auxN/connector, if
> > the connector device pointer was correctly set in the aux helper struct.
> > 
> > Two main operations are provided on the registers read and write. The
> > address of the register to be read or written is given using lseek. The
> > seek position is updated upon read or write.
> > 
> > v2:
> >  - lseek is used to select the register to read/write
> >  - read/write are used instead of ioctl
> >  - no blocking_notifier is used, just a direct callback
> > 
> > v3:
> >  - use drm_dp_aux_dev prefix for public functions
> >  - chardev is named drm_dp_auxN
> >  - read/write don't allocate a buffer anymore, and transfer up to 16 bytes a
> >time
> >  - remove notifier list from the implementation
> >  - option on menuconfig is now a boolean
> >  - add inline stub functions to avoid breakage when this option is disabled
> > 
> > v4:
> >  - fix build system changes - actually disable this module when not 
> > selected.
> > 
> > v5:
> >  - Use kref to avoid device closing while still in use
> >  - Don't use list, use an idr for storing aux_dev
> >  - Remove "connector" attribute
> >  - set aux.dev to the connector drm_connector device, instead of
> >drm_device
> > 
> > v6:
> >  - Use atomic_t for usage count
> >  - Use a mutex instead of spinlock for idr lock
> >  - Destroy chardev immediately on unregister
> >  - other minor suggestions from Ville
> > 
> > v7:
> >  - style fixes
> >  - error handling fixes
> > 
> > v8:
> >  - more error handling fixes
> > 
> > v9:
> >  - remove module_init and module_exit, and add drm_dp_aux_dev_init/exit
> >  to drm_kms_helper_init/exit.
> > 
> > Signed-off-by: Rafael Antognolli 
> 
> Only checked the init/exit stuff since I should have read the rest 
> many times by now.
> 
> Reviewed-by: Ville Syrjälä 

Merged the first 2 patches to drm-misc, thanks.
-Daniel

> 
> > ---
> >  drivers/gpu/drm/Kconfig |   8 +
> >  drivers/gpu/drm/Makefile|   1 +
> >  drivers/gpu/drm/drm_dp_aux_dev.c| 368 
> > 
> >  drivers/gpu/drm/drm_dp_helper.c |  16 +-
> >  drivers/gpu/drm/drm_kms_helper_common.c |  15 +-
> >  include/drm/drm_dp_aux_dev.h|  62 ++
> >  6 files changed, 468 insertions(+), 2 deletions(-)
> >  create mode 100644 drivers/gpu/drm/drm_dp_aux_dev.c
> >  create mode 100644 include/drm/drm_dp_aux_dev.h
> > 
> > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> > index 59babd5..dff87ca 100644
> > --- a/drivers/gpu/drm/Kconfig
> > +++ b/drivers/gpu/drm/Kconfig
> > @@ -25,6 +25,14 @@ config DRM_MIPI_DSI
> > bool
> > depends on DRM
> >  
> > +config DRM_DP_AUX_CHARDEV
> > +   bool "DRM DP AUX Interface"
> > +   depends on DRM
> > +   help
> > + Choose this option to enable a /dev/drm_dp_auxN node that allows to
> > + read and write values to arbitrary DPCD registers on the DP aux
> > + channel.
> > +
> >  config DRM_KMS_HELPER
> > tristate
> > depends on DRM
> > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> > index dfe513f..424fcb7 100644
> > --- a/drivers/gpu/drm/Makefile
> > +++ b/drivers/gpu/drm/Makefile
> > @@ -30,6 +30,7 @@ drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o 
> > drm_probe_helper.o \
> >  drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
> >  drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
> >  drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
> > +drm_kms_helper-$(CONFIG_DRM_DP_AUX_CHARDEV) += drm_dp_aux_dev.o
> >  
> >  obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
> >  
> > diff --git a/drivers/gpu/drm/drm_dp_aux_dev.c 
> > b/drivers/gpu/drm/drm_dp_aux_dev.c
> > new file mode 100644
> > index 000..f73b38b
> > --- /dev/null
> > +++ b/drivers/gpu/drm/drm_dp_aux_dev.c
> > @@ -0,0 +1,368 @@
> > +/*
> > + * Copyright © 2015 Intel Corporation
> > + *
> > + * Permission is hereby granted, free of charge, to any person obtaining a
> > + * copy of this software and associated documentation files (the 
> > "Software"),
> > + * to deal in the Software without restriction, including without 
> > limitation
> > + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom the
> > + * Software is furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice (including the 
> > next
> > + * paragraph) shall be included in all copies or substantial portions of 
> > the
> > 

[PULL] topic/drm-misc

2016-02-12 Thread Daniel Vetter
Hi Dave,

More drm-misc stuff:
- vgaswitcheroo support for apple gmux from Lukas Wunner
- checks for ->mode_fixup in non-atomic helpers from Carlos Palminha, plus
  removing dummy funcs from drivers. Carlos promised to follow up with
  more, since there's lots more silly dummy functions around.
- dma-buf patches from Tiago, except the ioctl itself (that needed a
  respin to address review from David Herrmann)
- encoder mask for atomic from Maarten
- bunch of random things all over.

Aside: the connector_mask stuff from Maarten that landed in 4.5 is blowing
up in certain mst unplug cases. Maarten is looking into it.

Cheers, Daniel


The following changes since commit 10c1b6183a163aca59ba92b88f2b4c4cecd20d4c:

  drm/tegra: drop unused variable. (2016-02-09 11:17:37 +1000)

are available in the git repository at:

  git://anongit.freedesktop.org/drm-intel tags/topic/drm-misc-2016-02-12

for you to fetch changes up to 382ab95d1af85381d8a5dff09b16a80c7e492534:

  drm/msm: remove unused variable (2016-02-11 11:48:39 +0100)


Arnd Bergmann (1):
  drm/msm: remove unused variable

Carlos Palminha (5):
  drm: fixes when i2c encoder slave mode_fixup is null.
  drm: fixes crct set_mode when encoder mode_fixup is null.
  drm/i2c/sil164: removed unnecessary code, mode_fixup is now optional.
  drm/i2c/tda998x: removed unnecessary code, mode_fixup is now optional.
  drm/bridge: removed dummy mode_fixup function from dw-hdmi.

Daniel Thompson (1):
  drm: prime: Honour O_RDWR during prime-handle-to-fd

Haixia Shi (1):
  drm/msm: remove the drm_device_is_unplugged check

Insu Yun (1):
  ch7006: correctly handling failed allocation

LABBE Corentin (1):
  drm: modes: add missing [drm] to message printing

Lukas Wunner (13):
  vga_switcheroo: Add handler flags infrastructure
  vga_switcheroo: Add support for switching only the DDC
  apple-gmux: Track switch state
  apple-gmux: Add switch_ddc support
  drm/edid: Switch DDC when reading the EDID
  drm/i915: Switch DDC when reading the EDID
  drm/nouveau: Switch DDC when reading the EDID
  drm/radeon: Switch DDC when reading the EDID
  apple-gmux: Add helper for presence detect
  drm/i915: Defer probe if gmux is present but its driver isn't
  drm/nouveau: Defer probe if gmux is present but its driver isn't
  drm/radeon: Defer probe if gmux is present but its driver isn't
  apple-gmux: Fix build breakage if !CONFIG_ACPI

Maarten Lankhorst (5):
  drm/core: Add drm_encoder_index.
  drm/core: Add drm_for_each_encoder_mask, v2.
  drm/i915: Do not touch best_encoder for load detect.
  drm/atomic: Do not unset crtc when an encoder is stolen
  drm/atomic: Add encoder_mask to crtc_state, v3.

Rasmus Villemoes (1):
  drm/gma500: fix error path in gma_intel_setup_gmbus()

Tiago Vignatti (3):
  dma-buf: Remove range-based flush
  drm/i915: Implement end_cpu_access
  drm/i915: Use CPU mapping for userspace dma-buf mmap()

Ville Syrjälä (1):
  drm: Add drm_format_plane_width() and drm_format_plane_height()

 Documentation/DocBook/gpu.tmpl   |   5 +
 Documentation/dma-buf-sharing.txt|  19 ++--
 drivers/dma-buf/dma-buf.c|  13 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c |   3 +-
 drivers/gpu/drm/bridge/dw-hdmi.c |   8 --
 drivers/gpu/drm/drm_atomic_helper.c  |  57 +--
 drivers/gpu/drm/drm_crtc.c   |  65 +
 drivers/gpu/drm/drm_crtc_helper.c|  10 +-
 drivers/gpu/drm/drm_edid.c   |  26 +
 drivers/gpu/drm/drm_encoder_slave.c  |   3 +
 drivers/gpu/drm/drm_modes.c  |   3 +-
 drivers/gpu/drm/drm_prime.c  |  10 +-
 drivers/gpu/drm/gma500/intel_gmbus.c |   2 +-
 drivers/gpu/drm/i2c/ch7006_drv.c |   2 +
 drivers/gpu/drm/i2c/sil164_drv.c |   9 --
 drivers/gpu/drm/i2c/tda998x_drv.c|   9 --
 drivers/gpu/drm/i915/i915_drv.c  |  12 +++
 drivers/gpu/drm/i915/i915_gem_dmabuf.c   |  42 +++-
 drivers/gpu/drm/i915/intel_display.c |   5 +-
 drivers/gpu/drm/i915/intel_lvds.c|   8 +-
 drivers/gpu/drm/msm/msm_fbdev.c  |   4 -
 drivers/gpu/drm/nouveau/nouveau_acpi.c   |   2 +-
 drivers/gpu/drm/nouveau/nouveau_connector.c  |  21 +++-
 drivers/gpu/drm/nouveau/nouveau_drm.c|  11 +++
 drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c|   4 +-
 drivers/gpu/drm/radeon/radeon_atpx_handler.c |   3 +-
 drivers/gpu/drm/radeon/radeon_connectors.c   |   6 ++
 drivers/gpu/drm/radeon/radeon_drv.c  |  11 +++
 drivers/gpu/drm/udl/udl_fb.c |   2 -
 drivers/gpu/vga/vga_switcheroo.c | 119 ++-
 

[PATCH 17/17] drm/tilcdc: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/tilcdc/tilcdc_panel.c  | 9 -
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c | 9 -
 2 files changed, 18 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c 
b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index 4dda6e2..8dcf02a 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -70,14 +70,6 @@ static void panel_encoder_dpms(struct drm_encoder *encoder, 
int mode)
 mode == DRM_MODE_DPMS_ON ? 1 : 0);
 }

-static bool panel_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   /* nothing needed */
-   return true;
-}
-
 static void panel_encoder_prepare(struct drm_encoder *encoder)
 {
struct panel_encoder *panel_encoder = to_panel_encoder(encoder);
@@ -103,7 +95,6 @@ static const struct drm_encoder_funcs panel_encoder_funcs = {

 static const struct drm_encoder_helper_funcs panel_encoder_helper_funcs = {
.dpms   = panel_encoder_dpms,
-   .mode_fixup = panel_encoder_mode_fixup,
.prepare= panel_encoder_prepare,
.commit = panel_encoder_commit,
.mode_set   = panel_encoder_mode_set,
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c 
b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
index 5052a8a..1c23017 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
@@ -80,14 +80,6 @@ static void tfp410_encoder_dpms(struct drm_encoder *encoder, 
int mode)
tfp410_encoder->dpms = mode;
 }

-static bool tfp410_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   /* nothing needed */
-   return true;
-}
-
 static void tfp410_encoder_prepare(struct drm_encoder *encoder)
 {
tfp410_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
@@ -112,7 +104,6 @@ static const struct drm_encoder_funcs tfp410_encoder_funcs 
= {

 static const struct drm_encoder_helper_funcs tfp410_encoder_helper_funcs = {
.dpms   = tfp410_encoder_dpms,
-   .mode_fixup = tfp410_encoder_mode_fixup,
.prepare= tfp410_encoder_prepare,
.commit = tfp410_encoder_commit,
.mode_set   = tfp410_encoder_mode_set,
-- 
2.5.0



[PATCH 16/17] drm/sti: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/sti/sti_tvout.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index f2afcf5..24a3735 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -440,13 +440,6 @@ static void sti_tvout_encoder_dpms(struct drm_encoder 
*encoder, int mode)
 {
 }

-static bool sti_tvout_encoder_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void sti_tvout_encoder_mode_set(struct drm_encoder *encoder,
   struct drm_display_mode *mode,
   struct drm_display_mode *adjusted_mode)
@@ -486,7 +479,6 @@ static void sti_dvo_encoder_disable(struct drm_encoder 
*encoder)

 static const struct drm_encoder_helper_funcs sti_dvo_encoder_helper_funcs = {
.dpms = sti_tvout_encoder_dpms,
-   .mode_fixup = sti_tvout_encoder_mode_fixup,
.mode_set = sti_tvout_encoder_mode_set,
.prepare = sti_tvout_encoder_prepare,
.commit = sti_dvo_encoder_commit,
@@ -540,7 +532,6 @@ static void sti_hda_encoder_disable(struct drm_encoder 
*encoder)

 static const struct drm_encoder_helper_funcs sti_hda_encoder_helper_funcs = {
.dpms = sti_tvout_encoder_dpms,
-   .mode_fixup = sti_tvout_encoder_mode_fixup,
.mode_set = sti_tvout_encoder_mode_set,
.prepare = sti_tvout_encoder_prepare,
.commit = sti_hda_encoder_commit,
@@ -589,7 +580,6 @@ static void sti_hdmi_encoder_disable(struct drm_encoder 
*encoder)

 static const struct drm_encoder_helper_funcs sti_hdmi_encoder_helper_funcs = {
.dpms = sti_tvout_encoder_dpms,
-   .mode_fixup = sti_tvout_encoder_mode_fixup,
.mode_set = sti_tvout_encoder_mode_set,
.prepare = sti_tvout_encoder_prepare,
.commit = sti_hdmi_encoder_commit,
-- 
2.5.0



[PATCH] drm/exynos: add mic_bypass option for exynos542x fimd

2016-02-12 Thread Inki Dae
Hi Chanho,

There was a missing one so below is my review again.

2016년 02월 11일 22:59에 Chanho Park 이(가) 쓴 글:
> Hi Inki,
> 
> On Thu, Feb 11, 2016 at 7:37 PM, Inki Dae  wrote:
>> Hi Chanho,
>>
>> 2016년 01월 30일 22:58에 Chanho Park 이(가) 쓴 글:
>>> From: Chanho Park 
>>>
>>> This patch adds a mic_bypass option to bypass the mic
>>> from display out path. The mic(Mobile image compressor) compresses
>>> RGB data from fimd and send the compressed data to the mipi dsi.
>>> The bypass option can be founded from system register and the bit
>>> of the option is 11.
>>>
>>> Cc: Inki Dae 
>>> Cc: Joonyoung Shim 
>>> Cc: Seung-Woo Kim 
>>> Signed-off-by: Chanho Park 
>>> ---
>>>  .../devicetree/bindings/display/exynos/samsung-fimd.txt|  2 ++
>>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 14 
>>> ++
>>>  2 files changed, 16 insertions(+)
>>>
>>> diff --git 
>>> a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt 
>>> b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
>>> index 27c3ce0..7f90c4a 100644
>>> --- a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
>>> +++ b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
>>> @@ -45,6 +45,8 @@ Optional Properties:
>>>   Can be used in case timings cannot be provided otherwise
>>>   or to override timings provided by the panel.
>>>  - samsung,sysreg: handle to syscon used to control the system registers
>>> +- samsung,mic-bypass: bypass mic(mobile image compressor) from display 
>>> path.

mic-bypass is not really common property for fimd family so it's not correct 
for fimd device node has mic-bypass property.

>>> +   This option is only available since exynos5420.
>>>  - i80-if-timings: timing configuration for lcd i80 interface support.
>>>- cs-setup: clock cycles for the active period of address signal is 
>>> enabled
>>>until chip select is enabled.
>>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
>>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>>> index 70194d0..4fb2952 100644
>>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>>> @@ -94,6 +94,7 @@ struct fimd_driver_data {
>>>   unsigned int lcdblk_offset;
>>>   unsigned int lcdblk_vt_shift;
>>>   unsigned int lcdblk_bypass_shift;
>>> + unsigned int lcdblk_mic_bypass_shift;
>>>
>>>   unsigned int has_shadowcon:1;
>>>   unsigned int has_clksel:1;
>>> @@ -140,6 +141,7 @@ static struct fimd_driver_data exynos5_fimd_driver_data 
>>> = {
>>>   .lcdblk_offset = 0x214,
>>>   .lcdblk_vt_shift = 24,
>>>   .lcdblk_bypass_shift = 15,
>>> + .lcdblk_mic_bypass_shift = 11,
>>>   .has_shadowcon = 1,
>>>   .has_vidoutcon = 1,
>>>   .has_vtsel = 1,
>>> @@ -162,6 +164,7 @@ struct fimd_context {
>>>   u32 i80ifcon;
>>>   booli80_if;
>>>   boolsuspended;
>>> + boolmic_bypass;
>>>   int pipe;
>>>   wait_queue_head_t   wait_vsync_queue;
>>>   atomic_twait_vsync_event;
>>> @@ -461,6 +464,14 @@ static void fimd_commit(struct exynos_drm_crtc *crtc)
>>>   return;
>>>   }
>>>
>>> + if (ctx->mic_bypass && ctx->sysreg && regmap_update_bits(ctx->sysreg,
>>> + driver_data->lcdblk_offset,
>>> + 0x1 << driver_data->lcdblk_mic_bypass_shift,
>>> + 0x1 << driver_data->lcdblk_mic_bypass_shift)) 
>>> {
>>> + DRM_ERROR("Failed to update sysreg for bypass mic.\n");
>>> + return;
>>> + }
>>
>> It'd better to consider mic path also because mic bypass bit of lcdblk could 
>> be true by bootloader. In this case, fimd driver wouldn't do anything if 
>> mic_bypass property isn't declared but the mic_bypass bit of lcdblk register 
>> is still set to 1.
> 
> Actually, I wanted to set the bit on kernel side even though it's not
> assigned from bootloader.
> If the bootloader already set the bit, that means mic will be by-pass
> and we don't care about it from kernel side.
> The option is useful when I want to skip the mic on the kernel side.
> 
>>
>> For this, I think you could check lcdblk_mic_pypass_shift to identify 
>> whether mic path is supported or not like below,
>> if (ctx->lcdblk_mic_bypass_shift) {
> 
> It causes all exynos5 fimd driver skips the mic from display path.
> How about below patch instead of this?
> 
> +   if (of_property_read_bool(dev->of_node, "samsung,mic-bypass") &&
> +   ctx->driver_data->lcdblk_mic_bypass_shift)
> +   ctx->mic_bypass = true;

So let's bypass mic path in default like lcdblk_bypass,
/* set mic bypass selection */
if (ctx->has_mic_bypass && ctx->sysreg && 

[PATCH 15/17] drm/rockchip: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index f8f8f29..7766206 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -875,13 +875,6 @@ static void dw_mipi_dsi_encoder_disable(struct drm_encoder 
*encoder)
clk_disable_unprepare(dsi->pclk);
 }

-static bool dw_mipi_dsi_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void dw_mipi_dsi_encoder_commit(struct drm_encoder *encoder)
 {
struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder);
@@ -931,7 +924,6 @@ static void dw_mipi_dsi_encoder_commit(struct drm_encoder 
*encoder)

 static struct drm_encoder_helper_funcs
 dw_mipi_dsi_encoder_helper_funcs = {
-   .mode_fixup = dw_mipi_dsi_encoder_mode_fixup,
.commit = dw_mipi_dsi_encoder_commit,
.mode_set = dw_mipi_dsi_encoder_mode_set,
.disable = dw_mipi_dsi_encoder_disable,
-- 
2.5.0



[PATCH 14/17] drm/radeon: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/radeon/atombios_encoders.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c 
b/drivers/gpu/drm/radeon/atombios_encoders.c
index 01b20e1..1603751 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -2623,16 +2623,8 @@ radeon_atom_ext_dpms(struct drm_encoder *encoder, int 
mode)

 }

-static bool radeon_atom_ext_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static const struct drm_encoder_helper_funcs radeon_atom_ext_helper_funcs = {
.dpms = radeon_atom_ext_dpms,
-   .mode_fixup = radeon_atom_ext_mode_fixup,
.prepare = radeon_atom_ext_prepare,
.mode_set = radeon_atom_ext_mode_set,
.commit = radeon_atom_ext_commit,
-- 
2.5.0



[PATCH 13/17] drm/qxl: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/qxl/qxl_display.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_display.c 
b/drivers/gpu/drm/qxl/qxl_display.c
index 8627651..43e5f50 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -734,14 +734,6 @@ static void qxl_enc_dpms(struct drm_encoder *encoder, int 
mode)
DRM_DEBUG("\n");
 }

-static bool qxl_enc_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   DRM_DEBUG("\n");
-   return true;
-}
-
 static void qxl_enc_prepare(struct drm_encoder *encoder)
 {
DRM_DEBUG("\n");
@@ -864,7 +856,6 @@ static struct drm_encoder *qxl_best_encoder(struct 
drm_connector *connector)

 static const struct drm_encoder_helper_funcs qxl_enc_helper_funcs = {
.dpms = qxl_enc_dpms,
-   .mode_fixup = qxl_enc_mode_fixup,
.prepare = qxl_enc_prepare,
.mode_set = qxl_enc_mode_set,
.commit = qxl_enc_commit,
-- 
2.5.0



[PATCH 12/17] drm/mgag200: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/mgag200/mgag200_mode.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c 
b/drivers/gpu/drm/mgag200/mgag200_mode.c
index dc13c48..af8b4c1 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -1479,13 +1479,6 @@ void mga_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 
*red, u16 *green,
  * These functions are analagous to those in the CRTC code, but are intended
  * to handle any encoder-specific limitations
  */
-static bool mga_encoder_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void mga_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -1515,7 +1508,6 @@ static void mga_encoder_destroy(struct drm_encoder 
*encoder)

 static const struct drm_encoder_helper_funcs mga_encoder_helper_funcs = {
.dpms = mga_encoder_dpms,
-   .mode_fixup = mga_encoder_mode_fixup,
.mode_set = mga_encoder_mode_set,
.prepare = mga_encoder_prepare,
.commit = mga_encoder_commit,
-- 
2.5.0



[PATCH 11/17] drm/msm/mdp: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c  | 8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c  | 8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c | 8 
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c  | 9 -
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c  | 8 
 5 files changed, 41 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c
index 2f57e94..106f0e7 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c
@@ -47,13 +47,6 @@ static const struct drm_encoder_funcs mdp4_dsi_encoder_funcs 
= {
.destroy = mdp4_dsi_encoder_destroy,
 };

-static bool mdp4_dsi_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void mdp4_dsi_encoder_mode_set(struct drm_encoder *encoder,
  struct drm_display_mode *mode,
  struct drm_display_mode *adjusted_mode)
@@ -163,7 +156,6 @@ static void mdp4_dsi_encoder_enable(struct drm_encoder 
*encoder)
 }

 static const struct drm_encoder_helper_funcs mdp4_dsi_encoder_helper_funcs = {
-   .mode_fixup = mdp4_dsi_encoder_mode_fixup,
.mode_set = mdp4_dsi_encoder_mode_set,
.disable = mdp4_dsi_encoder_disable,
.enable = mdp4_dsi_encoder_enable,
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c
index a21df54..35ad78a 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c
@@ -94,13 +94,6 @@ static const struct drm_encoder_funcs mdp4_dtv_encoder_funcs 
= {
.destroy = mdp4_dtv_encoder_destroy,
 };

-static bool mdp4_dtv_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void mdp4_dtv_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -234,7 +227,6 @@ static void mdp4_dtv_encoder_enable(struct drm_encoder 
*encoder)
 }

 static const struct drm_encoder_helper_funcs mdp4_dtv_encoder_helper_funcs = {
-   .mode_fixup = mdp4_dtv_encoder_mode_fixup,
.mode_set = mdp4_dtv_encoder_mode_set,
.enable = mdp4_dtv_encoder_enable,
.disable = mdp4_dtv_encoder_disable,
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
index cd63fed..bc3d8e7 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
@@ -260,13 +260,6 @@ static void setup_phy(struct drm_encoder *encoder)
mdp4_write(mdp4_kms, REG_MDP4_LVDS_PHY_CFG0, lvds_phy_cfg0);
 }

-static bool mdp4_lcdc_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void mdp4_lcdc_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -430,7 +423,6 @@ static void mdp4_lcdc_encoder_enable(struct drm_encoder 
*encoder)
 }

 static const struct drm_encoder_helper_funcs mdp4_lcdc_encoder_helper_funcs = {
-   .mode_fixup = mdp4_lcdc_encoder_mode_fixup,
.mode_set = mdp4_lcdc_encoder_mode_set,
.disable = mdp4_lcdc_encoder_disable,
.enable = mdp4_lcdc_encoder_enable,
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c
index 1aa21db..69094cb 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c
@@ -188,13 +188,6 @@ static const struct drm_encoder_funcs 
mdp5_cmd_encoder_funcs = {
.destroy = mdp5_cmd_encoder_destroy,
 };

-static bool mdp5_cmd_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void mdp5_cmd_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -256,7 +249,6 @@ static void mdp5_cmd_encoder_enable(struct drm_encoder 
*encoder)
 }

 static const struct drm_encoder_helper_funcs mdp5_cmd_encoder_helper_funcs = {
-   .mode_fixup = mdp5_cmd_encoder_mode_fixup,
.mode_set = mdp5_cmd_encoder_mode_set,
.disable = mdp5_cmd_encoder_disable,
.enable = mdp5_cmd_encoder_enable,
@@ -340,4 +332,3 @@ fail:

return 

[PATCH 10/17] drm/imx: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/imx/dw_hdmi-imx.c  | 8 
 drivers/gpu/drm/imx/imx-ldb.c  | 8 
 drivers/gpu/drm/imx/imx-tve.c  | 8 
 drivers/gpu/drm/imx/parallel-display.c | 8 
 4 files changed, 32 deletions(-)

diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c 
b/drivers/gpu/drm/imx/dw_hdmi-imx.c
index 063825f..21d6158 100644
--- a/drivers/gpu/drm/imx/dw_hdmi-imx.c
+++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c
@@ -109,13 +109,6 @@ static void dw_hdmi_imx_encoder_disable(struct drm_encoder 
*encoder)
 {
 }

-static bool dw_hdmi_imx_encoder_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adj_mode)
-{
-   return true;
-}
-
 static void dw_hdmi_imx_encoder_mode_set(struct drm_encoder *encoder,
 struct drm_display_mode *mode,
 struct drm_display_mode *adj_mode)
@@ -138,7 +131,6 @@ static void dw_hdmi_imx_encoder_prepare(struct drm_encoder 
*encoder)
 }

 static const struct drm_encoder_helper_funcs dw_hdmi_imx_encoder_helper_funcs 
= {
-   .mode_fixup = dw_hdmi_imx_encoder_mode_fixup,
.mode_set   = dw_hdmi_imx_encoder_mode_set,
.prepare= dw_hdmi_imx_encoder_prepare,
.commit = dw_hdmi_imx_encoder_commit,
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index 22ac482..024d613 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -139,13 +139,6 @@ static void imx_ldb_encoder_dpms(struct drm_encoder 
*encoder, int mode)
 {
 }

-static bool imx_ldb_encoder_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void imx_ldb_set_clock(struct imx_ldb *ldb, int mux, int chno,
unsigned long serial_clk, unsigned long di_clk)
 {
@@ -376,7 +369,6 @@ static const struct drm_encoder_funcs imx_ldb_encoder_funcs 
= {

 static const struct drm_encoder_helper_funcs imx_ldb_encoder_helper_funcs = {
.dpms = imx_ldb_encoder_dpms,
-   .mode_fixup = imx_ldb_encoder_mode_fixup,
.prepare = imx_ldb_encoder_prepare,
.commit = imx_ldb_encoder_commit,
.mode_set = imx_ldb_encoder_mode_set,
diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c
index 292349f..ae7a9fb 100644
--- a/drivers/gpu/drm/imx/imx-tve.c
+++ b/drivers/gpu/drm/imx/imx-tve.c
@@ -286,13 +286,6 @@ static void imx_tve_encoder_dpms(struct drm_encoder 
*encoder, int mode)
dev_err(tve->dev, "failed to disable TVOUT: %d\n", ret);
 }

-static bool imx_tve_encoder_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void imx_tve_encoder_prepare(struct drm_encoder *encoder)
 {
struct imx_tve *tve = enc_to_tve(encoder);
@@ -379,7 +372,6 @@ static const struct drm_encoder_funcs imx_tve_encoder_funcs 
= {

 static const struct drm_encoder_helper_funcs imx_tve_encoder_helper_funcs = {
.dpms = imx_tve_encoder_dpms,
-   .mode_fixup = imx_tve_encoder_mode_fixup,
.prepare = imx_tve_encoder_prepare,
.mode_set = imx_tve_encoder_mode_set,
.commit = imx_tve_encoder_commit,
diff --git a/drivers/gpu/drm/imx/parallel-display.c 
b/drivers/gpu/drm/imx/parallel-display.c
index 0ffef17..363e2c7 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -112,13 +112,6 @@ static void imx_pd_encoder_dpms(struct drm_encoder 
*encoder, int mode)
drm_panel_enable(imxpd->panel);
 }

-static bool imx_pd_encoder_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void imx_pd_encoder_prepare(struct drm_encoder *encoder)
 {
struct imx_parallel_display *imxpd = enc_to_imxpd(encoder);
@@ -166,7 +159,6 @@ static const struct drm_encoder_funcs imx_pd_encoder_funcs 
= {

 static const struct drm_encoder_helper_funcs imx_pd_encoder_helper_funcs = {
.dpms = imx_pd_encoder_dpms,
-   .mode_fixup = imx_pd_encoder_mode_fixup,
.prepare = imx_pd_encoder_prepare,
.commit = imx_pd_encoder_commit,
.mode_set = imx_pd_encoder_mode_set,
-- 
2.5.0



[PATCH 09/17] drm/gma500: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/gma500/cdv_intel_crt.c  | 1 -
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 1 -
 drivers/gpu/drm/gma500/gma_display.c| 7 ---
 drivers/gpu/drm/gma500/gma_display.h| 3 ---
 drivers/gpu/drm/gma500/oaktrail_hdmi.c  | 1 -
 5 files changed, 13 deletions(-)

diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c 
b/drivers/gpu/drm/gma500/cdv_intel_crt.c
index d0717a8..b837e7a 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_crt.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c
@@ -217,7 +217,6 @@ static int cdv_intel_crt_set_property(struct drm_connector 
*connector,

 static const struct drm_encoder_helper_funcs cdv_intel_crt_helper_funcs = {
.dpms = cdv_intel_crt_dpms,
-   .mode_fixup = gma_encoder_mode_fixup,
.prepare = gma_encoder_prepare,
.commit = gma_encoder_commit,
.mode_set = cdv_intel_crt_mode_set,
diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c 
b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
index ddf2d77..28f9d90 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
@@ -255,7 +255,6 @@ static void cdv_hdmi_destroy(struct drm_connector 
*connector)

 static const struct drm_encoder_helper_funcs cdv_hdmi_helper_funcs = {
.dpms = cdv_hdmi_dpms,
-   .mode_fixup = gma_encoder_mode_fixup,
.prepare = gma_encoder_prepare,
.mode_set = cdv_hdmi_mode_set,
.commit = gma_encoder_commit,
diff --git a/drivers/gpu/drm/gma500/gma_display.c 
b/drivers/gpu/drm/gma500/gma_display.c
index ff17af4..9270821 100644
--- a/drivers/gpu/drm/gma500/gma_display.c
+++ b/drivers/gpu/drm/gma500/gma_display.c
@@ -478,13 +478,6 @@ int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int 
y)
return 0;
 }

-bool gma_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 bool gma_crtc_mode_fixup(struct drm_crtc *crtc,
 const struct drm_display_mode *mode,
 struct drm_display_mode *adjusted_mode)
diff --git a/drivers/gpu/drm/gma500/gma_display.h 
b/drivers/gpu/drm/gma500/gma_display.h
index ed569d8..78b9f98 100644
--- a/drivers/gpu/drm/gma500/gma_display.h
+++ b/drivers/gpu/drm/gma500/gma_display.h
@@ -90,9 +90,6 @@ extern void gma_crtc_restore(struct drm_crtc *crtc);
 extern void gma_encoder_prepare(struct drm_encoder *encoder);
 extern void gma_encoder_commit(struct drm_encoder *encoder);
 extern void gma_encoder_destroy(struct drm_encoder *encoder);
-extern bool gma_encoder_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode);

 /* Common clock related functions */
 extern const struct gma_limit_t *gma_limit(struct drm_crtc *crtc, int refclk);
diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c 
b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
index 2d18499..8b2eb32 100644
--- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
+++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
@@ -601,7 +601,6 @@ static void oaktrail_hdmi_destroy(struct drm_connector 
*connector)

 static const struct drm_encoder_helper_funcs oaktrail_hdmi_helper_funcs = {
.dpms = oaktrail_hdmi_dpms,
-   .mode_fixup = gma_encoder_mode_fixup,
.prepare = gma_encoder_prepare,
.mode_set = oaktrail_hdmi_mode_set,
.commit = gma_encoder_commit,
-- 
2.5.0



[PATCH 08/17] drm/exynos: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/exynos/exynos_dp_core.c  | 8 
 drivers/gpu/drm/exynos/exynos_drm_dpi.c  | 8 
 drivers/gpu/drm/exynos/exynos_drm_vidi.c | 8 
 3 files changed, 24 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 673164b..9fd12c62 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1155,13 +1155,6 @@ static int exynos_dp_create_connector(struct drm_encoder 
*encoder)
return 0;
 }

-static bool exynos_dp_mode_fixup(struct drm_encoder *encoder,
-const struct drm_display_mode *mode,
-struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void exynos_dp_mode_set(struct drm_encoder *encoder,
   struct drm_display_mode *mode,
   struct drm_display_mode *adjusted_mode)
@@ -1177,7 +1170,6 @@ static void exynos_dp_disable(struct drm_encoder *encoder)
 }

 static const struct drm_encoder_helper_funcs exynos_dp_encoder_helper_funcs = {
-   .mode_fixup = exynos_dp_mode_fixup,
.mode_set = exynos_dp_mode_set,
.enable = exynos_dp_enable,
.disable = exynos_dp_disable,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 05350ae..75e570f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -128,13 +128,6 @@ static int exynos_dpi_create_connector(struct drm_encoder 
*encoder)
return 0;
 }

-static bool exynos_dpi_mode_fixup(struct drm_encoder *encoder,
- const struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void exynos_dpi_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -162,7 +155,6 @@ static void exynos_dpi_disable(struct drm_encoder *encoder)
 }

 static const struct drm_encoder_helper_funcs exynos_dpi_encoder_helper_funcs = 
{
-   .mode_fixup = exynos_dpi_mode_fixup,
.mode_set = exynos_dpi_mode_set,
.enable = exynos_dpi_enable,
.disable = exynos_dpi_disable,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c 
b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index 62ac4e5..65108cb 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -410,13 +410,6 @@ static int vidi_create_connector(struct drm_encoder 
*encoder)
return 0;
 }

-static bool exynos_vidi_mode_fixup(struct drm_encoder *encoder,
-const struct drm_display_mode *mode,
-struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void exynos_vidi_mode_set(struct drm_encoder *encoder,
   struct drm_display_mode *mode,
   struct drm_display_mode *adjusted_mode)
@@ -432,7 +425,6 @@ static void exynos_vidi_disable(struct drm_encoder *encoder)
 }

 static const struct drm_encoder_helper_funcs exynos_vidi_encoder_helper_funcs 
= {
-   .mode_fixup = exynos_vidi_mode_fixup,
.mode_set = exynos_vidi_mode_set,
.enable = exynos_vidi_enable,
.disable = exynos_vidi_disable,
-- 
2.5.0



[PATCH 07/17] drm/cirrus: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/cirrus/cirrus_mode.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c 
b/drivers/gpu/drm/cirrus/cirrus_mode.c
index 4a02854..432ce94 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -430,14 +430,6 @@ void cirrus_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 
*red, u16 *green,
*blue = cirrus_crtc->lut_b[regno];
 }

-
-static bool cirrus_encoder_mode_fixup(struct drm_encoder *encoder,
- const struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void cirrus_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -466,7 +458,6 @@ static void cirrus_encoder_destroy(struct drm_encoder 
*encoder)

 static const struct drm_encoder_helper_funcs cirrus_encoder_helper_funcs = {
.dpms = cirrus_encoder_dpms,
-   .mode_fixup = cirrus_encoder_mode_fixup,
.mode_set = cirrus_encoder_mode_set,
.prepare = cirrus_encoder_prepare,
.commit = cirrus_encoder_commit,
-- 
2.5.0



[PATCH 06/17] drm/bochs: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/bochs/bochs_kms.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs_kms.c 
b/drivers/gpu/drm/bochs/bochs_kms.c
index 2849f1b..317c27f 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -152,13 +152,6 @@ static void bochs_crtc_init(struct drm_device *dev)
drm_crtc_helper_add(crtc, _helper_funcs);
 }

-static bool bochs_encoder_mode_fixup(struct drm_encoder *encoder,
-const struct drm_display_mode *mode,
-struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void bochs_encoder_mode_set(struct drm_encoder *encoder,
   struct drm_display_mode *mode,
   struct drm_display_mode *adjusted_mode)
@@ -179,7 +172,6 @@ static void bochs_encoder_commit(struct drm_encoder 
*encoder)

 static const struct drm_encoder_helper_funcs bochs_encoder_helper_funcs = {
.dpms = bochs_encoder_dpms,
-   .mode_fixup = bochs_encoder_mode_fixup,
.mode_set = bochs_encoder_mode_set,
.prepare = bochs_encoder_prepare,
.commit = bochs_encoder_commit,
-- 
2.5.0



[PATCH 05/17] drm/ast: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/ast/ast_mode.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index 0123458..f221e2d 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -710,13 +710,6 @@ static void ast_encoder_dpms(struct drm_encoder *encoder, 
int mode)

 }

-static bool ast_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void ast_encoder_mode_set(struct drm_encoder *encoder,
   struct drm_display_mode *mode,
   struct drm_display_mode *adjusted_mode)
@@ -736,7 +729,6 @@ static void ast_encoder_commit(struct drm_encoder *encoder)

 static const struct drm_encoder_helper_funcs ast_enc_helper_funcs = {
.dpms = ast_encoder_dpms,
-   .mode_fixup = ast_mode_fixup,
.prepare = ast_encoder_prepare,
.commit = ast_encoder_commit,
.mode_set = ast_encoder_mode_set,
-- 
2.5.0



[Intel-gfx] [PATCH v10 2/4] drm/dp: Add a drm_aux-dev module for reading/writing dpcd registers.

2016-02-12 Thread Ville Syrjälä
On Thu, Jan 21, 2016 at 03:10:19PM -0800, Rafael Antognolli wrote:
> This module is heavily based on i2c-dev. Once loaded, it provides one
> dev node per DP AUX channel, named drm_dp_auxN, where N is an integer.
> 
> It's possible to know which connector owns this aux channel by looking
> at the respective sysfs /sys/class/drm_aux_dev/drm_dp_auxN/connector, if
> the connector device pointer was correctly set in the aux helper struct.
> 
> Two main operations are provided on the registers read and write. The
> address of the register to be read or written is given using lseek. The
> seek position is updated upon read or write.
> 
> v2:
>  - lseek is used to select the register to read/write
>  - read/write are used instead of ioctl
>  - no blocking_notifier is used, just a direct callback
> 
> v3:
>  - use drm_dp_aux_dev prefix for public functions
>  - chardev is named drm_dp_auxN
>  - read/write don't allocate a buffer anymore, and transfer up to 16 bytes a
>time
>  - remove notifier list from the implementation
>  - option on menuconfig is now a boolean
>  - add inline stub functions to avoid breakage when this option is disabled
> 
> v4:
>  - fix build system changes - actually disable this module when not selected.
> 
> v5:
>  - Use kref to avoid device closing while still in use
>  - Don't use list, use an idr for storing aux_dev
>  - Remove "connector" attribute
>  - set aux.dev to the connector drm_connector device, instead of
>drm_device
> 
> v6:
>  - Use atomic_t for usage count
>  - Use a mutex instead of spinlock for idr lock
>  - Destroy chardev immediately on unregister
>  - other minor suggestions from Ville
> 
> v7:
>  - style fixes
>  - error handling fixes
> 
> v8:
>  - more error handling fixes
> 
> v9:
>  - remove module_init and module_exit, and add drm_dp_aux_dev_init/exit
>  to drm_kms_helper_init/exit.
> 
> Signed-off-by: Rafael Antognolli 

Only checked the init/exit stuff since I should have read the rest 
many times by now.

Reviewed-by: Ville Syrjälä 

> ---
>  drivers/gpu/drm/Kconfig |   8 +
>  drivers/gpu/drm/Makefile|   1 +
>  drivers/gpu/drm/drm_dp_aux_dev.c| 368 
> 
>  drivers/gpu/drm/drm_dp_helper.c |  16 +-
>  drivers/gpu/drm/drm_kms_helper_common.c |  15 +-
>  include/drm/drm_dp_aux_dev.h|  62 ++
>  6 files changed, 468 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/gpu/drm/drm_dp_aux_dev.c
>  create mode 100644 include/drm/drm_dp_aux_dev.h
> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 59babd5..dff87ca 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -25,6 +25,14 @@ config DRM_MIPI_DSI
>   bool
>   depends on DRM
>  
> +config DRM_DP_AUX_CHARDEV
> + bool "DRM DP AUX Interface"
> + depends on DRM
> + help
> +   Choose this option to enable a /dev/drm_dp_auxN node that allows to
> +   read and write values to arbitrary DPCD registers on the DP aux
> +   channel.
> +
>  config DRM_KMS_HELPER
>   tristate
>   depends on DRM
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index dfe513f..424fcb7 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -30,6 +30,7 @@ drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o 
> drm_probe_helper.o \
>  drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
>  drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
>  drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
> +drm_kms_helper-$(CONFIG_DRM_DP_AUX_CHARDEV) += drm_dp_aux_dev.o
>  
>  obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
>  
> diff --git a/drivers/gpu/drm/drm_dp_aux_dev.c 
> b/drivers/gpu/drm/drm_dp_aux_dev.c
> new file mode 100644
> index 000..f73b38b
> --- /dev/null
> +++ b/drivers/gpu/drm/drm_dp_aux_dev.c
> @@ -0,0 +1,368 @@
> +/*
> + * Copyright © 2015 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN 

[PATCH v10 1/4] drm/kms_helper: Add a common place to call init and exit functions.

2016-02-12 Thread Ville Syrjälä
On Thu, Jan 21, 2016 at 03:10:18PM -0800, Rafael Antognolli wrote:
> The module_init and module_exit functions will start here, and call the
> subsequent init's and exit's.
> 
> v10:
>  - Keep __init on drm_fb_helper init function.
>  - Move MODULE_* macros to the common file.
> 
> Signed-off-by: Rafael Antognolli 

Looks all right to me.

Reviewed-by: Ville Syrjälä 

> ---
>  drivers/gpu/drm/Makefile|  4 ++-
>  drivers/gpu/drm/drm_crtc_helper.c   |  3 ---
>  drivers/gpu/drm/drm_fb_helper.c |  9 +++
>  drivers/gpu/drm/drm_kms_helper_common.c | 47 
> +
>  include/drm/drm_fb_helper.h |  6 +
>  5 files changed, 60 insertions(+), 9 deletions(-)
>  create mode 100644 drivers/gpu/drm/drm_kms_helper_common.c
> 
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index f858aa2..dfe513f 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -24,7 +24,9 @@ drm-$(CONFIG_AGP) += drm_agpsupport.o
>  drm-y += $(drm-m)
>  
>  drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \
> - drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o
> + drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o \
> + drm_kms_helper_common.o
> +
>  drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
>  drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
>  drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
> b/drivers/gpu/drm/drm_crtc_helper.c
> index 5d4bc64..baac181 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -73,9 +73,6 @@
>   * _crtc_helper_funcs, struct _encoder_helper_funcs and struct
>   * _connector_helper_funcs.
>   */
> -MODULE_AUTHOR("David Airlie, Jesse Barnes");
> -MODULE_DESCRIPTION("DRM KMS helper");
> -MODULE_LICENSE("GPL and additional rights");
>  
>  /**
>   * drm_helper_move_panel_connectors_to_head() - move panels to the front in 
> the
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 1e103c4..c27b964 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -2175,9 +2175,9 @@ EXPORT_SYMBOL(drm_fb_helper_hotplug_event);
>   * but the module doesn't depend on any fb console symbols.  At least
>   * attempt to load fbcon to avoid leaving the system without a usable 
> console.
>   */
> -#if defined(CONFIG_FRAMEBUFFER_CONSOLE_MODULE) && !defined(CONFIG_EXPERT)
> -static int __init drm_fb_helper_modinit(void)
> +int __init drm_fb_helper_modinit(void)
>  {
> +#if defined(CONFIG_FRAMEBUFFER_CONSOLE_MODULE) && !defined(CONFIG_EXPERT)
>   const char *name = "fbcon";
>   struct module *fbcon;
>  
> @@ -2187,8 +2187,7 @@ static int __init drm_fb_helper_modinit(void)
>  
>   if (!fbcon)
>   request_module_nowait(name);
> +#endif
>   return 0;
>  }
> -
> -module_init(drm_fb_helper_modinit);
> -#endif
> +EXPORT_SYMBOL(drm_fb_helper_modinit);
> diff --git a/drivers/gpu/drm/drm_kms_helper_common.c 
> b/drivers/gpu/drm/drm_kms_helper_common.c
> new file mode 100644
> index 000..d361005
> --- /dev/null
> +++ b/drivers/gpu/drm/drm_kms_helper_common.c
> @@ -0,0 +1,47 @@
> +/*
> + * Copyright © 2015 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> DEALINGS
> + * IN THE SOFTWARE.
> + *
> + * Authors:
> + *Rafael Antognolli 
> + *
> + */
> +
> +#include 
> +#include 
> +
> +MODULE_AUTHOR("David Airlie, Jesse Barnes");
> +MODULE_DESCRIPTION("DRM KMS helper");
> +MODULE_LICENSE("GPL and additional rights");
> +
> +static int __init drm_kms_helper_init(void)
> +{
> + /* Call init functions from specific kms helpers here */
> + return drm_fb_helper_modinit();
> +}
> +
> +static void __exit 

[PATCH 04/17] drm/amdgpu: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 8 
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 8 
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c  | 8 
 3 files changed, 24 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 093599a..3483018 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -3624,16 +3624,8 @@ dce_v10_0_ext_dpms(struct drm_encoder *encoder, int mode)

 }

-static bool dce_v10_0_ext_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static const struct drm_encoder_helper_funcs dce_v10_0_ext_helper_funcs = {
.dpms = dce_v10_0_ext_dpms,
-   .mode_fixup = dce_v10_0_ext_mode_fixup,
.prepare = dce_v10_0_ext_prepare,
.mode_set = dce_v10_0_ext_mode_set,
.commit = dce_v10_0_ext_commit,
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 8e67249..36deea1 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -3619,16 +3619,8 @@ dce_v11_0_ext_dpms(struct drm_encoder *encoder, int mode)

 }

-static bool dce_v11_0_ext_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static const struct drm_encoder_helper_funcs dce_v11_0_ext_helper_funcs = {
.dpms = dce_v11_0_ext_dpms,
-   .mode_fixup = dce_v11_0_ext_mode_fixup,
.prepare = dce_v11_0_ext_prepare,
.mode_set = dce_v11_0_ext_mode_set,
.commit = dce_v11_0_ext_commit,
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index d0e128c..25dd8b6 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -3554,16 +3554,8 @@ dce_v8_0_ext_dpms(struct drm_encoder *encoder, int mode)

 }

-static bool dce_v8_0_ext_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static const struct drm_encoder_helper_funcs dce_v8_0_ext_helper_funcs = {
.dpms = dce_v8_0_ext_dpms,
-   .mode_fixup = dce_v8_0_ext_mode_fixup,
.prepare = dce_v8_0_ext_prepare,
.mode_set = dce_v8_0_ext_mode_set,
.commit = dce_v8_0_ext_commit,
-- 
2.5.0



[PATCH 03/17] drm/exynos: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index e977a81..736115c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1597,13 +1597,6 @@ static int exynos_dsi_create_connector(struct 
drm_encoder *encoder)
return 0;
 }

-static bool exynos_dsi_mode_fixup(struct drm_encoder *encoder,
- const struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void exynos_dsi_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -1623,7 +1616,6 @@ static void exynos_dsi_mode_set(struct drm_encoder 
*encoder,
 }

 static const struct drm_encoder_helper_funcs exynos_dsi_encoder_helper_funcs = 
{
-   .mode_fixup = exynos_dsi_mode_fixup,
.mode_set = exynos_dsi_mode_set,
.enable = exynos_dsi_enable,
.disable = exynos_dsi_disable,
-- 
2.5.0



[PATCH 02/17] drm/udl: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/udl/udl_encoder.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/udl/udl_encoder.c 
b/drivers/gpu/drm/udl/udl_encoder.c
index a181a64..59a4b34 100644
--- a/drivers/gpu/drm/udl/udl_encoder.c
+++ b/drivers/gpu/drm/udl/udl_encoder.c
@@ -26,13 +26,6 @@ static void udl_encoder_disable(struct drm_encoder *encoder)
 {
 }

-static bool udl_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void udl_encoder_prepare(struct drm_encoder *encoder)
 {
 }
@@ -54,7 +47,6 @@ udl_encoder_dpms(struct drm_encoder *encoder, int mode)

 static const struct drm_encoder_helper_funcs udl_helper_funcs = {
.dpms = udl_encoder_dpms,
-   .mode_fixup = udl_mode_fixup,
.prepare = udl_encoder_prepare,
.mode_set = udl_encoder_mode_set,
.commit = udl_encoder_commit,
-- 
2.5.0



[PATCH 01/17] drm/virtio: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c 
b/drivers/gpu/drm/virtio/virtgpu_display.c
index a165f03..429aa31 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -282,13 +282,6 @@ static const struct drm_crtc_helper_funcs 
virtio_gpu_crtc_helper_funcs = {
.atomic_check  = virtio_gpu_crtc_atomic_check,
 };

-static bool virtio_gpu_enc_mode_fixup(struct drm_encoder *encoder,
- const struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void virtio_gpu_enc_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -362,7 +355,6 @@ virtio_gpu_best_encoder(struct drm_connector *connector)
 }

 static const struct drm_encoder_helper_funcs virtio_gpu_enc_helper_funcs = {
-   .mode_fixup = virtio_gpu_enc_mode_fixup,
.mode_set   = virtio_gpu_enc_mode_set,
.enable = virtio_gpu_enc_enable,
.disable= virtio_gpu_enc_disable,
-- 
2.5.0



[PATCH 00/17] drm encoders cleanup: nuke optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
mode_fixup function for encoder drivers became optional with patch
http://patchwork.freedesktop.org/patch/msgid/1455106522-32307-1-git-send-email-palminha
 at synopsys.com

This patch set nukes all the dummy mode_fixup implementations.

(made on top of Daniel topic/drm-misc branch)

Carlos Palminha (17):
  drm/virtio: removed optional dummy encoder mode_fixup function.
  drm/udl: removed optional dummy encoder mode_fixup function.
  drm/exynos: removed optional dummy encoder mode_fixup function.
  drm/amdgpu: removed optional dummy encoder mode_fixup function.
  drm/ast: removed optional dummy encoder mode_fixup function.
  drm/bochs: removed optional dummy encoder mode_fixup function.
  drm/cirrus: removed optional dummy encoder mode_fixup function.
  drm/exynos: removed optional dummy encoder mode_fixup function.
  drm/gma500: removed optional dummy encoder mode_fixup function.
  drm/imx: removed optional dummy encoder mode_fixup function.
  drm/msm/mdp: removed optional dummy encoder mode_fixup function.
  drm/mgag200: removed optional dummy encoder mode_fixup function.
  drm/qxl: removed optional dummy encoder mode_fixup function.
  drm/radeon: removed optional dummy encoder mode_fixup function.
  drm/rockchip: removed optional dummy encoder mode_fixup function.
  drm/sti: removed optional dummy encoder mode_fixup function.
  drm/tilcdc: removed optional dummy encoder mode_fixup function.

 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c   |  8 
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c   |  8 
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c|  8 
 drivers/gpu/drm/ast/ast_mode.c   |  8 
 drivers/gpu/drm/bochs/bochs_kms.c|  8 
 drivers/gpu/drm/cirrus/cirrus_mode.c |  9 -
 drivers/gpu/drm/exynos/exynos_dp_core.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_dpi.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_dsi.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_vidi.c |  8 
 drivers/gpu/drm/gma500/cdv_intel_crt.c   |  1 -
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c  |  1 -
 drivers/gpu/drm/gma500/gma_display.c |  7 ---
 drivers/gpu/drm/gma500/gma_display.h |  3 ---
 drivers/gpu/drm/gma500/oaktrail_hdmi.c   |  1 -
 drivers/gpu/drm/imx/dw_hdmi-imx.c|  8 
 drivers/gpu/drm/imx/imx-ldb.c|  8 
 drivers/gpu/drm/imx/imx-tve.c|  8 
 drivers/gpu/drm/imx/parallel-display.c   |  8 
 drivers/gpu/drm/mgag200/mgag200_mode.c   |  8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c  |  8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c  |  8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c |  8 
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c  |  9 -
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c  |  8 
 drivers/gpu/drm/qxl/qxl_display.c|  9 -
 drivers/gpu/drm/radeon/atombios_encoders.c   |  8 
 drivers/gpu/drm/rockchip/dw-mipi-dsi.c   |  8 
 drivers/gpu/drm/sti/sti_tvout.c  | 10 --
 drivers/gpu/drm/tilcdc/tilcdc_panel.c|  9 -
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c   |  9 -
 drivers/gpu/drm/udl/udl_encoder.c|  8 
 drivers/gpu/drm/virtio/virtgpu_display.c |  8 
 33 files changed, 244 deletions(-)

-- 
2.5.0



[PATCH 04/17] drm/amdgpu: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 8 
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 8 
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c  | 8 
 3 files changed, 24 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 093599a..3483018 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -3624,16 +3624,8 @@ dce_v10_0_ext_dpms(struct drm_encoder *encoder, int mode)

 }

-static bool dce_v10_0_ext_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static const struct drm_encoder_helper_funcs dce_v10_0_ext_helper_funcs = {
.dpms = dce_v10_0_ext_dpms,
-   .mode_fixup = dce_v10_0_ext_mode_fixup,
.prepare = dce_v10_0_ext_prepare,
.mode_set = dce_v10_0_ext_mode_set,
.commit = dce_v10_0_ext_commit,
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 8e67249..36deea1 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -3619,16 +3619,8 @@ dce_v11_0_ext_dpms(struct drm_encoder *encoder, int mode)

 }

-static bool dce_v11_0_ext_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static const struct drm_encoder_helper_funcs dce_v11_0_ext_helper_funcs = {
.dpms = dce_v11_0_ext_dpms,
-   .mode_fixup = dce_v11_0_ext_mode_fixup,
.prepare = dce_v11_0_ext_prepare,
.mode_set = dce_v11_0_ext_mode_set,
.commit = dce_v11_0_ext_commit,
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index d0e128c..25dd8b6 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -3554,16 +3554,8 @@ dce_v8_0_ext_dpms(struct drm_encoder *encoder, int mode)

 }

-static bool dce_v8_0_ext_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static const struct drm_encoder_helper_funcs dce_v8_0_ext_helper_funcs = {
.dpms = dce_v8_0_ext_dpms,
-   .mode_fixup = dce_v8_0_ext_mode_fixup,
.prepare = dce_v8_0_ext_prepare,
.mode_set = dce_v8_0_ext_mode_set,
.commit = dce_v8_0_ext_commit,
-- 
2.5.0



[PATCH 03/17] drm/exynos: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index e977a81..736115c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1597,13 +1597,6 @@ static int exynos_dsi_create_connector(struct 
drm_encoder *encoder)
return 0;
 }

-static bool exynos_dsi_mode_fixup(struct drm_encoder *encoder,
- const struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void exynos_dsi_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -1623,7 +1616,6 @@ static void exynos_dsi_mode_set(struct drm_encoder 
*encoder,
 }

 static const struct drm_encoder_helper_funcs exynos_dsi_encoder_helper_funcs = 
{
-   .mode_fixup = exynos_dsi_mode_fixup,
.mode_set = exynos_dsi_mode_set,
.enable = exynos_dsi_enable,
.disable = exynos_dsi_disable,
-- 
2.5.0



[PATCH 02/17] drm/udl: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/udl/udl_encoder.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/udl/udl_encoder.c 
b/drivers/gpu/drm/udl/udl_encoder.c
index a181a64..59a4b34 100644
--- a/drivers/gpu/drm/udl/udl_encoder.c
+++ b/drivers/gpu/drm/udl/udl_encoder.c
@@ -26,13 +26,6 @@ static void udl_encoder_disable(struct drm_encoder *encoder)
 {
 }

-static bool udl_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void udl_encoder_prepare(struct drm_encoder *encoder)
 {
 }
@@ -54,7 +47,6 @@ udl_encoder_dpms(struct drm_encoder *encoder, int mode)

 static const struct drm_encoder_helper_funcs udl_helper_funcs = {
.dpms = udl_encoder_dpms,
-   .mode_fixup = udl_mode_fixup,
.prepare = udl_encoder_prepare,
.mode_set = udl_encoder_mode_set,
.commit = udl_encoder_commit,
-- 
2.5.0



[PATCH 01/17] drm/virtio: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c 
b/drivers/gpu/drm/virtio/virtgpu_display.c
index a165f03..429aa31 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -282,13 +282,6 @@ static const struct drm_crtc_helper_funcs 
virtio_gpu_crtc_helper_funcs = {
.atomic_check  = virtio_gpu_crtc_atomic_check,
 };

-static bool virtio_gpu_enc_mode_fixup(struct drm_encoder *encoder,
- const struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void virtio_gpu_enc_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -362,7 +355,6 @@ virtio_gpu_best_encoder(struct drm_connector *connector)
 }

 static const struct drm_encoder_helper_funcs virtio_gpu_enc_helper_funcs = {
-   .mode_fixup = virtio_gpu_enc_mode_fixup,
.mode_set   = virtio_gpu_enc_mode_set,
.enable = virtio_gpu_enc_enable,
.disable= virtio_gpu_enc_disable,
-- 
2.5.0



[PATCH 00/17] drm encoders cleanup: nuke optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
mode_fixup function for encoder drivers became optional with patch
http://patchwork.freedesktop.org/patch/msgid/1455106522-32307-1-git-send-email-palminha
 at synopsys.com

This patch set nukes all the dummy mode_fixup implementations.

(made on top of Daniel topic/drm-misc branch)

Carlos Palminha (17):
  drm/virtio: removed optional dummy encoder mode_fixup function.
  drm/udl: removed optional dummy encoder mode_fixup function.
  drm/exynos: removed optional dummy encoder mode_fixup function.
  drm/amdgpu: removed optional dummy encoder mode_fixup function.
  drm/ast: removed optional dummy encoder mode_fixup function.
  drm/bochs: removed optional dummy encoder mode_fixup function.
  drm/cirrus: removed optional dummy encoder mode_fixup function.
  drm/exynos: removed optional dummy encoder mode_fixup function.
  drm/gma500: removed optional dummy encoder mode_fixup function.
  drm/imx: removed optional dummy encoder mode_fixup function.
  drm/msm/mdp: removed optional dummy encoder mode_fixup function.
  drm/mgag200: removed optional dummy encoder mode_fixup function.
  drm/qxl: removed optional dummy encoder mode_fixup function.
  drm/radeon: removed optional dummy encoder mode_fixup function.
  drm/rockchip: removed optional dummy encoder mode_fixup function.
  drm/sti: removed optional dummy encoder mode_fixup function.
  drm/tilcdc: removed optional dummy encoder mode_fixup function.

 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c   |  8 
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c   |  8 
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c|  8 
 drivers/gpu/drm/ast/ast_mode.c   |  8 
 drivers/gpu/drm/bochs/bochs_kms.c|  8 
 drivers/gpu/drm/cirrus/cirrus_mode.c |  9 -
 drivers/gpu/drm/exynos/exynos_dp_core.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_dpi.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_dsi.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_vidi.c |  8 
 drivers/gpu/drm/gma500/cdv_intel_crt.c   |  1 -
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c  |  1 -
 drivers/gpu/drm/gma500/gma_display.c |  7 ---
 drivers/gpu/drm/gma500/gma_display.h |  3 ---
 drivers/gpu/drm/gma500/oaktrail_hdmi.c   |  1 -
 drivers/gpu/drm/imx/dw_hdmi-imx.c|  8 
 drivers/gpu/drm/imx/imx-ldb.c|  8 
 drivers/gpu/drm/imx/imx-tve.c|  8 
 drivers/gpu/drm/imx/parallel-display.c   |  8 
 drivers/gpu/drm/mgag200/mgag200_mode.c   |  8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c  |  8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c  |  8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c |  8 
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c  |  9 -
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c  |  8 
 drivers/gpu/drm/qxl/qxl_display.c|  9 -
 drivers/gpu/drm/radeon/atombios_encoders.c   |  8 
 drivers/gpu/drm/rockchip/dw-mipi-dsi.c   |  8 
 drivers/gpu/drm/sti/sti_tvout.c  | 10 --
 drivers/gpu/drm/tilcdc/tilcdc_panel.c|  9 -
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c   |  9 -
 drivers/gpu/drm/udl/udl_encoder.c|  8 
 drivers/gpu/drm/virtio/virtgpu_display.c |  8 
 33 files changed, 244 deletions(-)

-- 
2.5.0



[PATCH 4/4] drm/exynos: use arch independent types in uapi header

2016-02-12 Thread Andrzej Hajda
User API structs should not use types which size/alignment/padding depends
on architecture. The patch fixes it for all structures except
drm_exynos_g2d_userptr, as g2d related stuff seems to be more complicated
and will be reviewed/adjusted later.

Signed-off-by: Andrzej Hajda 
---
 include/uapi/drm/exynos_drm.h | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/include/uapi/drm/exynos_drm.h b/include/uapi/drm/exynos_drm.h
index 312c67d..d2a5bb1 100644
--- a/include/uapi/drm/exynos_drm.h
+++ b/include/uapi/drm/exynos_drm.h
@@ -28,8 +28,8 @@
  */
 struct drm_exynos_gem_create {
__u64 size;
-   unsigned int flags;
-   unsigned int handle;
+   __u32 flags;
+   __u32 handle;
 };

 /**
@@ -42,8 +42,8 @@ struct drm_exynos_gem_create {
  * be set by driver.
  */
 struct drm_exynos_gem_info {
-   unsigned int handle;
-   unsigned int flags;
+   __u32 handle;
+   __u32 flags;
__u64 size;
 };

@@ -56,8 +56,8 @@ struct drm_exynos_gem_info {
  * @edid: the edid data pointer from user side.
  */
 struct drm_exynos_vidi_connection {
-   unsigned int connection;
-   unsigned int extensions;
+   __u32 connection;
+   __u32 extensions;
__u64 edid;
 };

@@ -206,9 +206,9 @@ struct drm_exynos_ipp_prop_list {
  * @pos: property of image position(src-cropped,dst-scaler).
  */
 struct drm_exynos_ipp_config {
-   enum drm_exynos_ops_id ops_id;
-   enum drm_exynos_flipflip;
-   enum drm_exynos_degree  degree;
+   __u32 ops_id;
+   __u32 flip;
+   __u32 degree;
__u32   fmt;
struct drm_exynos_szsz;
struct drm_exynos_pos   pos;
@@ -233,7 +233,7 @@ enum drm_exynos_ipp_cmd {
  */
 struct drm_exynos_ipp_property {
struct drm_exynos_ipp_config config[EXYNOS_DRM_OPS_MAX];
-   enum drm_exynos_ipp_cmd cmd;
+   __u32   cmd;
__u32   ipp_id;
__u32   prop_id;
__u32   refresh_rate;
@@ -255,8 +255,8 @@ enum drm_exynos_ipp_buf_type {
  * @user_data: user data.
  */
 struct drm_exynos_ipp_queue_buf {
-   enum drm_exynos_ops_id  ops_id;
-   enum drm_exynos_ipp_buf_typebuf_type;
+   __u32   ops_id;
+   __u32   buf_type;
__u32   prop_id;
__u32   buf_id;
__u32   handle[EXYNOS_DRM_PLANAR_MAX];
@@ -280,7 +280,7 @@ enum drm_exynos_ipp_ctrl {
  */
 struct drm_exynos_ipp_cmd_ctrl {
__u32   prop_id;
-   enum drm_exynos_ipp_ctrlctrl;
+   __u32   ctrl;
 };

 #define DRM_EXYNOS_GEM_CREATE  0x00
-- 
1.9.1



[PATCH 3/4] drm/exynos: remove platform data structures and include/drm/exynos_drm.h

2016-02-12 Thread Andrzej Hajda
Platform data structures are not used for long time so the whole header
file can be safely removed.

Signed-off-by: Andrzej Hajda 
---
 include/drm/exynos_drm.h | 86 
 1 file changed, 86 deletions(-)
 delete mode 100644 include/drm/exynos_drm.h

diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
deleted file mode 100644
index e9fb2bd..000
--- a/include/drm/exynos_drm.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* exynos_drm.h
- *
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
- * Authors:
- * Inki Dae 
- * Joonyoung Shim 
- * Seung-Woo Kim 
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-#ifndef _EXYNOS_DRM_H_
-#define _EXYNOS_DRM_H_
-
-#include 
-#include 
-
-/**
- * Platform Specific Structure for DRM based FIMD.
- *
- * @default_win: default window layer number to be used for UI.
- * @bpp: default bit per pixel.
- */
-struct exynos_drm_fimd_pdata {
-   u32 vidcon0;
-   u32 vidcon1;
-   unsigned intdefault_win;
-   unsigned intbpp;
-};
-
-/**
- * Platform Specific Structure for DRM based HDMI.
- *
- * @hdmi_dev: device point to specific hdmi driver.
- * @mixer_dev: device point to specific mixer driver.
- *
- * this structure is used for common hdmi driver and each device object
- * would be used to access specific device driver(hdmi or mixer driver)
- */
-struct exynos_drm_common_hdmi_pd {
-   struct device *hdmi_dev;
-   struct device *mixer_dev;
-};
-
-/**
- * Platform Specific Structure for DRM based HDMI core.
- *
- * @is_v13: set if hdmi version 13 is.
- * @cfg_hpd: function pointer to configure hdmi hotplug detection pin
- * @get_hpd: function pointer to get value of hdmi hotplug detection pin
- */
-struct exynos_drm_hdmi_pdata {
-   bool is_v13;
-   void (*cfg_hpd)(bool external);
-   int (*get_hpd)(void);
-};
-
-/**
- * Platform Specific Structure for DRM based IPP.
- *
- * @inv_pclk: if set 1. invert pixel clock
- * @inv_vsync: if set 1. invert vsync signal for wb
- * @inv_href: if set 1. invert href signal
- * @inv_hsync: if set 1. invert hsync signal for wb
- */
-struct exynos_drm_ipp_pol {
-   unsigned int inv_pclk;
-   unsigned int inv_vsync;
-   unsigned int inv_href;
-   unsigned int inv_hsync;
-};
-
-/**
- * Platform Specific Structure for DRM based FIMC.
- *
- * @pol: current hardware block polarity settings.
- * @clk_rate: current hardware clock rate.
- */
-struct exynos_drm_fimc_pdata {
-   struct exynos_drm_ipp_pol pol;
-   int clk_rate;
-};
-
-#endif /* _EXYNOS_DRM_H_ */
-- 
1.9.1



[PATCH 2/4] drm/exynos/fimc: remove unused camera interface polarization code

2016-02-12 Thread Andrzej Hajda
Polarization was never configured for DRM-FIMC device, so fimc_set_polarity
function did nothing. In fact DRM does not use camera interface so there
is no point in configuring it.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos_drm_fimc.c | 28 
 1 file changed, 28 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
index 8a4f4a0..0525c56 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
@@ -163,7 +163,6 @@ struct fimc_context {
u32 clk_frequency;
struct regmap   *sysreg;
struct fimc_scaler  sc;
-   struct exynos_drm_ipp_pol   pol;
int id;
int irq;
boolsuspended;
@@ -260,32 +259,6 @@ static void fimc_set_type_ctrl(struct fimc_context *ctx, 
enum fimc_wb wb)
fimc_write(ctx, cfg, EXYNOS_CIGCTRL);
 }

-static void fimc_set_polarity(struct fimc_context *ctx,
-   struct exynos_drm_ipp_pol *pol)
-{
-   u32 cfg;
-
-   DRM_DEBUG_KMS("inv_pclk[%d]inv_vsync[%d]\n",
-   pol->inv_pclk, pol->inv_vsync);
-   DRM_DEBUG_KMS("inv_href[%d]inv_hsync[%d]\n",
-   pol->inv_href, pol->inv_hsync);
-
-   cfg = fimc_read(ctx, EXYNOS_CIGCTRL);
-   cfg &= ~(EXYNOS_CIGCTRL_INVPOLPCLK | EXYNOS_CIGCTRL_INVPOLVSYNC |
-EXYNOS_CIGCTRL_INVPOLHREF | EXYNOS_CIGCTRL_INVPOLHSYNC);
-
-   if (pol->inv_pclk)
-   cfg |= EXYNOS_CIGCTRL_INVPOLPCLK;
-   if (pol->inv_vsync)
-   cfg |= EXYNOS_CIGCTRL_INVPOLVSYNC;
-   if (pol->inv_href)
-   cfg |= EXYNOS_CIGCTRL_INVPOLHREF;
-   if (pol->inv_hsync)
-   cfg |= EXYNOS_CIGCTRL_INVPOLHSYNC;
-
-   fimc_write(ctx, cfg, EXYNOS_CIGCTRL);
-}
-
 static void fimc_handle_jpeg(struct fimc_context *ctx, bool enable)
 {
u32 cfg;
@@ -1467,7 +1440,6 @@ static int fimc_ippdrv_start(struct device *dev, enum 
drm_exynos_ipp_cmd cmd)
/* If set ture, we can save jpeg about screen */
fimc_handle_jpeg(ctx, false);
fimc_set_scaler(ctx, >sc);
-   fimc_set_polarity(ctx, >pol);

switch (cmd) {
case IPP_CMD_M2M:
-- 
1.9.1



[PATCH 1/4] drm/exynos: remove struct exynos_drm_panel_info

2016-02-12 Thread Andrzej Hajda
struct exynos_drm_panel_info is not used anymore, except exynos_dp,
which can integrate useful fields directly into its context.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c |  1 -
 drivers/gpu/drm/exynos/exynos_dp_core.c|  7 ++-
 drivers/gpu/drm/exynos/exynos_dp_core.h|  4 ++--
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   |  1 -
 include/drm/exynos_drm.h   | 15 ---
 5 files changed, 4 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 52bda3b..9336107 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -60,7 +60,6 @@ struct decon_context {
wait_queue_head_t   wait_vsync_queue;
atomic_twait_vsync_event;

-   struct exynos_drm_panel_info panel;
struct drm_encoder *encoder;
 };

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index b79c316..461f6a1 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -977,9 +977,7 @@ static int exynos_dp_get_modes(struct drm_connector 
*connector)
return 0;
}

-   drm_display_mode_from_videomode(>priv.vm, mode);
-   mode->width_mm = dp->priv.width_mm;
-   mode->height_mm = dp->priv.height_mm;
+   drm_display_mode_from_videomode(>vm, mode);
connector->display_info.width_mm = mode->width_mm;
connector->display_info.height_mm = mode->height_mm;

@@ -1249,8 +1247,7 @@ static int exynos_dp_dt_parse_panel(struct 
exynos_dp_device *dp)
 {
int ret;

-   ret = of_get_videomode(dp->dev->of_node, >priv.vm,
-   OF_USE_NATIVE_MODE);
+   ret = of_get_videomode(dp->dev->of_node, >vm, OF_USE_NATIVE_MODE);
if (ret) {
DRM_ERROR("failed: of_get_videomode() : %d\n", ret);
return ret;
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h 
b/drivers/gpu/drm/exynos/exynos_dp_core.h
index 66eec4b..b5c2d8f 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.h
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 

 #include "exynos_drm_drv.h"

@@ -164,8 +165,7 @@ struct exynos_dp_device {
struct phy  *phy;
int dpms_mode;
int hpd_gpio;
-
-   struct exynos_drm_panel_info priv;
+   struct videomodevm;
 };

 /* exynos_dp_reg.c */
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 70194d0..2d48169 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -168,7 +168,6 @@ struct fimd_context {
atomic_twin_updated;
atomic_ttriggering;

-   struct exynos_drm_panel_info panel;
struct fimd_driver_data *driver_data;
struct drm_encoder *encoder;
 };
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index cb65fa1..e9fb2bd 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -18,27 +18,12 @@
 #include 

 /**
- * A structure for lcd panel information.
- *
- * @timing: default video mode for initializing
- * @width_mm: physical size of lcd width.
- * @height_mm: physical size of lcd height.
- */
-struct exynos_drm_panel_info {
-   struct videomode vm;
-   u32 width_mm;
-   u32 height_mm;
-};
-
-/**
  * Platform Specific Structure for DRM based FIMD.
  *
- * @panel: default panel info for initializing
  * @default_win: default window layer number to be used for UI.
  * @bpp: default bit per pixel.
  */
 struct exynos_drm_fimd_pdata {
-   struct exynos_drm_panel_info panel;
u32 vidcon0;
u32 vidcon1;
unsigned intdefault_win;
-- 
1.9.1



[PATCH 0/4] drm/exynos: cleanup of header files

2016-02-12 Thread Andrzej Hajda
Hi Inki,

This small cleanup series is based on exynos-drm-next.

Regards
Andrzej


Andrzej Hajda (4):
  drm/exynos: remove struct exynos_drm_panel_info
  drm/exynos/fimc: remove unused camera interface polarization code
  drm/exynos: remove platform data structures and
include/drm/exynos_drm.h
  drm/exynos: use arch independent types in uapi header

 drivers/gpu/drm/exynos/exynos7_drm_decon.c |   1 -
 drivers/gpu/drm/exynos/exynos_dp_core.c|   7 +-
 drivers/gpu/drm/exynos/exynos_dp_core.h|   4 +-
 drivers/gpu/drm/exynos/exynos_drm_fimc.c   |  28 
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   |   1 -
 include/drm/exynos_drm.h   | 101 -
 include/uapi/drm/exynos_drm.h  |  26 
 7 files changed, 17 insertions(+), 151 deletions(-)
 delete mode 100644 include/drm/exynos_drm.h

-- 
1.9.1



[Bug 38454] [KMS] ATI RV280 ennoying many OpenGL troubles

2016-02-12 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=38454

Timothy Arceri  changed:

   What|Removed |Added

  Component|Mesa core   |Drivers/DRI/r200
   Assignee|mesa-dev at lists.freedesktop. |dri-devel at 
lists.freedesktop
   |org |.org

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160212/50ccf91c/attachment.html>


[PATCH v3 2/2] drm: remove drm_device_is_unplugged and related code

2016-02-12 Thread Haixia Shi
v1: Remove the general drm_device_is_unplugged() checks, and move the unplugged
flag handling logic into drm/udl. In general we want to keep driver-specific
logic out of common drm code.

v2: Based on discussion with Stephane and David, drop most of the unplugged
flag handling logic in drm/udl except for udl_detect() and udl_fb_open().
The intention is to treat the device removal as a connector-unplug, and kep
the UDL device fully functional.

v3: Based on feedback from David, entirely drop the "unplugged" flag and all
related code. There is no need to check for the unplugged flag as the existing
udl_usb_disconnect() behavior already ensures the controller is removed, and
all code paths that uses the usb-device are not reachable after unplug.

When a UDL monitor is unplugged, we need to still treat it as a fully
functional device which just happens to have its connector unplugged.
This allows user-space to properly deallocate fbs and dumb buffers
before closing the device.

This drops the "unplugged" flag hack, which puts the device in a
non-functional state after USB unplug and rejects most operations on
the device such as ioctls with error -ENODEV.

Signed-off-by: Haixia Shi 
Reviewed-by: Stéphane Marchesin 
Cc: David Herrmann 
Cc: Daniel Vetter 
---
 drivers/gpu/drm/drm_drv.c   |  6 --
 drivers/gpu/drm/drm_fops.c  |  2 --
 drivers/gpu/drm/drm_gem.c   |  3 ---
 drivers/gpu/drm/drm_ioctl.c |  3 ---
 drivers/gpu/drm/drm_vm.c|  3 ---
 drivers/gpu/drm/udl/udl_connector.c |  2 --
 drivers/gpu/drm/udl/udl_fb.c|  6 --
 include/drm/drmP.h  | 14 --
 8 files changed, 39 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 167c8d3..f93ee12 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -376,9 +376,6 @@ struct drm_minor *drm_minor_acquire(unsigned int minor_id)

if (!minor) {
return ERR_PTR(-ENODEV);
-   } else if (drm_device_is_unplugged(minor->dev)) {
-   drm_dev_unref(minor->dev);
-   return ERR_PTR(-ENODEV);
}

return minor;
@@ -464,9 +461,6 @@ void drm_unplug_dev(struct drm_device *dev)
drm_minor_unregister(dev, DRM_MINOR_CONTROL);

mutex_lock(_global_mutex);
-
-   drm_device_set_unplugged(dev);
-
if (dev->open_count == 0) {
drm_put_dev(dev);
}
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 1ea8790..b4332d4 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -497,8 +497,6 @@ int drm_release(struct inode *inode, struct file *filp)

if (!--dev->open_count) {
retcode = drm_lastclose(dev);
-   if (drm_device_is_unplugged(dev))
-   drm_put_dev(dev);
}
mutex_unlock(_global_mutex);

diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 2e8c77e..c622e32 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -900,9 +900,6 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct 
*vma)
struct drm_vma_offset_node *node;
int ret;

-   if (drm_device_is_unplugged(dev))
-   return -ENODEV;
-
drm_vma_offset_lock_lookup(dev->vma_offset_manager);
node = drm_vma_offset_exact_lookup_locked(dev->vma_offset_manager,
  vma->vm_pgoff,
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 8ce2a0c..f959074 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -695,9 +695,6 @@ long drm_ioctl(struct file *filp,

dev = file_priv->minor->dev;

-   if (drm_device_is_unplugged(dev))
-   return -ENODEV;
-
is_driver_ioctl = nr >= DRM_COMMAND_BASE && nr < DRM_COMMAND_END;

if (is_driver_ioctl) {
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index f90bd5f..3a68be4 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -657,9 +657,6 @@ int drm_legacy_mmap(struct file *filp, struct 
vm_area_struct *vma)
struct drm_device *dev = priv->minor->dev;
int ret;

-   if (drm_device_is_unplugged(dev))
-   return -ENODEV;
-
mutex_lock(>struct_mutex);
ret = drm_mmap_locked(filp, vma);
mutex_unlock(>struct_mutex);
diff --git a/drivers/gpu/drm/udl/udl_connector.c 
b/drivers/gpu/drm/udl/udl_connector.c
index 4709b54..a6d5e21 100644
--- a/drivers/gpu/drm/udl/udl_connector.c
+++ b/drivers/gpu/drm/udl/udl_connector.c
@@ -96,8 +96,6 @@ static int udl_mode_valid(struct drm_connector *connector,
 static enum drm_connector_status
 udl_detect(struct drm_connector *connector, bool force)
 {
-   if (drm_device_is_unplugged(connector->dev))
-   return connector_status_disconnected;
return connector_status_connected;
 }

diff --git 

[PATCH 14/17] drm/radeon: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Alex Deucher
On Fri, Feb 12, 2016 at 8:55 AM, Carlos Palminha
 wrote:
> ---
>  drivers/gpu/drm/radeon/atombios_encoders.c | 8 
>  1 file changed, 8 deletions(-)

Reviewed-by: Alex Deucher 

>
> diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c 
> b/drivers/gpu/drm/radeon/atombios_encoders.c
> index 01b20e1..1603751 100644
> --- a/drivers/gpu/drm/radeon/atombios_encoders.c
> +++ b/drivers/gpu/drm/radeon/atombios_encoders.c
> @@ -2623,16 +2623,8 @@ radeon_atom_ext_dpms(struct drm_encoder *encoder, int 
> mode)
>
>  }
>
> -static bool radeon_atom_ext_mode_fixup(struct drm_encoder *encoder,
> -  const struct drm_display_mode *mode,
> -  struct drm_display_mode *adjusted_mode)
> -{
> -   return true;
> -}
> -
>  static const struct drm_encoder_helper_funcs radeon_atom_ext_helper_funcs = {
> .dpms = radeon_atom_ext_dpms,
> -   .mode_fixup = radeon_atom_ext_mode_fixup,
> .prepare = radeon_atom_ext_prepare,
> .mode_set = radeon_atom_ext_mode_set,
> .commit = radeon_atom_ext_commit,
> --
> 2.5.0
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 04/17] drm/amdgpu: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Alex Deucher
On Fri, Feb 12, 2016 at 8:50 AM, Carlos Palminha
 wrote:
> ---
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 8 
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 8 
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c  | 8 
>  3 files changed, 24 deletions(-)

Reviewed-by: Alex Deucher 

>
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c 
> b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index 093599a..3483018 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -3624,16 +3624,8 @@ dce_v10_0_ext_dpms(struct drm_encoder *encoder, int 
> mode)
>
>  }
>
> -static bool dce_v10_0_ext_mode_fixup(struct drm_encoder *encoder,
> -   const struct drm_display_mode *mode,
> -   struct drm_display_mode *adjusted_mode)
> -{
> -   return true;
> -}
> -
>  static const struct drm_encoder_helper_funcs dce_v10_0_ext_helper_funcs = {
> .dpms = dce_v10_0_ext_dpms,
> -   .mode_fixup = dce_v10_0_ext_mode_fixup,
> .prepare = dce_v10_0_ext_prepare,
> .mode_set = dce_v10_0_ext_mode_set,
> .commit = dce_v10_0_ext_commit,
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c 
> b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 8e67249..36deea1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -3619,16 +3619,8 @@ dce_v11_0_ext_dpms(struct drm_encoder *encoder, int 
> mode)
>
>  }
>
> -static bool dce_v11_0_ext_mode_fixup(struct drm_encoder *encoder,
> -   const struct drm_display_mode *mode,
> -   struct drm_display_mode *adjusted_mode)
> -{
> -   return true;
> -}
> -
>  static const struct drm_encoder_helper_funcs dce_v11_0_ext_helper_funcs = {
> .dpms = dce_v11_0_ext_dpms,
> -   .mode_fixup = dce_v11_0_ext_mode_fixup,
> .prepare = dce_v11_0_ext_prepare,
> .mode_set = dce_v11_0_ext_mode_set,
> .commit = dce_v11_0_ext_commit,
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c 
> b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index d0e128c..25dd8b6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -3554,16 +3554,8 @@ dce_v8_0_ext_dpms(struct drm_encoder *encoder, int 
> mode)
>
>  }
>
> -static bool dce_v8_0_ext_mode_fixup(struct drm_encoder *encoder,
> -   const struct drm_display_mode *mode,
> -   struct drm_display_mode *adjusted_mode)
> -{
> -   return true;
> -}
> -
>  static const struct drm_encoder_helper_funcs dce_v8_0_ext_helper_funcs = {
> .dpms = dce_v8_0_ext_dpms,
> -   .mode_fixup = dce_v8_0_ext_mode_fixup,
> .prepare = dce_v8_0_ext_prepare,
> .mode_set = dce_v8_0_ext_mode_set,
> .commit = dce_v8_0_ext_commit,
> --
> 2.5.0
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 00/29] Enabling new DAL display driver for amdgpu on Carrizo and Tonga

2016-02-12 Thread Dave Airlie
On 12 February 2016 at 07:06, Daniel Vetter  wrote:
> On Thu, Feb 11, 2016 at 9:52 PM, Dave Airlie  wrote:
>> On 12 February 2016 at 03:19, Harry Wentland  
>> wrote:
>>> This set of patches enables the new DAL display driver for amdgpu on Carrizo
>>> Tonga, and Fiji ASICs. This driver will allow us going forward to bring
>>> display features on the open amdgpu driver (mostly) on par with the Catalyst
>>> driver.
>>>
>>> This driver adds support for
>>> - Atomic KMS API
>>> - MST
>>> - HDMI 2.0
>>> - Better powerplay integration
>>> - Support of HW bandwidth formula on Carrizo
>>> - Better multi-display support and handling of co-functionality
>>> - Broader support of display dongles
>>> - Timing synchronization between DP and HDMI
>>>
>>> This patch series is based on Alex Deucher's drm-next-4.6-wip tree.
>>>
>> So the first minor criticism is this patch doesn't explain WHY.
>>
>> Why does the Linux kernel need 93k lines of code to run the displays
>> when whole drivers don't even come close.
>>
>> We've spent a lot of time ripping abstraction layers out of drivers (exynos
>> being the major one), what benefits does this major change bring to the
>> Linux kernel and the AMDGPU driver over and above a leaner, more focused
>> work.
>>
>> If were even to consider merging this it would be at a guess considered
>> staging level material which would require a TODO list of major cleanups.
>>
>> I do realise you've put a lot of work into this, but I think you are going to
>> get a lot of review pushback in the next few days and without knowing the
>> reasons this path was chosen it is going to be hard to take.
>
> Yeah agreed, we need to figure out the why/how first. Assembling a
> de-staging TODO is imo a second step. And the problem with that is
> that before we can do a full TODO we need to remove all the os and drm
> abstractions. I found delayed_work, timer, memory handling, pixel
> formats (in multiple copies), the i2c stuff Rob noticed and there's
> more I'm sure. With all that I just can't even see how the main DAL
> structures connect and how that would sensibly map to drm concepts.
> Which is most likely needed to make DAL properly atomic.
>
> So de-staging DAL (if we decided this is the right approach) would be
> multi-stage, with removal of the abstractions not needed first, then
> taking a 2nd look and figuring out how to untangle the actual
> concepts.
>
> Aside: If all this abstraction is to make dal run in userspace for
> testing or whatever - nouveau does this, we (Intel) want to do this
> too for unit-testing, so there's definitely room for sharing the
> tools. But the right approach imo is to just implement kernel services
> (like timers) in userspace.
>
> Another thing is that some of the features in here (hdmi 2.0, improved
> dongle support) really should be in shared helpers. If we have that
> hidden behind the dal abstraction it'll be pretty much impossible
> (with major work, which is unreasonable to ask of other people trying
> to get their own driver in) to extract it. And for sink handling
> having multiple copies of the same code just doesn't make sense.
>
> Anyway that's my quick thoughts from 2h of reading this. One wishlist:
> Some design overview or diagram how dal structures connect would be
> awesome as a reading aid.

Yes some overview of what the abstractions are and why they exist,

Follow things down the layers really makes for hard work, and in a lot of
places for not much benefit.

Dave.


[PATCH 2/2] drm/sti: support interlaced top / bottom field first

2016-02-12 Thread Vincent Abriou
From: Fabien Dessenne 

Support top field first and bottom field first interlaced buffers

Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/sti_hqvdp.c | 72 +
 1 file changed, 44 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index e9c33fb..e024c13 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -325,7 +325,7 @@ struct sti_hqvdp_cmd {
  * @clk_pix_main:  pix main clock
  * @reset: reset control
  * @vtg_nb:notifier to handle VTG Vsync
- * @btm_field_pending: is there any bottom field (interlaced frame) to display
+ * @nxt_field_pending: is there any other field (interlaced frame) to display
  * @hqvdp_cmd: buffer of commands
  * @hqvdp_cmd_paddr:   physical address of hqvdp_cmd
  * @vtg:   vtg for main data path
@@ -340,7 +340,7 @@ struct sti_hqvdp {
struct clk *clk_pix_main;
struct reset_control *reset;
struct notifier_block vtg_nb;
-   bool btm_field_pending;
+   bool nxt_field_pending;
void *hqvdp_cmd;
dma_addr_t hqvdp_cmd_paddr;
struct sti_vtg *vtg;
@@ -784,7 +784,7 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
  * @evt: event message
  * @data: private data
  *
- * Handle VTG Vsync event, display pending bottom field
+ * Handle VTG Vsync event, display next field
  *
  * RETURNS:
  * 0 on success.
@@ -792,8 +792,8 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
 int sti_hqvdp_vtg_cb(struct notifier_block *nb, unsigned long evt, void *data)
 {
struct sti_hqvdp *hqvdp = container_of(nb, struct sti_hqvdp, vtg_nb);
-   int btm_cmd_offset, top_cmd_offest;
-   struct sti_hqvdp_cmd *btm_cmd, *top_cmd;
+   int next_cmd_offset, curr_cmd_offest;
+   struct sti_hqvdp_cmd *next_cmd, *curr_cmd;

if ((evt != VTG_TOP_FIELD_EVENT) && (evt != VTG_BOTTOM_FIELD_EVENT)) {
DRM_DEBUG_DRIVER("Unknown event\n");
@@ -808,31 +808,41 @@ int sti_hqvdp_vtg_cb(struct notifier_block *nb, unsigned 
long evt, void *data)
sti_hqvdp_disable(hqvdp);
}

-   if (hqvdp->btm_field_pending) {
-   /* Create the btm field command from the current one */
-   btm_cmd_offset = sti_hqvdp_get_free_cmd(hqvdp);
-   top_cmd_offest = sti_hqvdp_get_curr_cmd(hqvdp);
-   if ((btm_cmd_offset == -1) || (top_cmd_offest == -1)) {
+   if (hqvdp->nxt_field_pending) {
+   /* Create the next field command from the current one */
+   next_cmd_offset = sti_hqvdp_get_free_cmd(hqvdp);
+   curr_cmd_offest = sti_hqvdp_get_curr_cmd(hqvdp);
+   if ((next_cmd_offset == -1) || (curr_cmd_offest == -1)) {
DRM_DEBUG_DRIVER("Warning: no cmd, will skip field\n");
return -EBUSY;
}

-   btm_cmd = hqvdp->hqvdp_cmd + btm_cmd_offset;
-   top_cmd = hqvdp->hqvdp_cmd + top_cmd_offest;
-
-   memcpy(btm_cmd, top_cmd, sizeof(*btm_cmd));
-
-   btm_cmd->top.config = TOP_CONFIG_INTER_BTM;
-   btm_cmd->top.current_luma +=
-   btm_cmd->top.luma_src_pitch / 2;
-   btm_cmd->top.current_chroma +=
-   btm_cmd->top.chroma_src_pitch / 2;
+   next_cmd = hqvdp->hqvdp_cmd + next_cmd_offset;
+   curr_cmd = hqvdp->hqvdp_cmd + curr_cmd_offest;
+
+   memcpy(next_cmd, curr_cmd, sizeof(*next_cmd));
+
+   if (curr_cmd->top.config == TOP_CONFIG_INTER_TOP) {
+   /* Display the bottom field now */
+   next_cmd->top.config = TOP_CONFIG_INTER_BTM;
+   next_cmd->top.current_luma +=
+   next_cmd->top.luma_src_pitch / 2;
+   next_cmd->top.current_chroma +=
+   next_cmd->top.chroma_src_pitch / 2;
+   } else {
+   /* Display the top field now */
+   next_cmd->top.config = TOP_CONFIG_INTER_TOP;
+   next_cmd->top.current_luma -=
+   next_cmd->top.luma_src_pitch / 2;
+   next_cmd->top.current_chroma -=
+   next_cmd->top.chroma_src_pitch / 2;
+   }

/* Post the command to mailbox */
-   writel(hqvdp->hqvdp_cmd_paddr + btm_cmd_offset,
-   hqvdp->regs + HQVDP_MBX_NEXT_CMD);
+   writel(hqvdp->hqvdp_cmd_paddr + next_cmd_offset,
+  hqvdp->regs + HQVDP_MBX_NEXT_CMD);

-   hqvdp->btm_field_pending = false;
+   hqvdp->nxt_field_pending = false;

dev_dbg(hqvdp->dev, "%s Posted 

[PATCH 1/2] drm: Add DRM_MODE_FB_BFF flag definition

2016-02-12 Thread Vincent Abriou
From: Fabien Dessenne 

If a buffer is interlaced, this "Bottom Field First" flag specifies
which of the top or the bottom field shall be displayed first.
When set, the bottom field shall be displayed first.
When unset the top field shall be displayed first.

Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/drm_crtc.c  | 3 ++-
 include/uapi/drm/drm_mode.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d40bab2..64b4fdac 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -3315,7 +3315,8 @@ internal_framebuffer_create(struct drm_device *dev,
struct drm_framebuffer *fb;
int ret;

-   if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS)) {
+   if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS
+   | DRM_MODE_FB_BFF)) {
DRM_DEBUG_KMS("bad framebuffer flags 0x%08x\n", r->flags);
return ERR_PTR(-EINVAL);
}
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 50adb46..f7c9111 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -354,6 +354,7 @@ struct drm_mode_fb_cmd {

 #define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */
 #define DRM_MODE_FB_MODIFIERS  (1<<1) /* enables ->modifer[] */
+#define DRM_MODE_FB_BFF(1<<2) /* if interlaced, bottom field 
first */

 struct drm_mode_fb_cmd2 {
__u32 fb_id;
-- 
1.9.1



[PATCH 0/2] drm/sti: support of interlaced content with Bottom Field

2016-02-12 Thread Vincent Abriou
Interlaced video can have different scan order:
Top Field First or Bottom Field First

In case of video with interlaced content, this information should be
propagated from the userland to the DRM kernel driver that will process the
deinterlacing starting with the top or the bottom field first.
That's why we introduce this new flag definition DRM_MODE_FB_BFF (Bottom Field
First) that should be used jointly with the already existing
DRM_MODE_FB_INTERLACED flag incase of interlaced video with Bottom Field First
scan order should be processed.

Fabien Dessenne (2):
  drm: Add DRM_MODE_FB_BFF flag definition
  drm/sti: support interlaced top / bottom field first

 drivers/gpu/drm/drm_crtc.c  |  3 +-
 drivers/gpu/drm/sti/sti_hqvdp.c | 72 +
 include/uapi/drm/drm_mode.h |  1 +
 3 files changed, 47 insertions(+), 29 deletions(-)

-- 
1.9.1



[PATCH 06/29] drm/amd/dal: Adapter Service

2016-02-12 Thread Dave Airlie
> +
> +/* Stores entire ASIC features by sets */
> +uint32_t adapter_feature_set[FEATURE_MAXIMUM/32];

Is this global, what about multiple GPUs in one machine,
is this per GPU or per system?

Dave.


[PATCH 00/10] Exynos DRM: various fixes for 64bit and Exynos5433

2016-02-12 Thread Andrzej Hajda
Hi Emil,


On 02/08/2016 12:14 PM, Emil Velikov wrote:
> Hi Marek,
> 
> On 3 February 2016 at 12:42, Marek Szyprowski  
> wrote:
>> Hello all,
>>
>> This patch series is a set of various fixes to get Exynos DRM working on
>> Exynos 5433 SoCs and 64bit ARM64 architecture.
>>
> As you mentioned "64bit Exynos" devices, I'm wondering if you'll have
> some input on the current exynos drm ABI as mentioned here [1]. I.e.
> it feels broken when using 32bit userspace on 64 bit kernel due to the
> use of unsigned int and alike types. Should we replace them (fix
> things) with explicitly sized ones - _u32/64.
> 
> Does that sound reasonable, is anyone from the Exynos team interested
> in sorting it out ?

I will take care of it.
Thanks of pointing it out.

Regards
Andrzej

> 
> Regards,
> Emil
> 
> [1] https://lists.freedesktop.org/archives/dri-devel/2016-January/099547.html
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 



[PATCH 10/10] drm/sti: add debugfs fps_show/fps_get mechanism for planes

2016-02-12 Thread Vincent Abriou
Display fps on demand for each used plane:
cat /sys/kernel/debug/dri/0/fps_get
Display fps in live in the console for each used plane:
echo 255 > /sys/kernel/debug/dri/0/fps_show

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_cursor.c |   2 +
 drivers/gpu/drm/sti/sti_drv.c| 128 +++
 drivers/gpu/drm/sti/sti_gdp.c|   2 +
 drivers/gpu/drm/sti/sti_hqvdp.c  |  11 ++--
 drivers/gpu/drm/sti/sti_plane.c  |  63 +++
 drivers/gpu/drm/sti/sti_plane.h  |  17 ++
 6 files changed, 216 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index 9eac1b9..82b5711 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -306,6 +306,8 @@ static void sti_cursor_atomic_update(struct drm_plane 
*drm_plane,
writel(cursor->clut_paddr, cursor->regs + CUR_CML);
writel(CUR_CTL_CLUT_UPDATE, cursor->regs + CUR_CTL);

+   sti_plane_update_fps(plane, true, false);
+
plane->status = STI_PLANE_UPDATED;
 }

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index bcb1861..e5ef6b6 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -20,6 +20,7 @@

 #include "sti_crtc.h"
 #include "sti_drv.h"
+#include "sti_plane.h"

 #define DRIVER_NAME"sti"
 #define DRIVER_DESC"STMicroelectronics SoC DRM"
@@ -30,6 +31,130 @@
 #define STI_MAX_FB_HEIGHT  4096
 #define STI_MAX_FB_WIDTH   4096

+static int sti_drm_fps_get(void *data, u64 *val)
+{
+   struct drm_device *drm_dev = data;
+   struct drm_plane *p;
+   unsigned int i = 0;
+
+   *val = 0;
+   list_for_each_entry(p, _dev->mode_config.plane_list, head) {
+   struct sti_plane *plane = to_sti_plane(p);
+
+   *val |= plane->fps_info.output << i;
+   i++;
+   }
+
+   return 0;
+}
+
+static int sti_drm_fps_set(void *data, u64 val)
+{
+   struct drm_device *drm_dev = data;
+   struct drm_plane *p;
+   unsigned int i = 0;
+
+   list_for_each_entry(p, _dev->mode_config.plane_list, head) {
+   struct sti_plane *plane = to_sti_plane(p);
+
+   plane->fps_info.output = (val >> i) & 1;
+   i++;
+   }
+
+   return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(sti_drm_fps_fops,
+   sti_drm_fps_get, sti_drm_fps_set, "%llu\n");
+
+static int sti_drm_fps_dbg_show(struct seq_file *s, void *data)
+{
+   struct drm_info_node *node = s->private;
+   struct drm_device *dev = node->minor->dev;
+   struct drm_plane *p;
+   int ret;
+
+   ret = mutex_lock_interruptible(>struct_mutex);
+   if (ret)
+   return ret;
+
+   list_for_each_entry(p, >mode_config.plane_list, head) {
+   struct sti_plane *plane = to_sti_plane(p);
+
+   seq_printf(s, "%s%s\n",
+  plane->fps_info.fps_str,
+  plane->fps_info.fips_str);
+   }
+
+   mutex_unlock(>struct_mutex);
+   return 0;
+}
+
+static struct drm_info_list sti_drm_dbg_list[] = {
+   {"fps_get", sti_drm_fps_dbg_show, 0},
+};
+
+static int sti_drm_debugfs_create(struct dentry *root,
+ struct drm_minor *minor,
+ const char *name,
+ const struct file_operations *fops)
+{
+   struct drm_device *dev = minor->dev;
+   struct drm_info_node *node;
+   struct dentry *ent;
+
+   ent = debugfs_create_file(name, S_IRUGO | S_IWUSR, root, dev, fops);
+   if (IS_ERR(ent))
+   return PTR_ERR(ent);
+
+   node = kmalloc(sizeof(*node), GFP_KERNEL);
+   if (!node) {
+   debugfs_remove(ent);
+   return -ENOMEM;
+   }
+
+   node->minor = minor;
+   node->dent = ent;
+   node->info_ent = (void *)fops;
+
+   mutex_lock(>debugfs_lock);
+   list_add(>list, >debugfs_list);
+   mutex_unlock(>debugfs_lock);
+
+   return 0;
+}
+
+static int sti_drm_dbg_init(struct drm_minor *minor)
+{
+   int ret;
+
+   ret = drm_debugfs_create_files(sti_drm_dbg_list,
+  ARRAY_SIZE(sti_drm_dbg_list),
+  minor->debugfs_root, minor);
+   if (ret)
+   goto err;
+
+   ret = sti_drm_debugfs_create(minor->debugfs_root, minor, "fps_show",
+_drm_fps_fops);
+   if (ret)
+   goto err;
+
+   DRM_INFO("%s: debugfs installed\n", DRIVER_NAME);
+   return 0;
+err:
+   DRM_ERROR("%s: cannot install debugfs\n", DRIVER_NAME);
+   return ret;
+}
+
+void sti_drm_dbg_cleanup(struct drm_minor *minor)
+{
+   drm_debugfs_remove_files(sti_drm_dbg_list,
+ARRAY_SIZE(sti_drm_dbg_list), minor);
+
+   drm_debugfs_remove_files((struct drm_info_list 

[PATCH 09/10] drm/sti: add debugfs entries for TVOUT encoders

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_tvout.c | 157 
 1 file changed, 157 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index 0b171fd..d4bb953 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -462,6 +462,157 @@ static void tvout_hda_start(struct sti_tvout *tvout, bool 
main_path)
tvout_write(tvout, 0, TVO_HD_DAC_CFG_OFF);
 }

+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  readl(tvout->regs + reg))
+
+static void tvout_dbg_vip(struct seq_file *s, int val)
+{
+   int r, g, b, tmp, mask;
+   char *const reorder[] = {"Y_G", "Cb_B", "Cr_R"};
+   char *const clipping[] = {"No", "EAV/SAV", "Limited range RGB/Y",
+ "Limited range Cb/Cr", "decided by register"};
+   char *const round[] = {"8-bit", "10-bit", "12-bit"};
+   char *const input_sel[] = {"Main (color matrix enabled)",
+  "Main (color matrix by-passed)",
+  "", "", "", "", "", "",
+  "Aux (color matrix enabled)",
+  "Aux (color matrix by-passed)",
+  "", "", "", "", "", "Force value"};
+
+   seq_puts(s, "\t");
+   mask = TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_R_SHIFT;
+   r = (val & mask) >> TVO_VIP_REORDER_R_SHIFT;
+   mask = TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_G_SHIFT;
+   g = (val & mask) >> TVO_VIP_REORDER_G_SHIFT;
+   mask = TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_B_SHIFT;
+   b = (val & mask) >> TVO_VIP_REORDER_B_SHIFT;
+   seq_printf(s, "%-24s %s->%s %s->%s %s->%s\n", "Reorder:",
+  reorder[r], reorder[TVO_VIP_REORDER_CR_R_SEL],
+  reorder[g], reorder[TVO_VIP_REORDER_Y_G_SEL],
+  reorder[b], reorder[TVO_VIP_REORDER_CB_B_SEL]);
+   seq_puts(s, "\t\t\t\t\t");
+   mask = TVO_VIP_CLIP_MASK << TVO_VIP_CLIP_SHIFT;
+   tmp = (val & mask) >> TVO_VIP_CLIP_SHIFT;
+   seq_printf(s, "%-24s %s\n", "Clipping:", clipping[tmp]);
+   seq_puts(s, "\t\t\t\t\t");
+   mask = TVO_VIP_RND_MASK << TVO_VIP_RND_SHIFT;
+   tmp = (val & mask) >> TVO_VIP_RND_SHIFT;
+   seq_printf(s, "%-24s input data rounded to %s per component\n",
+  "Round:", round[tmp]);
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = (val & TVO_VIP_SEL_INPUT_MASK);
+   seq_printf(s, "%-24s %s", "Input selection:", input_sel[tmp]);
+}
+
+static void tvout_dbg_hd_dac_cfg(struct seq_file *s, int val)
+{
+   seq_printf(s, "\t%-24s %s", "HD DAC:",
+  val & 1 ? "disabled" : "enabled");
+}
+
+static int tvout_dbg_show(struct seq_file *s, void *data)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_tvout *tvout = (struct sti_tvout *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   struct drm_crtc *crtc;
+   int ret;
+
+   ret = mutex_lock_interruptible(>struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "TVOUT: (vaddr = 0x%p)", tvout->regs);
+
+   seq_puts(s, "\n\n  HDMI encoder: ");
+   crtc = tvout->hdmi->crtc;
+   if (crtc) {
+   seq_printf(s, "connected to %s path",
+  sti_crtc_is_main(crtc) ? "main" : "aux");
+   DBGFS_DUMP(TVO_HDMI_SYNC_SEL);
+   DBGFS_DUMP(TVO_VIP_HDMI);
+   tvout_dbg_vip(s, readl(tvout->regs + TVO_VIP_HDMI));
+   } else {
+   seq_puts(s, "disabled");
+   }
+
+   seq_puts(s, "\n\n  DVO encoder: ");
+   crtc = tvout->dvo->crtc;
+   if (crtc) {
+   seq_printf(s, "connected to %s path",
+  sti_crtc_is_main(crtc) ? "main" : "aux");
+   DBGFS_DUMP(TVO_DVO_SYNC_SEL);
+   DBGFS_DUMP(TVO_DVO_CONFIG);
+   DBGFS_DUMP(TVO_VIP_DVO);
+   tvout_dbg_vip(s, readl(tvout->regs + TVO_VIP_DVO));
+   } else {
+   seq_puts(s, "disabled");
+   }
+
+   seq_puts(s, "\n\n  HDA encoder: ");
+   crtc = tvout->hda->crtc;
+   if (crtc) {
+   seq_printf(s, "connected to %s path",
+  sti_crtc_is_main(crtc) ? "main" : "aux");
+   DBGFS_DUMP(TVO_HD_SYNC_SEL);
+   DBGFS_DUMP(TVO_HD_DAC_CFG_OFF);
+   tvout_dbg_hd_dac_cfg(s,
+readl(tvout->regs + TVO_HD_DAC_CFG_OFF));
+   DBGFS_DUMP(TVO_VIP_HDF);
+   tvout_dbg_vip(s, readl(tvout->regs + TVO_VIP_HDF));
+   } else {
+   seq_puts(s, "disabled");
+   }
+
+   seq_puts(s, "\n\n  main path configuration");
+   DBGFS_DUMP(TVO_CSC_MAIN_M0);
+   DBGFS_DUMP(TVO_CSC_MAIN_M1);
+   DBGFS_DUMP(TVO_CSC_MAIN_M2);
+   

[PATCH 08/10] drm/sti: add debugfs entries for MIXER crtc

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_compositor.c |   2 +-
 drivers/gpu/drm/sti/sti_mixer.c  | 146 ++-
 drivers/gpu/drm/sti/sti_mixer.h  |   4 +-
 3 files changed, 149 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
b/drivers/gpu/drm/sti/sti_compositor.c
index 5b827a9..3d2fa3a 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -81,7 +81,7 @@ static int sti_compositor_bind(struct device *dev,
case STI_MIXER_MAIN_SUBDEV:
case STI_MIXER_AUX_SUBDEV:
compo->mixer[mixer_id++] =
-   sti_mixer_create(compo->dev, desc[i].id,
+   sti_mixer_create(compo->dev, drm_dev, desc[i].id,
 compo->regs + desc[i].offset);
break;
case STI_GPD_SUBDEV:
diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
index 49db835..e7425c3 100644
--- a/drivers/gpu/drm/sti/sti_mixer.c
+++ b/drivers/gpu/drm/sti/sti_mixer.c
@@ -75,6 +75,145 @@ static inline void sti_mixer_reg_write(struct sti_mixer 
*mixer,
writel(val, mixer->regs + reg_id);
 }

+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  sti_mixer_reg_read(mixer, reg))
+
+static void mixer_dbg_ctl(struct seq_file *s, int val)
+{
+   unsigned int i;
+   int count = 0;
+   char *const disp_layer[] = {"BKG", "VID0", "VID1", "GDP0",
+   "GDP1", "GDP2", "GDP3"};
+
+   seq_puts(s, "\tEnabled: ");
+   for (i = 0; i < 7; i++) {
+   if (val & 1) {
+   seq_printf(s, "%s ", disp_layer[i]);
+   count++;
+   }
+   val = val >> 1;
+   }
+
+   val = val >> 2;
+   if (val & 1) {
+   seq_puts(s, "CURS ");
+   count++;
+   }
+   if (!count)
+   seq_puts(s, "Nothing");
+}
+
+static void mixer_dbg_crb(struct seq_file *s, int val)
+{
+   int i;
+
+   seq_puts(s, "\tDepth: ");
+   for (i = 0; i < GAM_MIXER_NB_DEPTH_LEVEL; i++) {
+   switch (val & GAM_DEPTH_MASK_ID) {
+   case GAM_DEPTH_VID0_ID:
+   seq_puts(s, "VID0");
+   break;
+   case GAM_DEPTH_VID1_ID:
+   seq_puts(s, "VID1");
+   break;
+   case GAM_DEPTH_GDP0_ID:
+   seq_puts(s, "GDP0");
+   break;
+   case GAM_DEPTH_GDP1_ID:
+   seq_puts(s, "GDP1");
+   break;
+   case GAM_DEPTH_GDP2_ID:
+   seq_puts(s, "GDP2");
+   break;
+   case GAM_DEPTH_GDP3_ID:
+   seq_puts(s, "GDP3");
+   break;
+   default:
+   seq_puts(s, "---");
+   }
+
+   if (i < GAM_MIXER_NB_DEPTH_LEVEL - 1)
+   seq_puts(s, " < ");
+   val = val >> 3;
+   }
+}
+
+static void mixer_dbg_mxn(struct seq_file *s, void *addr)
+{
+   int i;
+
+   for (i = 1; i < 8; i++)
+   seq_printf(s, "-0x%08X", (int)readl(addr + i * 4));
+}
+
+static int mixer_dbg_show(struct seq_file *s, void *arg)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_mixer *mixer = (struct sti_mixer *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   int ret;
+
+   ret = mutex_lock_interruptible(>struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "%s: (vaddr = 0x%p)",
+  sti_mixer_to_str(mixer), mixer->regs);
+
+   DBGFS_DUMP(GAM_MIXER_CTL);
+   mixer_dbg_ctl(s, sti_mixer_reg_read(mixer, GAM_MIXER_CTL));
+   DBGFS_DUMP(GAM_MIXER_BKC);
+   DBGFS_DUMP(GAM_MIXER_BCO);
+   DBGFS_DUMP(GAM_MIXER_BCS);
+   DBGFS_DUMP(GAM_MIXER_AVO);
+   DBGFS_DUMP(GAM_MIXER_AVS);
+   DBGFS_DUMP(GAM_MIXER_CRB);
+   mixer_dbg_crb(s, sti_mixer_reg_read(mixer, GAM_MIXER_CRB));
+   DBGFS_DUMP(GAM_MIXER_ACT);
+   DBGFS_DUMP(GAM_MIXER_MBP);
+   DBGFS_DUMP(GAM_MIXER_MX0);
+   mixer_dbg_mxn(s, mixer->regs + GAM_MIXER_MX0);
+   seq_puts(s, "\n");
+
+   mutex_unlock(>struct_mutex);
+   return 0;
+}
+
+static struct drm_info_list mixer0_debugfs_files[] = {
+   { "mixer_main", mixer_dbg_show, 0, NULL },
+};
+
+static struct drm_info_list mixer1_debugfs_files[] = {
+   { "mixer_aux", mixer_dbg_show, 0, NULL },
+};
+
+static int mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor)
+{
+   unsigned int i;
+   struct drm_info_list *mixer_debugfs_files;
+   int nb_files;
+
+   switch (mixer->id) {
+   case STI_MIXER_MAIN:
+   

[PATCH 07/10] drm/sti: add debugfs entries for VID plane

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_compositor.c |  2 +-
 drivers/gpu/drm/sti/sti_vid.c| 94 +++-
 drivers/gpu/drm/sti/sti_vid.h|  4 +-
 3 files changed, 95 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
b/drivers/gpu/drm/sti/sti_compositor.c
index afed217..5b827a9 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -75,7 +75,7 @@ static int sti_compositor_bind(struct device *dev,
switch (desc[i].type) {
case STI_VID_SUBDEV:
compo->vid[vid_id++] =
-   sti_vid_create(compo->dev, desc[i].id,
+   sti_vid_create(compo->dev, drm_dev, desc[i].id,
   compo->regs + desc[i].offset);
break;
case STI_MIXER_MAIN_SUBDEV:
diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c
index 0a1e50c..5a2c5dc 100644
--- a/drivers/gpu/drm/sti/sti_vid.c
+++ b/drivers/gpu/drm/sti/sti_vid.c
@@ -54,6 +54,93 @@

 #define VID_MIN_HD_HEIGHT   720

+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  readl(vid->regs + reg))
+
+static void vid_dbg_ctl(struct seq_file *s, int val)
+{
+   val = val >> 30;
+   seq_puts(s, "\t");
+
+   if (!(val & 1))
+   seq_puts(s, "NOT ");
+   seq_puts(s, "ignored on main mixer - ");
+
+   if (!(val & 2))
+   seq_puts(s, "NOT ");
+   seq_puts(s, "ignored on aux mixer");
+}
+
+static void vid_dbg_vpo(struct seq_file *s, int val)
+{
+   seq_printf(s, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
+}
+
+static void vid_dbg_vps(struct seq_file *s, int val)
+{
+   seq_printf(s, "\txds:%4d\tyds:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
+}
+
+static void vid_dbg_mst(struct seq_file *s, int val)
+{
+   if (val & 1)
+   seq_puts(s, "\tBUFFER UNDERFLOW!");
+}
+
+static int vid_dbg_show(struct seq_file *s, void *arg)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_vid *vid = (struct sti_vid *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   int ret;
+
+   ret = mutex_lock_interruptible(>struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "VID: (vaddr= 0x%p)", vid->regs);
+
+   DBGFS_DUMP(VID_CTL);
+   vid_dbg_ctl(s, readl(vid->regs + VID_CTL));
+   DBGFS_DUMP(VID_ALP);
+   DBGFS_DUMP(VID_CLF);
+   DBGFS_DUMP(VID_VPO);
+   vid_dbg_vpo(s, readl(vid->regs + VID_VPO));
+   DBGFS_DUMP(VID_VPS);
+   vid_dbg_vps(s, readl(vid->regs + VID_VPS));
+   DBGFS_DUMP(VID_KEY1);
+   DBGFS_DUMP(VID_KEY2);
+   DBGFS_DUMP(VID_MPR0);
+   DBGFS_DUMP(VID_MPR1);
+   DBGFS_DUMP(VID_MPR2);
+   DBGFS_DUMP(VID_MPR3);
+   DBGFS_DUMP(VID_MST);
+   vid_dbg_mst(s, readl(vid->regs + VID_MST));
+   DBGFS_DUMP(VID_BC);
+   DBGFS_DUMP(VID_TINT);
+   DBGFS_DUMP(VID_CSAT);
+   seq_puts(s, "\n");
+
+   mutex_unlock(>struct_mutex);
+   return 0;
+}
+
+static struct drm_info_list vid_debugfs_files[] = {
+   { "vid", vid_dbg_show, 0, NULL },
+};
+
+static int vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor)
+{
+   unsigned int i;
+
+   for (i = 0; i < ARRAY_SIZE(vid_debugfs_files); i++)
+   vid_debugfs_files[i].data = vid;
+
+   return drm_debugfs_create_files(vid_debugfs_files,
+   ARRAY_SIZE(vid_debugfs_files),
+   minor->debugfs_root, minor);
+}
+
 void sti_vid_commit(struct sti_vid *vid,
struct drm_plane_state *state)
 {
@@ -122,8 +209,8 @@ static void sti_vid_init(struct sti_vid *vid)
writel(VID_CSAT_DFLT, vid->regs + VID_CSAT);
 }

-struct sti_vid *sti_vid_create(struct device *dev, int id,
-  void __iomem *baseaddr)
+struct sti_vid *sti_vid_create(struct device *dev, struct drm_device *drm_dev,
+  int id, void __iomem *baseaddr)
 {
struct sti_vid *vid;

@@ -139,5 +226,8 @@ struct sti_vid *sti_vid_create(struct device *dev, int id,

sti_vid_init(vid);

+   if (vid_debugfs_init(vid, drm_dev->primary))
+   DRM_ERROR("VID debugfs setup failed\n");
+
return vid;
 }
diff --git a/drivers/gpu/drm/sti/sti_vid.h b/drivers/gpu/drm/sti/sti_vid.h
index 5dea479..6c84234 100644
--- a/drivers/gpu/drm/sti/sti_vid.h
+++ b/drivers/gpu/drm/sti/sti_vid.h
@@ -23,7 +23,7 @@ struct sti_vid {
 void sti_vid_commit(struct sti_vid *vid,
struct drm_plane_state *state);
 void sti_vid_disable(struct sti_vid *vid);
-struct sti_vid *sti_vid_create(struct device *dev, int id,
-  void __iomem *baseaddr);
+struct sti_vid *sti_vid_create(struct 

[PATCH 06/10] drm/sti: add debugfs entries for HQVDP plane

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hqvdp.c | 243 
 1 file changed, 243 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index eace56d..8d2118a 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -414,6 +414,246 @@ static int sti_hqvdp_get_curr_cmd(struct sti_hqvdp *hqvdp)
 }

 /**
+ * sti_hqvdp_get_next_cmd
+ * @hqvdp: hqvdp structure
+ *
+ * Look for the next hqvdp_cmd that will be used by the FW.
+ *
+ * RETURNS:
+ *  the offset of the next command that will be used.
+ * -1 in error cases
+ */
+static int sti_hqvdp_get_next_cmd(struct sti_hqvdp *hqvdp)
+{
+   int next_cmd;
+   dma_addr_t cmd = hqvdp->hqvdp_cmd_paddr;
+   unsigned int i;
+
+   next_cmd = readl(hqvdp->regs + HQVDP_MBX_NEXT_CMD);
+
+   for (i = 0; i < NB_VDP_CMD; i++) {
+   if (cmd == next_cmd)
+   return i * sizeof(struct sti_hqvdp_cmd);
+
+   cmd += sizeof(struct sti_hqvdp_cmd);
+   }
+
+   return -1;
+}
+
+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  readl(hqvdp->regs + reg))
+
+static const char *hqvdp_dbg_get_lut(u32 *coef)
+{
+   if (!memcmp(coef, coef_lut_a_legacy, 16))
+   return "LUT A";
+   if (!memcmp(coef, coef_lut_b, 16))
+   return "LUT B";
+   if (!memcmp(coef, coef_lut_c_y_legacy, 16))
+   return "LUT C Y";
+   if (!memcmp(coef, coef_lut_c_c_legacy, 16))
+   return "LUT C C";
+   if (!memcmp(coef, coef_lut_d_y_legacy, 16))
+   return "LUT D Y";
+   if (!memcmp(coef, coef_lut_d_c_legacy, 16))
+   return "LUT D C";
+   if (!memcmp(coef, coef_lut_e_y_legacy, 16))
+   return "LUT E Y";
+   if (!memcmp(coef, coef_lut_e_c_legacy, 16))
+   return "LUT E C";
+   if (!memcmp(coef, coef_lut_f_y_legacy, 16))
+   return "LUT F Y";
+   if (!memcmp(coef, coef_lut_f_c_legacy, 16))
+   return "LUT F C";
+   return "";
+}
+
+static void hqvdp_dbg_dump_cmd(struct seq_file *s, struct sti_hqvdp_cmd *c)
+{
+   int src_w, src_h, dst_w, dst_h;
+
+   seq_puts(s, "\n\tTOP:");
+   seq_printf(s, "\n\t %-20s 0x%08X", "Config", c->top.config);
+   switch (c->top.config) {
+   case TOP_CONFIG_PROGRESSIVE:
+   seq_puts(s, "\tProgressive");
+   break;
+   case TOP_CONFIG_INTER_TOP:
+   seq_puts(s, "\tInterlaced, top field");
+   break;
+   case TOP_CONFIG_INTER_BTM:
+   seq_puts(s, "\tInterlaced, bottom field");
+   break;
+   default:
+   seq_puts(s, "\t");
+   break;
+   }
+
+   seq_printf(s, "\n\t %-20s 0x%08X", "MemFormat", c->top.mem_format);
+   seq_printf(s, "\n\t %-20s 0x%08X", "CurrentY", c->top.current_luma);
+   seq_printf(s, "\n\t %-20s 0x%08X", "CurrentC", c->top.current_chroma);
+   seq_printf(s, "\n\t %-20s 0x%08X", "YSrcPitch", c->top.luma_src_pitch);
+   seq_printf(s, "\n\t %-20s 0x%08X", "CSrcPitch",
+  c->top.chroma_src_pitch);
+   seq_printf(s, "\n\t %-20s 0x%08X", "InputFrameSize",
+  c->top.input_frame_size);
+   seq_printf(s, "\t%dx%d",
+  c->top.input_frame_size & 0x,
+  c->top.input_frame_size >> 16);
+   seq_printf(s, "\n\t %-20s 0x%08X", "InputViewportSize",
+  c->top.input_viewport_size);
+   src_w = c->top.input_viewport_size & 0x;
+   src_h = c->top.input_viewport_size >> 16;
+   seq_printf(s, "\t%dx%d", src_w, src_h);
+
+   seq_puts(s, "\n\tHVSRC:");
+   seq_printf(s, "\n\t %-20s 0x%08X", "OutputPictureSize",
+  c->hvsrc.output_picture_size);
+   dst_w = c->hvsrc.output_picture_size & 0x;
+   dst_h = c->hvsrc.output_picture_size >> 16;
+   seq_printf(s, "\t%dx%d", dst_w, dst_h);
+   seq_printf(s, "\n\t %-20s 0x%08X", "ParamCtrl", c->hvsrc.param_ctrl);
+
+   seq_printf(s, "\n\t %-20s %s", "yh_coef",
+  hqvdp_dbg_get_lut(c->hvsrc.yh_coef));
+   seq_printf(s, "\n\t %-20s %s", "ch_coef",
+  hqvdp_dbg_get_lut(c->hvsrc.ch_coef));
+   seq_printf(s, "\n\t %-20s %s", "yv_coef",
+  hqvdp_dbg_get_lut(c->hvsrc.yv_coef));
+   seq_printf(s, "\n\t %-20s %s", "cv_coef",
+  hqvdp_dbg_get_lut(c->hvsrc.cv_coef));
+
+   seq_printf(s, "\n\t %-20s", "ScaleH");
+   if (dst_w > src_w)
+   seq_printf(s, " %d/1", dst_w / src_w);
+   else
+   seq_printf(s, " 1/%d", src_w / dst_w);
+
+   seq_printf(s, "\n\t %-20s", "tScaleV");
+   if (dst_h > src_h)
+   seq_printf(s, " %d/1", dst_h / src_h);
+   else
+   seq_printf(s, " 1/%d", src_h / dst_h);
+
+   

[PATCH 05/10] drm/sti: add debugfs entries for GDP planes

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_gdp.c | 236 ++
 1 file changed, 236 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index a6fba9c..8f0e89f 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -31,6 +31,23 @@
 #define GDP_ARGB15550x06
 #define GDP_ARGB0x07

+#define GDP2STR(fmt) { GDP_ ## fmt, #fmt }
+
+static struct gdp_format_to_str {
+   int format;
+   char name[20];
+} gdp_format_to_str[] = {
+   GDP2STR(RGB565),
+   GDP2STR(RGB888),
+   GDP2STR(RGB888_32),
+   GDP2STR(XBGR),
+   GDP2STR(ARGB8565),
+   GDP2STR(ARGB),
+   GDP2STR(ABGR),
+   GDP2STR(ARGB1555),
+   GDP2STR(ARGB)
+   };
+
 #define GAM_GDP_CTL_OFFSET  0x00
 #define GAM_GDP_AGC_OFFSET  0x04
 #define GAM_GDP_VPO_OFFSET  0x0C
@@ -119,6 +136,222 @@ static const uint32_t gdp_supported_formats[] = {
DRM_FORMAT_RGB888,
 };

+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  readl(gdp->regs + reg ## _OFFSET))
+
+static void gdp_dbg_ctl(struct seq_file *s, int val)
+{
+   int i;
+
+   seq_puts(s, "\tColor:");
+   for (i = 0; i < ARRAY_SIZE(gdp_format_to_str); i++) {
+   if (gdp_format_to_str[i].format == (val & 0x1F)) {
+   seq_printf(s, gdp_format_to_str[i].name);
+   break;
+   }
+   }
+   if (i == ARRAY_SIZE(gdp_format_to_str))
+   seq_puts(s, "");
+
+   seq_printf(s, "\tWaitNextVsync:%d", val & WAIT_NEXT_VSYNC ? 1 : 0);
+}
+
+static void gdp_dbg_vpo(struct seq_file *s, int val)
+{
+   seq_printf(s, "\txdo:%4d\tydo:%4d", val & 0x, (val >> 16) & 0x);
+}
+
+static void gdp_dbg_vps(struct seq_file *s, int val)
+{
+   seq_printf(s, "\txds:%4d\tyds:%4d", val & 0x, (val >> 16) & 0x);
+}
+
+static void gdp_dbg_size(struct seq_file *s, int val)
+{
+   seq_printf(s, "\t%d x %d", val & 0x, (val >> 16) & 0x);
+}
+
+static void gdp_dbg_nvn(struct seq_file *s, struct sti_gdp *gdp, int val)
+{
+   void *base = NULL;
+   unsigned int i;
+
+   for (i = 0; i < GDP_NODE_NB_BANK; i++) {
+   if (gdp->node_list[i].top_field_paddr == val) {
+   base = gdp->node_list[i].top_field;
+   break;
+   }
+   if (gdp->node_list[i].btm_field_paddr == val) {
+   base = gdp->node_list[i].btm_field;
+   break;
+   }
+   }
+
+   if (base)
+   seq_printf(s, "\tVirt @: %p", base);
+}
+
+static void gdp_dbg_ppt(struct seq_file *s, int val)
+{
+   if (val & GAM_GDP_PPT_IGNORE)
+   seq_puts(s, "\tNot displayed on mixer!");
+}
+
+static void gdp_dbg_mst(struct seq_file *s, int val)
+{
+   if (val & 1)
+   seq_puts(s, "\tBUFFER UNDERFLOW!");
+}
+
+static int gdp_dbg_show(struct seq_file *s, void *data)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_gdp *gdp = (struct sti_gdp *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   struct drm_plane *drm_plane = >plane.drm_plane;
+   struct drm_crtc *crtc = drm_plane->crtc;
+   int ret;
+
+   ret = mutex_lock_interruptible(>struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "%s: (vaddr = 0x%p)",
+  sti_plane_to_str(>plane), gdp->regs);
+
+   DBGFS_DUMP(GAM_GDP_CTL);
+   gdp_dbg_ctl(s, readl(gdp->regs + GAM_GDP_CTL_OFFSET));
+   DBGFS_DUMP(GAM_GDP_AGC);
+   DBGFS_DUMP(GAM_GDP_VPO);
+   gdp_dbg_vpo(s, readl(gdp->regs + GAM_GDP_VPO_OFFSET));
+   DBGFS_DUMP(GAM_GDP_VPS);
+   gdp_dbg_vps(s, readl(gdp->regs + GAM_GDP_VPS_OFFSET));
+   DBGFS_DUMP(GAM_GDP_PML);
+   DBGFS_DUMP(GAM_GDP_PMP);
+   DBGFS_DUMP(GAM_GDP_SIZE);
+   gdp_dbg_size(s, readl(gdp->regs + GAM_GDP_SIZE_OFFSET));
+   DBGFS_DUMP(GAM_GDP_NVN);
+   gdp_dbg_nvn(s, gdp, readl(gdp->regs + GAM_GDP_NVN_OFFSET));
+   DBGFS_DUMP(GAM_GDP_KEY1);
+   DBGFS_DUMP(GAM_GDP_KEY2);
+   DBGFS_DUMP(GAM_GDP_PPT);
+   gdp_dbg_ppt(s, readl(gdp->regs + GAM_GDP_PPT_OFFSET));
+   DBGFS_DUMP(GAM_GDP_CML);
+   DBGFS_DUMP(GAM_GDP_MST);
+   gdp_dbg_mst(s, readl(gdp->regs + GAM_GDP_MST_OFFSET));
+
+   seq_puts(s, "\n\n");
+   if (!crtc)
+   seq_puts(s, "  Not connected to any DRM CRTC\n");
+   else
+   seq_printf(s, "  Connected to DRM CRTC #%d (%s)\n",
+  crtc->base.id, sti_mixer_to_str(to_sti_mixer(crtc)));
+
+   mutex_unlock(>struct_mutex);
+   return 0;
+}
+
+static void gdp_node_dump_node(struct seq_file *s, struct sti_gdp_node *node)
+{
+   seq_printf(s, "\t@:0x%p", 

[PATCH 04/10] drm/sti: add debugfs entries for CURSOR plane

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_cursor.c | 79 
 1 file changed, 79 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index a4c67ab..9eac1b9 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -72,6 +72,82 @@ static const uint32_t cursor_supported_formats[] = {

 #define to_sti_cursor(x) container_of(x, struct sti_cursor, plane)

+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  readl(cursor->regs + reg))
+
+static void cursor_dbg_vpo(struct seq_file *s, u32 val)
+{
+   seq_printf(s, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
+}
+
+static void cursor_dbg_size(struct seq_file *s, u32 val)
+{
+   seq_printf(s, "\t%d x %d", val & 0x07FF, (val >> 16) & 0x07FF);
+}
+
+static void cursor_dbg_pml(struct seq_file *s,
+  struct sti_cursor *cursor, u32 val)
+{
+   if (cursor->pixmap.paddr == val)
+   seq_printf(s, "\tVirt @: %p", cursor->pixmap.base);
+}
+
+static void cursor_dbg_cml(struct seq_file *s,
+  struct sti_cursor *cursor, u32 val)
+{
+   if (cursor->clut_paddr == val)
+   seq_printf(s, "\tVirt @: %p", cursor->clut);
+}
+
+static int cursor_dbg_show(struct seq_file *s, void *data)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_cursor *cursor = (struct sti_cursor *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   int ret;
+
+   ret = mutex_lock_interruptible(>struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "%s: (vaddr = 0x%p)",
+  sti_plane_to_str(>plane), cursor->regs);
+
+   DBGFS_DUMP(CUR_CTL);
+   DBGFS_DUMP(CUR_VPO);
+   cursor_dbg_vpo(s, readl(cursor->regs + CUR_VPO));
+   DBGFS_DUMP(CUR_PML);
+   cursor_dbg_pml(s, cursor, readl(cursor->regs + CUR_PML));
+   DBGFS_DUMP(CUR_PMP);
+   DBGFS_DUMP(CUR_SIZE);
+   cursor_dbg_size(s, readl(cursor->regs + CUR_SIZE));
+   DBGFS_DUMP(CUR_CML);
+   cursor_dbg_cml(s, cursor, readl(cursor->regs + CUR_CML));
+   DBGFS_DUMP(CUR_AWS);
+   DBGFS_DUMP(CUR_AWE);
+   seq_puts(s, "\n");
+
+   mutex_unlock(>struct_mutex);
+   return 0;
+}
+
+static struct drm_info_list cursor_debugfs_files[] = {
+   { "cursor", cursor_dbg_show, 0, NULL },
+};
+
+static int cursor_debugfs_init(struct sti_cursor *cursor,
+  struct drm_minor *minor)
+{
+   unsigned int i;
+
+   for (i = 0; i < ARRAY_SIZE(cursor_debugfs_files); i++)
+   cursor_debugfs_files[i].data = cursor;
+
+   return drm_debugfs_create_files(cursor_debugfs_files,
+   ARRAY_SIZE(cursor_debugfs_files),
+   minor->debugfs_root, minor);
+}
+
 static void sti_cursor_argb_to_clut8(struct sti_cursor *cursor, u32 *src)
 {
u8  *dst = cursor->pixmap.base;
@@ -306,6 +382,9 @@ struct drm_plane *sti_cursor_create(struct drm_device 
*drm_dev,

sti_plane_init_property(>plane, DRM_PLANE_TYPE_CURSOR);

+   if (cursor_debugfs_init(cursor, drm_dev->primary))
+   DRM_ERROR("CURSOR debugfs setup failed\n");
+
return >plane.drm_plane;

 err_plane:
-- 
1.9.1



[PATCH 03/10] drm/sti: add debugfs entries for HDA connector

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hda.c | 105 +-
 1 file changed, 104 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index 293a133..ec0d017 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -326,6 +326,103 @@ static void hda_enable_hd_dacs(struct sti_hda *hda, bool 
enable)
}
 }

+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  readl(hda->regs + reg))
+
+static void hda_dbg_cfg(struct seq_file *s, int val)
+{
+   seq_puts(s, "\tAWG ");
+   seq_puts(s, val & CFG_AWG_ASYNC_EN ? "enabled" : "disabled");
+}
+
+static void hda_dbg_awg_microcode(struct seq_file *s, void __iomem *reg)
+{
+   unsigned int i;
+
+   seq_puts(s, "\n\n");
+   seq_puts(s, "  HDA AWG microcode:");
+   for (i = 0; i < AWG_MAX_INST; i++) {
+   if (i % 8 == 0)
+   seq_printf(s, "\n  %04X:", i);
+   seq_printf(s, " %04X", readl(reg + i * 4));
+   }
+}
+
+static void hda_dbg_video_dacs_ctrl(struct seq_file *s, void __iomem *reg)
+{
+   u32 val = readl(reg);
+   u32 mask;
+
+   switch ((u32)reg & VIDEO_DACS_CONTROL_MASK) {
+   case VIDEO_DACS_CONTROL_SYSCFG2535:
+   mask = DAC_CFG_HD_OFF_MASK;
+   break;
+   case VIDEO_DACS_CONTROL_SYSCFG5072:
+   mask = DAC_CFG_HD_HZUVW_OFF_MASK;
+   break;
+   default:
+   DRM_DEBUG_DRIVER("Warning: DACS ctrl register not supported!");
+   return;
+   }
+
+   seq_puts(s, "\n");
+   seq_printf(s, "\n  %-25s 0x%08X", "VIDEO_DACS_CONTROL", val);
+   seq_puts(s, "\tHD DACs ");
+   seq_puts(s, val & mask ? "disabled" : "enabled");
+}
+
+static int hda_dbg_show(struct seq_file *s, void *data)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_hda *hda = (struct sti_hda *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   int ret;
+
+   ret = mutex_lock_interruptible(>struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "HD Analog: (vaddr = 0x%p)", hda->regs);
+   DBGFS_DUMP(HDA_ANA_CFG);
+   hda_dbg_cfg(s, readl(hda->regs + HDA_ANA_CFG));
+   DBGFS_DUMP(HDA_ANA_SCALE_CTRL_Y);
+   DBGFS_DUMP(HDA_ANA_SCALE_CTRL_CB);
+   DBGFS_DUMP(HDA_ANA_SCALE_CTRL_CR);
+   DBGFS_DUMP(HDA_ANA_ANC_CTRL);
+   DBGFS_DUMP(HDA_ANA_SRC_Y_CFG);
+   DBGFS_DUMP(HDA_ANA_SRC_C_CFG);
+   hda_dbg_awg_microcode(s, hda->regs + HDA_SYNC_AWGI);
+   if (hda->video_dacs_ctrl)
+   hda_dbg_video_dacs_ctrl(s, hda->video_dacs_ctrl);
+   seq_puts(s, "\n");
+
+   mutex_unlock(>struct_mutex);
+   return 0;
+}
+
+static struct drm_info_list hda_debugfs_files[] = {
+   { "hda", hda_dbg_show, 0, NULL },
+};
+
+static void hda_debugfs_exit(struct sti_hda *hda, struct drm_minor *minor)
+{
+   drm_debugfs_remove_files(hda_debugfs_files,
+ARRAY_SIZE(hda_debugfs_files),
+minor);
+}
+
+static int hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor)
+{
+   unsigned int i;
+
+   for (i = 0; i < ARRAY_SIZE(hda_debugfs_files); i++)
+   hda_debugfs_files[i].data = hda;
+
+   return drm_debugfs_create_files(hda_debugfs_files,
+   ARRAY_SIZE(hda_debugfs_files),
+   minor->debugfs_root, minor);
+}
+
 /**
  * Configure AWG, writing instructions
  *
@@ -688,6 +785,9 @@ static int sti_hda_bind(struct device *dev, struct device 
*master, void *data)
/* force to disable hd dacs at startup */
hda_enable_hd_dacs(hda, false);

+   if (hda_debugfs_init(hda, drm_dev->primary))
+   DRM_ERROR("HDA debugfs setup failed\n");
+
return 0;

 err_sysfs:
@@ -700,7 +800,10 @@ err_connector:
 static void sti_hda_unbind(struct device *dev,
struct device *master, void *data)
 {
-   /* do nothing */
+   struct sti_hda *hda = dev_get_drvdata(dev);
+   struct drm_device *drm_dev = data;
+
+   hda_debugfs_exit(hda, drm_dev->primary);
 }

 static const struct component_ops sti_hda_ops = {
-- 
1.9.1



[PATCH 02/10] drm/sti: add debugfs entries for DVO connector

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_dvo.c | 70 +++
 1 file changed, 70 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index 9e90b74..25f7663 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -6,6 +6,7 @@

 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -156,6 +157,69 @@ static void dvo_awg_configure(struct sti_dvo *dvo, u32 
*awg_ram_code, int nb)
writel(DVO_AWG_CTRL_EN, dvo->regs + DVO_AWG_DIGSYNC_CTRL);
 }

+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  readl(dvo->regs + reg))
+
+static void dvo_dbg_awg_microcode(struct seq_file *s, void __iomem *reg)
+{
+   unsigned int i;
+
+   seq_puts(s, "\n\n");
+   seq_puts(s, "  DVO AWG microcode:");
+   for (i = 0; i < AWG_MAX_INST; i++) {
+   if (i % 8 == 0)
+   seq_printf(s, "\n  %04X:", i);
+   seq_printf(s, " %04X", readl(reg + i * 4));
+   }
+}
+
+static int dvo_dbg_show(struct seq_file *s, void *data)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_dvo *dvo = (struct sti_dvo *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   int ret;
+
+   ret = mutex_lock_interruptible(>struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "DVO: (vaddr = 0x%p)", dvo->regs);
+   DBGFS_DUMP(DVO_AWG_DIGSYNC_CTRL);
+   DBGFS_DUMP(DVO_DOF_CFG);
+   DBGFS_DUMP(DVO_LUT_PROG_LOW);
+   DBGFS_DUMP(DVO_LUT_PROG_MID);
+   DBGFS_DUMP(DVO_LUT_PROG_HIGH);
+   dvo_dbg_awg_microcode(s, dvo->regs + DVO_DIGSYNC_INSTR_I);
+   seq_puts(s, "\n");
+
+   mutex_unlock(>struct_mutex);
+   return 0;
+}
+
+static struct drm_info_list dvo_debugfs_files[] = {
+   { "dvo", dvo_dbg_show, 0, NULL },
+};
+
+static void dvo_debugfs_exit(struct sti_dvo *dvo, struct drm_minor *minor)
+{
+   drm_debugfs_remove_files(dvo_debugfs_files,
+ARRAY_SIZE(dvo_debugfs_files),
+minor);
+}
+
+static int dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor)
+{
+   unsigned int i;
+
+   for (i = 0; i < ARRAY_SIZE(dvo_debugfs_files); i++)
+   dvo_debugfs_files[i].data = dvo;
+
+   return drm_debugfs_create_files(dvo_debugfs_files,
+   ARRAY_SIZE(dvo_debugfs_files),
+   minor->debugfs_root, minor);
+}
+
 static void sti_dvo_disable(struct drm_bridge *bridge)
 {
struct sti_dvo *dvo = bridge->driver_private;
@@ -455,6 +519,9 @@ static int sti_dvo_bind(struct device *dev, struct device 
*master, void *data)
goto err_sysfs;
}

+   if (dvo_debugfs_init(dvo, drm_dev->primary))
+   DRM_ERROR("DVO debugfs setup failed\n");
+
return 0;

 err_sysfs:
@@ -469,6 +536,9 @@ static void sti_dvo_unbind(struct device *dev,
   struct device *master, void *data)
 {
struct sti_dvo *dvo = dev_get_drvdata(dev);
+   struct drm_device *drm_dev = data;
+
+   dvo_debugfs_exit(dvo, drm_dev->primary);

drm_bridge_remove(dvo->bridge);
 }
-- 
1.9.1



[PATCH 01/10] drm/sti: add debugfs entries for HDMI connector

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hdmi.c | 175 -
 drivers/gpu/drm/sti/sti_hdmi.h |   4 +-
 2 files changed, 175 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 69a2286..6ef0715 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -6,6 +6,7 @@

 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -550,6 +551,172 @@ static void hdmi_swreset(struct sti_hdmi *hdmi)
clk_disable_unprepare(hdmi->clk_audio);
 }

+#define DBGFS_PRINT_STR(str1, str2) seq_printf(s, "%-24s %s\n", str1, str2)
+#define DBGFS_PRINT_INT(str1, int2) seq_printf(s, "%-24s %d\n", str1, int2)
+#define DBGFS_DUMP(str, reg) seq_printf(s, "%s  %-25s 0x%08X", str, #reg, \
+   hdmi_read(hdmi, reg))
+#define DBGFS_DUMP_DI(reg, slot) DBGFS_DUMP("\n", reg(slot))
+
+static void hdmi_dbg_cfg(struct seq_file *s, int val)
+{
+   int tmp;
+
+   seq_puts(s, "\t");
+   tmp = val & HDMI_CFG_HDMI_NOT_DVI;
+   DBGFS_PRINT_STR("mode:", tmp ? "HDMI" : "DVI");
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = val & HDMI_CFG_HDCP_EN;
+   DBGFS_PRINT_STR("HDCP:", tmp ? "enable" : "disable");
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = val & HDMI_CFG_ESS_NOT_OESS;
+   DBGFS_PRINT_STR("HDCP mode:", tmp ? "ESS enable" : "OESS enable");
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = val & HDMI_CFG_SINK_TERM_DET_EN;
+   DBGFS_PRINT_STR("Sink term detection:", tmp ? "enable" : "disable");
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = val & HDMI_CFG_H_SYNC_POL_NEG;
+   DBGFS_PRINT_STR("Hsync polarity:", tmp ? "inverted" : "normal");
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = val & HDMI_CFG_V_SYNC_POL_NEG;
+   DBGFS_PRINT_STR("Vsync polarity:", tmp ? "inverted" : "normal");
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = val & HDMI_CFG_422_EN;
+   DBGFS_PRINT_STR("YUV422 format:", tmp ? "enable" : "disable");
+}
+
+static void hdmi_dbg_sta(struct seq_file *s, int val)
+{
+   int tmp;
+
+   seq_puts(s, "\t");
+   tmp = (val & HDMI_STA_DLL_LCK);
+   DBGFS_PRINT_STR("pll:", tmp ? "locked" : "not locked");
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = (val & HDMI_STA_HOT_PLUG);
+   DBGFS_PRINT_STR("hdmi cable:", tmp ? "connected" : "not connected");
+}
+
+static void hdmi_dbg_sw_di_cfg(struct seq_file *s, int val)
+{
+   int tmp;
+   char *const en_di[] = {"no transmission",
+  "single transmission",
+  "once every field",
+  "once every frame"};
+
+   seq_puts(s, "\t");
+   tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 1));
+   DBGFS_PRINT_STR("Data island 1:", en_di[tmp]);
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 2)) >> 4;
+   DBGFS_PRINT_STR("Data island 2:", en_di[tmp]);
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 3)) >> 8;
+   DBGFS_PRINT_STR("Data island 3:", en_di[tmp]);
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 4)) >> 12;
+   DBGFS_PRINT_STR("Data island 4:", en_di[tmp]);
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 5)) >> 16;
+   DBGFS_PRINT_STR("Data island 5:", en_di[tmp]);
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 6)) >> 20;
+   DBGFS_PRINT_STR("Data island 6:", en_di[tmp]);
+}
+
+static int hdmi_dbg_show(struct seq_file *s, void *data)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_hdmi *hdmi = (struct sti_hdmi *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   int ret;
+
+   ret = mutex_lock_interruptible(>struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "HDMI: (vaddr = 0x%p)", hdmi->regs);
+   DBGFS_DUMP("\n", HDMI_CFG);
+   hdmi_dbg_cfg(s, hdmi_read(hdmi, HDMI_CFG));
+   DBGFS_DUMP("", HDMI_INT_EN);
+   DBGFS_DUMP("\n", HDMI_STA);
+   hdmi_dbg_sta(s, hdmi_read(hdmi, HDMI_STA));
+   DBGFS_DUMP("", HDMI_ACTIVE_VID_XMIN);
+   seq_puts(s, "\t");
+   DBGFS_PRINT_INT("Xmin:", hdmi_read(hdmi, HDMI_ACTIVE_VID_XMIN));
+   DBGFS_DUMP("", HDMI_ACTIVE_VID_XMAX);
+   seq_puts(s, "\t");
+   DBGFS_PRINT_INT("Xmax:", hdmi_read(hdmi, HDMI_ACTIVE_VID_XMAX));
+   DBGFS_DUMP("", HDMI_ACTIVE_VID_YMIN);
+   seq_puts(s, "\t");
+   DBGFS_PRINT_INT("Ymin:", hdmi_read(hdmi, HDMI_ACTIVE_VID_YMIN));
+   DBGFS_DUMP("", HDMI_ACTIVE_VID_YMAX);
+   seq_puts(s, "\t");
+   DBGFS_PRINT_INT("Ymax:", hdmi_read(hdmi, HDMI_ACTIVE_VID_YMAX));
+   DBGFS_DUMP("", HDMI_SW_DI_CFG);
+   hdmi_dbg_sw_di_cfg(s, hdmi_read(hdmi, HDMI_SW_DI_CFG));
+
+   

[PATCH 00/10] drm/sti: debugfs

2016-02-12 Thread Vincent Abriou
Those patches introduce debugfs for connector, encoder, crtc and planes.
It adds the following entries:
 - planes:
   gdpx / gdpx_node
   hqvdp
   cursor
   vid
   fps_get / fps_show

 - crtc:
   mixer_aux / mixer_main

 - encoder:
   tvout

 - connectors:
   hda
   hdmi
   dvo

Vincent Abriou (10):
  drm/sti: add debugfs entries for HDMI connector
  drm/sti: add debugfs entries for DVO connector
  drm/sti: add debugfs entries for HDA connector
  drm/sti: add debugfs entries for CURSOR plane
  drm/sti: add debugfs entries for GDP planes
  drm/sti: add debugfs entries for HQVDP plane
  drm/sti: add debugfs entries for VID plane
  drm/sti: add debugfs entries for MIXER crtc
  drm/sti: add debugfs entries for TVOUT encoders
  drm/sti: add debugfs fps_show/fps_get mechanism for planes

 drivers/gpu/drm/sti/sti_compositor.c |   4 +-
 drivers/gpu/drm/sti/sti_cursor.c |  81 +++
 drivers/gpu/drm/sti/sti_drv.c| 128 ++
 drivers/gpu/drm/sti/sti_dvo.c|  70 ++
 drivers/gpu/drm/sti/sti_gdp.c| 238 
 drivers/gpu/drm/sti/sti_hda.c| 105 ++-
 drivers/gpu/drm/sti/sti_hdmi.c   | 175 +++-
 drivers/gpu/drm/sti/sti_hdmi.h   |   4 +-
 drivers/gpu/drm/sti/sti_hqvdp.c  | 254 ++-
 drivers/gpu/drm/sti/sti_mixer.c  | 146 +++-
 drivers/gpu/drm/sti/sti_mixer.h  |   4 +-
 drivers/gpu/drm/sti/sti_plane.c  |  63 +
 drivers/gpu/drm/sti/sti_plane.h  |  17 +++
 drivers/gpu/drm/sti/sti_tvout.c  | 157 ++
 drivers/gpu/drm/sti/sti_vid.c|  94 -
 drivers/gpu/drm/sti/sti_vid.h|   4 +-
 16 files changed, 1524 insertions(+), 20 deletions(-)

-- 
1.9.1



[PATCH 11/11] drm/sti: add hdmi_mode property for HDMI connector

2016-02-12 Thread Vincent Abriou
Configures the framer of the HDMI connection.
By default starts in HDMI mode and can be swtich to DVI.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hdmi.c | 30 --
 drivers/gpu/drm/sti/sti_hdmi.h | 15 +++
 2 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 1f37dc4..69a2286 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -129,6 +129,7 @@ struct sti_hdmi_connector {
struct drm_encoder *encoder;
struct sti_hdmi *hdmi;
struct drm_property *colorspace_property;
+   struct drm_property *hdmi_mode_property;
 };

 #define to_sti_hdmi_connector(x) \
@@ -229,8 +230,10 @@ static void hdmi_config(struct sti_hdmi *hdmi)
/* Clear overrun and underrun fifo */
conf = HDMI_CFG_FIFO_OVERRUN_CLR | HDMI_CFG_FIFO_UNDERRUN_CLR;

-   /* Enable HDMI mode not DVI */
-   conf |= HDMI_CFG_HDMI_NOT_DVI | HDMI_CFG_ESS_NOT_OESS;
+   /* Select encryption type and the framing mode */
+   conf |= HDMI_CFG_ESS_NOT_OESS;
+   if (hdmi->hdmi_mode == HDMI_MODE_HDMI)
+   conf |= HDMI_CFG_HDMI_NOT_DVI;

/* Enable sink term detection */
conf |= HDMI_CFG_SINK_TERM_DET_EN;
@@ -791,6 +794,19 @@ static void sti_hdmi_connector_init_property(struct 
drm_device *drm_dev,
}
hdmi_connector->colorspace_property = prop;
drm_object_attach_property(>base, prop, hdmi->colorspace);
+
+   /* hdmi_mode property */
+   hdmi->hdmi_mode = DEFAULT_HDMI_MODE;
+   prop = drm_property_create_enum(drm_dev, 0, "hdmi_mode",
+   hdmi_mode_names,
+   ARRAY_SIZE(hdmi_mode_names));
+   if (!prop) {
+   DRM_ERROR("fails to create colorspace property\n");
+   return;
+   }
+   hdmi_connector->hdmi_mode_property = prop;
+   drm_object_attach_property(>base, prop, hdmi->hdmi_mode);
+
 }

 static int
@@ -808,6 +824,11 @@ sti_hdmi_connector_set_property(struct drm_connector 
*connector,
return 0;
}

+   if (property == hdmi_connector->hdmi_mode_property) {
+   hdmi->hdmi_mode = val;
+   return 0;
+   }
+
DRM_ERROR("failed to set hdmi connector property\n");
return -EINVAL;
 }
@@ -827,6 +848,11 @@ sti_hdmi_connector_get_property(struct drm_connector 
*connector,
return 0;
}

+   if (property == hdmi_connector->hdmi_mode_property) {
+   *val = hdmi->hdmi_mode;
+   return 0;
+   }
+
DRM_ERROR("failed to get hdmi connector property\n");
return -EINVAL;
 }
diff --git a/drivers/gpu/drm/sti/sti_hdmi.h b/drivers/gpu/drm/sti/sti_hdmi.h
index f621cd7..77edb73 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.h
+++ b/drivers/gpu/drm/sti/sti_hdmi.h
@@ -25,6 +25,19 @@ struct hdmi_phy_ops {
void (*stop)(struct sti_hdmi *hdmi);
 };

+/* values for the framing mode property */
+enum sti_hdmi_modes {
+   HDMI_MODE_HDMI,
+   HDMI_MODE_DVI,
+};
+
+static const struct drm_prop_enum_list hdmi_mode_names[] = {
+   { HDMI_MODE_HDMI, "hdmi" },
+   { HDMI_MODE_DVI, "dvi" },
+};
+
+#define DEFAULT_HDMI_MODE HDMI_MODE_HDMI
+
 static const struct drm_prop_enum_list colorspace_mode_names[] = {
{ HDMI_COLORSPACE_RGB, "rgb" },
{ HDMI_COLORSPACE_YUV422, "yuv422" },
@@ -55,6 +68,7 @@ static const struct drm_prop_enum_list 
colorspace_mode_names[] = {
  * @reset: reset control of the hdmi phy
  * @ddc_adapt: i2c ddc adapter
  * @colorspace: current colorspace selected
+ * @hdmi_mode: select framing for HDMI or DVI
  */
 struct sti_hdmi {
struct device dev;
@@ -76,6 +90,7 @@ struct sti_hdmi {
struct reset_control *reset;
struct i2c_adapter *ddc_adapt;
enum hdmi_colorspace colorspace;
+   enum sti_hdmi_modes hdmi_mode;
 };

 u32 hdmi_read(struct sti_hdmi *hdmi, int offset);
-- 
1.9.1



[PATCH 10/11] drm/sti: add colorspace property to the HDMI connector

2016-02-12 Thread Vincent Abriou
Make the value of the colorspace of the HDMI infoframe configurable.
HDMI colorspace could be: RGB, YUV422 or YUV444

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hdmi.c | 68 +-
 drivers/gpu/drm/sti/sti_hdmi.h | 12 
 2 files changed, 79 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 34e33a1..1f37dc4 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -128,6 +128,7 @@ struct sti_hdmi_connector {
struct drm_connector drm_connector;
struct drm_encoder *encoder;
struct sti_hdmi *hdmi;
+   struct drm_property *colorspace_property;
 };

 #define to_sti_hdmi_connector(x) \
@@ -408,7 +409,7 @@ static int hdmi_avi_infoframe_config(struct sti_hdmi *hdmi)
}

/* fixed infoframe configuration not linked to the mode */
-   infoframe.colorspace = HDMI_COLORSPACE_RGB;
+   infoframe.colorspace = hdmi->colorspace;
infoframe.quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
infoframe.colorimetry = HDMI_COLORIMETRY_NONE;

@@ -771,12 +772,74 @@ static void sti_hdmi_connector_destroy(struct 
drm_connector *connector)
kfree(hdmi_connector);
 }

+static void sti_hdmi_connector_init_property(struct drm_device *drm_dev,
+struct drm_connector *connector)
+{
+   struct sti_hdmi_connector *hdmi_connector
+   = to_sti_hdmi_connector(connector);
+   struct sti_hdmi *hdmi = hdmi_connector->hdmi;
+   struct drm_property *prop;
+
+   /* colorspace property */
+   hdmi->colorspace = DEFAULT_COLORSPACE_MODE;
+   prop = drm_property_create_enum(drm_dev, 0, "colorspace",
+   colorspace_mode_names,
+   ARRAY_SIZE(colorspace_mode_names));
+   if (!prop) {
+   DRM_ERROR("fails to create colorspace property\n");
+   return;
+   }
+   hdmi_connector->colorspace_property = prop;
+   drm_object_attach_property(>base, prop, hdmi->colorspace);
+}
+
+static int
+sti_hdmi_connector_set_property(struct drm_connector *connector,
+   struct drm_connector_state *state,
+   struct drm_property *property,
+   uint64_t val)
+{
+   struct sti_hdmi_connector *hdmi_connector
+   = to_sti_hdmi_connector(connector);
+   struct sti_hdmi *hdmi = hdmi_connector->hdmi;
+
+   if (property == hdmi_connector->colorspace_property) {
+   hdmi->colorspace = val;
+   return 0;
+   }
+
+   DRM_ERROR("failed to set hdmi connector property\n");
+   return -EINVAL;
+}
+
+static int
+sti_hdmi_connector_get_property(struct drm_connector *connector,
+   const struct drm_connector_state *state,
+   struct drm_property *property,
+   uint64_t *val)
+{
+   struct sti_hdmi_connector *hdmi_connector
+   = to_sti_hdmi_connector(connector);
+   struct sti_hdmi *hdmi = hdmi_connector->hdmi;
+
+   if (property == hdmi_connector->colorspace_property) {
+   *val = hdmi->colorspace;
+   return 0;
+   }
+
+   DRM_ERROR("failed to get hdmi connector property\n");
+   return -EINVAL;
+}
+
 static const struct drm_connector_funcs sti_hdmi_connector_funcs = {
.dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = sti_hdmi_connector_detect,
.destroy = sti_hdmi_connector_destroy,
.reset = drm_atomic_helper_connector_reset,
+   .set_property = drm_atomic_helper_connector_set_property,
+   .atomic_set_property = sti_hdmi_connector_set_property,
+   .atomic_get_property = sti_hdmi_connector_get_property,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
@@ -836,6 +899,9 @@ static int sti_hdmi_bind(struct device *dev, struct device 
*master, void *data)
drm_connector_helper_add(drm_connector,
_hdmi_connector_helper_funcs);

+   /* initialise property */
+   sti_hdmi_connector_init_property(drm_dev, drm_connector);
+
err = drm_connector_register(drm_connector);
if (err)
goto err_connector;
diff --git a/drivers/gpu/drm/sti/sti_hdmi.h b/drivers/gpu/drm/sti/sti_hdmi.h
index 3d22390..f621cd7 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.h
+++ b/drivers/gpu/drm/sti/sti_hdmi.h
@@ -7,6 +7,7 @@
 #ifndef _STI_HDMI_H_
 #define _STI_HDMI_H_

+#include 
 #include 

 #include 
@@ -24,6 +25,14 @@ struct hdmi_phy_ops {
void (*stop)(struct sti_hdmi *hdmi);
 };

+static const struct drm_prop_enum_list colorspace_mode_names[] = {
+

[PATCH 09/11] drm/sti: add HDMI vendor specific infoframe

2016-02-12 Thread Vincent Abriou
Vendor specific infoframe is mandatory for 4K2K resolution.
Without this, the HDMI protocol compliance fails.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hdmi.c | 82 +-
 1 file changed, 73 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index ff04ed2..34e33a1 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -51,9 +51,18 @@
 #define HDMI_SW_DI_2_PKT_WORD4  0x0614
 #define HDMI_SW_DI_2_PKT_WORD5  0x0618
 #define HDMI_SW_DI_2_PKT_WORD6  0x061C
+#define HDMI_SW_DI_3_HEAD_WORD  0x0620
+#define HDMI_SW_DI_3_PKT_WORD0  0x0624
+#define HDMI_SW_DI_3_PKT_WORD1  0x0628
+#define HDMI_SW_DI_3_PKT_WORD2  0x062C
+#define HDMI_SW_DI_3_PKT_WORD3  0x0630
+#define HDMI_SW_DI_3_PKT_WORD4  0x0634
+#define HDMI_SW_DI_3_PKT_WORD5  0x0638
+#define HDMI_SW_DI_3_PKT_WORD6  0x063C

 #define HDMI_IFRAME_SLOT_AVI1
 #define HDMI_IFRAME_SLOT_AUDIO  2
+#define HDMI_IFRAME_SLOT_VENDOR 3

 #define  XCAT(prefix, x, suffix)prefix ## x ## suffix
 #define  HDMI_SW_DI_N_HEAD_WORD(x)  XCAT(HDMI_SW_DI_, x, _HEAD_WORD)
@@ -264,6 +273,10 @@ static void hdmi_infoframe_reset(struct sti_hdmi *hdmi,
head_offset = HDMI_SW_DI_N_HEAD_WORD(HDMI_IFRAME_SLOT_AUDIO);
pack_offset = HDMI_SW_DI_N_PKT_WORD0(HDMI_IFRAME_SLOT_AUDIO);
break;
+   case HDMI_IFRAME_SLOT_VENDOR:
+   head_offset = HDMI_SW_DI_N_HEAD_WORD(HDMI_IFRAME_SLOT_VENDOR);
+   pack_offset = HDMI_SW_DI_N_PKT_WORD0(HDMI_IFRAME_SLOT_VENDOR);
+   break;
default:
DRM_ERROR("unsupported infoframe slot: %#x\n", slot);
return;
@@ -305,12 +318,13 @@ static inline unsigned int hdmi_infoframe_subpack(const 
u8 *ptr, size_t size)
  * @data: infoframe to write
  * @size: size to write
  */
-static void hdmi_infoframe_write_infopack(struct sti_hdmi *hdmi, const u8 
*data)
+static void hdmi_infoframe_write_infopack(struct sti_hdmi *hdmi,
+ const u8 *data,
+ size_t size)
 {
const u8 *ptr = data;
u32 val, slot, mode, i;
u32 head_offset, pack_offset;
-   size_t size;

switch (*ptr) {
case HDMI_INFOFRAME_TYPE_AVI:
@@ -318,17 +332,19 @@ static void hdmi_infoframe_write_infopack(struct sti_hdmi 
*hdmi, const u8 *data)
mode = HDMI_IFRAME_FIELD;
head_offset = HDMI_SW_DI_N_HEAD_WORD(HDMI_IFRAME_SLOT_AVI);
pack_offset = HDMI_SW_DI_N_PKT_WORD0(HDMI_IFRAME_SLOT_AVI);
-   size = HDMI_AVI_INFOFRAME_SIZE;
break;
-
case HDMI_INFOFRAME_TYPE_AUDIO:
slot = HDMI_IFRAME_SLOT_AUDIO;
mode = HDMI_IFRAME_FRAME;
head_offset = HDMI_SW_DI_N_HEAD_WORD(HDMI_IFRAME_SLOT_AUDIO);
pack_offset = HDMI_SW_DI_N_PKT_WORD0(HDMI_IFRAME_SLOT_AUDIO);
-   size = HDMI_AUDIO_INFOFRAME_SIZE;
break;
-
+   case HDMI_INFOFRAME_TYPE_VENDOR:
+   slot = HDMI_IFRAME_SLOT_VENDOR;
+   mode = HDMI_IFRAME_FRAME;
+   head_offset = HDMI_SW_DI_N_HEAD_WORD(HDMI_IFRAME_SLOT_VENDOR);
+   pack_offset = HDMI_SW_DI_N_PKT_WORD0(HDMI_IFRAME_SLOT_VENDOR);
+   break;
default:
DRM_ERROR("unsupported infoframe type: %#x\n", *ptr);
return;
@@ -347,8 +363,9 @@ static void hdmi_infoframe_write_infopack(struct sti_hdmi 
*hdmi, const u8 *data)
/*
 * Each subpack contains 4 bytes
 * The First Bytes of the first subpacket must contain the checksum
-* Packet size in increase by one.
+* Packet size is increase by one.
 */
+   size = size - HDMI_INFOFRAME_HEADER_SIZE + 1;
for (i = 0; i < size; i += sizeof(u32)) {
size_t num;

@@ -401,7 +418,7 @@ static int hdmi_avi_infoframe_config(struct sti_hdmi *hdmi)
return ret;
}

-   hdmi_infoframe_write_infopack(hdmi, buffer);
+   hdmi_infoframe_write_infopack(hdmi, buffer, ret);

return 0;
 }
@@ -437,7 +454,49 @@ static int hdmi_audio_infoframe_config(struct sti_hdmi 
*hdmi)
return ret;
}

-   hdmi_infoframe_write_infopack(hdmi, buffer);
+   hdmi_infoframe_write_infopack(hdmi, buffer, ret);
+
+   return 0;
+}
+
+/*
+ * Prepare and configure the VS infoframe
+ *
+ * Vendor Specific infoframe are transmitted once per frame and
+ * contains vendor specific information.
+ *
+ * @hdmi: pointer on the hdmi internal structure
+ *
+ * Return negative value if error occurs
+ */
+#define HDMI_VENDOR_INFOFRAME_MAX_SIZE 6
+static int hdmi_vendor_infoframe_config(struct sti_hdmi *hdmi)
+{
+   struct drm_display_mode 

[PATCH 08/11] drm/sti: reset infoframe transmission when HDMI is stopped

2016-02-12 Thread Vincent Abriou
Clear all infoframe registers when the HDMI link is stopped.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hdmi.c | 43 ++
 1 file changed, 43 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 8537852..ff04ed2 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -65,6 +65,8 @@
 #define  HDMI_SW_DI_N_PKT_WORD5(x)  XCAT(HDMI_SW_DI_, x, _PKT_WORD5)
 #define  HDMI_SW_DI_N_PKT_WORD6(x)  XCAT(HDMI_SW_DI_, x, _PKT_WORD6)

+#define HDMI_SW_DI_MAX_WORD 7
+
 #define HDMI_IFRAME_DISABLED0x0
 #define HDMI_IFRAME_SINGLE_SHOT 0x1
 #define HDMI_IFRAME_FIELD   0x2
@@ -241,6 +243,43 @@ static void hdmi_config(struct sti_hdmi *hdmi)
hdmi_write(hdmi, conf, HDMI_CFG);
 }

+/*
+ * Helper to reset info frame
+ *
+ * @hdmi: pointer on the hdmi internal structure
+ * @slot: infoframe to reset
+ */
+static void hdmi_infoframe_reset(struct sti_hdmi *hdmi,
+u32 slot)
+{
+   u32 val, i;
+   u32 head_offset, pack_offset;
+
+   switch (slot) {
+   case HDMI_IFRAME_SLOT_AVI:
+   head_offset = HDMI_SW_DI_N_HEAD_WORD(HDMI_IFRAME_SLOT_AVI);
+   pack_offset = HDMI_SW_DI_N_PKT_WORD0(HDMI_IFRAME_SLOT_AVI);
+   break;
+   case HDMI_IFRAME_SLOT_AUDIO:
+   head_offset = HDMI_SW_DI_N_HEAD_WORD(HDMI_IFRAME_SLOT_AUDIO);
+   pack_offset = HDMI_SW_DI_N_PKT_WORD0(HDMI_IFRAME_SLOT_AUDIO);
+   break;
+   default:
+   DRM_ERROR("unsupported infoframe slot: %#x\n", slot);
+   return;
+   }
+
+   /* Disable transmission for the selected slot */
+   val = hdmi_read(hdmi, HDMI_SW_DI_CFG);
+   val &= ~HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, slot);
+   hdmi_write(hdmi, val, HDMI_SW_DI_CFG);
+
+   /* Reset info frame registers */
+   hdmi_write(hdmi, 0x0, head_offset);
+   for (i = 0; i < HDMI_SW_DI_MAX_WORD; i += sizeof(u32))
+   hdmi_write(hdmi, 0x0, pack_offset + i);
+}
+
 /**
  * Helper to concatenate infoframe in 32 bits word
  *
@@ -468,6 +507,10 @@ static void sti_hdmi_disable(struct drm_bridge *bridge)
/* Stop the phy */
hdmi->phy_ops->stop(hdmi);

+   /* Reset info frame transmission */
+   hdmi_infoframe_reset(hdmi, HDMI_IFRAME_SLOT_AVI);
+   hdmi_infoframe_reset(hdmi, HDMI_IFRAME_SLOT_AUDIO);
+
/* Set the default channel data to be a dark red */
hdmi_write(hdmi, 0x, HDMI_DFLT_CHL0_DAT);
hdmi_write(hdmi, 0x, HDMI_DFLT_CHL1_DAT);
-- 
1.9.1



[PATCH 07/11] drm/sti: HDMI infoframe transmission mode not take into account

2016-02-12 Thread Vincent Abriou
Set the infoframe transmission mode according to the type of
the infoframe.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hdmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index cd50156..8537852 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -321,7 +321,7 @@ static void hdmi_infoframe_write_infopack(struct sti_hdmi 
*hdmi, const u8 *data)

/* Enable transmission slot for updated infoframe */
val = hdmi_read(hdmi, HDMI_SW_DI_CFG);
-   val |= HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_FIELD, slot);
+   val |= HDMI_IFRAME_CFG_DI_N(mode, slot);
hdmi_write(hdmi, val, HDMI_SW_DI_CFG);
 }

-- 
1.9.1



[PATCH 06/11] drm/sti: reset HD DACS when HDA connector is created

2016-02-12 Thread Vincent Abriou
Make sure the HD DACS are disabled when the HDA connector
is created.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hda.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index 49cce83..293a133 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -685,6 +685,9 @@ static int sti_hda_bind(struct device *dev, struct device 
*master, void *data)
goto err_sysfs;
}

+   /* force to disable hd dacs at startup */
+   hda_enable_hd_dacs(hda, false);
+
return 0;

 err_sysfs:
-- 
1.9.1



[PATCH 05/11] drm/sti: fix dvo data_enable signal

2016-02-12 Thread Vincent Abriou
From: Bich Hemon 

Modify AWG algorithm in order to handle more than 1023 lines

Signed-off-by: Bich Hemon 
---
 drivers/gpu/drm/sti/sti_awg_utils.c | 51 +
 1 file changed, 35 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_awg_utils.c 
b/drivers/gpu/drm/sti/sti_awg_utils.c
index 2378b93..a516eb8 100644
--- a/drivers/gpu/drm/sti/sti_awg_utils.c
+++ b/drivers/gpu/drm/sti/sti_awg_utils.c
@@ -7,6 +7,7 @@
 #include "sti_awg_utils.h"

 #define AWG_OPCODE_OFFSET 10
+#define AWG_MAX_ARG   0x3ff

 enum opcode {
SET,
@@ -67,7 +68,7 @@ static int awg_generate_instr(enum opcode opcode,

mux = 0;
data_enable = 0;
-   arg &= (0x3ff);
+   arg &= AWG_MAX_ARG;
break;
case REPEAT:
case REPLAY:
@@ -78,13 +79,13 @@ static int awg_generate_instr(enum opcode opcode,

mux = 0;
data_enable = 0;
-   arg &= (0x3ff);
+   arg &= AWG_MAX_ARG;
break;
case JUMP:
mux = 0;
data_enable = 0;
arg |= 0x40; /* for jump instruction 7th bit is 1 */
-   arg &= 0x3ff;
+   arg &= AWG_MAX_ARG;
break;
case STOP:
arg = 0;
@@ -112,22 +113,13 @@ static int awg_generate_instr(enum opcode opcode,
return 0;
 }

-int sti_awg_generate_code_data_enable_mode(
+static int awg_generate_line_signal(
struct awg_code_generation_params *fwparams,
struct awg_timing *timing)
 {
long int val;
int ret = 0;

-   if (timing->trailing_lines > 0) {
-   /* skip trailing lines */
-   val = timing->blanking_level;
-   ret |= awg_generate_instr(RPLSET, val, 0, 0, fwparams);
-
-   val = timing->trailing_lines - 1;
-   ret |= awg_generate_instr(REPLAY, val, 0, 0, fwparams);
-   }
-
if (timing->trailing_pixels > 0) {
/* skip trailing pixel */
val = timing->blanking_level;
@@ -152,9 +144,36 @@ int sti_awg_generate_code_data_enable_mode(
ret |= awg_generate_instr(SET, val, 0, 0, fwparams);
}

-   /* replay the sequence as many active lines defined */
-   val = timing->active_lines - 1;
-   ret |= awg_generate_instr(REPLAY, val, 0, 0, fwparams);
+   return ret;
+}
+
+int sti_awg_generate_code_data_enable_mode(
+   struct awg_code_generation_params *fwparams,
+   struct awg_timing *timing)
+{
+   long int val, tmp_val;
+   int ret = 0;
+
+   if (timing->trailing_lines > 0) {
+   /* skip trailing lines */
+   val = timing->blanking_level;
+   ret |= awg_generate_instr(RPLSET, val, 0, 0, fwparams);
+
+   val = timing->trailing_lines - 1;
+   ret |= awg_generate_instr(REPLAY, val, 0, 0, fwparams);
+   }
+
+   tmp_val = timing->active_lines - 1;
+
+   while (tmp_val > 0) {
+   /* generate DE signal for each line */
+   ret |= awg_generate_line_signal(fwparams, timing);
+   /* replay the sequence as many active lines defined */
+   ret |= awg_generate_instr(REPLAY,
+ min_t(int, AWG_MAX_ARG, tmp_val),
+ 0, 0, fwparams);
+   tmp_val -= AWG_MAX_ARG;
+   }

if (timing->blanking_lines > 0) {
/* skip blanking lines */
-- 
1.9.1



[PATCH 04/11] drm/sti: adjust delay for DVO

2016-02-12 Thread Vincent Abriou
From: Bich Hemon 

Modify delay to display last pixel column on DVO

Signed-off-by: Bich Hemon 
---
 drivers/gpu/drm/sti/sti_vtg.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c
index 313d703..32c7986 100644
--- a/drivers/gpu/drm/sti/sti_vtg.c
+++ b/drivers/gpu/drm/sti/sti_vtg.c
@@ -64,6 +64,9 @@
 /* Delay introduced by the HDMI in nb of pixel */
 #define HDMI_DELAY  (5)

+/* Delay introduced by the DVO in nb of pixel */
+#define DVO_DELAY   (2)
+
 /* delay introduced by the Arbitrary Waveform Generator in nb of pixels */
 #define AWG_DELAY_HD(-9)
 #define AWG_DELAY_ED(-8)
@@ -278,7 +281,7 @@ static void vtg_set_mode(struct sti_vtg *vtg,
vtg_set_hsync_vsync_pos([VTG_SYNC_ID_HDF - 1], AWG_DELAY_HD, mode);

/* Set hsync and vsync position for DVO */
-   vtg_set_hsync_vsync_pos([VTG_SYNC_ID_DVO - 1], 0, mode);
+   vtg_set_hsync_vsync_pos([VTG_SYNC_ID_DVO - 1], DVO_DELAY, mode);

/* Progam the syncs outputs */
for (i = 0; i < VTG_MAX_SYNC_OUTPUT ; i++) {
-- 
1.9.1



[PATCH 03/11] drm/sti: add missing encoder cleanup for DVO connector

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_tvout.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index 784a3e2..0b171fd 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -663,6 +663,10 @@ static void sti_tvout_destroy_encoders(struct sti_tvout 
*tvout)
if (tvout->hda)
drm_encoder_cleanup(tvout->hda);
tvout->hda = NULL;
+
+   if (tvout->dvo)
+   drm_encoder_cleanup(tvout->dvo);
+   tvout->dvo = NULL;
 }

 static int sti_tvout_bind(struct device *dev, struct device *master, void 
*data)
-- 
1.9.1



[PATCH 02/11] drm/sti: fix panel detection for DVO connector

2016-02-12 Thread Vincent Abriou
The DVO connector is tag as disconnect because of a wrong management
of the panel detection.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_dvo.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index 45cbe2b..9e90b74 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -345,12 +345,14 @@ sti_dvo_connector_detect(struct drm_connector *connector, 
bool force)

DRM_DEBUG_DRIVER("\n");

-   if (!dvo->panel)
+   if (!dvo->panel) {
dvo->panel = of_drm_find_panel(dvo->panel_node);
+   if (dvo->panel)
+   drm_panel_attach(dvo->panel, connector);
+   }

if (dvo->panel)
-   if (!drm_panel_attach(dvo->panel, connector))
-   return connector_status_connected;
+   return connector_status_connected;

return connector_status_disconnected;
 }
-- 
1.9.1



[PATCH 01/11] drm/sti: do not clip RGB/YUV component value at connector side

2016-02-12 Thread Vincent Abriou
Disable the clipping mode for hdmi, dvo and hda connectors.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_tvout.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index 1c27a2c..784a3e2 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -326,9 +326,8 @@ static void tvout_dvo_start(struct sti_tvout *tvout, bool 
main_path)
  TVO_VIP_REORDER_Y_G_SEL,
  TVO_VIP_REORDER_CB_B_SEL);

-   /* Set clipping mode (Limited range RGB/Y) */
-   tvout_vip_set_clip_mode(tvout, TVO_VIP_DVO,
-   TVO_VIP_CLIP_LIMITED_RANGE_RGB_Y);
+   /* Set clipping mode */
+   tvout_vip_set_clip_mode(tvout, TVO_VIP_DVO, TVO_VIP_CLIP_DISABLED);

/* Set round mode (rounded to 8-bit per component) */
tvout_vip_set_rnd(tvout, TVO_VIP_DVO, TVO_VIP_RND_8BIT_ROUNDED);
@@ -383,9 +382,8 @@ static void tvout_hdmi_start(struct sti_tvout *tvout, bool 
main_path)
  TVO_VIP_REORDER_Y_G_SEL,
  TVO_VIP_REORDER_CB_B_SEL);

-   /* set clipping mode (Limited range RGB/Y) */
-   tvout_vip_set_clip_mode(tvout, TVO_VIP_HDMI,
-   TVO_VIP_CLIP_LIMITED_RANGE_RGB_Y);
+   /* set clipping mode */
+   tvout_vip_set_clip_mode(tvout, TVO_VIP_HDMI, TVO_VIP_CLIP_DISABLED);

/* set round mode (rounded to 8-bit per component) */
tvout_vip_set_rnd(tvout, TVO_VIP_HDMI, TVO_VIP_RND_8BIT_ROUNDED);
@@ -442,8 +440,8 @@ static void tvout_hda_start(struct sti_tvout *tvout, bool 
main_path)
  TVO_VIP_REORDER_Y_G_SEL,
  TVO_VIP_REORDER_CB_B_SEL);

-   /* set clipping mode (EAV/SAV clipping) */
-   tvout_vip_set_clip_mode(tvout, TVO_VIP_HDF, TVO_VIP_CLIP_EAV_SAV);
+   /* set clipping mode */
+   tvout_vip_set_clip_mode(tvout, TVO_VIP_HDF, TVO_VIP_CLIP_DISABLED);

/* set round mode (rounded to 10-bit per component) */
tvout_vip_set_rnd(tvout, TVO_VIP_HDF, TVO_VIP_RND_10BIT_ROUNDED);
-- 
1.9.1



  1   2   >