openwrt/staging/blogic.git
11 years agodrm/radeon/audio: set up the sads on DCE3.2 asics
Alex Deucher [Thu, 29 Aug 2013 14:51:04 +0000 (10:51 -0400)]
drm/radeon/audio: set up the sads on DCE3.2 asics

This sets up the short audio descriptors properly on
DCE3.2 asics for hdmi audio.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: fix handling of variable sized arrays for router objects
Alex Deucher [Tue, 27 Aug 2013 16:36:01 +0000 (12:36 -0400)]
drm/radeon: fix handling of variable sized arrays for router objects

The table has the following format:

typedef struct _ATOM_SRC_DST_TABLE_FOR_ONE_OBJECT         //usSrcDstTableOffset pointing to this structure
{
  UCHAR               ucNumberOfSrc;
  USHORT              usSrcObjectID[1];
  UCHAR               ucNumberOfDst;
  USHORT              usDstObjectID[1];
}ATOM_SRC_DST_TABLE_FOR_ONE_OBJECT;

usSrcObjectID[] and usDstObjectID[] are variably sized, so we
can't access them directly.  Use pointers and update the offset
appropriately when accessing the Dst members.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
11 years agodrm/radeon: fix resume on some rs4xx boards (v2)
Alex Deucher [Mon, 26 Aug 2013 21:52:12 +0000 (17:52 -0400)]
drm/radeon: fix resume on some rs4xx boards (v2)

Setting MC_MISC_CNTL.GART_INDEX_REG_EN causes hangs on
some boards on resume.  The systems seem to work fine
without touching this bit so leave it as is.

v2: read-modify-write the GART_INDEX_REG_EN bit.
I suspect the problem is that we are losing the other
settings in the register.

fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=52952

Reported-by: Ondrej Zary <linux@rainbow-software.org>
Tested-by: Daniel Tobias <dan.g.tob@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
11 years agodrm/radeon: add berlin pci ids
Alex Deucher [Mon, 10 Jun 2013 19:51:21 +0000 (15:51 -0400)]
drm/radeon: add berlin pci ids

This adds the pci ids for the berlin GPU core.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
11 years agodrm/radeon: fill in gpu_init for berlin GPU cores
Alex Deucher [Mon, 10 Jun 2013 19:18:26 +0000 (15:18 -0400)]
drm/radeon: fill in gpu_init for berlin GPU cores

This fills in the GPU specific details for berlin
GPU cores so that the driver will work with them.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
11 years agodrm/radeon/dpm: ungate blocks in dpm disable for kb/kv
Alex Deucher [Mon, 26 Aug 2013 13:46:51 +0000 (09:46 -0400)]
drm/radeon/dpm: ungate blocks in dpm disable for kb/kv

These blocks need to be ungated for the other parts of
the driver properly initialize them (e.g., after a gpu
reset, etc.).

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: track uvd gated state for ci
Alex Deucher [Mon, 26 Aug 2013 13:43:24 +0000 (09:43 -0400)]
drm/radeon/dpm: track uvd gated state for ci

Track the current uvd gated state on CI to avoid unnecessary
state changes when uvd is active.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: enable uvd dpm on CI
Alex Deucher [Fri, 23 Aug 2013 15:06:12 +0000 (11:06 -0400)]
drm/radeon: enable uvd dpm on CI

UVD dpm dynamically adjusts the uvd clocks on
demand.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: disable the GRPH block when we disable the crtc
Alex Deucher [Wed, 21 Aug 2013 18:44:15 +0000 (14:44 -0400)]
drm/radeon: disable the GRPH block when we disable the crtc

Since we aren't using it when the crtc is disabled, turn it off
to save power.  The GRPH block is the part of the display
controller that controls the primary graphics plane (size,
address, etc.).

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: atombios hw i2c fixes
Alex Deucher [Wed, 21 Aug 2013 17:48:12 +0000 (13:48 -0400)]
drm/radeon: atombios hw i2c fixes

These fixes make writes work properly.  Previously
only reads worked.  Note that this feature is off
by default.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: fix LCD record parsing
Alex Deucher [Tue, 20 Aug 2013 18:59:01 +0000 (14:59 -0400)]
drm/radeon: fix LCD record parsing

If the LCD table contains an EDID record, properly account
for the edid size when walking through the records.

This should fix error messages about unknown LCD records.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
11 years agodrm/radeon: check firmware overrides for mclk/sclk ss
Alex Deucher [Mon, 19 Aug 2013 23:06:19 +0000 (19:06 -0400)]
drm/radeon: check firmware overrides for mclk/sclk ss

