platform/kernel/linux-starfive.git
8 years agodrm/omap: omap_display_timings: rename hbp to hback_porch
Peter Ujfalusi [Thu, 22 Sep 2016 11:06:50 +0000 (14:06 +0300)]
drm/omap: omap_display_timings: rename hbp to hback_porch

In preparation to move the stack to use the generic videmode struct for
display timing information rename the hbp member to hback_porch.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
8 years agodrm/omap: omap_display_timings: rename hfp to hfront_porch
Peter Ujfalusi [Thu, 22 Sep 2016 11:06:49 +0000 (14:06 +0300)]
drm/omap: omap_display_timings: rename hfp to hfront_porch

In preparation to move the stack to use the generic videmode struct for
display timing information rename the hfp member to hfront_porch.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
8 years agodrm/omap: omap_display_timings: rename hsw to hsync_len
Peter Ujfalusi [Thu, 22 Sep 2016 11:06:48 +0000 (14:06 +0300)]
drm/omap: omap_display_timings: rename hsw to hsync_len

In preparation to move the stack to use the generic videmode struct for
display timing information rename the hsw member to hsync_len.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
8 years agodrm/omap: omap_display_timings: rename y_res to vactive
Peter Ujfalusi [Thu, 22 Sep 2016 11:06:47 +0000 (14:06 +0300)]
drm/omap: omap_display_timings: rename y_res to vactive

In preparation to move the stack to use the generic videmode struct for
display timing information rename the y_res member to vactive.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
8 years agodrm/omap: omap_display_timings: rename x_res to hactive
Peter Ujfalusi [Thu, 22 Sep 2016 11:06:46 +0000 (14:06 +0300)]
drm/omap: omap_display_timings: rename x_res to hactive

In preparation to move the stack to use the generic videmode struct for
display timing information rename the x_res member to hactive.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
8 years agovideo: of: display_timing: Add support for syncclk-active property
Peter Ujfalusi [Thu, 22 Sep 2016 10:35:26 +0000 (13:35 +0300)]
video: of: display_timing: Add support for syncclk-active property

Configure the DISPLAY_FLAGS_SYNC_POSEDGE/NEGEDGE flags according to the
binding document.
If the syncclk-active is present in DT, configure the flags accordingly, if
it is omitted it means that the SYNC edge is following the pixdata
configuration.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Rob Herring <robh+dt@kernel.org>
CC: Mark Rutland <mark.rutland@arm.com>
CC: devicetree@vger.kernel.org
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
8 years agovideo: display_timing: Add flags to select the edge when the sync is driven
Peter Ujfalusi [Thu, 22 Sep 2016 10:35:25 +0000 (13:35 +0300)]
video: display_timing: Add flags to select the edge when the sync is driven

The sync can be - and for some panels it must be - driven on different edge
then the data.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Rob Herring <robh+dt@kernel.org>
CC: Mark Rutland <mark.rutland@arm.com>
CC: devicetree@vger.kernel.org
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
8 years agodt-bindings: display: display-timing: Add property to configure sync drive edge
Peter Ujfalusi [Thu, 22 Sep 2016 10:35:24 +0000 (13:35 +0300)]
dt-bindings: display: display-timing: Add property to configure sync drive edge

There are display panels which demands that the sync signal is driven on
different edge than the pixel data.
With the syncclk-active property we can specify the clk edge to be used to
drive the sync signal. When the property is missing it indicates that the
sync is driven on the same edge as the pixel data.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Rob Herring <robh+dt@kernel.org>
CC: Mark Rutland <mark.rutland@arm.com>
CC: devicetree@vger.kernel.org
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
8 years agodrm/omap: fix return value check in dsi_bind()
Wei Yongjun [Sat, 17 Sep 2016 15:53:54 +0000 (15:53 +0000)]
drm/omap: fix return value check in dsi_bind()

Fix the retrn value check which testing the wrong variable
in dsi_bind().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
8 years agodrm/omap: omap_gem: Do not try to unmap page which is not mapped
Peter Ujfalusi [Fri, 27 Nov 2015 09:00:37 +0000 (11:00 +0200)]
drm/omap: omap_gem: Do not try to unmap page which is not mapped

It might be possible that the page has been unmapped already in
omap_gem_cpu_sync() so check before calling dma_unmap_page().

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
8 years agodrm/omapdrm: Remove double gamma table write in omap_crtc_atomic_flush()
Jyri Sarha [Wed, 31 Aug 2016 17:17:05 +0000 (20:17 +0300)]
drm/omapdrm: Remove double gamma table write in omap_crtc_atomic_flush()

Remove double gamma table write in omap_crtc_atomic_flush().
Fixes commit 492a426a2fc53
("drm/omapdrm: Implement gamma_lut atomic crtc properties")

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
8 years agodrm/omap: remove unneeded conversions to bool
Andrew F. Davis [Fri, 1 Jul 2016 14:27:21 +0000 (09:27 -0500)]
drm/omap: remove unneeded conversions to bool

