xref: /dflybsd-src/sys/dev/drm/radeon/btc_dpm.h (revision 7dcf36dc33228b5b368783d7b6f7ada00ee671d6)
157e252bfSMichael Neumann /*
257e252bfSMichael Neumann  * Copyright 2011 Advanced Micro Devices, Inc.
357e252bfSMichael Neumann  *
457e252bfSMichael Neumann  * Permission is hereby granted, free of charge, to any person obtaining a
557e252bfSMichael Neumann  * copy of this software and associated documentation files (the "Software"),
657e252bfSMichael Neumann  * to deal in the Software without restriction, including without limitation
757e252bfSMichael Neumann  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
857e252bfSMichael Neumann  * and/or sell copies of the Software, and to permit persons to whom the
957e252bfSMichael Neumann  * Software is furnished to do so, subject to the following conditions:
1057e252bfSMichael Neumann  *
1157e252bfSMichael Neumann  * The above copyright notice and this permission notice shall be included in
1257e252bfSMichael Neumann  * all copies or substantial portions of the Software.
1357e252bfSMichael Neumann  *
1457e252bfSMichael Neumann  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1557e252bfSMichael Neumann  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1657e252bfSMichael Neumann  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1757e252bfSMichael Neumann  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
1857e252bfSMichael Neumann  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1957e252bfSMichael Neumann  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2057e252bfSMichael Neumann  * OTHER DEALINGS IN THE SOFTWARE.
2157e252bfSMichael Neumann  *
2257e252bfSMichael Neumann  */
2357e252bfSMichael Neumann #ifndef __BTC_DPM_H__
2457e252bfSMichael Neumann #define __BTC_DPM_H__
2557e252bfSMichael Neumann 
2657e252bfSMichael Neumann #define BTC_RLP_UVD_DFLT                              20
2757e252bfSMichael Neumann #define BTC_RMP_UVD_DFLT                              50
2857e252bfSMichael Neumann #define BTC_LHP_UVD_DFLT                              50
2957e252bfSMichael Neumann #define BTC_LMP_UVD_DFLT                              20
3057e252bfSMichael Neumann #define BARTS_MGCGCGTSSMCTRL_DFLT                     0x81944000
3157e252bfSMichael Neumann #define TURKS_MGCGCGTSSMCTRL_DFLT                     0x6e944000
3257e252bfSMichael Neumann #define CAICOS_MGCGCGTSSMCTRL_DFLT                    0x46944040
3357e252bfSMichael Neumann #define BTC_CGULVPARAMETER_DFLT                       0x00040035
3457e252bfSMichael Neumann #define BTC_CGULVCONTROL_DFLT                         0x00001450
3557e252bfSMichael Neumann 
3657e252bfSMichael Neumann extern u32 btc_valid_sclk[40];
3757e252bfSMichael Neumann 
3857e252bfSMichael Neumann void btc_read_arb_registers(struct radeon_device *rdev);
3957e252bfSMichael Neumann void btc_program_mgcg_hw_sequence(struct radeon_device *rdev,
4057e252bfSMichael Neumann 				  const u32 *sequence, u32 count);
4157e252bfSMichael Neumann void btc_skip_blacklist_clocks(struct radeon_device *rdev,
4257e252bfSMichael Neumann 			       const u32 max_sclk, const u32 max_mclk,
4357e252bfSMichael Neumann 			       u32 *sclk, u32 *mclk);
4457e252bfSMichael Neumann void btc_adjust_clock_combinations(struct radeon_device *rdev,
4557e252bfSMichael Neumann 				   const struct radeon_clock_and_voltage_limits *max_limits,
4657e252bfSMichael Neumann 				   struct rv7xx_pl *pl);
4757e252bfSMichael Neumann void btc_apply_voltage_dependency_rules(struct radeon_clock_voltage_dependency_table *table,
4857e252bfSMichael Neumann 					u32 clock, u16 max_voltage, u16 *voltage);
49*7dcf36dcSFrançois Tigeot void btc_get_max_clock_from_voltage_dependency_table(struct radeon_clock_voltage_dependency_table *table,
50*7dcf36dcSFrançois Tigeot 						     u32 *max_clock);
5157e252bfSMichael Neumann void btc_apply_voltage_delta_rules(struct radeon_device *rdev,
5257e252bfSMichael Neumann 				   u16 max_vddc, u16 max_vddci,
5357e252bfSMichael Neumann 				   u16 *vddc, u16 *vddci);
5457e252bfSMichael Neumann bool btc_dpm_enabled(struct radeon_device *rdev);
5557e252bfSMichael Neumann int btc_reset_to_default(struct radeon_device *rdev);
5657e252bfSMichael Neumann void btc_notify_uvd_to_smc(struct radeon_device *rdev,
5757e252bfSMichael Neumann 			   struct radeon_ps *radeon_new_state);
5857e252bfSMichael Neumann 
5957e252bfSMichael Neumann #endif
60