Check the overrides in the firmware info table before
enabling spread spectrum on the engine or memory clocks.

Some boards may have valid spread spectrum tables, but
shouldn't necessarily have it enabled.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: update line buffer allocation for dce8
Alex Deucher [Mon, 19 Aug 2013 15:39:27 +0000 (11:39 -0400)]
drm/radeon: update line buffer allocation for dce8

We need to allocate line buffer to each display when
setting up the watermarks.  Failure to do so can lead
to a blank screen.  This fixes blank screen problems
on dce8 asics.

Based on an initial fix from:
Jay Cornwall <jay.cornwall@amd.com>

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
11 years agodrm/radeon: update line buffer allocation for dce6
Alex Deucher [Mon, 19 Aug 2013 15:15:43 +0000 (11:15 -0400)]
drm/radeon: update line buffer allocation for dce6

We need to allocate line buffer to each display when
setting up the watermarks.  Failure to do so can lead
to a blank screen.  This fixes blank screen problems
on dce6 asics.

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

Based on an initial fix from:
Jay Cornwall <jay.cornwall@amd.com>

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
11 years agodrm/radeon: update line buffer allocation for dce4.1/5
Alex Deucher [Mon, 19 Aug 2013 15:06:50 +0000 (11:06 -0400)]
drm/radeon: update line buffer allocation for dce4.1/5

We need to allocate line buffer to each display when
setting up the watermarks.  Failure to do so can lead
to a blank screen.  This fixes blank screen problems
on dce4.1/5 asics.

Based on an initial fix from:
Jay Cornwall <jay.cornwall@amd.com>

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
11 years agodrm/radeon/si: Add support for CP DMA to CS checker for compute v2
Tom Stellard [Fri, 16 Aug 2013 21:47:39 +0000 (17:47 -0400)]
drm/radeon/si: Add support for CP DMA to CS checker for compute v2

Also add a new RADEON_INFO query to check that CP DMA packets are
supported on the compute ring.

CP DMA has been supported since the 3.8 kernel, but due to an oversight
we forgot to teach the CS checker that the CP DMA packet was legal for
the compute ring on Southern Islands GPUs.

This patch fixes a bug where the radeon driver will incorrectly reject a legal
CP DMA packet from user space.  I would like to have the patch
backported to stable so that we don't have to require Mesa users to use a
bleeding edge kernel in order to take advantage of this feature which
is already present in the stable kernels (3.8 and newer).

v2:
  - Don't bump kms version, so this patch can be backported to stable
    kernels.

Cc: stable@vger.kernel.org
Signed-off-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: enable mgcg on CIK
Alex Deucher [Wed, 14 Aug 2013 22:58:43 +0000 (18:58 -0400)]
drm/radeon: enable mgcg on CIK

Now that the CP is no longer reset and cg is properly
disabled in when appropriate in the dpm code we can
now enable mgcg (medium grained clockgating).

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: handle cg in KB/KV dpm code
Alex Deucher [Wed, 14 Aug 2013 23:55:46 +0000 (19:55 -0400)]
drm/radeon: handle cg in KB/KV dpm code

Clockgating needs to be disabled around certain parts
of dpm setup otherwise the smc gets into a bad state
and dpm doesn't work properly.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: handle cg in CI dpm code
Alex Deucher [Wed, 14 Aug 2013 17:55:53 +0000 (13:55 -0400)]
drm/radeon: handle cg in CI dpm code

Clockgating needs to be disabled around certain parts
of dpm setup otherwise the smc gets into a bad state
and dpm doesn't work properly.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/cik: properly set up the clearstate buffer for pg (v2)
Alex Deucher [Thu, 22 Aug 2013 15:57:46 +0000 (11:57 -0400)]
drm/radeon/cik: properly set up the clearstate buffer for pg (v2)

The format of the clearstate buffer used for pg (powergating)
changed between NI and SI.  This formats it properly for what
the hardware expects on SI+.

v2: fix addresses

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: fixes for gfx clockgating on CIK
Alex Deucher [Mon, 12 Aug 2013 21:25:26 +0000 (17:25 -0400)]
drm/radeon: fixes for gfx clockgating on CIK

