[Bug 87041] Morrowind: r700: [drm:radeon_cs_ioctl] *ERROR* Failed to parse relocation -12!

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=87041

Alex Deucher  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #1 from Alex Deucher  ---
Fixed in this patch:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e5a5fd4df21b9c4acb67e815ec949cce594860f8

-- 
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/20141205/3e2b8bcb/attachment.html>


[PULL] amdkfd-next-3.19

2014-12-05 Thread Oded Gabbay
Hi Dave,

As discussed on irc, I'm sending a pull request with one important change:

- Disable support for 32-bit user processes. This is done due to AMD's decision
  to remove support for 32-bit user processes on Linux for its HSA stack.

Thanks,

Oded

The following changes since commit 7608867d0c4d9da30e9efe6a53ff4ee1e6c4990b:

  Merge tag 'drm-intel-next-fixes-2014-12-04' of 
git://anongit.freedesktop.org/drm-intel into drm-next (2014-12-05 11:11:57 
+1000)

are available in the git repository at:

  git://people.freedesktop.org/~gabbayo/linux amdkfd-next-3.19

for you to fetch changes up to a18069c132cb0d065ff23c05977d06ea0c78404f:

  amdkfd: Disable support for 32-bit user processes (2014-12-05 22:01:35 +0200)


Oded Gabbay (1):
  amdkfd: Disable support for 32-bit user processes

 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)


[Bug 87041] Morrowind: r700: [drm:radeon_cs_ioctl] *ERROR* Failed to parse relocation -12!

2014-12-05 Thread bugzilla-dae...@freedesktop.org
 pagetables:51088kB unstable:0kB
bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[1404447.631234] lowmem_reserve[]: 0 0 0 0
[1404447.631238] Node 0 DMA: 0*4kB 0*8kB 0*16kB 0*32kB 2*64kB (U) 1*128kB (U)
1*256kB (U) 0*512kB 1*1024kB (U) 1*2048kB (R) 3*4096kB (EM) = 15872kB
[1404447.631254] Node 0 DMA32: 142909*4kB (UEM) 19164*8kB (UEM) 1403*16kB (EM)
14*32kB (EMR) 10*64kB (R) 2*128kB (R) 2*256kB (R) 2*512kB (R) 0*1024kB 0*2048kB
0*4096kB = 750276kB
[1404447.631270] Node 0 Normal: 97707*4kB (UEM) 237*8kB (UEM) 11*16kB (M)
19*32kB (UEM) 4*64kB (E) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB =
393764kB
[1404447.631286] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0
hugepages_size=2048kB
[1404447.631288] 549305 total pagecache pages
[1404447.631290] 32847 pages in swap cache
[1404447.631293] Swap cache stats: add 5174951, delete 5142088, find
4244840/4636881
[1404447.631295] Free swap  = 24675848kB
[1404447.631296] Total swap = 25991816kB
[1404447.631298] 2620953 pages RAM
[1404447.631300] 0 pages HighMem/MovableOnly
[1404447.631302] 41382 pages reserved
[1404447.631305] [drm:radeon_cs_ioctl] *ERROR* Failed to parse relocation -12!

-- 
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/20141205/265c4e67/attachment-0001.html>


[Bug 73338] Fan speed in idle at 40% with radeonsi and at 18% with catalyst

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=73338

--- Comment #65 from Chernovsky Oleg  ---
> 1. add the new dpm asic callbacks
> 2. add the common hwmon fan code.  Make sure it's only enabled on asics
> which support manual fan control
> 3. wire up the CI specific code

Ok, makes sense

> 
> As far as percent vs. rpm, I'm not sure which would be preferred.  I think
> the hwmon subsystem generally prefers rpm.  Maybe add callbacks for both
> percent and rpm and then check rdev->pm.fan_pulses_per_revolution.  If it's
> 0, expose it as a percent.  if not, expose as rpm.  Thoughts?  Might be
> worth asking on the hwmon mailing lists.

Good idea, I'll try to test rpm behaviour today

> Also, we should only expose these on asics which support fan control.

No problem, some tinkering with `hwmon_attributes_visible` should make it.

I'll refresh & update patches on weekend.

-- 
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/20141205/82c01d87/attachment.html>


[Bug 87023] Dota 2 crashed and hang on ATi Mobility Radeon HD 5650 (Acer 4745G)

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=87023

--- Comment #12 from Romy  ---
Seems to be a bit complicated, but I'll try it.

-- 
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/20141205/9df4c372/attachment.html>


[Bug 73338] Fan speed in idle at 40% with radeonsi and at 18% with catalyst

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=73338

--- Comment #64 from Alex Deucher  ---
(In reply to Chernovsky Oleg from comment #63)
> Created attachment 110476 [details] [review]
> hwmon interface for manual fan control on CI cards
> 
> Hi Alex, I've made rough patch implementing hwmon interface for the code
> you've provided. Please take a look (comments inside).
> 
> Patch is done on top of your 3.19-wip branch.

Looks good.  Please split into 3 patches:

1. add the new dpm asic callbacks
2. add the common hwmon fan code.  Make sure it's only enabled on asics which
support manual fan control
3. wire up the CI specific code

As far as percent vs. rpm, I'm not sure which would be preferred.  I think the
hwmon subsystem generally prefers rpm.  Maybe add callbacks for both percent
and rpm and then check rdev->pm.fan_pulses_per_revolution.  If it's 0, expose
it as a percent.  if not, expose as rpm.  Thoughts?  Might be worth asking on
the hwmon mailing lists.

Also, we should only expose these on asics which support fan control.

-- 
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/20141205/d5196b69/attachment.html>


[Bug 60879] [radeonsi] X11 can't start with acceleration enabled

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=60879

--- Comment #110 from Pali Rohár  ---
Michel Dänzer: is this patch going to be included in mesa git?

-- 
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/20141205/0cba30a9/attachment.html>


[Bug 87023] Dota 2 crashed and hang on ATi Mobility Radeon HD 5650 (Acer 4745G)

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=87023

--- Comment #11 from Alex Deucher  ---
(In reply to Romy from comment #10)
> What do you mean bisect mesa? Did you mean I must installing mesa 10.1.3 and
> send you xorg log and dmesg output?

bisecting is a git feature you can use to identify what commit causes a
regression.  You just checkout the mesa git tree and mark what commits were
working and not-working and it will walk you hrough the rest to identify the
culprit.  Google for git bisect howto.

-- 
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/20141205/9ae846eb/attachment.html>


[Bug 87023] Dota 2 crashed and hang on ATi Mobility Radeon HD 5650 (Acer 4745G)

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=87023

--- Comment #10 from Romy  ---
What do you mean bisect mesa? Did you mean I must installing mesa 10.1.3 and
send you xorg log and dmesg output?

-- 
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/20141205/20f68d67/attachment-0001.html>


[PATCH v15 0/3] Add drm driver for Rockchip Socs

2014-12-05 Thread Dave Airlie
On 5 December 2014 at 05:29, Daniel Kurtz  wrote:
> On Tue, Dec 2, 2014 at 1:31 AM, Heiko Stübner  wrote:
>> Hi Mark,
>>
>> Am Dienstag, 2. Dezember 2014, 17:13:20 schrieb Mark Yao:
>>> This a series of patches is a DRM Driver for Rockchip Socs, add support
>>> for vop devices. Future patches will add additional encoders/connectors,
>>> such as eDP, HDMI.
>>>
>>> The basic "crtc" for rockchip is a "VOP" - Video Output Processor.
>>> the vop devices found on Rockchip rk3288 Soc, rk3288 soc have two similar
>>> Vop devices. Vop devices support iommu mapping, we use dma-mapping API with
>>> ARM_DMA_USE_IOMMU.
>>
>> [...]
>>
>>> Changes in v15:
>>> - remove depends on ARM_DMA_USE_IOMMU & IOMMU_API which cause
>>>   recursive dependency problem
>
> I thought the recommended solution for this was to fix OMAP3 to not
> select  ARM_DMA_USE_IOMMU and OMAP_IOMMU, not to drop the 'depends on'
> in drm/rockchip?

Lets fix that up once we get this merged, if I had a tree based on the
iommu I'd have
it -next now.

can I get a pull for that?
Dave.


[PATCH] add support for AM572x in the DDX

2014-12-05 Thread Emil Velikov
On 5 December 2014 at 17:01, Robert Nelson  wrote:
> On Fri, Dec 5, 2014 at 10:57 AM, Emil Velikov  
> wrote:
>> Adding the freedreno ML to the Cc list :-)
>
> Sorry Emil,
>
> underneath this is omapdrm + PowerVR, so i should have prefixed it as:
> "xf86-video-omap"...
>
Hi Robert,

My sleep deprived brain read omap, but registered freedreno. Or
perhaps I'm a bit excited about the contributions from the
CodeAurora/QCom guys in the latter case, which clouded my judgement
:-)

Cheers,
Emil


[PATCH] add support for AM572x in the DDX

2014-12-05 Thread Emil Velikov
Adding the freedreno ML to the Cc list :-)

-Emil

On 5 December 2014 at 14:42, Robert Nelson  wrote:
> Signed-off-by: Robert Nelson 
> ---
>  README| 1 +
>  src/omap_driver.c | 3 +++
>  src/omap_driver.h | 2 +-
>  3 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/README b/README
> index 059f258..d4afd89 100644
> --- a/README
> +++ b/README
> @@ -9,6 +9,7 @@ the following chipsets:
>+ OMAP4460
>+ OMAP5430
>+ OMAP5432
> +  + AM572x
>
>
>  NOTE: this driver is work in progress..  you probably don't want to try
> diff --git a/src/omap_driver.c b/src/omap_driver.c
> index 1fc188d..b9d90c5 100644
> --- a/src/omap_driver.c
> +++ b/src/omap_driver.c
> @@ -95,6 +95,7 @@ static SymTabRec OMAPChipsets[] = {
> /*{ 4470, "OMAP4470 with  ;-)" }, */
> { 0x5430, "OMAP5430 with PowerVR SGX544 MP" },
> { 0x5432, "OMAP5432 with PowerVR SGX544 MP" },
> +   { 0x0752, "AM572x with PowerVR SGX544 MP" },
> {-1, NULL }
>  };
>
> @@ -620,6 +621,7 @@ OMAPPreInit(ScrnInfoPtr pScrn, int flags)
> case 0x4460:
> case 0x5430:
> case 0x5432:
> +   case 0x0752:
> if (xf86LoadSubModule(pScrn, SUB_MODULE_PVR)) {
> INFO_MSG("Loaded the %s sub-module", SUB_MODULE_PVR);
> } else {
> @@ -663,6 +665,7 @@ OMAPAccelInit(ScreenPtr pScreen)
> case 0x4460:
> case 0x5430:
> case 0x5432:
> +   case 0x0752:
> INFO_MSG("Initializing the \"%s\" sub-module ...", 
> SUB_MODULE_PVR);
> pOMAP->pOMAPEXA = InitPowerVREXA(pScreen, pScrn, 
> pOMAP->drmFD);
> if (pOMAP->pOMAPEXA) {
> diff --git a/src/omap_driver.h b/src/omap_driver.h
> index 6d2517e..8277e25 100644
> --- a/src/omap_driver.h
> +++ b/src/omap_driver.h
> @@ -184,7 +184,7 @@ static inline Bool has_video(OMAPPtr pOMAP)
>
>  static inline Bool has_dmm(OMAPPtr pOMAP)
>  {
> -   return pOMAP->chipset >= 0x4430;
> +   return pOMAP->chipset >= 0x4430 || pOMAP->chipset == 0x0752;
>  }
>
>  static inline Bool has_rotation(OMAPPtr pOMAP)
> --
> 2.1.3
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/2] drm/msm: Add the eDP connector in msm drm driver

2014-12-05 Thread Hai Li
Modified the hard-coded hdmi connector/encoder implementations in msm drm
driver to support both edp and hdmi.

Signed-off-by: Hai Li 
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c | 38 +--
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 47 -
 drivers/gpu/drm/msm/msm_drv.c   |  2 ++
 drivers/gpu/drm/msm/msm_drv.h   |  7 +
 4 files changed, 77 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
index 25c2fcb..f4159c2 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
  * Copyright (C) 2013 Red Hat
  * Author: Rob Clark 
  *
@@ -151,11 +152,13 @@ static void mdp5_encoder_mode_set(struct drm_encoder 
*encoder,
 {
struct mdp5_encoder *mdp5_encoder = to_mdp5_encoder(encoder);
struct mdp5_kms *mdp5_kms = get_kms(encoder);
+   struct drm_device *dev = encoder->dev;
+   struct drm_connector *connector;
int intf = mdp5_encoder->intf;
uint32_t dtv_hsync_skew, vsync_period, vsync_len, ctrl_pol;
uint32_t display_v_start, display_v_end;
uint32_t hsync_start_x, hsync_end_x;
-   uint32_t format;
+   uint32_t format = 0x2100;
unsigned long flags;

mode = adjusted_mode;
@@ -177,7 +180,28 @@ static void mdp5_encoder_mode_set(struct drm_encoder 
*encoder,
/* probably need to get DATA_EN polarity from panel.. */

dtv_hsync_skew = 0;  /* get this from panel? */
-   format = 0x213f; /* get this from panel? */
+
+   /* Get color format from panel, default is 8bpc */
+   list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
+   if (connector->encoder == encoder) {
+   switch (connector->display_info.bpc) {
+   case 4:
+   format |= 0;
+   break;
+   case 5:
+   format |= 0x15;
+   break;
+   case 6:
+   format |= 0x2A;
+   break;
+   case 8:
+   default:
+   format |= 0x3F;
+   break;
+   }
+   break;
+   }
+   }

hsync_start_x = (mode->htotal - mode->hsync_start);
hsync_end_x = mode->htotal - (mode->hsync_start - mode->hdisplay) - 1;
@@ -187,6 +211,16 @@ static void mdp5_encoder_mode_set(struct drm_encoder 
*encoder,
display_v_start = (mode->vtotal - mode->vsync_start) * mode->htotal + 
dtv_hsync_skew;
display_v_end = vsync_period - ((mode->vsync_start - mode->vdisplay) * 
mode->htotal) + dtv_hsync_skew - 1;

+   /*
+* For edp only:
+* DISPLAY_V_START = (VBP * HCYCLE) + HBP
+* DISPLAY_V_END = (VBP + VACTIVE) * HCYCLE - 1 - HFP
+*/
+   if (mdp5_encoder->intf_id == INTF_eDP) {
+   display_v_start += (mode->htotal - mode->hsync_start);
+   display_v_end -= (mode->hsync_start - mode->hdisplay);
+   }
+
spin_lock_irqsave(&mdp5_encoder->intf_lock, flags);

mdp5_write(mdp5_kms, REG_MDP5_INTF_HSYNC_CTL(intf),
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
index ab5f8d2..9d891e2 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
@@ -157,7 +157,7 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)
};
struct drm_device *dev = mdp5_kms->dev;
struct msm_drm_private *priv = dev->dev_private;
-   struct drm_encoder *encoder;
+   struct drm_encoder *edp_encoder = NULL, *hdmi_encoder = NULL;
const struct mdp5_cfg_hw *hw_cfg;
int i, ret;

@@ -208,14 +208,6 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)
}
}

-   /* Construct encoder for HDMI: */
-   encoder = mdp5_encoder_init(dev, 3, INTF_HDMI);
-   if (IS_ERR(encoder)) {
-   dev_err(dev->dev, "failed to construct encoder\n");
-   ret = PTR_ERR(encoder);
-   goto fail;
-   }
-
/* NOTE: the vsync and error irq's are actually associated with
 * the INTF/encoder.. the easiest way to deal with this (ie. what
 * we do now) is assume a fixed relationship between crtc's and
@@ -224,20 +216,45 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)
 * care of error and vblank irq's that the crtc has registered,
 * and also update user-requested vblank_mask.
 */
