clk-regmap.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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_REGMAP_H__
  14. #define __QCOM_CLK_REGMAP_H__
  15. #include <linux/clk-provider.h>
  16. struct regmap;
  17. /**
  18. * struct clk_regmap - regmap supporting clock
  19. * @hw: handle between common and hardware-specific interfaces
  20. * @regmap: regmap to use for regmap helpers and/or by providers
  21. * @enable_reg: register when using regmap enable/disable ops
  22. * @enable_mask: mask when using regmap enable/disable ops
  23. * @enable_is_inverted: flag to indicate set enable_mask bits to disable
  24. * when using clock_enable_regmap and friends APIs.
  25. */
  26. struct clk_regmap {
  27. struct clk_hw hw;
  28. struct regmap *regmap;
  29. unsigned int enable_reg;
  30. unsigned int enable_mask;
  31. bool enable_is_inverted;
  32. };
  33. #define to_clk_regmap(_hw) container_of(_hw, struct clk_regmap, hw)
  34. int clk_is_enabled_regmap(struct clk_hw *hw);
  35. int clk_enable_regmap(struct clk_hw *hw);
  36. void clk_disable_regmap(struct clk_hw *hw);
  37. struct clk *
  38. devm_clk_register_regmap(struct device *dev, struct clk_regmap *rclk);
  39. #endif