GitHub/exynos8895/android_kernel_samsung_universal8895.git
12 years agodrm: allow loading an EDID as firmware to override broken monitor
Carsten Emde [Sun, 18 Mar 2012 21:37:33 +0000 (22:37 +0100)]
drm: allow loading an EDID as firmware to override broken monitor

Broken monitors and/or broken graphic boards may send erroneous or no
EDID data. This also applies to broken KVM devices that are unable to
correctly forward the EDID data of the connected monitor but invent
their own fantasy data.

This patch allows to specify an EDID data set to be used instead of
probing the monitor for it. It contains built-in data sets of frequently
used screen resolutions. In addition, a particular EDID data set may be
provided in the /lib/firmware directory and loaded via the firmware
interface. The name is passed to the kernel as module parameter of the
drm_kms_helper module either when loaded
  options drm_kms_helper edid_firmware=edid/1280x1024.bin
or as kernel commandline parameter
  drm_kms_helper.edid_firmware=edid/1280x1024.bin

It is also possible to restrict the usage of a specified EDID data set
to a particular connector. This is done by prepending the name of the
connector to the name of the EDID data set using the syntax
  edid_firmware=[<connector>:]<edid>
such as, for example,
  edid_firmware=DVI-I-1:edid/1920x1080.bin
in which case no other connector will be affected.

The built-in data sets are
Resolution    Name
--------------------------------
1024x768      edid/1024x768.bin
1280x1024     edid/1280x1024.bin
1680x1050     edid/1680x1050.bin
1920x1080     edid/1920x1080.bin

They are ignored, if a file with the same name is available in the
/lib/firmware directory.

The built-in EDID data sets are based on standard timings that may not
apply to a particular monitor and even crash it. Ideally, EDID data of
the connected monitor should be used. They may be obtained through the
drm/cardX/cardX-<connector>/edid entry in the /sys/devices PCI directory
of a correctly working graphics adapter.

It is even possible to specify the name of an EDID data set on-the-fly
via the /sys/module interface, e.g.
echo edid/myedid.bin >/sys/module/drm_kms_helper/parameters/edid_firmware
The new screen mode is considered when the related kernel function is
called for the first time after the change. Such calls are made when the
X server is started or when the display settings dialog is opened in an
already running X server.

Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/exynos: enable hdmi audio feature
Seung-Woo Kim [Fri, 16 Mar 2012 09:47:16 +0000 (18:47 +0900)]
drm/exynos: enable hdmi audio feature

This patch adds hdmi audio feature for exynos drm.
With this patch, i2s channel feeds audio data in hdmi when hdmi is connected.

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>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/exynos: add default pixel format for plane
Eunchul Kim [Fri, 16 Mar 2012 09:47:15 +0000 (18:47 +0900)]
drm/exynos: add default pixel format for plane

DRM checks whether the plane supports a pixel format of fb when plane is
updated. This adds a default pixel format supporting format exynos drm
plane.

Signed-off-by: Eunchul Kim <chulspro.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>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/exynos: cleanup exynos_hdmi.h
Joonyoung Shim [Fri, 16 Mar 2012 09:47:14 +0000 (18:47 +0900)]
drm/exynos: cleanup exynos_hdmi.h

The some contents of the exynos_hdmi.h are used only in exynos_hdmi.c,
so move them to exynos_hdmi.c.

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>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/exynos: add is_local member in exynos_drm_subdrv struct
Joonyoung Shim [Fri, 16 Mar 2012 09:47:10 +0000 (18:47 +0900)]
drm/exynos: add is_local member in exynos_drm_subdrv struct

The is_local member indicates unused subdrv such connector and encoder
so doesn't make resources for them.

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>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/exynos: add subdrv open/close functions
Joonyoung Shim [Fri, 16 Mar 2012 09:47:09 +0000 (18:47 +0900)]
drm/exynos: add subdrv open/close functions

Some subdrv need open and close functions call when open and close drm.

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>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/exynos: remove module of exynos drm subdrv
Joonyoung Shim [Fri, 16 Mar 2012 09:47:08 +0000 (18:47 +0900)]
drm/exynos: remove module of exynos drm subdrv

The exynos drm driver has several subdrv. They each can be module but it
causes unfixed probe order of exynodr drm driver and each subdrv. It
also needs some weird codes such as exynos_drm_fbdev_reinit and
exynos_drm_mode_group_reinit. This patch can remove weird codes and
clear codes through we doesn't modularity each subdrv.

Also this removes unnecessary codes related module.

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>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/exynos: release pending pageflip events when closed
Joonyoung Shim [Fri, 16 Mar 2012 09:47:07 +0000 (18:47 +0900)]
drm/exynos: release pending pageflip events when closed

We should release pending pageflip events when closed. If not, they will
be dangling events.

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>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/exynos: added new funtion to get/put dma address.
Inki Dae [Fri, 16 Mar 2012 09:47:06 +0000 (18:47 +0900)]
drm/exynos: added new funtion to get/put dma address.

