162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright 2011 Advanced Micro Devices, Inc.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
562306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
662306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation
762306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
862306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
962306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
1262306a36Sopenharmony_ci * all copies or substantial portions of the Software.
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1562306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1662306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1762306a36Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
1862306a36Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1962306a36Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2062306a36Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci */
2362306a36Sopenharmony_ci#ifndef __RS780_DPM_H__
2462306a36Sopenharmony_ci#define __RS780_DPM_H__
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_cienum rs780_vddc_level {
2762306a36Sopenharmony_ci	RS780_VDDC_LEVEL_UNKNOWN = 0,
2862306a36Sopenharmony_ci	RS780_VDDC_LEVEL_LOW = 1,
2962306a36Sopenharmony_ci	RS780_VDDC_LEVEL_HIGH = 2,
3062306a36Sopenharmony_ci};
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_cistruct igp_power_info {
3362306a36Sopenharmony_ci	/* flags */
3462306a36Sopenharmony_ci	bool invert_pwm_required;
3562306a36Sopenharmony_ci	bool pwm_voltage_control;
3662306a36Sopenharmony_ci	bool voltage_control;
3762306a36Sopenharmony_ci	bool gfx_clock_gating;
3862306a36Sopenharmony_ci	/* stored values */
3962306a36Sopenharmony_ci	u32 system_config;
4062306a36Sopenharmony_ci	u32 bootup_uma_clk;
4162306a36Sopenharmony_ci	u16 max_voltage;
4262306a36Sopenharmony_ci	u16 min_voltage;
4362306a36Sopenharmony_ci	u16 boot_voltage;
4462306a36Sopenharmony_ci	u16 inter_voltage_low;
4562306a36Sopenharmony_ci	u16 inter_voltage_high;
4662306a36Sopenharmony_ci	u16 num_of_cycles_in_period;
4762306a36Sopenharmony_ci	/* variable */
4862306a36Sopenharmony_ci	int crtc_id;
4962306a36Sopenharmony_ci	int refresh_rate;
5062306a36Sopenharmony_ci};
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_cistruct igp_ps {
5362306a36Sopenharmony_ci	enum rs780_vddc_level min_voltage;
5462306a36Sopenharmony_ci	enum rs780_vddc_level max_voltage;
5562306a36Sopenharmony_ci	u32 sclk_low;
5662306a36Sopenharmony_ci	u32 sclk_high;
5762306a36Sopenharmony_ci	u32 flags;
5862306a36Sopenharmony_ci};
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci#define RS780_CGFTV_DFLT                 0x0303000f
6162306a36Sopenharmony_ci#define RS780_FBDIVTIMERVAL_DFLT         0x2710
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci#define RS780_FVTHROTUTC0_DFLT   0x04010040
6462306a36Sopenharmony_ci#define RS780_FVTHROTUTC1_DFLT   0x04010040
6562306a36Sopenharmony_ci#define RS780_FVTHROTUTC2_DFLT   0x04010040
6662306a36Sopenharmony_ci#define RS780_FVTHROTUTC3_DFLT   0x04010040
6762306a36Sopenharmony_ci#define RS780_FVTHROTUTC4_DFLT   0x04010040
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci#define RS780_FVTHROTDTC0_DFLT 0x04010040
7062306a36Sopenharmony_ci#define RS780_FVTHROTDTC1_DFLT 0x04010040
7162306a36Sopenharmony_ci#define RS780_FVTHROTDTC2_DFLT 0x04010040
7262306a36Sopenharmony_ci#define RS780_FVTHROTDTC3_DFLT 0x04010040
7362306a36Sopenharmony_ci#define RS780_FVTHROTDTC4_DFLT 0x04010040
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci#define RS780_FVTHROTFBUSREG0_DFLT       0x00001001
7662306a36Sopenharmony_ci#define RS780_FVTHROTFBUSREG1_DFLT       0x00002002
7762306a36Sopenharmony_ci#define RS780_FVTHROTFBDSREG0_DFLT       0x00004001
7862306a36Sopenharmony_ci#define RS780_FVTHROTFBDSREG1_DFLT       0x00020010
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci#define RS780_FVTHROTPWMUSREG0_DFLT      0x00002001
8162306a36Sopenharmony_ci#define RS780_FVTHROTPWMUSREG1_DFLT      0x00004003
8262306a36Sopenharmony_ci#define RS780_FVTHROTPWMDSREG0_DFLT      0x00002001
8362306a36Sopenharmony_ci#define RS780_FVTHROTPWMDSREG1_DFLT      0x00004003
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci#define RS780_FVTHROTPWMFBDIVRANGEREG0_DFLT  0x37
8662306a36Sopenharmony_ci#define RS780_FVTHROTPWMFBDIVRANGEREG1_DFLT  0x4b
8762306a36Sopenharmony_ci#define RS780_FVTHROTPWMFBDIVRANGEREG2_DFLT  0x8b
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci#define RS780D_FVTHROTPWMFBDIVRANGEREG0_DFLT  0x8b
9062306a36Sopenharmony_ci#define RS780D_FVTHROTPWMFBDIVRANGEREG1_DFLT  0x8c
9162306a36Sopenharmony_ci#define RS780D_FVTHROTPWMFBDIVRANGEREG2_DFLT  0xb5
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci#define RS880D_FVTHROTPWMFBDIVRANGEREG0_DFLT  0x8d
9462306a36Sopenharmony_ci#define RS880D_FVTHROTPWMFBDIVRANGEREG1_DFLT  0x8e
9562306a36Sopenharmony_ci#define RS880D_FVTHROTPWMFBDIVRANGEREG2_DFLT  0xBa
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci#define RS780_FVTHROTPWMRANGE0_GPIO_DFLT  0x1a
9862306a36Sopenharmony_ci#define RS780_FVTHROTPWMRANGE1_GPIO_DFLT  0x1a
9962306a36Sopenharmony_ci#define RS780_FVTHROTPWMRANGE2_GPIO_DFLT  0x0
10062306a36Sopenharmony_ci#define RS780_FVTHROTPWMRANGE3_GPIO_DFLT  0x0
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci#define RS780_SLOWCLKFEEDBACKDIV_DFLT 110
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci#define RS780_CGCLKGATING_DFLT           0x0000E204
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci#define RS780_DEFAULT_VCLK_FREQ  53300 /* 10 khz */
10762306a36Sopenharmony_ci#define RS780_DEFAULT_DCLK_FREQ  40000 /* 10 khz */
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci#endif
110