common.h 913 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. //
  3. // Spreadtrum clock infrastructure
  4. //
  5. // Copyright (C) 2017 Spreadtrum, Inc.
  6. // Author: Chunyan Zhang <[email protected]>
  7. #ifndef _SPRD_CLK_COMMON_H_
  8. #define _SPRD_CLK_COMMON_H_
  9. #include <linux/clk-provider.h>
  10. #include <linux/of_platform.h>
  11. #include <linux/regmap.h>
  12. struct device_node;
  13. struct sprd_clk_common {
  14. struct regmap *regmap;
  15. u32 reg;
  16. struct clk_hw hw;
  17. };
  18. struct sprd_clk_desc {
  19. struct sprd_clk_common **clk_clks;
  20. unsigned long num_clk_clks;
  21. struct clk_hw_onecell_data *hw_clks;
  22. };
  23. static inline struct sprd_clk_common *
  24. hw_to_sprd_clk_common(const struct clk_hw *hw)
  25. {
  26. return container_of(hw, struct sprd_clk_common, hw);
  27. }
  28. int sprd_clk_regmap_init(struct platform_device *pdev,
  29. const struct sprd_clk_desc *desc);
  30. int sprd_clk_probe(struct device *dev, struct clk_hw_onecell_data *clkhw);
  31. #endif /* _SPRD_CLK_COMMON_H_ */