this function would be used for drm based 2d acceleration driver
to get/put dma address through gem handle.
when exynos_drm_get_dma_address is called reference count of
gem object would be increased not to be released by gem close and
when exynos_drm_put_dma_address is called the reference count of
this gem object would be decreased to be released.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/exynos: update gem and buffer framework.
Inki Dae [Fri, 16 Mar 2012 09:47:05 +0000 (18:47 +0900)]
drm/exynos: update gem and buffer framework.

with this patch, we can allocate physically continuous or non-continuous
memory and also it creates scatterlist for iommu support so allocated
memory region can be mapped to iommu page table using scatterlist.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/exynos: added mode_fixup feature and code clean.
Inki Dae [Fri, 16 Mar 2012 09:47:04 +0000 (18:47 +0900)]
drm/exynos: added mode_fixup feature and code clean.

this patch adds mode_fixup feature for hdmi module that
specific driver changes current mode to driver desired mode
properly.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/exynos: add HDMI version 1.4 support
Joonyoung Shim [Fri, 16 Mar 2012 09:47:03 +0000 (18:47 +0900)]
drm/exynos: add HDMI version 1.4 support

Later Exynos series from Exynos4X12 support HDMI version 1.4. We will
distinguish to use which version via platform data. This patch supports
only default features of HDMI version 1.4(The 3D, sound and etc don't
support yet)

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>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/exynos: remove exynos_mixer.h
Joonyoung Shim [Thu, 15 Mar 2012 08:19:04 +0000 (17:19 +0900)]
drm/exynos: remove exynos_mixer.h

The contents of exynos_mixer.h are used only in exynos_mixer.c, so
separated header is unnecessary.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agogma500: Fix mmap frambuffer
Yoichi Yuasa [Thu, 15 Mar 2012 14:50:16 +0000 (14:50 +0000)]
gma500: Fix mmap frambuffer

It cannot map correctly if page fault begins from a intermediate address.

[The driver prefaults the mapping, so we need to work from the correct
 base address not the faulting address otherwise the map appears offset by
 the fault offset]

Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoMerge tag 'drm-intel-next-2012-03-01' of git://people.freedesktop.org/~danvet/drm...
Dave Airlie [Tue, 20 Mar 2012 08:51:37 +0000 (08:51 +0000)]
Merge tag 'drm-intel-next-2012-03-01' of git://people.freedesktop.org/~danvet/drm-intel into drm-next

* tag 'drm-intel-next-2012-03-01' of git://people.freedesktop.org/~danvet/drm-intel:
  drm/i915: Only clear the GPU domains upon a successful finish
  drm/i915: reenable gmbus on gen3+ again
  drm/i915: i2c: unconditionally set up gpio fallback
  drm/i915: merge gmbus and gpio i2c adpater into one
  drm/i915: merge struct intel_gpio into struct intel_gmbus
  i2c: export bit-banging algo functions
  drm/nouveau: do a better job at hiding the NIH i2c bit-banging algo
  drm/i915: add dev_priv to intel_gmbus
  drm/i915: Fix single msg gmbus_xfers writes
  drm/i915: error_buffer->ring should be signed
  drm/i915: Silence the error message from i915_wait_request()
  drm/i915: use the new hdmi_force_audio enum more
  drm/i915: No need to search again after retiring requests
  drm/i915: Only bump refcnt on objects scheduled for eviction
  drm/i915/bios: Downgrade the "signature missing" DRM_ERROR to debug
  drm/i915: Ignore LVDS on hp t5745 and hp st5747 thin client
  drm/i915: Fixes distorted external screen image on HP 2730p

12 years agodrm/radeon: Drop radeon_gem_object_(un)pin.
Michel Dänzer [Wed, 14 Mar 2012 13:59:25 +0000 (14:59 +0100)]
drm/radeon: Drop radeon_gem_object_(un)pin.

Only radeon_gem_object_unpin was used anymore, in only one place.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon: Restrict offset for legacy display engine.
Michel Dänzer [Wed, 14 Mar 2012 16:12:42 +0000 (17:12 +0100)]
drm/radeon: Restrict offset for legacy display engine.

The hardware only takes 27 bits for the offset, so larger offsets are
truncated, and the display shows random bits other than the intended ones.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon: Restrict offset for legacy hardware cursor.
Michel Dänzer [Wed, 14 Mar 2012 16:12:41 +0000 (17:12 +0100)]
drm/radeon: Restrict offset for legacy hardware cursor.

The hardware only takes 27 bits for the offset, so larger offsets are
truncated, and the hardware cursor shows random bits other than the intended
ones.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=46796

Cc: stable@vger.kernel.org
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon/kms: reduce probe latency on digital connectors
Tvrtko Ursulin [Fri, 16 Mar 2012 16:22:11 +0000 (12:22 -0400)]
drm/radeon/kms: reduce probe latency on digital connectors