Clockgating requires signalling between the CP and the
RLC to work properly.  Resetting the CP block in the
CP resume code messed up the internal coordination
between the blocks.  Removing the reset allows gfx
clockgating to work properly.  However, when gfx clock
gating is enabled, there is a strange interaction with
dpm which causes the chip to stay in the high performance
level all the time, so leave gfx clockgating disabled
for now.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: restructure cg/pg on cik (v2)
Alex Deucher [Fri, 9 Aug 2013 15:18:39 +0000 (11:18 -0400)]
drm/radeon: restructure cg/pg on cik (v2)

- use new cg/pg flags for finer grained clock and
powergating control
- restructure the cg/pg code so it can be called from
other components such as dpm

v2: fix build breakage from rebase

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/si: enable DMA pg by default
Alex Deucher [Tue, 13 Aug 2013 17:18:37 +0000 (13:18 -0400)]
drm/radeon/si: enable DMA pg by default

Enable DMA powergating by default.  The DMA engines
will be powergated when not in use.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/si: properly set up the clearstate buffer for pg (v2)
Alex Deucher [Tue, 13 Aug 2013 16:48:06 +0000 (12:48 -0400)]
drm/radeon/si: properly set up the clearstate buffer for pg (v2)

The format of the clearstate buffer used for pg (powergating)
changed between NI and SI.  This formats it properly for what
the hardware expects on SI.

v2: fix addresses

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: enable mgcg on SI
Alex Deucher [Wed, 14 Aug 2013 22:53:56 +0000 (18:53 -0400)]
drm/radeon: enable mgcg on SI

Now that the CP is no longer reset and cg is properly
disabled in when appropriate in the dpm code we can
now enable mgcg (medium grained clockgating).

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: handle cg in SI dpm code
Alex Deucher [Wed, 14 Aug 2013 21:24:08 +0000 (17:24 -0400)]
drm/radeon: handle cg in SI dpm code

Clockgating needs to be disabled around certain parts
of dpm setup otherwise the smc gets into a bad state
and dpm doesn't work properly.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: fixes for gfx clockgating on SI
Alex Deucher [Thu, 15 Aug 2013 20:20:26 +0000 (16:20 -0400)]
drm/radeon: fixes for gfx clockgating on SI

Clockgating requires signalling between the CP and the
RLC to work properly.  Resetting the CP block in the
CP resume code messed up the internal coordination
between the blocks.  Removing the reset allows gfx
clockgating to work properly.  However, when gfx clock
gating is enabled, there is a strange interaction with
dpm which causes the chip to stay in the high performance
level all the time, so leave gfx clockgating disabled
for now.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/si: restructure cg code (v3)
Alex Deucher [Thu, 8 Aug 2013 23:34:07 +0000 (19:34 -0400)]
drm/radeon/si: restructure cg code (v3)

Resturcture clockgating code so that it can be
enabled/disabled from other components such as
dpm.

v2: make function static
v3: add fine grained cg controls

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: use new cg/pg flags for SI
Alex Deucher [Thu, 8 Aug 2013 22:00:10 +0000 (18:00 -0400)]
drm/radeon: use new cg/pg flags for SI

Allows us finer grained control over clock and
powergating on SI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add cg and pg flags
Alex Deucher [Thu, 8 Aug 2013 20:31:25 +0000 (16:31 -0400)]
drm/radeon: add cg and pg flags

This commits adds flags for supported clockgating and
powergating features.  This allows us to more easily
track which features are supported on a particular
asic and to enable/disable features for debugging.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: set speaker allocation for DCE3.2
Alex Deucher [Thu, 15 Aug 2013 16:03:37 +0000 (12:03 -0400)]
drm/radeon: set speaker allocation for DCE3.2

This updates the audio driver to the speaker allocation
block from the EDID.  A similar change was just implemented
for DCE4-8.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: set speaker allocation for DCE4/5 (v2)
Alex Deucher [Thu, 15 Aug 2013 13:34:07 +0000 (09:34 -0400)]
drm/radeon: set speaker allocation for DCE4/5 (v2)

This updates the audio driver to the speaker allocation
block from the EDID.  A similar change was just implemented
for DCE6/8.

v2: remove unused variables

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Rafał Miłecki <zajec5@gmail.com>
11 years agodrm/radeon: set speakers allocation earlier
Rafał Miłecki [Thu, 15 Aug 2013 09:16:30 +0000 (11:16 +0200)]
drm/radeon: set speakers allocation earlier

Do it before enabling audio channels (in AFMT_AUDIO_PACKET_CONTROL2
register).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add audio support for DCE6/8 GPUs (v12)
Alex Deucher [Wed, 31 Jul 2013 20:51:33 +0000 (16:51 -0400)]
drm/radeon: add audio support for DCE6/8 GPUs (v12)

