GitHub/moto-9609/android_kernel_motorola_exynos9610.git
11 years agodrm/exynos: fix interlace resolutions for exynos5420
Rahul Sharma [Tue, 18 Jun 2013 12:49:37 +0000 (18:19 +0530)]
drm/exynos: fix interlace resolutions for exynos5420

Modified code for calculating hdmi IP register values from drm timing
values. The modification is based on the inputs from hw team and specifically
proposed for 1440x576i and 1440x480i. But same changes holds good for other
interlaced resolutions also.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agodrm/exynos: use of_get_named_gpio to get hdmi hpd gpio
Rahul Sharma [Tue, 11 Jun 2013 14:11:29 +0000 (19:41 +0530)]
drm/exynos: use of_get_named_gpio to get hdmi hpd gpio

Cleanup by removing flags variable from drm_hdmi_dt_parse_pdata
which is not used anywhere. Swtiching to of_get_named_gpio instead
of of_get_named_gpio_flags solved this.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Acked-by: Seung-Woo Kim <sw0312@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agodrm/exynos: make sure to handle an error case to vm_mmap call
Inki Dae [Fri, 14 Jun 2013 08:54:27 +0000 (17:54 +0900)]
drm/exynos: make sure to handle an error case to vm_mmap call

vm_mmap function returns unsigned long so addr type should be unsigned long.
a pointer or address variable is required to use unsigned long or uint64_t
type for 64bits address support.

So this patch makes sure that addr has unsigned long type and also
exynos_drm_gem_mmap_ioctl returns correct error type.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
11 years agodrm/exynos: exynos_drm_ipp: Remove redundant break statement
Sachin Kamat [Tue, 11 Jun 2013 06:56:51 +0000 (12:26 +0530)]
drm/exynos: exynos_drm_ipp: Remove redundant break statement

'break' after goto statement is redundant. Silences the following
message:
drivers/gpu/drm/exynos/exynos_drm_ipp.c:1067 exynos_drm_ipp_check_valid()
info: ignoring unreachable code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agodrm/exynos: add mout_hdmi clock in hdmi driver to change parent
Rahul Sharma [Tue, 11 Jun 2013 06:54:03 +0000 (12:24 +0530)]
drm/exynos: add mout_hdmi clock in hdmi driver to change parent

HDMI driver needs to configure the mout_hdmi mux clock to change
the parent between sclk_hdmiphy and sclk_pixel.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agodrm/exynos: Prepare/Unprepare HDMI subsystem clocks
Sean Paul [Tue, 11 Jun 2013 06:54:02 +0000 (12:24 +0530)]
drm/exynos: Prepare/Unprepare HDMI subsystem clocks

Change the clk_enable/clk_disable calls in mixer and hdmi drivers into
clk_prepare_enable/clk_disable_unprepare, respectively.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agodrm/exynos: Clean up logs for DRM_ERROR / DRM_DEBUG_KMS
YoungJun Cho [Wed, 12 Jun 2013 01:44:40 +0000 (10:44 +0900)]
drm/exynos: Clean up logs for DRM_ERROR / DRM_DEBUG_KMS

This patch cleans up logs for DRM_ERROR / DRM_DEBUG_KMS to avoid
logging duplicated function name because the macros already contain
 __func__.

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agodrm/exynos: Remove tracking log functions
YoungJun Cho [Wed, 12 Jun 2013 01:40:52 +0000 (10:40 +0900)]
drm/exynos: Remove tracking log functions

This patch removes tracking log functions which were used to debug
in the early development stage and are not so important as were.
So remove them for code clean up.

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agodrm/exynos: hdmi: use drm_display_mode to check the supported modes
Rahul Sharma [Mon, 10 Jun 2013 09:20:00 +0000 (14:50 +0530)]
drm/exynos: hdmi: use drm_display_mode to check the supported modes

This patch renames check_timing to check_mode and removes the
unnecessary conversion of drm_display_mode to/from fb_videomode in
the hdmi driver.

v4:
1) Changed the commit message to add information related to renaming
the callbacks to check_mode.
2) Changed debug message to print 1/0 for interlace mode.

v3:
1) Replaced check_timing callbacks with check_mode.
2) Change the type of second parameter of check_mode callback from void
pointer paramenter to struct drm_display_mode pointer.

v2:
1) Removed convert_to_video_timing().
2) Corrected DRM_DEBUG_KMS to print the resolution properly.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agodrm/exynos: fimd: Add support for S3C64xx SoCs
Tomasz Figa [Wed, 1 May 2013 19:02:29 +0000 (21:02 +0200)]
drm/exynos: fimd: Add support for S3C64xx SoCs

The FIMD block present on S3C6400/S3C6410 SoCs is compatible with this
driver, so it can be supported by it as well.

This patch adds appropriate device IDs and driver data to enable this
driver for S3C64xx SoCs.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Acked-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agodrm/exynos: fimd: Add support for FIMD variants with clock selection
Tomasz Figa [Wed, 1 May 2013 19:02:28 +0000 (21:02 +0200)]
drm/exynos: fimd: Add support for FIMD variants with clock selection

Some platforms that can be supported this driver has additional clock
source selection bits in VIDCON0 register that allows to select which
clock should be used to drive the pixel clock: bus clock or special
clock.