On a system with one HDMI and one VGA connector the latter
causes output polling to run every ten seconds. This causes
full EDID re-fetch on every poll and approx. 100ms rendering
stalls are experienced by full screen page-flipping applications.
Optimisation is to trust HPD sense on R600+ ASICs and to skip
doing these expensive probes unless HPD sense has changed.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=47007

agd5f: fix patch and message formatting.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@onelan.co.uk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon/kms: add connector quirk for Fujitsu D3003-S2 board
Alex Deucher [Fri, 16 Mar 2012 16:22:10 +0000 (12:22 -0400)]
drm/radeon/kms: add connector quirk for Fujitsu D3003-S2 board

vbios lists DVI-I port as VGA and DVI-D.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=47007

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon/kms: fix analog load detection on DVI-I connectors
Alex Deucher [Fri, 16 Mar 2012 16:22:09 +0000 (12:22 -0400)]
drm/radeon/kms: fix analog load detection on DVI-I connectors

We digital encoders have a detect function as well (for
DP to VGA bridges), so we make sure we choose the analog
one here.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=47007

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: Use pr_fmt and pr_<level>
Joe Perches [Sat, 17 Mar 2012 04:43:50 +0000 (21:43 -0700)]
drm/ttm: Use pr_fmt and pr_<level>

Use the more current logging style.

Add pr_fmt and remove the TTM_PFX uses.
Coalesce formats and align arguments.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrivers/gpu/drm/savage/savage_state.c: add missing kfree
Julia Lawall [Sat, 17 Mar 2012 17:57:02 +0000 (18:57 +0100)]
drivers/gpu/drm/savage/savage_state.c: add missing kfree

Most of the error handling code in this function frees the buffers
kcmd_addr, kvb_addr, and kbox_addr allocated at the beginning of this
function.  These two branches are changed to do the same.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrivers/gpu/drm/radeon/radeon_cs.c: eliminate possible double free
Julia Lawall [Sat, 17 Mar 2012 17:03:29 +0000 (18:03 +0100)]
drivers/gpu/drm/radeon/radeon_cs.c: eliminate possible double free

The function radeon_cs_parser_init is only called from two places, in
drivers/gpu/drm/radeon/radeon_cs.c and drivers/gpu/drm/radeon/r600_cs.c.
In each case, if the call fails another function is called that frees all
of the kdata and dpage information in the chunks array.  So this
information should not be freed in radeon_cs_parser_init as well.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon: dp only enable enhanced framing if sink supports.
Dave Airlie [Sun, 18 Mar 2012 10:10:50 +0000 (10:10 +0000)]
drm/radeon: dp only enable enhanced framing if sink supports.

DisplayPort spec v1.1a, Table 2-52.

Same commit to Intel by ajax in 9962c9252e46eda7058067cbe73bdf1ed74b0d37

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon/kms: skip db/cb/streamout checking when possible on r600
Marek Olšák [Mon, 19 Mar 2012 02:09:38 +0000 (03:09 +0100)]
drm/radeon/kms: skip db/cb/streamout checking when possible on r600

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon/kms: compute GPU addresses correctly on r600
Marek Olšák [Mon, 19 Mar 2012 02:09:37 +0000 (03:09 +0100)]
drm/radeon/kms: compute GPU addresses correctly on r600

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon/kms: remove some unused variables in evergreen_cs_track
Marek Olšák [Mon, 19 Mar 2012 02:09:36 +0000 (03:09 +0100)]
drm/radeon/kms: remove some unused variables in evergreen_cs_track

and document the other unused ones.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon/kms: skip db/cb/streamout checking when possible on evergreen
Marek Olšák [Mon, 19 Mar 2012 02:09:35 +0000 (03:09 +0100)]
drm/radeon/kms: skip db/cb/streamout checking when possible on evergreen

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon/kms: optimize streamout checking for evergreen
Marek Olšák [Mon, 19 Mar 2012 02:09:34 +0000 (03:09 +0100)]
drm/radeon/kms: optimize streamout checking for evergreen

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon/kms: compute GPU addresses correctly on evergreen
Marek Olšák [Mon, 19 Mar 2012 02:09:33 +0000 (03:09 +0100)]
drm/radeon/kms: compute GPU addresses correctly on evergreen

There are also two fixes:
- In DRAW_INDEX_2, we read idx_value, but should have read idx+1.
- When correcting SQ_VTX_CONSTANT_WORD1_0.SIZE, we should subtract
  the offset.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon/kms: make some DRM errors more informative
Marek Olšák [Mon, 19 Mar 2012 02:09:32 +0000 (03:09 +0100)]
drm/radeon/kms: make some DRM errors more informative

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon/kms: skip cb/db checking if SX_MISC is 1 on r600+
Marek Olšák [Wed, 7 Mar 2012 23:56:00 +0000 (00:56 +0100)]
drm/radeon/kms: skip cb/db checking if SX_MISC is 1 on r600+

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/usb: move usb support into a separate module
Dave Airlie [Tue, 20 Mar 2012 06:59:29 +0000 (06:59 +0000)]
drm/usb: move usb support into a separate module