Similar to DCE4/5, but supports multiple audio pins
which can be assigned per afmt block.

v2: rework the driver to handle more than one audio
pin.
v3: try different dto reg
v4: properly program dto
v5 (ck): change dto programming order
v6: program speaker allocation block
v7: rebase
v8: rebase on Rafał's changes
v9: integrated Rafał's comments, update to latest
    drm_edid_to_speaker_allocation API
v10: add missing line break in error message
v11: add back audio enabled messages
v12: fix copy paste typo in r600_audio_enable

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Rafał Miłecki <zajec5@gmail.com>
11 years agodrm/radeon: use loop for initializing AFMT blocks
Rafał Miłecki [Thu, 1 Aug 2013 15:29:16 +0000 (17:29 +0200)]
drm/radeon: use loop for initializing AFMT blocks

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/edid: add a helper function to extract the speaker allocation data block (v3)
Alex Deucher [Thu, 25 Jul 2013 19:55:32 +0000 (15:55 -0400)]
drm/edid: add a helper function to extract the speaker allocation data block (v3)

This adds a helper function to extract the speaker allocation
data block from the EDID.  This data block describes what speakers
are present on the display device.

v2: update per Ville Syrjälä's comments
v3: fix copy/paste typo in memory allocation

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Tested-by: Rafał Miłecki <zajec5@gmail.com>
11 years agodrm/radeon: separate DMA code
Christian König [Tue, 13 Aug 2013 09:56:54 +0000 (11:56 +0200)]
drm/radeon: separate DMA code

Similar to separating the UVD code, just put the DMA
functions into separate files.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: separate UVD code v3
Christian König [Tue, 13 Aug 2013 09:56:53 +0000 (11:56 +0200)]
drm/radeon: separate UVD code v3

Our different hardware blocks are actually completely
separated, so it doesn't make much sense any more to
structure the code by pure chipset generations.

Start restructuring the code by separating our the UVD block.

v2: updated commit message
v3: rebased and restructurized start/stop functions for kv dpm.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: remove special handling for the DMA ring
Christian König [Tue, 13 Aug 2013 09:56:52 +0000 (11:56 +0200)]
drm/radeon: remove special handling for the DMA ring

Now that we have callbacks for [rw]ptr handling we can
remove the special handling for the DMA rings and use
the callbacks instead.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: rework UVD writeback & [rw]ptr handling
Christian König [Tue, 13 Aug 2013 09:56:51 +0000 (11:56 +0200)]
drm/radeon: rework UVD writeback & [rw]ptr handling

The hardware just doesn't support this correctly.
Disable it before we accidentally write anywhere we shouldn't.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: rework ring function handling
Christian König [Tue, 13 Aug 2013 09:56:50 +0000 (11:56 +0200)]
drm/radeon: rework ring function handling

Give the ring functions a separate structure and let the asic
structure point to the ring specific functions. This simplifies
the code and allows us to make changes at only one point.

No change in functionality.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: fix endian bugs in hw i2c atom routines
Alex Deucher [Wed, 7 Aug 2013 23:34:53 +0000 (19:34 -0400)]
drm/radeon: fix endian bugs in hw i2c atom routines

Need to swap the data fetched over i2c properly.  This
is the same fix as the endian fix for aux channel
transactions.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
11 years agodrm/radeon/dpm: adjust the vblank time checks for eg, ni, si
Alex Deucher [Mon, 12 Aug 2013 15:35:02 +0000 (11:35 -0400)]
drm/radeon/dpm: adjust the vblank time checks for eg, ni, si

According to the internal teams, we never hit the limit for
mclk switching on these asics, so we can disable the check.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add reclocking quirk for ASUS K70AF
Alex Deucher [Mon, 12 Aug 2013 15:24:05 +0000 (11:24 -0400)]
drm/radeon/dpm: add reclocking quirk for ASUS K70AF

The LCD has a relatively short vblank time (216us), but
the card is able to reclock memory fine in that time.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reported-by: normalrawr@gmail.com
11 years agodrm/radeon/dpm: implement UVD powergating for CI
Alex Deucher [Fri, 9 Aug 2013 14:05:24 +0000 (10:05 -0400)]
drm/radeon/dpm: implement UVD powergating for CI

Disable the UVD block when not in use to save power.
The block is not actually powergated on CI, but we
switch between UVD DPM (where the uvd clocks are
adjusted on demand) and clocks off.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: implement UVD powergating for KB/KV
Alex Deucher [Fri, 9 Aug 2013 14:02:40 +0000 (10:02 -0400)]
drm/radeon/dpm: implement UVD powergating for KB/KV