Since this driver assumes that special clock always drives the pixel
clock, this patch sets the selection bitfield to use the special clock.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Acked-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agodrm/exynos: fimd: Add support for FIMD versions without SHADOWCON register
Tomasz Figa [Wed, 1 May 2013 19:02:27 +0000 (21:02 +0200)]
drm/exynos: fimd: Add support for FIMD versions without SHADOWCON register

Some platforms that can be supported with this driver have PRTCON
register instead of SHADOWCON, which requires slightly different
handling.

This patch factors out all register shadow control code from the driver
and adds a function to control register shadowing appropriately,
depending on driver data.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Acked-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agodrm/exynos: fimd: Hold pointer to driver data in context struct
Tomasz Figa [Wed, 1 May 2013 19:02:26 +0000 (21:02 +0200)]
drm/exynos: fimd: Hold pointer to driver data in context struct

This patch adds pointer to driver data to fimd_context structure, to
remove the need to call drm_fimd_get_driver_data() each time access to
driver data is necessary.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Acked-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agodrm/exynos: do not use mode_set_base function directly
Inki Dae [Sun, 12 May 2013 07:09:33 +0000 (16:09 +0900)]
drm/exynos: do not use mode_set_base function directly

This patch adds exynos_drm_crtc_mode_set_commit function
to update mode data and it makes page flip call this function
instead of calling exynos_drm_crtc_mode_set_base function directly.

exynos_drm_crtc_mode_set_base function is called by drm subsystem
as a callback so we don't have to call this function directly.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
11 years agodrm/exynos: Remove redundant use of of_match_ptr macro
Sachin Kamat [Wed, 5 Jun 2013 07:00:23 +0000 (16:00 +0900)]
drm/exynos: Remove redundant use of of_match_ptr macro

'mixer_match_types' is always compiled in. Hence of_match_ptr is not
necessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agodrm/exynos: remove ignoring return value warning in hdmi
Seung-Woo Kim [Wed, 5 Jun 2013 05:34:38 +0000 (14:34 +0900)]
drm/exynos: remove ignoring return value warning in hdmi

The definition of regulator_bulk_enable is fixed with __must_check
and this causes following build warning.
warning: ignoring return value of 'regulator_bulk_enable',
declared with attribute warn_unused_result
This patch fixes to check return value of the function.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agodrm/exynos: fix WINDOWS_NR checking to vidi driver
Inki Dae [Tue, 28 May 2013 07:01:21 +0000 (16:01 +0900)]
drm/exynos: fix WINDOWS_NR checking to vidi driver

This patch just checks if win_data array range is valid
or not correctly.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
11 years agodrm/exynos: fix tests for valid FIMD window number
Krzysztof Kozlowski [Mon, 27 May 2013 09:56:26 +0000 (11:56 +0200)]
drm/exynos: fix tests for valid FIMD window number

Valid values for FIMD windows are from 0 to WINDOWS_NR-1
inclusive (5 windows in total). The WINDOWS_NR is also
a size of fimd_context.win_data array.
However, early-return tests for wrong values of windows
accepted a value of WINDOWS_NR which is out of bound
for fimd_context.win_data.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agodrm/exynos: fix checks for valid mixer window
Krzysztof Kozlowski [Mon, 27 May 2013 06:00:43 +0000 (15:00 +0900)]
drm/exynos: fix checks for valid mixer window

Valid values for mixer window are from 0 to MIXER_WIN_NR-1 inclusive.
Arrays in structures (e.g. mixer_context.win_data) have size of
MIXER_WIN_NR so checks for wrong mixer window must be greater-equal.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Hyunhee Kim <hyunhee.kim@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
11 years agoRevert "drm: kms_helper: don't lose hotplug event"
Dave Airlie [Fri, 28 Jun 2013 10:31:34 +0000 (20:31 +1000)]
Revert "drm: kms_helper: don't lose hotplug event"

This reverts commit 160954b7bca43da7cd3cfbce310e6df919a8216e.

This was rearming the workqueue with a 0 timeout, causing
a WARN_ON, and possible loop.

Daniel writes:
"I've looked a bit into this and I think we need to have a separate
work struct for recovering these lost hotplug events since the
continuous self-rearming case is a real risk (e.g. if a connector
flip-flops all the time). At least I don't see a sane way to block out
re-arming with the current code in a simple way. So reverting the
offender seems like the right thing and I'll go back to the drawing
board for 3.12."

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/doc: Document the KMS property API
Laurent Pinchart [Sat, 22 Jun 2013 14:10:30 +0000 (16:10 +0200)]
drm/doc: Document the KMS property API

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/doc: Remove outdated note about i915 driver not behaving properly
Laurent Pinchart [Sat, 22 Jun 2013 14:10:29 +0000 (16:10 +0200)]
drm/doc: Remove outdated note about i915 driver not behaving properly

The i915 driver has been fixed not to modify the mode argument of the
encoder mode_fixup operation. Remove the related comment from the
documentation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Improve manual IRQ installation documentation
Laurent Pinchart [Sat, 22 Jun 2013 12:10:59 +0000 (14:10 +0200)]
drm: Improve manual IRQ installation documentation

Define the rules for using irqs from drm drivers.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/prime: add return check for dma_buf_fd
YoungJun Cho [Wed, 26 Jun 2013 01:21:42 +0000 (10:21 +0900)]
drm/prime: add return check for dma_buf_fd

