ccu_frac.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (c) 2016 Maxime Ripard. 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 _CCU_FRAC_H_
  14. #define _CCU_FRAC_H_
  15. #include <linux/clk-provider.h>
  16. #include "ccu_common.h"
  17. struct _ccu_frac {
  18. u32 enable;
  19. u32 select;
  20. unsigned long rates[2];
  21. };
  22. #define _SUNXI_CCU_FRAC(_enable, _select, _rate1, _rate2) \
  23. { \
  24. .enable = _enable, \
  25. .select = _select, \
  26. .rates = { _rate1, _rate2 }, \
  27. }
  28. bool ccu_frac_helper_is_enabled(struct ccu_common *common,
  29. struct _ccu_frac *cf);
  30. void ccu_frac_helper_enable(struct ccu_common *common,
  31. struct _ccu_frac *cf);
  32. void ccu_frac_helper_disable(struct ccu_common *common,
  33. struct _ccu_frac *cf);
  34. bool ccu_frac_helper_has_rate(struct ccu_common *common,
  35. struct _ccu_frac *cf,
  36. unsigned long rate);
  37. unsigned long ccu_frac_helper_read_rate(struct ccu_common *common,
  38. struct _ccu_frac *cf);
  39. int ccu_frac_helper_set_rate(struct ccu_common *common,
  40. struct _ccu_frac *cf,
  41. unsigned long rate);
  42. #endif /* _CCU_FRAC_H_ */