GitHub/MotorolaMobilityLLC/kernel-slsi.git
12 years agodrm/exynos: added hdmi display support
Seung-Woo Kim [Wed, 21 Dec 2011 08:39:39 +0000 (17:39 +0900)]
drm/exynos: added hdmi display support

This patch is hdmi display support for exynos drm driver.

There is already v4l2 based exynos hdmi driver in drivers/media/video/s5p-tv
and some low level code is already in s5p-tv and even headers for register
define are almost same. but in this patch, we decide not to consider separated
common code with s5p-tv.

Exynos HDMI is composed of 5 blocks, mixer, vp, hdmi, hdmiphy and ddc.

1. mixer. The piece of hardware responsible for mixing and blending multiple
data inputs before passing it to an output device.  The mixer is capable of
handling up to three image layers. One is the output of VP.  Other two are
images in RGB format.  The blending factor, and layers' priority are controlled
by mixer's registers. The output is passed to HDMI.

2. vp (video processor). It is used for processing of NV12/NV21 data.  An image
stored in RAM is accessed by DMA. The output in YCbCr444 format is send to
mixer.

3. hdmi. The piece of HW responsible for generation of HDMI packets. It takes
pixel data from mixer and transforms it into data frames. The output is send
to HDMIPHY interface.

4. hdmiphy. Physical interface for HDMI. Its duties are sending HDMI packets to
HDMI connector. Basically, it contains a PLL that produces source clock for
mixer, vp and hdmi.

5. ddc (display data channel). It is dedicated i2c channel to exchange display
information as edid with display monitor.

With plane support, exynos hdmi driver fully supports two mixer layes and vp
layer. Also vp layer supports multi buffer plane pixel formats having non
contigus memory spaces.

In exynos drm driver, common drm_hdmi driver to interface with drm framework
has opertion pointers for mixer and hdmi. this drm_hdmi driver is registered as
sub driver of exynos_drm. hdmi has hdmiphy and ddc i2c clients and controls
them. mixer controls all overlay layers in both mixer and vp.

Vblank interrupts for hdmi are handled by mixer internally because drm
framework cannot support multiple irq id. And pipe number is used to check
which display device irq happens.

History
v2: this version
 - drm plane feature support to handle overlay layers.
 - multi buffer plane pixel format support for vp layer.
 - vp layer support

RFCv1: original
 - at https://lkml.org/lkml/2011/11/4/164

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: added mutex lock and code clean.
Inki Dae [Fri, 16 Dec 2011 12:49:03 +0000 (21:49 +0900)]
drm/exynos: added mutex lock and code clean.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
12 years agodrm/exynos: extend vblank off delay time.
Inki Dae [Fri, 16 Dec 2011 12:31:12 +0000 (21:31 +0900)]
drm/exynos: extend vblank off delay time.

some platform could be entering to sleep after short time once lcd panel off
but before that vblank could be off by vblank off delay feature. at that time,
vblank doesn't have the pair between vblank_get/put. so this path makes vblank
off delay to have enough.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
12 years agodrm/exynos: change driver name.
Inki Dae [Thu, 15 Dec 2011 08:31:24 +0000 (17:31 +0900)]
drm/exynos: change driver name.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: Support multi buffers
Seung-Woo Kim [Thu, 15 Dec 2011 05:36:22 +0000 (14:36 +0900)]
drm/exynos: Support multi buffers

These formats(NV12M, NV12MT and YUV420M) have non contiguous  multi
planes, so each plane uses different buffer. The exynos drm should
support multi buffer for them.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm: Add multi buffer plane pixel formats
Seung-Woo Kim [Thu, 15 Dec 2011 06:40:55 +0000 (15:40 +0900)]
drm: Add multi buffer plane pixel formats

Multi buffer plane pixel format has seperated memory spaces for each
plane. For example, NV12M has Y plane and CbCr plane and these are in
non contiguous memory region. Compared with NV12, NV12M's memory shape
is like following.
NV12  : ______(Y)(CbCr)_______
NV12M : __(Y)_ ..... _(CbCr)__

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: added pm support.
Inki Dae [Mon, 12 Dec 2011 07:35:20 +0000 (16:35 +0900)]
drm/exynos: added pm support.

this patch adds pm feature for fimd driver.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: remove buffer creation of fbdev from drm framebuffer creation
Joonyoung Shim [Tue, 13 Dec 2011 05:46:57 +0000 (14:46 +0900)]
drm/exynos: remove buffer creation of fbdev from drm framebuffer creation

