Squashed backup commit (no shallow-clone history issues) of xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2 branch, upstream commit 9eece662e) plus all fixes applied to get everpal_defconfig building clean against a modern (GCC 15.2.0) toolchain -- see the previous commit message on the lineage-23.2 branch (also in this repo history is not available here since this is a squashed snapshot; full incremental history lives in the local DL380 checkout and the upstream GitHub remote). Upstream: https://github.com/xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2)
128 lines
3.1 KiB
C
128 lines
3.1 KiB
C
/*
|
|
* Copyright (C) 2017 MediaTek Inc.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#ifndef __SCP_DVFS_H__
|
|
#define __SCP_DVFS_H__
|
|
|
|
#define SCP_DVFS_USE_PLL 1
|
|
|
|
#define PLL_ENABLE (1)
|
|
#define PLL_DISABLE (0)
|
|
|
|
#define DVFS_STATUS_OK (0)
|
|
#define DVFS_STATUS_BUSY (-1)
|
|
#define DVFS_REQUEST_SAME_CLOCK (-2)
|
|
#define DVFS_STATUS_ERR (-3)
|
|
#define DVFS_STATUS_TIMEOUT (-4)
|
|
#define DVFS_CLK_ERROR (-5)
|
|
#define DVFS_STATUS_CMD_FIX (-6)
|
|
#define DVFS_STATUS_CMD_LIMITED (-7)
|
|
#define DVFS_STATUS_CMD_DISABLE (-8)
|
|
|
|
enum scp_state_enum {
|
|
IN_DEBUG_IDLE = 1,
|
|
ENTERING_SLEEP = 2,
|
|
IN_SLEEP = 4,
|
|
ENTERING_ACTIVE = 8,
|
|
IN_ACTIVE = 16,
|
|
};
|
|
|
|
enum clk_opp_enum {
|
|
CLK_26M = 26,
|
|
CLK_O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K_BY_SLP_DISABLED_CNT,
|
|
SLP_DBG_CMD_BLOCK_BY_SLP_BUSY_CNT,
|
|
SLP_DBG_CMD_BLOCK_BY_HARD1_BUSY_CNT
|
|
};
|
|
|
|
struct mt_scp_pll_t {
|
|
struct clk *clk_mux;
|
|
struct clk *clk_pll0;
|
|
struct clk *clk_pll1;
|
|
struct clk *clk_pll2;
|
|
struct clk *clk_pll3;
|
|
struct clk *clk_pll4;
|
|
struct clk *clk_pll5;
|
|
struct clk *clk_pll6;
|
|
struct clk *clk_pll7;
|
|
};
|
|
|
|
extern int scp_pll_ctrl_set(unsigned int pll_ctrl_flag, unsigned int pll_sel);
|
|
extern int scp_set_pmic_vcore(unsigned int cur_freq);
|
|
extern unsigned int scp_get_dvfs_opp(void);
|
|
extern uint32_t scp_get_freq(void);
|
|
extern int scp_request_freq(void);
|
|
extern void scp_pll_mux_set(unsigned int pll_ctrl_flag);
|
|
extern void wait_scp_dvfs_init_done(void);
|
|
extern int __init scp_dvfs_init(void);
|
|
extern void __exit scp_dvfs_exit(void);
|
|
extern int scp_resource_req(unsigned int req_type);
|
|
extern void scp_slp_ipi_init(void);
|
|
extern void scp_vcore_request(unsigned int clk_opp);
|
|
|
|
/* scp dvfs variable*/
|
|
extern unsigned int scp_expected_freq;
|
|
extern unsigned int scp_current_freq;
|
|
extern spinlock_t scp_awake_spinlock;
|
|
extern int scp_dvfs_flag;
|
|
|
|
#endif /* __SCP_DVFS_H__ */
|