The dma_buf_fd() can return error when it fails to prepare fd,
so the dma_buf needs to be put.

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/prime: reorder drm_prime_add_buf_handle and remove prototype
Seung-Woo Kim [Wed, 26 Jun 2013 01:21:41 +0000 (10:21 +0900)]
drm/prime: reorder drm_prime_add_buf_handle and remove prototype

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/prime: fix to put an exported dma_buf for adding handle failure
YoungJun Cho [Wed, 26 Jun 2013 01:21:40 +0000 (10:21 +0900)]
drm/prime: fix to put an exported dma_buf for adding handle failure

When drm_prime_add_buf_handle() returns failure for an exported
dma_buf, the dma_buf was already allocated and its refcount was
increased, so it needs to be put.

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/prime: support to cache mapping
Joonyoung Shim [Wed, 19 Jun 2013 06:03:05 +0000 (15:03 +0900)]
drm/prime: support to cache mapping

The drm prime also can support it like GEM CMA supports to cache
mapping. It doesn't allow multiple mappings for one attachment.

[airlied: rebased on top of other prime changes]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/prime: replace NULL with error value in drm_prime_pages_to_sg
YoungJun Cho [Mon, 24 Jun 2013 07:40:53 +0000 (16:40 +0900)]
drm/prime: replace NULL with error value in drm_prime_pages_to_sg

Instead of NULL, error value is casted with ERR_PTR() for
drm_prime_pages_to_sg() and IS_ERR_OR_NULL() macro is replaced
with IS_ERR() macro for drm_gem_map_dma_buf().

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/prime: fix to check return of dma_map_sg in prime helper
YoungJun Cho [Mon, 24 Jun 2013 06:34:21 +0000 (15:34 +0900)]
drm/prime: fix to check return of dma_map_sg in prime helper

The dma_map_sg(), in map_dma_buf callback operation of prime helper,
can return 0 when it fails to map, so it needs to release related
resources.

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/gem: fix not to assign error value to gem name
YoungJun Cho [Wed, 26 Jun 2013 23:58:33 +0000 (08:58 +0900)]
drm/gem: fix not to assign error value to gem name

If idr_alloc() is failed, obj->name can be error value. Also
it cleans up duplicated flink processing code.

This regression has been introduced in

commit 2e928815c1886fe628ed54623aa98d0889cf5509
Author: Tejun Heo <tj@kernel.org>
Date:   Wed Feb 27 17:04:08 2013 -0800

    drm: convert to idr_alloc()

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: stable@vger.kernel.org
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/gem: add mutex lock when using drm_gem_mmap_obj
YoungJun Cho [Wed, 26 Jun 2013 23:39:58 +0000 (08:39 +0900)]
drm/gem: add mutex lock when using drm_gem_mmap_obj

The drm_gem_mmap_obj() has to be protected with dev->struct_mutex,
but some caller functions do not. So it adds mutex lock to missing
callers and adds assertion to check whether drm_gem_mmap_obj() is
called with mutex lock or not.

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/omap: drop the !FB_OMAP2 dep
Dave Airlie [Fri, 28 Jun 2013 02:08:10 +0000 (12:08 +1000)]
drm/omap: drop the !FB_OMAP2 dep

This ends up causing circularity and really let people shoot themselves
in the foot.

Acked-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/ttm: get rid of ttm_bo_is_reserved
Maarten Lankhorst [Thu, 27 Jun 2013 11:48:28 +0000 (13:48 +0200)]
drm/ttm: get rid of ttm_bo_is_reserved

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/vmwgfx: get rid of ttm_bo_is_reserved usage
Maarten Lankhorst [Thu, 27 Jun 2013 11:48:27 +0000 (13:48 +0200)]
drm/vmwgfx: get rid of ttm_bo_is_reserved usage

Use lockdep_assert_held instead.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/radeon: get rid of ttm_bo_is_reserved usage
Maarten Lankhorst [Thu, 27 Jun 2013 11:48:26 +0000 (13:48 +0200)]
drm/radeon: get rid of ttm_bo_is_reserved usage

Try to use lockdep_assert_held or other alternatives where possible.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/ttm: get rid of ttm_bo_is_reserved usage
Maarten Lankhorst [Thu, 27 Jun 2013 11:48:25 +0000 (13:48 +0200)]
drm/ttm: get rid of ttm_bo_is_reserved usage

Use lockdep_assert_held instead.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/ttm: inline ttm_bo_reserve and related calls
Maarten Lankhorst [Thu, 27 Jun 2013 11:48:24 +0000 (13:48 +0200)]
drm/ttm: inline ttm_bo_reserve and related calls

Makes lockdep a lot more useful.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/radeon: inline reservations
Maarten Lankhorst [Thu, 27 Jun 2013 11:48:23 +0000 (13:48 +0200)]
drm/radeon: inline reservations

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/mgag200: inline reservations
Maarten Lankhorst [Thu, 27 Jun 2013 11:48:22 +0000 (13:48 +0200)]
drm/mgag200: inline reservations

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/cirrus: inline reservations
Maarten Lankhorst [Thu, 27 Jun 2013 11:48:21 +0000 (13:48 +0200)]
drm/cirrus: inline reservations

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/ast: inline reservations
Maarten Lankhorst [Thu, 27 Jun 2013 11:48:20 +0000 (13:48 +0200)]
drm/ast: inline reservations

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/ttm: convert to the reservation api
Maarten Lankhorst [Thu, 27 Jun 2013 11:48:19 +0000 (13:48 +0200)]
drm/ttm: convert to the reservation api