The fbdev fb and the user fb is created from same function -
exynos_drm_fb_create, but this function creates not only drm framebuffer
but buffer of fbdev. Remove it because it complicates codes and use
exynos_drm_gem_create() than exynos_drm_buf_create() to create buffer of
fbdev, it give better consistency of codes and more clear
implementation.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: Split creation of gem object and gem handle
Joonyoung Shim [Tue, 13 Dec 2011 05:39:13 +0000 (14:39 +0900)]
drm/exynos: Split creation of gem object and gem handle

exynos_drm_gem_create function created gem object with gem handle but it
can be called externally without gem handle creation through this patch.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: Fix a fake mmap offset creation
Joonyoung Shim [Tue, 13 Dec 2011 05:32:24 +0000 (14:32 +0900)]
drm/exynos: Fix a fake mmap offset creation

Make a fake mmap offset only when it needs.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: gem code cleanup
Joonyoung Shim [Tue, 13 Dec 2011 05:20:23 +0000 (14:20 +0900)]
drm/exynos: gem code cleanup

This cleans codes of exynos gem - indents and order function and so on.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm: add missing exports for i810 driver.
Dave Airlie [Thu, 22 Dec 2011 19:09:01 +0000 (19:09 +0000)]
drm: add missing exports for i810 driver.

Brown paper bag of danvet.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoMerge branch 'for-airlied' of git://people.freedesktop.org/~danvet/drm into drm-core...
Dave Airlie [Thu, 22 Dec 2011 19:05:01 +0000 (19:05 +0000)]
Merge branch 'for-airlied' of git://people.freedesktop.org/~danvet/drm into drm-core-next

* 'for-airlied' of git://people.freedesktop.org/~danvet/drm:
  drm/i810: don't acces hw regs in lastclose
  drm/i810: cleanup reclaim_buffers
  drm: kill drm_sman
  drm/sis: use drm_mm instead of drm_sman
  drm/via: use drm_mm instead of drm_sman
  drm/sman: kill user_hash_tab
  drm/sis: track user->memblock mapping with idr
  drm/via: track user->memblock mapping with idr
  drm/sman: rip out owner tracking
  drm/sman: kill owner tracking interface functions
  drm/via: track obj->drm_fd relations in the driver
  drm/sis: track obj->drm_fd relations in the driver

12 years agodrm/i810: don't acces hw regs in lastclose
Daniel Vetter [Sun, 30 Oct 2011 11:44:56 +0000 (12:44 +0100)]
drm/i810: don't acces hw regs in lastclose

i810 uses a userspace provided mmio map using the drm core map
infrastructure. By the time we reach lastclose, this is all gone
and our mmio_map pointer points at freed memory. Depending upon
luck that still works, most often it just oopses.

Aside: drm maps aren't refcounted, so userspace can essentially oops
the kernel any time it wants to. Who cares.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agodrm/i810: cleanup reclaim_buffers
Daniel Vetter [Tue, 25 Oct 2011 21:51:24 +0000 (23:51 +0200)]
drm/i810: cleanup reclaim_buffers

My dear old i815 always hits the deadlocked on reclaim_buffers
warning. Switch over to the idlelock duct-tape on hope that
works better. I've fired up my i815 and now closing glxgears doesn't
take 5 seconds anymore. \o/

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agoMerge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux...
Dave Airlie [Thu, 22 Dec 2011 11:02:06 +0000 (11:02 +0000)]
Merge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-core-next

* 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6: (102 commits)
  drm/nouveau/ttm: fix crash as a result of a recent ttm change
  drm/nouveau: Fix notifier blocks over the 4GB mark.
  drm/nouveau: Fix pushbufs over the 4GB mark.
  drm/nvc0/pm: initial engine reclocking
  drm/nouveau: move hpd enable/disable to common code
  drm/nv40/disp: implement support for hotplug irq
  drm/nouveau/gpio: reimplement as nouveau_gpio.c, fixing a number of issues
  drm/nouveau: just pass gpio line to pwm_*, not entire gpio struct
  drm/nouveau/hwsq: remove some magic, give proper opcode names
  drm/nv50/pm: introduce hwsq-based memory reclocking
  drm/nv04/disp: handle dual-link spwg panels without needing quirks
  drm/nouveau/dp: remove broken display depth function, use the improved one
  drm/nouveau/mxm: implement ROM shadow method
  drm/nouveau/mxm: implement _DSM shadow method
  drm/nouveau/mxm: implement wmi shadow method
  drm/nouveau/mxm: initial implementation of dcb sanitisation
  drm/nouveau/disp: parse connector info directly in nouveau_connector.c
  drm/nouveau/i2c: handle bit-banging ourselves
  drm/nouveau/i2c: fix debug message
  drm/nouveau/i2c: tidy up bit-bang helpers, also fixing nv50 setsda bug
  ...