Powergate the UVD block when not in use to save power.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: restructure UVD code to handle UVD PG (v2)
Alex Deucher [Tue, 6 Aug 2013 15:39:38 +0000 (11:39 -0400)]
drm/radeon: restructure UVD code to handle UVD PG (v2)

When we PG (powergate) UVD, we need to re-initialize it
before we can use it again.

v2: rebase on UVD stop fixes

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add new callback for powergating UVD (v4)
Alex Deucher [Wed, 31 Jul 2013 22:13:23 +0000 (18:13 -0400)]
drm/radeon/dpm: add new callback for powergating UVD (v4)

Starting on CIK, multi-media blocks like UVD no longer
have special power state.  Rather they have their own
DPM implementation which adjusts their clocks dynamically
when active.  When they are not active, the blocks are
powergated to save power.

v2: add missing pm locks
v3: rebase on uvd state selection rework
v4: fix inverted logic typo noticed by Christian

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: implement force performance level for KB/KV
Alex Deucher [Thu, 18 Jul 2013 20:48:46 +0000 (16:48 -0400)]
drm/radeon/dpm: implement force performance level for KB/KV

Allows you to force the selected performance level via sysfs.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add debugfs support for KB/KV
Alex Deucher [Thu, 18 Jul 2013 20:39:53 +0000 (16:39 -0400)]
drm/radeon/dpm: add debugfs support for KB/KV

This allows you to look at the current DPM state via
debugfs.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: implement vblank_too_short callback for CI
Alex Deucher [Mon, 15 Jul 2013 22:24:31 +0000 (18:24 -0400)]
drm/radeon/dpm: implement vblank_too_short callback for CI

Check if we can switch the mclk during the vblank time otherwise
we may get artifacts on the screen when the mclk changes.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: implement force performance level for CI
Alex Deucher [Mon, 15 Jul 2013 22:14:24 +0000 (18:14 -0400)]
drm/radeon/dpm: implement force performance level for CI

Allows you to force the selected performance level via sysfs.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add debugfs support for CI
Alex Deucher [Mon, 15 Jul 2013 21:34:33 +0000 (17:34 -0400)]
drm/radeon/dpm: add debugfs support for CI

This allows you to look at the current DPM state via debugfs.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add dpm support for CI dGPUs (v2)
Alex Deucher [Wed, 14 Aug 2013 05:03:41 +0000 (01:03 -0400)]
drm/radeon: add dpm support for CI dGPUs (v2)

This adds dpm support for btc asics. This includes:
- dynamic engine clock scaling
- dynamic memory clock scaling
- dynamic voltage scaling
- dynamic pcie gen switching

Set radeon.dpm=1 to enable.

v2: remove unused radeon_atombios.c changes,
    make missing smc ucode non-fatal

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/kms: add dpm support for KB/KV
Alex Deucher [Wed, 14 Aug 2013 05:01:40 +0000 (01:01 -0400)]
drm/radeon/kms: add dpm support for KB/KV

This adds dpm support for KB/KV asics.  This includes:
- dynamic engine clock scaling
- dynamic voltage scaling
- power containment
- shader power scaling

Set radeon.dpm=1 to enable.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add helper to fetch the vrefresh of the current mode
Alex Deucher [Fri, 19 Jul 2013 16:42:08 +0000 (12:42 -0400)]
drm/radeon/dpm: add helper to fetch the vrefresh of the current mode

Needed for DPM on CI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add a helper to encode pcie lane setting
Alex Deucher [Wed, 15 May 2013 21:25:03 +0000 (17:25 -0400)]
drm/radeon/dpm: add a helper to encode pcie lane setting