Now that the code is compatible in semantics, flip the switch.
Use ww_mutex instead of the homegrown implementation.

ww_mutex uses -EDEADLK to signal that the caller has to back off,
and -EALREADY to indicate this buffer is already held by the caller.

ttm used -EAGAIN and -EDEADLK for those, respectively. So some changes
were needed to handle this correctly.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/nouveau: make flipping lockdep safe
Maarten Lankhorst [Thu, 27 Jun 2013 11:48:18 +0000 (13:48 +0200)]
drm/nouveau: make flipping lockdep safe

cli->mutex was inverted with reservations, and multiple reservations were
used without a ticket, fix both. This commit had to be done after the previous
commit, because otherwise ttm_eu_* calls would use a different seqno counter..

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/ttm: make ttm reservation calls behave like reservation calls
Maarten Lankhorst [Thu, 27 Jun 2013 11:48:17 +0000 (13:48 +0200)]
drm/ttm: make ttm reservation calls behave like reservation calls

This commit converts the source of the val_seq counter to
the ww_mutex api. The reservation objects are converted later,
because there is still a lockdep splat in nouveau that has to
resolved first.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoreservation: cross-device reservation support, v4
Maarten Lankhorst [Thu, 27 Jun 2013 11:48:16 +0000 (13:48 +0200)]
reservation: cross-device reservation support, v4

This adds support for a generic reservations framework that can be
hooked up to ttm and dma-buf and allows easy sharing of reservations
across devices.

The idea is that a dma-buf and ttm object both will get a pointer
to a struct reservation_object, which has to be reserved before
anything is done with the contents of the dma-buf.

Changes since v1:
 - Fix locking issue in ticket_reserve, which could cause mutex_unlock
   to be called too many times.
Changes since v2:
 - All fence related calls and members have been taken out for now,
   what's left is the bare minimum to be useful for ttm locking conversion.
Changes since v3:
 - Removed helper functions too. The documentation has an example
   implementation for locking. With the move to ww_mutex there is no
   need to have much logic any more.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/ast: do not attempt to acquire a reservation while in an interrupt handler
Maarten Lankhorst [Thu, 27 Jun 2013 11:38:26 +0000 (13:38 +0200)]
drm/ast: do not attempt to acquire a reservation while in an interrupt handler

Mutexes should not be acquired in interrupt context. While the trylock
fastpath is arguably safe on all implementations, the slowpath
unlock path definitely isn't.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/mgag200: do not attempt to acquire a reservation while in an interrupt handler
Maarten Lankhorst [Thu, 27 Jun 2013 11:38:25 +0000 (13:38 +0200)]
drm/mgag200: do not attempt to acquire a reservation while in an interrupt handler

Mutexes should not be acquired in interrupt context. While the trylock
fastpath is arguably safe on all implementations, the slowpath
unlock path definitely isn't.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/cirrus: do not attempt to acquire a reservation while in an interrupt handler
Maarten Lankhorst [Thu, 27 Jun 2013 11:38:24 +0000 (13:38 +0200)]
drm/cirrus: do not attempt to acquire a reservation while in an interrupt handler

Mutexes should not be acquired in interrupt context. While the trylock
fastpath is arguably safe on all implementations, the slowpath
unlock path definitely isn't. This fixes the following lockdep splat:

[   13.044313] ------------[ cut here ]------------
[   13.044367] WARNING: at /c/kernel-tests/src/tip/kernel/mutex.c:858 mutex_trylock+0x87/0x220()
[   13.044378] DEBUG_LOCKS_WARN_ON(in_interrupt())
[   13.044378] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.10.0-rc4-00296-ga2963dd #20
[   13.044379] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
[   13.044390]  0000000000000009 ffff88000de039f8 ffffffff81fc86d5 ffff88000de03a38
[   13.044395]  ffffffff810d511b ffff880000000018 ffff88000f33c690 0000000000000001
[   13.044398]  00000000000003f0 ffff88000f4677c8 0000000000000000 ffff88000de03a98
[   13.044400] Call Trace:
[   13.044412]  <IRQ>  [<ffffffff81fc86d5>] dump_stack+0x19/0x1b
[   13.044441]  [<ffffffff810d511b>] warn_slowpath_common+0x6b/0x90
[   13.044445]  [<ffffffff810d51a6>] warn_slowpath_fmt+0x46/0x50
[   13.044448]  [<ffffffff81fd34d7>] mutex_trylock+0x87/0x220
[   13.044482]  [<ffffffff8186484d>] cirrus_dirty_update+0x1cd/0x330
[   13.044486]  [<ffffffff818649e8>] cirrus_imageblit+0x38/0x50
[   13.044506]  [<ffffffff8165782e>] soft_cursor+0x22e/0x240
[   13.044510]  [<ffffffff81656c31>] bit_cursor+0x581/0x5b0
[   13.044525]  [<ffffffff815de9f4>] ? vsnprintf+0x124/0x670
[   13.044529]  [<ffffffff81651333>] ? get_color.isra.16+0x43/0x130
[   13.044532]  [<ffffffff81653fca>] fbcon_cursor+0x18a/0x1d0
[   13.044535]  [<ffffffff816566b0>] ? update_attr.isra.2+0xa0/0xa0
[   13.044556]  [<ffffffff81754b82>] hide_cursor+0x32/0xa0
[   13.044565]  [<ffffffff81755bd3>] vt_console_print+0x103/0x3b0
[   13.044569]  [<ffffffff810d58ac>] ? print_time+0x9c/0xb0
[   13.044576]  [<ffffffff810d5960>] ? print_prefix+0xa0/0xc0
[   13.044580]  [<ffffffff810d63f6>] call_console_drivers.constprop.6+0x146/0x1f0
[   13.044593]  [<ffffffff815f9b38>] ? do_raw_spin_unlock+0xc8/0x100
[   13.044597]  [<ffffffff810d6f27>] console_unlock+0x2f7/0x460
[   13.044600]  [<ffffffff810d787a>] vprintk_emit+0x59a/0x5e0
[   13.044615]  [<ffffffff81fb676c>] printk+0x4d/0x4f
[   13.044650]  [<ffffffff82ba5511>] print_local_APIC+0x28/0x41c
[   13.044672]  [<ffffffff8114db55>] generic_smp_call_function_single_interrupt+0x145/0x2b0
[   13.044688]  [<ffffffff8106f9e7>] smp_call_function_single_interrupt+0x27/0x40
[   13.044697]  [<ffffffff81fd8f72>] call_function_single_interrupt+0x72/0x80
[   13.044707]  <EOI>  [<ffffffff81078166>] ? native_safe_halt+0x6/0x10
[   13.044717]  [<ffffffff811425cd>] ? trace_hardirqs_on+0xd/0x10
[   13.044738]  [<ffffffff8104f669>] default_idle+0x59/0x120
[   13.044742]  [<ffffffff810501e8>] arch_cpu_idle+0x18/0x40
[   13.044754]  [<ffffffff811320c5>] cpu_startup_entry+0x235/0x410
[   13.044763]  [<ffffffff81f9e781>] rest_init+0xd1/0xe0
[   13.044766]  [<ffffffff81f9e6b5>] ? rest_init+0x5/0xe0
[   13.044778]  [<ffffffff82b93ec2>] start_kernel+0x425/0x493
[   13.044781]  [<ffffffff82b93810>] ? repair_env_string+0x5e/0x5e
[   13.044786]  [<ffffffff82b93595>] x86_64_start_reservations+0x2a/0x2c
[   13.044789]  [<ffffffff82b93688>] x86_64_start_kernel+0xf1/0x100
[   13.044799] ---[ end trace 113ad28772af4058 ]---

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/nouveau: always select ACPI_VIDEO if ACPI is enabled.
Maarten Lankhorst [Thu, 27 Jun 2013 11:38:23 +0000 (13:38 +0200)]
drm/nouveau: always select ACPI_VIDEO if ACPI is enabled.

Having nouveau builtin would still allow ACPI_VIDEO to be used as external module
if some of the deps for acpi_video have not been met, which would result in a linking
failure. Solve this by selecting all dependencies as well.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/nouveau: complain loudly if buffer is pinned during destruction
Maarten Lankhorst [Thu, 27 Jun 2013 11:38:22 +0000 (13:38 +0200)]
drm/nouveau: complain loudly if buffer is pinned during destruction

Shouldn't happen, and we invert the struct_mutex with reservation here,
potentially leading to deadlocks. Once reservations become lockdep annotated,
lockdep will go splat on this.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/nouveau: fixup fbcon failure paths
Maarten Lankhorst [Thu, 27 Jun 2013 11:38:21 +0000 (13:38 +0200)]
drm/nouveau: fixup fbcon failure paths

Add missing calls, and fix a leak from forgetting to call the unpin function.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/nouveau: unpin notify object in chan_fini
Maarten Lankhorst [Thu, 27 Jun 2013 11:38:20 +0000 (13:38 +0200)]
drm/nouveau: unpin notify object in chan_fini

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/nouveau: implement prime helper unpin function
Maarten Lankhorst [Thu, 27 Jun 2013 11:38:19 +0000 (13:38 +0200)]
drm/nouveau: implement prime helper unpin function

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/radeon: implement unpin function, v2
Maarten Lankhorst [Thu, 27 Jun 2013 11:38:18 +0000 (13:38 +0200)]
drm/radeon: implement unpin function, v2

Changes since v1:
- Fixup compiler warning in unpin function.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoMerge branch 'drm-next-3.11' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Fri, 28 Jun 2013 00:53:23 +0000 (10:53 +1000)]
Merge branch 'drm-next-3.11' of git://people.freedesktop.org/~agd5f/linux into drm-next

This is the pull request for radeon for 3.11.  Highlights include:

- Support for CIK (Sea Islands) asics: 3D, compute, UVD
- DPM (Dynamic Power Management) support for 6xx-SI
- ASPM support for 6xx-SI
- Assorted bug fixes