In order to satisfy all the various Kconfig options between
USB and DRM, we need to split the USB code out into a separate module
and export symbols to it.

This fixes build problems in -next reported by sfr.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: fix build with UDL if USB is a module
Dave Airlie [Fri, 16 Mar 2012 09:28:03 +0000 (09:28 +0000)]
drm: fix build with UDL if USB is a module

reported by sfr on -next merge.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/udl: initial UDL driver (v4)
Dave Airlie [Tue, 14 Dec 2010 21:14:24 +0000 (07:14 +1000)]
drm/udl: initial UDL driver (v4)

This is an initial drm/kms driver for the displaylink devices.

Supports fb_defio,
supports KMS dumb interface
supports 24bpp via conversion to 16bpp, hw can do this better.
supports hot unplug using new drm core features.

On an unplug, it disables connector polling, unplugs connectors
from sysfs, unplugs fbdev layer (using Kay's API), drops all the
USB device URBs, and call the drm core to unplug the device.

This driver is based in large parts on udlfb.c so I've licensed
it under GPLv2.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: add core support for unplugging a device (v2)
Dave Airlie [Mon, 20 Feb 2012 14:18:07 +0000 (14:18 +0000)]
drm: add core support for unplugging a device (v2)

Two parts to this, one is simple unplug from sysfs for the device node.

The second adds an unplugged state, if we have device opens, we
just set the unplugged state and return, if we have no device
opens we drop the drm device.

If after a lastclose we discover we are unplugged we then
drop the drm device.

v2: use an atomic for unplugged and wrap it for users,
add checks on open + mmap + ioctl entry points.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/modeset: add helper to unplug all connectors from sysfs
Dave Airlie [Mon, 20 Feb 2012 14:16:40 +0000 (14:16 +0000)]
drm/modeset: add helper to unplug all connectors from sysfs

In order to get correct ordering at hot-unplug for userspace,
we need to tear down all the sysfs bits at the correct time.

This adds a helper to allow drivers to remove the sysfs nodes
for all connectors.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/sysfs: protect sysfs removal code against being run twice.
Dave Airlie [Mon, 20 Feb 2012 14:15:02 +0000 (14:15 +0000)]
drm/sysfs: protect sysfs removal code against being run twice.

a step towards correct hot unplug for USB devices, we need to
remove the userspace facing bits at the unplug time for correct
udev operation.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoudlfb: remove sysfs framebuffer device with USB .disconnect()
Kay Sievers [Sat, 28 Jan 2012 19:57:46 +0000 (19:57 +0000)]
udlfb: remove sysfs framebuffer device with USB .disconnect()

The USB graphics card driver delays the unregistering of the framebuffer
device to a workqueue, which breaks the userspace visible remove uevent
sequence. Recent userspace tools started to support USB graphics card
hotplug out-of-the-box and rely on proper events sent by the kernel.

The framebuffer device is a direct child of the USB interface which is
removed immediately after the USB .disconnect() callback. But the fb device
in /sys stays around until its final cleanup, at a time where all the parent
devices have been removed already.

To work around that, we remove the sysfs fb device directly in the USB
.disconnect() callback and leave only the cleanup of the internal fb
data to the delayed work.

Before:
 add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2 (usb)
 add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0 (usb)
 add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/graphics/fb0 (graphics)
 remove   /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0 (usb)
 remove   /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2 (usb)
 remove   /2-1.2:1.0/graphics/fb0 (graphics)

After:
 add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2 (usb)
 add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0 (usb)
 add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/graphics/fb1 (graphics)
 remove   /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/graphics/fb1 (graphics)
 remove   /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0 (usb)
 remove   /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2 (usb)

Cc: stable@vger.kernel.org
Tested-by: Bernie Thompson <bernie@plugable.com>
Acked-by: Bernie Thompson <bernie@plugable.com>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
12 years agodrm: Merge tag 'v3.3-rc7' into drm-core-next
Dave Airlie [Thu, 15 Mar 2012 10:24:32 +0000 (10:24 +0000)]
drm: Merge tag 'v3.3-rc7' into drm-core-next

Merge the fixes so far into core-next, needed to test
intel driver.

Conflicts:
drivers/gpu/drm/i915/intel_ringbuffer.c

12 years agodrm: Add drm_mode_copy()
Ville Syrjälä [Tue, 13 Mar 2012 10:35:51 +0000 (12:35 +0200)]
drm: Add drm_mode_copy()

Add a helper function to copy a display mode. Use it in
drm_mode_duplicate() and nouveau mode_fixup hooks.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Use a flexible array member for blob property data
Ville Syrjälä [Tue, 13 Mar 2012 10:35:49 +0000 (12:35 +0200)]
drm: Use a flexible array member for blob property data

The blob property data is always allocated immediately after the object
header. No need for the extra indirection when accessing it, just use
a flexible array member.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Handle drm_object_get() failures
Ville Syrjälä [Tue, 13 Mar 2012 10:35:48 +0000 (12:35 +0200)]
drm: Handle drm_object_get() failures

Check drm_mode_object_get() return value everywhere.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Make drm_crtc_convert_{umode, to_umode} static and constify their params
Ville Syrjälä [Tue, 13 Mar 2012 10:35:47 +0000 (12:35 +0200)]
drm: Make drm_crtc_convert_{umode, to_umode} static and constify their params

drm_crtc_convert_umode() and drm_crtc_convert_to_umode() are never
used outside drm_crtc.c, so make them static. Also make the input
mode structure const for both functions.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Fix drm_mode_attachmode_crtc()
Ville Syrjälä [Tue, 13 Mar 2012 10:35:46 +0000 (12:35 +0200)]
drm: Fix drm_mode_attachmode_crtc()

Change drm_mode_attachmode_crtc() to take an "all or nothing" approach.
If an error is returned, there are no side effects visible.

Also change the function to always duplicate the mode passed in.

Also change the function to not give up when it finds the first
connector without and encoder.

A simpler approach would be to just remove the function completely as
it's unused currently.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Check CRTC viewport against framebuffer size
Ville Syrjälä [Tue, 13 Mar 2012 10:35:45 +0000 (12:35 +0200)]
drm: Check CRTC viewport against framebuffer size

Make sure the requested CRTC viewport fits inside the
framebuffer.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Check user mode against overflows
Ville Syrjälä [Tue, 13 Mar 2012 10:35:44 +0000 (12:35 +0200)]
drm: Check user mode against overflows

The internal mode representation drm_display_mode uses signed data
types. When converting the user mode to internal representation,
check that the unsigned values don't overflow the signed datatypes.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Fix memory leak in drm_mode_setcrtc()
Ville Syrjälä [Tue, 13 Mar 2012 10:35:43 +0000 (12:35 +0200)]
drm: Fix memory leak in drm_mode_setcrtc()

The mode passed to the .set_config() hook was never freed. The drivers
will make a copy of the mode, so simply free it when done.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Make drm_mode_attachmode() void
Ville Syrjälä [Tue, 13 Mar 2012 10:35:42 +0000 (12:35 +0200)]
drm: Make drm_mode_attachmode() void

drm_mode_attachmode() always returns 0. Change the return type to void.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Check crtc x and y coordinates
Ville Syrjälä [Tue, 13 Mar 2012 10:35:41 +0000 (12:35 +0200)]
drm: Check crtc x and y coordinates

The crtc x/y panning coordinates are stored as signed integers
internally. The user provides them as unsigned, so we should check
that the user provided values actually fit in the internal datatypes.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Warn if mode to umode conversion overflows the destination types
Ville Syrjälä [Tue, 13 Mar 2012 10:35:40 +0000 (12:35 +0200)]
drm: Warn if mode to umode conversion overflows the destination types

When converting from a drm_display_mode to drm_mode_modeinfo, print a
warning if the the timings values don't fit into the __u16 datatype.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Change drm_display_mode::type to unsigned
Ville Syrjälä [Tue, 13 Mar 2012 10:35:39 +0000 (12:35 +0200)]
drm: Change drm_display_mode::type to unsigned

The drm_display_mode type is a bitmask so it should be unsigned.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Reject mode set with current fb if no current fb is bound
Ville Syrjälä [Tue, 13 Mar 2012 10:35:38 +0000 (12:35 +0200)]
drm: Reject mode set with current fb if no current fb is bound

When doing a mode set with the special fb id -1, reject the mode set if
no fb is currently bound to the crtc.

Also remove the pointless list traversal to find the current crtc based
on the current crtc :)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agogma500: suspend/resume support for Cedartrail
Alan Cox [Wed, 14 Mar 2012 12:00:29 +0000 (12:00 +0000)]
gma500: suspend/resume support for Cedartrail