convert from number of lanes to register setting.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add vce clocks to radeon_ps
Alex Deucher [Wed, 15 May 2013 19:53:57 +0000 (15:53 -0400)]
drm/radeon/dpm: add vce clocks to radeon_ps

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add r600_get_pcie_lane_support helper
Alex Deucher [Tue, 14 May 2013 21:44:31 +0000 (17:44 -0400)]
drm/radeon: add r600_get_pcie_lane_support helper

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: parse the acp clock voltage deps table
Alex Deucher [Thu, 9 May 2013 21:34:45 +0000 (17:34 -0400)]
drm/radeon: parse the acp clock voltage deps table

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: parse the samu clock voltage deps table
Alex Deucher [Thu, 9 May 2013 21:27:49 +0000 (17:27 -0400)]
drm/radeon: parse the samu clock voltage deps table

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: clean up the extended table error pathes
Alex Deucher [Thu, 9 May 2013 21:21:56 +0000 (17:21 -0400)]
drm/radeon/dpm: clean up the extended table error pathes

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: parse the uvd clock voltage deps table
Alex Deucher [Thu, 9 May 2013 21:14:11 +0000 (17:14 -0400)]
drm/radeon: parse the uvd clock voltage deps table

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: parse the vce clock voltage deps table
Alex Deucher [Thu, 9 May 2013 21:04:27 +0000 (17:04 -0400)]
drm/radeon: parse the vce clock voltage deps table

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add clock voltage dep tables for acp, samu
Alex Deucher [Thu, 9 May 2013 20:42:33 +0000 (16:42 -0400)]
drm/radeon: add clock voltage dep tables for acp, samu

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add structs to store vce clock voltage deps
Alex Deucher [Thu, 9 May 2013 20:37:28 +0000 (16:37 -0400)]
drm/radeon: add structs to store vce clock voltage deps

Used for vce power management.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: grab mvdd_dependency_on_mclk info from vbios
Alex Deucher [Mon, 6 May 2013 18:37:56 +0000 (14:37 -0400)]
drm/radeon/dpm: grab mvdd_dependency_on_mclk info from vbios

Required for dpm on CI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: add support for parsing the atom powertune table
Alex Deucher [Mon, 6 May 2013 16:15:33 +0000 (12:15 -0400)]
drm/radeon/dpm: add support for parsing the atom powertune table

Needed for DPM on CI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: update cac leakage table parsing for CI
Alex Deucher [Mon, 6 May 2013 15:31:04 +0000 (11:31 -0400)]
drm/radeon/dpm: update cac leakage table parsing for CI

Uses a different table format if the board supports EVV.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: adjust si_dpm function for code sharing
Alex Deucher [Mon, 29 Apr 2013 22:53:52 +0000 (18:53 -0400)]
drm/radeon: adjust si_dpm function for code sharing

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add get_temperature() callbacks for CIK (v2)
Alex Deucher [Fri, 21 Jun 2013 19:50:47 +0000 (15:50 -0400)]
drm/radeon: add get_temperature() callbacks for CIK (v2)

This added support for the on-chip thermal sensors on
CIK asics.

v2: fix register offset.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add KB/KV to r600_is_internal_thermal_sensor
Alex Deucher [Tue, 16 Jul 2013 20:59:08 +0000 (16:59 -0400)]
drm/radeon: add KB/KV to r600_is_internal_thermal_sensor

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

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add support for thermal controller on KB/KV
Alex Deucher [Tue, 23 Apr 2013 01:41:26 +0000 (21:41 -0400)]
drm/radeon: add support for thermal controller on KB/KV

No support for reading temperature back yet.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/cik: add rlc helpers for DPM
Alex Deucher [Tue, 23 Apr 2013 00:23:31 +0000 (20:23 -0400)]
drm/radeon/cik: add rlc helpers for DPM

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add structs to store uvd clock voltage deps
Alex Deucher [Fri, 19 Apr 2013 23:11:37 +0000 (19:11 -0400)]
drm/radeon: add structs to store uvd clock voltage deps

Used for uvd power management.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: switch to pptable.h
Alex Deucher [Fri, 19 Apr 2013 22:58:44 +0000 (18:58 -0400)]
drm/radeon: switch to pptable.h

Internally we switched to using a separate header for
atombios pplib definitions.  Switch over the open source
driver.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/sumo add helper to go from vid7 to vid2
Alex Deucher [Fri, 19 Apr 2013 17:29:43 +0000 (13:29 -0400)]
drm/radeon/sumo add helper to go from vid7 to vid2

Needed for DPM on KB/KV.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add indirect accessors for dift registers on CIK
Alex Deucher [Fri, 19 Apr 2013 17:03:37 +0000 (13:03 -0400)]
drm/radeon: add indirect accessors for dift registers on CIK

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: implement clock and power gating for CIK (v3)
Alex Deucher [Tue, 23 Jul 2013 13:41:05 +0000 (09:41 -0400)]
drm/radeon: implement clock and power gating for CIK (v3)

Only the APUs support power gating.

v2: disable cgcg for now
v3: workaround hw issue in mgcg

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: convert SI,CIK to use sumo_rlc functions
Alex Deucher [Wed, 17 Apr 2013 21:53:50 +0000 (17:53 -0400)]
drm/radeon: convert SI,CIK to use sumo_rlc functions