12 years agodrm/nouveau/ttm: fix crash as a result of a recent ttm change
Ben Skeggs [Thu, 22 Dec 2011 05:20:21 +0000 (15:20 +1000)]
drm/nouveau/ttm: fix crash as a result of a recent ttm change

"drm/ttm: callback move_notify any time bo placement change v4" failed to
avoid a NULL pointer dereference in nouveau caused by move_notify being
expected to handle that case now.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm: kill drm_sman
Daniel Vetter [Tue, 25 Oct 2011 21:19:27 +0000 (23:19 +0200)]
drm: kill drm_sman

No longer used.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agodrm/sis: use drm_mm instead of drm_sman
Daniel Vetter [Wed, 26 Oct 2011 20:22:59 +0000 (22:22 +0200)]
drm/sis: use drm_mm instead of drm_sman

v2: Smash compile fix from Tormod Volden <debian.tormod@gmail.com> for
CONFIG_FB_SIS on top of this.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agodrm/via: use drm_mm instead of drm_sman
Daniel Vetter [Wed, 26 Oct 2011 20:21:13 +0000 (22:21 +0200)]
drm/via: use drm_mm instead of drm_sman

To make the transition in a piece-wise and bisectable way possible,
I've hijacked the ->owner_list from drm_sman. While transitioning, the
list_add was done by the driver, while the list_del was still done by
the dying sman code.

Now that we are in full control of ->owner_list, do the list_del
ourselves.

v2: Better explain the list_del trickery as suggested by Chris Wilson.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agodrm/sman: kill user_hash_tab
Daniel Vetter [Tue, 25 Oct 2011 20:33:37 +0000 (22:33 +0200)]
drm/sman: kill user_hash_tab

No longer used.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agodrm/sis: track user->memblock mapping with idr
Daniel Vetter [Tue, 25 Oct 2011 16:00:41 +0000 (18:00 +0200)]
drm/sis: track user->memblock mapping with idr

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agodrm/via: track user->memblock mapping with idr
Daniel Vetter [Tue, 25 Oct 2011 15:55:31 +0000 (17:55 +0200)]
drm/via: track user->memblock mapping with idr

Massive indirection through a hashtable for a simple key->pointer
look-up actually just adds bloat.

v2: Drop the misleading comment noted by Chris Wilson.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agodrm/sman: rip out owner tracking
Daniel Vetter [Wed, 26 Oct 2011 20:28:07 +0000 (22:28 +0200)]
drm/sman: rip out owner tracking

In contrast to kms drivers, sis/via _always_ associated a buffer with
a drm fd. So by the time we reach lastclose, all open drm fds are gone
and with them their associated objects.

So when sis/via call drm_sman_cleanup in their lastclose funcs, that
will free 0 objects.

The owner tracking now serves no purpose at all, hence rip it ou. We
can't kill the corresponding fields in struct drm_memblock_item yet
because we hijack these in the new driver private owner tracking. But
now that drm_sman.c doesn't touch ->owner_list anymore, we need to
kill the list_move hack and properly add the item to the file_priv
list.

Also leave the list_del(&obj->owner_list) in drm_sman_free for the
moment, it will move to the drivers when sman disappears completely.

v2: Remove the redundant INIT_LIST_HEAD as noted by Chris Wilson

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agodrm/sman: kill owner tracking interface functions
Daniel Vetter [Tue, 25 Oct 2011 14:39:59 +0000 (16:39 +0200)]
drm/sman: kill owner tracking interface functions

These are now unused.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agodrm/via: track obj->drm_fd relations in the driver
Daniel Vetter [Tue, 25 Oct 2011 14:32:45 +0000 (16:32 +0200)]
drm/via: track obj->drm_fd relations in the driver

