clk-gate.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (c) 2014 MediaTek Inc.
  3. * Author: James Liao <jamesjj.liao@mediatek.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #ifndef __DRV_CLK_GATE_H
  15. #define __DRV_CLK_GATE_H
  16. #include <linux/regmap.h>
  17. #include <linux/clk-provider.h>
  18. struct clk;
  19. struct mtk_clk_gate {
  20. struct clk_hw hw;
  21. struct regmap *regmap;
  22. int set_ofs;
  23. int clr_ofs;
  24. int sta_ofs;
  25. u8 bit;
  26. };
  27. static inline struct mtk_clk_gate *to_mtk_clk_gate(struct clk_hw *hw)
  28. {
  29. return container_of(hw, struct mtk_clk_gate, hw);
  30. }
  31. extern const struct clk_ops mtk_clk_gate_ops_setclr;
  32. extern const struct clk_ops mtk_clk_gate_ops_setclr_inv;
  33. extern const struct clk_ops mtk_clk_gate_ops_no_setclr;
  34. extern const struct clk_ops mtk_clk_gate_ops_no_setclr_inv;
  35. struct clk *mtk_clk_register_gate(
  36. const char *name,
  37. const char *parent_name,
  38. struct regmap *regmap,
  39. int set_ofs,
  40. int clr_ofs,
  41. int sta_ofs,
  42. u8 bit,
  43. const struct clk_ops *ops);
  44. #endif /* __DRV_CLK_GATE_H */