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