Found with scripts/coccinelle/misc/boolconv.cocci.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
8 years agodrm/omap: print error instead of WARN() if plane setup fails
Tomi Valkeinen [Fri, 10 Jun 2016 09:44:31 +0000 (12:44 +0300)]
drm/omap: print error instead of WARN() if plane setup fails

omap_plane_atomic_update() does WARN_ON() if dispc rejects the given
plane config. Change that to dev_err() to lessen the possible spam.

To fix this correctly, the plane setup needs much more work by creating
a check function for dispc setup, so that we could reliably check the
config in atomic_check, instead of only noticing the problem when
programming dispc.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
8 years agodrm/omap: cleanup omap_plane_atomic_check()
Tomi Valkeinen [Fri, 10 Jun 2016 09:50:53 +0000 (12:50 +0300)]
drm/omap: cleanup omap_plane_atomic_check()

Clean up omap_plane_atomic_check() with:

- Check state->fb first. If no fb, return 0.
- use drm_atomic_get_existing_crtc_state() instead of
  drm_atomic_get_crtc_state()

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
8 years agodrm/omap: fix plane check when crtc is disabled
Tomi Valkeinen [Fri, 10 Jun 2016 09:50:39 +0000 (12:50 +0300)]
drm/omap: fix plane check when crtc is disabled

I sometimes see:

[drm:drm_framebuffer_remove [drm]] *ERROR* failed to reset crtc ed2a6c00
when fb was deleted: -22

which comes from drm_framebuffer_remove() when it's disabling the crtc
with zeroed drm_mode_set.

The problem in omap_plane_atomic_check() is that it will use those
zeroed fields to verify if the setup is correct.

This patch makes omap_plane_atomic_check() return 0 if the crtc is
disabled.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
8 years agoMerge branch 'linux-4.9' of git://github.com/skeggsb/linux into drm-next
Dave Airlie [Fri, 28 Oct 2016 04:24:56 +0000 (14:24 +1000)]
Merge branch 'linux-4.9' of git://github.com/skeggsb/linux into drm-next

Karol's work which greatly improves volt/clock changes on a
heap of boards, nothing too exciting beyond a random collection of fixes.

* 'linux-4.9' of git://github.com/skeggsb/linux: (33 commits)
  drm/nouveau/fb/nv50: defer DMA mapping of scratch page to oneinit() hook
  drm/nouveau/fb/gf100: defer DMA mapping of scratch page to oneinit() hook
  drm/nouveau/pci: set streaming DMA mask early
  drm/nouveau/kms: add Maxwell to backlight initialization
  drm/nouveau/bar/nv50: fix bar2 vm size
  drm/nouveau/disp: remove unused function in sorg94.c
  drm/nouveau/volt: use kernel's 64-bit signed division function
  drm/nouveau/core: add missing header dependencies
  drm/nouveau/gr/nv3x: add 0x0597 kelvin 3d class support
  drm/nouveau/drm/nouveau: add a LED driver for the NVIDIA logo
  drm/nouveau/fb/ram: Use Kepler implementation on Maxwell
  drm/nouveau/volt: Make use of cvb coefficients
  drm/nouveau/volt/gf100-: Add speedo
  drm/nouveau/volt: Add implementation for gf100
  drm/nouveau/bios/vmap: unk0 field is the mode
  drm/nouveau/volt: Don't require perfect fit
  drm/nouveau/clk: Allow boosting only when NvBoost is set
  drm/nouveau/bios: Add parsing of VPSTATE table
  drm/nouveau/clk: Respect voltage limits in nvkm_cstate_prog
  drm/nouveau/clk: Fixup cstate selection
  ...

8 years agoMerge tag 'topic/drm-misc-2016-10-27' of git://anongit.freedesktop.org/git/drm-intel...
Dave Airlie [Fri, 28 Oct 2016 01:33:52 +0000 (11:33 +1000)]
Merge tag 'topic/drm-misc-2016-10-27' of git://anongit.freedesktop.org/git/drm-intel into drm-next

Pull request already again to get the s/fence/dma_fence/ stuff in and
allow everyone to resync. Otherwise really just misc stuff all over, and a
new bridge driver.

* tag 'topic/drm-misc-2016-10-27' of git://anongit.freedesktop.org/git/drm-intel:
  drm/bridge: fix platform_no_drv_owner.cocci warnings
  drm/bridge: fix semicolon.cocci warnings
  drm: Print some debug/error info during DP dual mode detect
  drm: mark drm_of_component_match_add dummy inline
  drm/bridge: add Silicon Image SiI8620 driver
  dt-bindings: add Silicon Image SiI8620 bridge bindings
  video: add header file for Mobile High-Definition Link (MHL) interface
  drm: convert DT component matching to component_match_add_release()
  dma-buf: Rename struct fence to dma_fence
  dma-buf/fence: add an lockdep_assert_held()
  drm/dp: Factor out helper to distinguish between branch and sink devices
  drm/edid: Only print the bad edid when aborting
  drm/msm: add missing header dependencies
  drm/msm/adreno: move function declarations to header file
  drm/i2c/tda998x: mark symbol static where possible
  doc: add missing docbook parameter for fence-array
  drm: RIP mode_config->rotation_property
  drm/msm/mdp5: Advertize 180 degree rotation
  drm/msm/mdp5: Use per-plane rotation property