Update our tree to match the current driver head.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agogma500: Fix resume paths
Alan Cox [Wed, 14 Mar 2012 12:00:09 +0000 (12:00 +0000)]
gma500: Fix resume paths

We fall apart somewhat on resume because we don't invoke all the resume
methods as we should. Fix the silly error in the logic.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/nouveau: add userspace fallback hints.
Dave Airlie [Mon, 20 Feb 2012 14:39:11 +0000 (14:39 +0000)]
drm/nouveau: add userspace fallback hints.

This lets the modesetting driver work better.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoMerge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux...
Dave Airlie [Tue, 13 Mar 2012 10:16:06 +0000 (10:16 +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: (57 commits)
  drm/nouveau: map first page of mmio early and determine chipset earlier
  drm/nvd0/disp: disconnect encoders before reprogramming them
  drm/nvd0/disp: move syncs/magic setup to or mode_set
  drm/nouveau/dp: account for channel coding overhead in link training
  drm/nvd0/disp: fix dcb sor link matching in supervisor handler
  drm/nvd0/disp: initial implementation of displayport
  drm/nouveau/dp: make dp dpms function common, call from sor code instead
  drm/nv50/hwsq: some nv92 fixes
  drm/nouveau/dp: move all nv50/sor-specific code out of nouveau_dp.c
  drm/nouveau/dp: make functions for executing various bios tables
  drm/nouveau/pm: fix oops if chipset has no pm support at all
  drm/nouveau/bios: rework vbios shadowing
  drm/nouveau/bios: attempt acpi rom fetch before pcirom
  drm/nvd0/disp: attempt to handle more than 2 crtcs if possible
  drm/nvc0/vram: get part count from PUNITS
  drm/nv40/pm: fix fanspeed regression
  drm/nouveau/pm: several fixes for nvc0 memory timings
  drm/nvc0/pm: restrict pll mode to clocks that can actually use it
  drm/nouveau/dp: fix bad comparison in dp_link_train_commit()
  drm/nouveau/mxm: call mxmi to determine revision before calling mxms
  ...

12 years agodrm/nouveau: map first page of mmio early and determine chipset earlier
Ben Skeggs [Mon, 12 Mar 2012 05:55:43 +0000 (15:55 +1000)]
drm/nouveau: map first page of mmio early and determine chipset earlier

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nvd0/disp: disconnect encoders before reprogramming them
Ben Skeggs [Mon, 12 Mar 2012 05:23:44 +0000 (15:23 +1000)]
drm/nvd0/disp: disconnect encoders before reprogramming them

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nvd0/disp: move syncs/magic setup to or mode_set
Ben Skeggs [Mon, 12 Mar 2012 01:42:20 +0000 (11:42 +1000)]
drm/nvd0/disp: move syncs/magic setup to or mode_set

NVIDIA appear to do these around the same place they do the MODE_CTRL
methods, and for DP at least we need to bash some extra bits in "syncs"
to keep EVO happy.

It's a bit of a guess as to the 6/8bpc, but i have no better idea yet.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/dp: account for channel coding overhead in link training
Ben Skeggs [Mon, 12 Mar 2012 01:16:55 +0000 (11:16 +1000)]
drm/nouveau/dp: account for channel coding overhead in link training

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nvd0/disp: fix dcb sor link matching in supervisor handler
Ben Skeggs [Sun, 11 Mar 2012 06:13:49 +0000 (16:13 +1000)]
drm/nvd0/disp: fix dcb sor link matching in supervisor handler

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nvd0/disp: initial implementation of displayport
Ben Skeggs [Sat, 10 Mar 2012 15:28:48 +0000 (01:28 +1000)]
drm/nvd0/disp: initial implementation of displayport

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/dp: make dp dpms function common, call from sor code instead
Ben Skeggs [Sat, 10 Mar 2012 15:20:54 +0000 (01:20 +1000)]
drm/nouveau/dp: make dp dpms function common, call from sor code instead

GF119 will use this too.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv50/hwsq: some nv92 fixes
Martin Peres [Thu, 8 Mar 2012 23:15:01 +0000 (00:15 +0100)]
drm/nv50/hwsq: some nv92 fixes

The shift from hwsq_data = 0x1400 to 0x080000 actually happened in nv94, not nv92
This fixes some reclocking issues on my newly acquired nv92

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/dp: move all nv50/sor-specific code out of nouveau_dp.c
Ben Skeggs [Fri, 9 Mar 2012 06:22:56 +0000 (16:22 +1000)]
drm/nouveau/dp: move all nv50/sor-specific code out of nouveau_dp.c

Off-chip encoders (which we don't support yet anyway), and newer chipsets
(such as NVD9...), will need their own code for this.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/dp: make functions for executing various bios tables
Ben Skeggs [Fri, 9 Mar 2012 05:22:19 +0000 (15:22 +1000)]
drm/nouveau/dp: make functions for executing various bios tables

More code to do the same thing, but will make it easier to handle various
changes that could possibly happen the the VBIOS tables.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/pm: fix oops if chipset has no pm support at all
Ben Skeggs [Wed, 7 Mar 2012 04:18:49 +0000 (14:18 +1000)]
drm/nouveau/pm: fix oops if chipset has no pm support at all

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/bios: rework vbios shadowing
Ben Skeggs [Wed, 7 Mar 2012 03:22:50 +0000 (13:22 +1000)]
drm/nouveau/bios: rework vbios shadowing

Refactored to allow shadowing of VBIOS images longer than 64KiB, which
allows us to pass the VBIOS checksum test on certain boards.

There's also a workaround for reading the PROM VBIOS on some chipsets.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/bios: attempt acpi rom fetch before pcirom
Ben Skeggs [Sun, 4 Mar 2012 07:05:54 +0000 (17:05 +1000)]
drm/nouveau/bios: attempt acpi rom fetch before pcirom

There's cards out there with completely messed up PCIROM images that have
a perfectly valid signature.. Sigh!

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nvd0/disp: attempt to handle more than 2 crtcs if possible
Ben Skeggs [Sun, 4 Mar 2012 06:25:59 +0000 (16:25 +1000)]
drm/nvd0/disp: attempt to handle more than 2 crtcs if possible

Theoretically handles CRTC2/CRTC3, should any GF119 out there actually
have them enabled.  The room is there for the regs etc, so why not :)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nvc0/vram: get part count from PUNITS
Ben Skeggs [Sun, 4 Mar 2012 05:44:59 +0000 (15:44 +1000)]
drm/nvc0/vram: get part count from PUNITS

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv40/pm: fix fanspeed regression
Ben Skeggs [Thu, 9 Feb 2012 05:25:25 +0000 (15:25 +1000)]
drm/nv40/pm: fix fanspeed regression

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/pm: several fixes for nvc0 memory timings
Roy Spliet [Mon, 6 Feb 2012 23:29:06 +0000 (00:29 +0100)]
drm/nouveau/pm: several fixes for nvc0 memory timings

This patch fixes two small issues in timing generation as spotted on
several NVCx cards.

In addition, the header of the file is updated to also contain (some of)
the current developers of this code.

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nvc0/pm: restrict pll mode to clocks that can actually use it
Ben Skeggs [Mon, 6 Feb 2012 23:59:54 +0000 (09:59 +1000)]
drm/nvc0/pm: restrict pll mode to clocks that can actually use it

Fixes reclocking failure on some chips where we attempted to set PDAEMON
to PLL mode.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/dp: fix bad comparison in dp_link_train_commit()
Xi Wang [Fri, 3 Feb 2012 16:13:55 +0000 (11:13 -0500)]
drm/nouveau/dp: fix bad comparison in dp_link_train_commit()

The comparison (lpre == DP_TRAIN_PRE_EMPHASIS_9_5) is always false:
lpre is initialized as (lane & 0x0c) >> 2, which is at most 3, while
DP_TRAIN_PRE_EMPHASIS_9_5 is defined as (3 << 3).

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/mxm: call mxmi to determine revision before calling mxms
Ben Skeggs [Wed, 1 Feb 2012 23:33:05 +0000 (09:33 +1000)]
drm/nouveau/mxm: call mxmi to determine revision before calling mxms

There's a HP laptop out there where the MXM version in the VBIOS doesn't
match what the ACPI implementation is expecting.  These tables will accept
0x00 to MXMS to return latest version, but *only* if MXMI has been called
first..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/pm: init only after display subsystem has been created
Ben Skeggs [Wed, 1 Feb 2012 05:17:07 +0000 (15:17 +1000)]
drm/nouveau/pm: init only after display subsystem has been created

This patch fixes an oops cause by pm_trigger accessing the (uninitialised)
crtc list.

Reported-by: Roy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nvc0/fb: detect presense of second rank
Ben Skeggs [Tue, 31 Jan 2012 23:05:42 +0000 (09:05 +1000)]
drm/nvc0/fb: detect presense of second rank

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv50/display: expose color vibrance control
Christoph Bumiller [Sat, 21 Jan 2012 22:13:26 +0000 (23:13 +0100)]
drm/nv50/display: expose color vibrance control

Signed-off-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv50-nvc0/vm: support unsnooped system memory
Ben Skeggs [Thu, 12 Jan 2012 05:34:54 +0000 (15:34 +1000)]
drm/nv50-nvc0/vm: support unsnooped system memory

v2 (Emil Velikov <emil.l.velikov@gmail.com>):
- Fixed a regression on certain nv50 IGP due to not passing the correct
  target type to nv50_vm_addr()

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Johannes Obermayr <johannesobermayr@gmx.de>
12 years agodrm/nouveau: recognise DCB connector type for DP+DVI+VGA DMS-59
Ben Skeggs [Thu, 12 Jan 2012 06:17:16 +0000 (16:17 +1000)]
drm/nouveau: recognise DCB connector type for DP+DVI+VGA DMS-59

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/mem: handle dll_off for ddr2/ddr3
Ben Skeggs [Tue, 24 Jan 2012 08:30:10 +0000 (18:30 +1000)]
drm/nouveau/mem: handle dll_off for ddr2/ddr3

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
12 years agodrm/nouveau/pm: extend profile interface for destroy/init/fini
Ben Skeggs [Tue, 24 Jan 2012 08:03:25 +0000 (18:03 +1000)]
drm/nouveau/pm: extend profile interface for destroy/init/fini

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
12 years agodrm/nouveau/pm: rework to allow selecting separate profiles for ac/battery
Ben Skeggs [Tue, 24 Jan 2012 05:59:07 +0000 (15:59 +1000)]
drm/nouveau/pm: rework to allow selecting separate profiles for ac/battery

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
12 years agodrm/nouveau/pm: fix dll off -> dll on transitions
Ben Skeggs [Tue, 24 Jan 2012 03:39:56 +0000 (13:39 +1000)]
drm/nouveau/pm: fix dll off -> dll on transitions

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
12 years agodrm/nouveau/pm: detect when we need dll disabled for gddr3
Ben Skeggs [Tue, 24 Jan 2012 01:26:40 +0000 (11:26 +1000)]
drm/nouveau/pm: detect when we need dll disabled for gddr3

Fixes minor flickering on NVS295 when at perflvl 0.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
12 years agodrm/nv50: fix detection of second vram rank
Ben Skeggs [Tue, 24 Jan 2012 01:03:14 +0000 (11:03 +1000)]
drm/nv50: fix detection of second vram rank

Goes a long way to correcting NVS295 memory reclocking issues.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
12 years agodrm/nouveau/pm: track mr2 for gddr3
Ben Skeggs [Tue, 24 Jan 2012 00:24:05 +0000 (10:24 +1000)]
drm/nouveau/pm: track mr2 for gddr3

There's some "extended" GDDR3 chipsets out there with EMRS2 settings that
change the layout of MRS/EMRS1 bitmaps.. Sigh.. Still need to track down
how exactly we're supposed to handle this.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
12 years agodrm/nv50/pm: wait for all fifo-connected engines to idle before reclocking
Martin Peres [Mon, 9 Jan 2012 05:23:10 +0000 (15:23 +1000)]
drm/nv50/pm: wait for all fifo-connected engines to idle before reclocking

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv50/pm: use hwsq for engine reclocking too
Ben Skeggs [Mon, 23 Jan 2012 23:47:04 +0000 (09:47 +1000)]
drm/nv50/pm: use hwsq for engine reclocking too

Idea from Martin Peres, different implementation by me.

v2: Martin Peres:
- fix mast calculation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
12 years agodrm/nv50/disp: more accurate function to determine active crtcs
Ben Skeggs [Mon, 23 Jan 2012 03:22:58 +0000 (13:22 +1000)]
drm/nv50/disp: more accurate function to determine active crtcs

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
12 years agodrm/nv50/pm: initial work towards proper memory reclocking, with timings
Ben Skeggs [Mon, 23 Jan 2012 03:17:11 +0000 (13:17 +1000)]
drm/nv50/pm: initial work towards proper memory reclocking, with timings

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
12 years agodrm/nouveau/pm: introduce ram reclocking helper
Ben Skeggs [Mon, 23 Jan 2012 03:12:09 +0000 (13:12 +1000)]
drm/nouveau/pm: introduce ram reclocking helper

This will probably result in more lines of code, however, we're going to
have at least 3 slightly different implementations of this very soon and
I'd rather keep the ram reclocking logic separate from the hw specifics.

DDR2/DDR3/GDDR3 implemented thus far, others will be added as necessary.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
12 years agodrm/nouveau/pm: embed timings into perflvl structs
Ben Skeggs [Tue, 17 Jan 2012 23:02:28 +0000 (09:02 +1000)]
drm/nouveau/pm: embed timings into perflvl structs

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
12 years agodrm/nouveau/pm: calculate memory timings at perflvl creation time
Ben Skeggs [Tue, 17 Jan 2012 11:10:58 +0000 (21:10 +1000)]
drm/nouveau/pm: calculate memory timings at perflvl creation time

Statically generating the PFB register and MR values for each timing set
turns out to be insufficient.  There's at least one (so far) known piece
of information which effects MR values which is stored in the perflvl
entry on some chipsets (and in another table on later ones), which is
disconnected from the timing table entries.

After this change we will generate a timing set based on an input clock
frequency instead, and have this data stored in the performance level
data.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
12 years agodrm/nouveau/pm: readback boot perflvl *before* parsing vbios
Ben Skeggs [Mon, 23 Jan 2012 03:47:02 +0000 (13:47 +1000)]
drm/nouveau/pm: readback boot perflvl *before* parsing vbios

We might want/need the boot data to generate the other perflevels.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
12 years agodrm/nouveau/pm: implement DDR2/DDR3/GDDR3/GDDR5 MR generation and validation
Roy Spliet [Mon, 9 Jan 2012 05:23:07 +0000 (15:23 +1000)]
drm/nouveau/pm: implement DDR2/DDR3/GDDR3/GDDR5 MR generation and validation

Roy Spliet:
- Implement according to specs
- Simplify
- Make array for mc latency registers

Martin Peres:
- squash and split all the commits from Roy
- rework following Ben Skeggs comments
- add a form of timings validation
- store the initial timings for later use

Ben Skeggs
- merge slightly modified tidy-up patch with this one
- remove perflvl-dropping logic for the moment

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/pm: restructure bios table parsing
Ben Skeggs [Mon, 16 Jan 2012 12:34:03 +0000 (22:34 +1000)]
drm/nouveau/pm: restructure bios table parsing

It turns out we need access to some additional information in various VBIOS
tables to handle PFB memory timings correctly.

Rather than hack in parsing of the new stuff in some kludgy way, I've
restructured the VBIOS parsing to be more primitive, so we can use them in
more flexible ways in the future.

The perflvl->timing association code is disabled for the moment until it can
be reworked.  We don't use this stuff yet anyway, so no harm done.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>