* 'drm-next-3.11' of git://people.freedesktop.org/~agd5f/linux: (168 commits)
  drm/radeon/SI: fix TDP adjustment in set_power_state
  drm/radeon/NI: fix TDP adjustment in set_power_state
  drm/radeon: fix endian issues in atombios dpm code
  drm/radeon/dpm: fix UVD clock setting on SI
  drm/radeon/dpm: fix UVD clock setting on cayman
  drm/radeon/dpm: add support for setting UVD clock on rv6xx
  drm/radeon/dpm: add support for setting UVD clock on rs780
  drm/radeon: fix typo in ni_print_power_state
  drm/radeon: fix typo in cik_select_se_sh()
  drm/radeon/si: fix typo in function name
  drm/radeon/dpm: fix typo in setting uvd clock
  drm/radeon/dpm: add dpm_set_power_state failure output (si)
  add dpm_set_power_state failure output (7xx-ni)
  drm/radeon/dpm: add dpm_set_power_state failure output (7xx-ni)
  drm/radeon/dpm: add dpm_enable failure output (si)
  drm/radeon/dpm: add dpm_enable failure output (7xx-ni)
  drm/radeon/kms: add dpm support for SI (v7)
  drm/radeon: switch SI to use radeon_ucode.h
  drm/radeon: add SI to r600_is_internal_thermal_sensor()
  drm/radeon/dpm/rs780: properly catch errors in dpm setup
  ...

11 years agoMerge tag 'drm-intel-next-2013-06-18' of git://people.freedesktop.org/~danvet/drm...
Dave Airlie [Thu, 27 Jun 2013 23:50:34 +0000 (09:50 +1000)]
Merge tag 'drm-intel-next-2013-06-18' of git://people.freedesktop.org/~danvet/drm-intel into drm-next

Last 3.11 feature pull. I have a few odds bits and pieces and fixes in my
queue, I'll sort them out later on to see what's for 3.11-fixes and what's
for 3.12. But nothing to hold this here up imo.

Highlights:
- more hangcheck work from Mika and Chris to prepare for arb robustness
- trickle feed fixes from Ville
- first parts of the shared pch pll rework, with some basic hw state
  readout and cross-checking (this shuts up the confused pch pll refcount
  WARN that Linus just recently forwarded)
- Haswell audio power well support from Wang Xingchao (alsa bits acked by
  Takashi)
- some cleanups and asserts sprinkling around the plane/gamma enabling
  sequence from Ville
- more gtt refactoring from Ben
- clear up the adjusted->mode vs. pixel clock vs. port clock confusion
- 30bpp support, this time for real hopefully

* tag 'drm-intel-next-2013-06-18' of git://people.freedesktop.org/~danvet/drm-intel: (97 commits)
  drm/i915: remove a superflous semi-colon
  drm/i915: Kill useless "Enable panel fitter" comments
  drm/i915: Remove extra "ring" from error message
  drm/i915: simplify the reduced clock handling for pch plls
  drm/i915: stop killing pfit on i9xx
  drm/i915: explicitly set up PIPECONF (and gamma table) on haswell
  drm/i915: set up PIPECONF explicitly for i9xx/vlv platforms
  drm/i915: set up PIPECONF explicitly on ilk-ivb
  drm/i915: find guilty batch buffer on ring resets
  drm/i915: store ring hangcheck action
  drm/i915: add batch bo to i915_add_request()
  drm/i915: change i915_add_request to macro
  drm/i915: add i915_gem_context_get_hang_stats()
  drm/i915: add struct i915_ctx_hang_stats
  drm/i915: Try harder to disable trickle feed on VLV
  drm/i915: fix up pch pll enabling for pixel multipliers
  drm/i915: hw state readout and cross-checking for shared dplls
  drm/i915: WARN on lack of shared dpll
  drm/i915: split up intel_modeset_check_state
  drm/i915: extract readout_hw_state from setup_hw_state
  ...

Conflicts:
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_fb.c
drivers/gpu/drm/i915/intel_sdvo.c

11 years agodrm/radeon/SI: fix TDP adjustment in set_power_state
Alex Deucher [Thu, 27 Jun 2013 23:37:12 +0000 (19:37 -0400)]
drm/radeon/SI: fix TDP adjustment in set_power_state

Fixes hangs with DPM in some cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/NI: fix TDP adjustment in set_power_state
Alex Deucher [Thu, 27 Jun 2013 23:08:23 +0000 (19:08 -0400)]
drm/radeon/NI: fix TDP adjustment in set_power_state

Fixes hangs with DPM in some cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: fix endian issues in atombios dpm code
Alex Deucher [Mon, 24 Jun 2013 14:54:16 +0000 (10:54 -0400)]
drm/radeon: fix endian issues in atombios dpm code

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: fix UVD clock setting on SI
Alex Deucher [Tue, 14 May 2013 22:24:34 +0000 (18:24 -0400)]
drm/radeon/dpm: fix UVD clock setting on SI

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: fix UVD clock setting on cayman
Alex Deucher [Tue, 14 May 2013 22:21:17 +0000 (18:21 -0400)]
drm/radeon/dpm: fix UVD clock setting on cayman