8 years agoMerge branch 'drm-next-4.10' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Fri, 28 Oct 2016 00:35:59 +0000 (10:35 +1000)]
Merge branch 'drm-next-4.10' of git://people.freedesktop.org/~agd5f/linux into drm-next

First new feature pull for 4.10.  Highlights:
- Support for multple virtual displays in the virtual dce component
- New VM mgr to support non-contiguous vram buffers
- Support for UVD powergating on additional asics
- Power management improvements
- lots of code cleanup and bug fixes

* 'drm-next-4.10' of git://people.freedesktop.org/~agd5f/linux: (107 commits)
  drm/amdgpu: turn on/off uvd clock when dpm enable/disable on CI
  drm/amdgpu: disable dpm before turn off clock when vce idle.
  drm/amdgpu: enable uvd bypass mode for CI/VI.
  drm/amdgpu: just not load smc firmware if smu is already running
  drm/amdgpu: when suspend, set boot state instand of disable dpm.
  drm/amdgpu: use failed label to handle context init failure
  drm/amdgpu: add amdgpu_ttm_bo_eviction_valuable callback
  drm/ttm: make eviction decision a driver callback v2
  drm/ttm: fix coding style in ttm_bo_driver.h
  drm/radeon/pm: autoswitch power state when in balanced mode
  drm/amd/powerplay: fix spelling mistake and add KERN_WARNING to printks
  drm/amdgpu:new ids flag for preempt
  drm/amdgpu: mark symbols static where possible
  drm/amdgpu: change function declarations and add missing header dependencies
  drm/amdgpu: s/amdgpuCrtc/amdgpu_crtc/ in pageflip code
  drm/amdgpu/atom: remove a bunch of unused functions
  drm/amdgpu: consolidate atom scratch reg handling for hangs
  drm/amdgpu: use amdgpu_bo_[create|free]_kernel for wb
  drm/amdgpu: add VCE VM session tracking
  drm/amdgpu: improve parse_cs handling a bit
  ...

8 years agodrm/amdgpu: turn on/off uvd clock when dpm enable/disable on CI
Rex Zhu [Wed, 26 Oct 2016 10:05:00 +0000 (18:05 +0800)]
drm/amdgpu: turn on/off uvd clock when dpm enable/disable on CI

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: disable dpm before turn off clock when vce idle.
Rex Zhu [Wed, 26 Oct 2016 09:05:30 +0000 (17:05 +0800)]
drm/amdgpu: disable dpm before turn off clock when vce idle.

v2: move return value check as well

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: enable uvd bypass mode for CI/VI.
Rex Zhu [Wed, 26 Oct 2016 09:04:33 +0000 (17:04 +0800)]
drm/amdgpu: enable uvd bypass mode for CI/VI.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: just not load smc firmware if smu is already running
Rex Zhu [Wed, 26 Oct 2016 05:44:12 +0000 (13:44 +0800)]
drm/amdgpu: just not load smc firmware if smu is already running

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: when suspend, set boot state instand of disable dpm.
Rex Zhu [Mon, 3 Oct 2016 12:46:36 +0000 (20:46 +0800)]
drm/amdgpu: when suspend, set boot state instand of disable dpm.

fix pm-hibernate bug, when suspend/resume, dpm start failed.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: use failed label to handle context init failure
Huang Rui [Wed, 26 Oct 2016 09:07:03 +0000 (17:07 +0800)]
drm/amdgpu: use failed label to handle context init failure

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/bridge: fix platform_no_drv_owner.cocci warnings
kbuild test robot [Wed, 26 Oct 2016 16:58:36 +0000 (00:58 +0800)]
drm/bridge: fix platform_no_drv_owner.cocci warnings

drivers/gpu/drm/bridge/sil-sii8620.c:1556:3-8: No need to set .owner here. The core will do it.

 Remove .owner field if calls are used which set it automatically

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

CC: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20161026165836.GA98766@lkp-sb04.lkp.intel.com
8 years agodrm/bridge: fix semicolon.cocci warnings
kbuild test robot [Wed, 26 Oct 2016 16:58:36 +0000 (00:58 +0800)]
drm/bridge: fix semicolon.cocci warnings

drivers/gpu/drm/bridge/sil-sii8620.c:988:2-3: Unneeded semicolon

 Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

