scmi_clock.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2024, Rockchip, Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef RK_SCMI_CLOCK_H
  7. #define RK_SCMI_CLOCK_H
  8. #include <stdint.h>
  9. #include <common.h>
  10. struct rk_scmi_clock;
  11. struct rk_clk_ops {
  12. unsigned long (*get_rate)(struct rk_scmi_clock *clock);
  13. int (*set_rate)(struct rk_scmi_clock *clock, unsigned long rate);
  14. int (*set_status)(struct rk_scmi_clock *clock, bool status);
  15. };
  16. typedef struct rk_scmi_clock {
  17. char name[SCMI_CLOCK_NAME_LENGTH_MAX];
  18. uint8_t enable;
  19. int8_t is_security;
  20. uint32_t id;
  21. uint32_t rate_cnt;
  22. uint64_t cur_rate;
  23. uint32_t enable_count;
  24. const struct rk_clk_ops *clk_ops;
  25. unsigned long *rate_table;
  26. } rk_scmi_clock_t;
  27. /*
  28. * Return number of clock controllers for an agent
  29. * @agent_id: SCMI agent ID
  30. * Return number of clock controllers
  31. */
  32. size_t rockchip_scmi_clock_count(unsigned int agent_id);
  33. /*
  34. * Get rk_scmi_clock_t point
  35. * @agent_id: SCMI agent ID
  36. * @scmi_id: SCMI clock ID
  37. * Return a rk_scmi_clock_t point
  38. */
  39. rk_scmi_clock_t *rockchip_scmi_get_clock(uint32_t agent_id,
  40. uint32_t scmi_id);
  41. #endif /* RK_SCMI_CLOCK_H */