Commit | Line | Data |
---|---|---|
4752544a | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
aa4f886f SH |
2 | /* |
3 | * SCMI Message Protocol driver header | |
4 | * | |
48dc16e2 | 5 | * Copyright (C) 2018-2021 ARM Ltd. |
aa4f886f | 6 | */ |
70771c69 SH |
7 | |
8 | #ifndef _LINUX_SCMI_PROTOCOL_H | |
9 | #define _LINUX_SCMI_PROTOCOL_H | |
10 | ||
1fe00b8b | 11 | #include <linux/bitfield.h> |
933c5044 | 12 | #include <linux/device.h> |
e7c215f3 | 13 | #include <linux/notifier.h> |
aa4f886f SH |
14 | #include <linux/types.h> |
15 | ||
4314f9f4 CM |
16 | #define SCMI_MAX_STR_SIZE 64 |
17 | #define SCMI_SHORT_NAME_MAX_SIZE 16 | |
18 | #define SCMI_MAX_NUM_RATES 16 | |
b6f20ff8 SH |
19 | |
20 | /** | |
21 | * struct scmi_revision_info - version information structure | |
22 | * | |
23 | * @major_ver: Major ABI version. Change here implies risk of backward | |
24 | * compatibility break. | |
25 | * @minor_ver: Minor ABI version. Change here implies new feature addition, | |
26 | * or compatible change in ABI. | |
27 | * @num_protocols: Number of protocols that are implemented, excluding the | |
28 | * base protocol. | |
29 | * @num_agents: Number of agents in the system. | |
30 | * @impl_ver: A vendor-specific implementation version. | |
31 | * @vendor_id: A vendor identifier(Null terminated ASCII string) | |
32 | * @sub_vendor_id: A sub-vendor identifier(Null terminated ASCII string) | |
33 | */ | |
34 | struct scmi_revision_info { | |
35 | u16 major_ver; | |
36 | u16 minor_ver; | |
37 | u8 num_protocols; | |
38 | u8 num_agents; | |
39 | u32 impl_ver; | |
4314f9f4 CM |
40 | char vendor_id[SCMI_SHORT_NAME_MAX_SIZE]; |
41 | char sub_vendor_id[SCMI_SHORT_NAME_MAX_SIZE]; | |
b6f20ff8 SH |
42 | }; |
43 | ||
5f6c6430 SH |
44 | struct scmi_clock_info { |
45 | char name[SCMI_MAX_STR_SIZE]; | |
18f295b7 | 46 | unsigned int enable_latency; |
5f6c6430 | 47 | bool rate_discrete; |
7aa75496 CM |
48 | bool rate_changed_notifications; |
49 | bool rate_change_requested_notifications; | |
5f6c6430 SH |
50 | union { |
51 | struct { | |
52 | int num_rates; | |
53 | u64 rates[SCMI_MAX_NUM_RATES]; | |
54 | } list; | |
55 | struct { | |
56 | u64 min_rate; | |
57 | u64 max_rate; | |
58 | u64 step_size; | |
59 | } range; | |
60 | }; | |
61 | }; | |
62 | ||
5e0fd202 LL |
63 | enum scmi_power_scale { |
64 | SCMI_POWER_BOGOWATTS, | |
65 | SCMI_POWER_MILLIWATTS, | |
66 | SCMI_POWER_MICROWATTS | |
67 | }; | |
68 | ||
a9e3fbfa | 69 | struct scmi_handle; |
23934efe CM |
70 | struct scmi_device; |
71 | struct scmi_protocol_handle; | |
a9e3fbfa | 72 | |
5f6c6430 | 73 | /** |
887281c7 | 74 | * struct scmi_clk_proto_ops - represents the various operations provided |
5f6c6430 SH |
75 | * by SCMI Clock Protocol |
76 | * | |
77 | * @count_get: get the count of clocks provided by SCMI | |
78 | * @info_get: get the information of the specified clock | |
79 | * @rate_get: request the current clock rate of a clock | |
80 | * @rate_set: set the clock rate of a clock | |
81 | * @enable: enables the specified clock | |
82 | * @disable: disables the specified clock | |
83 | */ | |
887281c7 CM |
84 | struct scmi_clk_proto_ops { |
85 | int (*count_get)(const struct scmi_protocol_handle *ph); | |
86 | ||
1ecb7d27 | 87 | const struct scmi_clock_info __must_check *(*info_get) |
887281c7 CM |
88 | (const struct scmi_protocol_handle *ph, u32 clk_id); |
89 | int (*rate_get)(const struct scmi_protocol_handle *ph, u32 clk_id, | |
90 | u64 *rate); | |
91 | int (*rate_set)(const struct scmi_protocol_handle *ph, u32 clk_id, | |
92 | u64 rate); | |
93 | int (*enable)(const struct scmi_protocol_handle *ph, u32 clk_id); | |
94 | int (*disable)(const struct scmi_protocol_handle *ph, u32 clk_id); | |
b7bd36f2 CM |
95 | int (*enable_atomic)(const struct scmi_protocol_handle *ph, u32 clk_id); |
96 | int (*disable_atomic)(const struct scmi_protocol_handle *ph, | |
97 | u32 clk_id); | |
887281c7 CM |
98 | }; |
99 | ||
a9e3fbfa | 100 | /** |
1fec5e6b | 101 | * struct scmi_perf_proto_ops - represents the various operations provided |
a9e3fbfa SH |
102 | * by SCMI Performance Protocol |
103 | * | |
104 | * @limits_set: sets limits on the performance level of a domain | |
105 | * @limits_get: gets limits on the performance level of a domain | |
106 | * @level_set: sets the performance level of a domain | |
107 | * @level_get: gets the performance level of a domain | |
108 | * @device_domain_id: gets the scmi domain id for a given device | |
7859e08c SH |
109 | * @transition_latency_get: gets the DVFS transition latency for a given device |
110 | * @device_opps_add: adds all the OPPs for a given device | |
a9e3fbfa SH |
111 | * @freq_set: sets the frequency for a given device using sustained frequency |
112 | * to sustained performance level mapping | |
113 | * @freq_get: gets the frequency for a given device using sustained frequency | |
114 | * to sustained performance level mapping | |
1a63fe9a QP |
115 | * @est_power_get: gets the estimated power cost for a given performance domain |
116 | * at a given frequency | |
52f83955 SH |
117 | * @fast_switch_possible: indicates if fast DVFS switching is possible or not |
118 | * for a given device | |
119 | * @power_scale_mw_get: indicates if the power values provided are in milliWatts | |
120 | * or in some other (abstract) scale | |
a9e3fbfa | 121 | */ |
1fec5e6b CM |
122 | struct scmi_perf_proto_ops { |
123 | int (*limits_set)(const struct scmi_protocol_handle *ph, u32 domain, | |
124 | u32 max_perf, u32 min_perf); | |
125 | int (*limits_get)(const struct scmi_protocol_handle *ph, u32 domain, | |
126 | u32 *max_perf, u32 *min_perf); | |
127 | int (*level_set)(const struct scmi_protocol_handle *ph, u32 domain, | |
128 | u32 level, bool poll); | |
129 | int (*level_get)(const struct scmi_protocol_handle *ph, u32 domain, | |
130 | u32 *level, bool poll); | |
131 | int (*device_domain_id)(struct device *dev); | |
132 | int (*transition_latency_get)(const struct scmi_protocol_handle *ph, | |
133 | struct device *dev); | |
134 | int (*device_opps_add)(const struct scmi_protocol_handle *ph, | |
135 | struct device *dev); | |
136 | int (*freq_set)(const struct scmi_protocol_handle *ph, u32 domain, | |
137 | unsigned long rate, bool poll); | |
138 | int (*freq_get)(const struct scmi_protocol_handle *ph, u32 domain, | |
139 | unsigned long *rate, bool poll); | |
140 | int (*est_power_get)(const struct scmi_protocol_handle *ph, u32 domain, | |
141 | unsigned long *rate, unsigned long *power); | |
142 | bool (*fast_switch_possible)(const struct scmi_protocol_handle *ph, | |
143 | struct device *dev); | |
5e0fd202 | 144 | enum scmi_power_scale (*power_scale_get)(const struct scmi_protocol_handle *ph); |
1fec5e6b CM |
145 | }; |
146 | ||
76a65509 | 147 | /** |
9bc8069c | 148 | * struct scmi_power_proto_ops - represents the various operations provided |
76a65509 SH |
149 | * by SCMI Power Protocol |
150 | * | |
151 | * @num_domains_get: get the count of power domains provided by SCMI | |
152 | * @name_get: gets the name of a power domain | |
153 | * @state_set: sets the power state of a power domain | |
154 | * @state_get: gets the power state of a power domain | |
155 | */ | |
9bc8069c CM |
156 | struct scmi_power_proto_ops { |
157 | int (*num_domains_get)(const struct scmi_protocol_handle *ph); | |
992be5d3 CM |
158 | const char *(*name_get)(const struct scmi_protocol_handle *ph, |
159 | u32 domain); | |
76a65509 SH |
160 | #define SCMI_POWER_STATE_TYPE_SHIFT 30 |
161 | #define SCMI_POWER_STATE_ID_MASK (BIT(28) - 1) | |
162 | #define SCMI_POWER_STATE_PARAM(type, id) \ | |
163 | ((((type) & BIT(0)) << SCMI_POWER_STATE_TYPE_SHIFT) | \ | |
164 | ((id) & SCMI_POWER_STATE_ID_MASK)) | |
165 | #define SCMI_POWER_STATE_GENERIC_ON SCMI_POWER_STATE_PARAM(0, 0) | |
166 | #define SCMI_POWER_STATE_GENERIC_OFF SCMI_POWER_STATE_PARAM(1, 0) | |
9bc8069c CM |
167 | int (*state_set)(const struct scmi_protocol_handle *ph, u32 domain, |
168 | u32 state); | |
169 | int (*state_get)(const struct scmi_protocol_handle *ph, u32 domain, | |
170 | u32 *state); | |
171 | }; | |
172 | ||
e2083d36 | 173 | /** |
52f83955 | 174 | * struct scmi_sensor_reading - represent a timestamped read |
e2083d36 CM |
175 | * |
176 | * Used by @reading_get_timestamped method. | |
177 | * | |
178 | * @value: The signed value sensor read. | |
179 | * @timestamp: An unsigned timestamp for the sensor read, as provided by | |
180 | * SCMI platform. Set to zero when not available. | |
181 | */ | |
182 | struct scmi_sensor_reading { | |
183 | long long value; | |
184 | unsigned long long timestamp; | |
185 | }; | |
186 | ||
1fe00b8b | 187 | /** |
52f83955 | 188 | * struct scmi_range_attrs - specifies a sensor or axis values' range |
1fe00b8b CM |
189 | * @min_range: The minimum value which can be represented by the sensor/axis. |
190 | * @max_range: The maximum value which can be represented by the sensor/axis. | |
191 | */ | |
192 | struct scmi_range_attrs { | |
193 | long long min_range; | |
194 | long long max_range; | |
195 | }; | |
196 | ||
197 | /** | |
52f83955 | 198 | * struct scmi_sensor_axis_info - describes one sensor axes |
1fe00b8b CM |
199 | * @id: The axes ID. |
200 | * @type: Axes type. Chosen amongst one of @enum scmi_sensor_class. | |
201 | * @scale: Power-of-10 multiplier applied to the axis unit. | |
202 | * @name: NULL-terminated string representing axes name as advertised by | |
203 | * SCMI platform. | |
204 | * @extended_attrs: Flag to indicate the presence of additional extended | |
205 | * attributes for this axes. | |
206 | * @resolution: Extended attribute representing the resolution of the axes. | |
207 | * Set to 0 if not reported by this axes. | |
208 | * @exponent: Extended attribute representing the power-of-10 multiplier that | |
209 | * is applied to the resolution field. Set to 0 if not reported by | |
210 | * this axes. | |
211 | * @attrs: Extended attributes representing minimum and maximum values | |
212 | * measurable by this axes. Set to 0 if not reported by this sensor. | |
213 | */ | |
214 | struct scmi_sensor_axis_info { | |
215 | unsigned int id; | |
216 | unsigned int type; | |
217 | int scale; | |
218 | char name[SCMI_MAX_STR_SIZE]; | |
219 | bool extended_attrs; | |
220 | unsigned int resolution; | |
221 | int exponent; | |
222 | struct scmi_range_attrs attrs; | |
223 | }; | |
224 | ||
225 | /** | |
52f83955 SH |
226 | * struct scmi_sensor_intervals_info - describes number and type of available |
227 | * update intervals | |
1fe00b8b CM |
228 | * @segmented: Flag for segmented intervals' representation. When True there |
229 | * will be exactly 3 intervals in @desc, with each entry | |
230 | * representing a member of a segment in this order: | |
231 | * {lowest update interval, highest update interval, step size} | |
232 | * @count: Number of intervals described in @desc. | |
233 | * @desc: Array of @count interval descriptor bitmask represented as detailed in | |
234 | * the SCMI specification: it can be accessed using the accompanying | |
235 | * macros. | |
236 | * @prealloc_pool: A minimal preallocated pool of desc entries used to avoid | |
237 | * lesser-than-64-bytes dynamic allocation for small @count | |
238 | * values. | |
239 | */ | |
240 | struct scmi_sensor_intervals_info { | |
241 | bool segmented; | |
242 | unsigned int count; | |
243 | #define SCMI_SENS_INTVL_SEGMENT_LOW 0 | |
244 | #define SCMI_SENS_INTVL_SEGMENT_HIGH 1 | |
245 | #define SCMI_SENS_INTVL_SEGMENT_STEP 2 | |
246 | unsigned int *desc; | |
247 | #define SCMI_SENS_INTVL_GET_SECS(x) FIELD_GET(GENMASK(20, 5), (x)) | |
248 | #define SCMI_SENS_INTVL_GET_EXP(x) \ | |
249 | ({ \ | |
250 | int __signed_exp = FIELD_GET(GENMASK(4, 0), (x)); \ | |
251 | \ | |
252 | if (__signed_exp & BIT(4)) \ | |
253 | __signed_exp |= GENMASK(31, 5); \ | |
254 | __signed_exp; \ | |
255 | }) | |
256 | #define SCMI_MAX_PREALLOC_POOL 16 | |
257 | unsigned int prealloc_pool[SCMI_MAX_PREALLOC_POOL]; | |
258 | }; | |
259 | ||
260 | /** | |
261 | * struct scmi_sensor_info - represents information related to one of the | |
262 | * available sensors. | |
263 | * @id: Sensor ID. | |
264 | * @type: Sensor type. Chosen amongst one of @enum scmi_sensor_class. | |
265 | * @scale: Power-of-10 multiplier applied to the sensor unit. | |
266 | * @num_trip_points: Number of maximum configurable trip points. | |
267 | * @async: Flag for asynchronous read support. | |
268 | * @update: Flag for continuouos update notification support. | |
269 | * @timestamped: Flag for timestamped read support. | |
270 | * @tstamp_scale: Power-of-10 multiplier applied to the sensor timestamps to | |
271 | * represent it in seconds. | |
272 | * @num_axis: Number of supported axis if any. Reported as 0 for scalar sensors. | |
273 | * @axis: Pointer to an array of @num_axis descriptors. | |
274 | * @intervals: Descriptor of available update intervals. | |
275 | * @sensor_config: A bitmask reporting the current sensor configuration as | |
276 | * detailed in the SCMI specification: it can accessed and | |
277 | * modified through the accompanying macros. | |
278 | * @name: NULL-terminated string representing sensor name as advertised by | |
279 | * SCMI platform. | |
280 | * @extended_scalar_attrs: Flag to indicate the presence of additional extended | |
281 | * attributes for this sensor. | |
282 | * @sensor_power: Extended attribute representing the average power | |
283 | * consumed by the sensor in microwatts (uW) when it is active. | |
284 | * Reported here only for scalar sensors. | |
285 | * Set to 0 if not reported by this sensor. | |
286 | * @resolution: Extended attribute representing the resolution of the sensor. | |
287 | * Reported here only for scalar sensors. | |
288 | * Set to 0 if not reported by this sensor. | |
289 | * @exponent: Extended attribute representing the power-of-10 multiplier that is | |
290 | * applied to the resolution field. | |
291 | * Reported here only for scalar sensors. | |
292 | * Set to 0 if not reported by this sensor. | |
293 | * @scalar_attrs: Extended attributes representing minimum and maximum | |
294 | * measurable values by this sensor. | |
295 | * Reported here only for scalar sensors. | |
296 | * Set to 0 if not reported by this sensor. | |
297 | */ | |
5179c523 | 298 | struct scmi_sensor_info { |
1fe00b8b CM |
299 | unsigned int id; |
300 | unsigned int type; | |
301 | int scale; | |
302 | unsigned int num_trip_points; | |
d09aac0e | 303 | bool async; |
1fe00b8b CM |
304 | bool update; |
305 | bool timestamped; | |
306 | int tstamp_scale; | |
307 | unsigned int num_axis; | |
308 | struct scmi_sensor_axis_info *axis; | |
309 | struct scmi_sensor_intervals_info intervals; | |
7b83c5f4 CM |
310 | unsigned int sensor_config; |
311 | #define SCMI_SENS_CFG_UPDATE_SECS_MASK GENMASK(31, 16) | |
312 | #define SCMI_SENS_CFG_GET_UPDATE_SECS(x) \ | |
313 | FIELD_GET(SCMI_SENS_CFG_UPDATE_SECS_MASK, (x)) | |
314 | ||
315 | #define SCMI_SENS_CFG_UPDATE_EXP_MASK GENMASK(15, 11) | |
316 | #define SCMI_SENS_CFG_GET_UPDATE_EXP(x) \ | |
317 | ({ \ | |
318 | int __signed_exp = \ | |
319 | FIELD_GET(SCMI_SENS_CFG_UPDATE_EXP_MASK, (x)); \ | |
320 | \ | |
321 | if (__signed_exp & BIT(4)) \ | |
322 | __signed_exp |= GENMASK(31, 5); \ | |
323 | __signed_exp; \ | |
324 | }) | |
325 | ||
326 | #define SCMI_SENS_CFG_ROUND_MASK GENMASK(10, 9) | |
327 | #define SCMI_SENS_CFG_ROUND_AUTO 2 | |
328 | #define SCMI_SENS_CFG_ROUND_UP 1 | |
329 | #define SCMI_SENS_CFG_ROUND_DOWN 0 | |
330 | ||
331 | #define SCMI_SENS_CFG_TSTAMP_ENABLED_MASK BIT(1) | |
332 | #define SCMI_SENS_CFG_TSTAMP_ENABLE 1 | |
333 | #define SCMI_SENS_CFG_TSTAMP_DISABLE 0 | |
334 | #define SCMI_SENS_CFG_IS_TSTAMP_ENABLED(x) \ | |
335 | FIELD_GET(SCMI_SENS_CFG_TSTAMP_ENABLED_MASK, (x)) | |
336 | ||
337 | #define SCMI_SENS_CFG_SENSOR_ENABLED_MASK BIT(0) | |
338 | #define SCMI_SENS_CFG_SENSOR_ENABLE 1 | |
339 | #define SCMI_SENS_CFG_SENSOR_DISABLE 0 | |
5179c523 | 340 | char name[SCMI_MAX_STR_SIZE]; |
7b83c5f4 | 341 | #define SCMI_SENS_CFG_IS_ENABLED(x) FIELD_GET(BIT(0), (x)) |
1fe00b8b CM |
342 | bool extended_scalar_attrs; |
343 | unsigned int sensor_power; | |
344 | unsigned int resolution; | |
345 | int exponent; | |
346 | struct scmi_range_attrs scalar_attrs; | |
5179c523 SH |
347 | }; |
348 | ||
349 | /* | |
350 | * Partial list from Distributed Management Task Force (DMTF) specification: | |
351 | * DSP0249 (Platform Level Data Model specification) | |
352 | */ | |
353 | enum scmi_sensor_class { | |
354 | NONE = 0x0, | |
607a4672 | 355 | UNSPEC = 0x1, |
5179c523 | 356 | TEMPERATURE_C = 0x2, |
607a4672 SH |
357 | TEMPERATURE_F = 0x3, |
358 | TEMPERATURE_K = 0x4, | |
5179c523 SH |
359 | VOLTAGE = 0x5, |
360 | CURRENT = 0x6, | |
361 | POWER = 0x7, | |
362 | ENERGY = 0x8, | |
607a4672 SH |
363 | CHARGE = 0x9, |
364 | VOLTAMPERE = 0xA, | |
365 | NITS = 0xB, | |
366 | LUMENS = 0xC, | |
367 | LUX = 0xD, | |
368 | CANDELAS = 0xE, | |
369 | KPA = 0xF, | |
370 | PSI = 0x10, | |
371 | NEWTON = 0x11, | |
372 | CFM = 0x12, | |
373 | RPM = 0x13, | |
374 | HERTZ = 0x14, | |
375 | SECS = 0x15, | |
376 | MINS = 0x16, | |
377 | HOURS = 0x17, | |
378 | DAYS = 0x18, | |
379 | WEEKS = 0x19, | |
380 | MILS = 0x1A, | |
381 | INCHES = 0x1B, | |
382 | FEET = 0x1C, | |
383 | CUBIC_INCHES = 0x1D, | |
384 | CUBIC_FEET = 0x1E, | |
385 | METERS = 0x1F, | |
386 | CUBIC_CM = 0x20, | |
387 | CUBIC_METERS = 0x21, | |
388 | LITERS = 0x22, | |
389 | FLUID_OUNCES = 0x23, | |
390 | RADIANS = 0x24, | |
391 | STERADIANS = 0x25, | |
392 | REVOLUTIONS = 0x26, | |
393 | CYCLES = 0x27, | |
394 | GRAVITIES = 0x28, | |
395 | OUNCES = 0x29, | |
396 | POUNDS = 0x2A, | |
397 | FOOT_POUNDS = 0x2B, | |
398 | OUNCE_INCHES = 0x2C, | |
399 | GAUSS = 0x2D, | |
400 | GILBERTS = 0x2E, | |
401 | HENRIES = 0x2F, | |
402 | FARADS = 0x30, | |
403 | OHMS = 0x31, | |
404 | SIEMENS = 0x32, | |
405 | MOLES = 0x33, | |
406 | BECQUERELS = 0x34, | |
407 | PPM = 0x35, | |
408 | DECIBELS = 0x36, | |
409 | DBA = 0x37, | |
410 | DBC = 0x38, | |
411 | GRAYS = 0x39, | |
412 | SIEVERTS = 0x3A, | |
413 | COLOR_TEMP_K = 0x3B, | |
414 | BITS = 0x3C, | |
415 | BYTES = 0x3D, | |
416 | WORDS = 0x3E, | |
417 | DWORDS = 0x3F, | |
418 | QWORDS = 0x40, | |
419 | PERCENTAGE = 0x41, | |
420 | PASCALS = 0x42, | |
421 | COUNTS = 0x43, | |
422 | GRAMS = 0x44, | |
423 | NEWTON_METERS = 0x45, | |
424 | HITS = 0x46, | |
425 | MISSES = 0x47, | |
426 | RETRIES = 0x48, | |
427 | OVERRUNS = 0x49, | |
428 | UNDERRUNS = 0x4A, | |
429 | COLLISIONS = 0x4B, | |
430 | PACKETS = 0x4C, | |
431 | MESSAGES = 0x4D, | |
432 | CHARS = 0x4E, | |
433 | ERRORS = 0x4F, | |
434 | CORRECTED_ERRS = 0x50, | |
435 | UNCORRECTABLE_ERRS = 0x51, | |
436 | SQ_MILS = 0x52, | |
437 | SQ_INCHES = 0x53, | |
438 | SQ_FEET = 0x54, | |
439 | SQ_CM = 0x55, | |
440 | SQ_METERS = 0x56, | |
1fe00b8b CM |
441 | RADIANS_SEC = 0x57, |
442 | BPM = 0x58, | |
443 | METERS_SEC_SQUARED = 0x59, | |
444 | METERS_SEC = 0x5A, | |
445 | CUBIC_METERS_SEC = 0x5B, | |
446 | MM_MERCURY = 0x5C, | |
447 | RADIANS_SEC_SQUARED = 0x5D, | |
448 | OEM_UNIT = 0xFF | |
5179c523 SH |
449 | }; |
450 | ||
451 | /** | |
9694a7f6 | 452 | * struct scmi_sensor_proto_ops - represents the various operations provided |
5179c523 SH |
453 | * by SCMI Sensor Protocol |
454 | * | |
455 | * @count_get: get the count of sensors provided by SCMI | |
456 | * @info_get: get the information of the specified sensor | |
9eefa43a | 457 | * @trip_point_config: selects and configures a trip-point of interest |
5179c523 | 458 | * @reading_get: gets the current value of the sensor |
e2083d36 CM |
459 | * @reading_get_timestamped: gets the current value and timestamp, when |
460 | * available, of the sensor. (as of v3.0 spec) | |
461 | * Supports multi-axis sensors for sensors which | |
462 | * supports it and if the @reading array size of | |
463 | * @count entry equals the sensor num_axis | |
7b83c5f4 CM |
464 | * @config_get: Get sensor current configuration |
465 | * @config_set: Set sensor current configuration | |
5179c523 | 466 | */ |
9694a7f6 CM |
467 | struct scmi_sensor_proto_ops { |
468 | int (*count_get)(const struct scmi_protocol_handle *ph); | |
1ecb7d27 | 469 | const struct scmi_sensor_info __must_check *(*info_get) |
9694a7f6 CM |
470 | (const struct scmi_protocol_handle *ph, u32 sensor_id); |
471 | int (*trip_point_config)(const struct scmi_protocol_handle *ph, | |
472 | u32 sensor_id, u8 trip_id, u64 trip_value); | |
473 | int (*reading_get)(const struct scmi_protocol_handle *ph, u32 sensor_id, | |
474 | u64 *value); | |
475 | int (*reading_get_timestamped)(const struct scmi_protocol_handle *ph, | |
476 | u32 sensor_id, u8 count, | |
477 | struct scmi_sensor_reading *readings); | |
478 | int (*config_get)(const struct scmi_protocol_handle *ph, | |
479 | u32 sensor_id, u32 *sensor_config); | |
480 | int (*config_set)(const struct scmi_protocol_handle *ph, | |
481 | u32 sensor_id, u32 sensor_config); | |
482 | }; | |
483 | ||
95a15d80 | 484 | /** |
7e029344 | 485 | * struct scmi_reset_proto_ops - represents the various operations provided |
95a15d80 SH |
486 | * by SCMI Reset Protocol |
487 | * | |
488 | * @num_domains_get: get the count of reset domains provided by SCMI | |
489 | * @name_get: gets the name of a reset domain | |
490 | * @latency_get: gets the reset latency for the specified reset domain | |
491 | * @reset: resets the specified reset domain | |
492 | * @assert: explicitly assert reset signal of the specified reset domain | |
493 | * @deassert: explicitly deassert reset signal of the specified reset domain | |
494 | */ | |
7e029344 CM |
495 | struct scmi_reset_proto_ops { |
496 | int (*num_domains_get)(const struct scmi_protocol_handle *ph); | |
992be5d3 CM |
497 | const char *(*name_get)(const struct scmi_protocol_handle *ph, |
498 | u32 domain); | |
7e029344 CM |
499 | int (*latency_get)(const struct scmi_protocol_handle *ph, u32 domain); |
500 | int (*reset)(const struct scmi_protocol_handle *ph, u32 domain); | |
501 | int (*assert)(const struct scmi_protocol_handle *ph, u32 domain); | |
502 | int (*deassert)(const struct scmi_protocol_handle *ph, u32 domain); | |
503 | }; | |
504 | ||
4c74701b CM |
505 | enum scmi_voltage_level_mode { |
506 | SCMI_VOLTAGE_LEVEL_SET_AUTO, | |
507 | SCMI_VOLTAGE_LEVEL_SET_SYNC, | |
508 | }; | |
509 | ||
2add5cac CM |
510 | /** |
511 | * struct scmi_voltage_info - describe one available SCMI Voltage Domain | |
512 | * | |
513 | * @id: the domain ID as advertised by the platform | |
514 | * @segmented: defines the layout of the entries of array @levels_uv. | |
515 | * - when True the entries are to be interpreted as triplets, | |
516 | * each defining a segment representing a range of equally | |
517 | * space voltages: <lowest_volts>, <highest_volt>, <step_uV> | |
518 | * - when False the entries simply represent a single discrete | |
519 | * supported voltage level | |
520 | * @negative_volts_allowed: True if any of the entries of @levels_uv represent | |
521 | * a negative voltage. | |
4c74701b CM |
522 | * @async_level_set: True when the voltage domain supports asynchronous level |
523 | * set commands. | |
2add5cac CM |
524 | * @name: name assigned to the Voltage Domain by platform |
525 | * @num_levels: number of total entries in @levels_uv. | |
526 | * @levels_uv: array of entries describing the available voltage levels for | |
527 | * this domain. | |
528 | */ | |
529 | struct scmi_voltage_info { | |
530 | unsigned int id; | |
531 | bool segmented; | |
532 | bool negative_volts_allowed; | |
4c74701b | 533 | bool async_level_set; |
2add5cac CM |
534 | char name[SCMI_MAX_STR_SIZE]; |
535 | unsigned int num_levels; | |
536 | #define SCMI_VOLTAGE_SEGMENT_LOW 0 | |
537 | #define SCMI_VOLTAGE_SEGMENT_HIGH 1 | |
538 | #define SCMI_VOLTAGE_SEGMENT_STEP 2 | |
539 | int *levels_uv; | |
540 | }; | |
541 | ||
542 | /** | |
fe4894d9 | 543 | * struct scmi_voltage_proto_ops - represents the various operations provided |
2add5cac CM |
544 | * by SCMI Voltage Protocol |
545 | * | |
546 | * @num_domains_get: get the count of voltage domains provided by SCMI | |
547 | * @info_get: get the information of the specified domain | |
548 | * @config_set: set the config for the specified domain | |
549 | * @config_get: get the config of the specified domain | |
550 | * @level_set: set the voltage level for the specified domain | |
551 | * @level_get: get the voltage level of the specified domain | |
552 | */ | |
fe4894d9 CM |
553 | struct scmi_voltage_proto_ops { |
554 | int (*num_domains_get)(const struct scmi_protocol_handle *ph); | |
555 | const struct scmi_voltage_info __must_check *(*info_get) | |
556 | (const struct scmi_protocol_handle *ph, u32 domain_id); | |
557 | int (*config_set)(const struct scmi_protocol_handle *ph, u32 domain_id, | |
558 | u32 config); | |
559 | #define SCMI_VOLTAGE_ARCH_STATE_OFF 0x0 | |
560 | #define SCMI_VOLTAGE_ARCH_STATE_ON 0x7 | |
561 | int (*config_get)(const struct scmi_protocol_handle *ph, u32 domain_id, | |
562 | u32 *config); | |
563 | int (*level_set)(const struct scmi_protocol_handle *ph, u32 domain_id, | |
4c74701b | 564 | enum scmi_voltage_level_mode mode, s32 volt_uV); |
fe4894d9 CM |
565 | int (*level_get)(const struct scmi_protocol_handle *ph, u32 domain_id, |
566 | s32 *volt_uV); | |
567 | }; | |
568 | ||
0316f99c CM |
569 | /** |
570 | * struct scmi_powercap_info - Describe one available Powercap domain | |
571 | * | |
572 | * @id: Domain ID as advertised by the platform. | |
573 | * @notify_powercap_cap_change: CAP change notification support. | |
574 | * @notify_powercap_measurement_change: MEASUREMENTS change notifications | |
575 | * support. | |
576 | * @async_powercap_cap_set: Asynchronous CAP set support. | |
577 | * @powercap_cap_config: CAP configuration support. | |
578 | * @powercap_monitoring: Monitoring (measurements) support. | |
579 | * @powercap_pai_config: PAI configuration support. | |
580 | * @powercap_scale_mw: Domain reports power data in milliwatt units. | |
581 | * @powercap_scale_uw: Domain reports power data in microwatt units. | |
582 | * Note that, when both @powercap_scale_mw and | |
583 | * @powercap_scale_uw are set to false, the domain | |
584 | * reports power data on an abstract linear scale. | |
585 | * @name: name assigned to the Powercap Domain by platform. | |
586 | * @min_pai: Minimum configurable PAI. | |
587 | * @max_pai: Maximum configurable PAI. | |
588 | * @pai_step: Step size between two consecutive PAI values. | |
589 | * @min_power_cap: Minimum configurable CAP. | |
590 | * @max_power_cap: Maximum configurable CAP. | |
591 | * @power_cap_step: Step size between two consecutive CAP values. | |
592 | * @sustainable_power: Maximum sustainable power consumption for this domain | |
593 | * under normal conditions. | |
594 | * @accuracy: The accuracy with which the power is measured and reported in | |
595 | * integral multiples of 0.001 percent. | |
596 | * @parent_id: Identifier of the containing parent power capping domain, or the | |
597 | * value 0xFFFFFFFF if this powercap domain is a root domain not | |
598 | * contained in any other domain. | |
599 | */ | |
600 | struct scmi_powercap_info { | |
601 | unsigned int id; | |
602 | bool notify_powercap_cap_change; | |
603 | bool notify_powercap_measurement_change; | |
604 | bool async_powercap_cap_set; | |
605 | bool powercap_cap_config; | |
606 | bool powercap_monitoring; | |
607 | bool powercap_pai_config; | |
608 | bool powercap_scale_mw; | |
609 | bool powercap_scale_uw; | |
855aa26e | 610 | bool fastchannels; |
0316f99c CM |
611 | char name[SCMI_MAX_STR_SIZE]; |
612 | unsigned int min_pai; | |
613 | unsigned int max_pai; | |
614 | unsigned int pai_step; | |
615 | unsigned int min_power_cap; | |
616 | unsigned int max_power_cap; | |
617 | unsigned int power_cap_step; | |
618 | unsigned int sustainable_power; | |
619 | unsigned int accuracy; | |
620 | #define SCMI_POWERCAP_ROOT_ZONE_ID 0xFFFFFFFFUL | |
621 | unsigned int parent_id; | |
855aa26e | 622 | struct scmi_fc_info *fc_info; |
0316f99c CM |
623 | }; |
624 | ||
625 | /** | |
626 | * struct scmi_powercap_proto_ops - represents the various operations provided | |
627 | * by SCMI Powercap Protocol | |
628 | * | |
629 | * @num_domains_get: get the count of powercap domains provided by SCMI. | |
630 | * @info_get: get the information for the specified domain. | |
631 | * @cap_get: get the current CAP value for the specified domain. | |
758cd5fc CM |
632 | * On SCMI platforms supporting powercap zone disabling, this could |
633 | * report a zero value for a zone where powercapping is disabled. | |
0316f99c CM |
634 | * @cap_set: set the CAP value for the specified domain to the provided value; |
635 | * if the domain supports setting the CAP with an asynchronous command | |
636 | * this request will finally trigger an asynchronous transfer, but, if | |
637 | * @ignore_dresp here is set to true, this call will anyway return | |
638 | * immediately without waiting for the related delayed response. | |
758cd5fc CM |
639 | * Note that the powercap requested value must NOT be zero, even if |
640 | * the platform supports disabling a powercap by setting its cap to | |
641 | * zero (since SCMI v3.2): there are dedicated operations that should | |
642 | * be used for that. (@cap_enable_set/get) | |
643 | * @cap_enable_set: enable or disable the powercapping on the specified domain, | |
644 | * if supported by the SCMI platform implementation. | |
645 | * Note that, by the SCMI specification, the platform can | |
646 | * silently ignore our disable request and decide to enforce | |
647 | * anyway some other powercap value requested by another agent | |
648 | * on the system: for this reason @cap_get and @cap_enable_get | |
649 | * will always report the final platform view of the powercaps. | |
650 | * @cap_enable_get: get the current CAP enable status for the specified domain. | |
0316f99c CM |
651 | * @pai_get: get the current PAI value for the specified domain. |
652 | * @pai_set: set the PAI value for the specified domain to the provided value. | |
653 | * @measurements_get: retrieve the current average power measurements for the | |
654 | * specified domain and the related PAI upon which is | |
655 | * calculated. | |
656 | * @measurements_threshold_set: set the desired low and high power thresholds | |
657 | * to be used when registering for notification | |
658 | * of type POWERCAP_MEASUREMENTS_NOTIFY with this | |
659 | * powercap domain. | |
660 | * Note that this must be called at least once | |
661 | * before registering any callback with the usual | |
662 | * @scmi_notify_ops; moreover, in case this method | |
663 | * is called with measurement notifications already | |
664 | * enabled it will also trigger, transparently, a | |
665 | * proper update of the power thresholds configured | |
666 | * in the SCMI backend server. | |
667 | * @measurements_threshold_get: get the currently configured low and high power | |
668 | * thresholds used when registering callbacks for | |
669 | * notification POWERCAP_MEASUREMENTS_NOTIFY. | |
670 | */ | |
671 | struct scmi_powercap_proto_ops { | |
672 | int (*num_domains_get)(const struct scmi_protocol_handle *ph); | |
673 | const struct scmi_powercap_info __must_check *(*info_get) | |
674 | (const struct scmi_protocol_handle *ph, u32 domain_id); | |
675 | int (*cap_get)(const struct scmi_protocol_handle *ph, u32 domain_id, | |
676 | u32 *power_cap); | |
677 | int (*cap_set)(const struct scmi_protocol_handle *ph, u32 domain_id, | |
678 | u32 power_cap, bool ignore_dresp); | |
758cd5fc CM |
679 | int (*cap_enable_set)(const struct scmi_protocol_handle *ph, |
680 | u32 domain_id, bool enable); | |
681 | int (*cap_enable_get)(const struct scmi_protocol_handle *ph, | |
682 | u32 domain_id, bool *enable); | |
0316f99c CM |
683 | int (*pai_get)(const struct scmi_protocol_handle *ph, u32 domain_id, |
684 | u32 *pai); | |
685 | int (*pai_set)(const struct scmi_protocol_handle *ph, u32 domain_id, | |
686 | u32 pai); | |
687 | int (*measurements_get)(const struct scmi_protocol_handle *ph, | |
688 | u32 domain_id, u32 *average_power, u32 *pai); | |
689 | int (*measurements_threshold_set)(const struct scmi_protocol_handle *ph, | |
690 | u32 domain_id, u32 power_thresh_low, | |
691 | u32 power_thresh_high); | |
692 | int (*measurements_threshold_get)(const struct scmi_protocol_handle *ph, | |
693 | u32 domain_id, u32 *power_thresh_low, | |
694 | u32 *power_thresh_high); | |
695 | }; | |
696 | ||
e7c215f3 CM |
697 | /** |
698 | * struct scmi_notify_ops - represents notifications' operations provided by | |
699 | * SCMI core | |
5ad3d1cf CM |
700 | * @devm_event_notifier_register: Managed registration of a notifier_block for |
701 | * the requested event | |
702 | * @devm_event_notifier_unregister: Managed unregistration of a notifier_block | |
703 | * for the requested event | |
aa1fd3e4 CM |
704 | * @event_notifier_register: Register a notifier_block for the requested event |
705 | * @event_notifier_unregister: Unregister a notifier_block for the requested | |
e7c215f3 CM |
706 | * event |
707 | * | |
708 | * A user can register/unregister its own notifier_block against the wanted | |
709 | * platform instance regarding the desired event identified by the | |
710 | * tuple: (proto_id, evt_id, src_id) using the provided register/unregister | |
711 | * interface where: | |
712 | * | |
5ad3d1cf CM |
713 | * @sdev: The scmi_device to use when calling the devres managed ops devm_ |
714 | * @handle: The handle identifying the platform instance to use, when not | |
715 | * calling the managed ops devm_ | |
e7c215f3 CM |
716 | * @proto_id: The protocol ID as in SCMI Specification |
717 | * @evt_id: The message ID of the desired event as in SCMI Specification | |
718 | * @src_id: A pointer to the desired source ID if different sources are | |
719 | * possible for the protocol (like domain_id, sensor_id...etc) | |
720 | * | |
721 | * @src_id can be provided as NULL if it simply does NOT make sense for | |
722 | * the protocol at hand, OR if the user is explicitly interested in | |
723 | * receiving notifications from ANY existent source associated to the | |
724 | * specified proto_id / evt_id. | |
725 | * | |
726 | * Received notifications are finally delivered to the registered users, | |
727 | * invoking the callback provided with the notifier_block *nb as follows: | |
728 | * | |
729 | * int user_cb(nb, evt_id, report) | |
730 | * | |
731 | * with: | |
732 | * | |
733 | * @nb: The notifier block provided by the user | |
734 | * @evt_id: The message ID of the delivered event | |
735 | * @report: A custom struct describing the specific event delivered | |
736 | */ | |
737 | struct scmi_notify_ops { | |
5ad3d1cf CM |
738 | int (*devm_event_notifier_register)(struct scmi_device *sdev, |
739 | u8 proto_id, u8 evt_id, | |
740 | const u32 *src_id, | |
741 | struct notifier_block *nb); | |
742 | int (*devm_event_notifier_unregister)(struct scmi_device *sdev, | |
743 | u8 proto_id, u8 evt_id, | |
744 | const u32 *src_id, | |
745 | struct notifier_block *nb); | |
aa1fd3e4 | 746 | int (*event_notifier_register)(const struct scmi_handle *handle, |
5ad3d1cf CM |
747 | u8 proto_id, u8 evt_id, |
748 | const u32 *src_id, | |
e7c215f3 | 749 | struct notifier_block *nb); |
aa1fd3e4 | 750 | int (*event_notifier_unregister)(const struct scmi_handle *handle, |
5ad3d1cf CM |
751 | u8 proto_id, u8 evt_id, |
752 | const u32 *src_id, | |
e7c215f3 CM |
753 | struct notifier_block *nb); |
754 | }; | |
755 | ||
aa4f886f SH |
756 | /** |
757 | * struct scmi_handle - Handle returned to ARM SCMI clients for usage. | |
758 | * | |
759 | * @dev: pointer to the SCMI device | |
b6f20ff8 | 760 | * @version: pointer to the structure containing SCMI version information |
d9107999 CM |
761 | * @devm_protocol_acquire: devres managed method to get hold of a protocol, |
762 | * causing its initialization and related resource | |
763 | * accounting | |
23934efe CM |
764 | * @devm_protocol_get: devres managed method to acquire a protocol and get specific |
765 | * operations and a dedicated protocol handler | |
766 | * @devm_protocol_put: devres managed method to release a protocol | |
69255e74 CM |
767 | * @is_transport_atomic: method to check if the underlying transport for this |
768 | * instance handle is configured to support atomic | |
769 | * transactions for commands. | |
770 | * Some users of the SCMI stack in the upper layers could | |
771 | * be interested to know if they can assume SCMI | |
772 | * command transactions associated to this handle will | |
773 | * never sleep and act accordingly. | |
05976c5f CM |
774 | * An optional atomic threshold value could be returned |
775 | * where configured. | |
e7c215f3 | 776 | * @notify_ops: pointer to set of notifications related operations |
aa4f886f SH |
777 | */ |
778 | struct scmi_handle { | |
779 | struct device *dev; | |
b6f20ff8 | 780 | struct scmi_revision_info *version; |
23934efe | 781 | |
d9107999 CM |
782 | int __must_check (*devm_protocol_acquire)(struct scmi_device *sdev, |
783 | u8 proto); | |
23934efe CM |
784 | const void __must_check * |
785 | (*devm_protocol_get)(struct scmi_device *sdev, u8 proto, | |
786 | struct scmi_protocol_handle **ph); | |
787 | void (*devm_protocol_put)(struct scmi_device *sdev, u8 proto); | |
05976c5f CM |
788 | bool (*is_transport_atomic)(const struct scmi_handle *handle, |
789 | unsigned int *atomic_threshold); | |
23934efe | 790 | |
82894c1d | 791 | const struct scmi_notify_ops *notify_ops; |
b6f20ff8 SH |
792 | }; |
793 | ||
794 | enum scmi_std_protocol { | |
795 | SCMI_PROTOCOL_BASE = 0x10, | |
796 | SCMI_PROTOCOL_POWER = 0x11, | |
797 | SCMI_PROTOCOL_SYSTEM = 0x12, | |
798 | SCMI_PROTOCOL_PERF = 0x13, | |
799 | SCMI_PROTOCOL_CLOCK = 0x14, | |
800 | SCMI_PROTOCOL_SENSOR = 0x15, | |
95a15d80 | 801 | SCMI_PROTOCOL_RESET = 0x16, |
2add5cac | 802 | SCMI_PROTOCOL_VOLTAGE = 0x17, |
0316f99c | 803 | SCMI_PROTOCOL_POWERCAP = 0x18, |
aa4f886f | 804 | }; |
933c5044 | 805 | |
a8803055 CM |
806 | enum scmi_system_events { |
807 | SCMI_SYSTEM_SHUTDOWN, | |
808 | SCMI_SYSTEM_COLDRESET, | |
809 | SCMI_SYSTEM_WARMRESET, | |
810 | SCMI_SYSTEM_POWERUP, | |
811 | SCMI_SYSTEM_SUSPEND, | |
812 | SCMI_SYSTEM_MAX | |
813 | }; | |
814 | ||
933c5044 SH |
815 | struct scmi_device { |
816 | u32 id; | |
817 | u8 protocol_id; | |
ee7a9c9f | 818 | const char *name; |
933c5044 SH |
819 | struct device dev; |
820 | struct scmi_handle *handle; | |
821 | }; | |
822 | ||
823 | #define to_scmi_dev(d) container_of(d, struct scmi_device, dev) | |
824 | ||
933c5044 SH |
825 | struct scmi_device_id { |
826 | u8 protocol_id; | |
ee7a9c9f | 827 | const char *name; |
933c5044 SH |
828 | }; |
829 | ||
830 | struct scmi_driver { | |
831 | const char *name; | |
832 | int (*probe)(struct scmi_device *sdev); | |
833 | void (*remove)(struct scmi_device *sdev); | |
834 | const struct scmi_device_id *id_table; | |
835 | ||
836 | struct device_driver driver; | |
837 | }; | |
838 | ||
839 | #define to_scmi_driver(d) container_of(d, struct scmi_driver, driver) | |
840 | ||
66d90f6e | 841 | #if IS_REACHABLE(CONFIG_ARM_SCMI_PROTOCOL) |
933c5044 SH |
842 | int scmi_driver_register(struct scmi_driver *driver, |
843 | struct module *owner, const char *mod_name); | |
844 | void scmi_driver_unregister(struct scmi_driver *driver); | |
845 | #else | |
846 | static inline int | |
847 | scmi_driver_register(struct scmi_driver *driver, struct module *owner, | |
848 | const char *mod_name) | |
849 | { | |
850 | return -EINVAL; | |
851 | } | |
852 | ||
853 | static inline void scmi_driver_unregister(struct scmi_driver *driver) {} | |
854 | #endif /* CONFIG_ARM_SCMI_PROTOCOL */ | |
855 | ||
856 | #define scmi_register(driver) \ | |
857 | scmi_driver_register(driver, THIS_MODULE, KBUILD_MODNAME) | |
858 | #define scmi_unregister(driver) \ | |
859 | scmi_driver_unregister(driver) | |
860 | ||
861 | /** | |
862 | * module_scmi_driver() - Helper macro for registering a scmi driver | |
863 | * @__scmi_driver: scmi_driver structure | |
864 | * | |
865 | * Helper macro for scmi drivers to set up proper module init / exit | |
866 | * functions. Replaces module_init() and module_exit() and keeps people from | |
867 | * printing pointless things to the kernel log when their driver is loaded. | |
868 | */ | |
869 | #define module_scmi_driver(__scmi_driver) \ | |
870 | module_driver(__scmi_driver, scmi_register, scmi_unregister) | |
871 | ||
f5800e0b CM |
872 | /** |
873 | * module_scmi_protocol() - Helper macro for registering a scmi protocol | |
874 | * @__scmi_protocol: scmi_protocol structure | |
875 | * | |
876 | * Helper macro for scmi drivers to set up proper module init / exit | |
877 | * functions. Replaces module_init() and module_exit() and keeps people from | |
878 | * printing pointless things to the kernel log when their driver is loaded. | |
879 | */ | |
880 | #define module_scmi_protocol(__scmi_protocol) \ | |
881 | module_driver(__scmi_protocol, \ | |
882 | scmi_protocol_register, scmi_protocol_unregister) | |
883 | ||
48dc16e2 CM |
884 | struct scmi_protocol; |
885 | int scmi_protocol_register(const struct scmi_protocol *proto); | |
886 | void scmi_protocol_unregister(const struct scmi_protocol *proto); | |
70771c69 | 887 | |
e27077bc CM |
888 | /* SCMI Notification API - Custom Event Reports */ |
889 | enum scmi_notification_events { | |
890 | SCMI_EVENT_POWER_STATE_CHANGED = 0x0, | |
7aa75496 CM |
891 | SCMI_EVENT_CLOCK_RATE_CHANGED = 0x0, |
892 | SCMI_EVENT_CLOCK_RATE_CHANGE_REQUESTED = 0x1, | |
fb5086dc CM |
893 | SCMI_EVENT_PERFORMANCE_LIMITS_CHANGED = 0x0, |
894 | SCMI_EVENT_PERFORMANCE_LEVEL_CHANGED = 0x1, | |
128e3e93 | 895 | SCMI_EVENT_SENSOR_TRIP_POINT_EVENT = 0x0, |
e3811190 | 896 | SCMI_EVENT_SENSOR_UPDATE = 0x1, |
469ca182 | 897 | SCMI_EVENT_RESET_ISSUED = 0x0, |
585dfab3 | 898 | SCMI_EVENT_BASE_ERROR_EVENT = 0x0, |
a8803055 | 899 | SCMI_EVENT_SYSTEM_POWER_STATE_NOTIFIER = 0x0, |
0316f99c CM |
900 | SCMI_EVENT_POWERCAP_CAP_CHANGED = 0x0, |
901 | SCMI_EVENT_POWERCAP_MEASUREMENTS_CHANGED = 0x1, | |
e27077bc CM |
902 | }; |
903 | ||
904 | struct scmi_power_state_changed_report { | |
72a5eb9d CM |
905 | ktime_t timestamp; |
906 | unsigned int agent_id; | |
907 | unsigned int domain_id; | |
908 | unsigned int power_state; | |
e27077bc CM |
909 | }; |
910 | ||
7aa75496 CM |
911 | struct scmi_clock_rate_notif_report { |
912 | ktime_t timestamp; | |
913 | unsigned int agent_id; | |
914 | unsigned int clock_id; | |
915 | unsigned long long rate; | |
916 | }; | |
917 | ||
a8803055 CM |
918 | struct scmi_system_power_state_notifier_report { |
919 | ktime_t timestamp; | |
920 | unsigned int agent_id; | |
7097f298 | 921 | #define SCMI_SYSPOWER_IS_REQUEST_GRACEFUL(flags) ((flags) & BIT(0)) |
a8803055 CM |
922 | unsigned int flags; |
923 | unsigned int system_state; | |
7097f298 | 924 | unsigned int timeout; |
a8803055 CM |
925 | }; |
926 | ||
fb5086dc | 927 | struct scmi_perf_limits_report { |
72a5eb9d CM |
928 | ktime_t timestamp; |
929 | unsigned int agent_id; | |
930 | unsigned int domain_id; | |
931 | unsigned int range_max; | |
932 | unsigned int range_min; | |
fb5086dc CM |
933 | }; |
934 | ||
935 | struct scmi_perf_level_report { | |
72a5eb9d CM |
936 | ktime_t timestamp; |
937 | unsigned int agent_id; | |
938 | unsigned int domain_id; | |
939 | unsigned int performance_level; | |
fb5086dc CM |
940 | }; |
941 | ||
128e3e93 | 942 | struct scmi_sensor_trip_point_report { |
72a5eb9d CM |
943 | ktime_t timestamp; |
944 | unsigned int agent_id; | |
945 | unsigned int sensor_id; | |
946 | unsigned int trip_point_desc; | |
128e3e93 CM |
947 | }; |
948 | ||
e3811190 CM |
949 | struct scmi_sensor_update_report { |
950 | ktime_t timestamp; | |
951 | unsigned int agent_id; | |
952 | unsigned int sensor_id; | |
953 | unsigned int readings_count; | |
954 | struct scmi_sensor_reading readings[]; | |
955 | }; | |
956 | ||
469ca182 | 957 | struct scmi_reset_issued_report { |
72a5eb9d CM |
958 | ktime_t timestamp; |
959 | unsigned int agent_id; | |
960 | unsigned int domain_id; | |
961 | unsigned int reset_state; | |
469ca182 CM |
962 | }; |
963 | ||
585dfab3 | 964 | struct scmi_base_error_report { |
72a5eb9d CM |
965 | ktime_t timestamp; |
966 | unsigned int agent_id; | |
967 | bool fatal; | |
968 | unsigned int cmd_count; | |
969 | unsigned long long reports[]; | |
585dfab3 CM |
970 | }; |
971 | ||
0316f99c CM |
972 | struct scmi_powercap_cap_changed_report { |
973 | ktime_t timestamp; | |
974 | unsigned int agent_id; | |
975 | unsigned int domain_id; | |
976 | unsigned int power_cap; | |
977 | unsigned int pai; | |
978 | }; | |
979 | ||
980 | struct scmi_powercap_meas_changed_report { | |
981 | ktime_t timestamp; | |
982 | unsigned int agent_id; | |
983 | unsigned int domain_id; | |
984 | unsigned int power; | |
985 | }; | |
70771c69 | 986 | #endif /* _LINUX_SCMI_PROTOCOL_H */ |