1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * SCMI Message Protocol driver header
5 * Copyright (C) 2018-2021 ARM Ltd.
8 #ifndef _LINUX_SCMI_PROTOCOL_H
9 #define _LINUX_SCMI_PROTOCOL_H
11 #include <linux/bitfield.h>
12 #include <linux/device.h>
13 #include <linux/notifier.h>
14 #include <linux/types.h>
16 #define SCMI_MAX_STR_SIZE 64
17 #define SCMI_MAX_NUM_RATES 16
20 * struct scmi_revision_info - version information structure
22 * @major_ver: Major ABI version. Change here implies risk of backward
23 * compatibility break.
24 * @minor_ver: Minor ABI version. Change here implies new feature addition,
25 * or compatible change in ABI.
26 * @num_protocols: Number of protocols that are implemented, excluding the
28 * @num_agents: Number of agents in the system.
29 * @impl_ver: A vendor-specific implementation version.
30 * @vendor_id: A vendor identifier(Null terminated ASCII string)
31 * @sub_vendor_id: A sub-vendor identifier(Null terminated ASCII string)
33 struct scmi_revision_info {
39 char vendor_id[SCMI_MAX_STR_SIZE];
40 char sub_vendor_id[SCMI_MAX_STR_SIZE];
43 struct scmi_clock_info {
44 char name[SCMI_MAX_STR_SIZE];
45 unsigned int enable_latency;
47 bool rate_changed_notifications;
48 bool rate_change_requested_notifications;
52 u64 rates[SCMI_MAX_NUM_RATES];
64 struct scmi_protocol_handle;
67 * struct scmi_clk_proto_ops - represents the various operations provided
68 * by SCMI Clock Protocol
70 * @count_get: get the count of clocks provided by SCMI
71 * @info_get: get the information of the specified clock
72 * @rate_get: request the current clock rate of a clock
73 * @rate_set: set the clock rate of a clock
74 * @enable: enables the specified clock
75 * @disable: disables the specified clock
77 struct scmi_clk_proto_ops {
78 int (*count_get)(const struct scmi_protocol_handle *ph);
80 const struct scmi_clock_info *(*info_get)
81 (const struct scmi_protocol_handle *ph, u32 clk_id);
82 int (*rate_get)(const struct scmi_protocol_handle *ph, u32 clk_id,
84 int (*rate_set)(const struct scmi_protocol_handle *ph, u32 clk_id,
86 int (*enable)(const struct scmi_protocol_handle *ph, u32 clk_id);
87 int (*disable)(const struct scmi_protocol_handle *ph, u32 clk_id);
88 int (*enable_atomic)(const struct scmi_protocol_handle *ph, u32 clk_id);
89 int (*disable_atomic)(const struct scmi_protocol_handle *ph,
94 * struct scmi_perf_proto_ops - represents the various operations provided
95 * by SCMI Performance Protocol
97 * @limits_set: sets limits on the performance level of a domain
98 * @limits_get: gets limits on the performance level of a domain
99 * @level_set: sets the performance level of a domain
100 * @level_get: gets the performance level of a domain
101 * @device_domain_id: gets the scmi domain id for a given device
102 * @transition_latency_get: gets the DVFS transition latency for a given device
103 * @device_opps_add: adds all the OPPs for a given device
104 * @freq_set: sets the frequency for a given device using sustained frequency
105 * to sustained performance level mapping
106 * @freq_get: gets the frequency for a given device using sustained frequency
107 * to sustained performance level mapping
108 * @est_power_get: gets the estimated power cost for a given performance domain
109 * at a given frequency
110 * @fast_switch_possible: indicates if fast DVFS switching is possible or not
112 * @power_scale_mw_get: indicates if the power values provided are in milliWatts
113 * or in some other (abstract) scale
115 struct scmi_perf_proto_ops {
116 int (*limits_set)(const struct scmi_protocol_handle *ph, u32 domain,
117 u32 max_perf, u32 min_perf);
118 int (*limits_get)(const struct scmi_protocol_handle *ph, u32 domain,
119 u32 *max_perf, u32 *min_perf);
120 int (*level_set)(const struct scmi_protocol_handle *ph, u32 domain,
121 u32 level, bool poll);
122 int (*level_get)(const struct scmi_protocol_handle *ph, u32 domain,
123 u32 *level, bool poll);
124 int (*device_domain_id)(struct device *dev);
125 int (*transition_latency_get)(const struct scmi_protocol_handle *ph,
127 int (*device_opps_add)(const struct scmi_protocol_handle *ph,
129 int (*freq_set)(const struct scmi_protocol_handle *ph, u32 domain,
130 unsigned long rate, bool poll);
131 int (*freq_get)(const struct scmi_protocol_handle *ph, u32 domain,
132 unsigned long *rate, bool poll);
133 int (*est_power_get)(const struct scmi_protocol_handle *ph, u32 domain,
134 unsigned long *rate, unsigned long *power);
135 bool (*fast_switch_possible)(const struct scmi_protocol_handle *ph,
137 bool (*power_scale_mw_get)(const struct scmi_protocol_handle *ph);
141 * struct scmi_power_proto_ops - represents the various operations provided
142 * by SCMI Power Protocol
144 * @num_domains_get: get the count of power domains provided by SCMI
145 * @name_get: gets the name of a power domain
146 * @state_set: sets the power state of a power domain
147 * @state_get: gets the power state of a power domain
149 struct scmi_power_proto_ops {
150 int (*num_domains_get)(const struct scmi_protocol_handle *ph);
151 const char *(*name_get)(const struct scmi_protocol_handle *ph,
153 #define SCMI_POWER_STATE_TYPE_SHIFT 30
154 #define SCMI_POWER_STATE_ID_MASK (BIT(28) - 1)
155 #define SCMI_POWER_STATE_PARAM(type, id) \
156 ((((type) & BIT(0)) << SCMI_POWER_STATE_TYPE_SHIFT) | \
157 ((id) & SCMI_POWER_STATE_ID_MASK))
158 #define SCMI_POWER_STATE_GENERIC_ON SCMI_POWER_STATE_PARAM(0, 0)
159 #define SCMI_POWER_STATE_GENERIC_OFF SCMI_POWER_STATE_PARAM(1, 0)
160 int (*state_set)(const struct scmi_protocol_handle *ph, u32 domain,
162 int (*state_get)(const struct scmi_protocol_handle *ph, u32 domain,
167 * struct scmi_sensor_reading - represent a timestamped read
169 * Used by @reading_get_timestamped method.
171 * @value: The signed value sensor read.
172 * @timestamp: An unsigned timestamp for the sensor read, as provided by
173 * SCMI platform. Set to zero when not available.
175 struct scmi_sensor_reading {
177 unsigned long long timestamp;
181 * struct scmi_range_attrs - specifies a sensor or axis values' range
182 * @min_range: The minimum value which can be represented by the sensor/axis.
183 * @max_range: The maximum value which can be represented by the sensor/axis.
185 struct scmi_range_attrs {
191 * struct scmi_sensor_axis_info - describes one sensor axes
193 * @type: Axes type. Chosen amongst one of @enum scmi_sensor_class.
194 * @scale: Power-of-10 multiplier applied to the axis unit.
195 * @name: NULL-terminated string representing axes name as advertised by
197 * @extended_attrs: Flag to indicate the presence of additional extended
198 * attributes for this axes.
199 * @resolution: Extended attribute representing the resolution of the axes.
200 * Set to 0 if not reported by this axes.
201 * @exponent: Extended attribute representing the power-of-10 multiplier that
202 * is applied to the resolution field. Set to 0 if not reported by
204 * @attrs: Extended attributes representing minimum and maximum values
205 * measurable by this axes. Set to 0 if not reported by this sensor.
207 struct scmi_sensor_axis_info {
211 char name[SCMI_MAX_STR_SIZE];
213 unsigned int resolution;
215 struct scmi_range_attrs attrs;
219 * struct scmi_sensor_intervals_info - describes number and type of available
221 * @segmented: Flag for segmented intervals' representation. When True there
222 * will be exactly 3 intervals in @desc, with each entry
223 * representing a member of a segment in this order:
224 * {lowest update interval, highest update interval, step size}
225 * @count: Number of intervals described in @desc.
226 * @desc: Array of @count interval descriptor bitmask represented as detailed in
227 * the SCMI specification: it can be accessed using the accompanying
229 * @prealloc_pool: A minimal preallocated pool of desc entries used to avoid
230 * lesser-than-64-bytes dynamic allocation for small @count
233 struct scmi_sensor_intervals_info {
236 #define SCMI_SENS_INTVL_SEGMENT_LOW 0
237 #define SCMI_SENS_INTVL_SEGMENT_HIGH 1
238 #define SCMI_SENS_INTVL_SEGMENT_STEP 2
240 #define SCMI_SENS_INTVL_GET_SECS(x) FIELD_GET(GENMASK(20, 5), (x))
241 #define SCMI_SENS_INTVL_GET_EXP(x) \
243 int __signed_exp = FIELD_GET(GENMASK(4, 0), (x)); \
245 if (__signed_exp & BIT(4)) \
246 __signed_exp |= GENMASK(31, 5); \
249 #define SCMI_MAX_PREALLOC_POOL 16
250 unsigned int prealloc_pool[SCMI_MAX_PREALLOC_POOL];
254 * struct scmi_sensor_info - represents information related to one of the
257 * @type: Sensor type. Chosen amongst one of @enum scmi_sensor_class.
258 * @scale: Power-of-10 multiplier applied to the sensor unit.
259 * @num_trip_points: Number of maximum configurable trip points.
260 * @async: Flag for asynchronous read support.
261 * @update: Flag for continuouos update notification support.
262 * @timestamped: Flag for timestamped read support.
263 * @tstamp_scale: Power-of-10 multiplier applied to the sensor timestamps to
264 * represent it in seconds.
265 * @num_axis: Number of supported axis if any. Reported as 0 for scalar sensors.
266 * @axis: Pointer to an array of @num_axis descriptors.
267 * @intervals: Descriptor of available update intervals.
268 * @sensor_config: A bitmask reporting the current sensor configuration as
269 * detailed in the SCMI specification: it can accessed and
270 * modified through the accompanying macros.
271 * @name: NULL-terminated string representing sensor name as advertised by
273 * @extended_scalar_attrs: Flag to indicate the presence of additional extended
274 * attributes for this sensor.
275 * @sensor_power: Extended attribute representing the average power
276 * consumed by the sensor in microwatts (uW) when it is active.
277 * Reported here only for scalar sensors.
278 * Set to 0 if not reported by this sensor.
279 * @resolution: Extended attribute representing the resolution of the sensor.
280 * Reported here only for scalar sensors.
281 * Set to 0 if not reported by this sensor.
282 * @exponent: Extended attribute representing the power-of-10 multiplier that is
283 * applied to the resolution field.
284 * Reported here only for scalar sensors.
285 * Set to 0 if not reported by this sensor.
286 * @scalar_attrs: Extended attributes representing minimum and maximum
287 * measurable values by this sensor.
288 * Reported here only for scalar sensors.
289 * Set to 0 if not reported by this sensor.
291 struct scmi_sensor_info {
295 unsigned int num_trip_points;
300 unsigned int num_axis;
301 struct scmi_sensor_axis_info *axis;
302 struct scmi_sensor_intervals_info intervals;
303 unsigned int sensor_config;
304 #define SCMI_SENS_CFG_UPDATE_SECS_MASK GENMASK(31, 16)
305 #define SCMI_SENS_CFG_GET_UPDATE_SECS(x) \
306 FIELD_GET(SCMI_SENS_CFG_UPDATE_SECS_MASK, (x))
308 #define SCMI_SENS_CFG_UPDATE_EXP_MASK GENMASK(15, 11)
309 #define SCMI_SENS_CFG_GET_UPDATE_EXP(x) \
312 FIELD_GET(SCMI_SENS_CFG_UPDATE_EXP_MASK, (x)); \
314 if (__signed_exp & BIT(4)) \
315 __signed_exp |= GENMASK(31, 5); \
319 #define SCMI_SENS_CFG_ROUND_MASK GENMASK(10, 9)
320 #define SCMI_SENS_CFG_ROUND_AUTO 2
321 #define SCMI_SENS_CFG_ROUND_UP 1
322 #define SCMI_SENS_CFG_ROUND_DOWN 0
324 #define SCMI_SENS_CFG_TSTAMP_ENABLED_MASK BIT(1)
325 #define SCMI_SENS_CFG_TSTAMP_ENABLE 1
326 #define SCMI_SENS_CFG_TSTAMP_DISABLE 0
327 #define SCMI_SENS_CFG_IS_TSTAMP_ENABLED(x) \
328 FIELD_GET(SCMI_SENS_CFG_TSTAMP_ENABLED_MASK, (x))
330 #define SCMI_SENS_CFG_SENSOR_ENABLED_MASK BIT(0)
331 #define SCMI_SENS_CFG_SENSOR_ENABLE 1
332 #define SCMI_SENS_CFG_SENSOR_DISABLE 0
333 char name[SCMI_MAX_STR_SIZE];
334 #define SCMI_SENS_CFG_IS_ENABLED(x) FIELD_GET(BIT(0), (x))
335 bool extended_scalar_attrs;
336 unsigned int sensor_power;
337 unsigned int resolution;
339 struct scmi_range_attrs scalar_attrs;
343 * Partial list from Distributed Management Task Force (DMTF) specification:
344 * DSP0249 (Platform Level Data Model specification)
346 enum scmi_sensor_class {
416 NEWTON_METERS = 0x45,
427 CORRECTED_ERRS = 0x50,
428 UNCORRECTABLE_ERRS = 0x51,
436 METERS_SEC_SQUARED = 0x59,
438 CUBIC_METERS_SEC = 0x5B,
440 RADIANS_SEC_SQUARED = 0x5D,
445 * struct scmi_sensor_proto_ops - represents the various operations provided
446 * by SCMI Sensor Protocol
448 * @count_get: get the count of sensors provided by SCMI
449 * @info_get: get the information of the specified sensor
450 * @trip_point_config: selects and configures a trip-point of interest
451 * @reading_get: gets the current value of the sensor
452 * @reading_get_timestamped: gets the current value and timestamp, when
453 * available, of the sensor. (as of v3.0 spec)
454 * Supports multi-axis sensors for sensors which
455 * supports it and if the @reading array size of
456 * @count entry equals the sensor num_axis
457 * @config_get: Get sensor current configuration
458 * @config_set: Set sensor current configuration
460 struct scmi_sensor_proto_ops {
461 int (*count_get)(const struct scmi_protocol_handle *ph);
462 const struct scmi_sensor_info *(*info_get)
463 (const struct scmi_protocol_handle *ph, u32 sensor_id);
464 int (*trip_point_config)(const struct scmi_protocol_handle *ph,
465 u32 sensor_id, u8 trip_id, u64 trip_value);
466 int (*reading_get)(const struct scmi_protocol_handle *ph, u32 sensor_id,
468 int (*reading_get_timestamped)(const struct scmi_protocol_handle *ph,
469 u32 sensor_id, u8 count,
470 struct scmi_sensor_reading *readings);
471 int (*config_get)(const struct scmi_protocol_handle *ph,
472 u32 sensor_id, u32 *sensor_config);
473 int (*config_set)(const struct scmi_protocol_handle *ph,
474 u32 sensor_id, u32 sensor_config);
478 * struct scmi_reset_proto_ops - represents the various operations provided
479 * by SCMI Reset Protocol
481 * @num_domains_get: get the count of reset domains provided by SCMI
482 * @name_get: gets the name of a reset domain
483 * @latency_get: gets the reset latency for the specified reset domain
484 * @reset: resets the specified reset domain
485 * @assert: explicitly assert reset signal of the specified reset domain
486 * @deassert: explicitly deassert reset signal of the specified reset domain
488 struct scmi_reset_proto_ops {
489 int (*num_domains_get)(const struct scmi_protocol_handle *ph);
490 const char *(*name_get)(const struct scmi_protocol_handle *ph,
492 int (*latency_get)(const struct scmi_protocol_handle *ph, u32 domain);
493 int (*reset)(const struct scmi_protocol_handle *ph, u32 domain);
494 int (*assert)(const struct scmi_protocol_handle *ph, u32 domain);
495 int (*deassert)(const struct scmi_protocol_handle *ph, u32 domain);
498 enum scmi_voltage_level_mode {
499 SCMI_VOLTAGE_LEVEL_SET_AUTO,
500 SCMI_VOLTAGE_LEVEL_SET_SYNC,
504 * struct scmi_voltage_info - describe one available SCMI Voltage Domain
506 * @id: the domain ID as advertised by the platform
507 * @segmented: defines the layout of the entries of array @levels_uv.
508 * - when True the entries are to be interpreted as triplets,
509 * each defining a segment representing a range of equally
510 * space voltages: <lowest_volts>, <highest_volt>, <step_uV>
511 * - when False the entries simply represent a single discrete
512 * supported voltage level
513 * @negative_volts_allowed: True if any of the entries of @levels_uv represent
514 * a negative voltage.
515 * @async_level_set: True when the voltage domain supports asynchronous level
517 * @name: name assigned to the Voltage Domain by platform
518 * @num_levels: number of total entries in @levels_uv.
519 * @levels_uv: array of entries describing the available voltage levels for
522 struct scmi_voltage_info {
525 bool negative_volts_allowed;
526 bool async_level_set;
527 char name[SCMI_MAX_STR_SIZE];
528 unsigned int num_levels;
529 #define SCMI_VOLTAGE_SEGMENT_LOW 0
530 #define SCMI_VOLTAGE_SEGMENT_HIGH 1
531 #define SCMI_VOLTAGE_SEGMENT_STEP 2
536 * struct scmi_voltage_proto_ops - represents the various operations provided
537 * by SCMI Voltage Protocol
539 * @num_domains_get: get the count of voltage domains provided by SCMI
540 * @info_get: get the information of the specified domain
541 * @config_set: set the config for the specified domain
542 * @config_get: get the config of the specified domain
543 * @level_set: set the voltage level for the specified domain
544 * @level_get: get the voltage level of the specified domain
546 struct scmi_voltage_proto_ops {
547 int (*num_domains_get)(const struct scmi_protocol_handle *ph);
548 const struct scmi_voltage_info __must_check *(*info_get)
549 (const struct scmi_protocol_handle *ph, u32 domain_id);
550 int (*config_set)(const struct scmi_protocol_handle *ph, u32 domain_id,
552 #define SCMI_VOLTAGE_ARCH_STATE_OFF 0x0
553 #define SCMI_VOLTAGE_ARCH_STATE_ON 0x7
554 int (*config_get)(const struct scmi_protocol_handle *ph, u32 domain_id,
556 int (*level_set)(const struct scmi_protocol_handle *ph, u32 domain_id,
557 enum scmi_voltage_level_mode mode, s32 volt_uV);
558 int (*level_get)(const struct scmi_protocol_handle *ph, u32 domain_id,
563 * struct scmi_notify_ops - represents notifications' operations provided by
565 * @devm_event_notifier_register: Managed registration of a notifier_block for
566 * the requested event
567 * @devm_event_notifier_unregister: Managed unregistration of a notifier_block
568 * for the requested event
569 * @event_notifier_register: Register a notifier_block for the requested event
570 * @event_notifier_unregister: Unregister a notifier_block for the requested
573 * A user can register/unregister its own notifier_block against the wanted
574 * platform instance regarding the desired event identified by the
575 * tuple: (proto_id, evt_id, src_id) using the provided register/unregister
578 * @sdev: The scmi_device to use when calling the devres managed ops devm_
579 * @handle: The handle identifying the platform instance to use, when not
580 * calling the managed ops devm_
581 * @proto_id: The protocol ID as in SCMI Specification
582 * @evt_id: The message ID of the desired event as in SCMI Specification
583 * @src_id: A pointer to the desired source ID if different sources are
584 * possible for the protocol (like domain_id, sensor_id...etc)
586 * @src_id can be provided as NULL if it simply does NOT make sense for
587 * the protocol at hand, OR if the user is explicitly interested in
588 * receiving notifications from ANY existent source associated to the
589 * specified proto_id / evt_id.
591 * Received notifications are finally delivered to the registered users,
592 * invoking the callback provided with the notifier_block *nb as follows:
594 * int user_cb(nb, evt_id, report)
598 * @nb: The notifier block provided by the user
599 * @evt_id: The message ID of the delivered event
600 * @report: A custom struct describing the specific event delivered
602 struct scmi_notify_ops {
603 int (*devm_event_notifier_register)(struct scmi_device *sdev,
604 u8 proto_id, u8 evt_id,
606 struct notifier_block *nb);
607 int (*devm_event_notifier_unregister)(struct scmi_device *sdev,
608 u8 proto_id, u8 evt_id,
610 struct notifier_block *nb);
611 int (*event_notifier_register)(const struct scmi_handle *handle,
612 u8 proto_id, u8 evt_id,
614 struct notifier_block *nb);
615 int (*event_notifier_unregister)(const struct scmi_handle *handle,
616 u8 proto_id, u8 evt_id,
618 struct notifier_block *nb);
622 * struct scmi_handle - Handle returned to ARM SCMI clients for usage.
624 * @dev: pointer to the SCMI device
625 * @version: pointer to the structure containing SCMI version information
626 * @devm_protocol_get: devres managed method to acquire a protocol and get specific
627 * operations and a dedicated protocol handler
628 * @devm_protocol_put: devres managed method to release a protocol
629 * @is_transport_atomic: method to check if the underlying transport for this
630 * instance handle is configured to support atomic
631 * transactions for commands.
632 * Some users of the SCMI stack in the upper layers could
633 * be interested to know if they can assume SCMI
634 * command transactions associated to this handle will
635 * never sleep and act accordingly.
636 * An optional atomic threshold value could be returned
638 * @notify_ops: pointer to set of notifications related operations
642 struct scmi_revision_info *version;
644 const void __must_check *
645 (*devm_protocol_get)(struct scmi_device *sdev, u8 proto,
646 struct scmi_protocol_handle **ph);
647 void (*devm_protocol_put)(struct scmi_device *sdev, u8 proto);
648 bool (*is_transport_atomic)(const struct scmi_handle *handle,
649 unsigned int *atomic_threshold);
651 const struct scmi_notify_ops *notify_ops;
654 enum scmi_std_protocol {
655 SCMI_PROTOCOL_BASE = 0x10,
656 SCMI_PROTOCOL_POWER = 0x11,
657 SCMI_PROTOCOL_SYSTEM = 0x12,
658 SCMI_PROTOCOL_PERF = 0x13,
659 SCMI_PROTOCOL_CLOCK = 0x14,
660 SCMI_PROTOCOL_SENSOR = 0x15,
661 SCMI_PROTOCOL_RESET = 0x16,
662 SCMI_PROTOCOL_VOLTAGE = 0x17,
665 enum scmi_system_events {
666 SCMI_SYSTEM_SHUTDOWN,
667 SCMI_SYSTEM_COLDRESET,
668 SCMI_SYSTEM_WARMRESET,
679 struct scmi_handle *handle;
682 #define to_scmi_dev(d) container_of(d, struct scmi_device, dev)
685 scmi_device_create(struct device_node *np, struct device *parent, int protocol,
687 void scmi_device_destroy(struct scmi_device *scmi_dev);
689 struct scmi_device_id {
696 int (*probe)(struct scmi_device *sdev);
697 void (*remove)(struct scmi_device *sdev);
698 const struct scmi_device_id *id_table;
700 struct device_driver driver;
703 #define to_scmi_driver(d) container_of(d, struct scmi_driver, driver)
705 #if IS_REACHABLE(CONFIG_ARM_SCMI_PROTOCOL)
706 int scmi_driver_register(struct scmi_driver *driver,
707 struct module *owner, const char *mod_name);
708 void scmi_driver_unregister(struct scmi_driver *driver);
711 scmi_driver_register(struct scmi_driver *driver, struct module *owner,
712 const char *mod_name)
717 static inline void scmi_driver_unregister(struct scmi_driver *driver) {}
718 #endif /* CONFIG_ARM_SCMI_PROTOCOL */
720 #define scmi_register(driver) \
721 scmi_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
722 #define scmi_unregister(driver) \
723 scmi_driver_unregister(driver)
726 * module_scmi_driver() - Helper macro for registering a scmi driver
727 * @__scmi_driver: scmi_driver structure
729 * Helper macro for scmi drivers to set up proper module init / exit
730 * functions. Replaces module_init() and module_exit() and keeps people from
731 * printing pointless things to the kernel log when their driver is loaded.
733 #define module_scmi_driver(__scmi_driver) \
734 module_driver(__scmi_driver, scmi_register, scmi_unregister)
737 * module_scmi_protocol() - Helper macro for registering a scmi protocol
738 * @__scmi_protocol: scmi_protocol structure
740 * Helper macro for scmi drivers to set up proper module init / exit
741 * functions. Replaces module_init() and module_exit() and keeps people from
742 * printing pointless things to the kernel log when their driver is loaded.
744 #define module_scmi_protocol(__scmi_protocol) \
745 module_driver(__scmi_protocol, \
746 scmi_protocol_register, scmi_protocol_unregister)
748 struct scmi_protocol;
749 int scmi_protocol_register(const struct scmi_protocol *proto);
750 void scmi_protocol_unregister(const struct scmi_protocol *proto);
752 /* SCMI Notification API - Custom Event Reports */
753 enum scmi_notification_events {
754 SCMI_EVENT_POWER_STATE_CHANGED = 0x0,
755 SCMI_EVENT_CLOCK_RATE_CHANGED = 0x0,
756 SCMI_EVENT_CLOCK_RATE_CHANGE_REQUESTED = 0x1,
757 SCMI_EVENT_PERFORMANCE_LIMITS_CHANGED = 0x0,
758 SCMI_EVENT_PERFORMANCE_LEVEL_CHANGED = 0x1,
759 SCMI_EVENT_SENSOR_TRIP_POINT_EVENT = 0x0,
760 SCMI_EVENT_SENSOR_UPDATE = 0x1,
761 SCMI_EVENT_RESET_ISSUED = 0x0,
762 SCMI_EVENT_BASE_ERROR_EVENT = 0x0,
763 SCMI_EVENT_SYSTEM_POWER_STATE_NOTIFIER = 0x0,
766 struct scmi_power_state_changed_report {
768 unsigned int agent_id;
769 unsigned int domain_id;
770 unsigned int power_state;
773 struct scmi_clock_rate_notif_report {
775 unsigned int agent_id;
776 unsigned int clock_id;
777 unsigned long long rate;
780 struct scmi_system_power_state_notifier_report {
782 unsigned int agent_id;
784 unsigned int system_state;
787 struct scmi_perf_limits_report {
789 unsigned int agent_id;
790 unsigned int domain_id;
791 unsigned int range_max;
792 unsigned int range_min;
795 struct scmi_perf_level_report {
797 unsigned int agent_id;
798 unsigned int domain_id;
799 unsigned int performance_level;
802 struct scmi_sensor_trip_point_report {
804 unsigned int agent_id;
805 unsigned int sensor_id;
806 unsigned int trip_point_desc;
809 struct scmi_sensor_update_report {
811 unsigned int agent_id;
812 unsigned int sensor_id;
813 unsigned int readings_count;
814 struct scmi_sensor_reading readings[];
817 struct scmi_reset_issued_report {
819 unsigned int agent_id;
820 unsigned int domain_id;
821 unsigned int reset_state;
824 struct scmi_base_error_report {
826 unsigned int agent_id;
828 unsigned int cmd_count;
829 unsigned long long reports[];
832 #endif /* _LINUX_SCMI_PROTOCOL_H */