1
2
3
4
5
6
7#include <linux/types.h>
8
9struct scpi_opp {
10 u32 freq;
11 u32 m_volt;
12} __packed;
13
14struct scpi_dvfs_info {
15 unsigned int count;
16 unsigned int latency;
17 struct scpi_opp *opps;
18};
19
20enum scpi_sensor_class {
21 TEMPERATURE,
22 VOLTAGE,
23 CURRENT,
24 POWER,
25 ENERGY,
26};
27
28struct scpi_sensor_info {
29 u16 sensor_id;
30 u8 class;
31 u8 trigger_type;
32 char name[20];
33} __packed;
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51struct scpi_ops {
52 u32 (*get_version)(void);
53 int (*clk_get_range)(u16, unsigned long *, unsigned long *);
54 unsigned long (*clk_get_val)(u16);
55 int (*clk_set_val)(u16, unsigned long);
56 int (*dvfs_get_idx)(u8);
57 int (*dvfs_set_idx)(u8, u8);
58 struct scpi_dvfs_info *(*dvfs_get_info)(u8);
59 int (*device_domain_id)(struct device *);
60 int (*get_transition_latency)(struct device *);
61 int (*add_opps_to_device)(struct device *);
62 int (*sensor_get_capability)(u16 *sensors);
63 int (*sensor_get_info)(u16 sensor_id, struct scpi_sensor_info *);
64 int (*sensor_get_value)(u16, u64 *);
65 int (*device_get_power_state)(u16);
66 int (*device_set_power_state)(u16, u8);
67};
68
69#if IS_REACHABLE(CONFIG_ARM_SCPI_PROTOCOL)
70struct scpi_ops *get_scpi_ops(void);
71#else
72static inline struct scpi_ops *get_scpi_ops(void) { return NULL; }
73#endif
74