Exactly like the previous patch for sis.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agodrm/sis: track obj->drm_fd relations in the driver
Daniel Vetter [Tue, 25 Oct 2011 14:32:34 +0000 (16:32 +0200)]
drm/sis: track obj->drm_fd relations in the driver

By attach a driver private struct to each open drm fd.

Because we steal the owner_list from drm_sman until things settle,
use list_move instead of list_add.

This requires to export a drm_sman function temporarily before
drm_sman will die for real completely.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agoMerge remote-tracking branch 'pfdo/drm-fixes' into drm-core-next
Dave Airlie [Wed, 21 Dec 2011 09:50:56 +0000 (09:50 +0000)]
Merge remote-tracking branch 'pfdo/drm-fixes' into drm-core-next

-next reported a messy merge, so I've merged my upstream pull into
my -next tree.

Conflicts:
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

13 years agodrm/nouveau: Fix notifier blocks over the 4GB mark.
Francisco Jerez [Sat, 19 Nov 2011 16:22:37 +0000 (17:22 +0100)]
drm/nouveau: Fix notifier blocks over the 4GB mark.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Fix pushbufs over the 4GB mark.
Francisco Jerez [Sat, 19 Nov 2011 10:57:52 +0000 (11:57 +0100)]
drm/nouveau: Fix pushbufs over the 4GB mark.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvc0/pm: initial engine reclocking
Ben Skeggs [Fri, 28 Oct 2011 14:22:49 +0000 (00:22 +1000)]
drm/nvc0/pm: initial engine reclocking

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: move hpd enable/disable to common code
Ben Skeggs [Thu, 24 Nov 2011 02:59:44 +0000 (12:59 +1000)]
drm/nouveau: move hpd enable/disable to common code

No idea why I didn't do this initially... NVD9 HPD is now enabled.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv40/disp: implement support for hotplug irq
Ben Skeggs [Tue, 22 Nov 2011 03:49:22 +0000 (13:49 +1000)]
drm/nv40/disp: implement support for hotplug irq

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/gpio: reimplement as nouveau_gpio.c, fixing a number of issues
Ben Skeggs [Mon, 21 Nov 2011 06:41:48 +0000 (16:41 +1000)]
drm/nouveau/gpio: reimplement as nouveau_gpio.c, fixing a number of issues

- moves out of nouveau_bios.c and demagics the logical state definitions
- simplifies chipset-specific driver interface
- makes most of gpio irq handling common, will use for nv4x hpd later
- api extended to allow both direct gpio access, and access using the
  logical function states
- api extended to allow for future use of gpio extender chips
- pre-nv50 was handled very badly, the main issue being that all GPIOs
  were being treated as output-only.
- fixes nvd0 so gpio changes actually stick, magic reg needs bashing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: just pass gpio line to pwm_*, not entire gpio struct
Ben Skeggs [Mon, 21 Nov 2011 11:28:28 +0000 (21:28 +1000)]
drm/nouveau: just pass gpio line to pwm_*, not entire gpio struct

We don't need more than the line id to determine the PWM controller, and
the GPIO interfaces are about to change somewhat.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/hwsq: remove some magic, give proper opcode names
Ben Skeggs [Wed, 9 Nov 2011 10:22:25 +0000 (20:22 +1000)]
drm/nouveau/hwsq: remove some magic, give proper opcode names

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/pm: introduce hwsq-based memory reclocking
Martin Peres [Mon, 7 Nov 2011 22:38:50 +0000 (23:38 +0100)]
drm/nv50/pm: introduce hwsq-based memory reclocking

More work needs to be done on supporting the different memory types.

v2 (Ben Skeggs):
- fixed up conflicts from not having pausing patch first
- restructured code somewhat to fit with how all the other code works
- fixed bug where incorrect mpll_ctrl could get set sometimes
- removed stuff that's cargo-culted from the binary driver
- merged nv92+ display disable into hwsq
- fixed incorrect opcode 0x5f magic at end of ucode

Signed-off-by: Martin Peres <martin.peres@ensi-bourges.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv04/disp: handle dual-link spwg panels without needing quirks
Ben Skeggs [Fri, 18 Nov 2011 01:55:43 +0000 (11:55 +1000)]
drm/nv04/disp: handle dual-link spwg panels without needing quirks

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/dp: remove broken display depth function, use the improved one
Ben Skeggs [Tue, 15 Nov 2011 04:31:13 +0000 (14:31 +1000)]
drm/nouveau/dp: remove broken display depth function, use the improved one

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/mxm: implement ROM shadow method
Ben Skeggs [Mon, 7 Nov 2011 06:16:24 +0000 (16:16 +1000)]
drm/nouveau/mxm: implement ROM shadow method