The rv770 version was using the wrong power state type.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add support for setting UVD clock on rv6xx
Alex Deucher [Tue, 14 May 2013 22:12:13 +0000 (18:12 -0400)]
drm/radeon/dpm: add support for setting UVD clock on rv6xx

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add support for setting UVD clock on rs780
Alex Deucher [Tue, 14 May 2013 21:55:03 +0000 (17:55 -0400)]
drm/radeon/dpm: add support for setting UVD clock on rs780

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: fix typo in ni_print_power_state
Alex Deucher [Tue, 14 May 2013 14:35:05 +0000 (10:35 -0400)]
drm/radeon: fix typo in ni_print_power_state

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: fix typo in cik_select_se_sh()
Alex Deucher [Thu, 18 Apr 2013 20:25:47 +0000 (16:25 -0400)]
drm/radeon: fix typo in cik_select_se_sh()

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/si: fix typo in function name
Alex Deucher [Wed, 17 Apr 2013 20:27:40 +0000 (16:27 -0400)]
drm/radeon/si: fix typo in function name

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: fix typo in setting uvd clock
Alex Deucher [Wed, 3 Apr 2013 19:03:17 +0000 (15:03 -0400)]
drm/radeon/dpm: fix typo in setting uvd clock

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add dpm_set_power_state failure output (si)
Alex Deucher [Thu, 27 Jun 2013 23:33:58 +0000 (19:33 -0400)]
drm/radeon/dpm: add dpm_set_power_state failure output (si)

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agoadd dpm_set_power_state failure output (7xx-ni)
Alex Deucher [Thu, 27 Jun 2013 23:04:16 +0000 (19:04 -0400)]
add dpm_set_power_state failure output (7xx-ni)

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add dpm_set_power_state failure output (7xx-ni)
Alex Deucher [Thu, 28 Mar 2013 14:46:29 +0000 (10:46 -0400)]
drm/radeon/dpm: add dpm_set_power_state failure output (7xx-ni)

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add dpm_enable failure output (si)
Alex Deucher [Thu, 28 Mar 2013 14:45:50 +0000 (10:45 -0400)]
drm/radeon/dpm: add dpm_enable failure output (si)

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add dpm_enable failure output (7xx-ni)
Alex Deucher [Thu, 28 Mar 2013 14:44:28 +0000 (10:44 -0400)]
drm/radeon/dpm: add dpm_enable failure output (7xx-ni)

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/kms: add dpm support for SI (v7)
Alex Deucher [Tue, 25 Jun 2013 21:56:16 +0000 (17:56 -0400)]
drm/radeon/kms: add dpm support for SI (v7)

This adds dpm support for SI asics.  This includes:
- dynamic engine clock scaling
- dynamic memory clock scaling
- dynamic voltage scaling
- dynamic pcie gen1/gen2/gen3 switching
- power containment
- shader power scaling

Set radeon.dpm=1 to enable.

v2: enable hainan support, rebase
v3: guard acpi stuff
v4: fix 64 bit math
v5: fix 64 bit div harder
v6: fix thermal interrupt check noticed by Jerome
v7: attempt fix state enable

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agoMerge branch 'drm/for-next' of git://anongit.freedesktop.org/tegra/linux into drm...
Dave Airlie [Thu, 27 Jun 2013 23:29:04 +0000 (09:29 +1000)]
Merge branch 'drm/for-next' of git://anongit.freedesktop.org/tegra/linux into drm-next

These changes are mostly minor fixes to things introduced in 3.10. The
biggest chunk is updates to the host1x firewall which checks job
submissions from userspace and wasn't working properly. All other
patches are mostly one-liners. Nothing new or too exciting this time
around.

* 'drm/for-next' of git://anongit.freedesktop.org/tegra/linux:
  gpu: host1x: Rework CPU syncpoint increment
  gpu: host1x: Fix client_managed type
  gpu: host1x: Fix memory access in syncpt request
  gpu: host1x: Copy gathers before verification
  gpu: host1x: Don't reset firewall between gathers
  gpu: host1x: Check reloc table before usage
  gpu: host1x: Check INCR opcode correctly
  drm/tegra: Remove DRIVER_BUS_PLATFORM from driver_features
  drm/tegra: Fix return value
  drm/tegra: Include header drm/drm.h
  MAINTAINERS: Update Tegra DRM entry
  drm/tegra: fix error return code in gr2d_submit()
  drm/tegra: fix missing unlock on error
  drm/tegra: Honor pixel-format changes
  drm/tegra: Explicitly set irq_enabled
  drm/tegra: Don't disable unused planes

11 years agodrm/radeon: switch SI to use radeon_ucode.h
Alex Deucher [Wed, 27 Mar 2013 19:18:04 +0000 (15:18 -0400)]
drm/radeon: switch SI to use radeon_ucode.h

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add SI to r600_is_internal_thermal_sensor()
Alex Deucher [Tue, 26 Mar 2013 23:25:06 +0000 (19:25 -0400)]
drm/radeon: add SI to r600_is_internal_thermal_sensor()

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm/rs780: properly catch errors in dpm setup
Alex Deucher [Tue, 26 Mar 2013 23:23:19 +0000 (19:23 -0400)]
drm/radeon/dpm/rs780: properly catch errors in dpm setup

We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm/r6xx: properly catch errors in dpm setup
Alex Deucher [Tue, 26 Mar 2013 23:18:46 +0000 (19:18 -0400)]
drm/radeon/dpm/r6xx: properly catch errors in dpm setup

We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm/r7xx: properly catch errors in dpm setup
Alex Deucher [Tue, 26 Mar 2013 23:09:18 +0000 (19:09 -0400)]
drm/radeon/dpm/r7xx: properly catch errors in dpm setup

