[PATCH libdrm 4/4] tests: Use drmFreeVersion() instead of drmFree()

2014-04-08 Thread Thierry Reding
From: Thierry Reding 

drmFreeVersion() frees the memory allocated for the name, date and desc
fields in addition to that for the struct _drmVersion.

Signed-off-by: Thierry Reding 
---
 tests/getversion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/getversion.c b/tests/getversion.c
index 53d1d354ea16..bcec46999140 100644
--- a/tests/getversion.c
+++ b/tests/getversion.c
@@ -43,7 +43,7 @@ int main(int argc, char **argv)
assert(strlen(v->desc) != 0);
if (strcmp(v->name, "i915") == 0)
assert(v->version_major >= 1);
-   drmFree(v);
+   drmFreeVersion(v);
close(fd);
return 0;
 }
-- 
1.9.1



[PATCH libdrm 3/4] libdrm: Remove extraneous parameter

2014-04-08 Thread Thierry Reding
From: Thierry Reding 

The debug message's format string doesn't contain any conversion
specifiers, therefore making the fd argument unused.

Signed-off-by: Thierry Reding 
---
 xf86drm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xf86drm.c b/xf86drm.c
index fa5701abae51..e94f2cd00c11 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -503,7 +503,7 @@ static int drmOpenByBusid(const char *busid)
sv.drm_di_minor = 1;
sv.drm_dd_major = -1;   /* Don't care */
sv.drm_dd_minor = -1;   /* Don't care */
-   drmMsg("drmOpenByBusid: Interface 1.4 failed, trying 1.1\n",fd);
+   drmMsg("drmOpenByBusid: Interface 1.4 failed, trying 1.1\n");
drmSetInterfaceVersion(fd, );
}
buf = drmGetBusid(fd);
-- 
1.9.1



[PATCH libdrm 2/4] intel: Fix some format strings

2014-04-08 Thread Thierry Reding
From: Thierry Reding 

Some of the format strings for debug messages use the wrong modifier to
print sizes.

Signed-off-by: Thierry Reding 
---
 intel/intel_bufmgr_fake.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/intel/intel_bufmgr_fake.c b/intel/intel_bufmgr_fake.c
index d9b5cfdc8952..d63fc815cf9c 100644
--- a/intel/intel_bufmgr_fake.c
+++ b/intel/intel_bufmgr_fake.c
@@ -505,7 +505,7 @@ alloc_backing_store(drm_intel_bo *bo)

bo_fake->backing_store = malloc(bo->size);

-   DBG("alloc_backing - buf %d %p %d\n", bo_fake->id,
+   DBG("alloc_backing - buf %d %p %lu\n", bo_fake->id,
bo_fake->backing_store, bo->size);
assert(bo_fake->backing_store);
 }
@@ -716,7 +716,7 @@ evict_and_alloc_block(drm_intel_bo *bo)
if (alloc_block(bo))
return 1;

-   DBG("%s 0x%x bytes failed\n", __FUNCTION__, bo->size);
+   DBG("%s 0x%lx bytes failed\n", __FUNCTION__, bo->size);

return 0;
 }
