#include <linux/kernel.h>
#include <linux/bitops.h>
#include <linux/err.h>
#include <linux/bug.h>
#include <linux/export.h>
#include <linux/clk-provider.h>
#include <linux/delay.h>
#include <linux/rational.h>
#include <linux/regmap.h>
#include <linux/math64.h>
#include <linux/minmax.h>
#include <linux/slab.h>
#include <asm/div64.h>
#include "clk-rcg.h"
#include "common.h"
#define CMD_REG …
#define CMD_UPDATE …
#define CMD_ROOT_EN …
#define CMD_DIRTY_CFG …
#define CMD_DIRTY_N …
#define CMD_DIRTY_M …
#define CMD_DIRTY_D …
#define CMD_ROOT_OFF …
#define CFG_REG …
#define CFG_SRC_DIV_SHIFT …
#define CFG_SRC_SEL_SHIFT …
#define CFG_SRC_SEL_MASK …
#define CFG_MODE_SHIFT …
#define CFG_MODE_MASK …
#define CFG_MODE_DUAL_EDGE …
#define CFG_HW_CLK_CTRL_MASK …
#define M_REG …
#define N_REG …
#define D_REG …
#define RCG_CFG_OFFSET(rcg) …
#define RCG_M_OFFSET(rcg) …
#define RCG_N_OFFSET(rcg) …
#define RCG_D_OFFSET(rcg) …
#define MAX_PERF_LEVEL …
#define SE_CMD_DFSR_OFFSET …
#define SE_CMD_DFS_EN …
#define SE_PERF_DFSR(level) …
#define SE_PERF_M_DFSR(level) …
#define SE_PERF_N_DFSR(level) …
enum freq_policy { … };
static int clk_rcg2_is_enabled(struct clk_hw *hw)
{ … }
static u8 __clk_rcg2_get_parent(struct clk_hw *hw, u32 cfg)
{ … }
static u8 clk_rcg2_get_parent(struct clk_hw *hw)
{ … }
static int update_config(struct clk_rcg2 *rcg)
{ … }
static int clk_rcg2_set_parent(struct clk_hw *hw, u8 index)
{ … }
static unsigned long
calc_rate(unsigned long rate, u32 m, u32 n, u32 mode, u32 hid_div)
{ … }
static unsigned long
__clk_rcg2_recalc_rate(struct clk_hw *hw, unsigned long parent_rate, u32 cfg)
{ … }
static unsigned long
clk_rcg2_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
{ … }
static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f,
struct clk_rate_request *req,
enum freq_policy policy)
{ … }
static const struct freq_conf *
__clk_rcg2_select_conf(struct clk_hw *hw, const struct freq_multi_tbl *f,
unsigned long req_rate)
{ … }
static int _freq_tbl_fm_determine_rate(struct clk_hw *hw, const struct freq_multi_tbl *f,
struct clk_rate_request *req)
{ … }
static int clk_rcg2_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{ … }
static int clk_rcg2_determine_floor_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{ … }
static int clk_rcg2_fm_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{ … }
static int __clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f,
u32 *_cfg)
{ … }
static int clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f)
{ … }
static int __clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate,
enum freq_policy policy)
{ … }
static int __clk_rcg2_fm_set_rate(struct clk_hw *hw, unsigned long rate)
{ … }
static int clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ … }
static int clk_rcg2_set_floor_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ … }
static int clk_rcg2_fm_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ … }
static int clk_rcg2_set_rate_and_parent(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate, u8 index)
{ … }
static int clk_rcg2_set_floor_rate_and_parent(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate, u8 index)
{ … }
static int clk_rcg2_fm_set_rate_and_parent(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate, u8 index)
{ … }
static int clk_rcg2_get_duty_cycle(struct clk_hw *hw, struct clk_duty *duty)
{ … }
static int clk_rcg2_set_duty_cycle(struct clk_hw *hw, struct clk_duty *duty)
{ … }
const struct clk_ops clk_rcg2_ops = …;
EXPORT_SYMBOL_GPL(…);
const struct clk_ops clk_rcg2_floor_ops = …;
EXPORT_SYMBOL_GPL(…);
const struct clk_ops clk_rcg2_fm_ops = …;
EXPORT_SYMBOL_GPL(…);
const struct clk_ops clk_rcg2_mux_closest_ops = …;
EXPORT_SYMBOL_GPL(…);
struct frac_entry { … };
static const struct frac_entry frac_table_675m[] = …;
static struct frac_entry frac_table_810m[] = …;
static int clk_edp_pixel_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ … }
static int clk_edp_pixel_set_rate_and_parent(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate, u8 index)
{ … }
static int clk_edp_pixel_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{ … }
const struct clk_ops clk_edp_pixel_ops = …;
EXPORT_SYMBOL_GPL(…);
static int clk_byte_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{ … }
static int clk_byte_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ … }
static int clk_byte_set_rate_and_parent(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate, u8 index)
{ … }
const struct clk_ops clk_byte_ops = …;
EXPORT_SYMBOL_GPL(…);
static int clk_byte2_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{ … }
static int clk_byte2_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ … }
static int clk_byte2_set_rate_and_parent(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate, u8 index)
{ … }
const struct clk_ops clk_byte2_ops = …;
EXPORT_SYMBOL_GPL(…);
static const struct frac_entry frac_table_pixel[] = …;
static int clk_pixel_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{ … }
static int clk_pixel_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ … }
static int clk_pixel_set_rate_and_parent(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate, u8 index)
{ … }
const struct clk_ops clk_pixel_ops = …;
EXPORT_SYMBOL_GPL(…);
static int clk_gfx3d_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{ … }
static int clk_gfx3d_set_rate_and_parent(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate, u8 index)
{ … }
static int clk_gfx3d_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ … }
const struct clk_ops clk_gfx3d_ops = …;
EXPORT_SYMBOL_GPL(…);
static int clk_rcg2_set_force_enable(struct clk_hw *hw)
{ … }
static int clk_rcg2_clear_force_enable(struct clk_hw *hw)
{ … }
static int
clk_rcg2_shared_force_enable_clear(struct clk_hw *hw, const struct freq_tbl *f)
{ … }
static int clk_rcg2_shared_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ … }
static int clk_rcg2_shared_set_rate_and_parent(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate, u8 index)
{ … }
static int clk_rcg2_shared_enable(struct clk_hw *hw)
{ … }
static void clk_rcg2_shared_disable(struct clk_hw *hw)
{ … }
static u8 clk_rcg2_shared_get_parent(struct clk_hw *hw)
{ … }
static int clk_rcg2_shared_set_parent(struct clk_hw *hw, u8 index)
{ … }
static unsigned long
clk_rcg2_shared_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
{ … }
static int clk_rcg2_shared_init(struct clk_hw *hw)
{ … }
const struct clk_ops clk_rcg2_shared_ops = …;
EXPORT_SYMBOL_GPL(…);
static void clk_rcg2_dfs_populate_freq(struct clk_hw *hw, unsigned int l,
struct freq_tbl *f)
{ … }
static int clk_rcg2_dfs_populate_freq_table(struct clk_rcg2 *rcg)
{ … }
static int clk_rcg2_dfs_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{ … }
static unsigned long
clk_rcg2_dfs_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
{ … }
static const struct clk_ops clk_rcg2_dfs_ops = …;
static int clk_rcg2_enable_dfs(const struct clk_rcg_dfs_data *data,
struct regmap *regmap)
{ … }
int qcom_cc_register_rcg_dfs(struct regmap *regmap,
const struct clk_rcg_dfs_data *rcgs, size_t len)
{ … }
EXPORT_SYMBOL_GPL(…);
static int clk_rcg2_dp_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ … }
static int clk_rcg2_dp_set_rate_and_parent(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate, u8 index)
{ … }
static int clk_rcg2_dp_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{ … }
const struct clk_ops clk_dp_ops = …;
EXPORT_SYMBOL_GPL(…);