and remove duplicate si_rlc functions.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: clean up sumo_rlc_init() for code sharing
Alex Deucher [Wed, 17 Apr 2013 21:22:05 +0000 (17:22 -0400)]
drm/radeon: clean up sumo_rlc_init() for code sharing

This will eventually be shared with newer asics to
reduce code duplication.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/cik: restructure rlc setup
Alex Deucher [Mon, 15 Apr 2013 21:13:29 +0000 (17:13 -0400)]
drm/radeon/cik: restructure rlc setup

Restructure rlc setup to handle clock and power
gating.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add support for ASPM on CIK asics
Alex Deucher [Thu, 4 Apr 2013 17:58:09 +0000 (13:58 -0400)]
drm/radeon: add support for ASPM on CIK asics

Enables PCIE ASPM (Active State Power Management) on
CIK asics.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/cik: add support for pcie gen1/2/3 switching
Alex Deucher [Tue, 6 Aug 2013 15:29:39 +0000 (11:29 -0400)]
drm/radeon/cik: add support for pcie gen1/2/3 switching

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: switch CIK to use radeon_ucode.h
Alex Deucher [Fri, 21 Jun 2013 19:38:37 +0000 (15:38 -0400)]
drm/radeon: switch CIK to use radeon_ucode.h

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/cik: implement some more atom helpers for DPM
Alex Deucher [Tue, 19 Feb 2013 23:15:06 +0000 (18:15 -0500)]
drm/radeon/cik: implement some more atom helpers for DPM

Required for DPM on CIK.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/kms: fix up dce8 display watermark calc for dpm
Alex Deucher [Thu, 24 Jan 2013 15:03:39 +0000 (10:03 -0500)]
drm/radeon/kms: fix up dce8 display watermark calc for dpm

Calculate the low and high watermarks based on the low and high
clocks for the current power state.  The dynamic pm hw will select
the appropriate watermark based on the internal dpm state.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: use performance state if no UVD state
Alex Deucher [Tue, 11 Jun 2013 21:55:39 +0000 (17:55 -0400)]
drm/radeon/dpm: use performance state if no UVD state

Newer asics don't have specific UVD states.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: default to 1024M gart size on rv770+
Alex Deucher [Fri, 5 Jul 2013 21:16:51 +0000 (17:16 -0400)]
drm/radeon: default to 1024M gart size on rv770+

Newer asics have a lot of vram so it's less of an
issue to waste a little more space for the gart
page table.  This gives us some additional gart space
before having to migrate to non-gart system ram
for games, etc. where we use up most of vram.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: rework thermal state handling
Alex Deucher [Wed, 24 Jul 2013 18:59:48 +0000 (14:59 -0400)]
drm/radeon/dpm: rework thermal state handling

1. Handle the the thermal state directly in the work handler.
Remove the state selection function since nothing else uses it now.
2. On some asics there is no thermal state, so we just use a regular
state and force the low performance state.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: use multiple UVD power states (v3)
Alex Deucher [Wed, 24 Jul 2013 16:12:49 +0000 (12:12 -0400)]
drm/radeon/dpm: use multiple UVD power states (v3)

Use the UVD handle information to determine which
which power states to select when using UVD.  For
example, decoding a single SD stream requires much
lower clocks than multiple HD streams.

v2: switch to a cleaner dpm/uvd interface
v3: change the uvd power state while streams
are active if need be

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add UVD->DPM helper function (v5)
Alex Deucher [Mon, 5 Aug 2013 16:41:20 +0000 (12:41 -0400)]
drm/radeon: add UVD->DPM helper function (v5)

Add a helper function for counting the number of open stream handles.

v2: fix copy-pasta in comments and whitespace error
v3: make function static since it's only used in radeon_uvd.c
at the moment
v4: make non-static again for future changes
v5: make static again for new rework of dpm uvd changes

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/kms: remove r6xx+ blit copy routines
Alex Deucher [Mon, 5 Aug 2013 16:37:32 +0000 (12:37 -0400)]
drm/radeon/kms: remove r6xx+ blit copy routines

No longer used now that we use the async dma engines or
CP DMA for bo copies.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: switch r6xx+ to using CP DMA for the blit copy callback
Alex Deucher [Fri, 12 Jul 2013 18:52:30 +0000 (14:52 -0400)]
drm/radeon: switch r6xx+ to using CP DMA for the blit copy callback