Untested, -ENOHW.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/mxm: implement _DSM shadow method
Ben Skeggs [Mon, 7 Nov 2011 03:36:08 +0000 (13:36 +1000)]
drm/nouveau/mxm: implement _DSM shadow method

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/mxm: implement wmi shadow method
Ben Skeggs [Mon, 7 Nov 2011 02:54:20 +0000 (12:54 +1000)]
drm/nouveau/mxm: implement wmi shadow method

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/mxm: initial implementation of dcb sanitisation
Ben Skeggs [Wed, 12 Oct 2011 06:36:42 +0000 (16:36 +1000)]
drm/nouveau/mxm: initial implementation of dcb sanitisation

The DCB table provided by the VBIOS on most MXM chips has a number of
entries which either need to be disabled, or modified according to the
MXM-SIS Output Device Descriptors.

The x86 vbios code usually takes care of this for us, however, with the
large number of laptops now with switchable graphics or optimus, a lot
of the time nouveau is responsible for POSTing the card instead - leaving
some fun situations like, plugging in a monitor and having nouveau decide
3 connectors actually just got plugged in..

No MXM-SIS fetching methods implemented yet.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/disp: parse connector info directly in nouveau_connector.c
Ben Skeggs [Fri, 18 Nov 2011 00:23:59 +0000 (10:23 +1000)]
drm/nouveau/disp: parse connector info directly in nouveau_connector.c

Another case where we parsed vbios data to some structs, then again use
that info once to construct another set of data.  Skip the intermediate
step.

This is also slightly improved in that we can now use DCB 3.x connector
table info, which will allow NV4x to gain hotplug support, and to make
quirks for SPWG LVDS panels unnecessary.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/i2c: handle bit-banging ourselves
Ben Skeggs [Wed, 21 Dec 2011 08:09:12 +0000 (18:09 +1000)]
drm/nouveau/i2c: handle bit-banging ourselves

i2c-algo-bit doesn't actually work very well on one card I have access to
(NVS 300), random single-bit errors occur most of the time - what we're
doing now is closer to what xf86i2c.c does.

The original plan was to figure out why i2c-algo-bit fails on the NVS 300,
and fix it.  However, while investigating I discovered i2c-algo-bit calls
cond_resched(), which makes it a bad idea for us to be using as we execute
VBIOS scripts from a tasklet, and there may very well be i2c transfers as
a result.

So, since I already wrote this code in userspace to track down the NVS 300
bug, and it's not really much code - lets use it.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/i2c: fix debug message
Ben Skeggs [Tue, 22 Nov 2011 12:36:18 +0000 (22:36 +1000)]
drm/nouveau/i2c: fix debug message

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/i2c: tidy up bit-bang helpers, also fixing nv50 setsda bug
Ben Skeggs [Thu, 17 Nov 2011 03:56:14 +0000 (13:56 +1000)]
drm/nouveau/i2c: tidy up bit-bang helpers, also fixing nv50 setsda bug

Was using nv_mask, which is bad.  Reading the reg senses the current line
states, which aren't necessarily the states we're trying to drive the
lines to.

Fixed to store SCL driver state just as we already do for SDA.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/i2c: do parsing of i2c-related vbios info in nouveau_i2c.c
Ben Skeggs [Fri, 11 Nov 2011 00:22:19 +0000 (10:22 +1000)]
drm/nouveau/i2c: do parsing of i2c-related vbios info in nouveau_i2c.c

Not much point parsing the vbios data into a struct which is only used once
to parse the data into another struct, go directly from vbios to
nouveau_i2c_chan.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/bios: start refactoring dcb routines
Ben Skeggs [Thu, 10 Nov 2011 05:42:55 +0000 (15:42 +1000)]
drm/nouveau/bios: start refactoring dcb routines

