common.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (c) 2014, The Linux Foundation. All rights reserved.
  3. *
  4. * This software is licensed under the terms of the GNU General Public
  5. * License version 2, as published by the Free Software Foundation, and
  6. * may be copied, distributed, and modified under those terms.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef __QCOM_CLK_COMMON_H__
  14. #define __QCOM_CLK_COMMON_H__
  15. struct platform_device;
  16. struct regmap_config;
  17. struct clk_regmap;
  18. struct qcom_reset_map;
  19. struct regmap;
  20. struct freq_tbl;
  21. struct clk_hw;
  22. #define PLL_LOCK_COUNT_SHIFT 8
  23. #define PLL_LOCK_COUNT_MASK 0x3f
  24. #define PLL_BIAS_COUNT_SHIFT 14
  25. #define PLL_BIAS_COUNT_MASK 0x3f
  26. #define PLL_VOTE_FSM_ENA BIT(20)
  27. #define PLL_VOTE_FSM_RESET BIT(21)
  28. struct qcom_cc_desc {
  29. const struct regmap_config *config;
  30. struct clk_regmap **clks;
  31. size_t num_clks;
  32. const struct qcom_reset_map *resets;
  33. size_t num_resets;
  34. struct gdsc **gdscs;
  35. size_t num_gdscs;
  36. };
  37. /**
  38. * struct parent_map - map table for source select configuration values
  39. * @src: source
  40. * @cfg: configuration value
  41. */
  42. struct parent_map {
  43. u8 src;
  44. u8 cfg;
  45. };
  46. extern const struct freq_tbl *qcom_find_freq(const struct freq_tbl *f,
  47. unsigned long rate);
  48. extern const struct freq_tbl *qcom_find_freq_floor(const struct freq_tbl *f,
  49. unsigned long rate);
  50. extern void
  51. qcom_pll_set_fsm_mode(struct regmap *m, u32 reg, u8 bias_count, u8 lock_count);
  52. extern int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map,
  53. u8 src);
  54. extern int qcom_cc_register_board_clk(struct device *dev, const char *path,
  55. const char *name, unsigned long rate);
  56. extern int qcom_cc_register_sleep_clk(struct device *dev);
  57. extern struct regmap *qcom_cc_map(struct platform_device *pdev,
  58. const struct qcom_cc_desc *desc);
  59. extern int qcom_cc_really_probe(struct platform_device *pdev,
  60. const struct qcom_cc_desc *desc,
  61. struct regmap *regmap);
  62. extern int qcom_cc_probe(struct platform_device *pdev,
  63. const struct qcom_cc_desc *desc);
  64. #endif