We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm/trinity: properly catch errors in dpm setup
Alex Deucher [Tue, 26 Mar 2013 23:01:05 +0000 (19:01 -0400)]
drm/radeon/dpm/trinity: properly catch errors in dpm setup

We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm/sumo: properly catch errors in dpm setup
Alex Deucher [Tue, 26 Mar 2013 22:55:59 +0000 (18:55 -0400)]
drm/radeon/dpm/sumo: properly catch errors in dpm setup

We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm/evergreen: properly catch errors in dpm setup
Alex Deucher [Tue, 26 Mar 2013 22:49:14 +0000 (18:49 -0400)]
drm/radeon/dpm/evergreen: properly catch errors in dpm setup

We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm/btc: properly catch errors in dpm setup
Alex Deucher [Tue, 26 Mar 2013 22:40:35 +0000 (18:40 -0400)]
drm/radeon/dpm/btc: properly catch errors in dpm setup

We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm/ni: properly catch errors in dpm setup
Alex Deucher [Tue, 26 Mar 2013 21:56:05 +0000 (17:56 -0400)]
drm/radeon/dpm/ni: properly catch errors in dpm setup

We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/atom: fix voltage table parsing
Alex Deucher [Thu, 28 Mar 2013 18:47:34 +0000 (14:47 -0400)]
drm/radeon/atom: fix voltage table parsing

The arrays items are variable sized.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: fix typo in atom voltage table handling (si+)
Alex Deucher [Thu, 28 Mar 2013 00:37:25 +0000 (20:37 -0400)]
drm/radeon: fix typo in atom voltage table handling (si+)

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: fix typo in atom voltage table handling (6xx-ni)
Alex Deucher [Thu, 28 Mar 2013 00:34:19 +0000 (20:34 -0400)]
drm/radeon: fix typo in atom voltage table handling (6xx-ni)

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add pcie gen helper function
Alex Deucher [Mon, 25 Mar 2013 22:28:29 +0000 (18:28 -0400)]
drm/radeon/dpm: add pcie gen helper function

Add a helper function to determine the preferred
pcie gen based on the card, system, and circumstance.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: update radeon_atombios_get_default_voltages for mvdd
Alex Deucher [Mon, 25 Mar 2013 16:47:23 +0000 (12:47 -0400)]
drm/radeon: update radeon_atombios_get_default_voltages for mvdd

Add a way to look up the bootup mvdd.  Required for DPM on SI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: validate voltages against dispclk requirements
Alex Deucher [Fri, 22 Mar 2013 19:59:10 +0000 (15:59 -0400)]
drm/radeon/dpm: validate voltages against dispclk requirements

Validate the voltages against the voltage requirements of the
dispclk.  We currently don't adjust the disp clock so it never
changes, but we need to filter out voltage levels that are too
low none the less.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: fix some memory leaks in extended table parsing
Alex Deucher [Fri, 22 Mar 2013 19:38:15 +0000 (15:38 -0400)]
drm/radeon: fix some memory leaks in extended table parsing

Forgot to free some structs when allocation fails for some
tables.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm/cayman: use new fixed point functions (v2)
Alex Deucher [Fri, 22 Mar 2013 14:43:00 +0000 (10:43 -0400)]
drm/radeon/dpm/cayman: use new fixed point functions (v2)

Use the new fixed point functions for leakage
calculations on cayman.

v2: fix up 64 bit math

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm: add some additional fixed point helpers (v3)
Alex Deucher [Fri, 22 Mar 2013 14:35:50 +0000 (10:35 -0400)]
drm: add some additional fixed point helpers (v3)

Required for certain driver calculations.  Code
was written by Christian König and ported to the
drm by me.

v2: fix 64 bit divides
v3: fix 64 bit for real (math64.h)

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: minor sid.h cleanup
Alex Deucher [Thu, 21 Mar 2013 16:41:46 +0000 (12:41 -0400)]
drm/radeon: minor sid.h cleanup

Consolidate the non-register defines.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: save some display parameters for DPM
Alex Deucher [Thu, 21 Mar 2013 14:38:49 +0000 (10:38 -0400)]
drm/radeon/dpm: save some display parameters for DPM

Required for SI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: pull in ppm info from atom
Alex Deucher [Wed, 20 Mar 2013 17:00:18 +0000 (13:00 -0400)]
drm/radeon/dpm: pull in ppm info from atom

Used by SI dpm.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: endian fixes for extended power tables
Alex Deucher [Wed, 20 Mar 2013 16:44:11 +0000 (12:44 -0400)]
drm/radeon/dpm: endian fixes for extended power tables

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: pull in phase shedding limits from atom
Alex Deucher [Wed, 20 Mar 2013 16:30:25 +0000 (12:30 -0400)]
drm/radeon/dpm: pull in phase shedding limits from atom

Required for dpm on SI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add an enum for pcie gen selection
Alex Deucher [Mon, 18 Mar 2013 21:03:01 +0000 (17:03 -0400)]
drm/radeon/dpm: add an enum for pcie gen selection

This makes it easier the understand what the code is
doing.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: implement clock and power gating for SI
Alex Deucher [Thu, 7 Mar 2013 17:56:35 +0000 (12:56 -0500)]
drm/radeon: implement clock and power gating for SI

Only Cape Verde supports power gating.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>