Rex Zhu
53d3de140b
drm/amd/powerplay: fix bug that NULL checks are reversed.
...
&& was used instead of ||.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Ken Wang <Qingqing.Wang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2016-01-08 15:39:22 -05:00
Dan Carpenter
7c9574f262
drm/amd/powerplay: precedence bug in init_non_clock_fields()
...
The cast to uint8_t happens before the right shift so this always sets
.m3arb to zero. The cast is actually a no-op so we can remove it.
Fixes: 3bace35914 ('drm/amd/powerplay: add hardware manager sub-component')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2016-01-04 16:21:44 -05:00
Dan Carpenter
2500a3c9e0
drm/amd/powerplay: fix a reversed condition
...
This test was reversed so it would end up leading to a NULL dereference.
Fixes: 4630f0faae ('drm/amd/powerplay: add Carrizo smu support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2016-01-04 16:16:59 -05:00
Arnd Bergmann
6a53b31349
drm: powerplay: use div64_s64 instead of do_div
...
The newly added code for Fiji creates a correct compiler warning
about invalid use of the do_div macro:
In file included from powerplay/hwmgr/ppatomctrl.c:31:0:
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/ppevvmath.h: In function 'fDivide':
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/ppevvmath.h:382:89: warning: comparison of distinct pointer types lacks a cast
do_div(longlongX, longlongY); /*Q(32,32) divided by Q(16,16) = Q(16,16) Back to original format */
do_div() divides an unsigned 64-bit number by an unsigned 32-bit number.
The code instead wants to divide two signed 64-bit numbers, which is done
using the div64_s64 function.
Reviewed-by: Thierry Reding <treding@nvidia.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Fixes: 770911a3cf ("drm/amd/powerplay: add/update headers for Fiji SMU and DPM")
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2016-01-04 10:36:58 -05:00
Dave Airlie
fd3e14ffbd
Merge branch 'drm-next-4.5' of git://people.freedesktop.org/~agd5f/linux into drm-next
...
[airlied: fixup build problems on arm - added errno.h include]
* 'drm-next-4.5' of git://people.freedesktop.org/~agd5f/linux: (152 commits)
amd/powerplay: fix copy paste typo in hardwaremanager.c
amd/powerplay: disable powerplay by default initially
amd/powerplay: don't enable ucode fan control if vbios has no fan table
drm/amd/powerplay: show gpu load when print gpu performance for Cz. (v2)
drm/amd/powerplay: check whether need to enable thermal control. (v2)
drm/amd/powerplay: add point check to avoid NULL point hang.
drm/amdgpu/powerplay: Program a calculated value as Deep Sleep clock.
drm/amd/powerplay: Don't return an error if fan table is missing
drm/powerplay/hwmgr: log errors in tonga_hwmgr_backend_init
drm/powerplay: add debugging output to processpptables.c
drm/powerplay: add debugging output to tonga_processpptables.c
amd/powerplay: Add structures required to report configuration change
amd/powerplay: Fix get dal power level
amd\powerplay Implement get dal power level
drm/amd/powerplay: display gpu load when print performance for tonga.
drm/amdgpu/powerplay: enable sysfs and debugfs interfaces late
drm/amd/powerplay: move shared function of vi to hwmgr. (v2)
drm/amd/powerplay: check whether enable dpm in powerplay.
drm/amd/powerplay: fix bug that dpm funcs in debugfs/sysfs missing.
drm/amd/powerplay: fix boolreturn.cocci warnings
...
2015-12-23 14:15:26 +10:00
Alex Deucher
eafbbd9883
amd/powerplay: fix copy paste typo in hardwaremanager.c
...
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 17:13:05 -05:00
Alex Deucher
45b0cf54bc
amd/powerplay: don't enable ucode fan control if vbios has no fan table
...
Some systems have a single fan controlled by ACPI or some other
method.
Reviewed-by: Tom St Denis <tom.stdenis@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:58 -05:00
Rex Zhu
605ed21929
drm/amd/powerplay: show gpu load when print gpu performance for Cz. (v2)
...
Show GPU load in in the debugfs output.
v2: integrate Tom's optimization
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
2015-12-21 16:42:58 -05:00
Rex Zhu
cae9b9c81b
drm/amd/powerplay: check whether need to enable thermal control. (v2)
...
In I+A platform(skylake), it is controlled by intel.
v2: integrate Tom's fix
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
2015-12-21 16:42:57 -05:00
Rex Zhu
88b8dcbe21
drm/amd/powerplay: add point check to avoid NULL point hang.
...
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:57 -05:00
David Rokhvarg
c90e5d20fc
drm/amdgpu/powerplay: Program a calculated value as Deep Sleep clock.
...
This replaces programming of a hardcoded value.
Signed-off-by: David Rokhvarg <David.Rokhvarg@amd.com >
2015-12-21 16:42:56 -05:00
Alex Deucher
283b1a8bfb
drm/amd/powerplay: Don't return an error if fan table is missing
...
It's a valid configuration on some laptops.
Reviewed-by: Tom St Denis <tom.stdenis@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:56 -05:00
Alex Deucher
aa22ae4b1f
drm/powerplay/hwmgr: log errors in tonga_hwmgr_backend_init
...
Helpful in debugging init issues.
Reviewed-by: Tom St Denis <tom.stdenis@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:55 -05:00
Alex Deucher
a71e06d972
drm/powerplay: add debugging output to processpptables.c
...
To help track down init errors.
Reviewed-by: Tom St Denis <tom.stdenis@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:55 -05:00
Alex Deucher
1d5498c23e
drm/powerplay: add debugging output to tonga_processpptables.c
...
To help track down init errors.
Reviewed-by: Tom St Denis <tom.stdenis@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:54 -05:00
Eric Yang
14f634110f
amd/powerplay: Add structures required to report configuration change
...
Add required structures for amd_powerplay_display_configuration_change
Signed-off-by: Eric Yang <eric.yang2@amd.com >
2015-12-21 16:42:54 -05:00
Vitaly Prosyak
1c9a90820b
amd/powerplay: Fix get dal power level
...
Simplify data struct for get dal power level
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com >
2015-12-21 16:42:53 -05:00
Vitaly Prosyak
c4dd206be1
amd\powerplay Implement get dal power level
...
Implement get dal power level and simple clock info
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com >
2015-12-21 16:42:52 -05:00
Rex Zhu
9c5f8de6ef
drm/amd/powerplay: display gpu load when print performance for tonga.
...
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
2015-12-21 16:42:52 -05:00
Rex Zhu
17c00a2fed
drm/amd/powerplay: move shared function of vi to hwmgr. (v2)
...
v2: agd: rebase on upstream
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
2015-12-21 16:42:51 -05:00
kbuild test robot
195567e99b
drm/amd/powerplay: fix boolreturn.cocci warnings
...
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/ppatomctrl.c:475:10-11: WARNING: return of 0/1 in function 'atomctrl_lookup_gpio_pin' with return type bool
Return statements in functions returning bool should use
true/false instead of 1/0.
Generated by: scripts/coccinelle/misc/boolreturn.cocci
CC: yanyang1 <young.yang@amd.com >
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:49 -05:00
Eric Huang
db18ce397c
drm/amd/powerplay: add functions set/get_fan_control_mode in hwmgr for Fiji.
...
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com >
2015-12-21 16:42:49 -05:00
Eric Huang
9dcfc1936a
drm/amd/powerplay: add functions set/get_fan_control_mode in hwmgr for Tonga.
...
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com >
2015-12-21 16:42:48 -05:00
Eric Huang
7ae0a66134
drm/amd/powerplay: Fix a bug in fan control setting default mode for Tonga and Fiji.
...
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com >
2015-12-21 16:42:48 -05:00
Eric Huang
601038142f
drm/amd/powerplay: Add thermal protection support for Fiji.
...
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com >
2015-12-21 16:42:47 -05:00
Eric Huang
ea617bc9f9
drm/amd/powerplay: add display configeration changed function in hwmgr for Fiji.
...
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com >
2015-12-21 16:42:47 -05:00
Eric Huang
91c4c98155
drm/amd/powerplay: add multimedia power gating support for Fiji.
...
Acked-by: Jammy Zhou <Jammy.Zhou@amd.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com >
2015-12-21 16:42:44 -05:00
David Rokhvarg
6bd48d2404
drm/amd/powerplay: Add PPLib debug print macro.
...
- The macro is silent by default.
- Use the macro to print Display Configuration - related changes.
Signed-off-by: David Rokhvarg <David.Rokhvarg@amd.com >
2015-12-21 16:42:42 -05:00
Rex Zhu
0f8b106e11
drm/amd/powerplay: enable/disable NB pstate feature for Carrizo.
...
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Signed-off-by: David Rokhvarg <David.Rokhvarg@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
2015-12-21 16:42:42 -05:00
Rex Zhu
73afe62101
drm/amd/powerplay: enable set_cpu_power_state task. (v2)
...
v2: integrate Jammy's crash fix
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
2015-12-21 16:42:41 -05:00
Rex Zhu
7fb72a1fc0
drm/amd/powerplay: export interface to DAL to init/change display configuration.
...
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Signed-off-by: David Rokhvarg <David.Rokhvarg@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
2015-12-21 16:42:41 -05:00
Rex Zhu
aceae1bfd9
drm/amd/powerplay: add smc msg for NB P-State switch
...
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Signed-off-by: David Rokhvarg <David.Rokhvarg@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
2015-12-21 16:42:40 -05:00
Rex Zhu
73c9f22288
drm/amd/powerplay: add new function point in hwmgr.
...
1. for set_cpu_power_state
2. restore display configuration
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
2015-12-21 16:42:40 -05:00
Rex Zhu
c9fe74e68b
drm/amd/powerplay: fix warning of cast to pointer from integer of different size.
...
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:39 -05:00
rezhu
09b7a98622
drm/amd/powerplay: fix warning of cast to pointer from integer of different size.
...
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:38 -05:00
Alex Deucher
9c0bad9074
drm/amd/powerplay: implement smc state upload for CZ
...
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:38 -05:00
Alex Deucher
d39d5c2c9d
drm/amd/powerplay: add atomctrl function to calculate CZ sclk dividers
...
Use atombios to calculate the values.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:37 -05:00
Eric Huang
92b05d827d
drm/amd/powerplay: enable clock gating for Fiji.
...
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com >
2015-12-21 16:42:37 -05:00
Alex Deucher
0104aa21a9
drm/amd/powerplay/tonga: Add UVD DPM init
...
Load the UVD DPM state into the SMC.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:34 -05:00
Alex Deucher
464cea3e35
drm/amdgpu/powerplay/fiji: query supported pcie info from cgs (v2)
...
Rather than hardcode it.
v2: integrate spc fix from Rex
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:33 -05:00
Alex Deucher
834b694cc3
drm/amdgpu/powerplay/tonga: query supported pcie info from cgs (v2)
...
Rather than hardcode it.
v2: integrate spc fix from Rex
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:33 -05:00
Alex Deucher
16881da6c0
drm/amdgpu: extract pcie helpers to common header
...
These will be used by multiple powerplay drivers and
other IP modules.
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:30 -05:00
Alex Deucher
74c577b031
drm/amd/powerplay/fiji: enable pcie and mclk forcing for low
...
When forcing the lowest state also force mclk and pcie.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:30 -05:00
Alex Deucher
9fe1837d18
drm/amd/powerplay/tonga: enable pcie and mclk forcing for low
...
When forcing the lowest state also force mclk and pcie.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:29 -05:00
Rex Zhu
f4caf3e584
drm/amd/powerplay: refine the logic of whether need to update power state.
...
Better handle power state changes.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
2015-12-21 16:42:29 -05:00
Rex Zhu
e829ecdb15
drm/amd/powerplay: implement new funcs to check current states for tonga.
...
Implement the new callbacks for tonga.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
2015-12-21 16:42:28 -05:00
Rex Zhu
09b4c872fe
drm/amd/powerplay: add and export hwmgr interface to eventmgr to check hw states.
...
Interface between hwmgr and eventmgr.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
2015-12-21 16:42:28 -05:00
Rex Zhu
cac9a19919
drm/amdgpu/powerplay: implement fan control interface in amd_powerplay_funcs
...
This adds the interface needed to expose powerplay fan control to sysfs
via hwmon.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:26 -05:00
Rex Zhu
1e4854e96c
drm/amdgpu/powerplay: implement thermal control for tonga.
...
Implement thermal and fan control for tonga.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:25 -05:00
Rex Zhu
2dfea9cd1f
drm/amdgpu/powerplay: enable thermal interrupt task in eventmgr.
...
Add thermal handling to the event manager.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com >
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
2015-12-21 16:42:25 -05:00