This primary reason for this was mostly to avoid duplication of some of
this stuff by the MXM-SIS parser.  However, some other cleanups will also
follow this as a result.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/bios: fold fixup_legacy_i2c
Ben Skeggs [Thu, 10 Nov 2011 04:49:19 +0000 (14:49 +1000)]
drm/nouveau/bios: fold fixup_legacy_i2c

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/bios: pass drm_device to ROMPTR, rather than nvbios
Ben Skeggs [Wed, 12 Oct 2011 06:48:48 +0000 (16:48 +1000)]
drm/nouveau/bios: pass drm_device to ROMPTR, rather than nvbios

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd0/disp: use single, shared, sync bo for all evo channels
Ben Skeggs [Wed, 16 Nov 2011 05:48:48 +0000 (15:48 +1000)]
drm/nvd0/disp: use single, shared, sync bo for all evo channels

This simplifies some things, and hopefully won't come back to bite me.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd0/disp: rename sync channel to flip channel
Ben Skeggs [Wed, 16 Nov 2011 05:22:34 +0000 (15:22 +1000)]
drm/nvd0/disp: rename sync channel to flip channel

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd0/disp: handle yet another interrupt
Ben Skeggs [Sat, 12 Nov 2011 17:43:30 +0000 (03:43 +1000)]
drm/nvd0/disp: handle yet another interrupt

Spotted while messing with overlay channels (probably as a result of
sending a similar "disable" sequence as we do for the flip channels).

The value in 0x61008c was 0x20, which one would reasonably guess is
"bit 5 == something to report about evo channel 5" - but who knows.

Spotted the binary driver getting this too, and it appears to not do
anything exciting as a result.  So, handle it the same way and avoid
an IRQ storm.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd0/disp: initialise overlay channels
Ben Skeggs [Sat, 12 Nov 2011 13:52:07 +0000 (23:52 +1000)]
drm/nvd0/disp: initialise overlay channels

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd0/disp: add support for page flipping
Ben Skeggs [Sat, 12 Nov 2011 04:28:12 +0000 (14:28 +1000)]
drm/nvd0/disp: add support for page flipping

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd0/disp: make it clearer that the cursor regs are pio evo channels
Ben Skeggs [Sat, 12 Nov 2011 02:57:54 +0000 (12:57 +1000)]
drm/nvd0/disp: make it clearer that the cursor regs are pio evo channels

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd0/disp: have evo names now, use them
Ben Skeggs [Sat, 12 Nov 2011 02:53:36 +0000 (12:53 +1000)]
drm/nvd0/disp: have evo names now, use them

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd0/disp: init display sync channels
Ben Skeggs [Fri, 11 Nov 2011 15:30:24 +0000 (01:30 +1000)]
drm/nvd0/disp: init display sync channels

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd0/disp: scaler updates, overscan compensation etc
Ben Skeggs [Fri, 11 Nov 2011 13:49:06 +0000 (23:49 +1000)]
drm/nvd0/disp: scaler updates, overscan compensation etc

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd0/disp: update crtc timing calculations for interlace/doublescan
Ben Skeggs [Fri, 11 Nov 2011 13:39:22 +0000 (23:39 +1000)]
drm/nvd0/disp: update crtc timing calculations for interlace/doublescan

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: shutdown display on suspend/hibernate
Ben Skeggs [Wed, 9 Nov 2011 05:18:47 +0000 (15:18 +1000)]
drm/nouveau: shutdown display on suspend/hibernate

