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