clk.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include <linux/clk.h>
  3. /*
  4. * The "inline" implementation of below helpers are only available when
  5. * CONFIG_HAVE_CLK or CONFIG_HAVE_CLK_PREPARE aren't set.
  6. */
  7. #ifndef CONFIG_HAVE_CLK
  8. struct clk *rust_helper_clk_get(struct device *dev, const char *id)
  9. {
  10. return clk_get(dev, id);
  11. }
  12. void rust_helper_clk_put(struct clk *clk)
  13. {
  14. clk_put(clk);
  15. }
  16. int rust_helper_clk_enable(struct clk *clk)
  17. {
  18. return clk_enable(clk);
  19. }
  20. void rust_helper_clk_disable(struct clk *clk)
  21. {
  22. clk_disable(clk);
  23. }
  24. unsigned long rust_helper_clk_get_rate(struct clk *clk)
  25. {
  26. return clk_get_rate(clk);
  27. }
  28. int rust_helper_clk_set_rate(struct clk *clk, unsigned long rate)
  29. {
  30. return clk_set_rate(clk, rate);
  31. }
  32. #endif
  33. #ifndef CONFIG_HAVE_CLK_PREPARE
  34. int rust_helper_clk_prepare(struct clk *clk)
  35. {
  36. return clk_prepare(clk);
  37. }
  38. void rust_helper_clk_unprepare(struct clk *clk)
  39. {
  40. clk_unprepare(clk);
  41. }
  42. #endif
  43. struct clk *rust_helper_clk_get_optional(struct device *dev, const char *id)
  44. {
  45. return clk_get_optional(dev, id);
  46. }
  47. int rust_helper_clk_prepare_enable(struct clk *clk)
  48. {
  49. return clk_prepare_enable(clk);
  50. }
  51. void rust_helper_clk_disable_unprepare(struct clk *clk)
  52. {
  53. clk_disable_unprepare(clk);
  54. }