CC: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20161026165836.GA98907@lkp-sb04.lkp.intel.com
8 years agodrm: Print some debug/error info during DP dual mode detect
Imre Deak [Wed, 26 Oct 2016 16:29:19 +0000 (19:29 +0300)]
drm: Print some debug/error info during DP dual mode detect

There's at least one LSPCON device that occasionally returns an unexpected
adaptor ID which leads to a failed detect. Print some debug info to help
debugging this and future cases. Also print an error for an unexpected
adaptor ID, so users can report it.

v2:
- s/adapter/adaptor/ and add code comment about incorrect type 1 adaptor
  IDs. (Ville)

Cc: dri-devel@lists.freedesktop.org
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1477499359-12001-1-git-send-email-imre.deak@intel.com
8 years agodrm: mark drm_of_component_match_add dummy inline
Arnd Bergmann [Wed, 26 Oct 2016 08:57:47 +0000 (10:57 +0200)]
drm: mark drm_of_component_match_add dummy inline

The newly added drm_of_component_match_add helper is defined as
'static' in a header when CONFIG_OF is disabled, causing a warning
each time the header is included:

In file included from /git/arm-soc/drivers/gpu/drm/bridge/dw-hdmi.c:23:0:
include/drm/drm_of.h:33:13: error: 'drm_of_component_match_add' defined but not used [-Werror=unused-function]

This marks it 'inline' like the other such helpers in this file.