@@ -835,7 +835,7 @@ drm_intel_fake_bo_alloc(drm_intel_bufmgr *bufmgr,
bo_fake->flags = 0;
bo_fake->is_static = 0;

-   DBG("drm_bo_alloc: (buf %d: %s, %d kb)\n", bo_fake->id, bo_fake->name,
+   DBG("drm_bo_alloc: (buf %d: %s, %lu kb)\n", bo_fake->id, bo_fake->name,
bo_fake->bo.size / 1024);

return _fake->bo;
@@ -894,7 +894,7 @@ drm_intel_bo_fake_alloc_static(drm_intel_bufmgr *bufmgr,
bo_fake->flags = BM_PINNED;
bo_fake->is_static = 1;

-   DBG("drm_bo_alloc_static: (buf %d: %s, %d kb)\n", bo_fake->id,
+   DBG("drm_bo_alloc_static: (buf %d: %s, %lu kb)\n", bo_fake->id,
bo_fake->name, bo_fake->bo.size / 1024);

return _fake->bo;
@@ -1022,7 +1022,7 @@ static int
return 0;

{
-   DBG("drm_bo_map: (buf %d: %s, %d kb)\n", bo_fake->id,
+   DBG("drm_bo_map: (buf %d: %s, %lu kb)\n", bo_fake->id,
bo_fake->name, bo_fake->bo.size / 1024);

if (bo->virtual != NULL) {
@@ -1100,7 +1100,7 @@ static int
if (--bo_fake->map_count != 0)
return 0;

-   DBG("drm_bo_unmap: (buf %d: %s, %d kb)\n", bo_fake->id, bo_fake->name,
+   DBG("drm_bo_unmap: (buf %d: %s, %lu kb)\n", bo_fake->id, bo_fake->name,
bo_fake->bo.size / 1024);

bo->virtual = NULL;
@@ -1167,7 +1167,7 @@ static int

bufmgr_fake = (drm_intel_bufmgr_fake *) bo->bufmgr;

-   DBG("drm_bo_validate: (buf %d: %s, %d kb)\n", bo_fake->id,
+   DBG("drm_bo_validate: (buf %d: %s, %lu kb)\n", bo_fake->id,
bo_fake->name, bo_fake->bo.size / 1024);

/* Sanity check: Buffers should be unmapped before being validated.
@@ -1197,7 +1197,7 @@ static int

/* Upload the buffer contents if necessary */
if (bo_fake->dirty) {
-   DBG("Upload dirty buf %d:%s, sz %d offset 0x%x\n", bo_fake->id,
+   DBG("Upload dirty buf %d:%s, sz %lu offset 0x%x\n", bo_fake->id,
bo_fake->name, bo->size, bo_fake->block->mem->ofs);

assert(!(bo_fake->flags & (BM_NO_BACKING_STORE | BM_PINNED)));
@@ -1522,12 +1522,12 @@ drm_intel_fake_check_aperture_space(drm_intel_bo ** 
bo_array, int count)
}

if (sz > bufmgr_fake->size) {
-   DBG("check_space: overflowed bufmgr size, %dkb vs %dkb\n",
+   DBG("check_space: overflowed bufmgr size, %ukb vs %lukb\n",
sz / 1024, bufmgr_fake->size / 1024);
return -1;
}

-   DBG("drm_check_space: sz %dkb vs bufgr %dkb\n", sz / 1024,
+   DBG("drm_check_space: sz %ukb vs bufgr %lukb\n", sz / 1024,
bufmgr_fake->size / 1024);
return 0;
 }
-- 
1.9.1



[PATCH libdrm 1/4] Mark functions printf-like where possible

2014-04-08 Thread Thierry Reding
From: Thierry Reding 

These functions all take a format string and either a list of variable
arguments or a va_list. Use the new DRM_PRINTFLIKE macro to tell the
compiler about it so that the arguments can be checked against the
format string.

Signed-off-by: Thierry Reding 
---
 intel/intel_decode.c |  7 ++-
 tests/drmstat.c  |  2 +-
 xf86drm.c| 10 +++---
 xf86drm.h|  2 +-
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/intel/intel_decode.c b/intel/intel_decode.c
index c0a0cafc904e..61239dd96d27 100644
--- a/intel/intel_decode.c
+++ b/intel/intel_decode.c
@@ -29,6 +29,7 @@
 #include 
 #include 

+#include "xf86drm.h"
 #include "intel_chipset.h"
 #include "intel_bufmgr.h"

@@ -104,11 +105,7 @@ static float int_as_float(uint32_t intval)
return uval.f;
 }

-static void
-instr_out(struct drm_intel_decode *ctx, unsigned int index,
- const char *fmt, ...) __attribute__((format(__printf__, 3, 4)));
-
-static void
+static void DRM_PRINTFLIKE(3, 4)
 instr_out(struct drm_intel_decode *ctx, unsigned int index,
  const char *fmt, ...)
 {
diff --git a/tests/drmstat.c b/tests/drmstat.c
index 345b8d2cda31..c51cbc6c9f61 100644
--- a/tests/drmstat.c
+++ b/tests/drmstat.c
@@ -425,7 +425,7 @@ int main(int argc, char **argv)
 return r; 
 }

-void
+void DRM_PRINTFLIKE(4, 0)
 xf86VDrvMsgVerb(int scrnIndex, int type, int verb, const char *format,
 va_list args)
 {
diff --git a/xf86drm.c b/xf86drm.c
index 720952ff2cbd..fa5701abae51 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -104,12 +104,16 @@ void drmSetServerInfo(drmServerInfoPtr info)
  * This function is a wrapper around vfprintf().
  */

-static int drmDebugPrint(const char *format, va_list ap)
+static int DRM_PRINTFLIKE(1, 0)
+drmDebugPrint(const char *format, va_list ap)
 {
 return vfprintf(stderr, format, ap);
 }

-static int (*drm_debug_print)(const char *format, va_list ap) = drmDebugPrint;
+typedef int DRM_PRINTFLIKE(1, 0) (*debug_msg_func_t)(const char *format,
+va_list ap);
+
+static debug_msg_func_t drm_debug_print = drmDebugPrint;

 void
 drmMsg(const char *format, ...)
@@ -129,7 +133,7 @@ drmMsg(const char *format, ...)
 }

 void
-drmSetDebugMsgFunction(int (*debug_msg_ptr)(const char *format, va_list ap))
+drmSetDebugMsgFunction(debug_msg_func_t debug_msg_ptr)
 {
 drm_debug_print = debug_msg_ptr;
 }
diff --git a/xf86drm.h b/xf86drm.h
index 5e170f86fe5e..c024cc446354 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -704,7 +704,7 @@ extern int  drmSLLookupNeighbors(void *l, unsigned long key,

 extern int drmOpenOnce(void *unused, const char *BusID, int *newlyopened);
 extern void drmCloseOnce(int fd);
-extern void drmMsg(const char *format, ...);
+extern void drmMsg(const char *format, ...) DRM_PRINTFLIKE(1, 2);

 extern int drmSetMaster(int fd);
 extern int drmDropMaster(int fd);
-- 
1.9.1



[PATCH libdrm 0/4] Minor cleanups

2014-04-08 Thread Thierry Reding
From: Thierry Reding 

These four patches clean up some minor issues in libdrm. Patch 1 makes
gcc aware of various functions (such as drmMsg(), drm_debug_print(),
etc) being printf-like and patches 2 and 3 fix up a number of warnings
flagged as a result of that.

Patch 4 uses drmFreeVersion() instead of drmFree() to free a drmVersion
structure to prevent memory leaks.

Thierry

Thierry Reding (4):
  Mark functions printf-like where possible
  intel: Fix some format strings
  libdrm: Remove extraneous parameter
  tests: Use drmFreeVersion() instead of drmFree()

 intel/intel_bufmgr_fake.c | 20 ++--
 intel/intel_decode.c  |  7 ++-
 tests/drmstat.c   |  2 +-
 tests/getversion.c|  2 +-
 xf86drm.c | 12 
 xf86drm.h |  2 +-
 6 files changed, 23 insertions(+), 22 deletions(-)

-- 
1.9.1



[PATCH] drm/tegra: dp: Support address-only I2C-over-AUX transactions

2014-04-08 Thread Thierry Reding
On Tue, Apr 8, 2014 at 4:06 PM, Christian K?nig  
wrote:
> Am 07.04.2014 10:37, schrieb Thierry Reding:
>
>> From: Thierry Reding 
>>
>> Certain types of I2C-over-AUX transactions require that only the address
>> is transferred. Detect this by looking at the AUX message's size and set
>> the address-only bit appropriately.
>>
>> Signed-off-by: Thierry Reding 
>> ---
>> Hi Alex,
>>
>> This patch is required to make eDP work properly on Tegra with your I2C-
>> over-AUX patch series applied. Would you consider carrying this in your
>> series so that bisectability can be maintained? It would need to be
>> applied prior to the core change (patch 2/4 in the latest series) to do
>> so.
>
>
> Hi Thierry,
>
> do you already have this patch in drm-next or should I send it do Dave
> together with the pull request for the dp aux helper changes?

The patch is not in drm-next. To preserve bisectability it should be part of
Alex' patch set and it needs to be applied before the patch that makes use
of the bare address transactions (patch 2/4 in the series).

Thierry


[Bug 77204] make fails due to wrong file names in man

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=77204

--- Comment #1 from Tamas Haraszti  ---
Sorry, I forgot the tested build was the stable libdrm.2.4.52

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


[Bug 77204] New: make fails due to wrong file names in man

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=77204

  Priority: medium
Bug ID: 77204
  Assignee: dri-devel at lists.freedesktop.org
   Summary: make fails due to wrong file names in man
  Severity: normal
Classification: Unclassified
OS: All
  Reporter: tamas.haraszti at uni-heidelberg.de
  Hardware: Other
Status: NEW
   Version: XOrg CVS
 Component: libdrm
   Product: DRI

make fails with:
/bin/sed: can't read drm-mm.7: No such file or directory

looking into the man folder I can find:

Makefile drm-kms.7 drm-memory.xml  drmAvailable.3drmHandleEvent.xml
  drm\-gem.7
Makefile.am  drm-kms.xml   drm.7   drmAvailable.xml 
drmModeGetResources.3drm\-mm.7
Makefile.in  drm-memory.7  drm.xml drmHandleEvent.3 
drmModeGetResources.xml  drm\-ttm.7

Thus all MANPAGE_ALIASES contain an extra \.
Renaming the files allows the make to proceed.

System: gentoo linux, newest automake, cmake, bash...

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


[Bug 77002] hdmi audio problems with 3.14

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=77002

--- Comment #27 from bgunteriv at gmail.com ---
(In reply to comment #26)
> (In reply to comment #25)
> 
> > Note that Takashi was talking about the commit in comment #16, note the one
> > you reverted previously. Can you verify you reverted the correct patch?
> > 
> > If my patch fixed your issue, it would be unexpected that reverting would
> > not work as well.
> 
> ah! i see. okay i will try that and let you know.

yes. reverting this commit --
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7546abfb8e1f9933b549f05898377e9444ee4cb2

did work as well.
thanks everyone.

let me know if you need me to test anything else going forward.

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


[PATCH v12][ 12/12] ARM: imx_v6_v7_defconfig: Add more drm drivers.

2014-04-08 Thread Shawn Guo
On Mon, Apr 07, 2014 at 02:44:51PM +0200, Denis Carikli wrote:
> The DRM_PANEL_SIMPLE is needed by the eukrea
> mbimxsd51's displays.
> 
> Signed-off-by: Denis Carikli 

Applied, thanks.



[PATCH v12][ 06/12] ARM: dts: imx5*, imx6*: correct display-timings nodes.

2014-04-08 Thread Shawn Guo
On Mon, Apr 07, 2014 at 02:44:45PM +0200, Denis Carikli wrote:
> The imx-drm driver can't use the de-active and
> pixelclk-active display-timings properties yet.
> 
> Instead the data-enable and the pixel data clock
> polarity are hardcoded in the imx-drm driver.
> 
> So theses properties are now set to keep
> the same behaviour when imx-drm will start
> using them.
> 
> Signed-off-by: Denis Carikli 
> ---
> ChangeLog v9->v10:
> - New patch that was splitted out of:
>   "staging imx-drm: Use de-active and pixelclk-active
>   display-timings."
> ---
>  arch/arm/boot/dts/imx51-babbage.dts   |2 ++
>  arch/arm/boot/dts/imx53-m53evk.dts|2 ++
>  arch/arm/boot/dts/imx53-tx53-x03x.dts |2 +-
>  arch/arm/boot/dts/imx6qdl-gw53xx.dtsi |2 ++
>  arch/arm/boot/dts/imx6qdl-gw54xx.dtsi |2 ++
>  arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi |2 ++
>  arch/arm/boot/dts/imx6qdl-sabreauto.dtsi  |2 ++
>  arch/arm/boot/dts/imx6qdl-sabrelite.dtsi  |2 ++
>  arch/arm/boot/dts/imx6qdl-sabresd.dtsi|2 ++
>  9 files changed, 17 insertions(+), 1 deletion(-)

...

> diff --git a/arch/arm/boot/dts/imx53-tx53-x03x.dts 
> b/arch/arm/boot/dts/imx53-tx53-x03x.dts
> index 0217dde3..4092a81 100644
> --- a/arch/arm/boot/dts/imx53-tx53-x03x.dts
> +++ b/arch/arm/boot/dts/imx53-tx53-x03x.dts
> @@ -93,7 +93,7 @@
>   hsync-active = <0>;
>   vsync-active = <0>;
>   de-active = <1>;
> - pixelclk-active = <1>;
> + pixelclk-active = <0>;

@Lothar, is this change correct?

Shawn

>   };
>  
>   ET0500 {



[Bug 71461] monitor doesn't get detected after boot or disconnection

2014-04-08 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=71461

--- Comment #21 from Alex Deucher  ---
(In reply to Tom Yan from comment #20)
> I did some more tests. Seems to me that the blank occured with
> dis/reconnection in X is also related to DPMS toggling. Any similar code in
> ddx driver I can try removing? Since in console everything is fine so far :P

With KMS, the kernel controls all modesetting.  All the ddx does is call down
into the kernel.  There's no difference between the kernel and the ddx, it's
all calling the same code.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Bug 71461] monitor doesn't get detected after boot or disconnection

2014-04-08 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=71461

--- Comment #20 from Tom Yan  ---
I did some more tests. Seems to me that the blank occured with dis/reconnection
in X is also related to DPMS toggling. Any similar code in ddx driver I can try
removing? Since in console everything is fine so far :P

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Bug 77002] hdmi audio problems with 3.14

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=77002

--- Comment #26 from bgunteriv at gmail.com ---
(In reply to comment #25)

> Note that Takashi was talking about the commit in comment #16, note the one
> you reverted previously. Can you verify you reverted the correct patch?
> 
> If my patch fixed your issue, it would be unexpected that reverting would
> not work as well.

ah! i see. okay i will try that and let you know.

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


[PATCH 4/4] Revert "drm/exynos: add mout_hdmi clock in hdmi driver to change parent"

2014-04-08 Thread Tomasz Figa
Hi Tomasz,

On 04.04.2014 16:53, Tomasz Stanislawski wrote:
> This reverts commit 59956d35a8618235ea715280b49447bb36f2c975.
>

Probably a reason why this commit is being reverted would be a good idea.

> Signed-off-by: Tomasz Stanislawski 
> ---
>   drivers/gpu/drm/exynos/exynos_hdmi.c |   14 --
>   1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
> b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 9a6d652..8ebb4bf 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -75,7 +75,6 @@ struct hdmi_resources {
>   struct clk  *sclk_pixel;
>   struct clk  *sclk_hdmiphy;
>   struct clk  *hdmiphy;
> - struct clk  *mout_hdmi;
>   struct regulator_bulk_data  *regul_bulk;
>   int regul_count;
>   };
> @@ -1282,7 +1281,7 @@ static void hdmi_v13_mode_apply(struct hdmi_context 
> *hdata)
>   }
>
>   clk_disable_unprepare(hdata->res.sclk_hdmi);
> - clk_set_parent(hdata->res.mout_hdmi, hdata->res.sclk_hdmiphy);
> + clk_set_parent(hdata->res.sclk_hdmi, hdata->res.sclk_hdmiphy);
>   clk_prepare_enable(hdata->res.sclk_hdmi);
>
>   /* enable HDMI and timing generator */
> @@ -1449,7 +1448,7 @@ static void hdmi_v14_mode_apply(struct hdmi_context 
> *hdata)
>   }
>
>   clk_disable_unprepare(hdata->res.sclk_hdmi);
> - clk_set_parent(hdata->res.mout_hdmi, hdata->res.sclk_hdmiphy);
> + clk_set_parent(hdata->res.sclk_hdmi, hdata->res.sclk_hdmiphy);
>   clk_prepare_enable(hdata->res.sclk_hdmi);
>
>   /* enable HDMI and timing generator */
> @@ -1475,7 +1474,7 @@ static void hdmiphy_conf_reset(struct hdmi_context 
> *hdata)
>   u32 reg;
>
>   clk_disable_unprepare(hdata->res.sclk_hdmi);
> - clk_set_parent(hdata->res.mout_hdmi, hdata->res.sclk_pixel);
> + clk_set_parent(hdata->res.sclk_hdmi, hdata->res.sclk_pixel);
>   clk_prepare_enable(hdata->res.sclk_hdmi);
>
>   /* operation mode */
> @@ -1982,13 +1981,8 @@ static int hdmi_resources_init(struct hdmi_context 
> *hdata)
>   DRM_ERROR("failed to get clock 'hdmiphy'\n");
>   goto fail;
>   }
> - res->mout_hdmi = devm_clk_get(dev, "mout_hdmi");
> - if (IS_ERR(res->mout_hdmi)) {
> - DRM_ERROR("failed to get clock 'mout_hdmi'\n");
> - goto fail;
> - }
>
> - clk_set_parent(res->mout_hdmi, res->sclk_pixel);
> + clk_set_parent(res->sclk_hdmi, res->sclk_pixel);
>
>   res->regul_bulk = devm_kzalloc(dev, ARRAY_SIZE(supply) *
>   sizeof(res->regul_bulk[0]), GFP_KERNEL);
>

Otherwise looks fine and will apply after all its dependencies are 
agreed upon.

Best regards,
Tomasz


[PATCH 3/4] clk: exynos4: enable clk_set_parent() propagation for sclk_hdmi and sclk_mixer clocks

2014-04-08 Thread Tomasz Figa
On 04.04.2014 16:53, Tomasz Stanislawski wrote:
> This patch enables clk_set_parent() propagation for clocks used
> by s5p-tv and exynos-drm drivers.
>
> Signed-off-by: Tomasz Stanislawski 
> ---
>   drivers/clk/samsung/clk-exynos4.c |6 --
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/samsung/clk-exynos4.c 
> b/drivers/clk/samsung/clk-exynos4.c
> index 528f8eb..87b8264 100644
> --- a/drivers/clk/samsung/clk-exynos4.c
> +++ b/drivers/clk/samsung/clk-exynos4.c
> @@ -680,7 +680,8 @@ static struct samsung_gate_clock exynos4_gate_clks[] 
> __initdata = {
>* the device name and clock alias names specified below for some
>* of the clocks can be removed.
>*/
> - GATE(CLK_SCLK_HDMI, "sclk_hdmi", "mout_hdmi", SRC_MASK_TV, 0, 0, 0),
> + GATE(CLK_SCLK_HDMI, "sclk_hdmi", "mout_hdmi", SRC_MASK_TV, 0,
> + CLK_SET_PARENT_PARENT, 0),
>   GATE(CLK_SCLK_SPDIF, "sclk_spdif", "mout_spdif", SRC_MASK_PERIL1, 8, 0,
>   0),
>   GATE(CLK_JPEG, "jpeg", "aclk160", GATE_IP_CAM, 6, 0, 0),
> @@ -880,7 +881,8 @@ static struct samsung_gate_clock exynos4210_gate_clks[] 
> __initdata = {
>   E4210_SRC_MASK_LCD1, 12, CLK_SET_RATE_PARENT, 0),
>   GATE(CLK_SCLK_SATA, "sclk_sata", "div_sata",
>   SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0),
> - GATE(CLK_SCLK_MIXER, "sclk_mixer", "mout_mixer", SRC_MASK_TV, 4, 0, 0),
> + GATE(CLK_SCLK_MIXER, "sclk_mixer", "mout_mixer", SRC_MASK_TV, 4,
> + CLK_SET_PARENT_PARENT, 0),
>   GATE(CLK_SCLK_DAC, "sclk_dac", "mout_dac", SRC_MASK_TV, 8, 0, 0),
>   GATE(CLK_TSADC, "tsadc", "aclk100", GATE_IP_PERIL, 15,
>   0, 0),
>

Looks fine, but since it depends on patch 1/4, which needs to be 
discussed a bit, I'll hold on with applying it for now.

Best regards,
Tomasz


[PATCH 2/4] clk: exynos4: export sclk_hdmiphy clock

2014-04-08 Thread Tomasz Figa
Hi Tomasz,

On 04.04.2014 16:53, Tomasz Stanislawski wrote:
> Export sclk_hdmiphy clock to be usable from DT.
>
> Signed-off-by: Tomasz Stanislawski 
> ---
>   drivers/clk/samsung/clk-exynos4.c   |2 +-
>   include/dt-bindings/clock/exynos4.h |1 +
>   2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/samsung/clk-exynos4.c 
> b/drivers/clk/samsung/clk-exynos4.c
> index b4f9672..528f8eb 100644
> --- a/drivers/clk/samsung/clk-exynos4.c
> +++ b/drivers/clk/samsung/clk-exynos4.c
> @@ -428,7 +428,7 @@ static struct samsung_fixed_rate_clock 
> exynos4_fixed_rate_ext_clks[] __initdata
>   /* fixed rate clocks generated inside the soc */
>   static struct samsung_fixed_rate_clock exynos4_fixed_rate_clks[] __initdata 
> = {
>   FRATE(0, "sclk_hdmi24m", NULL, CLK_IS_ROOT, 2400),
> - FRATE(0, "sclk_hdmiphy", NULL, CLK_IS_ROOT, 2700),
> + FRATE(CLK_SCLK_HDMIPHY, "sclk_hdmiphy", NULL, CLK_IS_ROOT, 2700),
>   FRATE(0, "sclk_usbphy0", NULL, CLK_IS_ROOT, 4800),
>   };
>
> diff --git a/include/dt-bindings/clock/exynos4.h 
> b/include/dt-bindings/clock/exynos4.h
> index 75aff33..0e245eb 100644
> --- a/include/dt-bindings/clock/exynos4.h
> +++ b/include/dt-bindings/clock/exynos4.h
> @@ -33,6 +33,7 @@
>   #define CLK_MOUT_MPLL_USER_C18 /* Exynos4x12 only */
>   #define CLK_MOUT_CORE   19
>   #define CLK_MOUT_APLL   20
> +#define CLK_SCLK_HDMIPHY 22
>
>   /* gate for special clocks (sclk) */
>   #define CLK_SCLK_FIMC0  128
>

I believe this clock should be properly abstracted as an output of HDMI 
PHY, but I don't see any way to do this with existing infrastructure, so 
probably for now such workaround is fine.

Will apply, if nobody opposes.

Best regards,
Tomasz


[PATCH 1/4] clk: propagate parent change up one level

2014-04-08 Thread Tomasz Figa
Hi,

On 04.04.2014 16:53, Tomasz Stanislawski wrote:
> This patch adds support for propagation of setup of clock's parent one level
> up.
>
> This feature is helpful when a driver changes topology of its clocks using
> clk_set_parent().  The problem occurs when on one platform/SoC driver's clock
> is located at MUX output but on the other platform/SoC there is a gated proxy
> clock between the MUX and driver's clock.  In such a case, driver's code has 
> to
> be modified to use one clock for enabling and the other clock for setup of a
> parent.
>
> The code updates are avoided by propagating setup of a parent up one level.
>
> Additionally, this patch adds CLK_SET_PARENT_PARENT (sorry for naming) flag to
> inform clk-core that clk_set_parent() should be propagated.
>
> Signed-off-by: Tomasz Stanislawski 
> ---
>   drivers/clk/clk.c|6 ++
>   include/linux/clk-provider.h |1 +
>   2 files changed, 7 insertions(+)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index dff0373..53bbfda 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -1737,6 +1737,12 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
>
>   /* try finding the new parent index */
>   if (parent) {
> + if ((clk->flags & CLK_SET_PARENT_PARENT)
> + && clk->num_parents == 1) {
> + ret = clk_set_parent(clk->parent, parent);
> + goto out;
> + }
> +
>   p_index = clk_fetch_parent_index(clk, parent);
>   p_rate = parent->rate;
>   if (p_index < 0) {
> diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
> index 5119174..daa0b03 100644
> --- a/include/linux/clk-provider.h
> +++ b/include/linux/clk-provider.h
> @@ -30,6 +30,7 @@
>   #define CLK_GET_RATE_NOCACHEBIT(6) /* do not use the cached clk 
> rate */
>   #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */
>   #define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk 
> accuracy */
> +#define CLK_SET_PARENT_PARENTBIT(9) /* propagate parent change up 
> one level */
>
>   struct clk_hw;
>   struct dentry;
>

This would be very useful, at least on Exynos platforms, with 
mux-div-gate clock paths. PARENT_PARENT sounds a bit funny, though.

Reviewed-by: Tomasz Figa 

Best regards,
Tomasz


[Bug 77002] hdmi audio problems with 3.14

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=77002

--- Comment #25 from Anssi Hannula  ---
(In reply to comment #24)
> (In reply to comment #23)
> > I'd rather revert the commit in this case.  Changing the assignment order
> > has a significant risk of breakage with other weird controllers.
> > 
> > Could you confirm that just reverting the commit fixes the problem?  Once
> > after it's confirmed, I'll submit a fix revert patch for 3.14.x.  Thanks.
> 
> The patch worked... reverting did not.
> although, again, i'm not positive i've done it correctly.
> 
> if you read my post above, it explains my steps. 
> if i did it correctly, then no, reverting does not solve the problem.

Note that Takashi was talking about the commit in comment #16, note the one you
reverted previously. Can you verify you reverted the correct patch?

If my patch fixed your issue, it would be unexpected that reverting would not
work as well.

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


[PATCH v2 1/7] drm/exynos: add super device support

2014-04-08 Thread Inki Dae
2014-04-08 0:40 GMT+09:00, Tomasz Figa :
> On 07.04.2014 17:16, Inki Dae wrote:
>> Hi Andrzej,
>>
>> 2014-04-07 23:18 GMT+09:00 Andrzej Hajda :
>>> Hi Inki and Tomasz,
>>>
>>> On 04/06/2014 05:15 AM, Inki Dae wrote:
>>>
>>> (...)
 The code creating the list of components to wait for
 (exynos_drm_add_components()) doesn't seem to consider which sub-drivers
 are
 actually enabled in kernel config.

 Are you sure?

 exynos_drm_add_components() will try to attach components *added to
 component_lists. And these components will be added by only
 corresponding sub drivers to the component_lists and
 master->components.

 So in this case, if users disabled HDMI support then a commponent
 object for HDMI sub driver doesn't exists in the component_lists and
 master->components. This means that a component object for HDMI sub
 driver *cannot be attached to master object*.

 As a result, component_bind_add() will ignor component_bind call for
 HDMI sub driver so HDMI driver will not be bounded. The only
 components added by sub drivers will be bound, component->ops->bind().

 For more understanding, it seems like you need to look into below
 codes,

 static int exynos_drm_add_components(...)
 {
  ...
  for (i == 0;; i++) {
  ...
  node = of_parse_phandle(np, "ports", i);
  ...
  ret = component_master_add_child(m, compare_of, node);
  ...
  }
 }
>>>
>>> Hmm, In case HDMI driver is not present, HDMI device is not probed and
>>> HDMI component is not added, so component_master_add_child returns
>>> an error when it tries to add hdmi component and master is never brought
>>> up, am I correct?
>>>
>>
>> Ok, after that,
>>
>> ret = component_master_add(,..)
>> if (ret < 0)
>>   DRM_DEBUG_KMS("re-tried by last sub driver probed later.\n");
>>
>> As you can see above, if component_master_add() is failed, return 0,
>> *not error*. And then component_add() called by other kms drivers,
>> late probing of hdmi or fimd probing - if there is any kms driver
>> enabled - will try to bring up master again by calling
>> try_to_bring_up_master() from beginning.
>>
>> And if component_list is empty then it means that there is no any kms
>> driver enabled.
>>
>> Do you still think in that case, exynos drm initialization will be
>> failed?
>
> There will be no HDMI driver to call component_add(), because HDMI sub
> driver will be disabled in kernel config and any previous
> component_master_add_child() for the phandle pointing to HDMI node will
> wail, because such component will never be registered.
>
> The complete failure path is as follows:
>
> exynos_drm_platform_probe()
>   component_master_add()
>   try_to_bring_up_master()
>   exynos_drm_add_components()
>   // phandle to HDMI node
>   component_master_add_child()
>   = -ENXIO
>   = -ENXIO
>   = 0 // but no call to master->ops->bind(master->dev);
>   = 0
> = 0 // but Exynos DRM platform is not registered yet
>
> Now if any other late-probed sub-driver comes, the sequence will be as
> follows (let's take FIMD as an example):
>
> fimd_probe()
>   component_add()
>   try_to_bring_up_masters()
>   try_to_bring_up_master()
>   exynos_drm_add_components()
>   // phandle to HDMI node
>   component_master_add_child()
>   = -ENXIO
>   = -ENXIO
>   = 0 // but no call to   
>   // master->ops->bind(master->dev);
>   = 0
>   = 0
> = 0 // but Exynos DRM platform still not registered
>
> And the same for any late-probed driver, unless HDMI drivers loads, but
> there is no HDMI driver, because it is disabled in kernel config and not
> compiled in.
>

Ah, right. I missed that it gets phandle to hdmi, and compares the
phandle to one in component_list.
Yes, in this case, exynos drm driver will be failed because
component_list never has a component object for hdmi.
So this shouldn't return as long as there is any component - in
component_list - that can be attached to master.

Hm.. the foot of the candle is dark.

For this, I fixed and tested it like below,
for (i = 0;; i++) {
node = of_parse_phandle(np, "ports", i);
...
ret = component_master_add_child(...);
...
if (!ret)
attached_cnt++;
}

if (!attached_cnt)
return -ENXIO;
...

And one more thing, it seems that we could  resolve dt broken issue
easily by getting phandle to existing device node directly.

Thanks,
Inki Dae

> 

[Bug 71461] monitor doesn't get detected after boot or disconnection

2014-04-08 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=71461

--- Comment #19 from Tom Yan  ---
(In reply to Alex Deucher from comment #18)
> It's required to re-establish the DP link if you physically disconnect and
> reconnect an active display since DP requires link training while other
> digital links do not, otherwise you'd end up with a blank display after
> disconnecting and reconnecting a DP display.  It sounds like may have a
> problem with the hpd interrupts on your board.

Unfortunately it doesn't work as intended but only cause some side effect, at
least for my case. FYR my board is Sapphire HD5850 Toxic, and my monitor is
EIZO EV2336W.

> How are you turning it off in X vs console?  Are you physically powering the
> monitor off or triggering dpms (e.g., xset dpms force off)?

All "turning it off" mean physically powering it off. I even tried unplugging
the power today.

> Are you physically powering off the TV or do you mean dpms?
In the case that I found out the problem, I was nuking a disk in console, so I
physically powered off the TV after I ran the command. When I turn on my TV
again after a long time, I can't get back the display.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[PATCHv2 3/3] s5p-tv: hdmi: use hdmiphy as PHY

2014-04-08 Thread Tomasz Stanislawski
The HDMIPHY (physical interface) is controlled by a single
bit in a power controller's regiter. It was implemented
as clock. It was a simple but effective hack.

This patch makes S5P-HDMI driver to control HDMIPHY via PHY interface.

Signed-off-by: Tomasz Stanislawski 
---
 drivers/media/platform/s5p-tv/hdmi_drv.c |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c 
b/drivers/media/platform/s5p-tv/hdmi_drv.c
index 534722c..8013e52 100644
--- a/drivers/media/platform/s5p-tv/hdmi_drv.c
+++ b/drivers/media/platform/s5p-tv/hdmi_drv.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -66,7 +67,7 @@ struct hdmi_resources {
struct clk *sclk_hdmi;
struct clk *sclk_pixel;
struct clk *sclk_hdmiphy;
-   struct clk *hdmiphy;
+   struct phy *hdmiphy;
struct regulator_bulk_data *regul_bulk;
int regul_count;
 };
@@ -586,7 +587,7 @@ static int hdmi_resource_poweron(struct hdmi_resources *res)
if (ret < 0)
return ret;
/* power-on hdmi physical interface */
-   clk_enable(res->hdmiphy);
+   phy_power_on(res->hdmiphy);
/* use VPP as parent clock; HDMIPHY is not working yet */
clk_set_parent(res->sclk_hdmi, res->sclk_pixel);
/* turn clocks on */
@@ -600,7 +601,7 @@ static void hdmi_resource_poweroff(struct hdmi_resources 
*res)
/* turn clocks off */
clk_disable(res->sclk_hdmi);
/* power-off hdmiphy */
-   clk_disable(res->hdmiphy);
+   phy_power_off(res->hdmiphy);
/* turn HDMI power off */
regulator_bulk_disable(res->regul_count, res->regul_bulk);
 }
@@ -784,7 +785,7 @@ static void hdmi_resources_cleanup(struct hdmi_device *hdev)
/* kfree is NULL-safe */
kfree(res->regul_bulk);
if (!IS_ERR(res->hdmiphy))
-   clk_put(res->hdmiphy);
+   phy_put(res->hdmiphy);
if (!IS_ERR(res->sclk_hdmiphy))
clk_put(res->sclk_hdmiphy);
if (!IS_ERR(res->sclk_pixel))
@@ -835,7 +836,7 @@ static int hdmi_resources_init(struct hdmi_device *hdev)
dev_err(dev, "failed to get clock 'sclk_hdmiphy'\n");
goto fail;
}
-   res->hdmiphy = clk_get(dev, "hdmiphy");
+   res->hdmiphy = phy_get(dev, "hdmiphy");
if (IS_ERR(res->hdmiphy)) {
dev_err(dev, "failed to get clock 'hdmiphy'\n");
goto fail;
-- 
1.7.9.5



[PATCHv2 2/3] drm: exynos: hdmi: use hdmiphy as PHY

2014-04-08 Thread Tomasz Stanislawski
The HDMIPHY (physical interface) is controlled by a single
bit in a power controller's regiter. It was implemented
as clock. It was a simple but effective hack.

This patch makes HDMI driver to control HDMIPHY via PHY interface.

Signed-off-by: Tomasz Stanislawski 
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 9a6d652..ef1cdd0 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 

@@ -74,8 +75,8 @@ struct hdmi_resources {
struct clk  *sclk_hdmi;
struct clk  *sclk_pixel;
struct clk  *sclk_hdmiphy;
-   struct clk  *hdmiphy;
struct clk  *mout_hdmi;
+   struct phy  *hdmiphy;
struct regulator_bulk_data  *regul_bulk;
int regul_count;
 };
@@ -1854,7 +1855,7 @@ static void hdmi_poweron(struct exynos_drm_display 
*display)
if (regulator_bulk_enable(res->regul_count, res->regul_bulk))
DRM_DEBUG_KMS("failed to enable regulator bulk\n");

-   clk_prepare_enable(res->hdmiphy);
+   phy_power_on(res->hdmiphy);
clk_prepare_enable(res->hdmi);
clk_prepare_enable(res->sclk_hdmi);

@@ -1881,7 +1882,7 @@ static void hdmi_poweroff(struct exynos_drm_display 
*display)

clk_disable_unprepare(res->sclk_hdmi);
clk_disable_unprepare(res->hdmi);
-   clk_disable_unprepare(res->hdmiphy);
+   phy_power_off(res->hdmiphy);
regulator_bulk_disable(res->regul_count, res->regul_bulk);

pm_runtime_put_sync(hdata->dev);
@@ -1977,9 +1978,9 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
DRM_ERROR("failed to get clock 'sclk_hdmiphy'\n");
goto fail;
}
-   res->hdmiphy = devm_clk_get(dev, "hdmiphy");
+   res->hdmiphy = devm_phy_get(dev, "hdmiphy");
if (IS_ERR(res->hdmiphy)) {
-   DRM_ERROR("failed to get clock 'hdmiphy'\n");
+   DRM_ERROR("failed to get phy 'hdmiphy'\n");
goto fail;
}
res->mout_hdmi = devm_clk_get(dev, "mout_hdmi");
-- 
1.7.9.5



[PATCHv2 1/3] phy: Add exynos-simple-phy driver

2014-04-08 Thread Tomasz Stanislawski
Add exynos-simple-phy driver to support a single register
PHY interfaces present on Exynos4 SoC.

Signed-off-by: Tomasz Stanislawski 
---
 .../devicetree/bindings/phy/samsung-phy.txt|   24 +++
 drivers/phy/Kconfig|5 +
 drivers/phy/Makefile   |1 +
 drivers/phy/exynos-simple-phy.c|  154 
 4 files changed, 184 insertions(+)
 create mode 100644 drivers/phy/exynos-simple-phy.c

diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt 
b/Documentation/devicetree/bindings/phy/samsung-phy.txt
index b422e38..f97c4c3 100644
--- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
+++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
@@ -114,3 +114,27 @@ Example:
compatible = "samsung,exynos-sataphy-i2c";
reg = <0x38>;
};
+
+Samsung S5P/EXYNOS SoC series SIMPLE PHY
+-
+
+Required properties:
+- compatible : should be one of the listed compatibles:
+   - "samsung,exynos4210-simple-phy"
+   - "samsung,exynos4412-simple-phy"
+- reg : offset and length of the register set;
+- #phy-cells : from the generic phy bindings, must be 1;
+
+For "samsung,exynos4210-simple-phy" compatible PHYs the second cell in
+the PHY specifier identifies the PHY and its meaning is as follows:
+  0 - HDMI PHY,
+  1 - DAC PHY,
+  2 - ADC PHY,
+  3 - PCIE PHY.
+  4 - SATA PHY.
+
+For "samsung,exynos4412-simple-phy" compatible PHYs the second cell in
+the PHY specifier identifies the PHY and its meaning is as follows:
+  0 - HDMI PHY,
+  1 - ADC PHY,
+
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 3bb05f1..65ab783 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -166,4 +166,9 @@ config PHY_XGENE
help
  This option enables support for APM X-Gene SoC multi-purpose PHY.

+config EXYNOS_SIMPLE_PHY
+   tristate "Exynos Simple PHY driver"
+   help
+ Support for 1-bit PHY controllers on SoCs from Exynos family.
+
 endmenu
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 2faf78e..88c5b60 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -18,3 +18,4 @@ obj-$(CONFIG_PHY_EXYNOS4210_USB2) += phy-exynos4210-usb2.o
 obj-$(CONFIG_PHY_EXYNOS4X12_USB2)  += phy-exynos4x12-usb2.o
 obj-$(CONFIG_PHY_EXYNOS5250_USB2)  += phy-exynos5250-usb2.o
 obj-$(CONFIG_PHY_XGENE)+= phy-xgene.o
+obj-$(CONFIG_EXYNOS_SIMPLE_PHY)+= exynos-simple-phy.o
diff --git a/drivers/phy/exynos-simple-phy.c b/drivers/phy/exynos-simple-phy.c
new file mode 100644
index 000..57ad338
--- /dev/null
+++ b/drivers/phy/exynos-simple-phy.c
@@ -0,0 +1,154 @@
+/*
+ * Exynos Simple PHY driver
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Author: Tomasz Stanislawski 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define EXYNOS_PHY_ENABLE  (1 << 0)
+
+static int exynos_phy_power_on(struct phy *phy)
+{
+   void __iomem *reg = phy_get_drvdata(phy);
+   u32 val;
+
+   val = readl(reg);
+   val |= EXYNOS_PHY_ENABLE;
+   writel(val, reg);
+
+   return 0;
+}
+
+static int exynos_phy_power_off(struct phy *phy)
+{
+   void __iomem *reg = phy_get_drvdata(phy);
+   u32 val;
+
+   val = readl(reg);
+   val &= ~EXYNOS_PHY_ENABLE;
+   writel(val, reg);
+
+   return 0;
+}
+
+static struct phy_ops exynos_phy_ops = {
+   .power_on   = exynos_phy_power_on,
+   .power_off  = exynos_phy_power_off,
+   .owner  = THIS_MODULE,
+};
+
+static const u32 exynos4210_offsets[] = {
+   0x0700, /* HDMI_PHY */
+   0x070C, /* DAC_PHY */
+   0x0718, /* ADC_PHY */
+   0x071C, /* PCIE_PHY */
+   0x0720, /* SATA_PHY */
+   ~0, /* end mark */
+};
+
+static const u32 exynos4412_offsets[] = {
+   0x0700, /* HDMI_PHY */
+   0x0718, /* ADC_PHY */
+   ~0, /* end mark */
+};
+
+static const struct of_device_id exynos_phy_of_match[] = {
+   { .compatible = "samsung,exynos4210-simple-phy",
+ .data = exynos4210_offsets},
+   { .compatible = "samsung,exynos4412-simple-phy",
+ .data = exynos4412_offsets},
+   { },
+};
+MODULE_DEVICE_TABLE(of, exynos_phy_of_match);
+
+static struct phy *exynos_phy_xlate(struct device *dev,
+   struct of_phandle_args *args)
+{
+   struct phy **phys = dev_get_drvdata(dev);
+   int index = args->args[0];
+   int i;
+
+   /* verify if index is valid */
+   for (i = 0; i <= index; ++i)
+   if (!phys[i])
+   return ERR_PTR(-ENODEV);
+
+   return phys[index];
+}
+
+static int 

[PATCHv2 0/3] phy: Add exynos-simple-phy driver

2014-04-08 Thread Tomasz Stanislawski
Hello everyone,

The Samsung SoCs from Exynos family are enhanced with a bunch of devices that
provide functionality of a physical layer for interfaces like USB, HDMI, SATA,
etc. They are controlled by a simple interface, often a single bit that enables
and/or resets the physical layer.

An IP driver should to control such a controller in an abstract manner.
Therefore, such 'enablers' were implemented as clocks in older versions of
Linux kernel.  With the dawn of PHY subsystems, PHYs become a natural way of
exporting the 'enabler' functionality to drivers.  However, there is an
unexpected consequence. Some of those 1-bit PHYs were implemented as separate
drivers.  This means that one has to create a struct device, struct phy, its
phy provider and 100-150 lines of driver code to basically set one bit.

The DP phy driver is a good example:
https://lkml.org/lkml/2013/7/18/53

And simple-phy RFC (shares only driver code but not other resources):
https://lkml.org/lkml/2013/10/21/313

To avoid waste of resources I propose to create all such 1-bit phys from Exynos
SoC using a single device, driver and phy provider.

This patchset contains a proposed solution.

All comment are welcome.

Hopefully in future the functionality introduced by this patch may be merged
into a larger Power Management Unit (PMU) gluer driver.  On Samsusng SoC , the
PMU part contains a number of register barely linked to power management (like
clock gating, clock dividers, CPU resetting, etc.).  It may be tempting to
create a hybrid driver that export clocks/phys/etc that are controlled by PMU
unit.

Alternative solutions might be:
* exporting a regmap to the IP driver and allow the driver to control the PHY 
layer
  like in the patch:
  http://thread.gmane.org/gmane.linux.kernel.samsung-soc/28617/focus=28648

* create a dedicated power domain for hdmiphy

Regards,
Tomasz Stanislawski

Changelog:
v2:
* rename to exynos-simple-phy
* fix usage of devm_ioremap()
* add documentation for DT bindings
* add patches to client drivers

v1: initial version

Tomasz Stanislawski (3):
  phy: Add exynos-simple-phy driver
  drm: exynos: hdmi: use hdmiphy as PHY
  s5p-tv: hdmi: use hdmiphy as PHY

 .../devicetree/bindings/phy/samsung-phy.txt|   24 +++
 drivers/gpu/drm/exynos/exynos_hdmi.c   |   11 +-
 drivers/media/platform/s5p-tv/hdmi_drv.c   |   11 +-
 drivers/phy/Kconfig|5 +
 drivers/phy/Makefile   |1 +
 drivers/phy/exynos-simple-phy.c|  154 
 6 files changed, 196 insertions(+), 10 deletions(-)
 create mode 100644 drivers/phy/exynos-simple-phy.c

-- 
1.7.9.5



[PATCH v1 00/19] Add DRM for stih4xx platforms

2014-04-08 Thread Benjamin Gaignard
You can found the patches here:

git://git.linaro.org/people/benjamin.gaignard/kernel.git
on branch: drm_kms_for_next

Regards,
Benjamin


2014-04-08 14:27 GMT+02:00 Rob Clark :
> On Tue, Apr 8, 2014 at 8:19 AM, Benjamin Gaignard
>  wrote:
>> This series of patches add the support of DRM/KMS drivers for 
>> STMicroelectronics
>> chipsets stih416 and stih407.
>
> *finally* \o/
>
> one small request.. got a git branch somewhere?  This patchset is big
> enough that it would be convenient for reviewing to be able to
> git-fetch..
>
> BR,
> -R
>
>> Hardware is split in two main blocks: Compositor and TVout. Each of them
>> includes specific hardware IPs and the display timing are controlled by a 
>> specific
>> Video Timing Generator hardware IP (VTG).
>>
>> Compositor is made of the follow hardware IPs:
>>  - GDP (Generic Display Pipeline) which is an entry point for graphic (RGB)
>>buffers
>>  - VDP (Video Diplay Pipeline) which is an entry point for video (YUV) 
>> buffers
>>  - HQVDP (High Quality Video Display Processor) that supports scaling,
>>deinterlacing and some miscellaneous image quality improvements.
>>It fetches the Video decoded buffers from memory, processes them and 
>> pushes
>>them to the Compositor through a HW dedicated bus.
>>  - Mixer is responsible of mixing all the entries depending of their
>>respective z-order and layout
>>
>> TVout is divided in 3 parts:
>>  - HDMI to generate HDMI signals, depending of chipset version HDMI phy can
>>change.
>>  - HDA to generate signals for HD analog TV
>>  - VIP to control/switch data path coming from Compositor
>>
>> On stih416 compositor and Tvout are on different dies so a Video Trafic 
>> Advance
>> inter-die Communication mechanism (VTAC) is needed.
>>
>> +-+   
>> ++
>> | +---+   ++  |   |  ++   
>> +--+ |
>> | |   |   ||  |   |  ||   |  +-+ 
>> ++  | |
>> | | ++  +--+  |   ||  |   |  ||   |  | VIP 
>> |>|HDMI|  | |
>> | | |GPD +->|  |  |   ||  |   |  ||   |  | | 
>> ++  | |
>> | | ++  |Mixer |--|-->||  |   |  ||---|->| switcher| 
>> | |
>> | | |  |  |   ||  |   |  ||   |  | | 
>> ++  | |
>> | | |  |  |   ||  |   |  ||   |  | 
>> |>|HDA |  | |
>> | | +--+  |   |VTAC|>|VTAC|   |  +-+ 
>> ++  | |
>> | |   |   ||  |   |  ||   |  
>> | |
>> | | Compositor|   ||  |   |  ||   |   
>> TVout  | |
>> | +---+   ||  |   |  ||   
>> +--+ |
>> |  ^  ||  |   |  || ^
>>   |
>> |  |  ||  |   |  || |
>>   |
>> |   +--+  ||  |   |  ||  
>> +-+   |
>> |   | VTG (master) |->||  |   |  ||->| VTG 
>> (slave) |   |
>> |   +--+  ++  |   |  ++  
>> +-+   |
>> |Digital die  |   |  
>> Analog Die|
>> +-+   
>> ++
>>
>> On stih407 Compositor and Tvout are on the same die
>>
>> +-+
>> | +---+  +--+ |
>> | |   |  |  +-+ ++  | |
>> | | ++  +--+  |  |  | VIP |>|HDMI|  | |
>> | | |GPD +->|  |  |  |  | | ++  | |
>> | | ++  |Mixer |--|--|->| switcher| | |
>> | | ++   +-+|  |  |  |  | | ++  | |
>> | | |VDP +-->+HQVDP+--->|  |  |  |  | |>|HDA |  | |
>> | | ++   +-++--+  |  |  +-+ ++  | |
>> | |   |  |  | |
>> | | Compositor|  |   TVout  | |
>> | +---+  +--+ |
>> |  ^^ |
>> |  || |
>> |   +--+  |
>> |   | VTG  |  |
>> |   +--+  |
>> |Digital die  

[PATCH] drm/tegra: dp: Support address-only I2C-over-AUX transactions

2014-04-08 Thread Christian König
Am 07.04.2014 10:37, schrieb Thierry Reding:
> From: Thierry Reding 
>
> Certain types of I2C-over-AUX transactions require that only the address
> is transferred. Detect this by looking at the AUX message's size and set
> the address-only bit appropriately.
>
> Signed-off-by: Thierry Reding 
> ---
> Hi Alex,
>
> This patch is required to make eDP work properly on Tegra with your I2C-
> over-AUX patch series applied. Would you consider carrying this in your
> series so that bisectability can be maintained? It would need to be
> applied prior to the core change (patch 2/4 in the latest series) to do
> so.

Hi Thierry,

do you already have this patch in drm-next or should I send it do Dave 
together with the pull request for the dp aux helper changes?

Regards,
Christian.

>
> Thanks,
> Thierry
>
>   drivers/gpu/drm/tegra/dpaux.c | 44 
> ++-
>   drivers/gpu/drm/tegra/dpaux.h |  1 +
>   2 files changed, 32 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c
> index d536ed381fbd..005c19bd92df 100644
> --- a/drivers/gpu/drm/tegra/dpaux.c
> +++ b/drivers/gpu/drm/tegra/dpaux.c
> @@ -99,55 +99,73 @@ static void tegra_dpaux_read_fifo(struct tegra_dpaux 
> *dpaux, u8 *buffer,
>   static ssize_t tegra_dpaux_transfer(struct drm_dp_aux *aux,
>   struct drm_dp_aux_msg *msg)
>   {
> - unsigned long value = DPAUX_DP_AUXCTL_TRANSACTREQ;
>   unsigned long timeout = msecs_to_jiffies(250);
>   struct tegra_dpaux *dpaux = to_dpaux(aux);
>   unsigned long status;
>   ssize_t ret = 0;
> + u32 value;
>   
> - if (msg->size < 1 || msg->size > 16)
> + /* Tegra has 4x4 byte DP AUX transmit and receive FIFOs. */
> + if (msg->size > 16)
>   return -EINVAL;
>   
> - tegra_dpaux_writel(dpaux, msg->address, DPAUX_DP_AUXADDR);
> + /*
> +  * Allow zero-sized messages only for I2C, in which case they specify
> +  * address-only transactions.
> +  */
> + if (msg->size < 1) {
> + switch (msg->request & ~DP_AUX_I2C_MOT) {
> + case DP_AUX_I2C_WRITE:
> + case DP_AUX_I2C_READ:
> + value = DPAUX_DP_AUXCTL_CMD_ADDRESS_ONLY;
> + break;
> +
> + default:
> + return -EINVAL;
> + }
> + } else {
> + /* For non-zero-sized messages, set the CMDLEN field. */
> + value = DPAUX_DP_AUXCTL_CMDLEN(msg->size - 1);
> + }
>   
>   switch (msg->request & ~DP_AUX_I2C_MOT) {
>   case DP_AUX_I2C_WRITE:
>   if (msg->request & DP_AUX_I2C_MOT)
> - value = DPAUX_DP_AUXCTL_CMD_MOT_WR;
> + value |= DPAUX_DP_AUXCTL_CMD_MOT_WR;
>   else
> - value = DPAUX_DP_AUXCTL_CMD_I2C_WR;
> + value |= DPAUX_DP_AUXCTL_CMD_I2C_WR;
>   
>   break;
>   
>   case DP_AUX_I2C_READ:
>   if (msg->request & DP_AUX_I2C_MOT)
> - value = DPAUX_DP_AUXCTL_CMD_MOT_RD;
> + value |= DPAUX_DP_AUXCTL_CMD_MOT_RD;
>   else
> - value = DPAUX_DP_AUXCTL_CMD_I2C_RD;
> + value |= DPAUX_DP_AUXCTL_CMD_I2C_RD;
>   
>   break;
>   
>   case DP_AUX_I2C_STATUS:
>   if (msg->request & DP_AUX_I2C_MOT)
> - value = DPAUX_DP_AUXCTL_CMD_MOT_RQ;
> + value |= DPAUX_DP_AUXCTL_CMD_MOT_RQ;
>   else
> - value = DPAUX_DP_AUXCTL_CMD_I2C_RQ;
> + value |= DPAUX_DP_AUXCTL_CMD_I2C_RQ;
>   
>   break;
>   
>   case DP_AUX_NATIVE_WRITE:
> - value = DPAUX_DP_AUXCTL_CMD_AUX_WR;
> + value |= DPAUX_DP_AUXCTL_CMD_AUX_WR;
>   break;
>   
>   case DP_AUX_NATIVE_READ:
> - value = DPAUX_DP_AUXCTL_CMD_AUX_RD;
> + value |= DPAUX_DP_AUXCTL_CMD_AUX_RD;
>   break;
>   
>   default:
>   return -EINVAL;
>   }
>   
> - value |= DPAUX_DP_AUXCTL_CMDLEN(msg->size - 1);
> + tegra_dpaux_writel(dpaux, msg->address, DPAUX_DP_AUXADDR);
>   tegra_dpaux_writel(dpaux, value, DPAUX_DP_AUXCTL);
>   
>   if ((msg->request & DP_AUX_I2C_READ) == 0) {
> @@ -198,7 +216,7 @@ static ssize_t tegra_dpaux_transfer(struct drm_dp_aux 
> *aux,
>   break;
>   }
>   
> - if (msg->reply == DP_AUX_NATIVE_REPLY_ACK) {
> + if ((msg->size > 0) && (msg->reply == DP_AUX_NATIVE_REPLY_ACK)) {
>   if (msg->request & DP_AUX_I2C_READ) {
>   size_t count = value & DPAUX_DP_AUXSTAT_REPLY_MASK;
>   
> diff --git a/drivers/gpu/drm/tegra/dpaux.h b/drivers/gpu/drm/tegra/dpaux.h
> index 4f5bf10fdff9..806e245ca787 100644
> --- a/drivers/gpu/drm/tegra/dpaux.h
> +++ b/drivers/gpu/drm/tegra/dpaux.h
> @@ -32,6 +32,7 @@
>   #define 

[Bug 65141] Blank screen after resume with radeon driver

2014-04-08 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=65141

Alex Deucher  changed:

   What|Removed |Added

 CC||alexdeucher at gmail.com

--- Comment #6 from Alex Deucher  ---
This is a duplicate of:
https://bugs.freedesktop.org/show_bug.cgi?id=42960

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Intel-gfx] [PATCH] drm/i915: support address only i2c-over-aux transactions

2014-04-08 Thread Christian König
Am 08.04.2014 15:04, schrieb Alex Deucher:
> On Tue, Apr 8, 2014 at 4:03 AM, Daniel Vetter  wrote:
>> On Tue, Apr 8, 2014 at 8:58 AM, Jani Nikula  wrote:
>>> Before the conversion to dp aux helpers there was a switch case [1] that
>>> ended up in msg_bytes = 3 for address only start/stop messages
>>> (MODE_I2C_START or MODE_I2C_STOP bit set [2]). With Alex's series in,
>>> but without my patch, we'd send the four byte header but with 0 - 1 =
>>> 0xff in txbuf[3]. I'm pretty sure breakage would follow.
>>>
>>> Thus I'd like to have my patch in before the dp aux helpers use
>>> msg->size == 0 for address only messages.
>>>
>>> Daniel, convinced yet?
>> Indeed, I've been blinding. Acked for merging through radeon trees
>> together with the other patches as a fixup for 3.15.
> Christian,
>
> Can you pull this into the radeon 3.15 branch as well?

Sure, directly before your other patches I would assume.

Going to send out the pull request to Dave this evening if nobody objects.

Christian.

>
> Thanks,
>
> Alex



[PATCH 0/6] File Sealing & memfd_create()

2014-04-08 Thread Florian Weimer
On 03/19/2014 08:06 PM, David Herrmann wrote:

> Unlike existing techniques that provide similar protection, sealing allows
> file-sharing without any trust-relationship. This is enforced by rejecting 
> seal
> modifications if you don't own an exclusive reference to the given file. So if
> you own a file-descriptor, you can be sure that no-one besides you can modify
> the seals on the given file. This allows mapping shared files from untrusted
> parties without the fear of the file getting truncated or modified by an
> attacker.

How do you keep these promises on network and FUSE file systems?  Surely 
there is still some trust involved for such descriptors?

What happens if you create a loop device on a sealed descriptor?

Why does memfd_create not create a file backed by a memory region in the 
current process?  Wouldn't this be a far more generic primitive? 
Creating aliases of memory regions would be interesting for many things 
(not just libffi bypassing SELinux-enforced NX restrictions :-).

-- 
Florian Weimer / Red Hat Product Security Team


[RFC libdrm 0/6] Add NVIDIA Tegra support

2014-04-08 Thread Erik Faye-Lund
On Thu, Mar 20, 2014 at 4:23 PM, Erik Faye-Lund  wrote:
> On Wed, Feb 19, 2014 at 5:04 PM, Thierry Reding
>  wrote:
>> From: Thierry Reding 
>>
>> Hi,
>>
>> This series adds libdrm-tegra with a very lightweight API on top of the
>> kernel interfaces. Most of the functions provided here have been in use
>> in various driver efforts in different incarnations. This is an attempt
>> to consolidate, so I'm looking for review comments especially by Erik
>> to ensure it can be used by grate.
>
> Is there anything I can do to move this series along?

I'll ask again... Is there something I can do to help move this along?


[PATCH] drm/radeon: fix audio pin counts for DCE6+

2014-04-08 Thread Christian König
Applied to my 3.15 branch as well.

Cheers,
Christian.

Am 07.04.2014 22:17, schrieb Alex Deucher:
> There is actually quite a bit of variance based on
> the asic.
>
> Signed-off-by: Alex Deucher 
> Cc: stable at vger.kernel.org
> ---
>   drivers/gpu/drm/radeon/dce6_afmt.c | 14 ++
>   drivers/gpu/drm/radeon/radeon.h|  5 -
>   2 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c 
> b/drivers/gpu/drm/radeon/dce6_afmt.c
> index 8595449..38766aa 100644
> --- a/drivers/gpu/drm/radeon/dce6_afmt.c
> +++ b/drivers/gpu/drm/radeon/dce6_afmt.c
> @@ -309,11 +309,17 @@ int dce6_audio_init(struct radeon_device *rdev)
>   
>   rdev->audio.enabled = true;
>   
> - if (ASIC_IS_DCE8(rdev))
> - rdev->audio.num_pins = 6;
> - else if (ASIC_IS_DCE61(rdev))
> + if (ASIC_IS_DCE81(rdev)) /* KV: 4 streams, 7 endpoints */
> + rdev->audio.num_pins = 7;
> + else if (ASIC_IS_DCE83(rdev)) /* KB: 2 streams, 3 endpoints */
>   rdev->audio.num_pins = 4;
> - else
> + else if (ASIC_IS_DCE8(rdev)) /* BN/HW: 6 streams, 7 endpoints */
> + rdev->audio.num_pins = 7;
> + else if (ASIC_IS_DCE61(rdev)) /* TN: 4 streams, 6 endpoints */
> + rdev->audio.num_pins = 6;
> + else if (ASIC_IS_DCE64(rdev)) /* OL: 2 streams, 2 endpoints */
> + rdev->audio.num_pins = 2;
> + else /* SI: 6 streams, 6 endpoints */
>   rdev->audio.num_pins = 6;
>   
>   for (i = 0; i < rdev->audio.num_pins; i++) {
> diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
> index 7a07ec8..f0fc2c8 100644
> --- a/drivers/gpu/drm/radeon/radeon.h
> +++ b/drivers/gpu/drm/radeon/radeon.h
> @@ -736,7 +736,7 @@ union radeon_irq_stat_regs {
>   struct cik_irq_stat_regs cik;
>   };
>   
> -#define RADEON_MAX_HPD_PINS 6
> +#define RADEON_MAX_HPD_PINS 7
>   #define RADEON_MAX_CRTCS 6
>   #define RADEON_MAX_AFMT_BLOCKS 7
>   
> @@ -2628,6 +2628,9 @@ void r100_pll_errata_after_index(struct radeon_device 
> *rdev);
>   #define ASIC_IS_DCE64(rdev) ((rdev->family == CHIP_OLAND))
>   #define ASIC_IS_NODCE(rdev) ((rdev->family == CHIP_HAINAN))
>   #define ASIC_IS_DCE8(rdev) ((rdev->family >= CHIP_BONAIRE))
> +#define ASIC_IS_DCE81(rdev) ((rdev->family == CHIP_KAVERI))
> +#define ASIC_IS_DCE82(rdev) ((rdev->family == CHIP_BONAIRE))
> +#define ASIC_IS_DCE83(rdev) ((rdev->family == CHIP_KABINI))
>   
>   #define ASIC_IS_LOMBOK(rdev) ((rdev->ddev->pdev->device == 0x6849) || \
> (rdev->ddev->pdev->device == 0x6850) || \



[PATCH 0/4] Reset i2c connection between xfers (v4)

2014-04-08 Thread Christian König
I've added the patches to my 3.15 queue, but had to fix patch #3 a bit 
to make it apply cleanly.

Thanks,
Christian.

Am 07.04.2014 16:33, schrieb Alex Deucher:
> Updated with Thierry's comments.
>
> Alex Deucher (4):
>drm/radeon/dp: handle zero sized i2c over aux transactions (v2)
>drm/dp/i2c: send bare addresses to properly reset i2c connections (v4)
>drm/dp/i2c: Update comments about common i2c over dp assumptions (v2)
>drm/radeon/dp: switch to the common i2c over aux code
>
>   drivers/gpu/drm/drm_dp_helper.c|  55 +++-
>   drivers/gpu/drm/radeon/atombios_dp.c   | 140 
> -
>   drivers/gpu/drm/radeon/radeon_connectors.c |  44 ++---
>   drivers/gpu/drm/radeon/radeon_display.c|  11 ++-
>   drivers/gpu/drm/radeon/radeon_i2c.c|  60 +++--
>   drivers/gpu/drm/radeon/radeon_mode.h   |  12 +--
>   include/drm/drm_dp_helper.h|   4 +
>   7 files changed, 101 insertions(+), 225 deletions(-)
>



[PATCH libdrm 0/4] Minor cleanups

2014-04-08 Thread Eric Anholt
Thierry Reding  writes:

> From: Thierry Reding 
>
> These four patches clean up some minor issues in libdrm. Patch 1 makes
> gcc aware of various functions (such as drmMsg(), drm_debug_print(),
> etc) being printf-like and patches 2 and 3 fix up a number of warnings
> flagged as a result of that.
>
> Patch 4 uses drmFreeVersion() instead of drmFree() to free a drmVersion
> structure to prevent memory leaks.

These are:

Reviewed-by: Eric Anholt 
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140408/64f1c168/attachment.sig>


[Bug 77009] 24P playback video signal loss with latest DRI patches

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=77009

--- Comment #26 from Peter Fr?hberger  ---
Both your logs are of April 1st, so don't contain the possible fix.

The fix (to keep the divs low) was commited two days ago into OpenELEC git.
Since then no official builds have been made. 

Furthermore the logs are useless without drm.debug=0xe

I think you got your builds from xbmcnightly.com and they did not do full
rebuilds.

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


[PATCH v1 19/19] drm: sti: rename mixer registers to be main/aux independent

2014-04-08 Thread Benjamin Gaignard
From: Vincent Abriou 

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/sti_mixer.c | 70 -
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
index fce72e4..73d5405 100644
--- a/drivers/gpu/drm/sti/sti_mixer.c
+++ b/drivers/gpu/drm/sti/sti_mixer.c
@@ -18,16 +18,16 @@ static const u32 MixerColorSpaceMatIdentity[] = {
 };

 /* regs offset */
-#define GAM_MIXER_MAIN_CTL 0x00
-#define GAM_MIXER_MAIN_BKC 0x04
-#define GAM_MIXER_MAIN_BCO 0x0C
-#define GAM_MIXER_MAIN_BCS 0x10
-#define GAM_MIXER_MAIN_AVO 0x28
-#define GAM_MIXER_MAIN_AVS 0x2C
-#define GAM_MIXER_MAIN_CRB 0x34
-#define GAM_MIXER_MAIN_ACT 0x38
-#define GAM_MIXER_MAIN_MBP 0x3C
-#define GAM_MIXER_MAIN_MX0 0x80
+#define GAM_MIXER_CTL  0x00
+#define GAM_MIXER_BKC  0x04
+#define GAM_MIXER_BCO  0x0C
+#define GAM_MIXER_BCS  0x10
+#define GAM_MIXER_AVO  0x28
+#define GAM_MIXER_AVS  0x2C
+#define GAM_MIXER_CRB  0x34
+#define GAM_MIXER_ACT  0x38
+#define GAM_MIXER_MBP  0x3C
+#define GAM_MIXER_MX0  0x80

 /* id for depth of CRB reg */
 #define GAM_DEPTH_VID0_ID  1
@@ -82,7 +82,7 @@ static inline void sti_mixer_reg_writemask(struct sti_mixer 
*mixer,
 void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable)
 {
sti_mixer_reg_writemask(mixer,
-   GAM_MIXER_MAIN_CTL, enable, GAM_CTL_BACK_MASK);
+   GAM_MIXER_CTL, enable, GAM_CTL_BACK_MASK);
 }

 static void sti_mixer_set_background_color(struct sti_mixer *mixer,
@@ -90,7 +90,7 @@ static void sti_mixer_set_background_color(struct sti_mixer 
*mixer,
 {
u32 val = (red << 16) | (green << 8) | blue;

-   sti_mixer_reg_write(mixer, GAM_MIXER_MAIN_BKC, val);
+   sti_mixer_reg_write(mixer, GAM_MIXER_BKC, val);
 }

 static void sti_mixer_set_background_area(struct sti_mixer *mixer,
@@ -103,8 +103,8 @@ static void sti_mixer_set_background_area(struct sti_mixer 
*mixer,
xdo = sti_vtg_get_pixel_number(*mode, 0);
xds = sti_vtg_get_pixel_number(*mode, mode->hdisplay - 1);

-   sti_mixer_reg_write(mixer, GAM_MIXER_MAIN_BCO, ydo << 16 | xdo);
-   sti_mixer_reg_write(mixer, GAM_MIXER_MAIN_BCS, yds << 16 | xds);
+   sti_mixer_reg_write(mixer, GAM_MIXER_BCO, ydo << 16 | xdo);
+   sti_mixer_reg_write(mixer, GAM_MIXER_BCS, yds << 16 | xds);
 }

 int sti_mixer_set_layer_depth(struct sti_mixer *mixer, struct sti_layer *layer)
@@ -143,12 +143,12 @@ int sti_mixer_set_layer_depth(struct sti_mixer *mixer, 
struct sti_layer *layer)

DRM_DEBUG_DRIVER("%s %s depth=%d\n", sti_mixer_to_str(mixer),
 sti_layer_to_str(layer), depth);
-   dev_dbg(mixer->dev, "GAM_MIXER_MAIN_CRB val 0x%x mask 0x%x\n",
+   dev_dbg(mixer->dev, "GAM_MIXER_CRB val 0x%x mask 0x%x\n",
layer_id, mask);
-   sti_mixer_reg_writemask(mixer, GAM_MIXER_MAIN_CRB, layer_id, mask);
+   sti_mixer_reg_writemask(mixer, GAM_MIXER_CRB, layer_id, mask);

-   dev_dbg(mixer->dev, "Read GAM_MIXER_MAIN_CRB 0x%x\n",
-   sti_mixer_reg_read(mixer, GAM_MIXER_MAIN_CRB));
+   dev_dbg(mixer->dev, "Read GAM_MIXER_CRB 0x%x\n",
+   sti_mixer_reg_read(mixer, GAM_MIXER_CRB));
return 0;
 }

@@ -164,8 +164,8 @@ int sti_mixer_active_video_area(struct sti_mixer *mixer,

DRM_DEBUG_DRIVER("%s active video area xdo:%d ydo:%d xds:%d yds:%d\n",
 sti_mixer_to_str(mixer), xdo, ydo, xds, yds);
-   sti_mixer_reg_write(mixer, GAM_MIXER_MAIN_AVO, ydo << 16 | xdo);
-   sti_mixer_reg_write(mixer, GAM_MIXER_MAIN_AVS, yds << 16 | xds);
+   sti_mixer_reg_write(mixer, GAM_MIXER_AVO, ydo << 16 | xdo);
+   sti_mixer_reg_write(mixer, GAM_MIXER_AVS, yds << 16 | xds);

sti_mixer_set_background_color(mixer, 0xFF, 0, 0);

@@ -210,7 +210,7 @@ int sti_mixer_set_layer_status(struct sti_mixer *mixer,
return -1;
}
val = status ? mask : 0;
-   sti_mixer_reg_writemask(mixer, GAM_MIXER_MAIN_CTL, val, mask);
+   sti_mixer_reg_writemask(mixer, GAM_MIXER_CTL, val, mask);
return 0;
 }

@@ -219,7 +219,7 @@ void sti_mixer_set_matrix(struct sti_mixer *mixer)
int i;

for (i = 0; i < ARRAY_SIZE(MixerColorSpaceMatIdentity); i++)
-   sti_mixer_reg_write(mixer, GAM_MIXER_MAIN_MX0 + (i * 4),
+   sti_mixer_reg_write(mixer, GAM_MIXER_MX0 + (i * 4),
MixerColorSpaceMatIdentity[i]);
 }

@@ -359,23 +359,23 @@ int sti_mixer_dbg_show(struct seq_file *m, void *arg)
struct sti_mixer *mixer = compo->mixer[i];

seq_printf(m, "\n%s", sti_mixer_to_str(mixer));
-   MIXER_DBG_DUMP(GAM_MIXER_MAIN_CTL);
+   MIXER_DBG_DUMP(GAM_MIXER_CTL);

[PATCH v1 18/19] drm: sti: add HQVDP driver

2014-04-08 Thread Benjamin Gaignard
High Quality Video Display Plug is a data path for doing high quality
treatments (filtering, scaling) on video flow.

HQVDP IP is tunneled into compositor via VDP input.

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/Makefile|1 +
 drivers/gpu/drm/sti/sti_drm_drv.c   |   18 +
 drivers/gpu/drm/sti/sti_drm_drv.h   |4 +
 drivers/gpu/drm/sti/sti_hqvdp.c | 1089 +++
 drivers/gpu/drm/sti/sti_hqvdp.h |   55 ++
 drivers/gpu/drm/sti/sti_hqvdp_lut.h |  373 
 drivers/gpu/drm/sti/sti_layer.c |   27 +-
 drivers/gpu/drm/sti/sti_layer.h |3 +
 8 files changed, 1564 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/sti/sti_hqvdp.c
 create mode 100644 drivers/gpu/drm/sti/sti_hqvdp.h
 create mode 100644 drivers/gpu/drm/sti/sti_hqvdp_lut.h

diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
index 17b4a68..83835bd 100644
--- a/drivers/gpu/drm/sti/Makefile
+++ b/drivers/gpu/drm/sti/Makefile
@@ -10,6 +10,7 @@ stidrm-y := sti_drm_drv.o \
sti_layer.o \
sti_gdp.o \
sti_vid.o \
+   sti_hqvdp.o \
sti_tvout.o \
sti_hdmi.o \
sti_hdmi_tx3g0c55phy.o \
diff --git a/drivers/gpu/drm/sti/sti_drm_drv.c 
b/drivers/gpu/drm/sti/sti_drm_drv.c
index 16ac771..9d49db31 100644
--- a/drivers/gpu/drm/sti/sti_drm_drv.c
+++ b/drivers/gpu/drm/sti/sti_drm_drv.c
@@ -21,6 +21,7 @@
 #include "sti_drm_encoder.h"
 #include "sti_drm_connector.h"
 #include "sti_tvout.h"
+#include "sti_hqvdp.h"

 #define DRIVER_NAME"sti"
 #define DRIVER_DESC"STMicroelectronics SoC DRM"
@@ -131,6 +132,7 @@ static struct drm_info_list sti_drm_dbg_list[] = {
{"mixer", sti_mixer_dbg_show, 0},
{"hdmi", sti_tvout_hdmi_dbg_show, 0, NULL},
{"hda", sti_tvout_hda_dbg_show, 0, NULL},
+   {"vdp", sti_hqvdp_dbg_show, 0, NULL},
 };

 static int sti_drm_fps_get(void *data, u64 *val)
@@ -281,6 +283,16 @@ static int sti_drm_load(struct drm_device *dev, unsigned 
long flags)
if (err)
DRM_ERROR("Failed to initialize TVOUT\n");

+   /* Load HQVDP firmware */
+   drv = driver_find("sti-hqvdp", _bus_type);
+   if (!drv) {
+   DRM_ERROR("No HQVDP found\n");
+   return -ENOMEM;
+   }
+   err = driver_for_each_device(drv, NULL, dev, sti_hqvdp_load_init);
+   if (err)
+   DRM_ERROR("Failed to initialize HQVDP\n");
+
drm_helper_disable_unused_functions(dev);
 #ifdef CONFIG_DRM_STI_FBDEV
sti_drm_device = dev;
@@ -410,6 +422,10 @@ static int __init sti_drm_init(void)
if (ret < 0)
goto out_hda;

+   ret = platform_driver_register(_hqvdp_driver);
+   if (ret < 0)
+   goto out_hqvdp;
+
ret = platform_driver_register(_drm_platform_driver);
if (ret < 0)
goto out_drm;
@@ -427,6 +443,8 @@ out_drm_device:
platform_driver_unregister(_drm_platform_driver);
 out_drm:
platform_driver_unregister(_hda_driver);
+out_hqvdp:
+   platform_driver_unregister(_hqvdp_driver);
 out_hda:
platform_driver_unregister(_hdmi_driver);
 out_hdmi:
diff --git a/drivers/gpu/drm/sti/sti_drm_drv.h 
b/drivers/gpu/drm/sti/sti_drm_drv.h
index 2633d84..280577a 100644
--- a/drivers/gpu/drm/sti/sti_drm_drv.h
+++ b/drivers/gpu/drm/sti/sti_drm_drv.h
@@ -13,6 +13,7 @@

 #include "sti_compositor.h"
 #include "sti_tvout.h"
+#include "sti_hqvdp.h"

 extern struct platform_driver sti_compositor_driver;
 extern struct platform_driver sti_vtac_tx_driver;
@@ -21,6 +22,7 @@ extern struct platform_driver sti_vtg_driver;
 extern struct platform_driver sti_tvout_driver;
 extern struct platform_driver sti_hdmi_driver;
 extern struct platform_driver sti_hda_driver;
+extern struct platform_driver sti_hqvdp_driver;

 /*
  * STI drm private structure
@@ -28,12 +30,14 @@ extern struct platform_driver sti_hda_driver;
  *
  * @compo: compositor
  * @tvout: TV OUT
+ * @hqvdp: HQVDP
  * @pageflip_evt_list: list of pending page flip requests
  * @plane_zorder_property: z-order property for CRTC planes
  */
 struct sti_drm_private {
struct sti_compositor *compo;
struct sti_tvout *tvout;
+   struct sti_hqvdp *hqvdp;
struct list_head pageflip_evt_list;
struct drm_property *plane_zorder_property;
 };
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
new file mode 100644
index 000..0777b69
--- /dev/null
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -0,0 +1,1089 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2014
+ * Authors: Fabien Dessenne  for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "sti_hqvdp.h"
+#include "sti_hqvdp_lut.h"

[PATCH v1 17/19] drm: sti: Add DRM driver itself

2014-04-08 Thread Benjamin Gaignard
Make the link between all the hardware drivers and DRM/KMS interface.
Create the driver itself and make it register all the sub-components.
Use GEM CMA helpers for buffer allocation.

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/Kconfig |   8 +
 drivers/gpu/drm/sti/Makefile|  28 +-
 drivers/gpu/drm/sti/sti_compositor.c|   2 +
 drivers/gpu/drm/sti/sti_drm_connector.c | 195 +
 drivers/gpu/drm/sti/sti_drm_connector.h |  16 ++
 drivers/gpu/drm/sti/sti_drm_crtc.c  | 440 ++
 drivers/gpu/drm/sti/sti_drm_crtc.h  |  21 ++
 drivers/gpu/drm/sti/sti_drm_drv.c   | 466 
 drivers/gpu/drm/sti/sti_drm_encoder.c   | 201 ++
 drivers/gpu/drm/sti/sti_drm_encoder.h   |  16 ++
 drivers/gpu/drm/sti/sti_drm_plane.c | 195 +
 drivers/gpu/drm/sti/sti_drm_plane.h |  16 ++
 drivers/gpu/drm/sti/sti_vtg_utils.h |   2 +
 13 files changed, 1594 insertions(+), 12 deletions(-)
 create mode 100644 drivers/gpu/drm/sti/sti_drm_connector.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_connector.h
 create mode 100644 drivers/gpu/drm/sti/sti_drm_crtc.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_crtc.h
 create mode 100644 drivers/gpu/drm/sti/sti_drm_drv.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_encoder.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_encoder.h
 create mode 100644 drivers/gpu/drm/sti/sti_drm_plane.c
 create mode 100644 drivers/gpu/drm/sti/sti_drm_plane.h

diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig
index a958398..61c8bd4 100644
--- a/drivers/gpu/drm/sti/Kconfig
+++ b/drivers/gpu/drm/sti/Kconfig
@@ -1,10 +1,18 @@
 config DRM_STI
tristate "DRM Support for STMicroelectronics SoC stiH41x Series"
depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM)
+   select DRM_KMS_HELPER
+   select DRM_GEM_CMA_HELPER
select DRM_KMS_CMA_HELPER
help
  Choose this option to enable DRM on STM stiH41x chipset

+config DRM_STI_FBDEV
+   tristate "DRM frame buffer device for STMicroelectronics SoC stiH41x 
Serie"
+   depends on DRM_STI
+   help
+ Choose this option to enable FBDEV on top of DRM for STM stiH41x 
chipset
+
 config VTAC_STI
tristate "Video Trafic Advance Communication Rx and Tx for 
STMicroelectronics SoC stiH41x Series"
depends on DRM_STI
diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
index d598adc..17b4a68 100644
--- a/drivers/gpu/drm/sti/Makefile
+++ b/drivers/gpu/drm/sti/Makefile
@@ -1,17 +1,21 @@
 ccflags-y := -Iinclude/drm

-stidrm-y := \
-   sti_compositor.o \
-   sti_mixer.o \
-   sti_layer.o \
-   sti_gdp.o \
-   sti_vid.o \
-   sti_tvout.o \
-   sti_hdmi.o \
-   sti_hdmi_tx3g0c55phy.o \
-   sti_hdmi_tx3g4c28phy.o \
-   sti_hda.o \
-   sti_ddc.o
+stidrm-y := sti_drm_drv.o \
+   sti_drm_crtc.o \
+   sti_drm_plane.o \
+   sti_drm_connector.o \
+   sti_drm_encoder.o \
+   sti_compositor.o \
+   sti_mixer.o \
+   sti_layer.o \
+   sti_gdp.o \
+   sti_vid.o \
+   sti_tvout.o \
+   sti_hdmi.o \
+   sti_hdmi_tx3g0c55phy.o \
+   sti_hdmi_tx3g4c28phy.o \
+   sti_hda.o \
+   sti_ddc.o

 obj-$(CONFIG_DRM_STI) += stidrm.o
 obj-$(CONFIG_VTAC_STI) += sti_vtac_tx.o sti_vtac_rx.o
diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
b/drivers/gpu/drm/sti/sti_compositor.c
index a163344..4d8d0958 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -14,6 +14,7 @@

 #include "sti_compositor.h"
 #include "sti_gdp.h"
+#include "sti_drm_crtc.h"

 static const struct of_device_id compositor_match_types[];

@@ -98,6 +99,7 @@ static int sti_compositor_probe(struct platform_device *pdev)
}
DRM_DEBUG_DRIVER("Compositor %p\n", compo);
compo->dev = dev;
+   compo->vtg_vblank_nb.notifier_call = sti_drm_crtc_vblank_cb;

/* populate data structure depending on compatibility */
BUG_ON(!of_match_node(compositor_match_types, np)->data);
diff --git a/drivers/gpu/drm/sti/sti_drm_connector.c 
b/drivers/gpu/drm/sti/sti_drm_connector.c
new file mode 100644
index 000..b34a402
--- /dev/null
+++ b/drivers/gpu/drm/sti/sti_drm_connector.c
@@ -0,0 +1,195 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Author: Benjamin Gaignard  for 
STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#include 
+#include 
+
+#include "sti_drm_connector.h"
+#include "sti_drm_drv.h"
+
+#define to_sti_connector(x) container_of(x, struct sti_connector, 
drm_connector)
+
+/*
+ * sti specific connector structure
+ *
+ * @drm_encoder: connector object
+ * @encoder: 

[PATCH v1 16/19] drm: sti: add debug to mixer

2014-04-08 Thread Benjamin Gaignard
Make mixer driver more verbose

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/sti_mixer.c | 164 
 drivers/gpu/drm/sti/sti_mixer.h |   2 +
 2 files changed, 166 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
index ab8daf6..fce72e4 100644
--- a/drivers/gpu/drm/sti/sti_mixer.c
+++ b/drivers/gpu/drm/sti/sti_mixer.c
@@ -6,7 +6,9 @@
  * License terms:  GNU General Public License (GPL), version 2
  */

+#include "sti_drm_drv.h"
 #include "sti_mixer.h"
+#include "sti_compositor.h"
 #include "sti_vtg_utils.h"

 /* Identity: G=Y , B=Cb , R=Cr */
@@ -139,6 +141,8 @@ int sti_mixer_set_layer_depth(struct sti_mixer *mixer, 
struct sti_layer *layer)
mask = GAM_DEPTH_MASK_ID << (3 * depth);
layer_id = layer_id << (3 * depth);

+   DRM_DEBUG_DRIVER("%s %s depth=%d\n", sti_mixer_to_str(mixer),
+sti_layer_to_str(layer), depth);
dev_dbg(mixer->dev, "GAM_MIXER_MAIN_CRB val 0x%x mask 0x%x\n",
layer_id, mask);
sti_mixer_reg_writemask(mixer, GAM_MIXER_MAIN_CRB, layer_id, mask);
@@ -197,6 +201,9 @@ int sti_mixer_set_layer_status(struct sti_mixer *mixer,
 {
u32 mask, val;

+   DRM_DEBUG_DRIVER("%s %s %s\n", status ? "enable" : "disable",
+sti_mixer_to_str(mixer), sti_layer_to_str(layer));
+
mask = sti_mixer_get_layer_mask(layer);
if (!mask) {
DRM_ERROR("Can not find layer mask\n");
@@ -239,3 +246,160 @@ struct sti_mixer *sti_mixer_create(struct device *dev, 
int id,

return mixer;
 }
+
+static void sti_mixer_dbg_ctl(struct seq_file *m, int val)
+{
+   int count = 0;
+
+   seq_puts(m, "\tEnabled: ");
+   if (val & 1) {
+   seq_puts(m, "BKG ");
+   count++;
+   }
+   val = val >> 1;
+
+   if (val & 1) {
+   seq_puts(m, "VID0 ");
+   count++;
+   }
+   val = val >> 1;
+   if (val & 1) {
+   seq_puts(m, "VID1 ");
+   count++;
+   }
+   val = val >> 1;
+   if (val & 1) {
+   seq_puts(m, "GDP0 ");
+   count++;
+   }
+   val = val >> 1;
+   if (val & 1) {
+   seq_puts(m, "GDP1 ");
+   count++;
+   }
+   val = val >> 1;
+   if (val & 1) {
+   seq_puts(m, "GDP2 ");
+   count++;
+   }
+   val = val >> 1;
+   if (val & 1) {
+   seq_puts(m, "GDP3 ");
+   count++;
+   }
+   if (!count)
+   seq_puts(m, "Nothing");
+}
+
+static void sti_mixer_dbg_crb(struct seq_file *m, int val)
+{
+   int i;
+
+   seq_puts(m, "\tDepth: ");
+   for (i = 0; i < GAM_MIXER_NB_DEPTH_LEVEL; i++) {
+   switch (val & GAM_DEPTH_MASK_ID) {
+   case GAM_DEPTH_VID0_ID:
+   seq_puts(m, "VID0");
+   break;
+   case GAM_DEPTH_VID1_ID:
+   seq_puts(m, "VID1");
+   break;
+   case GAM_DEPTH_GDP0_ID:
+   seq_puts(m, "GDP0");
+   break;
+   case GAM_DEPTH_GDP1_ID:
+   seq_puts(m, "GDP1");
+   break;
+   case GAM_DEPTH_GDP2_ID:
+   seq_puts(m, "GDP2");
+   break;
+   case GAM_DEPTH_GDP3_ID:
+   seq_puts(m, "GDP3");
+   break;
+   default:
+   seq_puts(m, "---");
+   }
+   if (i < GAM_MIXER_NB_DEPTH_LEVEL - 1)
+   seq_puts(m, " < ");
+   val = val >> 3;
+   }
+}
+
+static void sti_mixer_dbg_mxn(struct seq_file *m, void *addr)
+{
+   int i;
+
+   for (i = 1; i < 8; i++)
+   seq_printf(m, "-0x%08X", (int)readl(addr + i * 4));
+}
+
+#define MIXER_DBG_DUMP(reg) seq_printf(m, "\n " #reg "\t 0x%08X", \
+   sti_mixer_reg_read(mixer, reg))
+
+int sti_mixer_dbg_show(struct seq_file *m, void *arg)
+{
+   struct drm_info_node *node = (struct drm_info_node *)m->private;
+   struct drm_device *dev = node->minor->dev;
+   struct sti_drm_private *dev_priv = dev->dev_private;
+   struct sti_compositor *compo = dev_priv->compo;
+   int i, ret;
+
+   ret = mutex_lock_interruptible(>struct_mutex);
+   if (ret)
+   return ret;
+
+   if (compo == NULL) {
+   seq_puts(m, "No compositor available\n");
+   goto out;
+   }
+
+   for (i = 0; i < compo->nb_mixers; i++) {
+   struct drm_crtc *crtc;
+   struct drm_framebuffer *fb;
+   struct sti_mixer *mixer = compo->mixer[i];
+
+   seq_printf(m, "\n%s", sti_mixer_to_str(mixer));
+   

[PATCH v1 15/19] drm: sti: add debug to TVout

2014-04-08 Thread Benjamin Gaignard
Use debugfs to dump information about TVout

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/sti_tvout.c | 181 
 1 file changed, 181 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index df9a2c3..3b2cf3a 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -17,6 +17,7 @@
 #include "sti_tvout.h"
 #include "sti_hdmi.h"
 #include "sti_hda.h"
+#include "sti_drm_drv.h"

 /* glue regsiters */
 #define TVO_CSC_MAIN_M0  0x000
@@ -604,6 +605,186 @@ void sti_tvout_disable(struct sti_tvout *tvout,
connector->stop(connector);
 }

+/*
+ * Debugfs
+ */
+#define TVOUT_DBG_DUMP(reg) seq_printf(m, "\n %-25s 0x%08X", #reg, \
+   readl(tvout->regs + reg))
+#define TVOUT_CONNECTOR_NAME_MAX_LENGHT 10
+#define MAX_STRING_LENGTH 55
+
+static int sti_tvout_dbg_type_to_connector_name(enum sti_tvout_connector_type
+   type, char *name)
+{
+   switch (type) {
+   case STI_TVOUT_CONNECTOR_HDMI:
+   snprintf(name, TVOUT_CONNECTOR_NAME_MAX_LENGHT, "HDMI");
+   break;
+   case STI_TVOUT_CONNECTOR_HDA:
+   snprintf(name, TVOUT_CONNECTOR_NAME_MAX_LENGHT, "HD Analog");
+   break;
+   default:
+   return -1;
+   }
+
+   return 0;
+}
+
+static void tvout_dbg_vip(struct seq_file *m, int val)
+{
+   int r, g, b, tmp, mask;
+   char str[MAX_STRING_LENGTH];
+   static const char *const reorder[] = { "Y_G", "Cb_B", "Cr_R" };
+   static const char *const clipping[] = { "No", "EAV/SAV",
+   "Limited range RGB/Y", "Limited range Cb/Cr",
+   "decided by register" };
+   static const char *const round[] = { "8-bit", "10-bit", "12-bit" };
+   static const 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(m, "\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;
+   snprintf(str, MAX_STRING_LENGTH, "Reorder: %s->%s %s->%s %s->%s",
+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_printf(m, "%-55s", str);
+
+   mask = TVO_VIP_CLIP_MASK << TVO_VIP_CLIP_SHIFT;
+   tmp = (val & mask) >> TVO_VIP_CLIP_SHIFT;
+   snprintf(str, MAX_STRING_LENGTH, "Clipping: %s", clipping[tmp]);
+   seq_printf(m, "%-55s", str);
+
+   seq_printf(m, "\n%-40s", "");
+
+   mask = TVO_VIP_RND_MASK << TVO_VIP_RND_SHIFT;
+   tmp = (val & mask) >> TVO_VIP_RND_SHIFT;
+   snprintf(str, MAX_STRING_LENGTH,
+"Round: input data rounded to %s per component", round[tmp]);
+   seq_printf(m, "%-55s", str);
+
+   tmp = (val & TVO_VIP_SEL_INPUT_MASK);
+   snprintf(str, MAX_STRING_LENGTH, "Input selection: %s", input_sel[tmp]);
+   seq_printf(m, "%-55s", str);
+}
+
+static void tvout_dbg_hd_dac_cfg(struct seq_file *m, int val)
+{
+   seq_puts(m, "\t HD DAC ");
+   seq_puts(m, val & 1 ? "disabled" : "enabled");
+}
+
+static int tvout_dbg_show(struct seq_file *m,
+ enum sti_tvout_connector_type type)
+{
+   struct drm_info_node *node = (struct drm_info_node *)m->private;
+   struct drm_device *dev = node->minor->dev;
+   struct sti_drm_private *dev_priv = dev->dev_private;
+   struct sti_tvout *tvout = dev_priv->tvout;
+   struct sti_tvout_connector *connector = tvout->connector[type];
+   char name[TVOUT_CONNECTOR_NAME_MAX_LENGHT];
+   int ret;
+
+   if (!connector)
+   return -1;
+
+   if (!connector->is_enabled)
+   return -1;
+
+   ret = mutex_lock_interruptible(>struct_mutex);
+   if (ret)
+   return ret;
+
+   if (tvout == NULL) {
+   seq_puts(m, "No tvout available");
+   goto out;
+   }
+
+   ret = sti_tvout_dbg_type_to_connector_name(type, name);
+   if (ret) {
+   seq_puts(m, "No connector!");
+   goto out;
+   }
+
+   seq_printf(m, "\n%s connector: ", name);
+   seq_printf(m, "\nTVOUT: (virt base addr = 0x%p)", tvout->regs);
+   if (connector->is_enabled(connector)) {
+   if (connector->main_path) {
+   

[PATCH v1 14/19] drm: sti: add debug to VID

2014-04-08 Thread Benjamin Gaignard
Make VIdeo plug more verbose on what is on going

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/sti_vid.c | 121 ++
 drivers/gpu/drm/sti/sti_vid.h |   1 +
 2 files changed, 122 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c
index 710665d..35f60d8 100644
--- a/drivers/gpu/drm/sti/sti_vid.c
+++ b/drivers/gpu/drm/sti/sti_vid.c
@@ -8,6 +8,8 @@

 #include "sti_vid.h"
 #include "sti_layer.h"
+#include "sti_compositor.h"
+#include "sti_drm_drv.h"
 #include "sti_vtg_utils.h"

 /* Registers */
@@ -49,6 +51,8 @@ static int sti_vid_prepare_layer(void *lay, bool 
first_prepare)
struct sti_layer *layer = (struct sti_layer *)lay;
struct sti_vid *vid = layer->vid;

+   dev_dbg(vid->dev, "%s %s\n", __func__, sti_layer_to_str(layer));
+
/* Unmask */
val = readl(vid->regs + VID_CTL);
val &= ~VID_CTL_IGNORE;
@@ -64,6 +68,8 @@ static int sti_vid_commit_layer(void *lay)
struct drm_display_mode *mode = layer->mode;
u32 ydo, xdo, yds, xds;

+   dev_dbg(vid->dev, "%s %s\n", __func__, sti_layer_to_str(layer));
+
ydo = sti_vtg_get_line_number(*mode, layer->dst_y);
yds = sti_vtg_get_line_number(*mode, layer->dst_y + layer->dst_h - 1);
xdo = sti_vtg_get_pixel_number(*mode, layer->dst_x);
@@ -81,6 +87,8 @@ static int sti_vid_disable_layer(void *lay)
struct sti_layer *layer = (struct sti_layer *)lay;
struct sti_vid *vid = layer->vid;

+   DRM_DEBUG_DRIVER("%s\n", sti_layer_to_str(layer));
+
/* Mask */
val = readl(vid->regs + VID_CTL);
val |= VID_CTL_IGNORE;
@@ -136,3 +144,116 @@ struct sti_vid *sti_vid_create(struct device *dev, void 
__iomem *baseaddr)

return vid;
 }
+
+static void sti_vid_dbg_ctl(struct seq_file *m, int val)
+{
+   val = val >> 30;
+   seq_puts(m, "\t");
+
+   if (!(val & 1))
+   seq_puts(m, "NOT ");
+   seq_puts(m, "ignored on main mixer - ");
+
+   if (!(val & 2))
+   seq_puts(m, "NOT ");
+   seq_puts(m, "ignored on aux mixer");
+}
+
+static void sti_vid_dbg_vpo(struct seq_file *m, int val)
+{
+   seq_printf(m, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
+}
+
+static void sti_vid_dbg_vps(struct seq_file *m, int val)
+{
+   seq_printf(m, "\txds:%4d\tyds:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
+}
+
+static void sti_vid_dbg_mst(struct seq_file *m, int val)
+{
+   if (val & 1)
+   seq_puts(m, "\tBUFFER UNDERFLOW!");
+}
+
+#define DBG_DUMP(reg) \
+   seq_printf(m, "\n " #reg "\t 0x%08X", readl(vid->regs + reg))
+
+int sti_vid_dbg_show(struct seq_file *m, void *arg)
+{
+   struct drm_info_node *node = (struct drm_info_node *)m->private;
+   struct drm_device *dev = node->minor->dev;
+   struct sti_drm_private *dev_priv = dev->dev_private;
+   struct sti_compositor *compo = dev_priv->compo;
+   enum sti_layer_desc vid_id = *(enum sti_layer_desc *)arg;
+   struct sti_layer *layer;
+   struct sti_vid *vid;
+   struct drm_plane *plane;
+   struct drm_crtc *crtc;
+   struct drm_framebuffer *fb;
+
+   if (compo == NULL) {
+   seq_puts(m, "No compo available\n");
+   goto out;
+   }
+
+   layer = sti_layer_find_layer(compo->layer, vid_id);
+   if (!layer) {
+   seq_puts(m, "Cannot find video layer\n");
+   goto out;
+   }
+   vid = layer->vid;
+
+   seq_printf(m, "\n%s (associated with the mixer_id %d)",
+   sti_layer_to_str(layer), layer->mixer_id);
+   seq_printf(m, "\t %d frame updates",
+  layer->fps_info.curr_frame_counter);
+
+   DBG_DUMP(VID_CTL);
+   sti_vid_dbg_ctl(m, readl(vid->regs + VID_CTL));
+   DBG_DUMP(VID_ALP);
+   DBG_DUMP(VID_CLF);
+   DBG_DUMP(VID_VPO);
+   sti_vid_dbg_vpo(m, readl(vid->regs + VID_VPO));
+   DBG_DUMP(VID_VPS);
+   sti_vid_dbg_vps(m, readl(vid->regs + VID_VPS));
+   DBG_DUMP(VID_KEY1);
+   DBG_DUMP(VID_KEY2);
+   DBG_DUMP(VID_MPR0);
+   DBG_DUMP(VID_MPR1);
+   DBG_DUMP(VID_MPR2);
+   DBG_DUMP(VID_MPR3);
+   DBG_DUMP(VID_MST);
+   sti_vid_dbg_mst(m, readl(vid->regs + VID_MST));
+   DBG_DUMP(VID_BC);
+   DBG_DUMP(VID_TINT);
+   DBG_DUMP(VID_CSAT);
+
+   seq_puts(m, "\n");
+
+   plane = >plane;
+   if (!plane->base.id) {
+   seq_puts(m, " Not connected to any DRM PLANE\n");
+   goto out;
+   }
+   seq_printf(m, " Connected to DRM PLANE #%d which is:\n",
+  plane->base.id);
+
+   crtc = plane->crtc;
+   if (!crtc) {
+   seq_puts(m, "\tNot connected to any DRM CRTC\n");
+   goto out;
+   }
+   seq_printf(m, "\tConnected to DRM CRTC #%d\n", crtc->base.id);
+
+   fb = crtc->fb;
+ 

[PATCH v1 13/19] drm: sti: add debug to GDP

2014-04-08 Thread Benjamin Gaignard
Allow to get more detailed debug information on GDP

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/sti_drm_drv.h |  44 +++
 drivers/gpu/drm/sti/sti_gdp.c | 235 ++
 drivers/gpu/drm/sti/sti_gdp.h |   2 +
 3 files changed, 281 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/sti_drm_drv.h

diff --git a/drivers/gpu/drm/sti/sti_drm_drv.h 
b/drivers/gpu/drm/sti/sti_drm_drv.h
new file mode 100644
index 000..2633d84
--- /dev/null
+++ b/drivers/gpu/drm/sti/sti_drm_drv.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Author: Benjamin Gaignard  for 
STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STI_DRM_DRV_H_
+#define _STI_DRM_DRV_H_
+
+#include 
+
+#include 
+
+#include "sti_compositor.h"
+#include "sti_tvout.h"
+
+extern struct platform_driver sti_compositor_driver;
+extern struct platform_driver sti_vtac_tx_driver;
+extern struct platform_driver sti_vtac_rx_driver;
+extern struct platform_driver sti_vtg_driver;
+extern struct platform_driver sti_tvout_driver;
+extern struct platform_driver sti_hdmi_driver;
+extern struct platform_driver sti_hda_driver;
+
+/*
+ * STI drm private structure
+ * This structure is stored as private in the drm_device
+ *
+ * @compo: compositor
+ * @tvout: TV OUT
+ * @pageflip_evt_list: list of pending page flip requests
+ * @plane_zorder_property: z-order property for CRTC planes
+ */
+struct sti_drm_private {
+   struct sti_compositor *compo;
+   struct sti_tvout *tvout;
+   struct list_head pageflip_evt_list;
+   struct drm_property *plane_zorder_property;
+};
+
+#define STI_MAX_FB_HEIGHT  4096
+#define STI_MAX_FB_WIDTH   4096
+
+#endif
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index 00ff7f9..095d707 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -9,9 +9,11 @@
 #include 
 #include 

+#include "sti_drm_drv.h"
 #include "sti_layer.h"
 #include "sti_gdp.h"
 #include "sti_vtg_utils.h"
+#include "sti_compositor.h"

 #define ENA_COLOR_FILL  (1 << 8)
 #define WAIT_NEXT_VSYNC (1 << 31)
@@ -29,6 +31,25 @@
 #define GDP_YCBR422R   0x12
 #define GDP_AYCBR  0x15

+#define GDP2STR(fmt) { GDP_ ## fmt, #fmt }
+
+static struct gdp_format_to_str {
+   int format;
+   char name[20];
+} sti_gdp_format_to_str[] = {
+   GDP2STR(RGB565),
+   GDP2STR(RGB888),
+   GDP2STR(RGB888_32),
+   GDP2STR(ARGB8565),
+   GDP2STR(ARGB),
+   GDP2STR(ARGB1555),
+   GDP2STR(ARGB),
+   GDP2STR(CLUT8),
+   GDP2STR(YCBR888),
+   GDP2STR(YCBR422R),
+   GDP2STR(AYCBR)
+   };
+
 #define GAM_GDP_CTL_OFFSET 0x00
 #define GAM_GDP_AGC_OFFSET 0x04
 #define GAM_GDP_VPO_OFFSET 0x0C
@@ -137,6 +158,9 @@ static struct sti_gdp_node_list 
*sti_gdp_get_free_nodes(struct sti_layer *layer)
return >node_list[i];

 end:
+   DRM_DEBUG_DRIVER("Warning, inconsistent NVN for %s: 0x%08X\n",
+   sti_layer_to_str(layer), hw_nvn);
+
return >node_list[0];
 }

@@ -169,6 +193,8 @@ struct sti_gdp_node_list *sti_gdp_get_current_nodes(struct 
sti_layer *layer)
return >node_list[i];

 end:
+   DRM_DEBUG_DRIVER("Warning, NVN 0x%08X for %s does not match any node\n",
+   hw_nvn, sti_layer_to_str(layer));
return NULL;
 }

@@ -198,6 +224,9 @@ static int sti_gdp_prepare_layer(void *lay, bool 
first_prepare)
top_field = list->top_field;
btm_field = list->btm_field;

+   dev_dbg(dev, "%s %s top_node:0x%p btm_node:0x%p\n", __func__,
+   sti_layer_to_str(layer), top_field, btm_field);
+
/* Build the top field from layer params */
top_field->gam_gdp_agc = GAM_GDP_AGC_FULL_RANGE;
top_field->gam_gdp_ctl = WAIT_NEXT_VSYNC;
@@ -294,6 +323,9 @@ static int sti_gdp_commit_layer(void *lay)
u32 dma_updated_btm = virt_to_dma(gdp->dev, updated_btm_node);
struct sti_gdp_node_list *curr_list = sti_gdp_get_current_nodes(layer);

+   dev_dbg(gdp->dev, "%s %s top/btm_node:0x%p/0x%p\n", __func__,
+   sti_layer_to_str(layer),
+   updated_top_node, updated_btm_node);
dev_dbg(gdp->dev, "Current NVN:0x%X\n",
readl(gdp->regs + GAM_GDP_NVN_OFFSET));
dev_dbg(gdp->dev, "Posted buff: %lx current buff: %x\n",
@@ -303,6 +335,8 @@ static int sti_gdp_commit_layer(void *lay)
if (curr_list == NULL) {
/* First update or invalid node should directly write in the
 * hw register */
+   DRM_DEBUG_DRIVER("%s first update (or invalid node)",
+   

[PATCH v1 12/19] drm: sti: add Compositor

2014-04-08 Thread Benjamin Gaignard
Compositor control all the input sub-devices and the mixer.
It is the main entry point for composition.
Layer interface is used to control the layer.

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/Kconfig  |   1 +
 drivers/gpu/drm/sti/Makefile |   2 +
 drivers/gpu/drm/sti/sti_compositor.c | 187 +
 drivers/gpu/drm/sti/sti_compositor.h |  84 ++
 drivers/gpu/drm/sti/sti_layer.c  | 309 +++
 5 files changed, 583 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/sti_compositor.c
 create mode 100644 drivers/gpu/drm/sti/sti_compositor.h
 create mode 100644 drivers/gpu/drm/sti/sti_layer.c

diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig
index e33b618..a958398 100644
--- a/drivers/gpu/drm/sti/Kconfig
+++ b/drivers/gpu/drm/sti/Kconfig
@@ -1,6 +1,7 @@
 config DRM_STI
tristate "DRM Support for STMicroelectronics SoC stiH41x Series"
depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM)
+   select DRM_KMS_CMA_HELPER
help
  Choose this option to enable DRM on STM stiH41x chipset

diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
index 3712435..d598adc 100644
--- a/drivers/gpu/drm/sti/Makefile
+++ b/drivers/gpu/drm/sti/Makefile
@@ -1,7 +1,9 @@
 ccflags-y := -Iinclude/drm

 stidrm-y := \
+   sti_compositor.o \
sti_mixer.o \
+   sti_layer.o \
sti_gdp.o \
sti_vid.o \
sti_tvout.o \
diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
b/drivers/gpu/drm/sti/sti_compositor.c
new file mode 100644
index 000..a163344
--- /dev/null
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Authors: Benjamin Gaignard 
+ *  Fabien Dessenne 
+ *  for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "sti_compositor.h"
+#include "sti_gdp.h"
+
+static const struct of_device_id compositor_match_types[];
+
+/*
+ * stiH407 compositor properties
+ */
+struct sti_compositor_data stih407_compositor_data = {
+   .nb_subdev = 6,
+   .subdev_desc = {
+   {STI_GPD_SUBDEV, (int)STI_GDP_0, 0x100},
+   {STI_GPD_SUBDEV, (int)STI_GDP_1, 0x200},
+   {STI_GPD_SUBDEV, (int)STI_GDP_2, 0x300},
+   {STI_GPD_SUBDEV, (int)STI_GDP_3, 0x400},
+   {STI_VID_SUBDEV, (int)STI_VID_0, 0x700},
+   {STI_MIXER_MAIN_SUBDEV, STI_MIXER_MAIN, 0xC00}
+   },
+};
+
+/*
+ * stiH416 compositor properties
+ * Note:
+ * on stih416 MIXER_AUX has a different base address from MIXER_MAIN
+ * Moreover, GDPx is different for Main and Aux Mixer. So this subdev map does
+ * not fit for stiH416 if we want to enable the MIXER_AUX.
+ */
+struct sti_compositor_data stih416_compositor_data = {
+   .nb_subdev = 3,
+   .subdev_desc = {
+   {STI_GPD_SUBDEV, (int)STI_GDP_0, 0x100},
+   {STI_GPD_SUBDEV, (int)STI_GDP_1, 0x200},
+   {STI_MIXER_MAIN_SUBDEV, STI_MIXER_MAIN, 0xC00}
+   },
+};
+
+static int sti_compositor_init_subdev(struct sti_compositor *compo,
+   struct sti_compositor_subdev_descriptor *desc,
+   int array_size)
+{
+   int i, mixer_id = 0, layer_id = 0;
+
+   dev_dbg(compo->dev, "%s\n", __func__);
+   for (i = 0; i < array_size; i++) {
+   switch (desc[i].type) {
+   case STI_MIXER_MAIN_SUBDEV:
+   case STI_MIXER_AUX_SUBDEV:
+   compo->mixer[mixer_id++] =
+   sti_mixer_create(compo->dev, desc[i].id,
+compo->regs + desc[i].offset);
+   break;
+   case STI_GPD_SUBDEV:
+   case STI_VID_SUBDEV:
+   compo->layer[layer_id++] =
+   sti_layer_create(compo->dev, desc[i].id,
+compo->regs + desc[i].offset);
+   break;
+   /* case STI_CURSOR_SUBDEV : TODO */
+   default:
+   DRM_ERROR("Unknow subdev compoment type\n");
+   return 1;
+   }
+
+   }
+   compo->nb_mixers = mixer_id;
+   compo->nb_layers = layer_id;
+
+   return 0;
+}
+
+static int sti_compositor_probe(struct platform_device *pdev)
+{
+   struct device *dev = >dev;
+   struct device_node *np = dev->of_node;
+   struct sti_compositor *compo;
+   struct resource *res;
+   int err;
+
+   DRM_INFO("%s\n", __func__);
+   compo = devm_kzalloc(dev, sizeof(*compo), GFP_KERNEL);
+   if (!compo) {
+   

[PATCH v1 11/19] drm: sti: add Mixer

2014-04-08 Thread Benjamin Gaignard
Mixer hardware IP is responsible of mixing the different inputs layers.
Z-order is managed by the mixer.
We could 2 mixers: one for main path and one for auxilary path

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/Makefile|   1 +
 drivers/gpu/drm/sti/sti_mixer.c | 241 
 drivers/gpu/drm/sti/sti_mixer.h |  52 +
 3 files changed, 294 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/sti_mixer.c
 create mode 100644 drivers/gpu/drm/sti/sti_mixer.h

diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
index 03c8d98..3712435 100644
--- a/drivers/gpu/drm/sti/Makefile
+++ b/drivers/gpu/drm/sti/Makefile
@@ -1,6 +1,7 @@
 ccflags-y := -Iinclude/drm

 stidrm-y := \
+   sti_mixer.o \
sti_gdp.o \
sti_vid.o \
sti_tvout.o \
diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
new file mode 100644
index 000..ab8daf6
--- /dev/null
+++ b/drivers/gpu/drm/sti/sti_mixer.c
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Authors: Benjamin Gaignard 
+ *  Fabien Dessenne 
+ *  for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#include "sti_mixer.h"
+#include "sti_vtg_utils.h"
+
+/* Identity: G=Y , B=Cb , R=Cr */
+static const u32 MixerColorSpaceMatIdentity[] = {
+   0x1000, 0x, 0x1000, 0x1000,
+   0x, 0x, 0x, 0x
+};
+
+/* regs offset */
+#define GAM_MIXER_MAIN_CTL 0x00
+#define GAM_MIXER_MAIN_BKC 0x04
+#define GAM_MIXER_MAIN_BCO 0x0C
+#define GAM_MIXER_MAIN_BCS 0x10
+#define GAM_MIXER_MAIN_AVO 0x28
+#define GAM_MIXER_MAIN_AVS 0x2C
+#define GAM_MIXER_MAIN_CRB 0x34
+#define GAM_MIXER_MAIN_ACT 0x38
+#define GAM_MIXER_MAIN_MBP 0x3C
+#define GAM_MIXER_MAIN_MX0 0x80
+
+/* id for depth of CRB reg */
+#define GAM_DEPTH_VID0_ID  1
+#define GAM_DEPTH_VID1_ID  2
+#define GAM_DEPTH_GDP0_ID  3
+#define GAM_DEPTH_GDP1_ID  4
+#define GAM_DEPTH_GDP2_ID  5
+#define GAM_DEPTH_GDP3_ID  6
+#define GAM_DEPTH_MASK_ID  7
+
+/* mask in CTL reg */
+#define GAM_CTL_BACK_MASK  (1 << 0)
+#define GAM_CTL_VID0_MASK  (1 << 1)
+#define GAM_CTL_VID1_MASK  (1 << 2)
+#define GAM_CTL_GDP0_MASK  (1 << 3)
+#define GAM_CTL_GDP1_MASK  (1 << 4)
+#define GAM_CTL_GDP2_MASK  (1 << 5)
+#define GAM_CTL_GDP3_MASK  (1 << 6)
+
+const char *sti_mixer_to_str(struct sti_mixer *mixer)
+{
+   switch (mixer->id) {
+   case STI_MIXER_MAIN:
+   return "MAIN_MIXER";
+   case STI_MIXER_AUX:
+   return "AUX_MIXER";
+   default:
+   return "";
+   }
+}
+
+static inline u32 sti_mixer_reg_read(struct sti_mixer *mixer, u32 reg_id)
+{
+   return readl(mixer->regs + reg_id);
+}
+
+static inline void sti_mixer_reg_write(struct sti_mixer *mixer,
+  u32 reg_id, u32 val)
+{
+   writel(val, mixer->regs + reg_id);
+}
+
+static inline void sti_mixer_reg_writemask(struct sti_mixer *mixer,
+  u32 reg_id, u32 val, u32 mask)
+{
+   u32 old = sti_mixer_reg_read(mixer, reg_id);
+
+   val = (val & mask) | (old & ~mask);
+   writel(val, mixer->regs + reg_id);
+}
+
+void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable)
+{
+   sti_mixer_reg_writemask(mixer,
+   GAM_MIXER_MAIN_CTL, enable, GAM_CTL_BACK_MASK);
+}
+
+static void sti_mixer_set_background_color(struct sti_mixer *mixer,
+  int red, int green, int blue)
+{
+   u32 val = (red << 16) | (green << 8) | blue;
+
+   sti_mixer_reg_write(mixer, GAM_MIXER_MAIN_BKC, val);
+}
+
+static void sti_mixer_set_background_area(struct sti_mixer *mixer,
+ struct drm_display_mode *mode)
+{
+   u32 ydo, xdo, yds, xds;
+
+   ydo = sti_vtg_get_line_number(*mode, 0);
+   yds = sti_vtg_get_line_number(*mode, mode->vdisplay - 1);
+   xdo = sti_vtg_get_pixel_number(*mode, 0);
+   xds = sti_vtg_get_pixel_number(*mode, mode->hdisplay - 1);
+
+   sti_mixer_reg_write(mixer, GAM_MIXER_MAIN_BCO, ydo << 16 | xdo);
+   sti_mixer_reg_write(mixer, GAM_MIXER_MAIN_BCS, yds << 16 | xds);
+}
+
+int sti_mixer_set_layer_depth(struct sti_mixer *mixer, struct sti_layer *layer)
+{
+   int layer_id = 0, depth = layer->zorder;
+   u32 mask;
+
+   if (depth >= GAM_MIXER_NB_DEPTH_LEVEL)
+   return 1;
+
+   switch (layer->desc) {
+   case STI_GDP_0:
+   layer_id = GAM_DEPTH_GDP0_ID;
+   break;
+   case STI_GDP_1:
+   layer_id = GAM_DEPTH_GDP1_ID;
+   break;
+   case STI_GDP_2:
+   layer_id = GAM_DEPTH_GDP2_ID;
+   break;
+   case 

[PATCH v1 09/19] drm: sti: add GDP layer

2014-04-08 Thread Benjamin Gaignard
Generic Display Pipeline are one of the compositor input sub-devices.
GDP are dedicated to graphic input like RGB plans.

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/Makefile|   1 +
 drivers/gpu/drm/sti/sti_gdp.c   | 491 
 drivers/gpu/drm/sti/sti_gdp.h   |  73 ++
 drivers/gpu/drm/sti/sti_layer.h |   5 +
 drivers/gpu/drm/sti/sti_vtg.c   |  14 +-
 drivers/gpu/drm/sti/sti_vtg_utils.h |   3 +-
 6 files changed, 583 insertions(+), 4 deletions(-)
 create mode 100644 drivers/gpu/drm/sti/sti_gdp.c
 create mode 100644 drivers/gpu/drm/sti/sti_gdp.h

diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
index 447eccf..3d1ae3e 100644
--- a/drivers/gpu/drm/sti/Makefile
+++ b/drivers/gpu/drm/sti/Makefile
@@ -1,6 +1,7 @@
 ccflags-y := -Iinclude/drm

 stidrm-y := \
+   sti_gdp.o \
sti_tvout.o \
sti_hdmi.o \
sti_hdmi_tx3g0c55phy.o \
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
new file mode 100644
index 000..00ff7f9
--- /dev/null
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -0,0 +1,491 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Authors: Benjamin Gaignard 
+ *  Fabien Dessenne 
+ *  for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#include 
+#include 
+
+#include "sti_layer.h"
+#include "sti_gdp.h"
+#include "sti_vtg_utils.h"
+
+#define ENA_COLOR_FILL  (1 << 8)
+#define WAIT_NEXT_VSYNC (1 << 31)
+
+/* GDP color formats */
+#define GDP_RGB565 0x00
+#define GDP_RGB888 0x01
+#define GDP_RGB888_32  0x02
+#define GDP_ARGB8565   0x04
+#define GDP_ARGB   0x05
+#define GDP_ARGB1555   0x06
+#define GDP_ARGB   0x07
+#define GDP_CLUT8  0x0B
+#define GDP_YCBR8880x10
+#define GDP_YCBR422R   0x12
+#define GDP_AYCBR  0x15
+
+#define GAM_GDP_CTL_OFFSET 0x00
+#define GAM_GDP_AGC_OFFSET 0x04
+#define GAM_GDP_VPO_OFFSET 0x0C
+#define GAM_GDP_VPS_OFFSET 0x10
+#define GAM_GDP_PML_OFFSET 0x14
+#define GAM_GDP_PMP_OFFSET 0x18
+#define GAM_GDP_SIZE_OFFSET0x1C
+#define GAM_GDP_NVN_OFFSET 0x24
+#define GAM_GDP_KEY1_OFFSET0x28
+#define GAM_GDP_KEY2_OFFSET0x2C
+#define GAM_GDP_PPT_OFFSET 0x34
+#define GAM_GDP_CML_OFFSET 0x3C
+#define GAM_GDP_MST_OFFSET 0x68
+
+#define GAM_GDP_ALPHARANGE_255  (1 << 5)
+#define GAM_GDP_AGC_FULL_RANGE 0x00808080
+#define GAM_GDP_PPT_IGNORE  ((1 << 1) | (1 << 0))
+#define GAM_GDP_SIZE_MAX0x7FF
+
+static const uint32_t gdp_supported_formats[] = {
+   DRM_FORMAT_XRGB,
+   DRM_FORMAT_ARGB,
+   DRM_FORMAT_ARGB,
+   DRM_FORMAT_ARGB1555,
+   DRM_FORMAT_RGB565,
+   DRM_FORMAT_RGB888,
+   DRM_FORMAT_AYUV,
+   DRM_FORMAT_YUV444,
+   DRM_FORMAT_VYUY,
+   DRM_FORMAT_C8,
+};
+
+static const uint32_t *sti_gdp_get_formats(void)
+{
+   return gdp_supported_formats;
+}
+
+static int sti_gdp_get_nb_formats(void)
+{
+   return ARRAY_SIZE(gdp_supported_formats);
+}
+
+static int sti_gdp_fourcc2format(int fourcc)
+{
+   switch (fourcc) {
+   case DRM_FORMAT_XRGB:
+   return GDP_RGB888_32;
+   case DRM_FORMAT_ARGB:
+   return GDP_ARGB;
+   case DRM_FORMAT_ARGB:
+   return GDP_ARGB;
+   case DRM_FORMAT_ARGB1555:
+   return GDP_ARGB1555;
+   case DRM_FORMAT_RGB565:
+   return GDP_RGB565;
+   case DRM_FORMAT_RGB888:
+   return GDP_RGB888;
+   case DRM_FORMAT_AYUV:
+   return GDP_AYCBR;
+   case DRM_FORMAT_YUV444:
+   return GDP_YCBR888;
+   case DRM_FORMAT_VYUY:
+   return GDP_YCBR422R;
+   case DRM_FORMAT_C8:
+   return GDP_CLUT8;
+   }
+   return -1;
+}
+
+static int sti_gdp_get_alpharange(int format)
+{
+   switch (format) {
+   case GDP_ARGB8565:
+   case GDP_ARGB:
+   case GDP_AYCBR:
+   return GAM_GDP_ALPHARANGE_255;
+   }
+   return 0;
+}
+
+/**
+ * sti_gdp_get_free_nodes
+ * @layer: gdp layer
+ *
+ * Look for a GDP node list that is not currently read by the HW.
+ *
+ * RETURNS:
+ * Pointer to the free GDP node list
+ */
+static struct sti_gdp_node_list *sti_gdp_get_free_nodes(struct sti_layer 
*layer)
+{
+   int hw_nvn;
+   void *virt_nvn;
+   struct sti_gdp *gdp = layer->gdp;
+   int i;
+
+   hw_nvn = readl(gdp->regs + GAM_GDP_NVN_OFFSET);
+   if (!hw_nvn)
+   goto end;
+
+   virt_nvn = dma_to_virt(gdp->dev, (dma_addr_t) hw_nvn);
+
+   for (i = 0; i < GDP_NODE_NB_BANK; i++)
+   if ((virt_nvn != gdp->node_list[i].btm_field) &&
+   (virt_nvn != gdp->node_list[i].top_field))
+   return >node_list[i];
+
+end:
+   return >node_list[0];
+}
+
+/**
+ * 

[PATCH v1 08/19] drm: sti: add sti layer interface definition

2014-04-08 Thread Benjamin Gaignard
STI hardware have various input sub-devices before mixing block.
Each type of sub-device have different capabilities for scaling,
filtering or accepted pixel format.
This layer interface abstract those differences and make the interaction
with compositor more simple.

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/sti_layer.h | 104 
 1 file changed, 104 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/sti_layer.h

diff --git a/drivers/gpu/drm/sti/sti_layer.h b/drivers/gpu/drm/sti/sti_layer.h
new file mode 100644
index 000..ed8386a
--- /dev/null
+++ b/drivers/gpu/drm/sti/sti_layer.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Authors: Benjamin Gaignard 
+ *  Fabien Dessenne 
+ *  for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STI_LAYER_H_
+#define _STI_LAYER_H_
+
+#include 
+
+#define to_sti_layer(x) container_of(x, struct sti_layer, plane)
+
+#define STI_LAYER_TYPE_SHIFT 8
+#define STI_LAYER_TYPE_MASK (~((1<

[PATCH v1 07/19] drm: sti: add TVOut driver

2014-04-08 Thread Benjamin Gaignard
TVout hardware block is responsible to dispatch the data flow coming
from compositor block to any of the output (HDMI or Analog TV).
It control when output are start/stop and configure according the
require flow path.

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/Makefile|   4 +-
 drivers/gpu/drm/sti/sti_hda.c   | 373 ++
 drivers/gpu/drm/sti/sti_hda.h   |  14 +
 drivers/gpu/drm/sti/sti_hdmi.c  | 542 +++
 drivers/gpu/drm/sti/sti_hdmi.h  |   3 +
 drivers/gpu/drm/sti/sti_tvout.c | 682 
 drivers/gpu/drm/sti/sti_tvout.h | 105 +++
 7 files changed, 1722 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/sti/sti_hda.h
 create mode 100644 drivers/gpu/drm/sti/sti_tvout.c
 create mode 100644 drivers/gpu/drm/sti/sti_tvout.h

diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
index 134ae6d..447eccf 100644
--- a/drivers/gpu/drm/sti/Makefile
+++ b/drivers/gpu/drm/sti/Makefile
@@ -1,6 +1,8 @@
 ccflags-y := -Iinclude/drm

-stidrm-y := sti_hdmi.o \
+stidrm-y := \
+   sti_tvout.o \
+   sti_hdmi.o \
sti_hdmi_tx3g0c55phy.o \
sti_hdmi_tx3g4c28phy.o \
sti_hda.o \
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index 03ed120..02a6f3a 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -10,6 +10,8 @@

 #include 

+#include "sti_hda.h"
+
 /* HDformatter registers */
 #define HDA_ANA_CFG 0x
 #define HDA_ANA_SCALE_CTRL_Y0x0004
@@ -371,6 +373,377 @@ static int sti_hda_get_modes(struct drm_connector 
*drm_connector)
return count;
 }

+/*
+ * Start hd analog
+ *
+ * @connector: pointer on the tvout HD analog connector
+ *
+ * Return 0 on success
+ */
+static int sti_hda_start(struct sti_tvout_connector *connector)
+{
+   struct sti_hda *hda = (struct sti_hda *)connector->priv;
+   u32 val, i, mode_idx;
+   u32 src_filter_y, src_filter_c;
+   u32 *coef_y, *coef_c;
+   u32 filter_mode;
+
+   DRM_DEBUG_DRIVER("\n");
+
+   /* Prepare/enable clocks */
+   if (clk_prepare_enable(hda->clk_pix))
+   DRM_ERROR("Failed to prepare/enable hda_pix clk\n");
+   if (clk_prepare_enable(hda->clk_hddac))
+   DRM_ERROR("Failed to prepare/enable hda_hddac clk\n");
+
+   hda->enabled = true;
+
+   if (!hda_get_mode_idx(hda->mode, _idx)) {
+   DRM_ERROR("Undefined mode\n");
+   return 1;
+   }
+
+   switch (hda_supported_modes[mode_idx].vid_cat) {
+   case VID_HD_148M:
+   DRM_ERROR("Beyond HD analog capabilities\n");
+   return 1;
+   case VID_HD_74M:
+   /* HD use alternate 2x filter */
+   filter_mode = CFG_AWG_FLTR_MODE_HD;
+   src_filter_y = HDA_ANA_SRC_Y_CFG_ALT_2X;
+   src_filter_c = HDA_ANA_SRC_C_CFG_ALT_2X;
+   coef_y = coef_y_alt_2x;
+   coef_c = coef_c_alt_2x;
+   break;
+   case VID_ED:
+   /* ED uses 4x filter */
+   filter_mode = CFG_AWG_FLTR_MODE_ED;
+   src_filter_y = HDA_ANA_SRC_Y_CFG_4X;
+   src_filter_c = HDA_ANA_SRC_C_CFG_4X;
+   coef_y = coef_yc_4x;
+   coef_c = coef_yc_4x;
+   break;
+   case VID_SD:
+   DRM_ERROR("Not supported\n");
+   return 1;
+   default:
+   DRM_ERROR("Undefined resolution\n");
+   return 1;
+   }
+   DRM_DEBUG_DRIVER("Using HDA mode #%d\n", mode_idx);
+
+   /* Enable HD Video DACs */
+   hda_enable_hd_dacs(hda, true);
+
+   /* Configure scaler */
+   writel(SCALE_CTRL_Y_DFLT, hda->regs + HDA_ANA_SCALE_CTRL_Y);
+   writel(SCALE_CTRL_CB_DFLT, hda->regs + HDA_ANA_SCALE_CTRL_CB);
+   writel(SCALE_CTRL_CR_DFLT, hda->regs + HDA_ANA_SCALE_CTRL_CR);
+
+   /* Configure sampler */
+   writel(src_filter_y, hda->regs + HDA_ANA_SRC_Y_CFG);
+   writel(src_filter_c, hda->regs + HDA_ANA_SRC_C_CFG);
+   for (i = 0; i < SAMPLER_COEF_NB; i++) {
+   writel(coef_y[i], hda->regs + HDA_COEFF_Y_PH1_TAP123 + i * 4);
+   writel(coef_c[i], hda->regs + HDA_COEFF_C_PH1_TAP123 + i * 4);
+   }
+
+   /* Configure main HDFormatter */
+   val = 0;
+   val |= (hda->mode.flags & DRM_MODE_FLAG_INTERLACE) ?
+   0 : CFG_AWG_ASYNC_VSYNC_MTD;
+   val |= (CFG_PBPR_SYNC_OFF_VAL << CFG_PBPR_SYNC_OFF_SHIFT);
+   val |= filter_mode;
+   writel(val, hda->regs + HDA_ANA_CFG);
+
+   /* Configure AWG */
+   sti_hda_configure_awg(hda, hda_supported_modes[mode_idx].awg_instr,
+ hda_supported_modes[mode_idx].nb_instr);
+
+   /* Enable AWG */
+   hda_reg_writemask(hda->regs + HDA_ANA_CFG, 1, CFG_AWG_ASYNC_EN);
+
+   return 

[PATCH v1 06/19] drm: sti: add HDA driver

2014-04-08 Thread Benjamin Gaignard
Add driver to support analog TV ouput.

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/Makefile  |   1 +
 drivers/gpu/drm/sti/sti_hda.c | 453 ++
 2 files changed, 454 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/sti_hda.c

diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
index b6f596a..134ae6d 100644
--- a/drivers/gpu/drm/sti/Makefile
+++ b/drivers/gpu/drm/sti/Makefile
@@ -3,6 +3,7 @@ ccflags-y := -Iinclude/drm
 stidrm-y := sti_hdmi.o \
sti_hdmi_tx3g0c55phy.o \
sti_hdmi_tx3g4c28phy.o \
+   sti_hda.o \
sti_ddc.o

 obj-$(CONFIG_DRM_STI) += stidrm.o
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
new file mode 100644
index 000..03ed120
--- /dev/null
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -0,0 +1,453 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2014
+ * Author: Fabien Dessenne  for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+/* HDformatter registers */
+#define HDA_ANA_CFG 0x
+#define HDA_ANA_SCALE_CTRL_Y0x0004
+#define HDA_ANA_SCALE_CTRL_CB   0x0008
+#define HDA_ANA_SCALE_CTRL_CR   0x000C
+#define HDA_ANA_ANC_CTRL0x0010
+#define HDA_ANA_SRC_Y_CFG   0x0014
+#define HDA_COEFF_Y_PH1_TAP123  0x0018
+#define HDA_COEFF_Y_PH1_TAP456  0x001C
+#define HDA_COEFF_Y_PH2_TAP123  0x0020
+#define HDA_COEFF_Y_PH2_TAP456  0x0024
+#define HDA_COEFF_Y_PH3_TAP123  0x0028
+#define HDA_COEFF_Y_PH3_TAP456  0x002C
+#define HDA_COEFF_Y_PH4_TAP123  0x0030
+#define HDA_COEFF_Y_PH4_TAP456  0x0034
+#define HDA_ANA_SRC_C_CFG   0x0040
+#define HDA_COEFF_C_PH1_TAP123  0x0044
+#define HDA_COEFF_C_PH1_TAP456  0x0048
+#define HDA_COEFF_C_PH2_TAP123  0x004C
+#define HDA_COEFF_C_PH2_TAP456  0x0050
+#define HDA_COEFF_C_PH3_TAP123  0x0054
+#define HDA_COEFF_C_PH3_TAP456  0x0058
+#define HDA_COEFF_C_PH4_TAP123  0x005C
+#define HDA_COEFF_C_PH4_TAP456  0x0060
+#define HDA_SYNC_AWGI   0x0300
+
+/* HDA_ANA_CFG */
+#define CFG_AWG_ASYNC_EN(1 << 0)
+#define CFG_AWG_ASYNC_HSYNC_MTD (1 << 1)
+#define CFG_AWG_ASYNC_VSYNC_MTD (1 << 2)
+#define CFG_AWG_SYNC_DEL(1 << 3)
+#define CFG_AWG_FLTR_MODE_SHIFT 4
+#define CFG_AWG_FLTR_MODE_MASK  (0xF << CFG_AWG_FLTR_MODE_SHIFT)
+#define CFG_AWG_FLTR_MODE_SD(0 << CFG_AWG_FLTR_MODE_SHIFT)
+#define CFG_AWG_FLTR_MODE_ED(1 << CFG_AWG_FLTR_MODE_SHIFT)
+#define CFG_AWG_FLTR_MODE_HD(2 << CFG_AWG_FLTR_MODE_SHIFT)
+#define CFG_SYNC_ON_PBPR_MASK   (1 << 8)
+#define CFG_PREFILTER_EN_MASK   (1 << 9)
+#define CFG_PBPR_SYNC_OFF_SHIFT 16
+#define CFG_PBPR_SYNC_OFF_MASK  (0x7FF << CFG_PBPR_SYNC_OFF_SHIFT)
+#define CFG_PBPR_SYNC_OFF_VAL   0x117  /* Voltage dependent. stiH416 */
+
+/* Default scaling values */
+#define SCALE_CTRL_Y_DFLT   0x00C50256
+#define SCALE_CTRL_CB_DFLT  0x00DB0249
+#define SCALE_CTRL_CR_DFLT  0x00DB0249
+
+/* Video DACs control */
+#define VIDEO_DACS_CONTROL_MASK 0x0FFF
+#define VIDEO_DACS_CONTROL_SYSCFG2535   0x085C /* for stih416 */
+#define DAC_CFG_HD_OFF_SHIFT5
+#define DAC_CFG_HD_OFF_MASK (0x7 << DAC_CFG_HD_OFF_SHIFT)
+#define VIDEO_DACS_CONTROL_SYSCFG5072   0x0120 /* for stih407 */
+#define DAC_CFG_HD_HZUVW_OFF_SHIFT  1
+#define DAC_CFG_HD_HZUVW_OFF_MASK   (0x1 << DAC_CFG_HD_HZUVW_OFF_SHIFT)
+
+
+/* Upsampler values for the alternative 2X Filter */
+#define SAMPLER_COEF_NB 8
+#define HDA_ANA_SRC_Y_CFG_ALT_2X0x0113
+static u32 coef_y_alt_2x[] = {
+   0x00FE83FB, 0x1F900401, 0x, 0x,
+   0x00F408F9, 0x055F7C25, 0x, 0x
+};
+
+#define HDA_ANA_SRC_C_CFG_ALT_2X0x01750004
+static u32 coef_c_alt_2x[] = {
+   0x001305F7, 0x05274BD0, 0x, 0x,
+   0x0004907C, 0x09C80B9D, 0x, 0x
+};
+
+/* Upsampler values for the 4X Filter */
+#define HDA_ANA_SRC_Y_CFG_4X0x01ED0005
+#define HDA_ANA_SRC_C_CFG_4X0x01ED0004
+static u32 coef_yc_4x[] = {
+   0x00FC827F, 0x008FE20B, 0x00F684FC, 0x050F7C24,
+   0x00F4857C, 0x0A1F402E, 0x00FA027F, 0x0E076E1D
+};
+
+/* AWG instructions for some video modes */
+#define AWG_MAX_INST64
+
+/* 720p at 50 */
+static u32 AWGi_720p_50[] = {
+   0x0971, 0x0C26, 0x013B, 0x0CDA,
+   0x0104, 0x0E7E, 0x0E7F, 0x013B,
+   0x0D8E, 0x0104, 0x1804, 0x0971,
+   0x0C26, 0x003B, 0x0FB4, 0x0FB5,
+   0x0104, 0x1AE8
+};
+

[PATCH v1 05/19] drm: sti: add I2C client driver for HDMI

2014-04-08 Thread Benjamin Gaignard
Add I2C client driver to retrieve EDID.

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/Makefile  |  3 ++-
 drivers/gpu/drm/sti/sti_ddc.c | 56 +++
 2 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/sti/sti_ddc.c

diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
index 2bb3035..b6f596a 100644
--- a/drivers/gpu/drm/sti/Makefile
+++ b/drivers/gpu/drm/sti/Makefile
@@ -2,7 +2,8 @@ ccflags-y := -Iinclude/drm

 stidrm-y := sti_hdmi.o \
sti_hdmi_tx3g0c55phy.o \
-   sti_hdmi_tx3g4c28phy.o
+   sti_hdmi_tx3g4c28phy.o \
+   sti_ddc.o

 obj-$(CONFIG_DRM_STI) += stidrm.o
 obj-$(CONFIG_VTAC_STI) += sti_vtac_tx.o sti_vtac_rx.o
diff --git a/drivers/gpu/drm/sti/sti_ddc.c b/drivers/gpu/drm/sti/sti_ddc.c
new file mode 100644
index 000..147a704
--- /dev/null
+++ b/drivers/gpu/drm/sti/sti_ddc.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Author: Benjamin Gaignard  for 
STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+#include 
+
+#include 
+#include 
+#include 
+
+#include "sti_hdmi.h"
+
+static int sti_hdmi_ddc_probe(struct i2c_client *client,
+ const struct i2c_device_id *dev_id)
+{
+   sti_hdmi_attach_ddc_client(client);
+
+   DRM_INFO("%s attached %s into i2c adapter successfully\n",
+__func__, client->name);
+
+   return 0;
+}
+
+static int sti_hdmi_ddc_remove(struct i2c_client *client)
+{
+   DRM_INFO("%s detached %s from i2c adapter successfully\n",
+__func__, client->name);
+
+   return 0;
+}
+
+static struct i2c_device_id sti_ddc_idtable[] = {
+   {"sti-hdmiddc", 0},
+   {},
+};
+
+static struct of_device_id hdmiddc_match_types[] = {
+   {
+.compatible = "st,sti-hdmiddc",
+}, {
+/* end node */
+}
+};
+
+struct i2c_driver ddc_driver = {
+   .driver = {
+  .name = "sti-hdmiddc",
+  .owner = THIS_MODULE,
+  .of_match_table = of_match_ptr(hdmiddc_match_types),
+  },
+   .id_table = sti_ddc_idtable,
+   .probe = sti_hdmi_ddc_probe,
+   .remove = sti_hdmi_ddc_remove,
+   .command = NULL,
+};
-- 
1.9.0



[PATCH v1 04/19] drm: sti: add HDMI driver

2014-04-08 Thread Benjamin Gaignard
Add driver for HDMI ouput

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/Makefile   |   5 +
 drivers/gpu/drm/sti/sti_hdmi.c | 503 +
 drivers/gpu/drm/sti/sti_hdmi.h | 195 +++
 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c | 398 +++
 drivers/gpu/drm/sti/sti_hdmi_tx3g4c28phy.c | 224 +
 5 files changed, 1325 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/sti_hdmi.c
 create mode 100644 drivers/gpu/drm/sti/sti_hdmi.h
 create mode 100644 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c
 create mode 100644 drivers/gpu/drm/sti/sti_hdmi_tx3g4c28phy.c

diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
index 79fdcb6..2bb3035 100644
--- a/drivers/gpu/drm/sti/Makefile
+++ b/drivers/gpu/drm/sti/Makefile
@@ -1,4 +1,9 @@
 ccflags-y := -Iinclude/drm

+stidrm-y := sti_hdmi.o \
+   sti_hdmi_tx3g0c55phy.o \
+   sti_hdmi_tx3g4c28phy.o
+
+obj-$(CONFIG_DRM_STI) += stidrm.o
 obj-$(CONFIG_VTAC_STI) += sti_vtac_tx.o sti_vtac_rx.o
 obj-$(CONFIG_VTG_STI) += sti_vtg.o sti_vtg_utils.o
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
new file mode 100644
index 000..5bbee6b
--- /dev/null
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -0,0 +1,503 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Author: Vincent Abriou  for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "sti_hdmi.h"
+#include "sti_vtg_utils.h"
+
+/* Reference to the hdmi device */
+struct device *hdmi_dev;
+
+/*
+ * Helper to write bit field
+ *
+ * @addr: register to update
+ * @val: value to write
+ * @mask: bit field mask to use
+ */
+static inline void hdmi_reg_writemask(void __iomem *addr, u32 val, u32 mask)
+{
+   u32 old = readl(addr);
+
+   val = (val & mask) | (old & ~mask);
+   writel(val, addr);
+}
+
+/*
+ * HDMI interrupt handler
+ *
+ * @irq: irq number
+ * @arg: connector structure
+ */
+static irqreturn_t hdmi_irq_thread(int irq, void *arg)
+{
+   struct sti_hdmi *hdmi = arg;
+   u32 status;
+
+   /* read interrupt status */
+   status = readl(hdmi->regs + HDMI_INT_STA);
+
+   /* PLL lock interrupt */
+   if (status & HDMI_INT_DLL_LCK) {
+   hdmi->event_received = true;
+   wake_up_interruptible(>wait_event);
+   }
+
+   /* Hot plug detection */
+   if (status & HDMI_INT_HOT_PLUG) {
+   hdmi->hpd = gpio_get_value(hdmi->hpd_gpio);
+   if (hdmi->drm_dev)
+   drm_helper_hpd_irq_event(hdmi->drm_dev);
+   }
+
+   /* Sw reset completed */
+   if (status & HDMI_INT_SW_RST) {
+   hdmi->event_received = true;
+   wake_up_interruptible(>wait_event);
+   }
+
+   /* clear interrupt status */
+   writel(status, hdmi->regs + HDMI_INT_CLR);
+
+   /* TODO: check why this sync bus write solves the problem which
+* is that without this line, the handler is sometimes called twice
+*/
+   /* sync bus write */
+   readl(hdmi->regs + HDMI_INT_STA);
+
+   return IRQ_HANDLED;
+}
+
+/*
+ * Start hdmi phy interface
+ *
+ * @hdmi: pointer on the hdmi internal structure
+ *
+ * Return -1 if error occurs
+ */
+static int hdmi_phy_start(struct sti_hdmi *hdmi)
+{
+   DRM_DEBUG_DRIVER("\n");
+
+   if (hdmi->tx3g0c55phy)
+   return sti_hdmi_tx3g0c55phy_start(hdmi);
+
+   return sti_hdmi_tx3g4c28phy_start(hdmi);
+}
+
+/*
+ * Stop hdmi phy interface
+ *
+ * @hdmi: pointer on the hdmi internal structure
+ */
+static void hdmi_phy_stop(struct sti_hdmi *hdmi)
+{
+   DRM_DEBUG_DRIVER("\n");
+
+   if (hdmi->tx3g0c55phy)
+   sti_hdmi_tx3g0c55phy_stop(hdmi);
+   else
+   sti_hdmi_tx3g4c28phy_stop(hdmi);
+}
+
+/*
+ * Set hdmi active area depending on the drm display mode selected
+ *
+ * @hdmi: pointer on the hdmi internal structure
+ */
+static void hdmi_active_area(struct sti_hdmi *hdmi)
+{
+   u32 xmin, xmax;
+   u32 ymin, ymax;
+
+   DRM_DEBUG_DRIVER("\n");
+
+   /*
+*   ActiveFrontSync   Back  Active
+*   RegionPorch  Porch  Region
+* <---><>0<-><><->
+*
+*   ///|   |  ///|
+*  /// |   | /// |
+* ///  |...|///  |
+*0___  x/ymin   x/ymax
+*
+* <--[hv]display--> <--[hv]display-->
+* 

[PATCH v1 03/19] drm: sti: add VTAC drivers

2014-04-08 Thread Benjamin Gaignard
Video Trafic Advance Communication Rx and Tx drivers are designed
for inter-die communication.

Both Tx and Rx must share the same configuration to communicate
that is why vtac_mode[] is shared in sti_vtac_utils.h.

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/Kconfig  |   6 ++
 drivers/gpu/drm/sti/Makefile |   1 +
 drivers/gpu/drm/sti/sti_vtac_rx.c| 140 
 drivers/gpu/drm/sti/sti_vtac_tx.c| 152 +++
 drivers/gpu/drm/sti/sti_vtac_utils.h |  52 
 5 files changed, 351 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/sti_vtac_rx.c
 create mode 100644 drivers/gpu/drm/sti/sti_vtac_tx.c
 create mode 100644 drivers/gpu/drm/sti/sti_vtac_utils.h

diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig
index b3c751c..e33b618 100644
--- a/drivers/gpu/drm/sti/Kconfig
+++ b/drivers/gpu/drm/sti/Kconfig
@@ -4,6 +4,12 @@ config DRM_STI
help
  Choose this option to enable DRM on STM stiH41x chipset

+config VTAC_STI
+   tristate "Video Trafic Advance Communication Rx and Tx for 
STMicroelectronics SoC stiH41x Series"
+   depends on DRM_STI
+   help
+ Choose this option to enable VTAC on STM stiH41x chipset
+
 config VTG_STI
tristate "Video Timing Generator for STMicroelectronics SoC stiH41x 
Series"
depends on DRM_STI
diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
index 33216e1..79fdcb6 100644
--- a/drivers/gpu/drm/sti/Makefile
+++ b/drivers/gpu/drm/sti/Makefile
@@ -1,3 +1,4 @@
 ccflags-y := -Iinclude/drm

+obj-$(CONFIG_VTAC_STI) += sti_vtac_tx.o sti_vtac_rx.o
 obj-$(CONFIG_VTG_STI) += sti_vtg.o sti_vtg_utils.o
diff --git a/drivers/gpu/drm/sti/sti_vtac_rx.c 
b/drivers/gpu/drm/sti/sti_vtac_rx.c
new file mode 100644
index 000..c089489
--- /dev/null
+++ b/drivers/gpu/drm/sti/sti_vtac_rx.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Author: Benjamin Gaignard  for 
STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "sti_vtac_utils.h"
+
+#define VTAC_RX_CONFIG 0x00
+#define VTAC_RX_FIFO_CONFIG0x04
+
+#define VTAC_SW_RST_AUTOC  0x02
+#define VTAC_FIFO_CONFIG_VAL   0x04
+
+/*
+ * VTAC RX structure
+ *
+ * @dev: pointer to device structure
+ * @regs: ioremapped regsiters
+ * @clk: clock
+ * @type: main or aux device
+ */
+struct sti_vtac_rx {
+   struct device *dev;
+   void __iomem *regs;
+   struct clk *clk;
+   int type;
+};
+
+static void sti_vtac_rx_reg_dump(struct sti_vtac_rx *vtac_rx)
+{
+   dev_dbg(vtac_rx->dev, "vtac_rx->regs %p\n", vtac_rx->regs);
+   dev_dbg(vtac_rx->dev, "VTAC_RX_CONFIG 0x%x\n",
+   readl(vtac_rx->regs + VTAC_RX_CONFIG));
+   dev_dbg(vtac_rx->dev, "VTAC_RX_FIFO_CONFIG 0x%x\n",
+   readl(vtac_rx->regs + VTAC_RX_FIFO_CONFIG));
+}
+
+static void sti_vtac_rx_set_config(struct sti_vtac_rx *vtac_rx)
+{
+   int i;
+   u32 rx_config = EVEN_PARITY | ODD_PARITY | SW_RST_AUTOC | ENABLE;
+
+   /* Enable VTAC clock */
+   if (clk_prepare_enable(vtac_rx->clk))
+   DRM_ERROR("Failed to prepare/enable vtac_rx clock.\n");
+
+   for (i = 0; i < ARRAY_SIZE(vtac_modes); i++) {
+   if (vtac_modes[i].type == vtac_rx->type) {
+   writel(VTAC_FIFO_CONFIG_VAL,
+  vtac_rx->regs + VTAC_RX_FIFO_CONFIG);
+   rx_config |= vtac_modes[i].vid_in_width << 4;
+   rx_config |= vtac_modes[i].phyts_width << 16;
+   rx_config |= vtac_modes[i].phyts_per_pixel << 23;
+   rx_config |= VTAC_SW_RST_AUTOC;
+   writel(rx_config, vtac_rx->regs + VTAC_RX_CONFIG);
+   }
+   }
+}
+
+static int sti_vtac_rx_probe(struct platform_device *pdev)
+{
+   struct device *dev = >dev;
+   struct device_node *np = dev->of_node;
+   struct sti_vtac_rx *vtac_rx;
+   struct resource *res;
+
+   vtac_rx = devm_kzalloc(dev, sizeof(*vtac_rx), GFP_KERNEL);
+   if (!vtac_rx) {
+   DRM_ERROR("Failed to allocate VTAC RX context\n");
+   return -ENOMEM;
+   }
+   vtac_rx->dev = dev;
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (!res) {
+   DRM_ERROR("Invalid resource\n");
+   return -ENOMEM;
+   }
+   vtac_rx->regs = devm_ioremap_resource(dev, res);
+   if (IS_ERR(vtac_rx->regs))
+   return PTR_ERR(vtac_rx->regs);
+
+   vtac_rx->type = VTAC_MAIN;
+   if (np)
+   if (of_property_read_bool(np, "vtac-rx-aux"))
+   vtac_rx->type = VTAC_AUX;
+
+   if (vtac_rx->type == VTAC_MAIN) {
+   vtac_rx->clk = 

[PATCH v1 02/19] drm: sti: add VTG driver

2014-04-08 Thread Benjamin Gaignard
Video Time Generator drivers are used to synchronize the compositor
and tvout hardware IPs by providing line count, sample count,
synchronization signals (HSYNC, VSYNC) and top and bottom fields indication.
VTG are used by pair for each data path (main or auxiliary): one for master and 
one for slave.

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 

---
 drivers/gpu/drm/Kconfig |   2 +
 drivers/gpu/drm/Makefile|   1 +
 drivers/gpu/drm/sti/Kconfig |  11 +
 drivers/gpu/drm/sti/Makefile|   3 +
 drivers/gpu/drm/sti/sti_vtg.c   | 430 
 drivers/gpu/drm/sti/sti_vtg.h   |  20 ++
 drivers/gpu/drm/sti/sti_vtg_utils.c |  99 +
 drivers/gpu/drm/sti/sti_vtg_utils.h |  26 +++
 8 files changed, 592 insertions(+)
 create mode 100644 drivers/gpu/drm/sti/Kconfig
 create mode 100644 drivers/gpu/drm/sti/Makefile
 create mode 100644 drivers/gpu/drm/sti/sti_vtg.c
 create mode 100644 drivers/gpu/drm/sti/sti_vtg.h
 create mode 100644 drivers/gpu/drm/sti/sti_vtg_utils.c
 create mode 100644 drivers/gpu/drm/sti/sti_vtg_utils.h

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index d1cc2f6..0e30029 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -201,3 +201,5 @@ source "drivers/gpu/drm/tegra/Kconfig"
 source "drivers/gpu/drm/panel/Kconfig"

 source "drivers/gpu/drm/bridge/Kconfig"
+
+source "drivers/gpu/drm/sti/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 5e792b0..44f7b17 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -61,6 +61,7 @@ obj-$(CONFIG_DRM_QXL) += qxl/
 obj-$(CONFIG_DRM_BOCHS) += bochs/
 obj-$(CONFIG_DRM_MSM) += msm/
 obj-$(CONFIG_DRM_TEGRA) += tegra/
+obj-$(CONFIG_DRM_STI) += sti/
 obj-y  += i2c/
 obj-y  += panel/
 obj-y  += bridge/
diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig
new file mode 100644
index 000..b3c751c
--- /dev/null
+++ b/drivers/gpu/drm/sti/Kconfig
@@ -0,0 +1,11 @@
+config DRM_STI
+   tristate "DRM Support for STMicroelectronics SoC stiH41x Series"
+   depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM)
+   help
+ Choose this option to enable DRM on STM stiH41x chipset
+
+config VTG_STI
+   tristate "Video Timing Generator for STMicroelectronics SoC stiH41x 
Series"
+   depends on DRM_STI
+   help
+ Choose this option to enable VTG on STM stiH41x chipset
diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
new file mode 100644
index 000..33216e1
--- /dev/null
+++ b/drivers/gpu/drm/sti/Makefile
@@ -0,0 +1,3 @@
+ccflags-y := -Iinclude/drm
+
+obj-$(CONFIG_VTG_STI) += sti_vtg.o sti_vtg_utils.o
diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c
new file mode 100644
index 000..d3514c1
--- /dev/null
+++ b/drivers/gpu/drm/sti/sti_vtg.c
@@ -0,0 +1,430 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2013
+ * Authors: Benjamin Gaignard 
+ *  Fabien Dessenne 
+ *  Vincent Abriou 
+ *  for STMicroelectronics.
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#include 
+#include 
+#include 
+
+#include "sti_vtg_utils.h"
+#include "sti_vtg.h"
+
+#define VTG_TYPE_MASTER 0
+#define VTG_TYPE_SLAVE_BY_EXT0  1
+
+/* registers offset */
+#define VTG_MODE   0x
+#define VTG_CLKLN  0x0008
+#define VTG_HLFLN  0x000C
+#define VTG_DRST_AUTOC 0x0010
+#define VTG_VID_TFO0x0040
+#define VTG_VID_TFS0x0044
+#define VTG_VID_BFO0x0048
+#define VTG_VID_BFS0x004C
+
+#define VTG_HOST_ITS   0x0078
+#define VTG_HOST_ITS_BCLR  0x007C
+#define VTG_HOST_ITM_BCLR  0x0088
+#define VTG_HOST_ITM_BSET  0x008C
+
+#define VTG_H_HD_1 0x00C0
+#define VTG_TOP_V_VD_1 0x00C4
+#define VTG_BOT_V_VD_1 0x00C8
+#define VTG_TOP_V_HD_1 0x00CC
+#define VTG_BOT_V_HD_1 0x00D0
+
+#define VTG_H_HD_2 0x00E0
+#define VTG_TOP_V_VD_2 0x00E4
+#define VTG_BOT_V_VD_2 0x00E8
+#define VTG_TOP_V_HD_2 0x00EC
+#define VTG_BOT_V_HD_2 0x00F0
+
+#define VTG_H_HD_3 0x0100
+#define VTG_TOP_V_VD_3 0x0104
+#define VTG_BOT_V_VD_3 0x0108
+#define VTG_TOP_V_HD_3 0x010C
+#define VTG_BOT_V_HD_3 0x0110
+
+/* IRQ mask */
+#define VTG_IRQ_MASK   ((1L<<1) | (1L<<0))
+
+/* Delay introduced by the AWG in nb of pixels */
+#define AWG_DELAY_HD(-9)
+#define AWG_DELAY_ED(-8)
+#define AWG_DELAY_SD(-7)
+
+static const struct of_device_id vtg_match_types[];
+
+/*
+ * STI VTG data structure
+ *
+ * @nb_reg: number of memory resources to register
+ * @reg_names: names of the memory resources to register
+ * @regs: ioremapped registers
+ */
+#define 

[PATCH v1 01/19] drm: sti: add bindings for DRM driver

2014-04-08 Thread Benjamin Gaignard
Add DRM/KMS driver bindings documentation.
Describe the required properties for each of the hardware IPs drivers.

Signed-off-by: Benjamin Gaignard 
Signed-off-by: Vincent Abriou 
Signed-off-by: Fabien Dessenne 
---
 .../devicetree/bindings/gpu/st,stih4xx.txt | 177 +
 1 file changed, 177 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpu/st,stih4xx.txt

diff --git a/Documentation/devicetree/bindings/gpu/st,stih4xx.txt 
b/Documentation/devicetree/bindings/gpu/st,stih4xx.txt
new file mode 100644
index 000..fe18ef1
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpu/st,stih4xx.txt
@@ -0,0 +1,177 @@
+STMicroelectronics stih4xx platforms
+
+- sti-compositor: frame compositor engine
+  Required properties:
+  - compatible: "st,stih-compositor"
+  - reg: Physical base address of the IP registers and length of memory mapped 
region.
+  - clocks: from common clock binding: handle hardware IP needed clocks, the
+number of clocks may depend of the SoC type.
+See ../clocks/clock-bindings.txt for details.
+  - clock-names: names of the clocks listed in clocks property in the same
+order.
+  - resets: resets to be used by the device
+See ../reset/reset.txt for details.
+  - reset-names: names of the resets listed in resets property in the same
+order.
+
+- sti-vtac: video timing advanced inter dye communication Rx and TX
+  Required properties:
+  - compatible: "st,stih-vtac-rx" or "st,stih-vtac-tx"
+  - reg: Physical base address of the IP registers and length of memory mapped 
region.
+  - reg-names: names of the mapped memory regions listed in regs property in
+the same order.
+  - clocks: from common clock binding: handle hardware IP needed clocks, the
+number of clocks may depend of the SoC type.
+See ../clocks/clock-bindings.txt for details.
+  - clock-names: names of the clocks listed in clocks property in the same
+order.
+  - vtac-rx-aux: Must be set to indicated that the device is dedicated to
+auxillary data path if not the device is used for main data path.
+  - vtac-tx-aux: Must be set to indicated that the device is dedicated to
+auxillary data path if not the device is used for main data path.
+
+- sti-vtg: video timing generator
+  Required properties:
+  - compatible: "st,stih-vtg"
+  - reg: Physical base address of the IP registers and length of memory mapped 
region.
+  - reg-names: names of the mapped memory regions listed in regs property in
+the same order.
+  - interrupts : VTG interrupt number to the CPU.
+  - interrupt-names: name of the interrupts listed in interrupts property in
+the same order.
+  - vtg-aux: Must be set to indicated that the device is dedicated to
+auxillary data path if not the device is used for main data path.
+
+- sti-tvout: video out hardware block
+  Required properties:
+  - compatible: "st,stih-tvout"
+  - reg: Physical base address of the IP registers and length of memory mapped 
region.
+  - reg-names: names of the mapped memory regions listed in regs property in
+the same order.
+  - resets: resets to be used by the device
+See ../reset/reset.txt for details.
+  - reset-names: names of the resets listed in resets property in the same
+order.
+  - ranges: to allow probing of subdevices
+
+- sti-hdmi: hdmi output block
+  Required properties:
+  - compatible: "st,stih-hdmi";
+  - reg: Physical base address of the IP registers and length of memory mapped 
region.
+  - reg-names: names of the mapped memory regions listed in regs property in
+the same order.
+  - interrupts : HDMI interrupt number to the CPU.
+  - interrupt-names: name of the interrupts listed in interrupts property in
+the same order
+  - clocks: from common clock binding: handle hardware IP needed clocks, the
+number of clocks may depend of the SoC type.
+  - clock-names: names of the clocks listed in clocks property in the same
+order.
+  - hdmi,hpd-gpio: gpio id to detect if an hdmi cable is plugged or not.
+
+sti-hda:
+  Required properties:
+  - compatible: "st,stih-hda"
+  - reg: Physical base address of the IP registers and length of memory mapped 
region.
+  - reg-names: names of the mapped memory regions listed in regs property in
+the same order.
+  - clocks: from common clock binding: handle hardware IP needed clocks, the
+number of clocks may depend of the SoC type.
+See ../clocks/clock-bindings.txt for details.
+  - clock-names: names of the clocks listed in clocks property in the same
+order.
+
+Example:
+
+/ {
+   ...
+
+   sti-compositor at fd34 {
+   compatible  = "st,stih416-compositor";
+   reg = <0xfd34 0x1000>;
+   clock-names = "compo_main", "compo_aux",
+ "pix_main", "pix_aux";
+   clocks  = <_M_A2_DIV1 CLK_M_COMPO_MAIN>, 
<_M_A2_DIV1 CLK_M_COMPO_AUX>,
+ 

[PATCH v1 00/19] Add DRM for stih4xx platforms

2014-04-08 Thread Benjamin Gaignard
This series of patches add the support of DRM/KMS drivers for STMicroelectronics
chipsets stih416 and stih407.

Hardware is split in two main blocks: Compositor and TVout. Each of them
includes specific hardware IPs and the display timing are controlled by a 
specific
Video Timing Generator hardware IP (VTG).

Compositor is made of the follow hardware IPs:
 - GDP (Generic Display Pipeline) which is an entry point for graphic (RGB)
   buffers
 - VDP (Video Diplay Pipeline) which is an entry point for video (YUV) buffers
 - HQVDP (High Quality Video Display Processor) that supports scaling,
   deinterlacing and some miscellaneous image quality improvements.
   It fetches the Video decoded buffers from memory, processes them and pushes
   them to the Compositor through a HW dedicated bus.
 - Mixer is responsible of mixing all the entries depending of their
   respective z-order and layout

TVout is divided in 3 parts:
 - HDMI to generate HDMI signals, depending of chipset version HDMI phy can
   change.
 - HDA to generate signals for HD analog TV
 - VIP to control/switch data path coming from Compositor

On stih416 compositor and Tvout are on different dies so a Video Trafic Advance
inter-die Communication mechanism (VTAC) is needed.

+-+   
++
| +---+   ++  |   |  ++   
+--+ |
| |   |   ||  |   |  ||   |  +-+
 ++  | |
| | ++  +--+  |   ||  |   |  ||   |  | VIP 
|>|HDMI|  | |
| | |GPD +->|  |  |   ||  |   |  ||   |  | |
 ++  | |
| | ++  |Mixer |--|-->||  |   |  ||---|->| switcher|
 | |
| | |  |  |   ||  |   |  ||   |  | |
 ++  | |
| | |  |  |   ||  |   |  ||   |  | 
|>|HDA |  | |
| | +--+  |   |VTAC|>|VTAC|   |  +-+
 ++  | |
| |   |   ||  |   |  ||   | 
 | |
| | Compositor|   ||  |   |  ||   |   TVout 
 | |
| +---+   ||  |   |  ||   
+--+ |
|  ^  ||  |   |  || ^   
   |
|  |  ||  |   |  || |   
   |
|   +--+  ||  |   |  ||  
+-+   |
|   | VTG (master) |->||  |   |  ||->| VTG (slave) 
|   |
|   +--+  ++  |   |  ++  
+-+   |
|Digital die  |   | 
 Analog Die|
+-+   
++

On stih407 Compositor and Tvout are on the same die

+-+
| +---+  +--+ |
| |   |  |  +-+ ++  | |
| | ++  +--+  |  |  | VIP |>|HDMI|  | |
| | |GPD +->|  |  |  |  | | ++  | |
| | ++  |Mixer |--|--|->| switcher| | |
| | ++   +-+|  |  |  |  | | ++  | |
| | |VDP +-->+HQVDP+--->|  |  |  |  | |>|HDA |  | |
| | ++   +-++--+  |  |  +-+ ++  | |
| |   |  |  | |
| | Compositor|  |   TVout  | |
| +---+  +--+ |
|  ^^ |
|  || |
|   +--+  |
|   | VTG  |  |
|   +--+  |
|Digital die  |
+-+

In addition of the drivers for the IPs listed before a thin I2C driver 
(hdmiddc) is used
by HDMI driver to retrieve EDID for monitor.

To unify interfaces of GDP and VDP we create a "layer" interface called by
compositor to control both GPD and VDP.

Hardware have memory contraints (alignment, contiguous) so we use CMA drm 
helpers functions
to allocate frame buffer.

File naming convention is:
 - sti_* for IPs drivers
 - sti_drm_* for drm functions implementation.

Benjamin Gaignard (18):
  drm: sti: add bindings for DRM driver
  drm: sti: add VTG driver
  drm: sti: add VTAC drivers
  drm: sti: add HDMI 

[Bug 77009] 24P playback video signal loss with latest DRI patches

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=77009

--- Comment #25 from Manp  ---
(In reply to comment #0)

i seem to be facing the issue described here:

software setup is openelec r18117

using the GPU integrated inside my A8-3870K the video play fine, TV reports
24p, xbmc-xrandr reports 23,976
http://sprunge.us/cGOc
http://sprunge.us/VMjU

same setup but with GPU integrated in the APU disabled and using a discrete
HD6450, TV shows no signal
http://sprunge.us/JBgc
http://sprunge.us/UXMV

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


[Bug 77009] 24P playback video signal loss with latest DRI patches

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=77009

--- Comment #24 from Christian K?nig  ---
(In reply to comment #22)
> I am trying to understand the plls.

Well how deep are you interested in getting into this? PLLs can be complicated,
but are also one of the very basic building blocks of electronics.

> I read the org. bug report 76564.  I
> assumed increasing the max would allow higher pll vals.  But it does go down
> with some.  Does that make sense?  

More or less yes. See your numbers for example, without the limit patch you had
the params like this:

148340 - 14834, pll dividers - fb: 741.7 ref: 50, post 10

This means with a feedback divider of 741.7, a referenz divider of 50 and a
post divider of 10 you have an exact match for the frequency.

There is just the little problem that as the divider numbers get higher the
signal gets more unstable. So in reality you don't get 148.340 MHz, but instead
something that fluctuates between 148.339 MHz and 148.341 MHz (for example).

The overall match for the average frequency is still better than with lower
numbers, but your TV/Monitor can't deal with such high fluctuations in it.

> Your patch does wonders for this A4-3400.  I am trying to understand it
> better.
> 
> Here your max is 100.  ref: 10, post 10  >>>> 10 * 10 = 100 max.

Yes correct.

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


[PATCH V2] DRM: Armada: Use devm_ioremap_resource()

2014-04-08 Thread Jingoo Han
Use devm_ioremap_resource() because devm_request_and_ioremap() is
obsoleted by devm_ioremap_resource().

Signed-off-by: Jingoo Han 
---
Changes since v1:
- remove unnecessary error message, because devm_ioremap_resource()
  already prints one in all failure cases.

 drivers/gpu/drm/armada/armada_crtc.c |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_crtc.c 
b/drivers/gpu/drm/armada/armada_crtc.c
index 5831e41..0bcce78 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -1038,11 +1038,9 @@ int armada_drm_crtc_create(struct drm_device *dev, 
unsigned num,
if (ret)
return ret;

-   base = devm_request_and_ioremap(dev->dev, res);
-   if (!base) {
-   DRM_ERROR("failed to ioremap register\n");
-   return -ENOMEM;
-   }
+   base = devm_ioremap_resource(dev->dev, res);
+   if (IS_ERR(base))
+   return PTR_ERR(base);

dcrtc = kzalloc(sizeof(*dcrtc), GFP_KERNEL);
if (!dcrtc) {
-- 
1.7.10.4




[Bug 66963] Rv6xx dpm problems

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=66963

--- Comment #211 from lockheed  ---
(In reply to comment #210)
> I note, the GPU never recovers, when it attempts to Xorg is basically
> frozen, I can VT switch to console but sometimes switching back to X it
> deadlocks completely.
>

You are lucky. I can't recall a single instance where I could switch to VT when
EQ starts overflowing.

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


[Bug 66963] Rv6xx dpm problems

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=66963

--- Comment #210 from Shawn Starr  ---
It's same for me, I can have several days of stability on my W500 w/ RV636 (HD
3650) and then GPU reset.

I note, the GPU never recovers, when it attempts to Xorg is basically frozen, I
can VT switch to console but sometimes switching back to X it deadlocks
completely.

I do recall eariler in 3.x GPU reset worked and it would recover. Now, it's a
lost cause.

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


[PATCH v12][ 03/12] imx-drm: Correct BGR666 and the board's dts that use them.

2014-04-08 Thread Russell King - ARM Linux
On Mon, Apr 07, 2014 at 02:44:42PM +0200, Denis Carikli wrote:
>  arch/arm/boot/dts/imx51-apf51dev.dts|2 +-
>  arch/arm/boot/dts/imx53-m53evk.dts  |2 +-
>  drivers/staging/imx-drm/imx-ldb.c   |4 ++--
>  drivers/staging/imx-drm/ipu-v3/ipu-dc.c |4 ++--
>  4 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/imx51-apf51dev.dts 
> b/arch/arm/boot/dts/imx51-apf51dev.dts
> index c5a9a24..7b3851d 100644
> --- a/arch/arm/boot/dts/imx51-apf51dev.dts
> +++ b/arch/arm/boot/dts/imx51-apf51dev.dts
> @@ -18,7 +18,7 @@
>  
>   display at di1 {
>   compatible = "fsl,imx-parallel-display";
> - interface-pix-fmt = "bgr666";
> + interface-pix-fmt = "rgb666";

...

>   /* bgr666 */
>   ipu_dc_map_clear(priv, IPU_DC_MAP_BGR666);
> - ipu_dc_map_config(priv, IPU_DC_MAP_BGR666, 0, 5, 0xfc); /* blue */
> + ipu_dc_map_config(priv, IPU_DC_MAP_BGR666, 0, 17, 0xfc); /* blue */
>   ipu_dc_map_config(priv, IPU_DC_MAP_BGR666, 1, 11, 0xfc); /* green */
> - ipu_dc_map_config(priv, IPU_DC_MAP_BGR666, 2, 17, 0xfc); /* red */
> + ipu_dc_map_config(priv, IPU_DC_MAP_BGR666, 2, 5, 0xfc); /* red */

arm-soc people have become very obtuse with respect to changes to any
patches to arch/arm/boot/dts, and complain loudly if any changes to
that directory do not go through them as separate patches.

What this means is that your patch is unacceptable and needs to be split
up.

The choices seem to be to either break imx-drm by splitting the patch in
two, thereby ending up with the two dependent changes being merged
entirely separate, resulting in breakage while one or other is merged,
or to add the RGB666 support, wait for that to hit mainline, then
update the DT files, wait for that to hit mainline, then fix the BGR666
support.  That'll take around six to nine months (two to three months
per release cycle.)

Or arm-soc could come to their senses and realise that they do not have
sole ownership over arch/arm/boot/dts.

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.


[PATCH] drm/radeon: Improve vramlimit module param documentation

2014-04-08 Thread Lauri Kasanen
Signed-off-by: Lauri Kasanen 
---
 drivers/gpu/drm/radeon/radeon_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index d0eba48..cf2721a 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -186,7 +186,7 @@ module_param_named(dynclks, radeon_dynclks, int, 0444);
 MODULE_PARM_DESC(r4xx_atom, "Enable ATOMBIOS modesetting for R4xx");
 module_param_named(r4xx_atom, radeon_r4xx_atom, int, 0444);

-MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing");
+MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
 module_param_named(vramlimit, radeon_vram_limit, int, 0600);

 MODULE_PARM_DESC(agpmode, "AGP Mode (-1 == PCI)");
-- 
1.8.3.1



[PATCH] DRM: Armada: Use devm_ioremap_resource()

2014-04-08 Thread Jingoo Han
On Monday, April 07, 2014 7:53 PM, Thierry Reding wrote:
> On Thu, Apr 03, 2014 at 09:31:04AM +0900, Jingoo Han wrote:
> > Use devm_ioremap_resource() because devm_request_and_ioremap() is
> > obsoleted by devm_ioremap_resource().
> >
> > Signed-off-by: Jingoo Han 
> > ---
> >  drivers/gpu/drm/armada/armada_crtc.c |6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/armada/armada_crtc.c 
> > b/drivers/gpu/drm/armada/armada_crtc.c
> > index d8e3982..23b0123 100644
> > --- a/drivers/gpu/drm/armada/armada_crtc.c
> > +++ b/drivers/gpu/drm/armada/armada_crtc.c
> > @@ -1037,10 +1037,10 @@ int armada_drm_crtc_create(struct drm_device *dev, 
> > unsigned num,
> > if (ret)
> > return ret;
> >
> > -   base = devm_request_and_ioremap(dev->dev, res);
> > -   if (!base) {
> > +   base = devm_ioremap_resource(dev->dev, res);
> > +   if (IS_ERR(base)) {
> > DRM_ERROR("failed to ioremap register\n");
> > -   return -ENOMEM;
> > +   return PTR_ERR(base);
> 
> While at it, perhaps you should drop the error message too because
> devm_ioremap_resource() already prints one in all failure cases.

Oh, right! It is my mistake. I will remove the error message.
Thank you for your comment.

Best regards,
Jingoo Han



[Bug 77009] 24P playback video signal loss with latest DRI patches

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=77009

--- Comment #23 from Christian K?nig  ---
(In reply to comment #21)
> Created attachment 97043 [details]
> 368 and others dmesg
> 
> >Garrett, please stop trying to merge the patches. Since the initial change 
> >is >already upsteram we are going to need to fix it in a separate patch 
> >anyway.
> 
> Sorry.  New to this FOSS stuff.  OE is a complete OS download with local
> code not pulling from mainline kernels (from what I can tell).  It was
> tricky for me to patch it.  I am trying to be transparent so others can
> reproduce my results easily.

No problem at all and keeping it reproducible is indeed a good intention. I
just wanted to avoid that you spend time on unnecessary stuff.

> What I don't understand is the pll numbers go
> up and down, despite having the higher max vals.  This concerns me..

Well that is simple to explain. Assum that you have a feedback to ref divider
ratio of 100/11. This ratio can't be reduced any more without lossing
precission.

Now we also assume to the ref divider maximum is 10, so after limiting the ref
divider to 10 we end up with a ratio of 90/10. Now 90 to 10 can be reduced
easily to 9/1. So in the end we end up with a far lower ration because of the
reference divider limit.

> Hope it helps.

Yeah, your numbers indeed helped a bit, thanks.

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


[Bug 65141] Blank screen after resume with radeon driver

2014-04-08 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=65141

--- Comment #5 from Andreas Wiener  ---
Created attachment 131721
  --> https://bugzilla.kernel.org/attachment.cgi?id=131721=edit
dmesg after suspend

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Bug 65141] Blank screen after resume with radeon driver

2014-04-08 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=65141

--- Comment #4 from Andreas Wiener  ---
Created attachment 131711
  --> https://bugzilla.kernel.org/attachment.cgi?id=131711=edit
dmesg befor suspend

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Bug 65141] Blank screen after resume with radeon driver

2014-04-08 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=65141

Andreas Wiener  changed:

   What|Removed |Added

 CC||aw at corti.de

--- Comment #3 from Andreas Wiener  ---
Hi, I am experiencing the same issue with an AMD A6 CPU. I tried with 3.13 and
now 3.14 kernel but the problem persists. I am also running opensuse 13.1.

I attached my dmesg before and after with drm.debug=0x0e. Please let me know if
I can help with additional information.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Bug 77002] hdmi audio problems with 3.14

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=77002

--- Comment #24 from bgunteriv at gmail.com ---
(In reply to comment #23)
> I'd rather revert the commit in this case.  Changing the assignment order
> has a significant risk of breakage with other weird controllers.
> 
> Could you confirm that just reverting the commit fixes the problem?  Once
> after it's confirmed, I'll submit a fix revert patch for 3.14.x.  Thanks.

The patch worked... reverting did not.
although, again, i'm not positive i've done it correctly.

if you read my post above, it explains my steps. 
if i did it correctly, then no, reverting does not solve the problem.

I do see warnings when my system boots up about:
bad taints
in both drm and kvm modules.

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


[Bug 72831] System hangs with kernel 3.13+ and AMD 4550

2014-04-08 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=72831

Alex Deucher  changed:

   What|Removed |Added

 CC||alexdeucher at gmail.com

--- Comment #1 from Alex Deucher  ---
Does appending radeon.runpm=0 to the kernel command line in grub fix the
problem?  Any chance you could bisect?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[PATCH] drm/panel/ld9040: add power control sequence

2014-04-08 Thread Andrzej Hajda
Some ld9040 panels do not start without providing power control sequence
during initialization. The patch fixes the driver by providing such
sequence for all panels.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/panel/panel-ld9040.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-ld9040.c 
b/drivers/gpu/drm/panel/panel-ld9040.c
index 1f1f837..db1601f 100644
--- a/drivers/gpu/drm/panel/panel-ld9040.c
+++ b/drivers/gpu/drm/panel/panel-ld9040.c
@@ -27,6 +27,7 @@
 #define MCS_ELVSS_ON   0xb1
 #define MCS_USER_SETTING   0xf0
 #define MCS_DISPCTL0xf2
+#define MCS_POWER_CTRL 0xf4
 #define MCS_GTCON  0xf7
 #define MCS_PANEL_CONDITION0xf8
 #define MCS_GAMMA_SET1 0xf9
@@ -182,6 +183,8 @@ static void ld9040_init(struct ld9040 *ctx)
ld9040_dcs_write_seq_static(ctx, MCS_DISPCTL,
0x02, 0x08, 0x08, 0x10, 0x10);
ld9040_dcs_write_seq_static(ctx, MCS_MANPWR, 0x04);
+   ld9040_dcs_write_seq_static(ctx, MCS_POWER_CTRL,
+   0x0a, 0x87, 0x25, 0x6a, 0x44, 0x02, 0x88);
ld9040_dcs_write_seq_static(ctx, MCS_ELVSS_ON, 0x0d, 0x00, 0x16);
ld9040_dcs_write_seq_static(ctx, MCS_GTCON, 0x09, 0x00, 0x00);
ld9040_brightness_set(ctx);
-- 
1.8.3.2



[PATCH v12][ 07/12] drm: drm_display_mode: add signal polarity flags

2014-04-08 Thread Andrzej Hajda
On 04/08/2014 10:08 AM, Denis Carikli wrote:
> On 04/08/2014 08:36 AM, Andrzej Hajda wrote:
>>
>> Hi Denis,
> Hi,
> 
>>> +#define DRM_MODE_FLAG_POL_PIXDATA_NEGEDGE  BIT(1)
>>> +#define DRM_MODE_FLAG_POL_PIXDATA_POSEDGE  BIT(2)
>>> +#define DRM_MODE_FLAG_POL_PIXDATA_PRESERVE BIT(3)
>>
>> What is the purpose of DRM_MODE_FLAG_POL_PIXDATA_PRESERVE?
>> If 'preserve' means 'ignore' we can set to zero negedge and posedge bits
>> instead of adding new bit. If it is something different please describe it.
> Yes, it meant 'ignore'.
> 
> The goal was to be able to have a way to keep the old behavior while 
> still being able to set the flags.
> 
> So, with the imx-drm driver, if none of the DRM_MODE_FLAG_POL_PIXDATA 
> were set(that is POSEDGE, NEGEDGE, PRESERVE), then in ipuv3-crtc.c, it 
> went using the old flags settings that were previously hardcoded.
> 
> The same applied for DRM_MODE_FLAG_POL_DE.
> The patch using theses flags is the 08/12 of this same serie.

So as I understand you want to:
- do not change hw polarity settings by using preserve bit,
- keep the old behavior of the driver by setting all bits to zero.

I think this is the issue of the specific driver, and it should not
influence core structs.

I am not familiar with imx but I guess it should not be a problem
to solve the issue in the driver.

> 
>>>   struct drm_display_mode {
> [..]
>>> +   unsigned int pol_flags;
>>
>> Adding field and macros description to the DocBook would be nice.
> So I will have to describe it in the "Connector Helper Operations" 
> section of drm.tmpl, right before the mode_valid synopsis ?

Yes, I think so.

Andrzej

> 
> Denis.
> 



[PATCH] drm/radeon: fix audio pin counts for DCE6+

2014-04-08 Thread Alex Deucher
On Tue, Apr 8, 2014 at 11:23 AM, Jerome Glisse  wrote:
> On Mon, Apr 07, 2014 at 04:17:21PM -0400, Alex Deucher wrote:
>> There is actually quite a bit of variance based on
>> the asic.
>>
>> Signed-off-by: Alex Deucher 
>> Cc: stable at vger.kernel.org
>> ---
>>  drivers/gpu/drm/radeon/dce6_afmt.c | 14 ++
>>  drivers/gpu/drm/radeon/radeon.h|  5 -
>>  2 files changed, 14 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c 
>> b/drivers/gpu/drm/radeon/dce6_afmt.c
>> index 8595449..38766aa 100644
>> --- a/drivers/gpu/drm/radeon/dce6_afmt.c
>> +++ b/drivers/gpu/drm/radeon/dce6_afmt.c
>> @@ -309,11 +309,17 @@ int dce6_audio_init(struct radeon_device *rdev)
>>
>>   rdev->audio.enabled = true;
>>
>> - if (ASIC_IS_DCE8(rdev))
>> - rdev->audio.num_pins = 6;
>> - else if (ASIC_IS_DCE61(rdev))
>> + if (ASIC_IS_DCE81(rdev)) /* KV: 4 streams, 7 endpoints */
>> + rdev->audio.num_pins = 7;
>> + else if (ASIC_IS_DCE83(rdev)) /* KB: 2 streams, 3 endpoints */
>>   rdev->audio.num_pins = 4;
>> - else
>
> This looks bogus, comment says 3 endpoint bit code set 4

Good catch.  fixed up version sent out.

Thanks!

Alex

>
> Cheers,
> Jerome
>
>> + else if (ASIC_IS_DCE8(rdev)) /* BN/HW: 6 streams, 7 endpoints */
>> + rdev->audio.num_pins = 7;
>> + else if (ASIC_IS_DCE61(rdev)) /* TN: 4 streams, 6 endpoints */
>> + rdev->audio.num_pins = 6;
>> + else if (ASIC_IS_DCE64(rdev)) /* OL: 2 streams, 2 endpoints */
>> + rdev->audio.num_pins = 2;
>> + else /* SI: 6 streams, 6 endpoints */
>>   rdev->audio.num_pins = 6;
>>
>>   for (i = 0; i < rdev->audio.num_pins; i++) {
>> diff --git a/drivers/gpu/drm/radeon/radeon.h 
>> b/drivers/gpu/drm/radeon/radeon.h
>> index 7a07ec8..f0fc2c8 100644
>> --- a/drivers/gpu/drm/radeon/radeon.h
>> +++ b/drivers/gpu/drm/radeon/radeon.h
>> @@ -736,7 +736,7 @@ union radeon_irq_stat_regs {
>>   struct cik_irq_stat_regs cik;
>>  };
>>
>> -#define RADEON_MAX_HPD_PINS 6
>> +#define RADEON_MAX_HPD_PINS 7
>>  #define RADEON_MAX_CRTCS 6
>>  #define RADEON_MAX_AFMT_BLOCKS 7
>>
>> @@ -2628,6 +2628,9 @@ void r100_pll_errata_after_index(struct radeon_device 
>> *rdev);
>>  #define ASIC_IS_DCE64(rdev) ((rdev->family == CHIP_OLAND))
>>  #define ASIC_IS_NODCE(rdev) ((rdev->family == CHIP_HAINAN))
>>  #define ASIC_IS_DCE8(rdev) ((rdev->family >= CHIP_BONAIRE))
>> +#define ASIC_IS_DCE81(rdev) ((rdev->family == CHIP_KAVERI))
>> +#define ASIC_IS_DCE82(rdev) ((rdev->family == CHIP_BONAIRE))
>> +#define ASIC_IS_DCE83(rdev) ((rdev->family == CHIP_KABINI))
>>
>>  #define ASIC_IS_LOMBOK(rdev) ((rdev->ddev->pdev->device == 0x6849) || \
>> (rdev->ddev->pdev->device == 0x6850) || \
>> --
>> 1.8.3.1
>>
>> ___
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/radeon: fix audio pin counts for DCE6+ (v2)

2014-04-08 Thread Alex Deucher
There is actually quite a bit of variance based on
the asic.

v2: fix typo noticed by Jerome.

Signed-off-by: Alex Deucher 
Cc: stable at vger.kernel.org
---
 drivers/gpu/drm/radeon/dce6_afmt.c | 14 ++
 drivers/gpu/drm/radeon/radeon.h|  5 -
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c 
b/drivers/gpu/drm/radeon/dce6_afmt.c
index 94e8587..0a65dc7 100644
--- a/drivers/gpu/drm/radeon/dce6_afmt.c
+++ b/drivers/gpu/drm/radeon/dce6_afmt.c
@@ -309,11 +309,17 @@ int dce6_audio_init(struct radeon_device *rdev)

rdev->audio.enabled = true;

-   if (ASIC_IS_DCE8(rdev))
+   if (ASIC_IS_DCE81(rdev)) /* KV: 4 streams, 7 endpoints */
+   rdev->audio.num_pins = 7;
+   else if (ASIC_IS_DCE83(rdev)) /* KB: 2 streams, 3 endpoints */
+   rdev->audio.num_pins = 3;
+   else if (ASIC_IS_DCE8(rdev)) /* BN/HW: 6 streams, 7 endpoints */
+   rdev->audio.num_pins = 7;
+   else if (ASIC_IS_DCE61(rdev)) /* TN: 4 streams, 6 endpoints */
rdev->audio.num_pins = 6;
-   else if (ASIC_IS_DCE61(rdev))
-   rdev->audio.num_pins = 4;
-   else
+   else if (ASIC_IS_DCE64(rdev)) /* OL: 2 streams, 2 endpoints */
+   rdev->audio.num_pins = 2;
+   else /* SI: 6 streams, 6 endpoints */
rdev->audio.num_pins = 6;

for (i = 0; i < rdev->audio.num_pins; i++) {
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 7a07ec8..f0fc2c8 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -736,7 +736,7 @@ union radeon_irq_stat_regs {
struct cik_irq_stat_regs cik;
 };

-#define RADEON_MAX_HPD_PINS 6
+#define RADEON_MAX_HPD_PINS 7
 #define RADEON_MAX_CRTCS 6
 #define RADEON_MAX_AFMT_BLOCKS 7

@@ -2628,6 +2628,9 @@ void r100_pll_errata_after_index(struct radeon_device 
*rdev);
 #define ASIC_IS_DCE64(rdev) ((rdev->family == CHIP_OLAND))
 #define ASIC_IS_NODCE(rdev) ((rdev->family == CHIP_HAINAN))
 #define ASIC_IS_DCE8(rdev) ((rdev->family >= CHIP_BONAIRE))
+#define ASIC_IS_DCE81(rdev) ((rdev->family == CHIP_KAVERI))
+#define ASIC_IS_DCE82(rdev) ((rdev->family == CHIP_BONAIRE))
+#define ASIC_IS_DCE83(rdev) ((rdev->family == CHIP_KABINI))

 #define ASIC_IS_LOMBOK(rdev) ((rdev->ddev->pdev->device == 0x6849) || \
  (rdev->ddev->pdev->device == 0x6850) || \
-- 
1.8.3.1



[PATCH] drm/radeon: fix audio pin counts for DCE6+

2014-04-08 Thread Jerome Glisse
On Mon, Apr 07, 2014 at 04:17:21PM -0400, Alex Deucher wrote:
> There is actually quite a bit of variance based on
> the asic.
> 
> Signed-off-by: Alex Deucher 
> Cc: stable at vger.kernel.org
> ---
>  drivers/gpu/drm/radeon/dce6_afmt.c | 14 ++
>  drivers/gpu/drm/radeon/radeon.h|  5 -
>  2 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c 
> b/drivers/gpu/drm/radeon/dce6_afmt.c
> index 8595449..38766aa 100644
> --- a/drivers/gpu/drm/radeon/dce6_afmt.c
> +++ b/drivers/gpu/drm/radeon/dce6_afmt.c
> @@ -309,11 +309,17 @@ int dce6_audio_init(struct radeon_device *rdev)
>  
>   rdev->audio.enabled = true;
>  
> - if (ASIC_IS_DCE8(rdev))
> - rdev->audio.num_pins = 6;
> - else if (ASIC_IS_DCE61(rdev))
> + if (ASIC_IS_DCE81(rdev)) /* KV: 4 streams, 7 endpoints */
> + rdev->audio.num_pins = 7;
> + else if (ASIC_IS_DCE83(rdev)) /* KB: 2 streams, 3 endpoints */
>   rdev->audio.num_pins = 4;
> - else

This looks bogus, comment says 3 endpoint bit code set 4

Cheers,
Jerome

> + else if (ASIC_IS_DCE8(rdev)) /* BN/HW: 6 streams, 7 endpoints */
> + rdev->audio.num_pins = 7;
> + else if (ASIC_IS_DCE61(rdev)) /* TN: 4 streams, 6 endpoints */
> + rdev->audio.num_pins = 6;
> + else if (ASIC_IS_DCE64(rdev)) /* OL: 2 streams, 2 endpoints */
> + rdev->audio.num_pins = 2;
> + else /* SI: 6 streams, 6 endpoints */
>   rdev->audio.num_pins = 6;
>  
>   for (i = 0; i < rdev->audio.num_pins; i++) {
> diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
> index 7a07ec8..f0fc2c8 100644
> --- a/drivers/gpu/drm/radeon/radeon.h
> +++ b/drivers/gpu/drm/radeon/radeon.h
> @@ -736,7 +736,7 @@ union radeon_irq_stat_regs {
>   struct cik_irq_stat_regs cik;
>  };
>  
> -#define RADEON_MAX_HPD_PINS 6
> +#define RADEON_MAX_HPD_PINS 7
>  #define RADEON_MAX_CRTCS 6
>  #define RADEON_MAX_AFMT_BLOCKS 7
>  
> @@ -2628,6 +2628,9 @@ void r100_pll_errata_after_index(struct radeon_device 
> *rdev);
>  #define ASIC_IS_DCE64(rdev) ((rdev->family == CHIP_OLAND))
>  #define ASIC_IS_NODCE(rdev) ((rdev->family == CHIP_HAINAN))
>  #define ASIC_IS_DCE8(rdev) ((rdev->family >= CHIP_BONAIRE))
> +#define ASIC_IS_DCE81(rdev) ((rdev->family == CHIP_KAVERI))
> +#define ASIC_IS_DCE82(rdev) ((rdev->family == CHIP_BONAIRE))
> +#define ASIC_IS_DCE83(rdev) ((rdev->family == CHIP_KABINI))
>  
>  #define ASIC_IS_LOMBOK(rdev) ((rdev->ddev->pdev->device == 0x6849) || \
> (rdev->ddev->pdev->device == 0x6850) || \
> -- 
> 1.8.3.1
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/radeon: Improve vramlimit module param documentation

2014-04-08 Thread Alex Deucher
On Tue, Apr 8, 2014 at 6:39 AM, Lauri Kasanen  wrote:
> Signed-off-by: Lauri Kasanen 

Reviewed-by: Alex Deucher 

> ---
>  drivers/gpu/drm/radeon/radeon_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
> b/drivers/gpu/drm/radeon/radeon_drv.c
> index d0eba48..cf2721a 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -186,7 +186,7 @@ module_param_named(dynclks, radeon_dynclks, int, 0444);
>  MODULE_PARM_DESC(r4xx_atom, "Enable ATOMBIOS modesetting for R4xx");
>  module_param_named(r4xx_atom, radeon_r4xx_atom, int, 0444);
>
> -MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing");
> +MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
>  module_param_named(vramlimit, radeon_vram_limit, int, 0600);
>
>  MODULE_PARM_DESC(agpmode, "AGP Mode (-1 == PCI)");
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 72831] System hangs with kernel 3.13+ and AMD 4550

2014-04-08 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=72831

Alan  changed:

   What|Removed |Added

 CC||alan at lxorguk.ukuu.org.uk
  Component|Video(Other)|Video(DRI - non Intel)
   Assignee|drivers_video-other at kernel- |drivers_video-dri at 
kernel-bu
   |bugs.osdl.org   |gs.osdl.org

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Bug 73041] radeon: not responding, "atombios stuck in loop"

2014-04-08 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=73041

Alan  changed:

   What|Removed |Added

   Assignee|drivers_pci at kernel-bugs.osd |drivers_video-dri at 
kernel-bu
   |l.org   |gs.osdl.org
 CC||alan at lxorguk.ukuu.org.uk
  Component|PCI |Video(DRI - non Intel)

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[PATCH] drm/mm: Don't WARN if drm_mm_reserve_node

2014-04-08 Thread Ben Widawsky
On Mon, Apr 07, 2014 at 10:13:13PM -0700, Jesse Barnes wrote:
> On Mon,  7 Apr 2014 23:25:20 +0200
> Daniel Vetter  wrote:
> 
> > Jesse's BIOS fb reconstruction code actually relies on the -ENOSPC
> > return value to detect overlapping framebuffers (which the bios uses
> > always when lighting up more than one screen). All this fanciness
> > happens in intel_alloc_plane_obj in intel_display.c.
> > 
> > Since no one else uses this we can savely remove the WARN without
> > repercursions.
> > 
> > Reported-by: Ben Widawsky 
> > Cc: Ben Widawsky 
> > Cc: Jesse Barnes 
> > Cc: Dave Airlie 
> > Signed-off-by: Daniel Vetter 
> > ---
> >  drivers/gpu/drm/drm_mm.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
> > index a2d45b748f86..e4dfd5c3b15e 100644
> > --- a/drivers/gpu/drm/drm_mm.c
> > +++ b/drivers/gpu/drm/drm_mm.c
> > @@ -192,8 +192,6 @@ int drm_mm_reserve_node(struct drm_mm *mm, struct 
> > drm_mm_node *node)
> > return 0;
> > }
> >  
> > -   WARN(1, "no hole found for node 0x%lx + 0x%lx\n",
> > -node->start, node->size);
> > return -ENOSPC;
> >  }
> >  EXPORT_SYMBOL(drm_mm_reserve_node);
> 
> Yeah thanks, pushing this has been on my list for weeks now...

I am not convinced this is the correct solution. At least the way we
used this interface, it isn't meant to ever fail.  I also didn't look
into exactly why we depend an ENOSPC return. That sounds fragile to me,
especially for a public interface.

Obviously it makes the WARN go away, and we have only one other user of
the interface, so it's correct.

So if both of you are happy, I won't stand in the way.

-- 
Ben Widawsky, Intel Open Source Technology Center


[PATCH v12][ 07/12] drm: drm_display_mode: add signal polarity flags

2014-04-08 Thread Denis Carikli
On 04/08/2014 08:36 AM, Andrzej Hajda wrote:
>
> Hi Denis,
Hi,

>> +#define DRM_MODE_FLAG_POL_PIXDATA_NEGEDGE   BIT(1)
>> +#define DRM_MODE_FLAG_POL_PIXDATA_POSEDGE   BIT(2)
>> +#define DRM_MODE_FLAG_POL_PIXDATA_PRESERVE  BIT(3)
>
> What is the purpose of DRM_MODE_FLAG_POL_PIXDATA_PRESERVE?
> If 'preserve' means 'ignore' we can set to zero negedge and posedge bits
> instead of adding new bit. If it is something different please describe it.
Yes, it meant 'ignore'.

The goal was to be able to have a way to keep the old behavior while 
still being able to set the flags.

So, with the imx-drm driver, if none of the DRM_MODE_FLAG_POL_PIXDATA 
were set(that is POSEDGE, NEGEDGE, PRESERVE), then in ipuv3-crtc.c, it 
went using the old flags settings that were previously hardcoded.

The same applied for DRM_MODE_FLAG_POL_DE.
The patch using theses flags is the 08/12 of this same serie.

>>   struct drm_display_mode {
[..]
>> +unsigned int pol_flags;
>
> Adding field and macros description to the DocBook would be nice.
So I will have to describe it in the "Connector Helper Operations" 
section of drm.tmpl, right before the mode_valid synopsis ?

Denis.


[Intel-gfx] [PATCH] drm/i915: support address only i2c-over-aux transactions

2014-04-08 Thread Daniel Vetter
On Tue, Apr 8, 2014 at 8:58 AM, Jani Nikula  wrote:
> Before the conversion to dp aux helpers there was a switch case [1] that
> ended up in msg_bytes = 3 for address only start/stop messages
> (MODE_I2C_START or MODE_I2C_STOP bit set [2]). With Alex's series in,
> but without my patch, we'd send the four byte header but with 0 - 1 =
> 0xff in txbuf[3]. I'm pretty sure breakage would follow.
>
> Thus I'd like to have my patch in before the dp aux helpers use
> msg->size == 0 for address only messages.
>
> Daniel, convinced yet?

Indeed, I've been blinding. Acked for merging through radeon trees
together with the other patches as a fixup for 3.15.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[Intel-gfx] [PATCH] drm/i915: support address only i2c-over-aux transactions

2014-04-08 Thread Jani Nikula
On Mon, 07 Apr 2014, Daniel Vetter  wrote:
> On Mon, Apr 7, 2014 at 4:35 PM, Alex Deucher  wrote:
>> On Mon, Apr 7, 2014 at 5:37 AM, Jani Nikula  wrote:
>>> To support bare address requests used by the drm dp helpers.
>>>
>>> Signed-off-by: Jani Nikula 
>>>
>>> ---
>>>
>>> Hi Alex, similar to Thierry's patch for i915.
>>>
>>
>> Looks good to me.
>>
>> Reviewed-by: Alex Deucher 
>>
>> Do you want me to add this to the patch set?
>
> Afaict we've done an unconditional msg_bytes = send_bytes + 4; in the
> i915 driver before the conversion to the dp aux helper, which is why
> I've slapped an r-b onto your patch without asking for a i915
> adjustement. Otoh we have a pile of bugs for dp dongles still. Imo my
> preferred approach would be to get the helper + radeon stuff in and
> then hawk the i915 patch to a bunch of bug reporter and see whether it
> sticks. Ofc if we already know that we need it it would be best to
> merge it in one pull together with all your other patches.
>
> Jani?

Before the conversion to dp aux helpers there was a switch case [1] that
ended up in msg_bytes = 3 for address only start/stop messages
(MODE_I2C_START or MODE_I2C_STOP bit set [2]). With Alex's series in,
but without my patch, we'd send the four byte header but with 0 - 1 =
0xff in txbuf[3]. I'm pretty sure breakage would follow.

Thus I'd like to have my patch in before the dp aux helpers use
msg->size == 0 for address only messages.

Daniel, convinced yet?

BR,
Jani.


[1] 
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/i915/intel_dp.c?id=v3.14#n654

[2] 
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/drm_dp_helper.c?id=v3.14#n59


> -Daniel
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Jani Nikula, Intel Open Source Technology Center


[Intel-gfx] [PATCH] drm/i915: support address only i2c-over-aux transactions

2014-04-08 Thread Alex Deucher
On Tue, Apr 8, 2014 at 9:09 AM, Christian K?nig  
wrote:
> Am 08.04.2014 15:04, schrieb Alex Deucher:
>
>> On Tue, Apr 8, 2014 at 4:03 AM, Daniel Vetter  wrote:
>>>
>>> On Tue, Apr 8, 2014 at 8:58 AM, Jani Nikula 
>>> wrote:

 Before the conversion to dp aux helpers there was a switch case [1] that
 ended up in msg_bytes = 3 for address only start/stop messages
 (MODE_I2C_START or MODE_I2C_STOP bit set [2]). With Alex's series in,
 but without my patch, we'd send the four byte header but with 0 - 1 =
 0xff in txbuf[3]. I'm pretty sure breakage would follow.

 Thus I'd like to have my patch in before the dp aux helpers use
 msg->size == 0 for address only messages.

 Daniel, convinced yet?
>>>
>>> Indeed, I've been blinding. Acked for merging through radeon trees
>>> together with the other patches as a fixup for 3.15.
>>
>> Christian,
>>
>> Can you pull this into the radeon 3.15 branch as well?
>
>
> Sure, directly before your other patches I would assume.

yes.

>
> Going to send out the pull request to Dave this evening if nobody objects.
>

Sounds good to me.

Thanks!

Alex

> Christian.
>
>>
>> Thanks,
>>
>> Alex
>
>


[Intel-gfx] [PATCH] drm/i915: support address only i2c-over-aux transactions

2014-04-08 Thread Alex Deucher
On Tue, Apr 8, 2014 at 4:03 AM, Daniel Vetter  wrote:
> On Tue, Apr 8, 2014 at 8:58 AM, Jani Nikula  wrote:
>> Before the conversion to dp aux helpers there was a switch case [1] that
>> ended up in msg_bytes = 3 for address only start/stop messages
>> (MODE_I2C_START or MODE_I2C_STOP bit set [2]). With Alex's series in,
>> but without my patch, we'd send the four byte header but with 0 - 1 =
>> 0xff in txbuf[3]. I'm pretty sure breakage would follow.
>>
>> Thus I'd like to have my patch in before the dp aux helpers use
>> msg->size == 0 for address only messages.
>>
>> Daniel, convinced yet?
>
> Indeed, I've been blinding. Acked for merging through radeon trees
> together with the other patches as a fixup for 3.15.

Christian,

Can you pull this into the radeon 3.15 branch as well?

Thanks,

Alex


[PATCH] drm/omap: fix plane rotation

2014-04-08 Thread Tomi Valkeinen
On 08/04/14 01:12, Rob Clark wrote:
> On Mon, Apr 7, 2014 at 5:41 PM, Grazvydas Ignotas  
> wrote:
>> Gra?vydas
>>
>>
>> On Mon, Apr 7, 2014 at 8:17 PM, Rob Clark  wrote:
>>> On Mon, Apr 7, 2014 at 6:32 AM, Grazvydas Ignotas  
>>> wrote:
>>>> On Sun, Apr 6, 2014 at 12:45 AM, Rob Clark  wrote:
>>>>> On Sat, Apr 5, 2014 at 2:33 PM, Grazvydas Ignotas  
>>>>> wrote:
>>>>>> Plane rotation with omapdrm is currently broken.
>>>>>> It seems omap_plane_mode_set() expects width and height in screen
>>>>>> coordinates, so pass it like that.
>>>>>>
>>>>>> Cc: Rob Clark 
>>>>>> Signed-off-by: Grazvydas Ignotas 
>>>>>> ---
>>>>>>  drivers/gpu/drm/omapdrm/omap_plane.c |8 
>>>>>>  1 file changed, 8 insertions(+)
>>>>>>
>>>>>> diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c 
>>>>>> b/drivers/gpu/drm/omapdrm/omap_plane.c
>>>>>> index 370580c..5611f15 100644
>>>>>> --- a/drivers/gpu/drm/omapdrm/omap_plane.c
>>>>>> +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
>>>>>> @@ -253,6 +253,14 @@ static int omap_plane_update(struct drm_plane 
>>>>>> *plane,
>>>>>>
>>>>>> drm_framebuffer_reference(fb);
>>>>>>
>>>>>> +   /* omap_plane_mode_set() takes adjusted src */
>>>>>> +   switch (omap_plane->win.rotation & 0xf) {
>>>>>> +   case BIT(DRM_ROTATE_90):
>>>>>> +   case BIT(DRM_ROTATE_270):
>>>>>> +   swap(src_w, src_h);
>>>>>> +   break;
>>>>>> +   }
>>>>>> +
>>>>>
>>>>> hmm, I think that the better thing would be to do this in
>>>>> omap_framebuffer_update_scanout().  In fact we do already swap
>>>>> src_w/src_h there.  Only we don't swap the width/height parameters we
>>>>> pass down to omapdss.  Not quite sure if something changed in omapdss
>>>>> with regards to rotation_type, but keeping it with the rest of the
>>>>> rotation related maths in _update_scanout() seems cleaner.
>>>>
>>>> But then it has to know somehow if apply was triggered from
>>>> omap_crtc_mode_set() or omap_plane_update(). The problem is
>>>> omap_crtc_mode_set() passes rotated width/height (and crtc rotation
>>>> works correctly), but omap_plane_update() uses unrotated width/height
>>>> (so plane rotation is currently broken).
>>>
>>>
>>> Something still seems a bit suspicious..  drm core is not swapping
>>> width/height for crtc (other than for validating the configuration...
>>> which might also be needed for planes).  I guess it is getting
>>> already-rotated width/height from userspace.  So probably we want to
>>> do the same for planes, so it might be a good idea to move
>>> crtc->invert_dimensions into plane.
>>
>> OK I guess I said it wrong..
>> The display I have is 1080x1920 portrait panel.
>> For omap_crtc_mode_set(), hdisplay is always 1080 and vdisplay, is
>> 1920, regardless of rotation. That is passed over to
>> omap_plane_mode_set() and everything works.
> 
> ahh, ok, that makes much more sense..   (sorry, it's been a long time
> since I looked at rotation)
> 
> Reviewed-by: Rob Clark 

I can queue this up in my omapdrm fixes branch. I already have a few there.

 Tomi


-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140408/bc501b1c/attachment.sig>


[PATCH v12][ 07/12] drm: drm_display_mode: add signal polarity flags

2014-04-08 Thread Andrzej Hajda
Hi Denis,

On 04/07/2014 02:44 PM, Denis Carikli wrote:
> We need a way to pass signal polarity informations
>   between DRM panels, and the display drivers.
> 
> To do that, a pol_flags field was added to drm_display_mode.
> 
> Signed-off-by: Denis Carikli 
> ---
> ChangeLog v11->v12:
> - Rebased: This patch now applies against drm_modes.h
> - Rebased: It now uses the new DRM_MODE_FLAG_POL_DE flags defines names
> 
> ChangeLog v10->v11:
> - Since the imx-drm won't be able to retrive its regulators
>   from the device tree when using display-timings nodes,
>   and that I was told that the drm simple-panel driver 
>   already supported that, I then, instead, added what was
>   lacking to make the eukrea displays work with the
>   drm-simple-panel driver.
> 
>   That required a way to get back the display polarity
>   informations from the imx-drm driver without affecting
>   userspace.
> ---
>  include/drm/drm_modes.h |8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
> index 2dbbf99..b3789e2 100644
> --- a/include/drm/drm_modes.h
> +++ b/include/drm/drm_modes.h
> @@ -93,6 +93,13 @@ enum drm_mode_status {
>  
>  #define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
>  
> +#define DRM_MODE_FLAG_POL_PIXDATA_NEGEDGEBIT(1)
> +#define DRM_MODE_FLAG_POL_PIXDATA_POSEDGEBIT(2)
> +#define DRM_MODE_FLAG_POL_PIXDATA_PRESERVE   BIT(3)

What is the purpose of DRM_MODE_FLAG_POL_PIXDATA_PRESERVE?
If 'preserve' means 'ignore' we can set to zero negedge and posedge bits
instead of adding new bit. If it is something different please describe it.

> +#define DRM_MODE_FLAG_POL_DE_LOW BIT(4)
> +#define DRM_MODE_FLAG_POL_DE_HIGHBIT(5)
> +#define DRM_MODE_FLAG_POL_DE_PRESERVEBIT(6)
> +

The same comments here.

>  struct drm_display_mode {
>   /* Header */
>   struct list_head head;
> @@ -144,6 +151,7 @@ struct drm_display_mode {
>   int vrefresh;   /* in Hz */
>   int hsync;  /* in kHz */
>   enum hdmi_picture_aspect picture_aspect_ratio;
> + unsigned int pol_flags;

Adding field and macros description to the DocBook would be nice.

Regards
Andrzej

>  };
>  
>  /* mode specified on the command line */
> 



[PATCH v1 00/19] Add DRM for stih4xx platforms

2014-04-08 Thread Rob Clark
On Tue, Apr 8, 2014 at 8:19 AM, Benjamin Gaignard
 wrote:
> This series of patches add the support of DRM/KMS drivers for 
> STMicroelectronics
> chipsets stih416 and stih407.

*finally* \o/

one small request.. got a git branch somewhere?  This patchset is big
enough that it would be convenient for reviewing to be able to
git-fetch..

BR,
-R

> Hardware is split in two main blocks: Compositor and TVout. Each of them
> includes specific hardware IPs and the display timing are controlled by a 
> specific
> Video Timing Generator hardware IP (VTG).
>
> Compositor is made of the follow hardware IPs:
>  - GDP (Generic Display Pipeline) which is an entry point for graphic (RGB)
>buffers
>  - VDP (Video Diplay Pipeline) which is an entry point for video (YUV) buffers
>  - HQVDP (High Quality Video Display Processor) that supports scaling,
>deinterlacing and some miscellaneous image quality improvements.
>It fetches the Video decoded buffers from memory, processes them and pushes
>them to the Compositor through a HW dedicated bus.
>  - Mixer is responsible of mixing all the entries depending of their
>respective z-order and layout
>
> TVout is divided in 3 parts:
>  - HDMI to generate HDMI signals, depending of chipset version HDMI phy can
>change.
>  - HDA to generate signals for HD analog TV
>  - VIP to control/switch data path coming from Compositor
>
> On stih416 compositor and Tvout are on different dies so a Video Trafic 
> Advance
> inter-die Communication mechanism (VTAC) is needed.
>
> +-+   
> ++
> | +---+   ++  |   |  ++   
> +--+ |
> | |   |   ||  |   |  ||   |  +-+  
>++  | |
> | | ++  +--+  |   ||  |   |  ||   |  | VIP 
> |>|HDMI|  | |
> | | |GPD +->|  |  |   ||  |   |  ||   |  | |  
>++  | |
> | | ++  |Mixer |--|-->||  |   |  ||---|->| switcher|  
>| |
> | | |  |  |   ||  |   |  ||   |  | |  
>++  | |
> | | |  |  |   ||  |   |  ||   |  | 
> |>|HDA |  | |
> | | +--+  |   |VTAC|>|VTAC|   |  +-+  
>++  | |
> | |   |   ||  |   |  ||   |   
>| |
> | | Compositor|   ||  |   |  ||   |   
> TVout  | |
> | +---+   ||  |   |  ||   
> +--+ |
> |  ^  ||  |   |  || ^ 
>  |
> |  |  ||  |   |  || | 
>  |
> |   +--+  ||  |   |  ||  
> +-+   |
> |   | VTG (master) |->||  |   |  ||->| VTG 
> (slave) |   |
> |   +--+  ++  |   |  ++  
> +-+   |
> |Digital die  |   |   
>Analog Die|
> +-+   
> ++
>
> On stih407 Compositor and Tvout are on the same die
>
> +-+
> | +---+  +--+ |
> | |   |  |  +-+ ++  | |
> | | ++  +--+  |  |  | VIP |>|HDMI|  | |
> | | |GPD +->|  |  |  |  | | ++  | |
> | | ++  |Mixer |--|--|->| switcher| | |
> | | ++   +-+|  |  |  |  | | ++  | |
> | | |VDP +-->+HQVDP+--->|  |  |  |  | |>|HDA |  | |
> | | ++   +-++--+  |  |  +-+ ++  | |
> | |   |  |  | |
> | | Compositor|  |   TVout  | |
> | +---+  +--+ |
> |  ^^ |
> |  || |
> |   +--+  |
> |   | VTG  |  |
> |   +--+  |
> |Digital die  |
> +-+
>
> In addition of the drivers for the IPs listed before a thin I2C driver 
> (hdmiddc) is used
> by HDMI driver to retrieve EDID for monitor.
>
> To unify interfaces of GDP and VDP we create a "layer" interface 

[Bug 66963] Rv6xx dpm problems

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=66963

--- Comment #209 from lockheed  ---
> (In reply to comment #207)
> Hm, that's interesting, I'm using the same driver RV635, card is HD 3650
> Had the system up for 3 days and had no crash, had to reboot for other
> reasons.
> Watched many videos (XBMC, mostly HD movies) , played few games.
> Working fine really, except like I said, I had black screens on boot few
> times, when that happens the very next reboot is success.
> Maybe there are other things in play here, really can't tell.
> btw I'm running OpenSuse 13.1 x64 , stock mesa 9.2 , kernel 3.14.0-5
> 
> Can you reproduce it every time ? 
> If yes what do you do exactly ? I would like to try that.

It's a Radeon HD 3650 in a ThinkPad W500.
Arch Linux x64 
mesa 10.1, 10.2, all git, updated daily
Kernel 3.12-3.14 (not tested earlier)

Yes, I can reproduce it every time (ie. I can't say WHEN it will happen apart
from the fact it WILL happen between 20 minutes and 20 hours), which is why I
have to stay on Catalysts.

The only thing I noticed that is most likely to cause it almost immediately is
moving windows inside a VNC client session connected to a server to a server.
In such case the crash occurs within seconds to minutes.

That's my logs: https://bugs.freedesktop.org/show_bug.cgi?id=74420

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


[Bug 77002] hdmi audio problems with 3.14

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=77002

Takashi Iwai  changed:

   What|Removed |Added

 Status|NEW |NEEDINFO

--- Comment #23 from Takashi Iwai  ---
I'd rather revert the commit in this case.  Changing the assignment order has a
significant risk of breakage with other weird controllers.

Could you confirm that just reverting the commit fixes the problem?  Once after
it's confirmed, I'll submit a fix revert patch for 3.14.x.  Thanks.

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


Fwd: WARNING ... drivers/gpu/drm/ttm/ttm_bo_vm.c...

2014-04-08 Thread Thomas Hellstrom
Hi, David,

Are there any dev_mapping changes in 3.15 that could cause this?
Do we know what happens to vma->vm_file->f_mapping during fork?

Thanks,
/Thomas



 Original Message 
Return-Path:pomidorabelisima at gmail.com
Received:   from zcs-prod-mta-3.vmware.com (LHLO
zcs-prod-mta-3.vmware.com) (10.113.163.65) by
zcs-prod-mbox-71.vmware.com with LMTP; Mon, 7 Apr 2014 18:29:31 -0700 (PDT)
Received:   from zcs-prod-mta-3.vmware.com (localhost.localdomain
[127.0.0.1]) by zcs-prod-mta-3.vmware.com (Postfix) with ESMTP id
9967BE003B for ; Mon, 7 Apr 2014 18:29:31
-0700 (PDT)
Received:   from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com
[10.113.161.71]) by zcs-prod-mta-3.vmware.com (Postfix) with ESMTP for
; Mon, 7 Apr 2014 18:29:31 -0700 (PDT)
Received:   by sc9-mailhost1.vmware.com (Postfix) id 8755C184C4; Mon, 7
Apr 2014 18:29:31 -0700 (PDT)
Delivered-To:   thellstrom at vmware.com
Received:   from sc9-proofpoint-agent-3.vmware.com
(sc9-proofpoint-agent-3.vmware.com [10.113.162.104]) by
sc9-mailhost1.vmware.com (Postfix) with ESMTP id 83121184C3 for
; Mon, 7 Apr 2014 18:29:31 -0700 (PDT)
Received:   from pps.filterd (sc9-proofpoint-agent-3.vmware.com
[127.0.0.1]) by sc9-proofpoint-agent-3.vmware.com (8.14.5/8.14.5) with
SMTP id s381Pn6F017997 for ; Mon, 7 Apr 2014
18:29:31 -0700
Received:   from sc9-mail1.vmware.com (lbv-sc9-t2prod2-int.vmware.com
[10.113.160.246]) by sc9-proofpoint-agent-3.vmware.com with ESMTP id
1k3xxksc4u-1 for ; Mon, 07 Apr 2014 18:29:31 -0700
Received:   from mail-ee0-f41.google.com (mail-ee0-f41.google.com
[74.125.83.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No
client certificate requested) by sc9-mail1.vmware.com (Postfix) with
ESMTPS id B13F7100AA for ; Mon, 7 Apr 2014
18:29:30 -0700 (PDT)
Received:   by mail-ee0-f41.google.com with SMTP id t10so104752eei.14 for
; Mon, 07 Apr 2014 18:29:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com;
s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject
:content-type:content-transfer-encoding;
bh=z/4ic61J+N58h1sNnKa7ijlyzlqumiv+OmAV1k7Tw6g=;
b=P7A42QOEMi6FhfcjOe0dwJeY6JYz8IHyy3HxtJjuY7esBV2LpgRaukscH+Y4qs6VRt
7aKBqKbvOa5/nCbVFq+JB1nunRO/vjJHDiXpNIsZavQfUt3mLdhlHRdokRJSEK7n3Kwu
8fgbijRmWQNeu57Cyuvm3kb8Yc9EwL9cwnBN1MvnFBqprO0nOxttOFUmeDNnNdip8RPJ
fPryZ2kL2KUOkzids0oWY/894DLdclmKgIdgfuGY7QicG2vLOPUdGMDrAVgAAIUQC065
UcreRin5BNvkTjN27WytMaqrMTQkcyQvKvyPUm9Hw5c2oz3b3u77DTIk0sd4D1yD5YCx h1/A==
X-Received: by 10.14.37.8 with SMTP id x8mr442817eea.32.1396920568788;
Mon, 07 Apr 2014 18:29:28 -0700 (PDT)
Received:   from localhost (iskon7169.duo.carnet.hr. [31.147.124.1]) by
mx.google.com with ESMTPSA id w1sm1094486eel.16.2014.04.07.18.29.27 for
 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA
bits=128/128); Mon, 07 Apr 2014 18:29:27 -0700 (PDT)
Message-ID: <534350F6.9050604 at gmail.com>
Date:   Tue, 08 Apr 2014 03:29:26 +0200
From:   poma 
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101
Thunderbird/24.4.0
To: Thomas Hellstrom 
CC: Linux Kernel list , Mailing-List
fedora-kernel 
Subject:WARNING ... drivers/gpu/drm/ttm/ttm_bo_vm.c...
Content-Type:   text/plain; charset=UTF-8
Content-Transfer-Encoding:  Quoted-printable
MIME-Version:   1.0
X-Proofpoint-Virus-Version: vendor=fsecure
engine=2.50.10432:5.11.96,1.0.14,0.0.
definitions=2014-04-08_01:2014-04-07,2014-04-08,1970-01-01 signatures=0
X-Proofpoint-Spam-Details:  rule=quarantine_notspam policy=quarantine
score=0 kscore.is_bulkscore=0 kscore.compositescore=0
circleOfTrustscore=0 compositescore=0.1038748133519
urlsuspect_oldscore=0.1038748133519 suspectscore=0
recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0
kscore.is_spamscore=0 recipient_to_sender_totalscore=0
recipient_domain_to_sender_domain_totalscore=0 rbsscore=0.1038748133519
spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9
adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
engine=7.0.1-140224 definitions=main-1404070251



...
Command line: initrd=initrd.img
inst.stage2=hd:LABEL=Fedora\x20rawhide\x20x86_64  xdriver=modesetting
BOOT_IMAGE=vmlinuz
Kernel command line: initrd=initrd.img
inst.stage2=hd:LABEL=Fedora\x20rawhide\x20x86_64  xdriver=modesetting
BOOT_IMAGE=vmlinuz
...
[ cut here ]
WARNING: CPU: 1 PID: 1230 at drivers/gpu/drm/ttm/ttm_bo_vm.c:269
ttm_bo_vm_open+0x52/0x80 [ttm]()
CPU: 1 PID: 1230 Comm: Xorg Not tainted 3.15.0-0.rc0.git9.1.fc21.x86_64 #1
Call Trace:
 [] dump_stack+0x4d/0x66
 [] warn_slowpath_common+0x7d/0xa0
 [] warn_slowpath_null+0x1a/0x20
 [] ttm_bo_vm_open+0x52/0x80 [ttm]
 [] copy_process.part.23+0x1b9e/0x1e90
 [] do_fork+0xc6/0x4b0
 [] ? might_fault+0x5f/0xb0
 [] ? sysret_check+0x22/0x5d
 [] SyS_clone+0x16/0x20
 [] stub_clone+0x69/0x90
 [] ? system_call_fastpath+0x16/0x1b
---[ end trace bc31de8c9c4c4d52 ]---
...


[Bug 77009] 24P playback video signal loss with latest DRI patches

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=77009

--- Comment #22 from Garrett  ---
Christian,
I managed to add only your patch solo:
https://bugs.freedesktop.org/attachment.cgi?id=96900=edit
It works great.  The mistake I made was ctrl-c/v from browser.  Bad chars I
assume.  White-space chrs?  

I am trying to understand the plls.  I read the org. bug report 76564.  I
assumed increasing the max would allow higher pll vals.  But it does go down
with some.  Does that make sense?  

from this patch applied to v2:

[   38.548302] [drm:drm_mode_debug_printmodeline], Modeline 32:"" 0 74176 1920
2558 2602 2750 1080 1084 1089 1125 0x0 0x5

  38.568903] [drm:radeon_compute_pll_avivo], 148340 - 14830, pll dividers - fb:
148.3 ref: 10, post 10
[   38.581485] [drm:drm_crtc_helper_set_mode], [ENCODER:17:TMDS-17] set
[MODE:32:]
[   38.581490] [drm:radeon_atom_encoder_dpms], encoder dpms 33 to mode 3,
devices 0008, active_devices 0008

Is this correct?
 from Modeline 32:  74176 * 2 = 148352 (LCD wants?) ~= 148300 (GPU makes?).  
Ideally we need 148350 (GPU)? 

Your patch does wonders for this A4-3400.  I am trying to understand it better.

Here your max is 100.  ref: 10, post 10  >>>> 10 * 10 = 100 max.

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


[git pull] drm merge for v3.15-rc1

2014-04-08 Thread Dave Airlie

Hi Linus,

Merge window tree for drm,

Highlights:
drm: generic display port aux features, primary plane support, drm master 
management fixes, logging cleanups, enforced locking checks (instead of docs), 
documentation improvements, minor number handling cleanup, pseudofs for shared 
inodes.

ttm: add ability to allocate from both ends

i915: broadwell features, power domain and runtime pm, per-process address 
space infrastructure (not enabled)

msm: power management, hdmi audio support

nouveau: ongoing GPU fault recovery, initial maxwell support, random fixes

exynos: refactored driver to clean up a lot of abstraction, DP support moved 
into drm, LVDS bridge support added,
parallel panel support,

gma500: SGX MMU support, SGX irq handling, asle irq work fixes,

radeon: video engine bringup, ring handling fixes, use dp aux helpers,

vmwgfx: add rendernode support

This has some small merge conflicts, all the staging ones are choose what is in 
your tree, the kconfig one is drop the stanza and the mmu.c one is trivial,

Dave.

The following changes since commit 455c6fdbd219161bd09b1165f11699d6d73de11c:

  Linux 3.14 (2014-03-30 20:40:15 -0700)

are available in the git repository at:

  git://people.freedesktop.org/~airlied/linux drm-next

for you to fetch changes up to c39b06951f1dc2e384650288676c5b7dcc0ec92c:

  DRM: armada: fix corruption while loading cursors (2014-04-08 10:51:03 +1000)


Akash Goel (1):
  drm/i915: Remove the enabling of VS_TIMER_DISPATCH bit in MI MODE reg

Alex Deucher (23):
  drm/radeon: add callback for setting vce clocks
  drm/radeon/dpm: move platform caps fetching to a separate function
  drm/radeon/dpm: fill in some initial vce infrastructure
  drm/radeon/dpm: fetch vce states from the vbios
  drm/radeon: fill in set_vce_clocks for CIK asics
  drm/radeon: add vce dpm support for CI
  drm/radeon: enable vce dpm on CI
  drm/radeon: add vce dpm support for KV/KB
  drm/radeon/dpm: enable dynamic vce state switching v2
  drm/radeon/dpm: properly enable/disable vce when vce pg is enabled
  drm/radeon: add support for vce 2.0 clock gating
  drm/radeon/cik: enable/disable vce cg when encoding v2
  drm/radeon: use variable UVD clocks
  drm/radeon/dp: use i2c_get_adapdata rather than casting
  drm/radeon/dp: move sink power control to a separate function
  drm/radeon/atom: rework encoder enable/disable sequence
  drm/radeon: clarify special handling in i2c over aux
  drm/dp: make aux retries less chatty
  drm/radeon: use the new drm helpers for dp aux
  drm/radeon: use drm_dp_dpcd_read_link_status()
  drm/radeon: call drm_edid_to_eld when we update the edid
  drm/radeon: fix endian swap on hawaii clear state buffer setup
  drm/radeon: fix typo in spectre_golden_registers

Alexandre Courbot (8):
  drm/nouveau: handle -EACCES runtime PM return code
  drm/nve0/fifo: allocate usermem as needed
  support for platform devices
  drm/nouveau: fix missing newline
  drm/panel: use gpiod interface for enable GPIO
  drm/panel: remove redundant regulator_disable()
  drm/panel: add support for LG LH500WX1-SD03 panel
  drm/panel: add support for LG LD070WX3-SL01 panel

Andrzej Hajda (22):
  drm/exynos: delay fbdev initialization until an output is connected
  drm/exynos: init kms poll after creation of connectors
  drm/exynos: correct timing porch conversion
  exynos/fimd: add parallel output related bindings
  drm/exynos: restore parallel output interface support
  ARM: dts: exynos4210-universal: add exynos/fimd node
  drm/exynos: fimd: remove unused variable
  drm/mipi_dsi: add flags to DSI messages
  drm/mipi_dsi: create dsi devices only for nodes with reg property
  drm/exynos: disallow fbdev initialization if no device is connected
  exynos/dsim: add DT bindings
  drm/exynos: add DSIM driver
  panel/s6e8aa0: add DT bindings
  panel/ld9040: add DT bindings
  drm/panel: add ld9040 driver
  ARM: dts: exynos4210-universal_c210: add proper panel node
  drm/panel: add S6E8AA0 driver
  ARM: dts: exynos4: add MIPI DSI Master node
  ARM: dts: exynos4210-trats: add panel node
  ARM: dts: exynos4412-trats2: add panel node
  ARM: dts: exynos4210-trats: enable exynos/fimd node
  ARM: dts: exynos4412-trats2: enable exynos/fimd node

Antti Koskipaa (1):
  drm/i915: Reorganize display pipe register accesses

Arnd Bergmann (1):
  drm/bridge: PTN3460 needs DRM_KMS_HELPER

Arthur Borsboom (3):
  drm/gma500: Code cleanup - removal of centralized exiting of function
  drm/gma500: Code cleanup - style fixes
  drm/gma500: Code cleanup - inline documentation

Ben Skeggs (68):
  drm/nouveau/core: extend width of engine mask for namedb
  drm/nv50/disp: preparation for storing static class data
  drm/nv50/disp: 

[PATCH] drm/omap: fix plane rotation

2014-04-08 Thread Grazvydas Ignotas
Gra?vydas


On Mon, Apr 7, 2014 at 8:17 PM, Rob Clark  wrote:
> On Mon, Apr 7, 2014 at 6:32 AM, Grazvydas Ignotas  
> wrote:
>> On Sun, Apr 6, 2014 at 12:45 AM, Rob Clark  wrote:
>>> On Sat, Apr 5, 2014 at 2:33 PM, Grazvydas Ignotas  
>>> wrote:
 Plane rotation with omapdrm is currently broken.
 It seems omap_plane_mode_set() expects width and height in screen
 coordinates, so pass it like that.

 Cc: Rob Clark 
 Signed-off-by: Grazvydas Ignotas 
 ---
  drivers/gpu/drm/omapdrm/omap_plane.c |8 
  1 file changed, 8 insertions(+)

 diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c 
 b/drivers/gpu/drm/omapdrm/omap_plane.c
 index 370580c..5611f15 100644
 --- a/drivers/gpu/drm/omapdrm/omap_plane.c
 +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
 @@ -253,6 +253,14 @@ static int omap_plane_update(struct drm_plane *plane,

 drm_framebuffer_reference(fb);

 +   /* omap_plane_mode_set() takes adjusted src */
 +   switch (omap_plane->win.rotation & 0xf) {
 +   case BIT(DRM_ROTATE_90):
 +   case BIT(DRM_ROTATE_270):
 +   swap(src_w, src_h);
 +   break;
 +   }
 +
>>>
>>> hmm, I think that the better thing would be to do this in
>>> omap_framebuffer_update_scanout().  In fact we do already swap
>>> src_w/src_h there.  Only we don't swap the width/height parameters we
>>> pass down to omapdss.  Not quite sure if something changed in omapdss
>>> with regards to rotation_type, but keeping it with the rest of the
>>> rotation related maths in _update_scanout() seems cleaner.
>>
>> But then it has to know somehow if apply was triggered from
>> omap_crtc_mode_set() or omap_plane_update(). The problem is
>> omap_crtc_mode_set() passes rotated width/height (and crtc rotation
>> works correctly), but omap_plane_update() uses unrotated width/height
>> (so plane rotation is currently broken).
>
>
> Something still seems a bit suspicious..  drm core is not swapping
> width/height for crtc (other than for validating the configuration...
> which might also be needed for planes).  I guess it is getting
> already-rotated width/height from userspace.  So probably we want to
> do the same for planes, so it might be a good idea to move
> crtc->invert_dimensions into plane.

OK I guess I said it wrong..
The display I have is 1080x1920 portrait panel.
For omap_crtc_mode_set(), hdisplay is always 1080 and vdisplay, is
1920, regardless of rotation. That is passed over to
omap_plane_mode_set() and everything works.
But in omap_plane_update(), src_w and src_h are passed instead, which
correspond to framebuffer size and not display? At least
drmModeSetPlane(), where those values originate, seems to expect
framebuffer dimensions, but passing 1920, 1080 there (with 90 deg.
rotation set) results in corruption on screen caused by bad base
address for hardware overlay without my patch.


Gra?vydas


[PATCH v2 1/7] drm/exynos: add super device support

2014-04-08 Thread Inki Dae
Hi Andrzej,

2014-04-07 23:18 GMT+09:00 Andrzej Hajda :
> Hi Inki and Tomasz,
>
> On 04/06/2014 05:15 AM, Inki Dae wrote:
>
> (...)
>> The code creating the list of components to wait for
>> (exynos_drm_add_components()) doesn't seem to consider which sub-drivers are
>> actually enabled in kernel config.
>>
>> Are you sure?
>>
>> exynos_drm_add_components() will try to attach components *added to
>> component_lists. And these components will be added by only
>> corresponding sub drivers to the component_lists and
>> master->components.
>>
>> So in this case, if users disabled HDMI support then a commponent
>> object for HDMI sub driver doesn't exists in the component_lists and
>> master->components. This means that a component object for HDMI sub
>> driver *cannot be attached to master object*.
>>
>> As a result, component_bind_add() will ignor component_bind call for
>> HDMI sub driver so HDMI driver will not be bounded. The only
>> components added by sub drivers will be bound, component->ops->bind().
>>
>> For more understanding, it seems like you need to look into below codes,
>>
>> static int exynos_drm_add_components(...)
>> {
>> ...
>> for (i == 0;; i++) {
>> ...
>> node = of_parse_phandle(np, "ports", i);
>> ...
>> ret = component_master_add_child(m, compare_of, node);
>> ...
>> }
>> }
>
> Hmm, In case HDMI driver is not present, HDMI device is not probed and
> HDMI component is not added, so component_master_add_child returns
> an error when it tries to add hdmi component and master is never brought
> up, am I correct?
>

Ok, after that,

ret = component_master_add(,..)
if (ret < 0)
 DRM_DEBUG_KMS("re-tried by last sub driver probed later.\n");

As you can see above, if component_master_add() is failed, return 0,
*not error*. And then component_add() called by other kms drivers,
late probing of hdmi or fimd probing - if there is any kms driver
enabled - will try to bring up master again by calling
try_to_bring_up_master() from beginning.

And if component_list is empty then it means that there is no any kms
driver enabled.

Do you still think in that case, exynos drm initialization will be failed?

Thanks,
Inki Dae

>>
>>
>> And below codes,
>>
>> int component_master_add_child(...)
>> {
>> list_for_each_entry(c, _list, node) {
>> if (c->master)
>> continue;
>>
>> if (compare(...)) {
>>  component_attach_master(master, c);
>>  ...
>> }
>> }
>> }
>>
>> And below codes,
>>
>> static void component_attach_master(master, c)
>> {
>> c->master = master;
>> list_add_tail(>master_node, >comonents);
>> }
>>
>>
>> As you can see above, the only components added to component_list can
>> be attached to master. And the important thing is that components can
>> be added by sub drivers to the component_list.
>>
>> And below codes that actually tries to bind each sub drivers,
>>
>> int component_bind_add(...)
>> {
>> 
>> list_for_each_entry(c, >components, master_node) {
>>ret = component_bind(c, master, data);
>>...
>> }
>> ...
>> }
>>
>> The hdmi driver users disabled doesn't exist to master->components list.
>> How Exynos DRM cannot be initialized?
>>
>> Of course, there may be my missing point, but I think I see them
>> correctly. Anyway I will test them tomorrow.
>>
>> Thanks,
>> Inki Dae
>>
> register, which is completely wrong. Users should be able to select which
> drivers should be compiled into their kernels.

 So users are be able to select drivers they want to use, and will be
 compiled correctly. So no, the only thing users can disable is each
 sub driver, not core module.

> 3) Such approach leads to complete integration of all Exynos DRM drivers,
> without possibility of loading some sub-drivers as modules. I know that
> current driver design doesn't support it either, but if this series is

 No, current drm driver *must also be built* as one integrated single
 drm driver without super device approach.
>>>
>>> As I wrote, I know that current design before this patch isn't modular
>>> either, but this is not my concern here. See below.
>>>
>>>
 So the super device approach
 *has no any effect on existing design*,  and what the super device
 approch tries to do is to resolve the probe order issue to sub drivers
 *without some codes specific to Exynos drm*.
>>>
>>> My concern is that the supernode design is actually carving such broken
>>> non-modular design in stone. Remember that we are currently heading towards
>>> a fully multi-platform kernel where it is critical for such subsystems to be
>>> modular, because the same zImage is going to be running on completely
>>> different machines.
>>>
>>>

[Bug 66963] Rv6xx dpm problems

2014-04-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=66963

--- Comment #208 from Kajzer  ---
(In reply to comment #207)
> Well, for me nothing changed on RV635. Computer boots perfectly fine, but
> video still crashes on random state dpm changes, sometimes in 10 minutes,
> sometimes in 10 hours after boot. But always when there is unsaved work on
> the screen.

Hm, that's interesting, I'm using the same driver RV635, card is HD 3650
Had the system up for 3 days and had no crash, had to reboot for other reasons.
Watched many videos (XBMC, mostly HD movies) , played few games.
Working fine really, except like I said, I had black screens on boot few times,
when that happens the very next reboot is success.
Maybe there are other things in play here, really can't tell.
btw I'm running OpenSuse 13.1 x64 , stock mesa 9.2 , kernel 3.14.0-5

Can you reproduce it every time ? 
If yes what do you do exactly ? I would like to try that.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 



[PATCH] drm/mm: Don't WARN if drm_mm_reserve_node

2014-04-08 Thread Daniel Vetter
Jesse's BIOS fb reconstruction code actually relies on the -ENOSPC
return value to detect overlapping framebuffers (which the bios uses
always when lighting up more than one screen). All this fanciness
happens in intel_alloc_plane_obj in intel_display.c.

Since no one else uses this we can savely remove the WARN without
repercursions.

Reported-by: Ben Widawsky 
Cc: Ben Widawsky 
Cc: Jesse Barnes 
Cc: Dave Airlie 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_mm.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index a2d45b748f86..e4dfd5c3b15e 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -192,8 +192,6 @@ int drm_mm_reserve_node(struct drm_mm *mm, struct 
drm_mm_node *node)
return 0;
}

-   WARN(1, "no hole found for node 0x%lx + 0x%lx\n",
-node->start, node->size);
return -ENOSPC;
 }
 EXPORT_SYMBOL(drm_mm_reserve_node);
-- 
1.8.5.2