18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright 2011 Advanced Micro Devices, Inc.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
128c2ecf20Sopenharmony_ci * all copies or substantial portions of the Software.
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
158c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
168c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
178c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
188c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
198c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
208c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci * Authors: Alex Deucher
238c2ecf20Sopenharmony_ci */
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#ifndef __RV6XX_DPM_H__
268c2ecf20Sopenharmony_ci#define __RV6XX_DPM_H__
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#include "r600_dpm.h"
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/* Represents a single SCLK step. */
318c2ecf20Sopenharmony_cistruct rv6xx_sclk_stepping
328c2ecf20Sopenharmony_ci{
338c2ecf20Sopenharmony_ci    u32 vco_frequency;
348c2ecf20Sopenharmony_ci    u32 post_divider;
358c2ecf20Sopenharmony_ci};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cistruct rv6xx_pm_hw_state {
388c2ecf20Sopenharmony_ci	u32 sclks[R600_PM_NUMBER_OF_ACTIVITY_LEVELS];
398c2ecf20Sopenharmony_ci	u32 mclks[R600_PM_NUMBER_OF_MCLKS];
408c2ecf20Sopenharmony_ci	u16 vddc[R600_PM_NUMBER_OF_VOLTAGE_LEVELS];
418c2ecf20Sopenharmony_ci	bool backbias[R600_PM_NUMBER_OF_VOLTAGE_LEVELS];
428c2ecf20Sopenharmony_ci	bool pcie_gen2[R600_PM_NUMBER_OF_ACTIVITY_LEVELS];
438c2ecf20Sopenharmony_ci	u8 high_sclk_index;
448c2ecf20Sopenharmony_ci	u8 medium_sclk_index;
458c2ecf20Sopenharmony_ci	u8 low_sclk_index;
468c2ecf20Sopenharmony_ci	u8 high_mclk_index;
478c2ecf20Sopenharmony_ci	u8 medium_mclk_index;
488c2ecf20Sopenharmony_ci	u8 low_mclk_index;
498c2ecf20Sopenharmony_ci	u8 high_vddc_index;
508c2ecf20Sopenharmony_ci	u8 medium_vddc_index;
518c2ecf20Sopenharmony_ci	u8 low_vddc_index;
528c2ecf20Sopenharmony_ci	u8 rp[R600_PM_NUMBER_OF_ACTIVITY_LEVELS];
538c2ecf20Sopenharmony_ci	u8 lp[R600_PM_NUMBER_OF_ACTIVITY_LEVELS];
548c2ecf20Sopenharmony_ci};
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_cistruct rv6xx_power_info {
578c2ecf20Sopenharmony_ci	/* flags */
588c2ecf20Sopenharmony_ci	bool voltage_control;
598c2ecf20Sopenharmony_ci	bool sclk_ss;
608c2ecf20Sopenharmony_ci	bool mclk_ss;
618c2ecf20Sopenharmony_ci	bool dynamic_ss;
628c2ecf20Sopenharmony_ci	bool dynamic_pcie_gen2;
638c2ecf20Sopenharmony_ci	bool thermal_protection;
648c2ecf20Sopenharmony_ci	bool display_gap;
658c2ecf20Sopenharmony_ci	bool gfx_clock_gating;
668c2ecf20Sopenharmony_ci	/* clk values */
678c2ecf20Sopenharmony_ci	u32 fb_div_scale;
688c2ecf20Sopenharmony_ci	u32 spll_ref_div;
698c2ecf20Sopenharmony_ci	u32 mpll_ref_div;
708c2ecf20Sopenharmony_ci	u32 bsu;
718c2ecf20Sopenharmony_ci	u32 bsp;
728c2ecf20Sopenharmony_ci	/* */
738c2ecf20Sopenharmony_ci	u32 active_auto_throttle_sources;
748c2ecf20Sopenharmony_ci	/* current power state */
758c2ecf20Sopenharmony_ci	u32 restricted_levels;
768c2ecf20Sopenharmony_ci	struct rv6xx_pm_hw_state hw;
778c2ecf20Sopenharmony_ci};
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_cistruct rv6xx_pl {
808c2ecf20Sopenharmony_ci	u32 sclk;
818c2ecf20Sopenharmony_ci	u32 mclk;
828c2ecf20Sopenharmony_ci	u16 vddc;
838c2ecf20Sopenharmony_ci	u32 flags;
848c2ecf20Sopenharmony_ci};
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_cistruct rv6xx_ps {
878c2ecf20Sopenharmony_ci	struct rv6xx_pl high;
888c2ecf20Sopenharmony_ci	struct rv6xx_pl medium;
898c2ecf20Sopenharmony_ci	struct rv6xx_pl low;
908c2ecf20Sopenharmony_ci};
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define RV6XX_DEFAULT_VCLK_FREQ  40000 /* 10 khz */
938c2ecf20Sopenharmony_ci#define RV6XX_DEFAULT_DCLK_FREQ  30000 /* 10 khz */
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci#endif
96