-   encoder->possible_crtcs = BIT(0);
-   mdp5_crtc_set_intf(priv->crtcs[0], 3, INTF_HDMI);
+   if (priv->hdmi) {
+  

[PATCH 1/2] drm/msm: Initial add eDP support in msm drm driver (V2)

2014-12-05 Thread Hai Li
This change adds a new eDP connector in msm drm driver. With this
change, eDP panel can work with msm platform under drm framework.

Signed-off-by: Hai Li 
---
 drivers/gpu/drm/msm/Makefile|6 +
 drivers/gpu/drm/msm/edp/edp.c   |  211 
 drivers/gpu/drm/msm/edp/edp.h   |   86 ++
 drivers/gpu/drm/msm/edp/edp_aux.c   |  297 +
 drivers/gpu/drm/msm/edp/edp_bridge.c|  206 
 drivers/gpu/drm/msm/edp/edp_connector.c |  159 +++
 drivers/gpu/drm/msm/edp/edp_ctrl.c  | 1810 +++
 drivers/gpu/drm/msm/edp/edp_phy.c   |  110 ++
 drivers/gpu/drm/msm/msm_drv.h   |6 +
 9 files changed, 2891 insertions(+)
 create mode 100644 drivers/gpu/drm/msm/edp/edp.c
 create mode 100644 drivers/gpu/drm/msm/edp/edp.h
 create mode 100644 drivers/gpu/drm/msm/edp/edp_aux.c
 create mode 100644 drivers/gpu/drm/msm/edp/edp_bridge.c
 create mode 100644 drivers/gpu/drm/msm/edp/edp_connector.c
 create mode 100644 drivers/gpu/drm/msm/edp/edp_ctrl.c
 create mode 100644 drivers/gpu/drm/msm/edp/edp_phy.c

diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile
index 143d988..e5464a0 100644
--- a/drivers/gpu/drm/msm/Makefile
+++ b/drivers/gpu/drm/msm/Makefile
@@ -16,6 +16,12 @@ msm-y := \
hdmi/hdmi_phy_8960.o \
hdmi/hdmi_phy_8x60.o \
hdmi/hdmi_phy_8x74.o \
+   edp/edp.o \
+   edp/edp_aux.o \
+   edp/edp_bridge.o \
+   edp/edp_connector.o \
+   edp/edp_ctrl.o \
+   edp/edp_phy.o \
mdp/mdp_format.o \
mdp/mdp_kms.o \
mdp/mdp4/mdp4_crtc.o \
diff --git a/drivers/gpu/drm/msm/edp/edp.c b/drivers/gpu/drm/msm/edp/edp.c
new file mode 100644
index 000..32e21e1
--- /dev/null
+++ b/drivers/gpu/drm/msm/edp/edp.c
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include "edp.h"
+
+static irqreturn_t edp_irq(int irq, void *dev_id)
+{
+   struct msm_edp *edp = dev_id;
+
+   /* Process eDP irq */
+   return msm_edp_ctrl_irq(edp->ctrl);
+}
+
+static void edp_destroy(struct platform_device *pdev)
+{
+   struct msm_edp *edp = platform_get_drvdata(pdev);
+
+   if (!edp)
+   return;
+
+   if (edp->ctrl) {
+   msm_edp_ctrl_destroy(edp->ctrl);
+   edp->ctrl = NULL;
+   }
+
+   platform_set_drvdata(pdev, NULL);
+
+   devm_kfree(&pdev->dev, edp);
+}
+
+/* construct hdmi at bind/probe time, grab all the resources. */
+static struct msm_edp *edp_init(struct platform_device *pdev)
+{
+   struct msm_edp *edp = NULL;
+   int ret;
+
+   if (!pdev) {
+   pr_err("no edp device\n");
+   ret = -ENXIO;
+   goto fail;
+   }
+
+   edp = devm_kzalloc(&pdev->dev, sizeof(*edp), GFP_KERNEL);
+   if (!edp) {
+   ret = -ENOMEM;
+   goto fail;
+   }
+   DBG("edp probed=%p", edp);
+
+   edp->pdev = pdev;
+   platform_set_drvdata(pdev, edp);
+
+   ret = msm_edp_ctrl_init(edp);
+   if (ret)
+   goto fail;
+
+   return edp;
+
+fail:
+   if (edp)
+   edp_destroy(pdev);
+
+   return ERR_PTR(ret);
+}
+
+static int edp_bind(struct device *dev, struct device *master, void *data)
+{
+   struct drm_device *drm = dev_get_drvdata(master);
+   struct msm_drm_private *priv = drm->dev_private;
+   struct msm_edp *edp;
+
+   DBG("");
+   edp = edp_init(to_platform_device(dev));
+   if (IS_ERR(edp))
+   return PTR_ERR(edp);
+   priv->edp = edp;
+
+   return 0;
+}
+
+static void edp_unbind(struct device *dev, struct device *master,
+   void *data)
+{
+   struct drm_device *drm = dev_get_drvdata(master);
+   struct msm_drm_private *priv = drm->dev_private;
+
+   DBG("");
+   if (priv->edp) {
+   edp_destroy(to_platform_device(dev));
+   priv->edp = NULL;
+   }
+}
+
+static const struct component_ops edp_ops = {
+   .bind   = edp_bind,
+   .unbind = edp_unbind,
+};
+
+static int edp_dev_probe(struct platform_device *pdev)
+{
+   DBG("");
+   return component_add(&pdev->dev, &edp_ops);
+}
+
+static int edp_dev_remove(struct platform_device *pdev)
+{
+   DBG("");
+   component_del(&pdev->dev, &edp_ops);
+   return 0;
+}
+
+static const struct of_device_id dt_match[] = {
+   { .compatible = "qcom,mdss-edp" },
+   {}
+};
+
+static struct platform_driver edp_dr

[Bug 84232] PHINode containing itself causes segfault in LLVM when compiling Blender OpenCL kernel with R600 backend

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=84232

--- Comment #14 from Vitaliy Filippov  ---
Wow!! Tom, did you just fix this bug with commit
857550322c6fe679d17d35c885606ae1d8cf43b6?

-- 
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/20141205/6565f76e/attachment.html>


[Bug 87023] Dota 2 crashed and hang on ATi Mobility Radeon HD 5650 (Acer 4745G)

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=87023

--- Comment #9 from Alex Deucher  ---
Can chance you could bisect mesa to indenfy what commit broke things for you? 
It seems like a software regression to me.

-- 
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/20141205/95d16860/attachment.html>


[PATCH] drm/radeon: KV has three PPLLs (v2)

2014-12-05 Thread Alex Deucher
Enable all three in the driver.  Early documentation
indicated the 3rd one was used for something else, but
that is not the case.

v2: handle disable as well

Signed-off-by: Alex Deucher 
Cc: stable at vger.kernel.org
---
 drivers/gpu/drm/radeon/atombios_crtc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c 
b/drivers/gpu/drm/radeon/atombios_crtc.c
index d59ec49..ed644a4 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1851,10 +1851,9 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc)
return pll;
}
/* otherwise, pick one of the plls */
-   if ((rdev->family == CHIP_KAVERI) ||
-   (rdev->family == CHIP_KABINI) ||
+   if ((rdev->family == CHIP_KABINI) ||
(rdev->family == CHIP_MULLINS)) {
-   /* KB/KV/ML has PPLL1 and PPLL2 */
+   /* KB/ML has PPLL1 and PPLL2 */
pll_in_use = radeon_get_pll_use_mask(crtc);
if (!(pll_in_use & (1 << ATOM_PPLL2)))
return ATOM_PPLL2;
@@ -1863,7 +1862,7 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc)
DRM_ERROR("unable to allocate a PPLL\n");
return ATOM_PPLL_INVALID;
} else {
-   /* CI has PPLL0, PPLL1, and PPLL2 */
+   /* CI/KV has PPLL0, PPLL1, and PPLL2 */
pll_in_use = radeon_get_pll_use_mask(crtc);
if (!(pll_in_use & (1 << ATOM_PPLL2)))
return ATOM_PPLL2;
@@ -2155,6 +2154,7 @@ static void atombios_crtc_disable(struct drm_crtc *crtc)
case ATOM_PPLL0:
/* disable the ppll */
if ((rdev->family == CHIP_ARUBA) ||
+   (rdev->family == CHIP_KAVERI) ||
(rdev->family == CHIP_BONAIRE) ||
(rdev->family == CHIP_HAWAII))
atombios_crtc_program_pll(crtc, radeon_crtc->crtc_id, 
radeon_crtc->pll_id,
-- 
1.8.3.1



[PATCH] drm/bridge: dw_hdmi: use rx sense pins for plug detection if hpd is unreliable

2014-12-05 Thread Philipp Zabel
Due to the voltage divider on the HPD line, the HDMI connector on
imx6q-sabrelite doesn't reliably detect connected DVI monitors.
This patch allows to use the RX_SENSE0 signal as a workaround when
enabled by a boolean device tree property 'hpd-unreliable'.

Signed-off-by: Philipp Zabel 
---
This patch is updated from
http://www.spinics.net/lists/linux-driver-devel/msg45207.html
and rebased on top of Andy Yan's "dw-hdmi: convert imx hdmi to bridge/dw_hdmi"
series.
---
 Documentation/devicetree/bindings/drm/imx/hdmi.txt |  2 ++
 drivers/gpu/drm/bridge/dw_hdmi.c   | 40 --
 2 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/drm/imx/hdmi.txt 
b/Documentation/devicetree/bindings/drm/imx/hdmi.txt
index 1b756cf..c997a3a 100644
--- a/Documentation/devicetree/bindings/drm/imx/hdmi.txt
+++ b/Documentation/devicetree/bindings/drm/imx/hdmi.txt
@@ -22,6 +22,8 @@ Required properties:

 Optional properties:
  - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
+ - hpd-unreliable : if present, the HPD line is to be ignored and the driver
+   should instead use a workaround for sink detection.

 example:

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index cecc46a..b88225c 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -125,6 +125,9 @@ struct dw_hdmi {
struct regmap *regmap;
struct i2c_adapter *ddc;
void __iomem *regs;
+   u8 sink_detect_polarity;
+   u8 sink_detect_status;
+   u8 sink_detect_mask;

unsigned int sample_rate;
int ratio;
@@ -1267,10 +1270,10 @@ static int dw_hdmi_fb_registered(struct dw_hdmi *hdmi)
HDMI_PHY_I2CM_CTLINT_ADDR);

/* enable cable hot plug irq */
-   hdmi_writeb(hdmi, (u8)~HDMI_PHY_HPD, HDMI_PHY_MASK0);
+   hdmi_writeb(hdmi, hdmi->sink_detect_mask, HDMI_PHY_MASK0);

/* Clear Hotplug interrupts */
-   hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0);
+   hdmi_writeb(hdmi, hdmi->sink_detect_status, HDMI_IH_PHY_STAT0);

return 0;
 }
@@ -1490,18 +1493,19 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)

phy_int_pol = hdmi_readb(hdmi, HDMI_PHY_POL0);