Known to fix some serious issues with hibernate on a couple of systems.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/disp: fix evo for create/init + destroy/fini split
Ben Skeggs [Wed, 9 Nov 2011 05:52:43 +0000 (15:52 +1000)]
drm/nv50/disp: fix evo for create/init + destroy/fini split

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: re-jig fbcon suspend/resume process a little
Ben Skeggs [Wed, 9 Nov 2011 04:31:16 +0000 (14:31 +1000)]
drm/nouveau: re-jig fbcon suspend/resume process a little

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/disp: introduce proper init/fini, separate from create/destroy
Ben Skeggs [Wed, 9 Nov 2011 01:36:33 +0000 (11:36 +1000)]
drm/nouveau/disp: introduce proper init/fini, separate from create/destroy

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/pm: fix missing volt changes when boot voltage is undefined
Ben Skeggs [Thu, 10 Nov 2011 03:20:14 +0000 (13:20 +1000)]
drm/nouveau/pm: fix missing volt changes when boot voltage is undefined

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/pm: fix a typo in clock calculation
Martin Peres [Tue, 1 Nov 2011 10:38:16 +0000 (11:38 +0100)]
drm/nv50/pm: fix a typo in clock calculation

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd0/disp: enable hdmi audio
Ben Skeggs [Fri, 11 Nov 2011 10:46:00 +0000 (20:46 +1000)]
drm/nvd0/disp: enable hdmi audio

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd0/disp: hook evo up to debugging
Ben Skeggs [Fri, 11 Nov 2011 10:26:44 +0000 (20:26 +1000)]
drm/nvd0/disp: hook evo up to debugging

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd0/disp: enable hdmi on sor if hdmi monitor present
Ben Skeggs [Fri, 11 Nov 2011 09:51:20 +0000 (19:51 +1000)]
drm/nvd0/disp: enable hdmi on sor if hdmi monitor present

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd0/disp: send eld to the audio codec
Ben Skeggs [Fri, 11 Nov 2011 08:13:13 +0000 (18:13 +1000)]
drm/nvd0/disp: send eld to the audio codec

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/hdmi: enable audio for nva3:nvd0 chipsets
Ben Skeggs [Wed, 9 Nov 2011 00:03:01 +0000 (10:03 +1000)]
drm/nouveau/hdmi: enable audio for nva3:nvd0 chipsets

Pre-nva3 will likely require far more extensive setup, and nvd9 needs to
be checked to find its SOR_HDMI/SOR_AUDIO blocks.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: fix page faulting for 128MB page table sizes
Marcin Slusarz [Sun, 6 Nov 2011 19:32:06 +0000 (20:32 +0100)]
drm/nv50: fix page faulting for 128MB page table sizes

This seems to be a typo...

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: print correct engine number which failed to unload/idle
Marcin Slusarz [Sun, 6 Nov 2011 19:32:03 +0000 (20:32 +0100)]
drm/nouveau: print correct engine number which failed to unload/idle

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nva3/copy: fix typo in fuc which caused host to not recieve exceptions
Ben Skeggs [Sat, 5 Nov 2011 02:08:05 +0000 (12:08 +1000)]
drm/nva3/copy: fix typo in fuc which caused host to not recieve exceptions

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nva3/copy: update fuc source for latest envytools
Ben Skeggs [Sat, 5 Nov 2011 01:55:39 +0000 (11:55 +1000)]
drm/nva3/copy: update fuc source for latest envytools

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/pm: only touch 0x611200 on nv92-
Ben Skeggs [Mon, 31 Oct 2011 02:14:10 +0000 (12:14 +1000)]
drm/nv50/pm: only touch 0x611200 on nv92-

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/pm: stabilise transition to 100MHz mclk a bit
Ben Skeggs [Mon, 31 Oct 2011 01:59:07 +0000 (11:59 +1000)]
drm/nv50/pm: stabilise transition to 100MHz mclk a bit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/pm: avoid touching dom6/vdec clocks if perflvl doesn't define it
Ben Skeggs [Mon, 31 Oct 2011 00:52:33 +0000 (10:52 +1000)]
drm/nv50/pm: avoid touching dom6/vdec clocks if perflvl doesn't define it

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/pm: fix thinko which lead to clocks being slightly off sometimes
Ben Skeggs [Sun, 30 Oct 2011 13:10:55 +0000 (23:10 +1000)]
drm/nv50/pm: fix thinko which lead to clocks being slightly off sometimes

