2018-07-16 05:54:32 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/* Copyright (c) 2014, The Linux Foundation. All rights reserved. */
|
|
|
|
|
2014-03-22 00:59:37 +00:00
|
|
|
#ifndef __QCOM_CLK_COMMON_H__
|
|
|
|
#define __QCOM_CLK_COMMON_H__
|
|
|
|
|
|
|
|
struct platform_device;
|
|
|
|
struct regmap_config;
|
|
|
|
struct clk_regmap;
|
|
|
|
struct qcom_reset_map;
|
2014-07-15 21:59:21 +00:00
|
|
|
struct regmap;
|
2014-09-04 20:21:50 +00:00
|
|
|
struct freq_tbl;
|
2015-03-20 16:30:26 +00:00
|
|
|
struct clk_hw;
|
2014-03-22 00:59:37 +00:00
|
|
|
|
2016-09-29 08:35:45 +00:00
|
|
|
#define PLL_LOCK_COUNT_SHIFT 8
|
|
|
|
#define PLL_LOCK_COUNT_MASK 0x3f
|
|
|
|
#define PLL_BIAS_COUNT_SHIFT 14
|
|
|
|
#define PLL_BIAS_COUNT_MASK 0x3f
|
|
|
|
#define PLL_VOTE_FSM_ENA BIT(20)
|
|
|
|
#define PLL_VOTE_FSM_RESET BIT(21)
|
|
|
|
|
2014-03-22 00:59:37 +00:00
|
|
|
struct qcom_cc_desc {
|
|
|
|
const struct regmap_config *config;
|
|
|
|
struct clk_regmap **clks;
|
|
|
|
size_t num_clks;
|
|
|
|
const struct qcom_reset_map *resets;
|
|
|
|
size_t num_resets;
|
2015-08-06 10:37:43 +00:00
|
|
|
struct gdsc **gdscs;
|
|
|
|
size_t num_gdscs;
|
2019-02-10 20:14:05 +00:00
|
|
|
struct clk_hw **clk_hws;
|
|
|
|
size_t num_clk_hws;
|
2014-03-22 00:59:37 +00:00
|
|
|
};
|
|
|
|
|
2017-12-13 14:25:33 +00:00
|
|
|
/**
|
|
|
|
* struct parent_map - map table for source select configuration values
|
|
|
|
* @src: source
|
|
|
|
* @cfg: configuration value
|
|
|
|
*/
|
|
|
|
struct parent_map {
|
|
|
|
u8 src;
|
|
|
|
u8 cfg;
|
|
|
|
};
|
|
|
|
|
2014-09-04 20:21:50 +00:00
|
|
|
extern const struct freq_tbl *qcom_find_freq(const struct freq_tbl *f,
|
|
|
|
unsigned long rate);
|
2016-11-21 06:37:11 +00:00
|
|
|
extern const struct freq_tbl *qcom_find_freq_floor(const struct freq_tbl *f,
|
|
|
|
unsigned long rate);
|
2016-09-29 08:35:45 +00:00
|
|
|
extern void
|
|
|
|
qcom_pll_set_fsm_mode(struct regmap *m, u32 reg, u8 bias_count, u8 lock_count);
|
2015-03-20 16:30:26 +00:00
|
|
|
extern int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map,
|
|
|
|
u8 src);
|
2014-09-04 20:21:50 +00:00
|
|
|
|
2015-10-27 00:11:32 +00:00
|
|
|
extern int qcom_cc_register_board_clk(struct device *dev, const char *path,
|
|
|
|
const char *name, unsigned long rate);
|
|
|
|
extern int qcom_cc_register_sleep_clk(struct device *dev);
|
|
|
|
|
2014-07-15 21:59:21 +00:00
|
|
|
extern struct regmap *qcom_cc_map(struct platform_device *pdev,
|
|
|
|
const struct qcom_cc_desc *desc);
|
|
|
|
extern int qcom_cc_really_probe(struct platform_device *pdev,
|
|
|
|
const struct qcom_cc_desc *desc,
|
|
|
|
struct regmap *regmap);
|
2014-03-22 00:59:37 +00:00
|
|
|
extern int qcom_cc_probe(struct platform_device *pdev,
|
|
|
|
const struct qcom_cc_desc *desc);
|
2019-07-26 09:23:28 +00:00
|
|
|
extern int qcom_cc_probe_by_index(struct platform_device *pdev, int index,
|
|
|
|
const struct qcom_cc_desc *desc);
|
2014-03-22 00:59:37 +00:00
|
|
|
|
|
|
|
#endif
|