-   if (intr_stat & HDMI_IH_PHY_STAT0_HPD) {
-   if (phy_int_pol & HDMI_PHY_HPD) {
+   if (intr_stat & hdmi->sink_detect_status) {
+   int pol_bit = hdmi->sink_detect_polarity;
+
+   if (phy_int_pol & pol_bit) {
dev_dbg(hdmi->dev, "EVENT=plugin\n");

-   hdmi_modb(hdmi, 0, HDMI_PHY_HPD, HDMI_PHY_POL0);
+   hdmi_modb(hdmi, 0, pol_bit, HDMI_PHY_POL0);

dw_hdmi_poweron(hdmi);
} else {
dev_dbg(hdmi->dev, "EVENT=plugout\n");

-   hdmi_modb(hdmi, HDMI_PHY_HPD, HDMI_PHY_HPD,
- HDMI_PHY_POL0);
+   hdmi_modb(hdmi, pol_bit, pol_bit, HDMI_PHY_POL0);

dw_hdmi_poweroff(hdmi);
}
@@ -1509,7 +1513,7 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
}

hdmi_writeb(hdmi, intr_stat, HDMI_IH_PHY_STAT0);
-   hdmi_writeb(hdmi, ~HDMI_IH_PHY_STAT0_HPD, HDMI_IH_MUTE_PHY_STAT0);
+   hdmi_writeb(hdmi, ~hdmi->sink_detect_status, HDMI_IH_MUTE_PHY_STAT0);

return IRQ_HANDLED;
 }
@@ -1648,6 +1652,16 @@ int dw_hdmi_bind(struct device *dev, struct device 
*master,

initialize_hdmi_ih_mutes(hdmi);

+   hdmi->sink_detect_status = HDMI_IH_PHY_STAT0_HPD;
+   hdmi->sink_detect_polarity = HDMI_PHY_HPD;
+   hdmi->sink_detect_mask = ~HDMI_PHY_HPD;
+
+   if (of_property_read_bool(np, "hpd-unreliable")) {
+   hdmi->sink_detect_status = HDMI_IH_PHY_STAT0_RX_SENSE0;
+   hdmi->sink_detect_polarity = HDMI_PHY_RX_SENSE0;
+   hdmi->sink_detect_mask = ~HDMI_PHY_RX_SENSE0;
+   }
+
/*
 * To prevent overflows in HDMI_IH_FC_STAT2, set the clk regenerator
 * N and cts values before enabling phy
@@ -1658,10 +1672,14 @@ int dw_hdmi_bind(struct device *dev, struct device 
*master,
 * Configure registers related to HDMI interrupt
 * generation before registering IRQ.
 */
-   hdmi_writeb(hdmi, HDMI_PHY_HPD, HDMI_PHY_POL0);
+   hdmi_writeb(hdmi, hdmi->sink_detect_polarity, HDMI_PHY_POL0);

/* Clear Hotplug interrupts */
-   hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0);
+   hdmi_writeb(hdmi,
+   HDMI_IH_PHY_STAT0_RX_SENSE3 | HDMI_IH_PHY_STAT0_RX_SENSE2 |
+   HDMI_IH_PHY_STAT0_RX_SENSE1 | HDMI_IH_PHY_STAT0_RX_SENSE0 |
+   HDMI_IH_PHY_STAT0_TX_PHY_LOCK | HDMI_IH_PHY_STAT0_HPD,
+   HDMI_IH_PHY_STAT0);

ret = dw_hdmi_fb_registered(hdmi);
if (ret)
@@ -1672,7 +1690,7 

[PATCH] drm/bridge: dw_hdmi: don't erroneously detect HDMI displays

2014-12-05 Thread Philipp Zabel
From: Lucas Stach 

While having a CEA mode is one prerequisite for using
HDMI transmit mode, we also have to check if the display
is actually capable of HDMI input. Fall back to DVI mode
otherwise.
This patch also gets rid of the unused local EDID copy.

Signed-off-by: Lucas Stach 
Signed-off-by: Philipp Zabel 
---
This patch is updated from
http://www.spinics.net/lists/linux-driver-devel/msg45206.html
and rebased on top of Andy Yan's "dw-hdmi: convert imx hdmi to bridge/dw_hdmi"
series.
---
 drivers/gpu/drm/bridge/dw_hdmi.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index b88225c..58a1718 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -27,8 +27,6 @@

 #include "dw_hdmi.h"

-#define HDMI_EDID_LEN  512
-
 #define RGB0
 #define YCBCR444   1
 #define YCBCR422_16BITS2
@@ -116,8 +114,8 @@ struct dw_hdmi {

int vic;

-   u8 edid[HDMI_EDID_LEN];
bool cable_plugin;
+   bool has_hdmi_monitor;

bool phy_enabled;
struct drm_display_mode previous_mode;
@@ -1182,13 +1180,10 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct 
drm_display_mode *mode)

hdmi->vic = drm_match_cea_mode(mode);

-   if (!hdmi->vic) {
-   dev_dbg(hdmi->dev, "Non-CEA mode used in HDMI\n");
-   hdmi->hdmi_data.video_mode.mdvi = true;
-   } else {
-   dev_dbg(hdmi->dev, "CEA mode used vic=%d\n", hdmi->vic);
+   if (hdmi->has_hdmi_monitor && hdmi->vic)
hdmi->hdmi_data.video_mode.mdvi = false;
-   }
+   else
+   hdmi->hdmi_data.video_mode.mdvi = true;

if ((hdmi->vic == 6) || (hdmi->vic == 7) ||
(hdmi->vic == 21) || (hdmi->vic == 22) ||
@@ -1237,7 +1232,7 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct 
drm_display_mode *mode)
if (hdmi->hdmi_data.video_mode.mdvi) {
dev_dbg(hdmi->dev, "%s DVI mode\n", __func__);
} else {
-   dev_dbg(hdmi->dev, "%s CEA mode\n", __func__);
+   dev_dbg(hdmi->dev, "%s CEA mode VIC=%d\n", __func__, hdmi->vic);

/* HDMI Initialization Step E - Configure audio */
hdmi_clk_regenerator_update_pixel_clock(hdmi);
@@ -1411,9 +1406,11 @@ static int dw_hdmi_connector_get_modes(struct 
drm_connector *connector)

drm_mode_connector_update_edid_property(connector, edid);
ret = drm_add_edid_modes(connector, edid);
+   hdmi->has_hdmi_monitor = drm_detect_hdmi_monitor(edid);
kfree(edid);
} else {
dev_dbg(hdmi->dev, "failed to get edid\n");
+   hdmi->has_hdmi_monitor = false;
}

return 0;
-- 
2.1.3



[PATCH v18 0/12] dw-hdmi: convert imx hdmi to bridge/dw_hdmi

2014-12-05 Thread Philipp Zabel
Hi Andy,

Am Freitag, den 05.12.2014, 14:22 +0800 schrieb Andy Yan:
> We found Freescale imx6 and Rockchip rk3288 and Ingenic JZ4780 (Xburst/MIPS)
> use the interface compatible Designware HDMI IP, but they also have some
> lightly differences, such as phy pll configuration, register width(imx hdmi
> register is one byte, but rk3288 is 4 bytes width and can only be accessed
> by word), 4K support(imx6 doesn't support 4k, but rk3288 does), and HDMI2.0
> support.
> 
> To reuse the imx-hdmi driver, we make this patch set:
> (1): fix some CodingStyle warning to make checkpatch happy
> (2): convert imx-hdmi to drm_bridge
> (3): split platform specific code
> (4): move imx-hdmi to bridge/dw_hdmi
> (5): extend dw_hdmi.c to support rk3288 hdmi
> (6): add rockchip rk3288 platform specific code dw_hdmi-rockchip.c
> 
> Changes in v18:
> - remove a multiple blank lines in imx-hdmi.c
> - fix a checkpatch warning in imx-hdmi_pltfm.c
> - add port bindings
> - correct some spelling mistakes in dw_hdmi bindings doc
> - correct some spelling mistakes in dw_hdmi-rockchip bindings doc
[...]

I am happy with the series so far. Pending Acks from the device tree
maintainers for the new binding documents, I'd like to apply either the
whole of it on top of
git://git.pengutronix.de/git/pza/linux.git imx-drm/next
or take at least the i.MX specific patches (1-5) because of the
dependency on the imx-drm OF helper conversion.

regards
Philipp



[PATCH v18 06/12] dt-bindings: add document for dw_hdmi

2014-12-05 Thread Philipp Zabel
Am Freitag, den 05.12.2014, 14:27 +0800 schrieb Andy Yan:
> Signed-off-by: Andy Yan 

This binding is mostly a copy of the existing
Documentation/devicetree/bindings/drm/imx/hdmi.txt, but there is a new
reg-io-width property to configure the register access bus width and we
have added new compatibles "rockchip,rk3288-dw-hdmi" and the common
"snps,dw-hdmi-tx". Could we get an Ack for this and patch 11 by the
device tree maintainers?

regards
Philipp

> ---
> 
> Changes in v18:
> - add port bindings
> - correct some spelling mistakes in dw_hdmi bindings doc
> 
> Changes in v17: None
> Changes in v16:
> - describe ddc-i2c-bus as optional
> - add common clocks bindings
> 
> Changes in v15: None
> Changes in v14: None
> Changes in v13: None
> Changes in v12: None
> Changes in v11: None
> Changes in v10: None
> Changes in v9: None
> Changes in v8:
> - correct some spelling mistake
> - modify ddc-i2c-bus and interrupt description
> 
> Changes in v7: None
> Changes in v6: None
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> 
>  .../devicetree/bindings/drm/bridge/dw_hdmi.txt | 50 
> ++
>  1 file changed, 50 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
> 
> diff --git a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt 
> b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
> new file mode 100644
> index 000..a905c14
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
> @@ -0,0 +1,50 @@
> +DesignWare HDMI bridge bindings
> +
> +Required properties:
> +- compatible: platform specific such as:
> +   * "snps,dw-hdmi-tx"
> +   * "fsl,imx6q-hdmi"
> +   * "fsl,imx6dl-hdmi"
> +   * "rockchip,rk3288-dw-hdmi"
> +- reg: Physical base address and length of the controller's registers.
> +- interrupts: The HDMI interrupt number
> +- clocks, clock-names : must have the phandles to the HDMI iahb and isfr 
> clocks,
> +  as described in Documentation/devicetree/bindings/clock/clock-bindings.txt,
> +  the clocks are soc specific, the clock-names should be "iahb", "isfr"
> +-port@[X]: SoC specific port nodes with endpoint definitions as defined
> +   in Documentation/devicetree/bindings/media/video-interfaces.txt,
> +   please refer to the SoC specific binding document:
> +* Documentation/devicetree/bindings/drm/imx/hdmi.txt
> +* Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt
> +
> +Optional properties
> +- reg-io-width: the width of the reg:1,4, default set to 1 if not present
> +- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
> +- clocks, clock-names: phandle to the HDMI CEC clock, name should be "cec"
> +
> +Example:
> + hdmi: hdmi at 012 {
> + compatible = "fsl,imx6q-hdmi";
> + reg = <0x0012 0x9000>;
> + interrupts = <0 115 0x04>;
> + gpr = <&gpr>;
> + clocks = <&clks 123>, <&clks 124>;
> + clock-names = "iahb", "isfr";
> + ddc-i2c-bus = <&i2c2>;
> +
> + port at 0 {
> + reg = <0>;
> +
> + hdmi_mux_0: endpoint {
> + remote-endpoint = <&ipu1_di0_hdmi>;
> + };
> + };
> +
> + port at 1 {
> + reg = <1>;
> +
> + hdmi_mux_1: endpoint {
> + remote-endpoint = <&ipu1_di1_hdmi>;
> + };
> + };
> + };




[PATCH v18 12/12] drm: bridge/dw_hdmi: add rockchip rk3288 support

2014-12-05 Thread Andy Yan
Rockchip RK3288 hdmi is compatible with dw_hdmi

this patch is depend on patch by Mark Yao
drm: rockchip: Add basic drm driver
see https://lkml.org/lkml/2014/12/2/161

Signed-off-by: Andy Yan 

---

Changes in v18: None
Changes in v17:
- parse resource and irq in platform driver

Changes in v16: None
Changes in v15:
- remove THIS_MODULE in platform driver

Changes in v14: None
Changes in v13: None
Changes in v12:
- add comment for the depend on patch

Changes in v11: None
Changes in v10:
- add more display mode support mpll configuration for rk3288

Changes in v9:
- move some phy configuration to platform driver

Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/dw_hdmi.c|   3 +
 drivers/gpu/drm/rockchip/Kconfig|  10 +
 drivers/gpu/drm/rockchip/Makefile   |   2 +
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 341 
 include/drm/bridge/dw_hdmi.h|   1 +
 5 files changed, 357 insertions(+)
 create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index cecc46a..01c95a8 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -852,6 +852,9 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, 
unsigned char prep,
dw_hdmi_phy_gen2_txpwron(hdmi, 1);
dw_hdmi_phy_gen2_pddq(hdmi, 0);

+   if (hdmi->dev_type == RK3288_HDMI)
+   dw_hdmi_phy_enable_spare(hdmi, 1);
+
/*Wait for PHY PLL lock */
msec = 5;
do {
diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index ca9f085..6ebebe8 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -15,3 +15,13 @@ config DRM_ROCKCHIP
  management to userspace. This driver does not provide
  2D or 3D acceleration; acceleration is performed by other
  IP found on the SoC.
+
+config ROCKCHIP_DW_HDMI
+bool "Rockchip specific extensions for Synopsys DW HDMI"
+depends on DRM_ROCKCHIP
+select DRM_DW_HDMI
+help
+ This selects support for Rockchip SoC specific extensions
+ for the Synopsys DesignWare HDMI driver. If you want to
+ enable HDMI on RK3288 based SoC, you should selet this
+ option.
diff --git a/drivers/gpu/drm/rockchip/Makefile 
b/drivers/gpu/drm/rockchip/Makefile
index 2cb0672..beed7df 100644
--- a/drivers/gpu/drm/rockchip/Makefile
+++ b/drivers/gpu/drm/rockchip/Makefile
@@ -5,4 +5,6 @@
 rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o rockchip_drm_fbdev.o \
rockchip_drm_gem.o

+rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
+
 obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o rockchip_drm_vop.o
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
new file mode 100644
index 000..11d54b0
--- /dev/null
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -0,0 +1,341 @@
+/*
+ * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "rockchip_drm_drv.h"
+#include "rockchip_drm_vop.h"
+
+#define GRF_SOC_CON60x025c
+#define HDMI_SEL_VOP_LIT(1 << 4)
+
+struct rockchip_hdmi {
+   struct device *dev;
+   struct regmap *regmap;
+   struct drm_encoder encoder;
+};
+
+#define to_rockchip_hdmi(x)container_of(x, struct rockchip_hdmi, x)
+
+static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = {
+   {
+   2700, {
+   { 0x00b3, 0x},
+   { 0x2153, 0x},
+   { 0x40f3, 0x}
+   },
+   }, {
+   3600, {
+   { 0x00b3, 0x},
+   { 0x2153, 0x},
+   { 0x40f3, 0x}
+   },
+   }, {
+   4000, {
+   { 0x00b3, 0x},
+   { 0x2153, 0x},
+   { 0x40f3, 0x}
+   },
+   }, {
+   5400, {
+   { 0x0072, 0x0001},
+   { 0x2142, 0x0001},
+   { 0x40a2, 0x0001},
+   },
+   }, {
+   6500, {
+   { 0x0072, 0x0001},
+   { 0x2142, 0x0001},
+   { 0x40a2, 0x0001},
+   },
+   }, {
+   6600, {
+   {

[PATCH v18 11/12] dt-bindings: Add documentation for rockchip dw hdmi

2014-12-05 Thread Andy Yan
Signed-off-by: Andy Yan 

---

Changes in v18:
- correct some spelling mistakes in dw_hdmi-rockchip bindings doc

Changes in v17: None
Changes in v16:
- modify clocks bindings
- descrbie ddc-i2c-bus as optional

Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8:
- Add documentation for rockchip dw hdmi

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 .../devicetree/bindings/video/dw_hdmi-rockchip.txt | 46 ++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt

diff --git a/Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt 
b/Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt
new file mode 100644
index 000..668091f
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt
@@ -0,0 +1,46 @@
+Rockchip specific extensions to the Synopsys Designware HDMI
+
+
+Required properties:
+- compatible: "rockchip,rk3288-dw-hdmi";
+- reg: Physical base address and length of the controller's registers.
+- clocks: phandle to hdmi iahb and isfr clocks.
+- clock-names: should be "iahb" "isfr"
+- rockchip,grf: this soc should set GRF regs to mux vopl/vopb.
+- interrupts: HDMI interrupt number
+- ports: contain a port node with endpoint definitions as defined in
+  Documentation/devicetree/bindings/media/video-interfaces.txt. For
+  vopb,set the reg = <0> and set the reg = <1> for vopl.
+- reg-io-width: the width of the reg:1,4, the value should be 4 on
+  rk3288 platform
+
+Optional properties
+- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
+- clocks, clock-names: phandle to the HDMI CEC clock, name should be "cec"
+
+Example:
+hdmi: hdmi at ff98 {
+   compatible = "rockchip,rk3288-dw-hdmi";
+   reg = <0xff98 0x2>;
+   reg-io-width = <4>;
+   ddc-i2c-bus = <&i2c5>;
+   rockchip,grf = <&grf>;
+   interrupts = ;
+   clocks = <&cru  PCLK_HDMI_CTRL>, <&cru SCLK_HDMI_HDCP>;
+   clock-names = "iahb", "isfr";
+   status = "disabled";
+   ports {
+   hdmi_in: port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   hdmi_in_vopb: endpoint at 0 {
+   reg = <0>;
+   remote-endpoint = <&vopb_out_hdmi>;
+   };
+   hdmi_in_vopl: endpoint at 1 {
+   reg = <1>;
+   remote-endpoint = <&vopl_out_hdmi>;
+   };
+   };
+   };
+};
-- 
1.9.1




[PATCH v18 10/12] drm: bridge/dw_hdmi: add function dw_hdmi_phy_enable_spare

2014-12-05 Thread Andy Yan
RK3288 HDMI will not work without the spare bit of
HDMI_PHY_CONF0 enable

Signed-off-by: Andy Yan 
---

Changes in v18: None
Changes in v17: None
Changes in v16: None
Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/dw_hdmi.c | 7 +++
 drivers/gpu/drm/bridge/dw_hdmi.h | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index 2264ec1..cecc46a 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -713,6 +713,13 @@ static void dw_hdmi_phy_enable_tmds(struct dw_hdmi *hdmi, 
u8 enable)
 HDMI_PHY_CONF0_ENTMDS_MASK);
 }

+static void dw_hdmi_phy_enable_spare(struct dw_hdmi *hdmi, u8 enable)
+{
+   hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0,
+HDMI_PHY_CONF0_SPARECTRL_OFFSET,
+HDMI_PHY_CONF0_SPARECTRL_MASK);
+}
+
 static void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable)
 {
hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0,
diff --git a/drivers/gpu/drm/bridge/dw_hdmi.h b/drivers/gpu/drm/bridge/dw_hdmi.h
index baa7849..175dbc8 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.h
+++ b/drivers/gpu/drm/bridge/dw_hdmi.h
@@ -837,7 +837,8 @@ enum {
HDMI_PHY_CONF0_PDZ_OFFSET = 7,
HDMI_PHY_CONF0_ENTMDS_MASK = 0x40,
HDMI_PHY_CONF0_ENTMDS_OFFSET = 6,
-   HDMI_PHY_CONF0_SPARECTRL = 0x20,
+   HDMI_PHY_CONF0_SPARECTRL_MASK = 0x20,
+   HDMI_PHY_CONF0_SPARECTRL_OFFSET = 5,
HDMI_PHY_CONF0_GEN2_PDDQ_MASK = 0x10,
HDMI_PHY_CONF0_GEN2_PDDQ_OFFSET = 4,
HDMI_PHY_CONF0_GEN2_TXPWRON_MASK = 0x8,
-- 
1.9.1




[PATCH v18 09/12] drm: bridge/dw_hdmi: clear i2cmphy_stat0 reg in hdmi_phy_wait_i2c_done

2014-12-05 Thread Andy Yan
HDMI_IH_I2CMPHY_STAT0 is a clear on write register, which indicates i2cm
operation status(i2c transfer done or error), every hdmi phy register
configuration must check this register to make sure the configuration
has complete. But the indication bit should be cleared after check, otherwise
the corresponding bit will hold on forever, this may give a wrong signal for
next check.

Signed-off-by: Andy Yan 
---

Changes in v18: None
Changes in v17: None
Changes in v16: None
Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/dw_hdmi.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index d5bec0c..2264ec1 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -666,11 +666,15 @@ static inline void hdmi_phy_test_dout(struct dw_hdmi 
*hdmi,

 static bool hdmi_phy_wait_i2c_done(struct dw_hdmi *hdmi, int msec)
 {
-   while ((hdmi_readb(hdmi, HDMI_IH_I2CMPHY_STAT0) & 0x3) == 0) {
+   u32 val;
+
+   while ((val = hdmi_readb(hdmi, HDMI_IH_I2CMPHY_STAT0) & 0x3) == 0) {
if (msec-- == 0)
return false;
udelay(1000);
}
+   hdmi_writeb(hdmi, val, HDMI_IH_I2CMPHY_STAT0);
+
return true;
 }

-- 
1.9.1




[PATCH v18 08/12] drm: bridge/dw_hdmi: add mode_valid support

2014-12-05 Thread Andy Yan
some platform may not support all the display mode,
add mode_valid interface check it

Signed-off-by: Andy Yan 

---

Changes in v18: None
Changes in v17: None
Changes in v16: None
Changes in v15: None
Changes in v14:
- remove drm_connector_register, because imx-drm core has registered
connector

Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/dw_hdmi.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index d49861c..d5bec0c 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -1405,6 +1405,20 @@ static int dw_hdmi_connector_get_modes(struct 
drm_connector *connector)
return 0;
 }

+static enum drm_mode_status
+dw_hdmi_connector_mode_valid(struct drm_connector *connector,
+struct drm_display_mode *mode)
+{
+   struct dw_hdmi *hdmi = container_of(connector,
+  struct dw_hdmi, connector);
+   enum drm_mode_status mode_status = MODE_OK;
+
+   if (hdmi->plat_data->mode_valid)
+   mode_status = hdmi->plat_data->mode_valid(connector, mode);
+
+   return mode_status;
+}
+
 static struct drm_encoder *dw_hdmi_connector_best_encoder(struct drm_connector
   *connector)
 {
@@ -1429,6 +1443,7 @@ static struct drm_connector_funcs dw_hdmi_connector_funcs 
= {

 static struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs = {
.get_modes = dw_hdmi_connector_get_modes,
+   .mode_valid = dw_hdmi_connector_mode_valid,
.best_encoder = dw_hdmi_connector_best_encoder,
 };

-- 
1.9.1




[PATCH v18 07/12] drm: bridge/dw_hdmi: add support for multi-byte register width access

2014-12-05 Thread Andy Yan
On rockchip rk3288, only word(32-bit) accesses are
permitted for hdmi registers.  Byte width accesses (writeb,
readb) generate an imprecise external abort.

Signed-off-by: Andy Yan 

---

Changes in v18: None
Changes in v17: None
Changes in v16: None
Changes in v15:
- remove unio of the multi-byte register access, adviced by Philipp Zabel

Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6:
- refactor register access without reg_shift

Changes in v5:
- refactor reg-io-width

Changes in v4: None
Changes in v3:
- split multi-register access to one indepent patch

 drivers/gpu/drm/bridge/dw_hdmi.c | 44 ++--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index e0a7bc3..d49861c 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -128,18 +128,41 @@ struct dw_hdmi {

unsigned int sample_rate;
int ratio;
+
+   void (*write)(struct dw_hdmi *hdmi, u8 val, int offset);
+   u8 (*read)(struct dw_hdmi *hdmi, int offset);
 };

-static inline void hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset)
+static void dw_hdmi_writel(struct dw_hdmi *hdmi, u8 val, int offset)
+{
+   writel(val, hdmi->regs + (offset << 2));
+}
+
+static u8 dw_hdmi_readl(struct dw_hdmi *hdmi, int offset)
+{
+   return readl(hdmi->regs + (offset << 2));
+}
+
+static void dw_hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset)
 {
writeb(val, hdmi->regs + offset);
 }

-static inline u8 hdmi_readb(struct dw_hdmi *hdmi, int offset)
+static u8 dw_hdmi_readb(struct dw_hdmi *hdmi, int offset)
 {
return readb(hdmi->regs + offset);
 }

+static inline void hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset)
+{
+   hdmi->write(hdmi, val, offset);
+}
+
+static inline u8 hdmi_readb(struct dw_hdmi *hdmi, int offset)
+{
+   return hdmi->read(hdmi, offset);
+}
+
 static void hdmi_modb(struct dw_hdmi *hdmi, u8 data, u8 mask, unsigned reg)
 {
u8 val = hdmi_readb(hdmi, reg) & ~mask;
@@ -1511,6 +1534,7 @@ int dw_hdmi_bind(struct device *dev, struct device 
*master,
struct device_node *ddc_node;
struct dw_hdmi *hdmi;
int ret;
+   u32 val = 1;

hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL);
if (!hdmi)
@@ -1523,6 +1547,22 @@ int dw_hdmi_bind(struct device *dev, struct device 
*master,
hdmi->ratio = 100;
hdmi->encoder = encoder;

+   of_property_read_u32(np, "reg-io-width", &val);
+
+   switch (val) {
+   case 4:
+   hdmi->write = dw_hdmi_writel;
+   hdmi->read = dw_hdmi_readl;
+   break;
+   case 1:
+   hdmi->write = dw_hdmi_writeb;
+   hdmi->read = dw_hdmi_readb;
+   break;
+   default:
+   dev_err(dev, "reg-io-width must be 1 or 4\n");
+   return -EINVAL;
+   }
+
ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
if (ddc_node) {
hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
-- 
1.9.1




[PATCH v18 06/12] dt-bindings: add document for dw_hdmi

2014-12-05 Thread Andy Yan
Signed-off-by: Andy Yan 

---

Changes in v18:
- add port bindings
- correct some spelling mistakes in dw_hdmi bindings doc

Changes in v17: None
Changes in v16:
- describe ddc-i2c-bus as optional
- add common clocks bindings

Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8:
- correct some spelling mistake
- modify ddc-i2c-bus and interrupt description

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 .../devicetree/bindings/drm/bridge/dw_hdmi.txt | 50 ++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt

diff --git a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt 
b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
new file mode 100644
index 000..a905c14
--- /dev/null
+++ b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
@@ -0,0 +1,50 @@
+DesignWare HDMI bridge bindings
+
+Required properties:
+- compatible: platform specific such as:
+   * "snps,dw-hdmi-tx"
+   * "fsl,imx6q-hdmi"
+   * "fsl,imx6dl-hdmi"
+   * "rockchip,rk3288-dw-hdmi"
+- reg: Physical base address and length of the controller's registers.
+- interrupts: The HDMI interrupt number
+- clocks, clock-names : must have the phandles to the HDMI iahb and isfr 
clocks,
+  as described in Documentation/devicetree/bindings/clock/clock-bindings.txt,
+  the clocks are soc specific, the clock-names should be "iahb", "isfr"
+-port@[X]: SoC specific port nodes with endpoint definitions as defined
+   in Documentation/devicetree/bindings/media/video-interfaces.txt,
+   please refer to the SoC specific binding document:
+* Documentation/devicetree/bindings/drm/imx/hdmi.txt
+* Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt
+
+Optional properties
+- reg-io-width: the width of the reg:1,4, default set to 1 if not present
+- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
+- clocks, clock-names: phandle to the HDMI CEC clock, name should be "cec"
+
+Example:
+   hdmi: hdmi at 012 {
+   compatible = "fsl,imx6q-hdmi";
+   reg = <0x0012 0x9000>;
+   interrupts = <0 115 0x04>;
+   gpr = <&gpr>;
+   clocks = <&clks 123>, <&clks 124>;
+   clock-names = "iahb", "isfr";
+   ddc-i2c-bus = <&i2c2>;
+
+   port at 0 {
+   reg = <0>;
+
+   hdmi_mux_0: endpoint {
+   remote-endpoint = <&ipu1_di0_hdmi>;
+   };
+   };
+
+   port at 1 {
+   reg = <1>;
+
+   hdmi_mux_1: endpoint {
+   remote-endpoint = <&ipu1_di1_hdmi>;
+   };
+   };
+   };
-- 
1.9.1




[PATCH v18 05/12] drm: imx: imx-hdmi: move imx-hdmi to bridge/dw_hdmi

2014-12-05 Thread Andy Yan
the original imx hdmi driver is under drm/imx/,
which depends on imx-drm, so move the imx hdmi
driver out to drm/bridge and rename it to dw_hdmi

Signed-off-by: Andy Yan 

---

Changes in v18: None
Changes in v17:
- remove prompt message of dw_hdmi, adviced by Russel King

Changes in v16: None
Changes in v15:
- add prefix dw_hdmi/DW_HDMI for public used dw_hdmi structs
  adviced by Philipp Zabel
- remove THIS_MODULE in platform driver

Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/Kconfig |   5 +
 drivers/gpu/drm/bridge/Makefile|   1 +
 .../gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c}   | 278 +++--
 .../gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h}   |  43 
 drivers/gpu/drm/imx/Kconfig|   1 +
 drivers/gpu/drm/imx/Makefile   |   2 +-
 .../drm/imx/{imx-hdmi_pltfm.c => dw_hdmi-imx.c}| 110 
 include/drm/bridge/dw_hdmi.h   |  60 +
 8 files changed, 262 insertions(+), 238 deletions(-)
 rename drivers/gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c} (84%)
 rename drivers/gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h} (98%)
 rename drivers/gpu/drm/imx/{imx-hdmi_pltfm.c => dw_hdmi-imx.c} (58%)
 create mode 100644 include/drm/bridge/dw_hdmi.h

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 884923f..4d822f0 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -3,3 +3,8 @@ config DRM_PTN3460
depends on DRM
select DRM_KMS_HELPER
---help---
+
+config DRM_DW_HDMI
+   bool
+   depends on DRM
+   select DRM_KMS_HELPER
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index b4733e1..d8a8cfd 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -1,3 +1,4 @@
 ccflags-y := -Iinclude/drm

 obj-$(CONFIG_DRM_PTN3460) += ptn3460.o
+obj-$(CONFIG_DRM_DW_HDMI) += dw_hdmi.o
diff --git a/drivers/gpu/drm/imx/imx-hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
similarity index 84%
rename from drivers/gpu/drm/imx/imx-hdmi.c
rename to drivers/gpu/drm/bridge/dw_hdmi.c
index 409fb4f..e0a7bc3 100644
--- a/drivers/gpu/drm/imx/imx-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -6,12 +6,11 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * SH-Mobile High-Definition Multimedia Interface (HDMI) driver
- * for SLISHDMI13T and SLIPHDMIT IP cores
+ * Designware High-Definition Multimedia Interface (HDMI) driver
  *
  * Copyright (C) 2010, Guennadi Liakhovetski 
  */
-
+#include 
 #include 
 #include 
 #include 
@@ -24,8 +23,9 @@
 #include 
 #include 
 #include 
+#include 

-#include "imx-hdmi.h"
+#include "dw_hdmi.h"

 #define HDMI_EDID_LEN  512

@@ -101,18 +101,19 @@ struct hdmi_data_info {
struct hdmi_vmode video_mode;
 };

-struct imx_hdmi {
+struct dw_hdmi {
struct drm_connector connector;
struct drm_encoder *encoder;
struct drm_bridge *bridge;

-   enum imx_hdmi_devtype dev_type;
+   enum dw_hdmi_devtype dev_type;
struct device *dev;
struct clk *isfr_clk;
struct clk *iahb_clk;

struct hdmi_data_info hdmi_data;
-   const struct imx_hdmi_plat_data *plat_data;
+   const struct dw_hdmi_plat_data *plat_data;
+
int vic;

u8 edid[HDMI_EDID_LEN];
@@ -129,17 +130,17 @@ struct imx_hdmi {
int ratio;
 };

-static inline void hdmi_writeb(struct imx_hdmi *hdmi, u8 val, int offset)
+static inline void hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset)
 {
writeb(val, hdmi->regs + offset);
 }

-static inline u8 hdmi_readb(struct imx_hdmi *hdmi, int offset)
+static inline u8 hdmi_readb(struct dw_hdmi *hdmi, int offset)
 {
return readb(hdmi->regs + offset);
 }

-static void hdmi_modb(struct imx_hdmi *hdmi, u8 data, u8 mask, unsigned reg)
+static void hdmi_modb(struct dw_hdmi *hdmi, u8 data, u8 mask, unsigned reg)
 {
u8 val = hdmi_readb(hdmi, reg) & ~mask;

@@ -147,13 +148,13 @@ static void hdmi_modb(struct imx_hdmi *hdmi, u8 data, u8 
mask, unsigned reg)
hdmi_writeb(hdmi, val, reg);
 }

-static void hdmi_mask_writeb(struct imx_hdmi *hdmi, u8 data, unsigned int reg,
+static void hdmi_mask_writeb(struct dw_hdmi *hdmi, u8 data, unsigned int reg,
 u8 shift, u8 mask)
 {
hdmi_modb(hdmi, data << shift, mask, reg);
 }

-static void hdmi_set_clock_regenerator_n(struct imx_hdmi *hdmi,
+static void hdmi_set_clock_regenerator_n(struct dw_hdmi *hdmi,
 unsigned int value)
 {
hdmi_writeb(hdmi, value & 0xff, HDMI_AUD_N1);
@@ -164,7 +165,7 @@ static void hdmi_set_clock_regenerat

[PATCH v18 04/12] drm: imx: imx-hdmi: split phy configuration to platform driver

2014-12-05 Thread Andy Yan
hdmi phy configuration is platform specific, which can be adusted
according to the board to get the best SI

Signed-off-by: Andy Yan 

---

Changes in v18: None
Changes in v17: None
Changes in v16: None
Changes in v15: None
Changes in v14: None
Changes in v13:
- split phy configuration from patch#4

Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/imx/imx-hdmi.c   | 85 +++-
 drivers/gpu/drm/imx/imx-hdmi.h   | 29 
 drivers/gpu/drm/imx/imx-hdmi_pltfm.c | 57 
 3 files changed, 101 insertions(+), 70 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-hdmi.c b/drivers/gpu/drm/imx/imx-hdmi.c
index d72f82c..409fb4f 100644
--- a/drivers/gpu/drm/imx/imx-hdmi.c
+++ b/drivers/gpu/drm/imx/imx-hdmi.c
@@ -713,76 +713,14 @@ static void imx_hdmi_phy_sel_interface_control(struct 
imx_hdmi *hdmi, u8 enable)
 HDMI_PHY_CONF0_SELDIPIF_MASK);
 }

-enum {
-   RES_8,
-   RES_10,
-   RES_12,
-   RES_MAX,
-};
-
-struct mpll_config {
-   unsigned long mpixelclock;
-   struct {
-   u16 cpce;
-   u16 gmp;
-   } res[RES_MAX];
-};
-
-static const struct mpll_config mpll_config[] = {
-   {
-   4525, {
-   { 0x01e0, 0x },
-   { 0x21e1, 0x },
-   { 0x41e2, 0x }
-   },
-   }, {
-   9250, {
-   { 0x0140, 0x0005 },
-   { 0x2141, 0x0005 },
-   { 0x4142, 0x0005 },
-   },
-   }, {
-   14850, {
-   { 0x00a0, 0x000a },
-   { 0x20a1, 0x000a },
-   { 0x40a2, 0x000a },
-   },
-   }, {
-   ~0UL, {
-   { 0x00a0, 0x000a },
-   { 0x2001, 0x000f },
-   { 0x4002, 0x000f },
-   },
-   }
-};
-
-struct curr_ctrl {
-   unsigned long mpixelclock;
-   u16 curr[RES_MAX];
-};
-
-static const struct curr_ctrl curr_ctrl[] = {
-   /*  pixelclk bpp8bpp10   bpp12 */
-   {
-5400, { 0x091c, 0x091c, 0x06dc },
-   }, {
-5840, { 0x091c, 0x06dc, 0x06dc },
-   }, {
-7200, { 0x06dc, 0x06dc, 0x091c },
-   }, {
-7425, { 0x06dc, 0x0b5c, 0x091c },
-   }, {
-   11880, { 0x091c, 0x091c, 0x06dc },
-   }, {
-   21600, { 0x06dc, 0x0b5c, 0x091c },
-   }
-};
-
 static int hdmi_phy_configure(struct imx_hdmi *hdmi, unsigned char prep,
  unsigned char res, int cscon)
 {
unsigned res_idx, i;
u8 val, msec;
+   const struct mpll_config *mpll_config = hdmi->plat_data->mpll_cfg;
+   const struct curr_ctrl   *curr_ctrl = hdmi->plat_data->cur_ctr;
+   const struct sym_term *sym_term =  hdmi->plat_data->sym_term;

if (prep)
return -EINVAL;
@@ -828,7 +766,7 @@ static int hdmi_phy_configure(struct imx_hdmi *hdmi, 
unsigned char prep,
hdmi_phy_test_clear(hdmi, 0);

/* PLL/MPLL Cfg - always match on final entry */
-   for (i = 0; i < ARRAY_SIZE(mpll_config) - 1; i++)
+   for (i = 0; mpll_config[i].mpixelclock != (~0UL); i++)
if (hdmi->hdmi_data.video_mode.mpixelclock <=
mpll_config[i].mpixelclock)
break;
@@ -836,12 +774,12 @@ static int hdmi_phy_configure(struct imx_hdmi *hdmi, 
unsigned char prep,
hdmi_phy_i2c_write(hdmi, mpll_config[i].res[res_idx].cpce, 0x06);
hdmi_phy_i2c_write(hdmi, mpll_config[i].res[res_idx].gmp, 0x15);

-   for (i = 0; i < ARRAY_SIZE(curr_ctrl); i++)
+   for (i = 0; curr_ctrl[i].mpixelclock != (~0UL); i++)
if (hdmi->hdmi_data.video_mode.mpixelclock <=
curr_ctrl[i].mpixelclock)
break;

-   if (i >= ARRAY_SIZE(curr_ctrl)) {
+   if (curr_ctrl[i].mpixelclock == (~0UL)) {
dev_err(hdmi->dev, "Pixel clock %d - unsupported by HDMI\n",
hdmi->hdmi_data.video_mode.mpixelclock);
return -EINVAL;
@@ -852,10 +790,17 @@ static int hdmi_phy_configure(struct imx_hdmi *hdmi, 
unsigned char prep,

hdmi_phy_i2c_write(hdmi, 0x, 0x13);  /* PLLPHBYCTRL */
hdmi_phy_i2c_write(hdmi, 0x0006, 0x17);
+
+   for (i = 0; sym_term[i].mpixelclock != (~0UL); i++)
+   if (hdmi->hdmi_data.video_mode.mpixelclock <=
+   sym_term[i].mpixelclock)
+   break;
+
/* RESISTANCE TERM 133Ohm Cfg */
-   hdmi_phy_i2c_write(hdmi, 0x0005, 0x19);  /* TXTERM */
+   hdmi_phy_i2c_write(hdmi,

[PATCH v18 03/12] drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode

2014-12-05 Thread Andy Yan
IMX6 and Rockchip RK3288 and JZ4780 (Ingenic Xburst/MIPS)
use the interface compatible Designware HDMI IP, but they
also have some lightly differences, such as phy pll configuration,
register width, 4K support, clk useage, and the crtc mux configuration
is also platform specific.

To reuse the imx hdmi driver, convert it to drm_bridge

handle encoder in imx-hdmi_pltfm.c, as most of the encoder
operation are platform specific such as crtc select and
panel format set

This patch depends on Russell King's patch:
 drm: imx: convert imx-drm to use the generic DRM OF helper
 
http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2014-July/053484.html

Signed-off-by: Andy Yan 
Signed-off-by: Yakir Yang 

---

Changes in v18:
- remove a multiple blank lines in imx-hdmi.c
- fix a checkpatch warning in imx-hdmi_pltfm.c

Changes in v17:
- remove platform device stuff, adviced by Russell King

Changes in v16:
- use the common binding for the clocks

Changes in v15: None
Changes in v14:
- add defer probing, adviced by Philipp Zabel

Changes in v13:
- split platform specific phy configuration

Changes in v12:
- squash patch 

Changes in v11:
- squash patch  

Changes in v10:
- split generic dw_hdmi.c improvements from patch#11 (add rk3288 support)

Changes in v9: None
Changes in v8: None
Changes in v7:
- remove unused variables from structure dw_hdmi
- remove a wrong modification
- add copyrights for dw_hdmi-imx.c

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/imx/Makefile |   2 +-
 drivers/gpu/drm/imx/imx-hdmi.c   | 258 +--
 drivers/gpu/drm/imx/imx-hdmi.h   |  15 ++
 drivers/gpu/drm/imx/imx-hdmi_pltfm.c | 203 +++
 4 files changed, 315 insertions(+), 163 deletions(-)
 create mode 100644 drivers/gpu/drm/imx/imx-hdmi_pltfm.c

diff --git a/drivers/gpu/drm/imx/Makefile b/drivers/gpu/drm/imx/Makefile
index 582c438..63cf56a 100644
--- a/drivers/gpu/drm/imx/Makefile
+++ b/drivers/gpu/drm/imx/Makefile
@@ -9,4 +9,4 @@ obj-$(CONFIG_DRM_IMX_LDB) += imx-ldb.o

 imx-ipuv3-crtc-objs  := ipuv3-crtc.o ipuv3-plane.o
 obj-$(CONFIG_DRM_IMX_IPUV3)+= imx-ipuv3-crtc.o
-obj-$(CONFIG_DRM_IMX_HDMI) += imx-hdmi.o
+obj-$(CONFIG_DRM_IMX_HDMI) += imx-hdmi.o imx-hdmi_pltfm.o
diff --git a/drivers/gpu/drm/imx/imx-hdmi.c b/drivers/gpu/drm/imx/imx-hdmi.c
index 7a54d20..d72f82c 100644
--- a/drivers/gpu/drm/imx/imx-hdmi.c
+++ b/drivers/gpu/drm/imx/imx-hdmi.c
@@ -12,25 +12,20 @@
  * Copyright (C) 2010, Guennadi Liakhovetski 
  */

-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 

+#include 
 #include 
 #include 
 #include 
 #include 
-#include 

 #include "imx-hdmi.h"
-#include "imx-drm.h"

 #define HDMI_EDID_LEN  512

@@ -54,11 +49,6 @@ enum hdmi_datamap {
YCbCr422_12B = 0x12,
 };

-enum imx_hdmi_devtype {
-   IMX6Q_HDMI,
-   IMX6DL_HDMI,
-};
-
 static const u16 csc_coeff_default[3][4] = {
{ 0x2000, 0x, 0x, 0x },
{ 0x, 0x2000, 0x, 0x },
@@ -113,7 +103,8 @@ struct hdmi_data_info {

 struct imx_hdmi {
struct drm_connector connector;
-   struct drm_encoder encoder;
+   struct drm_encoder *encoder;
+   struct drm_bridge *bridge;

enum imx_hdmi_devtype dev_type;
struct device *dev;
@@ -121,6 +112,7 @@ struct imx_hdmi {
struct clk *iahb_clk;

struct hdmi_data_info hdmi_data;
+   const struct imx_hdmi_plat_data *plat_data;
int vic;

u8 edid[HDMI_EDID_LEN];
@@ -137,13 +129,6 @@ struct imx_hdmi {
int ratio;
 };

-static void imx_hdmi_set_ipu_di_mux(struct imx_hdmi *hdmi, int ipu_di)
-{
-   regmap_update_bits(hdmi->regmap, IOMUXC_GPR3,
-  IMX6Q_GPR3_HDMI_MUX_CTL_MASK,
-  ipu_di << IMX6Q_GPR3_HDMI_MUX_CTL_SHIFT);
-}
-
 static inline void hdmi_writeb(struct imx_hdmi *hdmi, u8 val, int offset)
 {
writeb(val, hdmi->regs + offset);
@@ -1371,6 +1356,50 @@ static void imx_hdmi_poweroff(struct imx_hdmi *hdmi)
imx_hdmi_phy_disable(hdmi);
 }

+static void imx_hdmi_bridge_mode_set(struct drm_bridge *bridge,
+struct drm_display_mode *mode,
+struct drm_display_mode *adjusted_mode)
+{
+   struct imx_hdmi *hdmi = bridge->driver_private;
+
+   imx_hdmi_setup(hdmi, mode);
+
+   /* Store the display mode for plugin/DKMS poweron events */
+   memcpy(&hdmi->previous_mode, mode, sizeof(hdmi->previous_mode));
+}
+
+static bool imx_hdmi_bridge_mode_fixup(struct drm_bridge *bridge,
+  const struct drm_display_mode *mode,
+  struct drm_display_mode *adjusted_mode)
+{
+   return true;
+}
+
+static void imx_hdmi_bridge_disable(struct drm_bridge *bridge)
+{
+   struct imx_hdmi *hdmi = bridge->driver_private;
+
+   imx_

[PATCH v18 02/12] drm: imx: imx-hdmi: return defer if can't get ddc i2c adapter

2014-12-05 Thread Andy Yan
drm driver may probe before the i2c bus, so the driver should
defer probing until it is available

Signed-off-by: Andy Yan 
Reviewed-by: Daniel Kurtz 

---

Changes in v18: None
Changes in v17: None
Changes in v16: None
Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12:
- refactor of_node_put(ddc_node)

Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4:
- defer probe ddc i2c adapter

Changes in v3: None

 drivers/gpu/drm/imx/imx-hdmi.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-hdmi.c b/drivers/gpu/drm/imx/imx-hdmi.c
index 7fd90ae..7a54d20 100644
--- a/drivers/gpu/drm/imx/imx-hdmi.c
+++ b/drivers/gpu/drm/imx/imx-hdmi.c
@@ -1611,10 +1611,12 @@ static int imx_hdmi_bind(struct device *dev, struct 
device *master, void *data)
ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
if (ddc_node) {
hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
-   if (!hdmi->ddc)
+   of_node_put(ddc_node);
+   if (!hdmi->ddc) {
dev_dbg(hdmi->dev, "failed to read ddc node\n");
+   return -EPROBE_DEFER;
+   }

-   of_node_put(ddc_node);
} else {
dev_dbg(hdmi->dev, "no ddc property found\n");
}
-- 
1.9.1




[PATCH v18 01/12] drm: imx: imx-hdmi: make checkpatch happy

2014-12-05 Thread Andy Yan
CHECK: Alignment should match open parenthesis
+   if ((hdmi->vic == 10) || (hdmi->vic == 11) ||
+   (hdmi->vic == 12) || (hdmi->vic == 13) ||

CHECK: braces {} should be used on all arms of this statement
+   if (hdmi->hdmi_data.video_mode.mdvi)
[...]
+   else {
[...]

Signed-off-by: Andy Yan 
Reviewed-by: Daniel Kurtz 

---

Changes in v18: None
Changes in v17: None
Changes in v16: None
Changes in v15: None
Changes in v14: None
Changes in v13:
- patch against drm-next

Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6:
- rearrange the patch order

Changes in v5: None
Changes in v4:
- fix checkpatch CHECK

Changes in v3: None

 drivers/gpu/drm/imx/imx-hdmi.c | 109 -
 1 file changed, 52 insertions(+), 57 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-hdmi.c b/drivers/gpu/drm/imx/imx-hdmi.c
index aaec6b2..7fd90ae 100644
--- a/drivers/gpu/drm/imx/imx-hdmi.c
+++ b/drivers/gpu/drm/imx/imx-hdmi.c
@@ -163,7 +163,7 @@ static void hdmi_modb(struct imx_hdmi *hdmi, u8 data, u8 
mask, unsigned reg)
 }

 static void hdmi_mask_writeb(struct imx_hdmi *hdmi, u8 data, unsigned int reg,
- u8 shift, u8 mask)
+u8 shift, u8 mask)
 {
hdmi_modb(hdmi, data << shift, mask, reg);
 }
@@ -327,7 +327,7 @@ static unsigned int hdmi_compute_cts(unsigned int freq, 
unsigned long pixel_clk,
 }

 static void hdmi_set_clk_regenerator(struct imx_hdmi *hdmi,
-   unsigned long pixel_clk)
+unsigned long pixel_clk)
 {
unsigned int clk_n, clk_cts;

@@ -338,7 +338,7 @@ static void hdmi_set_clk_regenerator(struct imx_hdmi *hdmi,

if (!clk_cts) {
dev_dbg(hdmi->dev, "%s: pixel clock not supported: %lu\n",
-__func__, pixel_clk);
+   __func__, pixel_clk);
return;
}

@@ -477,13 +477,11 @@ static void imx_hdmi_update_csc_coeffs(struct imx_hdmi 
*hdmi)
u16 coeff_b = (*csc_coeff)[1][i];
u16 coeff_c = (*csc_coeff)[2][i];

-   hdmi_writeb(hdmi, coeff_a & 0xff,
-   HDMI_CSC_COEF_A1_LSB + i * 2);
+   hdmi_writeb(hdmi, coeff_a & 0xff, HDMI_CSC_COEF_A1_LSB + i * 2);
hdmi_writeb(hdmi, coeff_a >> 8, HDMI_CSC_COEF_A1_MSB + i * 2);
hdmi_writeb(hdmi, coeff_b & 0xff, HDMI_CSC_COEF_B1_LSB + i * 2);
hdmi_writeb(hdmi, coeff_b >> 8, HDMI_CSC_COEF_B1_MSB + i * 2);
-   hdmi_writeb(hdmi, coeff_c & 0xff,
-   HDMI_CSC_COEF_C1_LSB + i * 2);
+   hdmi_writeb(hdmi, coeff_c & 0xff, HDMI_CSC_COEF_C1_LSB + i * 2);
hdmi_writeb(hdmi, coeff_c >> 8, HDMI_CSC_COEF_C1_MSB + i * 2);
}

@@ -535,21 +533,22 @@ static void hdmi_video_packetize(struct imx_hdmi *hdmi)
struct hdmi_data_info *hdmi_data = &hdmi->hdmi_data;
u8 val, vp_conf;

-   if (hdmi_data->enc_out_format == RGB
-   || hdmi_data->enc_out_format == YCBCR444) {
-   if (!hdmi_data->enc_color_depth)
+   if (hdmi_data->enc_out_format == RGB ||
+   hdmi_data->enc_out_format == YCBCR444) {
+   if (!hdmi_data->enc_color_depth) {
output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_BYPASS;
-   else if (hdmi_data->enc_color_depth == 8) {
+   } else if (hdmi_data->enc_color_depth == 8) {
color_depth = 4;
output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_BYPASS;
-   } else if (hdmi_data->enc_color_depth == 10)
+   } else if (hdmi_data->enc_color_depth == 10) {
color_depth = 5;
-   else if (hdmi_data->enc_color_depth == 12)
+   } else if (hdmi_data->enc_color_depth == 12) {
color_depth = 6;
-   else if (hdmi_data->enc_color_depth == 16)
+   } else if (hdmi_data->enc_color_depth == 16) {
color_depth = 7;
-   else
+   } else {
return;
+   }
} else if (hdmi_data->enc_out_format == YCBCR422_8BITS) {
if (!hdmi_data->enc_color_depth ||
hdmi_data->enc_color_depth == 8)
@@ -561,8 +560,9 @@ static void hdmi_video_packetize(struct imx_hdmi *hdmi)
else
return;
output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_YCC422;
-   } else
+   } else {
return;
+   }

/* set the packetizer registers */
val = ((color_depth << HDMI_VP_PR_CD_COLOR_DEPTH_OFFSET) &
@@ -623,34 +623,34 @@ static void hdmi_video_packetize(struct imx_hdmi *hdmi)
 }

 static inline void hdmi_phy_test_clear(struct imx_hdmi *hdmi,
-   

[PATCH v18 0/12] dw-hdmi: convert imx hdmi to bridge/dw_hdmi

2014-12-05 Thread Andy Yan

We found Freescale imx6 and Rockchip rk3288 and Ingenic JZ4780 (Xburst/MIPS)
use the interface compatible Designware HDMI IP, but they also have some
lightly differences, such as phy pll configuration, register width(imx hdmi
register is one byte, but rk3288 is 4 bytes width and can only be accessed
by word), 4K support(imx6 doesn't support 4k, but rk3288 does), and HDMI2.0
support.

To reuse the imx-hdmi driver, we make this patch set:
(1): fix some CodingStyle warning to make checkpatch happy
(2): convert imx-hdmi to drm_bridge
(3): split platform specific code
(4): move imx-hdmi to bridge/dw_hdmi
(5): extend dw_hdmi.c to support rk3288 hdmi
(6): add rockchip rk3288 platform specific code dw_hdmi-rockchip.c

Changes in v18:
- remove a multiple blank lines in imx-hdmi.c
- fix a checkpatch warning in imx-hdmi_pltfm.c
- add port bindings
- correct some spelling mistakes in dw_hdmi bindings doc
- correct some spelling mistakes in dw_hdmi-rockchip bindings doc

Changes in v17:
- remove platform device stuff, adviced by Russell King
- remove prompt message of dw_hdmi, adviced by Russel King
- parse resource and irq in platform driver

Changes in v16:
- use the common binding for the clocks
- describe ddc-i2c-bus as optional
- add common clocks bindings
- modify clocks bindings
- descrbie ddc-i2c-bus as optional

Changes in v15:
- add prefix dw_hdmi/DW_HDMI for public used dw_hdmi structs
  adviced by Philipp Zabel
- remove THIS_MODULE in platform driver
- remove unio of the multi-byte register access, adviced by Philipp Zabel
- remove THIS_MODULE in platform driver

Changes in v14:
- add defer probing, adviced by Philipp Zabel
- remove drm_connector_register, because imx-drm core has registered
connector

Changes in v13:
- patch against drm-next
- split platform specific phy configuration
- split phy configuration from patch#4

Changes in v12:
- refactor of_node_put(ddc_node)
- squash patch 
- add comment for the depend on patch

Changes in v11:
- squash patch  

Changes in v10:
- split generic dw_hdmi.c improvements from patch#11 (add rk3288 support)
- add more display mode support mpll configuration for rk3288

Changes in v9:
- move some phy configuration to platform driver

Changes in v8:
- correct some spelling mistake
- modify ddc-i2c-bus and interrupt description
- Add documentation for rockchip dw hdmi

Changes in v7:
- remove unused variables from structure dw_hdmi
- remove a wrong modification
- add copyrights for dw_hdmi-imx.c

Changes in v6:
- rearrange the patch order
- refactor register access without reg_shift

Changes in v5:
- refactor reg-io-width

Changes in v4:
- fix checkpatch CHECK
- defer probe ddc i2c adapter

Changes in v3:
- split multi-register access to one indepent patch

Andy Yan (12):
  drm: imx: imx-hdmi: make checkpatch happy
  drm: imx: imx-hdmi: return defer if can't get ddc i2c adapter
  drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode
  drm: imx: imx-hdmi: split phy configuration to platform driver
  drm: imx: imx-hdmi: move imx-hdmi to bridge/dw_hdmi
  dt-bindings: add document for dw_hdmi
  drm: bridge/dw_hdmi: add support for multi-byte register width access
  drm: bridge/dw_hdmi: add mode_valid support
  drm: bridge/dw_hdmi: clear i2cmphy_stat0 reg in hdmi_phy_wait_i2c_done
  drm: bridge/dw_hdmi: add function dw_hdmi_phy_enable_spare
  dt-bindings: Add documentation for rockchip dw hdmi
  drm: bridge/dw_hdmi: add rockchip rk3288 support

 .../devicetree/bindings/drm/bridge/dw_hdmi.txt |  50 ++
 .../devicetree/bindings/video/dw_hdmi-rockchip.txt |  46 ++
 drivers/gpu/drm/bridge/Kconfig |   5 +
 drivers/gpu/drm/bridge/Makefile|   1 +
 .../gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c}   | 717 ++---
 .../gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h}   |   4 +-
 drivers/gpu/drm/imx/Kconfig|   1 +
 drivers/gpu/drm/imx/Makefile   |   2 +-
 drivers/gpu/drm/imx/dw_hdmi-imx.c  | 258 
 drivers/gpu/drm/rockchip/Kconfig   |  10 +
 drivers/gpu/drm/rockchip/Makefile  |   2 +
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c| 341 ++
 include/drm/bridge/dw_hdmi.h   |  61 ++
 13 files changed,  insertions(+), 387 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
 create mode 100644 Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt
 rename drivers/gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c} (72%)
 rename drivers/gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h} (99%)
 create mode 100644 drivers/gpu/drm/imx/dw_hdmi-imx.c
 create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
 create mode 100644 include/drm/bridge/dw_hdmi.h

-- 
1.9.1




[Intel-gfx] [PATCH -next] drm/i915: Fix missing unlock on error in i915_gem_init_hw()

2014-12-05 Thread Daniel Vetter
On Fri, Dec 05, 2014 at 08:55:59AM +0800, weiyj_lk at 163.com wrote:
> From: Wei Yongjun 
> 
> Add the missing unlock before return from function i915_gem_init_hw()
> in the error handling case.
> 
> Signed-off-by: Wei Yongjun 

Applied, thanks for the patch. Two minor comments:
- Please mention the commit that introduced the issue next time around.
  I've added that while applying.

- The usual patter is

if (ret)
goto out;


/* more code */

out:
mutex_unlock();
return ret;

This would work really well in i915_gem_init_hw and besides the
code-cleanup also prevents such a fumble in the future. If you feel like
please submit that patch to convert init_hw to this shared unlock code
pattern, too.

Thanks, Daniel
> ---
>  drivers/gpu/drm/i915/i915_gem.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index d2ba315..3eeb2d0 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4879,8 +4879,10 @@ i915_gem_init_hw(struct drm_device *dev)
>   i915_gem_init_swizzling(dev);
>  
>   ret = dev_priv->gt.init_rings(dev);
> - if (ret)
> + if (ret) {
> + mutex_unlock(&dev->struct_mutex);
>   return ret;
> + }
>  
>   for (i = 0; i < NUM_L3_SLICES(dev); i++)
>   i915_gem_l3_remap(&dev_priv->ring[RCS], i);
> 
> ___
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx


-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[patch] drm/tegra: checking IS_ERR() instead of NULL

2014-12-05 Thread Thierry Reding
On Fri, Dec 05, 2014 at 01:07:27PM +0100, SF Markus Elfring wrote:
> >> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> >> index e549afe..fa16048 100644
> >> --- a/drivers/gpu/drm/tegra/drm.c
> >> +++ b/drivers/gpu/drm/tegra/drm.c
> >> @@ -36,8 +36,8 @@ static int tegra_drm_load(struct drm_device *drm, 
> >> unsigned long flags)
> >>  
> >>if (iommu_present(&platform_bus_type)) {
> >>tegra->domain = iommu_domain_alloc(&platform_bus_type);
> >> -  if (IS_ERR(tegra->domain)) {
> >> -  err = PTR_ERR(tegra->domain);
> >> +  if (!tegra->domain) {
> >> +  err = -ENOMEM;
> >>goto free;
> >>}
> > 
> > Oh, good catch. Applied, thanks.
> 
> How do you think about to amend the commit title?
> 
> Is the following wording more appropriate?
> drm/tegra: Checking for NULL pointer instead of IS_ERR() usage

Sounds better yes. I've gone with:

drm/tegra: Check for NULL pointer instead of IS_ERR()

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20141205/11d5dec4/attachment.sig>


[PATCH] drm/radeon: KV has three PPLLs

2014-12-05 Thread Alex Deucher
Enable all three in the driver.  Early documentation
indicated the 3rd one was used for something else, but
that is not the case.

Signed-off-by: Alex Deucher 
Cc: stable at vger.kernel.org
---
 drivers/gpu/drm/radeon/atombios_crtc.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c 
b/drivers/gpu/drm/radeon/atombios_crtc.c
index d59ec49..4cb26c7 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1851,10 +1851,9 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc)
return pll;
}
/* otherwise, pick one of the plls */
-   if ((rdev->family == CHIP_KAVERI) ||
-   (rdev->family == CHIP_KABINI) ||
+   if ((rdev->family == CHIP_KABINI) ||
(rdev->family == CHIP_MULLINS)) {
-   /* KB/KV/ML has PPLL1 and PPLL2 */
+   /* KB/ML has PPLL1 and PPLL2 */
pll_in_use = radeon_get_pll_use_mask(crtc);
if (!(pll_in_use & (1 << ATOM_PPLL2)))
return ATOM_PPLL2;
@@ -1863,7 +1862,7 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc)
DRM_ERROR("unable to allocate a PPLL\n");
return ATOM_PPLL_INVALID;
} else {
-   /* CI has PPLL0, PPLL1, and PPLL2 */
+   /* CI/KV has PPLL0, PPLL1, and PPLL2 */
pll_in_use = radeon_get_pll_use_mask(crtc);
if (!(pll_in_use & (1 << ATOM_PPLL2)))
return ATOM_PPLL2;
-- 
1.8.3.1



[patch] drm/tegra: checking IS_ERR() instead of NULL

2014-12-05 Thread SF Markus Elfring
>> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
>> index e549afe..fa16048 100644
>> --- a/drivers/gpu/drm/tegra/drm.c
>> +++ b/drivers/gpu/drm/tegra/drm.c
>> @@ -36,8 +36,8 @@ static int tegra_drm_load(struct drm_device *drm, unsigned 
>> long flags)
>>  
>>  if (iommu_present(&platform_bus_type)) {
>>  tegra->domain = iommu_domain_alloc(&platform_bus_type);
>> -if (IS_ERR(tegra->domain)) {
>> -err = PTR_ERR(tegra->domain);
>> +if (!tegra->domain) {
>> +err = -ENOMEM;
>>  goto free;
>>  }
> 
> Oh, good catch. Applied, thanks.

How do you think about to amend the commit title?

Is the following wording more appropriate?
drm/tegra: Checking for NULL pointer instead of IS_ERR() usage

Regards,
Markus


[PATCH] add support for AM572x in the DDX

2014-12-05 Thread Rob Clark
On Fri, Dec 5, 2014 at 12:01 PM, Robert Nelson  
wrote:
> On Fri, Dec 5, 2014 at 10:57 AM, Emil Velikov  
> wrote:
>> Adding the freedreno ML to the Cc list :-)
>
> Sorry Emil,
>
> underneath this is omapdrm + PowerVR, so i should have prefixed it as:
> "xf86-video-omap"...

Hey Robert,

I can update xf86-video-omap..  where there some other patches
wanted/desired (has_dmm() iirc?)

BR,
-R

> Regards,
>
> --
> Robert Nelson
> http://www.rcn-ee.com/


[PATCH] add support for AM572x in the DDX

2014-12-05 Thread Robert Nelson
On Fri, Dec 5, 2014 at 11:34 AM, Rob Clark  wrote:
> On Fri, Dec 5, 2014 at 12:01 PM, Robert Nelson  
> wrote:
>> On Fri, Dec 5, 2014 at 10:57 AM, Emil Velikov  
>> wrote:
>>> Adding the freedreno ML to the Cc list :-)
>>
>> Sorry Emil,
>>
>> underneath this is omapdrm + PowerVR, so i should have prefixed it as:
>> "xf86-video-omap"...
>
> Hey Robert,
>
> I can update xf86-video-omap..  where there some other patches
> wanted/desired (has_dmm() iirc?)

Hi Rob,

The version i posted today has the "has_dmm" change merged in, which
other then the README update is the only change I made.

static inline Bool has_dmm(OMAPPtr pOMAP)
 {
-   return pOMAP->chipset >= 0x4430;
+   return pOMAP->chipset >= 0x4430 || pOMAP->chipset == 0x0752;
 }

Haven't really heard back from TI about all the other random changes
they made to their fork of your xf86-video-omap tree:

http://git.ti.com/gitweb/?p=glsdk/xf86-video-omap.git;a=summary

Regards,

-- 
Robert Nelson
http://www.rcn-ee.com/


[PATCH] add support for AM572x in the DDX

2014-12-05 Thread Robert Nelson
On Fri, Dec 5, 2014 at 11:19 AM, Emil Velikov  
wrote:
> On 5 December 2014 at 17:01, Robert Nelson  wrote:
>> On Fri, Dec 5, 2014 at 10:57 AM, Emil Velikov  
>> wrote:
>>> Adding the freedreno ML to the Cc list :-)
>>
>> Sorry Emil,
>>
>> underneath this is omapdrm + PowerVR, so i should have prefixed it as:
>> "xf86-video-omap"...
>>
> Hi Robert,
>
> My sleep deprived brain read omap, but registered freedreno. Or
> perhaps I'm a bit excited about the contributions from the
> CodeAurora/QCom guys in the latter case, which clouded my judgement
> :-)

We are all excited about the CodeAurora/QCom guys contributions. ;) I
make sure to point that out daily in my imgtec dealings. ;)

Regards,

-- 
Robert Nelson
http://www.rcn-ee.com/


[PATCH] amdkfd: Disable support for 32-bit user processes

2014-12-05 Thread Skidanov, Alexey
Reviewed-by: Alexey Skidanov 

-Original Message-
From: dri-devel [mailto:dri-devel-boun...@lists.freedesktop.org] On Behalf Of 
Gabbay, Oded
Sent: Friday, December 05, 2014 10:48 AM
To: dri-devel at lists.freedesktop.org; airlied at linux.ie
Cc: Deucher, Alexander
Subject: [PATCH] amdkfd: Disable support for 32-bit user processes

This patch checks if the process that opens the /dev/kfd device is 32-bit 
process. If so, it returns -EPERM and prints a warning message in dmesg.

This is done to prevent 32-bit user processes from using amdkfd, and hence, HSA 
features.

AMD's HSA userspace stack will also support only 64-bit processes on Linux.

Signed-off-by: Oded Gabbay 
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 102cd36..4f7b275 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -102,15 +102,26 @@ struct device *kfd_chardev(void)  static int 
kfd_open(struct inode *inode, struct file *filep)  {
struct kfd_process *process;
+   bool is_32bit_user_mode;

if (iminor(inode) != 0)
return -ENODEV;

+   is_32bit_user_mode = is_compat_task();
+
+   if (is_32bit_user_mode == true) {
+   dev_warn(kfd_device,
+   "Process %d (32-bit) failed to open /dev/kfd\n"
+   "32-bit processes are not supported by amdkfd\n",
+   current->pid);
+   return -EPERM;
+   }
+
process = kfd_create_process(current);
if (IS_ERR(process))
return PTR_ERR(process);

-   process->is_32bit_user_mode = is_compat_task();
+   process->is_32bit_user_mode = is_32bit_user_mode;

dev_dbg(kfd_device, "process %d opened, compat mode (32 bit) - %d\n",
process->pasid, process->is_32bit_user_mode);
--
2.1.0

___
dri-devel mailing list
dri-devel at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] add support for AM572x in the DDX

2014-12-05 Thread Robert Nelson
On Fri, Dec 5, 2014 at 10:57 AM, Emil Velikov  
wrote:
> Adding the freedreno ML to the Cc list :-)

Sorry Emil,

underneath this is omapdrm + PowerVR, so i should have prefixed it as:
"xf86-video-omap"...

Regards,

-- 
Robert Nelson
http://www.rcn-ee.com/


[PATCH] amdkfd: Disable support for 32-bit user processes

2014-12-05 Thread Oded Gabbay
This patch checks if the process that opens the /dev/kfd device is 32-bit
process. If so, it returns -EPERM and prints a warning message in dmesg.

This is done to prevent 32-bit user processes from using amdkfd, and hence, HSA
features.

AMD's HSA userspace stack will also support only 64-bit processes on Linux.

Signed-off-by: Oded Gabbay 
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 102cd36..4f7b275 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -102,15 +102,26 @@ struct device *kfd_chardev(void)
 static int kfd_open(struct inode *inode, struct file *filep)
 {
struct kfd_process *process;
+   bool is_32bit_user_mode;

if (iminor(inode) != 0)
return -ENODEV;

+   is_32bit_user_mode = is_compat_task();
+
+   if (is_32bit_user_mode == true) {
+   dev_warn(kfd_device,
+   "Process %d (32-bit) failed to open /dev/kfd\n"
+   "32-bit processes are not supported by amdkfd\n",
+   current->pid);
+   return -EPERM;
+   }
+
process = kfd_create_process(current);
if (IS_ERR(process))
return PTR_ERR(process);

-   process->is_32bit_user_mode = is_compat_task();
+   process->is_32bit_user_mode = is_32bit_user_mode;

dev_dbg(kfd_device, "process %d opened, compat mode (32 bit) - %d\n",
process->pasid, process->is_32bit_user_mode);
-- 
2.1.0



[Bug 83998] Oopses on R9270X using UVD since radeon/uvd: use PIPE_USAGE_STAGING for msg&fb buffers

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=83998

--- Comment #9 from Christian König  ---
That seems to be some kind of random kernel memory corruption, triggered by
using PIPE_USAGE_STAGING for your case.

Does anybody have any good idea how to figure out what this is?

-- 
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/20141205/6c0f4d15/attachment-0001.html>


[Intel-gfx] [PATCH] drm: Make drm_read() more robust against multithreaded races

2014-12-05 Thread Daniel Vetter
On Thu, Dec 04, 2014 at 09:03:25PM +, Chris Wilson wrote:
> The current implementation of drm_read() faces a number of issues:
> 
> 1. Upon an error, it consumes the event which may lead to the client
> blocking.
> 2. Upon an error, it forgets about events already copied
> 3. If it fails to copy a single event with O_NONBLOCK it falls into a
> infinite loop of reporting EAGAIN.
> 3. There is a race between multiple waiters and blocking reads of the
> events list.
> 
> Here, we inline drm_dequeue_event() into drm_read() so that we can take
> the spinlock around the list walking and event copying, and importantly
> reorder the error handling to avoid the issues above.
> 
> Cc: Takashi Iwai 
> Signed-off-by: Chris Wilson 

Imo if you go through all the trouble of fixing the corner-cases then we
should also have a testcase to exercise them. Otherwise I expect this to
fall apart again. So a little igt would be great.
-Daniel

> ---
>  drivers/gpu/drm/drm_fops.c | 90 
> ++
>  1 file changed, 43 insertions(+), 47 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> index 91e1105f2800..076dd606b580 100644
> --- a/drivers/gpu/drm/drm_fops.c
> +++ b/drivers/gpu/drm/drm_fops.c
> @@ -478,63 +478,59 @@ int drm_release(struct inode *inode, struct file *filp)
>  }
>  EXPORT_SYMBOL(drm_release);
>  
> -static bool
> -drm_dequeue_event(struct drm_file *file_priv,
> -   size_t total, size_t max, struct drm_pending_event **out)
> +ssize_t drm_read(struct file *filp, char __user *buffer,
> +  size_t count, loff_t *offset)
>  {
> + struct drm_file *file_priv = filp->private_data;
>   struct drm_device *dev = file_priv->minor->dev;
> - struct drm_pending_event *e;
> - unsigned long flags;
> - bool ret = false;
> -
> - spin_lock_irqsave(&dev->event_lock, flags);
> + ssize_t ret = 0;
>  
> - *out = NULL;
> - if (list_empty(&file_priv->event_list))
> - goto out;
> - e = list_first_entry(&file_priv->event_list,
> -  struct drm_pending_event, link);
> - if (e->event->length + total > max)
> - goto out;
> + if (!access_ok(VERIFY_WRITE, buffer, count))
> + return -EFAULT;
>  
> - file_priv->event_space += e->event->length;
> - list_del(&e->link);
> - *out = e;
> - ret = true;
> + spin_lock_irq(&dev->event_lock);
> + for (;;) {
> + if (list_empty(&file_priv->event_list)) {
> + if (ret)
> + break;
>  
> -out:
> - spin_unlock_irqrestore(&dev->event_lock, flags);
> - return ret;
> -}
> -
> -ssize_t drm_read(struct file *filp, char __user *buffer,
> -  size_t count, loff_t *offset)
> -{
> - struct drm_file *file_priv = filp->private_data;
> - struct drm_pending_event *e;
> - size_t total;
> - ssize_t ret;
> + if (filp->f_flags & O_NONBLOCK) {
> + ret = -EAGAIN;
> + break;
> + }
>  
> - if ((filp->f_flags & O_NONBLOCK) == 0) {
> - ret = wait_event_interruptible(file_priv->event_wait,
> -
> !list_empty(&file_priv->event_list));
> - if (ret < 0)
> - return ret;
> - }
> + spin_unlock_irq(&dev->event_lock);
> + ret = wait_event_interruptible(file_priv->event_wait,
> +
> !list_empty(&file_priv->event_list));
> + spin_lock_irq(&dev->event_lock);
> + if (ret < 0)
> + break;
> +
> + ret = 0;
> + } else {
> + struct drm_pending_event *e;
> +
> + e = list_first_entry(&file_priv->event_list,
> +  struct drm_pending_event, link);
> + if (e->event->length + ret > count)
> + break;
> +
> + if (__copy_to_user_inatomic(buffer + ret,
> + e->event, 
> e->event->length)) {
> + if (ret == 0)
> + ret = -EFAULT;
> + break;
> + }
>  
> - total = 0;
> - while (drm_dequeue_event(file_priv, total, count, &e)) {
> - if (copy_to_user(buffer + total,
> -  e->event, e->event->length)) {
> - total = -EFAULT;
> - break;
> + file_priv->event_space += e->event->length;
> + ret += e->event->length;
> + list_del(&e->link);
> + e->destroy(e);
>   }
> -
> - total += e->event->lengt

[PATCH] drm: Make drm_read() more robust against multithreaded races

2014-12-05 Thread Takashi Iwai
At Thu,  4 Dec 2014 21:03:25 +,
Chris Wilson wrote:
> 
> The current implementation of drm_read() faces a number of issues:
> 
> 1. Upon an error, it consumes the event which may lead to the client
> blocking.
> 2. Upon an error, it forgets about events already copied
> 3. If it fails to copy a single event with O_NONBLOCK it falls into a
> infinite loop of reporting EAGAIN.
> 3. There is a race between multiple waiters and blocking reads of the
> events list.
> 
> Here, we inline drm_dequeue_event() into drm_read() so that we can take
> the spinlock around the list walking and event copying, and importantly
> reorder the error handling to avoid the issues above.
> 
> Cc: Takashi Iwai 

Reviewed-by: Takashi Iwai 


Takashi

> Signed-off-by: Chris Wilson 
> ---
>  drivers/gpu/drm/drm_fops.c | 90 
> ++
>  1 file changed, 43 insertions(+), 47 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> index 91e1105f2800..076dd606b580 100644
> --- a/drivers/gpu/drm/drm_fops.c
> +++ b/drivers/gpu/drm/drm_fops.c
> @@ -478,63 +478,59 @@ int drm_release(struct inode *inode, struct file *filp)
>  }
>  EXPORT_SYMBOL(drm_release);
>  
> -static bool
> -drm_dequeue_event(struct drm_file *file_priv,
> -   size_t total, size_t max, struct drm_pending_event **out)
> +ssize_t drm_read(struct file *filp, char __user *buffer,
> +  size_t count, loff_t *offset)
>  {
> + struct drm_file *file_priv = filp->private_data;
>   struct drm_device *dev = file_priv->minor->dev;
> - struct drm_pending_event *e;
> - unsigned long flags;
> - bool ret = false;
> -
> - spin_lock_irqsave(&dev->event_lock, flags);
> + ssize_t ret = 0;
>  
> - *out = NULL;
> - if (list_empty(&file_priv->event_list))
> - goto out;
> - e = list_first_entry(&file_priv->event_list,
> -  struct drm_pending_event, link);
> - if (e->event->length + total > max)
> - goto out;
> + if (!access_ok(VERIFY_WRITE, buffer, count))
> + return -EFAULT;
>  
> - file_priv->event_space += e->event->length;
> - list_del(&e->link);
> - *out = e;
> - ret = true;
> + spin_lock_irq(&dev->event_lock);
> + for (;;) {
> + if (list_empty(&file_priv->event_list)) {
> + if (ret)
> + break;
>  
> -out:
> - spin_unlock_irqrestore(&dev->event_lock, flags);
> - return ret;
> -}
> -
> -ssize_t drm_read(struct file *filp, char __user *buffer,
> -  size_t count, loff_t *offset)
> -{
> - struct drm_file *file_priv = filp->private_data;
> - struct drm_pending_event *e;
> - size_t total;
> - ssize_t ret;
> + if (filp->f_flags & O_NONBLOCK) {
> + ret = -EAGAIN;
> + break;
> + }
>  
> - if ((filp->f_flags & O_NONBLOCK) == 0) {
> - ret = wait_event_interruptible(file_priv->event_wait,
> -
> !list_empty(&file_priv->event_list));
> - if (ret < 0)
> - return ret;
> - }
> + spin_unlock_irq(&dev->event_lock);
> + ret = wait_event_interruptible(file_priv->event_wait,
> +
> !list_empty(&file_priv->event_list));
> + spin_lock_irq(&dev->event_lock);
> + if (ret < 0)
> + break;
> +
> + ret = 0;
> + } else {
> + struct drm_pending_event *e;
> +
> + e = list_first_entry(&file_priv->event_list,
> +  struct drm_pending_event, link);
> + if (e->event->length + ret > count)
> + break;
> +
> + if (__copy_to_user_inatomic(buffer + ret,
> + e->event, 
> e->event->length)) {
> + if (ret == 0)
> + ret = -EFAULT;
> + break;
> + }
>  
> - total = 0;
> - while (drm_dequeue_event(file_priv, total, count, &e)) {
> - if (copy_to_user(buffer + total,
> -  e->event, e->event->length)) {
> - total = -EFAULT;
> - break;
> + file_priv->event_space += e->event->length;
> + ret += e->event->length;
> + list_del(&e->link);
> + e->destroy(e);
>   }
> -
> - total += e->event->length;
> - e->destroy(e);
>   }
> + spin_unlock_irq(&dev->event_lock);
>  
> - return total ?: -EAGAIN;
> + return ret;
>  }
>  EXPORT_SYMBOL(drm_

[PATCH 9/9] drm: sti: fix delay in VTG programming

2014-12-05 Thread Benjamin Gaignard
The HDMI path introduce a delay of 6 pixels.
This delay should be take into account while programming
VTG for the HDMI. Without this delay, the HDMI active
window area is shift of 6 pixel on the right.

Set also timing for DVO output.

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/sti/sti_vtg.c | 25 ++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c
index 740d6e3..ce7c0c9 100644
--- a/drivers/gpu/drm/sti/sti_vtg.c
+++ b/drivers/gpu/drm/sti/sti_vtg.c
@@ -55,6 +55,9 @@
 #define VTG_IRQ_TOP BIT(1)
 #define VTG_IRQ_MASK(VTG_IRQ_TOP | VTG_IRQ_BOTTOM)

+/* Delay introduced by the HDMI in nb of pixel */
+#define HDMI_DELAY  (6)
+
 /* delay introduced by the Arbitrary Waveform Generator in nb of pixels */
 #define AWG_DELAY_HD(-9)
 #define AWG_DELAY_ED(-8)
@@ -133,10 +136,10 @@ static void vtg_set_mode(struct sti_vtg *vtg,
writel(tmp, vtg->regs + VTG_VID_TFS);
writel(tmp, vtg->regs + VTG_VID_BFS);

-   /* prepare VTG set 1 and 2 for HDMI and VTG set 3 for HD DAC */
-   tmp = (mode->hsync_end - mode->hsync_start) << 16;
+   /* prepare VTG set 1 for HDMI */
+   tmp = (mode->hsync_end - mode->hsync_start + HDMI_DELAY) << 16;
+   tmp |= HDMI_DELAY;
writel(tmp, vtg->regs + VTG_H_HD_1);
-   writel(tmp, vtg->regs + VTG_H_HD_2);

tmp = (mode->vsync_end - mode->vsync_start + 1) << 16;
tmp |= 1;
@@ -146,6 +149,11 @@ static void vtg_set_mode(struct sti_vtg *vtg,
writel(0, vtg->regs + VTG_BOT_V_HD_1);

/* prepare VTG set 2 for for HD DCS */
+   tmp = (mode->hsync_end - mode->hsync_start) << 16;
+   writel(tmp, vtg->regs + VTG_H_HD_2);
+
+   tmp = (mode->vsync_end - mode->vsync_start + 1) << 16;
+   tmp |= 1;
writel(tmp, vtg->regs + VTG_TOP_V_VD_2);
writel(tmp, vtg->regs + VTG_BOT_V_VD_2);
writel(0, vtg->regs + VTG_TOP_V_HD_2);
@@ -166,6 +174,17 @@ static void vtg_set_mode(struct sti_vtg *vtg,
writel(tmp, vtg->regs + VTG_TOP_V_HD_3);
writel(tmp, vtg->regs + VTG_BOT_V_HD_3);

+   /* Prepare VTG set 4 for DVO */
+   tmp = (mode->hsync_end - mode->hsync_start) << 16;
+   writel(tmp, vtg->regs + VTG_H_HD_4);
+
+   tmp = (mode->vsync_end - mode->vsync_start + 1) << 16;
+   tmp |= 1;
+   writel(tmp, vtg->regs + VTG_TOP_V_VD_4);
+   writel(tmp, vtg->regs + VTG_BOT_V_VD_4);
+   writel(0, vtg->regs + VTG_TOP_V_HD_4);
+   writel(0, vtg->regs + VTG_BOT_V_HD_4);
+
/* mode */
writel(type, vtg->regs + VTG_MODE);
 }
-- 
1.9.1



[PATCH 8/9] drm: sti: prepare sti_tvout to support auxiliary crtc

2014-12-05 Thread Benjamin Gaignard
Change some functions prototype to prepare the introduction of
auxiliary crtc. It will also help to have a DVO encoder.

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/sti/sti_tvout.c | 92 +++--
 1 file changed, 52 insertions(+), 40 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index b8afe49..604e574 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -149,14 +149,15 @@ static void tvout_write(struct sti_tvout *tvout, u32 val, 
int offset)
  * Set the clipping mode of a VIP
  *
  * @tvout: tvout structure
+ * @reg: register to set
  * @cr_r:
  * @y_g:
  * @cb_b:
  */
-static void tvout_vip_set_color_order(struct sti_tvout *tvout,
+static void tvout_vip_set_color_order(struct sti_tvout *tvout, int reg,
  u32 cr_r, u32 y_g, u32 cb_b)
 {
-   u32 val = tvout_read(tvout, TVO_VIP_HDMI);
+   u32 val = tvout_read(tvout, reg);

val &= ~(TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_R_SHIFT);
val &= ~(TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_G_SHIFT);
@@ -165,52 +166,58 @@ static void tvout_vip_set_color_order(struct sti_tvout 
*tvout,
val |= y_g << TVO_VIP_REORDER_G_SHIFT;
val |= cb_b << TVO_VIP_REORDER_B_SHIFT;

-   tvout_write(tvout, val, TVO_VIP_HDMI);
+   tvout_write(tvout, val, reg);
 }

 /**
  * Set the clipping mode of a VIP
  *
  * @tvout: tvout structure
+ * @reg: register to set
  * @range: clipping range
  */
-static void tvout_vip_set_clip_mode(struct sti_tvout *tvout, u32 range)
+static void tvout_vip_set_clip_mode(struct sti_tvout *tvout, int reg, u32 
range)
 {
-   u32 val = tvout_read(tvout, TVO_VIP_HDMI);
+   u32 val = tvout_read(tvout, reg);

val &= ~(TVO_VIP_CLIP_MASK << TVO_VIP_CLIP_SHIFT);
val |= range << TVO_VIP_CLIP_SHIFT;
-   tvout_write(tvout, val, TVO_VIP_HDMI);
+   tvout_write(tvout, val, reg);
 }

 /**
  * Set the rounded value of a VIP
  *
  * @tvout: tvout structure
+ * @reg: register to set
  * @rnd: rounded val per component
  */
-static void tvout_vip_set_rnd(struct sti_tvout *tvout, u32 rnd)
+static void tvout_vip_set_rnd(struct sti_tvout *tvout, int reg, u32 rnd)
 {
-   u32 val = tvout_read(tvout, TVO_VIP_HDMI);
+   u32 val = tvout_read(tvout, reg);

val &= ~(TVO_VIP_RND_MASK << TVO_VIP_RND_SHIFT);
val |= rnd << TVO_VIP_RND_SHIFT;
-   tvout_write(tvout, val, TVO_VIP_HDMI);
+   tvout_write(tvout, val, reg);
 }

 /**
  * Select the VIP input
  *
  * @tvout: tvout structure
+ * @reg: register to set
+ * @main_path: main or auxiliary path
+ * @sel_input_logic_inverted: need to invert the logic
  * @sel_input: selected_input (main/aux + conv)
  */
 static void tvout_vip_set_sel_input(struct sti_tvout *tvout,
+   int reg,
bool main_path,
bool sel_input_logic_inverted,
enum sti_tvout_video_out_type video_out)
 {
u32 sel_input;
-   u32 val = tvout_read(tvout, TVO_VIP_HDMI);
+   u32 val = tvout_read(tvout, reg);

if (main_path)
sel_input = TVO_VIP_SEL_INPUT_MAIN;
@@ -232,22 +239,24 @@ static void tvout_vip_set_sel_input(struct sti_tvout 
*tvout,

val &= ~TVO_VIP_SEL_INPUT_MASK;
val |= sel_input;
-   tvout_write(tvout, val, TVO_VIP_HDMI);
+   tvout_write(tvout, val, reg);
 }

 /**
  * Select the input video signed or unsigned
  *
  * @tvout: tvout structure
+ * @reg: register to set
  * @in_vid_signed: used video input format
  */
-static void tvout_vip_set_in_vid_fmt(struct sti_tvout *tvout, u32 in_vid_fmt)
+static void tvout_vip_set_in_vid_fmt(struct sti_tvout *tvout,
+   int reg, u32 in_vid_fmt)
 {
-   u32 val = tvout_read(tvout, TVO_VIP_HDMI);
+   u32 val = tvout_read(tvout, reg);

val &= ~TVO_IN_FMT_SIGNED;
val |= in_vid_fmt;
-   tvout_write(tvout, val, TVO_MAIN_IN_VID_FORMAT);
+   tvout_write(tvout, val, reg);
 }

 /**
@@ -261,6 +270,7 @@ static void tvout_hdmi_start(struct sti_tvout *tvout, bool 
main_path)
 {
struct device_node *node = tvout->dev->of_node;
bool sel_input_logic_inverted = false;
+   u32 tvo_in_vid_format;

dev_dbg(tvout->dev, "%s\n", __func__);

@@ -268,33 +278,36 @@ static void tvout_hdmi_start(struct sti_tvout *tvout, 
bool main_path)
DRM_DEBUG_DRIVER("main vip for hdmi\n");
/* select the input sync for hdmi = VTG set 1 */
tvout_write(tvout, TVO_SYNC_MAIN_VTG_SET_1, TVO_HDMI_SYNC_SEL);
+   tvo_in_vid_format = TVO_MAIN_IN_VID_FORMAT;
} else {
DRM_DEBUG_DRIVER("aux vip for hdmi\n");
/* select the input sync for hdmi = VTG set 1 */
tvout_write(tvout, TVO_SYNC_AUX_VTG_SET_1, TVO_HDMI_SYNC_SEL);
+   tvo_in_vid_fo

[PATCH 7/9] drm: sti: use drm_crtc_vblank_{on/off} instead of drm_vblank_{on/off}

2014-12-05 Thread Benjamin Gaignard
Make sure that vblank is enabled when crtc commit is call.
Replace drm_vblank_off() by drm_crtc_vblank_off()

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/sti/sti_drm_crtc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_drm_crtc.c 
b/drivers/gpu/drm/sti/sti_drm_crtc.c
index f527997..3257dee 100644
--- a/drivers/gpu/drm/sti/sti_drm_crtc.c
+++ b/drivers/gpu/drm/sti/sti_drm_crtc.c
@@ -63,6 +63,8 @@ static void sti_drm_crtc_commit(struct drm_crtc *crtc)
/* Enable layer on mixer */
if (sti_mixer_set_layer_status(mixer, layer, true))
DRM_ERROR("Can not enable layer at mixer\n");
+
+   drm_crtc_vblank_on(crtc);
 }

 static bool sti_drm_crtc_mode_fixup(struct drm_crtc *crtc,
@@ -223,7 +225,7 @@ static void sti_drm_crtc_disable(struct drm_crtc *crtc)
/* Then disable layer itself */
sti_layer_disable(layer);

-   drm_vblank_off(crtc->dev, mixer->id);
+   drm_crtc_vblank_off(crtc);

/* Disable pixel clock and compo IP clocks */
if (mixer->id == STI_MIXER_MAIN) {
-- 
1.9.1



[PATCH 6/9] drm: sti: fix hdmi avi infoframe

2014-12-05 Thread Benjamin Gaignard
The hardware expect to have the infoframe checksum in the first byte.
In consequence shift all infoframe on one byte.

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/sti/sti_hdmi.c | 33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 1921197..d032e02 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -272,31 +272,32 @@ static int hdmi_avi_infoframe_config(struct sti_hdmi 
*hdmi)
hdmi_write(hdmi, val, HDMI_SW_DI_CFG);

/* Infoframe header */
-   val = buffer[0x0];
-   val |= buffer[0x1] << 8;
-   val |= buffer[0x2] << 16;
+   val =  buffer[0];
+   val |= buffer[1] << 8;
+   val |= buffer[2] << 16;
hdmi_write(hdmi, val, HDMI_SW_DI_N_HEAD_WORD(HDMI_IFRAME_SLOT_AVI));

/* Infoframe packet bytes */
-   val = frame[0x0];
-   val |= frame[0x1] << 8;
-   val |= frame[0x2] << 16;
-   val |= frame[0x3] << 24;
+   val =  buffer[3];
+   val |= *(frame++) << 8;
+   val |= *(frame++) << 16;
+   val |= *(frame++) << 24;
hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD0(HDMI_IFRAME_SLOT_AVI));

-   val = frame[0x4];
-   val |= frame[0x5] << 8;
-   val |= frame[0x6] << 16;
-   val |= frame[0x7] << 24;
+   val =  *(frame++);
+   val |= *(frame++) << 8;
+   val |= *(frame++) << 16;
+   val |= *(frame++) << 24;
hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD1(HDMI_IFRAME_SLOT_AVI));

-   val = frame[0x8];
-   val |= frame[0x9] << 8;
-   val |= frame[0xA] << 16;
-   val |= frame[0xB] << 24;
+   val =  *(frame++);
+   val |= *(frame++) << 8;
+   val |= *(frame++) << 16;
+   val |= *(frame++) << 24;
hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD2(HDMI_IFRAME_SLOT_AVI));

-   val = frame[0xC];
+   val = *(frame++);
+   val |= *(frame) << 8;
hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD3(HDMI_IFRAME_SLOT_AVI));

/* Enable transmission slot for AVI infoframe
-- 
1.9.1



[PATCH 5/9] drm: sti: remove event lock while disabling vblank

2014-12-05 Thread Benjamin Gaignard
Stop use event_lock in vblank disable function.
This was creating a dead lock.

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/sti/sti_drm_crtc.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_drm_crtc.c 
b/drivers/gpu/drm/sti/sti_drm_crtc.c
index e1e5550..f527997 100644
--- a/drivers/gpu/drm/sti/sti_drm_crtc.c
+++ b/drivers/gpu/drm/sti/sti_drm_crtc.c
@@ -365,7 +365,6 @@ void sti_drm_crtc_disable_vblank(struct drm_device *dev, 
int crtc)
struct sti_drm_private *priv = dev->dev_private;
struct sti_compositor *compo = priv->compo;
struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb;
-   unsigned long flags;

DRM_DEBUG_DRIVER("\n");

@@ -374,13 +373,10 @@ void sti_drm_crtc_disable_vblank(struct drm_device *dev, 
int crtc)
DRM_DEBUG_DRIVER("Warning: cannot unregister VTG notifier\n");

/* free the resources of the pending requests */
-   spin_lock_irqsave(&dev->event_lock, flags);
if (compo->mixer[crtc]->pending_event) {
drm_vblank_put(dev, crtc);
compo->mixer[crtc]->pending_event = NULL;
}
-   spin_unlock_irqrestore(&dev->event_lock, flags);
-
 }
 EXPORT_SYMBOL(sti_drm_crtc_disable_vblank);

-- 
1.9.1



[PATCH 4/9] drm: sti: simplify gdp code

2014-12-05 Thread Benjamin Gaignard
Store the physical address at node creation time
to avoid use of virt_to_dma and dma_to_virt everywhere

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/sti/sti_gdp.c | 39 ---
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index 4e30b74..1b903ff 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -73,7 +73,9 @@ struct sti_gdp_node {

 struct sti_gdp_node_list {
struct sti_gdp_node *top_field;
+   dma_addr_t top_field_paddr;
struct sti_gdp_node *btm_field;
+   dma_addr_t btm_field_paddr;
 };

 /**
@@ -168,7 +170,6 @@ static int sti_gdp_get_alpharange(int format)
 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 = to_sti_gdp(layer);
unsigned int i;

@@ -176,11 +177,9 @@ static struct sti_gdp_node_list 
*sti_gdp_get_free_nodes(struct sti_layer *layer)
if (!hw_nvn)
goto end;

-   virt_nvn = dma_to_virt(layer->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))
+   if ((hw_nvn != gdp->node_list[i].btm_field_paddr) &&
+   (hw_nvn != gdp->node_list[i].top_field_paddr))
return &gdp->node_list[i];

/* in hazardious cases restart with the first node */
@@ -204,7 +203,6 @@ static
 struct sti_gdp_node_list *sti_gdp_get_current_nodes(struct sti_layer *layer)
 {
int hw_nvn;
-   void *virt_nvn;
struct sti_gdp *gdp = to_sti_gdp(layer);
unsigned int i;

@@ -212,11 +210,9 @@ struct sti_gdp_node_list *sti_gdp_get_current_nodes(struct 
sti_layer *layer)
if (!hw_nvn)
goto end;

-   virt_nvn = dma_to_virt(layer->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))
+   if ((hw_nvn == gdp->node_list[i].btm_field_paddr) ||
+   (hw_nvn == gdp->node_list[i].top_field_paddr))
return &gdp->node_list[i];

 end:
@@ -292,8 +288,8 @@ static int sti_gdp_prepare_layer(struct sti_layer *layer, 
bool first_prepare)

/* Same content and chained together */
memcpy(btm_field, top_field, sizeof(*btm_field));
-   top_field->gam_gdp_nvn = virt_to_dma(dev, btm_field);
-   btm_field->gam_gdp_nvn = virt_to_dma(dev, top_field);
+   top_field->gam_gdp_nvn = list->btm_field_paddr;
+   btm_field->gam_gdp_nvn = list->top_field_paddr;

/* Interlaced mode */
if (layer->mode->flags & DRM_MODE_FLAG_INTERLACE)
@@ -349,8 +345,8 @@ static int sti_gdp_commit_layer(struct sti_layer *layer)
struct sti_gdp_node *updated_top_node = updated_list->top_field;
struct sti_gdp_node *updated_btm_node = updated_list->btm_field;
struct sti_gdp *gdp = to_sti_gdp(layer);
-   u32 dma_updated_top = virt_to_dma(layer->dev, updated_top_node);
-   u32 dma_updated_btm = virt_to_dma(layer->dev, updated_btm_node);
+   u32 dma_updated_top = updated_list->top_field_paddr;
+   u32 dma_updated_btm = updated_list->btm_field_paddr;
struct sti_gdp_node_list *curr_list = sti_gdp_get_current_nodes(layer);

dev_dbg(layer->dev, "%s %s top/btm_node:0x%p/0x%p\n", __func__,
@@ -461,16 +457,16 @@ static void sti_gdp_init(struct sti_layer *layer)
 {
struct sti_gdp *gdp = to_sti_gdp(layer);
struct device_node *np = layer->dev->of_node;
-   dma_addr_t dma;
+   dma_addr_t dma_addr;
void *base;
unsigned int i, size;

/* Allocate all the nodes within a single memory page */
size = sizeof(struct sti_gdp_node) *
GDP_NODE_PER_FIELD * GDP_NODE_NB_BANK;
-
base = dma_alloc_writecombine(layer->dev,
-   size, &dma, GFP_KERNEL | GFP_DMA);
+   size, &dma_addr, GFP_KERNEL | GFP_DMA);
+
if (!base) {
DRM_ERROR("Failed to allocate memory for GDP node\n");
return;
@@ -478,21 +474,26 @@ static void sti_gdp_init(struct sti_layer *layer)
memset(base, 0, size);

for (i = 0; i < GDP_NODE_NB_BANK; i++) {
-   if (virt_to_dma(layer->dev, base) & 0xF) {
+   if (dma_addr & 0xF) {
DRM_ERROR("Mem alignment failed\n");
return;
}
gdp->node_list[i].top_field = base;
+   gdp->node_list[i].top_field_paddr = dma_addr;
+
DRM_DEBUG_DRIVER("node[%d].top_field=%p\n", i, base);
base += sizeof(struct sti_gdp_node);
+ 

[PATCH 3/9] drm: sti: clear all mixer control

2014-12-05 Thread Benjamin Gaignard
Make sure that mixer control register is correctly reset
before use it.

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/sti/sti_drm_crtc.c | 2 ++
 drivers/gpu/drm/sti/sti_mixer.c| 9 +
 drivers/gpu/drm/sti/sti_mixer.h| 1 +
 3 files changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_drm_crtc.c 
b/drivers/gpu/drm/sti/sti_drm_crtc.c
index d2ae0c0..e1e5550 100644
--- a/drivers/gpu/drm/sti/sti_drm_crtc.c
+++ b/drivers/gpu/drm/sti/sti_drm_crtc.c
@@ -37,6 +37,8 @@ static void sti_drm_crtc_prepare(struct drm_crtc *crtc)
if (clk_prepare_enable(compo->clk_compo_aux))
DRM_INFO("Failed to prepare/enable compo_aux clk\n");
}
+
+   sti_mixer_clear_all_layers(mixer);
 }

 static void sti_drm_crtc_commit(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
index 79f369d..6bcdf3f 100644
--- a/drivers/gpu/drm/sti/sti_mixer.c
+++ b/drivers/gpu/drm/sti/sti_mixer.c
@@ -215,6 +215,15 @@ int sti_mixer_set_layer_status(struct sti_mixer *mixer,
return 0;
 }

+void sti_mixer_clear_all_layers(struct sti_mixer *mixer)
+{
+   u32 val;
+
+   DRM_DEBUG_DRIVER("%s clear all layer\n", sti_mixer_to_str(mixer));
+   val = sti_mixer_reg_read(mixer, GAM_MIXER_CTL) & 0x;
+   sti_mixer_reg_write(mixer, GAM_MIXER_CTL, val);
+}
+
 void sti_mixer_set_matrix(struct sti_mixer *mixer)
 {
unsigned int i;
diff --git a/drivers/gpu/drm/sti/sti_mixer.h b/drivers/gpu/drm/sti/sti_mixer.h
index 8743721..750e1fd 100644
--- a/drivers/gpu/drm/sti/sti_mixer.h
+++ b/drivers/gpu/drm/sti/sti_mixer.h
@@ -39,6 +39,7 @@ struct sti_mixer *sti_mixer_create(struct device *dev, int id,

 int sti_mixer_set_layer_status(struct sti_mixer *mixer,
struct sti_layer *layer, bool status);
+void sti_mixer_clear_all_layers(struct sti_mixer *mixer);
 int sti_mixer_set_layer_depth(struct sti_mixer *mixer, struct sti_layer 
*layer);
 int sti_mixer_active_video_area(struct sti_mixer *mixer,
struct drm_display_mode *mode);
-- 
1.9.1



[PATCH 2/9] drm: sti: remove gpio for HDMI hot plug detection

2014-12-05 Thread Benjamin Gaignard
gpio used for HDMI hot plug detection is useless,
HDMI_STI register contains an hot plug detection status bit.
Fix binding documentation.

Signed-off-by: Benjamin Gaignard 
---
 Documentation/devicetree/bindings/gpu/st,stih4xx.txt |  2 --
 drivers/gpu/drm/sti/sti_hdmi.c   | 11 ++-
 drivers/gpu/drm/sti/sti_hdmi.h   |  5 +++--
 3 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/Documentation/devicetree/bindings/gpu/st,stih4xx.txt 
b/Documentation/devicetree/bindings/gpu/st,stih4xx.txt
index 8885d9e..32cfc7b 100644
--- a/Documentation/devicetree/bindings/gpu/st,stih4xx.txt
+++ b/Documentation/devicetree/bindings/gpu/st,stih4xx.txt
@@ -68,7 +68,6 @@ STMicroelectronics stih4xx platforms
 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.
   - ddc: phandle of an I2C controller used for DDC EDID probing

 sti-hda:
@@ -174,7 +173,6 @@ Example:
interrupt-names = "irq";
clock-names = "pix", "tmds", "phy", "audio";
clocks  = <&clockgen_c_vcc 
CLK_S_PIX_HDMI>, <&clockgen_c_vcc CLK_S_TMDS_HDMI>, <&clockgen_c_vcc 
CLK_S_HDMI_REJECT_PLL>, <&clockgen_b1 CLK_S_PCM_0>;
-   hdmi,hpd-gpio   = <&PIO2 5>;
};

sti-hda at fe85a000 {
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index fed1b5f..1921197 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -130,8 +130,7 @@ static irqreturn_t hdmi_irq_thread(int irq, void *arg)

/* Hot plug/unplug IRQ */
if (hdmi->irq_status & HDMI_INT_HOT_PLUG) {
-   /* read gpio to get the status */
-   hdmi->hpd = gpio_get_value(hdmi->hpd_gpio);
+   hdmi->hpd = readl(hdmi->regs + HDMI_STA) & HDMI_STA_HOT_PLUG;
if (hdmi->drm_dev)
drm_helper_hpd_irq_event(hdmi->drm_dev);
}
@@ -766,13 +765,7 @@ static int sti_hdmi_probe(struct platform_device *pdev)
return PTR_ERR(hdmi->clk_audio);
}

-   hdmi->hpd_gpio = of_get_named_gpio(np, "hdmi,hpd-gpio", 0);
-   if (hdmi->hpd_gpio < 0) {
-   DRM_ERROR("Failed to get hdmi hpd-gpio\n");
-   return -EIO;
-   }
-
-   hdmi->hpd = gpio_get_value(hdmi->hpd_gpio);
+   hdmi->hpd = readl(hdmi->regs + HDMI_STA) & HDMI_STA_HOT_PLUG;

init_waitqueue_head(&hdmi->wait_event);

diff --git a/drivers/gpu/drm/sti/sti_hdmi.h b/drivers/gpu/drm/sti/sti_hdmi.h
index d00a3e0..3d22390 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.h
+++ b/drivers/gpu/drm/sti/sti_hdmi.h
@@ -14,6 +14,9 @@
 #define HDMI_STA   0x0010
 #define HDMI_STA_DLL_LCK   BIT(5)

+#define HDMI_STA_HOT_PLUG_SHIFT 4
+#define HDMI_STA_HOT_PLUG  (1 << HDMI_STA_HOT_PLUG_SHIFT)
+
 struct sti_hdmi;

 struct hdmi_phy_ops {
@@ -37,7 +40,6 @@ struct hdmi_phy_ops {
  * @irq_status: interrupt status register
  * @phy_ops: phy start/stop operations
  * @enabled: true if hdmi is enabled else false
- * @hpd_gpio: hdmi hot plug detect gpio number
  * @hpd: hot plug detect status
  * @wait_event: wait event
  * @event_received: wait event status
@@ -57,7 +59,6 @@ struct sti_hdmi {
u32 irq_status;
struct hdmi_phy_ops *phy_ops;
bool enabled;
-   int hpd_gpio;
bool hpd;
wait_queue_head_t wait_event;
bool event_received;
-- 
1.9.1



[PATCH 1/9] drm: sti: allow to change hdmi ddc i2c adapter

2014-12-05 Thread Benjamin Gaignard
Depending of the board configuration i2c for ddc could change,
this patch allow to use a phandle to specify which i2c controller to use.

Signed-off-by: Benjamin Gaignard 
---
 .../devicetree/bindings/gpu/st,stih4xx.txt |  1 +
 drivers/gpu/drm/sti/sti_hdmi.c | 40 +++---
 drivers/gpu/drm/sti/sti_hdmi.h |  1 +
 3 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/Documentation/devicetree/bindings/gpu/st,stih4xx.txt 
b/Documentation/devicetree/bindings/gpu/st,stih4xx.txt
index 2d150c3..8885d9e 100644
--- a/Documentation/devicetree/bindings/gpu/st,stih4xx.txt
+++ b/Documentation/devicetree/bindings/gpu/st,stih4xx.txt
@@ -69,6 +69,7 @@ STMicroelectronics stih4xx platforms
   - 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.
+  - ddc: phandle of an I2C controller used for DDC EDID probing

 sti-hda:
   Required properties:
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index b22968c..fed1b5f 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -480,17 +480,15 @@ static const struct drm_bridge_funcs 
sti_hdmi_bridge_funcs = {

 static int sti_hdmi_connector_get_modes(struct drm_connector *connector)
 {
-   struct i2c_adapter *i2c_adap;
+   struct sti_hdmi_connector *hdmi_connector
+   = to_sti_hdmi_connector(connector);
+   struct sti_hdmi *hdmi = hdmi_connector->hdmi;
struct edid *edid;
int count;

DRM_DEBUG_DRIVER("\n");

-   i2c_adap = i2c_get_adapter(1);
-   if (!i2c_adap)
-   goto fail;
-
-   edid = drm_get_edid(connector, i2c_adap);
+   edid = drm_get_edid(connector, hdmi->ddc_adapt);
if (!edid)
goto fail;

@@ -603,29 +601,38 @@ static int sti_hdmi_bind(struct device *dev, struct 
device *master, void *data)
struct sti_hdmi_connector *connector;
struct drm_connector *drm_connector;
struct drm_bridge *bridge;
-   struct i2c_adapter *i2c_adap;
+   struct device_node *ddc;
int err;

-   i2c_adap = i2c_get_adapter(1);
-   if (!i2c_adap)
-   return -EPROBE_DEFER;
+   ddc = of_parse_phandle(dev->of_node, "ddc", 0);
+   if (ddc) {
+   hdmi->ddc_adapt = of_find_i2c_adapter_by_node(ddc);
+   if (!hdmi->ddc_adapt) {
+   err = -EPROBE_DEFER;
+   of_node_put(ddc);
+   return err;
+   }
+
+   of_node_put(ddc);
+   }

/* Set the drm device handle */
hdmi->drm_dev = drm_dev;

encoder = sti_hdmi_find_encoder(drm_dev);
if (!encoder)
-   return -ENOMEM;
+   goto err_adapt;

connector = devm_kzalloc(dev, sizeof(*connector), GFP_KERNEL);
if (!connector)
-   return -ENOMEM;
+   goto err_adapt;
+

connector->hdmi = hdmi;

bridge = devm_kzalloc(dev, sizeof(*bridge), GFP_KERNEL);
if (!bridge)
-   return -ENOMEM;
+   goto err_adapt;

bridge->driver_private = hdmi;
drm_bridge_init(drm_dev, bridge, &sti_hdmi_bridge_funcs);
@@ -662,6 +669,8 @@ err_sysfs:
 err_connector:
drm_bridge_cleanup(bridge);
drm_connector_cleanup(drm_connector);
+err_adapt:
+   put_device(&hdmi->ddc_adapt->dev);
return -EINVAL;
 }

@@ -788,6 +797,11 @@ static int sti_hdmi_probe(struct platform_device *pdev)

 static int sti_hdmi_remove(struct platform_device *pdev)
 {
+   struct sti_hdmi *hdmi = dev_get_drvdata(&pdev->dev);
+
+   if (hdmi->ddc_adapt)
+   put_device(&hdmi->ddc_adapt->dev);
+
component_del(&pdev->dev, &sti_hdmi_ops);
return 0;
 }
diff --git a/drivers/gpu/drm/sti/sti_hdmi.h b/drivers/gpu/drm/sti/sti_hdmi.h
index 61bec65..d00a3e0 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.h
+++ b/drivers/gpu/drm/sti/sti_hdmi.h
@@ -62,6 +62,7 @@ struct sti_hdmi {
wait_queue_head_t wait_event;
bool event_received;
struct reset_control *reset;
+   struct i2c_adapter *ddc_adapt;
 };

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



[PATCH 0/9] fixes for STI drm driver

2014-12-05 Thread Benjamin Gaignard
This series of patches fix various issues in STI drm driver.
Now HDMI i2c adapter could be selected in device tree 
and plug detection doesn't use gpio anymore.
I also had fix some signal timing problems after testing the driver
on more hardware.
The remaining patches attemps to simplify the code and prepare
the next evolutions like DVO and auxiliary CRTC support

The changes could be fetch here:
http://git.linaro.org/people/benjamin.gaignard/kernel.git
on drm-sti-fixes-2014-12-04 branch

Benjamin Gaignard (9):
  drm: sti: allow to change hdmi ddc i2c adapter
  drm: sti: remove gpio for HDMI hot plug detection
  drm: sti: clear all mixer control
  drm: sti: simplify gdp code
  drm: sti: remove event lock while disabling vblank
  drm: sti: fix hdmi avi infoframe
  drm: sti: use drm_crtc_vblank_{on/off} instead of drm_vblank_{on/off}
  drm: sti: prepare sti_tvout to support auxiliary crtc
  drm: sti: fix delay in VTG programming

 .../devicetree/bindings/gpu/st,stih4xx.txt |  3 +-
 drivers/gpu/drm/sti/sti_drm_crtc.c | 10 +--
 drivers/gpu/drm/sti/sti_gdp.c  | 39 -
 drivers/gpu/drm/sti/sti_hdmi.c | 84 +++-
 drivers/gpu/drm/sti/sti_hdmi.h |  6 +-
 drivers/gpu/drm/sti/sti_mixer.c|  9 +++
 drivers/gpu/drm/sti/sti_mixer.h|  1 +
 drivers/gpu/drm/sti/sti_tvout.c| 92 --
 drivers/gpu/drm/sti/sti_vtg.c  | 25 +-
 9 files changed, 160 insertions(+), 109 deletions(-)

-- 
1.9.1



[PATCH v15 0/3] Add drm driver for Rockchip Socs

2014-12-05 Thread Heiko Stübner
Hi Dave,

Am Freitag, 5. Dezember 2014, 17:26:04 schrieb Dave Airlie:
> On 5 December 2014 at 05:29, Daniel Kurtz  wrote:
> > I thought the recommended solution for this was to fix OMAP3 to not
> > select  ARM_DMA_USE_IOMMU and OMAP_IOMMU, not to drop the 'depends on'
> > in drm/rockchip?
> 
> Lets fix that up once we get this merged, if I had a tree based on the
> iommu I'd have
> it -next now.
> 
> can I get a pull for that?

Mark sent a pull on tuesday as reply to the cover-letter.
Message-ID: <547D88D7.5080005 at rock-chips.com>

Replicated here, if you don't want to search.


Heiko

 8< -

Hi Dave

The following changes since commit 656d7077d8ffd1c2492d4a0a354367ab2e545059:

   dt-bindings: iommu: Add documentation for rockchip iommu (2014-11-03 
17:29:09 +0100)

are available in the git repository at:

   https://github.com/markyzq/kernel-drm-rockchip.git drm_iommu_v15

for you to fetch changes up to 5ac4837b12f533de5d9f8f66b45494c58e805536:

   dt-bindings: video: Add documentation for rockchip vop (2014-12-02 
17:29:33 +0800)


Mark Yao (3):
   drm: rockchip: Add basic drm driver
   dt-bindings: video: Add for rockchip display subsytem
   dt-bindings: video: Add documentation for rockchip vop

  .../devicetree/bindings/video/rockchip-drm.txt |   19 +
  .../devicetree/bindings/video/rockchip-vop.txt |   58 +
  drivers/gpu/drm/Kconfig|2 +
  drivers/gpu/drm/Makefile   |1 +
  drivers/gpu/drm/rockchip/Kconfig   |   17 +
  drivers/gpu/drm/rockchip/Makefile  |8 +
  drivers/gpu/drm/rockchip/rockchip_drm_drv.c|  551 
  drivers/gpu/drm/rockchip/rockchip_drm_drv.h|   68 +
  drivers/gpu/drm/rockchip/rockchip_drm_fb.c |  201 +++
  drivers/gpu/drm/rockchip/rockchip_drm_fb.h |   28 +
  drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c  |  210 +++
  drivers/gpu/drm/rockchip/rockchip_drm_fbdev.h  |   21 +
  drivers/gpu/drm/rockchip/rockchip_drm_gem.c|  294 
  drivers/gpu/drm/rockchip/rockchip_drm_gem.h|   54 +
  drivers/gpu/drm/rockchip/rockchip_drm_vop.c| 1455 
  drivers/gpu/drm/rockchip/rockchip_drm_vop.h|  201 +++
  16 files changed, 3188 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/video/rockchip-drm.txt
  create mode 100644 Documentation/devicetree/bindings/video/rockchip-vop.txt
  create mode 100644 drivers/gpu/drm/rockchip/Kconfig
  create mode 100644 drivers/gpu/drm/rockchip/Makefile
  create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_drv.c
  create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_drv.h
  create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_fb.c
  create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_fb.h
  create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c
  create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.h
  create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_gem.c
  create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_gem.h
  create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_vop.c
  create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_vop.h




[Bug 87023] Dota 2 crashed and hang on ATi Mobility Radeon HD 5650 (Acer 4745G)

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=87023

--- Comment #8 from Romy  ---
Created attachment 110486
  --> https://bugs.freedesktop.org/attachment.cgi?id=110486&action=edit
crashed with more convincing data

Hi Alex, this is more convincing data about crashing was not overheating's
fault.

-- 
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/20141205/33ca9a58/attachment.html>


[Bug 87023] Dota 2 crashed and hang on ATi Mobility Radeon HD 5650 (Acer 4745G)

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=87023

Romy  changed:

   What|Removed |Added

   Priority|medium  |highest
   Severity|major   |critical

-- 
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/20141205/11b983e7/attachment.html>


[PATCH -next] drm/i915: Fix missing unlock on error in i915_gem_init_hw()

2014-12-05 Thread weiyj...@163.com
From: Wei Yongjun 

Add the missing unlock before return from function i915_gem_init_hw()
in the error handling case.

Signed-off-by: Wei Yongjun 
---
 drivers/gpu/drm/i915/i915_gem.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index d2ba315..3eeb2d0 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4879,8 +4879,10 @@ i915_gem_init_hw(struct drm_device *dev)
i915_gem_init_swizzling(dev);

ret = dev_priv->gt.init_rings(dev);
-   if (ret)
+   if (ret) {
+   mutex_unlock(&dev->struct_mutex);
return ret;
+   }

for (i = 0; i < NUM_L3_SLICES(dev); i++)
i915_gem_l3_remap(&dev_priv->ring[RCS], i);



[PATCH] add support for AM572x in the DDX

2014-12-05 Thread Robert Nelson
Signed-off-by: Robert Nelson 
---
 README| 1 +
 src/omap_driver.c | 3 +++
 src/omap_driver.h | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/README b/README
index 059f258..d4afd89 100644
--- a/README
+++ b/README
@@ -9,6 +9,7 @@ the following chipsets:
   + OMAP4460
   + OMAP5430
   + OMAP5432
+  + AM572x


 NOTE: this driver is work in progress..  you probably don't want to try
diff --git a/src/omap_driver.c b/src/omap_driver.c
index 1fc188d..b9d90c5 100644
--- a/src/omap_driver.c
+++ b/src/omap_driver.c
@@ -95,6 +95,7 @@ static SymTabRec OMAPChipsets[] = {
/*{ 4470, "OMAP4470 with  ;-)" }, */
{ 0x5430, "OMAP5430 with PowerVR SGX544 MP" },
{ 0x5432, "OMAP5432 with PowerVR SGX544 MP" },
+   { 0x0752, "AM572x with PowerVR SGX544 MP" },
{-1, NULL }
 };

@@ -620,6 +621,7 @@ OMAPPreInit(ScrnInfoPtr pScrn, int flags)
case 0x4460:
case 0x5430:
case 0x5432:
+   case 0x0752:
if (xf86LoadSubModule(pScrn, SUB_MODULE_PVR)) {
INFO_MSG("Loaded the %s sub-module", SUB_MODULE_PVR);
} else {
@@ -663,6 +665,7 @@ OMAPAccelInit(ScreenPtr pScreen)
case 0x4460:
case 0x5430:
case 0x5432:
+   case 0x0752:
INFO_MSG("Initializing the \"%s\" sub-module ...", 
SUB_MODULE_PVR);
pOMAP->pOMAPEXA = InitPowerVREXA(pScreen, pScrn, 
pOMAP->drmFD);
if (pOMAP->pOMAPEXA) {
diff --git a/src/omap_driver.h b/src/omap_driver.h
index 6d2517e..8277e25 100644
--- a/src/omap_driver.h
+++ b/src/omap_driver.h
@@ -184,7 +184,7 @@ static inline Bool has_video(OMAPPtr pOMAP)

 static inline Bool has_dmm(OMAPPtr pOMAP)
 {
-   return pOMAP->chipset >= 0x4430;
+   return pOMAP->chipset >= 0x4430 || pOMAP->chipset == 0x0752;
 }

 static inline Bool has_rotation(OMAPPtr pOMAP)
-- 
2.1.3



[Bug 87023] Dota 2 crashed and hang on ATi Mobility Radeon HD 5650 (Acer 4745G)

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=87023

--- Comment #7 from Romy  ---
Hi Alex, thanks in advance, i often heard about you at phoronix :D . Feel free
to me if you need another attachment or question, I will monitoring this bug,
hope you can solve it.

-- 
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/20141205/47dffa96/attachment.html>


[Bug 87023] Dota 2 crashed and hang on ATi Mobility Radeon HD 5650 (Acer 4745G)

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=87023

--- Comment #6 from Romy  ---
Created attachment 110484
  --> https://bugs.freedesktop.org/attachment.cgi?id=110484&action=edit
my temperature monitor while playing dota2

-- 
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/20141205/d160b167/attachment-0001.html>


[PATCH 1/2] drm: Fix memory leak at error path of drm_read()

2014-12-05 Thread Chris Wilson
On Thu, Dec 04, 2014 at 06:25:08PM +0100, Daniel Vetter wrote:
> On Thu, Dec 04, 2014 at 04:31:15PM +, Chris Wilson wrote:
> > On Thu, Dec 04, 2014 at 01:28:39PM +0100, Daniel Vetter wrote:
> > > On Thu, Dec 04, 2014 at 11:51:14AM +, Chris Wilson wrote:
> > > > On Thu, Dec 04, 2014 at 11:56:42AM +0100, Takashi Iwai wrote:
> > > > > Signed-off-by: Takashi Iwai 
> > > > > ---
> > > > >  drivers/gpu/drm/drm_fops.c | 1 +
> > > > >  1 file changed, 1 insertion(+)
> > > > > 
> > > > > diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> > > > > index ed7bc68f7e87..a82dc28d54f3 100644
> > > > > --- a/drivers/gpu/drm/drm_fops.c
> > > > > +++ b/drivers/gpu/drm/drm_fops.c
> > > > > @@ -525,6 +525,7 @@ ssize_t drm_read(struct file *filp, char __user 
> > > > > *buffer,
> > > > >   if (copy_to_user(buffer + total,
> > > > >e->event, e->event->length)) {
> > > > >   total = -EFAULT;
> > > > > + e->destroy(e);
> > > > 
> > > > We shouldn't just be throwing away the event here, but put the event
> > > > back at the front of the queue. Poses an interesting race issue. Seems
> > > > like we want to hold the spinlock until the copy is complete so that we
> > > > can fix up the failure correctly.
> > > 
> > > I've read the manpage for read and it explicitly states that when you get
> > > an error it's undefined what happens to the read position. Since -EFAULT
> > > is really just a userspace bug I think we can happily drop the event on
> > > the floor, no reason to bend over in the kernel.
> > 
> > Hmm. Actually the code is buggy is the provided buffer is too short for
> > the first event in O_NONBLOCK mode.
> 
> Well we essentially send out datagrams instead of a bytestream. If we look
> at recvmsg and friends then discarding the additional bytes is something
> that's already being done. So I'm not terribly concerned about that
> either. It's a bit non-pretty that we use read and not reicvmsg but since
> we use read already not something we can ever fix.

In all of this consider what the impact of dropping an event is: system
lockup.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


[Bug 85421] radeon stalled, GPU lockup, reset and failed on resume; crashed by firefox.

2014-12-05 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=85421

--- Comment #17 from Jorn Amundsen  ---
I rebuilt the Fedora20 RPM's from the F20 v-10.3.3-1 mesa.spec file, after
applying
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ae4536b4f71cbe76230ea7edc7eb4d6041e651b4,
creating new RPM's v.10.3.3-2. Now I am up and running with the patched Mesa
10.3.3-2 and the 3.17.4-200 kernel.

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


[Bug 87023] Dota 2 crashed and hang on ATi Mobility Radeon HD 5650 (Acer 4745G)

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=87023

--- Comment #5 from Romy  ---
Created attachment 110479
  --> https://bugs.freedesktop.org/attachment.cgi?id=110479&action=edit
this is my bootchart

-- 
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/20141205/631c590b/attachment.html>


[Bug 87023] Dota 2 crashed and hang on ATi Mobility Radeon HD 5650 (Acer 4745G)

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=87023

--- Comment #4 from Romy  ---
should I attach my bootchart?

-- 
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/20141205/ca3f792d/attachment.html>


[Bug 87023] Dota 2 crashed and hang on ATi Mobility Radeon HD 5650 (Acer 4745G)

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=87023

--- Comment #3 from Romy  ---
Created attachment 110478
  --> https://bugs.freedesktop.org/attachment.cgi?id=110478&action=edit
this dmesg output

-- 
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/20141205/6ae635b9/attachment.html>


[Bug 87023] Dota 2 crashed and hang on ATi Mobility Radeon HD 5650 (Acer 4745G)

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=87023

--- Comment #2 from Romy  ---
Created attachment 110477
  --> https://bugs.freedesktop.org/attachment.cgi?id=110477&action=edit
this my recently xorg log

-- 
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/20141205/4646de34/attachment.html>


[Bug 87023] Dota 2 crashed and hang on ATi Mobility Radeon HD 5650 (Acer 4745G)

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=87023

--- Comment #1 from Alex Deucher  ---
Can you bisect mesa?  If changing mesa caused it and other apps are not
affected, I doubt it's temperature related.  Please also attach your xorg log
and dmesg output.

-- 
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/20141205/cbeae18f/attachment.html>


[Bug 73338] Fan speed in idle at 40% with radeonsi and at 18% with catalyst

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=73338

Chernovsky Oleg  changed:

   What|Removed |Added

 Attachment #106588|0   |1
is obsolete||

--- Comment #63 from Chernovsky Oleg  ---
Created attachment 110476
  --> https://bugs.freedesktop.org/attachment.cgi?id=110476&action=edit
hwmon interface for manual fan control on CI cards

Hi Alex, I've made rough patch implementing hwmon interface for the code you've
provided. Please take a look (comments inside).

Patch is done on top of your 3.19-wip branch.

-- 
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/20141205/bded2e47/attachment-0001.html>


[Bug 87023] Dota 2 crashed and hang on ATi Mobility Radeon HD 5650 (Acer 4745G)

2014-12-05 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=87023

Bug ID: 87023
   Summary: Dota 2 crashed and hang on ATi Mobility Radeon HD 5650
(Acer 4745G)
   Product: Mesa
   Version: git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: major
  Priority: medium
 Component: Drivers/Gallium/r600
  Assignee: dri-devel at lists.freedesktop.org
  Reporter: imoreph at gmail.com

This has never happened with mesa 10.1.3. But when I upgraded into latest mesa,
version 10.2 until now the problem not resolved. I think before it caused by
overheating, but it’s not true cause I have using conservative option and the
gpu and cpu has around 70 celcius degree, it become hang or crashed everytime I
playing dota 2. Other games are not affected even the temperature is high (I’m
playing Team Fortress 2, The Witcher 2, Euro Truck Simulator).
I have more information, since mesa 10.x.x., my laptop take 30 seconds to start
up, before it (mesa 9.x.x) only take 11 seconds (I’m using SSD).

-- 
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/20141205/06db377f/attachment.html>


[git pull] drm intel fixes

2014-12-05 Thread Dave Airlie

Hi Linus,

two intel stable fixes, that should be it from me for this round.

Dave.

The following changes since commit ebea76f5b95caddb59f49a3e288da26358e6ab1f:

  Merge tag 'media/v3.18-rc8' of 
git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media (2014-12-04 
16:06:02 -0800)

are available in the git repository at:


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

for you to fetch changes up to 3e3282c0a23d8eb9438dcf4ac908a5eb48c7038b:

  Merge tag 'drm-intel-fixes-2014-12-04' of 
git://anongit.freedesktop.org/drm-intel into drm-fixes (2014-12-05 11:12:29 
+1000)



Daniel Vetter (2):
  drm/i915: More cautious with pch fifo underruns
  drm/i915: Unlock panel even when LVDS is disabled

Dave Airlie (1):
  Merge tag 'drm-intel-fixes-2014-12-04' of 
git://anongit.freedesktop.org/drm-intel into drm-fixes

 drivers/gpu/drm/i915/intel_display.c |  2 --
 drivers/gpu/drm/i915/intel_lvds.c| 22 +++---
 2 files changed, 11 insertions(+), 13 deletions(-)


[Bug 67681] Asus G75VW F key Not Working For Screen Brightness

2014-12-05 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=67681

--- Comment #32 from KernelBug <3fdd1e5d at opayq.com> ---
Hi,

Has there been any progress on this?

As I mentioned in the past I use xbindkeys in my $HOME a file called,
.xbindkeysrc and these are the command I use below;



##
# End of xbindkeys configuration #
##

# My keybindings

#decrease brightness
"~/.config/openbox/backlight-dn.sh"
m:0x0 + c:71
 F5

#increase brightness
"~/.config/openbox/backlight-up.sh"
 m:0x0 + c:72
 F6

Which simply run;

xbacklight -inc 10
xbacklight -dec 10

Seeing that xbacklight works in this situation, does that help shed light on
comiing up with a solution?

thank you...

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


[Bug 85421] radeon stalled, GPU lockup, reset and failed on resume; crashed by firefox.

2014-12-05 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=85421

--- Comment #16 from Hin-Tak Leung  ---
I finally had a lock-up with mesa 10.2.9. Looking at the logs, I have had a
fair number of GPU faults which I did not notice, briefly for a few seconds
about 4 hours before an extended period of 1/2 hour of such faults. I believe
in the 2nd period I was watching a video with mplayer. (the first period might
be a trial run of the same video). I suspended the machine to RAM, then on
waking up, the screen flashed a few times between black and the last desktop
look, with some corruption in the desktop look; the mouse is still responsive
to movement but
clicking no longer works, nor keyboard (trying to switch to a vt to
shutdown/reboot, did not respond).

Anyway, I am onto mesa 10.3.4 now, which includes
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ae4536b4f71cbe76230ea7edc7eb4d6041e651b4
. I hope this get fixed properly though, since the change looks like it just
band-aided over something.

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