read_pll_ref() needs to take into account the refclk src bits in 0xc040 on
some chipsets, it wasn't doing this.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/pm: 0x84/0x86 can't use "1" for nvclk src, need 0x50 method
Ben Skeggs [Sun, 30 Oct 2011 13:04:31 +0000 (23:04 +1000)]
drm/nv50/pm: 0x84/0x86 can't use "1" for nvclk src, need 0x50 method

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvc0/gr: add initial support for nvd9, not quite there yet..
Ben Skeggs [Mon, 11 Jul 2011 05:57:54 +0000 (15:57 +1000)]
drm/nvc0/gr: add initial support for nvd9, not quite there yet..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvc0/gr: update fuc source to assemble with latest envyas
Ben Skeggs [Fri, 28 Oct 2011 02:06:42 +0000 (12:06 +1000)]
drm/nvc0/gr: update fuc source to assemble with latest envyas

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/disp: stricter check for evo being active on init
Ben Skeggs [Sat, 29 Oct 2011 01:31:29 +0000 (11:31 +1000)]
drm/nv50/disp: stricter check for evo being active on init

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Martin Peres <martin.peres@labri.fr>
13 years agodrm/nv50/pm: free state struct after setting clocks
Ben Skeggs [Fri, 28 Oct 2011 12:10:15 +0000 (22:10 +1000)]
drm/nv50/pm: free state struct after setting clocks

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/pm: change volt/fan before upclock, but after downclock
Ben Skeggs [Thu, 27 Oct 2011 02:02:12 +0000 (12:02 +1000)]
drm/nouveau/pm: change volt/fan before upclock, but after downclock

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/pm: remove the older interfaces completely
Ben Skeggs [Thu, 27 Oct 2011 00:28:17 +0000 (10:28 +1000)]
drm/nouveau/pm: remove the older interfaces completely

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv04-nv30/pm: port to newer interfaces
Ben Skeggs [Thu, 27 Oct 2011 00:24:12 +0000 (10:24 +1000)]
drm/nv04-nv30/pm: port to newer interfaces

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/pm: rewrite clock management, and switch to the new pm hooks
Ben Skeggs [Tue, 25 Oct 2011 23:11:02 +0000 (09:11 +1000)]
drm/nv50/pm: rewrite clock management, and switch to the new pm hooks

This area is horrifically complicated on these chipsets, and it's likely we
will need at least a few more tweaks yet.

Oh yes, and it's completely disabled on IGPs for the moment.  From traces,
things look potentially different there yet again.  Sigh...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/pm: s/PLL_UNK05/PLL_VDEC/
Martin Peres [Thu, 6 Oct 2011 21:47:58 +0000 (23:47 +0200)]
drm/nv50/pm: s/PLL_UNK05/PLL_VDEC/

Following to "drm/nv50/pm: s/unk05/vdec/", let's rename the PLL to PLL_VDEC

PLL names are purely indicative and are based on the most important engine
it clocks.

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/pm: make clocks_set return an error code clocks_set can fail.
Martin Peres [Sat, 9 Jul 2011 22:08:41 +0000 (00:08 +0200)]
drm/nouveau/pm: make clocks_set return an error code clocks_set can fail.

Reporting an error is better than silently refusing to reclock.

V2: Use the same logic on nv40

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd0: read temperature as we did on nv84+ boards
Martin Peres [Fri, 21 Oct 2011 23:40:40 +0000 (01:40 +0200)]
drm/nvd0: read temperature as we did on nv84+ boards

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/disp: fix scaling of doublescan modes
Ben Skeggs [Tue, 25 Oct 2011 06:29:13 +0000 (16:29 +1000)]
drm/nv50/disp: fix scaling of doublescan modes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/disp: rewrite crtc timing calculation, with proper names and fixes
Ben Skeggs [Thu, 20 Oct 2011 05:00:22 +0000 (15:00 +1000)]
drm/nv50/disp: rewrite crtc timing calculation, with proper names and fixes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/disp: kill off nouveau_crtc.mode
Ben Skeggs [Thu, 20 Oct 2011 04:25:53 +0000 (14:25 +1000)]
drm/nouveau/disp: kill off nouveau_crtc.mode

This hasn't been necessary for a long time now..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/disp: allow interlaced and doublescan modes on digital outputs
Ben Skeggs [Wed, 19 Oct 2011 03:06:48 +0000 (13:06 +1000)]
drm/nv50/disp: allow interlaced and doublescan modes on digital outputs

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: don't pretend to support the DVI-I 'select subconnector' prop
Ben Skeggs [Fri, 14 Oct 2011 13:55:47 +0000 (23:55 +1000)]
drm/nouveau: don't pretend to support the DVI-I 'select subconnector' prop

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: improve dithering properties, and implement proper auto mode
Ben Skeggs [Mon, 17 Oct 2011 02:23:41 +0000 (12:23 +1000)]
drm/nouveau: improve dithering properties, and implement proper auto mode

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: no need to pass parameters into set_scale/dither
Ben Skeggs [Mon, 17 Oct 2011 00:38:10 +0000 (10:38 +1000)]
drm/nouveau: no need to pass parameters into set_scale/dither

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: determine a value for display_info.bpc if edid doesn't
Ben Skeggs [Mon, 17 Oct 2011 00:24:49 +0000 (10:24 +1000)]
drm/nouveau: determine a value for display_info.bpc if edid doesn't

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>