Fixes: 97ac0e47aed5 ("drm: convert DT component matching to component_match_add_release()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20161026085759.3875472-1-arnd@arndb.de
8 years agodrm/bridge: add Silicon Image SiI8620 driver
Andrzej Hajda [Mon, 10 Oct 2016 07:39:17 +0000 (09:39 +0200)]
drm/bridge: add Silicon Image SiI8620 driver

SiI8620 transmitter converts eTMDS/HDMI signal to MHL 3.0.
It is controlled via I2C bus. Its interaction with other
devices in video pipeline is performed mainly on HW level.
The only interaction it does on device driver level is
filtering-out unsupported video modes, it exposes drm_bridge
interface to perform this operation.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1476085157-5266-1-git-send-email-a.hajda@samsung.com
8 years agodt-bindings: add Silicon Image SiI8620 bridge bindings
Andrzej Hajda [Fri, 7 Oct 2016 07:02:41 +0000 (09:02 +0200)]
dt-bindings: add Silicon Image SiI8620 bridge bindings

SiI8620 transmitter converts eTMDS/HDMI signal to MHL 3.0. It is controlled
via I2C bus.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1475823762-16237-3-git-send-email-a.hajda@samsung.com
8 years agovideo: add header file for Mobile High-Definition Link (MHL) interface
Andrzej Hajda [Fri, 7 Oct 2016 07:02:40 +0000 (09:02 +0200)]
video: add header file for Mobile High-Definition Link (MHL) interface

This header adds definitions specific to MHL protocol.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1475823762-16237-2-git-send-email-a.hajda@samsung.com
8 years agodrm/amdgpu: add amdgpu_ttm_bo_eviction_valuable callback
Christian König [Wed, 19 Oct 2016 12:44:22 +0000 (14:44 +0200)]
drm/amdgpu: add amdgpu_ttm_bo_eviction_valuable callback

This way we can correctly check split VRAM buffers as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/ttm: make eviction decision a driver callback v2
Christian König [Tue, 30 Aug 2016 15:26:04 +0000 (17:26 +0200)]
drm/ttm: make eviction decision a driver callback v2

This way the driver can decide if it is valuable to evict a BO or not.

The current implementation is added as default to all existing drivers.

v2: fix some typos found during internal testing

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/ttm: fix coding style in ttm_bo_driver.h
Christian König [Tue, 30 Aug 2016 13:01:27 +0000 (15:01 +0200)]
drm/ttm: fix coding style in ttm_bo_driver.h

A few 80chars issues and spaces at wrong places.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/radeon/pm: autoswitch power state when in balanced mode
Lucas Stach [Sat, 22 Oct 2016 23:05:33 +0000 (01:05 +0200)]
drm/radeon/pm: autoswitch power state when in balanced mode

The current default of always using the performance power state leads
to increased power consumption of mobile devices, which have a dedicated
battery power state. Switch between the performance and battery power
state automatically, dpending on the current AC power status, when the
user asked for the balanced power state.

The user can still override this logic by asking for the performance
or battery power state explicitly.

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: fix spelling mistake and add KERN_WARNING to printks
Colin Ian King [Mon, 24 Oct 2016 23:14:12 +0000 (00:14 +0100)]
drm/amd/powerplay: fix spelling mistake and add KERN_WARNING to printks

Fix trivial spelling mistake cant't -> can't and add KERN_WARNING to
printk messages.  Remove redundant spaces before \n too (thanks to
Joe Perches for spotting those).

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu:new ids flag for preempt
Monk Liu [Mon, 24 Oct 2016 03:36:17 +0000 (11:36 +0800)]
drm/amdgpu:new ids flag for preempt

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: mark symbols static where possible
Baoyou Xie [Sat, 22 Oct 2016 08:48:26 +0000 (16:48 +0800)]
drm/amdgpu: mark symbols static where possible

We get 2 warnings when building kernel with W=1:
drivers/gpu/drm/amd/amdgpu/si.c:908:5: warning: no previous prototype for 'si_pciep_rreg' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/si.c:921:6: warning: no previous prototype for 'si_pciep_wreg' [-Wmissing-prototypes]

In fact, both functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks these functions with 'static'.

Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: change function declarations and add missing header dependencies
Baoyou Xie [Sat, 22 Oct 2016 08:48:25 +0000 (16:48 +0800)]
drm/amdgpu: change function declarations and add missing header dependencies

We get a few warnings when building kernel with W=1:
drivers/gpu/drm/amd/amdgpu/atombios_crtc.c:38:6: warning: no previous prototype for 'amdgpu_atombios_crtc_overscan_setup' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c:661:6: warning: no previous prototype for 'dce_v8_0_disable_dce' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:40:5: warning: no previous prototype for 'amdgpu_gfx_scratch_get' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:62:6: warning: no previous prototype for 'amdgpu_gfx_scratch_free' [-Wmissing-prototypes]
....

In fact, these functions are declared in
drivers/gpu/drm/amd/amdgpu/atombios_crtc.h
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
drivers/gpu/drm/amd/amdgpu/dce_v8_0.h
drivers/gpu/drm/amd/amdgpu/dce_v10_0.h
drivers/gpu/drm/amd/amdgpu/dce_v11_0.h
drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h.
So this patch adds missing header dependencies.

By the way, this patch changes declaration of amdgpu_gfx_parse_disable_cu()
to subject to its implement, and clean three function declarations
in pp_acpi.h up.

Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: s/amdgpuCrtc/amdgpu_crtc/ in pageflip code
Alex Deucher [Fri, 21 Oct 2016 20:36:12 +0000 (16:36 -0400)]
drm/amdgpu: s/amdgpuCrtc/amdgpu_crtc/ in pageflip code

Fix random CamelCase that has annoyed me for a while.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/atom: remove a bunch of unused functions
Alex Deucher [Fri, 21 Oct 2016 19:54:18 +0000 (15:54 -0400)]
drm/amdgpu/atom: remove a bunch of unused functions

Leftovers from the radeon.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: consolidate atom scratch reg handling for hangs
Alex Deucher [Fri, 21 Oct 2016 19:45:22 +0000 (15:45 -0400)]
drm/amdgpu: consolidate atom scratch reg handling for hangs

Move from asic specific code to common atom code.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: use amdgpu_bo_[create|free]_kernel for wb
Alex Deucher [Fri, 21 Oct 2016 19:30:36 +0000 (15:30 -0400)]
drm/amdgpu: use amdgpu_bo_[create|free]_kernel for wb

Rather than open coding it.

Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: add VCE VM session tracking
Christian König [Mon, 10 Oct 2016 13:23:32 +0000 (15:23 +0200)]
drm/amdgpu: add VCE VM session tracking

Fix the problems with killing VCE sessions in VM mode.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: improve parse_cs handling a bit
Christian König [Wed, 5 Oct 2016 14:49:19 +0000 (16:49 +0200)]
drm/amdgpu: improve parse_cs handling a bit

This way we can use parse_cs and still keep VM mode enabled.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: refine set power state logic for dpm.
Rex Zhu [Fri, 14 Oct 2016 11:23:34 +0000 (19:23 +0800)]
drm/amdgpu: refine set power state logic for dpm.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: update current ps/requeset ps in adev with real ps.
Rex Zhu [Fri, 14 Oct 2016 11:29:02 +0000 (19:29 +0800)]
drm/amdgpu: update current ps/requeset ps in adev with real ps.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: add an implement for check_power_state equal for KV
Alex Deucher [Mon, 24 Oct 2016 19:50:17 +0000 (15:50 -0400)]
drm/amdgpu: add an implement for check_power_state equal for KV

KV/KB/ML was missed these was implemented for other asics.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: add an implement for check_power_state equal for Si.
Rex Zhu [Fri, 14 Oct 2016 11:39:52 +0000 (19:39 +0800)]
drm/amdgpu: add an implement for check_power_state equal for Si.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: add an implement for check_power_state equal for Cz.
Rex Zhu [Fri, 14 Oct 2016 11:30:08 +0000 (19:30 +0800)]
drm/amdgpu: add an implement for check_power_state equal for Cz.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: add an implement for check_power_state equal for CI
Rex Zhu [Fri, 14 Oct 2016 11:16:54 +0000 (19:16 +0800)]
drm/amdgpu: add an implement for check_power_state equal for CI

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: add new callback to check power state info
Rex Zhu [Mon, 17 Oct 2016 05:49:27 +0000 (13:49 +0800)]
drm/amdgpu: add new callback to check power state info

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: check min clock set by DAL before set ps.
Rex Zhu [Wed, 12 Oct 2016 12:05:03 +0000 (20:05 +0800)]
drm/amdgpu: check min clock set by DAL before set ps.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/amdgpu: Put in rest of wave fields
Tom St Denis [Fri, 14 Oct 2016 14:50:46 +0000 (10:50 -0400)]
drm/amd/amdgpu: Put in rest of wave fields

Add the rest of the basic SQ WAVE fields to
finish off the implementation.  Eventually,
a separate interface will be needed for GPRs.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/amdgpu: re-factor debugfs wave reader
Tom St Denis [Fri, 14 Oct 2016 13:49:09 +0000 (09:49 -0400)]
drm/amd/amdgpu: re-factor debugfs wave reader

Move IP version specific code into a callback.

Also add support for gfx7 devices.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/amdgpu: Make debugfs write compliment read
Tom St Denis [Mon, 10 Oct 2016 11:31:23 +0000 (07:31 -0400)]
drm/amd/amdgpu: Make debugfs write compliment read

Add PG lock support as well as bank selection to
the MMIO write function.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/amdgpu: Allow broadcast on debugfs read (v2)
Tom St Denis [Sun, 9 Oct 2016 11:41:26 +0000 (07:41 -0400)]
drm/amd/amdgpu: Allow broadcast on debugfs read (v2)

Allow any of the se/sh/instance fields to be
specified as a broadcast by submitting 0x3FF.

(v2) Fix broadcast range checking

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/amdgpu: Fix debugfs wave reader
Tom St Denis [Thu, 13 Oct 2016 16:15:03 +0000 (12:15 -0400)]
drm/amd/amdgpu: Fix debugfs wave reader

On non VI/CZ platforms it would not free
the grbm index lock.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/amdgpu: Add wave reader to debugfs
Tom St Denis [Tue, 11 Oct 2016 18:48:55 +0000 (14:48 -0400)]
drm/amd/amdgpu: Add wave reader to debugfs

Currently supports CZ/VI.  Allows nearly atomic read
of wave data from GPU.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: rework IP block registration (v2)
Alex Deucher [Thu, 13 Oct 2016 21:41:13 +0000 (17:41 -0400)]
drm/amdgpu: rework IP block registration (v2)

This makes it easier to replace specific IP blocks on
asics for handling virtual_dce, DAL, etc. and for building
IP lists for hw or tables.  This also stored the status
information in the same structure.

v2: split out spelling fix into a separate patch
    add a function to add IPs to the list

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/powerplay: fix spelling in amdgpu_powerplay.h
Alex Deucher [Fri, 14 Oct 2016 15:27:15 +0000 (11:27 -0400)]
drm/amdgpu/powerplay: fix spelling in amdgpu_powerplay.h

and update a comment as well.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/virtual_dce: move define into source file
Alex Deucher [Thu, 13 Oct 2016 21:36:46 +0000 (17:36 -0400)]
drm/amdgpu/virtual_dce: move define into source file

It's not used outside the file.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: enable virtual dce on SI
Alex Deucher [Thu, 13 Oct 2016 20:01:18 +0000 (16:01 -0400)]
drm/amdgpu: enable virtual dce on SI

Add the proper IP module when requested.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: fill in vce clock info ioctl query (v2)
Alex Deucher [Fri, 7 Oct 2016 16:22:02 +0000 (12:22 -0400)]
drm/amdgpu: fill in vce clock info ioctl query (v2)

Returns the vce clock table for the user mode driver.
The user mode driver can fill this data into vce clock
data packet for optimal VCE DPM.

v2: update to the new API

Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/powerplay: add an implementation for get_vce_clock_state (v3)
Alex Deucher [Fri, 7 Oct 2016 17:52:43 +0000 (13:52 -0400)]
drm/amdgpu/powerplay: add an implementation for get_vce_clock_state (v3)

Used by the powerplay dpm code.

v2: update to the new API
v3: drop old include

Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/dpm: add an implementation for get_vce_clock_state (v2)
Alex Deucher [Fri, 7 Oct 2016 16:38:04 +0000 (12:38 -0400)]
drm/amdgpu/dpm: add an implementation for get_vce_clock_state (v2)

Used by the non-powerplay dpm code.

v2: update to the new API

Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/dpm: add new callback to fetch vce clock state (v2)
Alex Deucher [Fri, 7 Oct 2016 18:10:15 +0000 (14:10 -0400)]
drm/amdgpu/dpm: add new callback to fetch vce clock state (v2)

Will be used by the new info ioctl query.

v2: fetch a single state per request

Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: add info ioctl query for vce clock info (v3)
Alex Deucher [Fri, 7 Oct 2016 16:12:46 +0000 (12:12 -0400)]
drm/amdgpu: add info ioctl query for vce clock info (v3)

This is needed to set up the vce clock table in userspace
for proper VCE DPM.

v2: fix copy paste typo in comment
v3: track number of valid states

Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: save number of vce states in dpm struct.
Rex Zhu [Wed, 12 Oct 2016 07:38:56 +0000 (15:38 +0800)]
drm/amdgpu: save number of vce states in dpm struct.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: use same vce state definition in dpm and powerplay
Rex Zhu [Wed, 12 Oct 2016 07:13:29 +0000 (15:13 +0800)]
drm/amdgpu: use same vce state definition in dpm and powerplay

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: move dpm related definitions to amdgpu_dpm.h
Alex Deucher [Fri, 7 Oct 2016 15:40:09 +0000 (11:40 -0400)]
drm/amdgpu: move dpm related definitions to amdgpu_dpm.h

No intended functional change.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: move align_mask and nop into ring funcs as well (v2)
Christian König [Wed, 5 Oct 2016 14:09:32 +0000 (16:09 +0200)]
drm/amdgpu: move align_mask and nop into ring funcs as well (v2)

They are constant as well.

v2: update uvd and vce phys ring structures as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: move the ring type into the funcs structure (v2)
Christian König [Wed, 5 Oct 2016 13:36:39 +0000 (15:36 +0200)]
drm/amdgpu: move the ring type into the funcs structure (v2)

It's constant, so it doesn't make to much sense to keep it
with the variable data.

v2: update vce and uvd phys mode ring structures as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: move IB and frame size directly into the engine description
Christian König [Wed, 5 Oct 2016 12:29:38 +0000 (14:29 +0200)]
drm/amdgpu: move IB and frame size directly into the engine description

I should have suggested that on the initial patchset. This saves us a
few CPU cycles during CS and a bunch of loc.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: remove explicit NULL init for parse_cs
Christian König [Wed, 5 Oct 2016 12:23:00 +0000 (14:23 +0200)]
drm/amdgpu: remove explicit NULL init for parse_cs

sed -i "/\.parse_cs = NULL,/d" drivers/gpu/drm/amd/amdgpu/*.c

That's just a leftover from radeon.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: remove 128 NOP hack from vm_flush v2
Christian König [Wed, 5 Oct 2016 10:59:20 +0000 (12:59 +0200)]
drm/amdgpu: remove 128 NOP hack from vm_flush v2

With the padding raised to 256 DW that shouldn't be needed any more.

v2: reduce estimation as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: remove ring type check for conditional execution
Christian König [Wed, 5 Oct 2016 10:51:57 +0000 (12:51 +0200)]
drm/amdgpu: remove ring type check for conditional execution

If a ring doesn't support that it shouldn't implement the function.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: pad gfx and compute rings to 256 dw
Christian König [Wed, 5 Oct 2016 10:38:21 +0000 (12:38 +0200)]
drm/amdgpu: pad gfx and compute rings to 256 dw

The same as on windows to avoid further problems with CE/DE
command submission overlaps.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/radeon: clarify why we evict vram twice on suspend
Alex Deucher [Mon, 10 Oct 2016 16:42:33 +0000 (12:42 -0400)]
drm/radeon: clarify why we evict vram twice on suspend

Update the comment to explain why we do this.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: clarify why we evict vram twice on suspend
Alex Deucher [Mon, 10 Oct 2016 16:41:36 +0000 (12:41 -0400)]
drm/amdgpu: clarify why we evict vram twice on suspend

Update the comment to explain why we do this.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: used cached gca values for vi_read_register (v2)
Alex Deucher [Mon, 10 Oct 2016 16:05:32 +0000 (12:05 -0400)]
drm/amdgpu: used cached gca values for vi_read_register (v2)

Using the cached values has less latency for bare metal
and SR-IOV, and prevents reading back bogus values if the
engine is powergated.

v2: fix typo in tile idx calculation

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/gfx8: use cached raster config values in csb setup
Alex Deucher [Mon, 10 Oct 2016 15:17:58 +0000 (11:17 -0400)]
drm/amdgpu/gfx8: use cached raster config values in csb setup

Simplify the code and properly set the csb for harvest values.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/gfx8: cache rb config values
Alex Deucher [Mon, 10 Oct 2016 15:15:24 +0000 (11:15 -0400)]
drm/amdgpu/gfx8: cache rb config values

Needed when for SR-IOV and when PG is enabled.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: add additional cached gca config variables
Alex Deucher [Mon, 10 Oct 2016 14:56:21 +0000 (10:56 -0400)]
drm/amdgpu: add additional cached gca config variables

We need to cache some additional values to handle SR-IOV
and PG.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: use amdgpu_vm_get_pd_bo in the GEM code
Christian König [Wed, 28 Sep 2016 14:33:01 +0000 (16:33 +0200)]
drm/amdgpu: use amdgpu_vm_get_pd_bo in the GEM code

Instead of messing with the PD directly.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: move VM defines into amdgpu_vm.h
Christian König [Wed, 28 Sep 2016 13:41:50 +0000 (15:41 +0200)]
drm/amdgpu: move VM defines into amdgpu_vm.h

Only cleanup, no intended functional change.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: move fence and ring defines into amdgpu_ring.h
Christian König [Wed, 28 Sep 2016 13:33:18 +0000 (15:33 +0200)]
drm/amdgpu: move fence and ring defines into amdgpu_ring.h

Only cleanup, no intended functional change.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: move sync handling into a separate header
Christian König [Wed, 28 Sep 2016 10:36:44 +0000 (12:36 +0200)]
drm/amdgpu: move sync handling into a separate header

Only cleanup, no intended functional change.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: stop using a bo list entry for the VM PTs
Christian König [Wed, 28 Sep 2016 10:27:37 +0000 (12:27 +0200)]
drm/amdgpu: stop using a bo list entry for the VM PTs

Saves us a bit of memory.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: move PT validation back into VM code v2
Christian König [Wed, 28 Sep 2016 10:03:04 +0000 (12:03 +0200)]
drm/amdgpu: move PT validation back into VM code v2

Saves a bunch of CPU cycles when swapping things back in and
allows us to split the VM headers into a separate file.

v2: rename parameters

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: remove adev pointer from struct amdgpu_bo v2
Christian König [Thu, 15 Sep 2016 12:58:48 +0000 (14:58 +0200)]
drm/amdgpu: remove adev pointer from struct amdgpu_bo v2

It's completely pointless to have two pointers to the
device in the same structure.

v2: rename function to amdgpu_ttm_adev, fix typos

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/amdgpu: Enable UVD PG on Tonga
Tom St Denis [Fri, 30 Sep 2016 15:00:16 +0000 (11:00 -0400)]
drm/amd/amdgpu: Enable UVD PG on Tonga

Tested by reading tile/clk bits during load/idle.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: Enable UVD powergating for SMU7
Tom St Denis [Fri, 30 Sep 2016 14:58:44 +0000 (10:58 -0400)]
drm/amd/powerplay: Enable UVD powergating for SMU7

This patch enables detecting VCE/UVD PG features and fixes the
UVD powergate function.

Tested on a Tonga (by reading UVD tile/clk bits during playback/idle).

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: update the shadow PD together with the real one v2
Christian König [Fri, 16 Sep 2016 13:36:49 +0000 (15:36 +0200)]
drm/amdgpu: update the shadow PD together with the real one v2

Far less CPU cycles needed for this approach.

v2: fix typo

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu:wptr poll address of gfx8 is needed
Frank Min [Wed, 27 Apr 2016 11:44:56 +0000 (19:44 +0800)]
drm/amdgpu:wptr poll address of gfx8 is needed

for GFX8, gfx ring's wptr_addr is needed by SRIOV & CP for polling.

Signed-off-by: Frank Min <Frank.Min@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu:properly fix some JumpTable issues
Monk Liu [Tue, 27 Sep 2016 08:39:58 +0000 (16:39 +0800)]
drm/amdgpu:properly fix some JumpTable issues

we found some MEC ucode leads to IB test fail or even
ring test fail if Jump Table of it is not start in
FW bo with page aligned address, fixed by always make
JT address page aligned.

we don't need to patch JT2 for MEC2, because for VI,
MEC2 is a copy of MEC1, thus when converting fw_type
for MEC_JT2 we just return MEC1,hw can use the same
JT for both MEC1 & MEC2.

above two change fixed some ring/ib test failure issue
for some version of MEC ucode.

Signed-off-by: Frank Min <Frank.Min@amd.com>
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu:add MEC_STORAGE ucode id for sriov
Monk Liu [Mon, 26 Sep 2016 08:35:03 +0000 (16:35 +0800)]
drm/amdgpu:add MEC_STORAGE ucode id for sriov

for sriov, SMC need MEC_STORAGE reserved in fw bo.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Signed-off-by: Frank Min <frank.min@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu:add callback in cgs for sriov detect
Frank Min [Wed, 27 Apr 2016 12:04:58 +0000 (20:04 +0800)]
drm/amdgpu:add callback in cgs for sriov detect

Signed-off-by: Frank Min <Frank.Min@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu:fw bo should be in VRAM for SRIOV
Frank Min [Wed, 27 Apr 2016 12:02:57 +0000 (20:02 +0800)]
drm/amdgpu:fw bo should be in VRAM for SRIOV

for GTT memory SMC can only access it within PF space, which is not
used for SRIOV case, thus for SRIOV case, we let SMC use FB space for
ucode bo.

Signed-off-by: Frank Min <frank.min@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu:keep bo pinned in prefered domain
Frank Min [Wed, 27 Apr 2016 10:33:35 +0000 (18:33 +0800)]
drm/amdgpu:keep bo pinned in prefered domain

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