CP DMA is lighter weight than using the 3D engine.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/edid: add quirk for Medion MD30217PG
Alex Deucher [Mon, 12 Aug 2013 15:04:29 +0000 (11:04 -0400)]
drm/edid: add quirk for Medion MD30217PG

This LCD monitor (1280x1024 native) has a completely
bogus detailed timing (640x350@70hz).  User reports that
1280x1024@60 has waves so prefer 1280x1024@75.

Manufacturer: MED  Model: 7b8  Serial#: 99188
Year: 2005  Week: 5
EDID Version: 1.3
Analog Display Input,  Input Voltage Level: 0.700/0.700 V
Sync:  Separate
Max Image Size [cm]: horiz.: 34  vert.: 27
Gamma: 2.50
DPMS capabilities: Off; RGB/Color Display
First detailed timing is preferred mode
redX: 0.645 redY: 0.348   greenX: 0.280 greenY: 0.605
blueX: 0.142 blueY: 0.071   whiteX: 0.313 whiteY: 0.329
Supported established timings:
720x400@70Hz
640x480@60Hz
640x480@72Hz
640x480@75Hz
800x600@56Hz
800x600@60Hz
800x600@72Hz
800x600@75Hz
1024x768@60Hz
1024x768@70Hz
1024x768@75Hz
1280x1024@75Hz
Manufacturer's mask: 0
Supported standard timings:
Supported detailed timing:
clock: 25.2 MHz   Image Size:  337 x 270 mm
h_active: 640  h_sync: 688  h_sync_end 784 h_blank_end 800 h_border: 0
v_active: 350  v_sync: 350  v_sync_end 352 v_blanking: 449 v_border: 0
Monitor name: MD30217PG
Ranges: V min: 56 V max: 76 Hz, H min: 30 H max: 83 kHz, PixClock max 145 MHz
Serial No: 501099188
EDID (in hex):
          00ffffffffffff0034a4b80774830100
          050f010368221b962a0c55a559479b24
          125054afcf00310a0101010101018180
          000000000000d60980a0205e63103060
          0200510e1100001e000000fc004d4433
          3032313750470a202020000000fd0038
          4c1e530e000a202020202020000000ff
          003530313039393138380a2020200078

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reported-by: friedrich@mailstation.de
Cc: stable@vger.kernel.org
11 years agodrm/vmwgfx: Split GMR2_REMAP commands if they are to large
Jakob Bornecrantz [Thu, 29 Aug 2013 00:32:53 +0000 (02:32 +0200)]
drm/vmwgfx: Split GMR2_REMAP commands if they are to large

This fixes the piglit test texturing/max-texture-size
causing the VM to die due to a too large SVGA command.

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Biran Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@gmail.com>
11 years agoMerge tag 'drm-intel-fixes-2013-08-30' of git://people.freedesktop.org/~danvet/drm...
Dave Airlie [Thu, 29 Aug 2013 23:02:57 +0000 (09:02 +1000)]
Merge tag 'drm-intel-fixes-2013-08-30' of git://people.freedesktop.org/~danvet/drm-intel into drm-fixes

Just a one-line patch to fix a black screen issue on rare ivb machines,
cc: stable. Normally I'd just shovel this into the -next pull request this
late in the -rc cycle, but Linus was making noises about not getting real
fixes which are cc: stable. So here we go ;-)

* tag 'drm-intel-fixes-2013-08-30' of git://people.freedesktop.org/~danvet/drm-intel:
  drm/i915: ivb: fix edp voltage swing reg val

11 years agodrm/i915: ivb: fix edp voltage swing reg val
Imre Deak [Fri, 23 Aug 2013 20:50:23 +0000 (23:50 +0300)]
drm/i915: ivb: fix edp voltage swing reg val

Fix the typo introduced in

commit 1a2eb4604b85c5efb343da8a4dcf41288fcfca85
Author: Keith Packard <keithp@keithp.com>
Date:   Wed Nov 16 16:26:07 2011 -0800

    drm/i915: Hook up Ivybridge eDP

This fixes eDP link-training failures and cases where all voltage swing
/pre-emphasis levels were tried and failed during clock recovery and -
as a fallback - we go on to do channel equalization with the last voltage
swing/pre-emphasis level which will succeed. Both issues can lead to a
blank screen.

v2:
- improve commit message

CC: stable@vger.kernel.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64880
Tested-by: Jeremy Moles <cubicool@gmail.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
11 years agoLinux 3.11-rc7
Linus Torvalds [Mon, 26 Aug 2013 00:43:22 +0000 (17:43 -0700)]
Linux 3.11-rc7