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_SHORT_NAME_MAX_SIZE 16
18 #define SCMI_MAX_NUM_RATES 16
21 * struct scmi_revision_info - version information structure
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
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)
34 struct scmi_revision_info {
40 char vendor_id[SCMI_SHORT_NAME_MAX_SIZE];
41 char sub_vendor_id[SCMI_SHORT_NAME_MAX_SIZE];
44 struct scmi_clock_info {
45 char name[SCMI_MAX_STR_SIZE];
46 unsigned int enable_latency;
48 bool rate_changed_notifications;
49 bool rate_change_requested_notifications;
53 u64 rates[SCMI_MAX_NUM_RATES];
63 enum scmi_power_scale {
65 SCMI_POWER_MILLIWATTS,
71 struct scmi_protocol_handle;
74 * struct scmi_clk_proto_ops - represents the various operations provided
75 * by SCMI Clock Protocol
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
84 struct scmi_clk_proto_ops {
85 int (*count_get)(const struct scmi_protocol_handle *ph);
87 const struct scmi_clock_info *(*info_get)
88 (const struct scmi_protocol_handle *ph, u32 clk_id);
89 int (*rate_get)(const struct scmi_protocol_handle *ph, u32 clk_id,
91 int (*rate_set)(const struct scmi_protocol_handle *ph, u32 clk_id,
93 int (*enable)(const struct scmi_protocol_handle *ph, u32 clk_id);
94 int (*disable)(const struct scmi_protocol_handle *ph, u32 clk_id);
95 int (*enable_atomic)(const struct scmi_protocol_handle *ph, u32 clk_id);
96 int (*disable_atomic)(const struct scmi_protocol_handle *ph,
101 * struct scmi_perf_proto_ops - represents the various operations provided
102 * by SCMI Performance Protocol
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
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
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
115 * @est_power_get: gets the estimated power cost for a given performance domain
116 * at a given frequency
117 * @fast_switch_possible: indicates if fast DVFS switching is possible or not
119 * @power_scale_mw_get: indicates if the power values provided are in milliWatts
120 * or in some other (abstract) scale
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,
134 int (*device_opps_add)(const struct scmi_protocol_handle *ph,
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,
144 enum scmi_power_scale (*power_scale_get)(const struct scmi_protocol_handle *ph);
148 * struct scmi_power_proto_ops - represents the various operations provided
149 * by SCMI Power Protocol
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
156 struct scmi_power_proto_ops {
157 int (*num_domains_get)(const struct scmi_protocol_handle *ph);
158 const char *(*name_get)(const struct scmi_protocol_handle *ph,
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)
167 int (*state_set)(const struct scmi_protocol_handle *ph, u32 domain,
169 int (*state_get)(const struct scmi_protocol_handle *ph, u32 domain,
174 * struct scmi_sensor_reading - represent a timestamped read
176 * Used by @reading_get_timestamped method.
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.
182 struct scmi_sensor_reading {
184 unsigned long long timestamp;
188 * struct scmi_range_attrs - specifies a sensor or axis values' range
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.
192 struct scmi_range_attrs {
198 * struct scmi_sensor_axis_info - describes one sensor axes
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
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
211 * @attrs: Extended attributes representing minimum and maximum values
212 * measurable by this axes. Set to 0 if not reported by this sensor.
214 struct scmi_sensor_axis_info {
218 char name[SCMI_MAX_STR_SIZE];
220 unsigned int resolution;
222 struct scmi_range_attrs attrs;
226 * struct scmi_sensor_intervals_info - describes number and type of available
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
236 * @prealloc_pool: A minimal preallocated pool of desc entries used to avoid
237 * lesser-than-64-bytes dynamic allocation for small @count
240 struct scmi_sensor_intervals_info {
243 #define SCMI_SENS_INTVL_SEGMENT_LOW 0
244 #define SCMI_SENS_INTVL_SEGMENT_HIGH 1
245 #define SCMI_SENS_INTVL_SEGMENT_STEP 2
247 #define SCMI_SENS_INTVL_GET_SECS(x) FIELD_GET(GENMASK(20, 5), (x))
248 #define SCMI_SENS_INTVL_GET_EXP(x) \
250 int __signed_exp = FIELD_GET(GENMASK(4, 0), (x)); \
252 if (__signed_exp & BIT(4)) \
253 __signed_exp |= GENMASK(31, 5); \
256 #define SCMI_MAX_PREALLOC_POOL 16
257 unsigned int prealloc_pool[SCMI_MAX_PREALLOC_POOL];
261 * struct scmi_sensor_info - represents information related to one of the
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
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.
298 struct scmi_sensor_info {
302 unsigned int num_trip_points;
307 unsigned int num_axis;
308 struct scmi_sensor_axis_info *axis;
309 struct scmi_sensor_intervals_info intervals;
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))
315 #define SCMI_SENS_CFG_UPDATE_EXP_MASK GENMASK(15, 11)
316 #define SCMI_SENS_CFG_GET_UPDATE_EXP(x) \
319 FIELD_GET(SCMI_SENS_CFG_UPDATE_EXP_MASK, (x)); \
321 if (__signed_exp & BIT(4)) \
322 __signed_exp |= GENMASK(31, 5); \
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
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))
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
340 char name[SCMI_MAX_STR_SIZE];
341 #define SCMI_SENS_CFG_IS_ENABLED(x) FIELD_GET(BIT(0), (x))
342 bool extended_scalar_attrs;
343 unsigned int sensor_power;
344 unsigned int resolution;
346 struct scmi_range_attrs scalar_attrs;
350 * Partial list from Distributed Management Task Force (DMTF) specification:
351 * DSP0249 (Platform Level Data Model specification)
353 enum scmi_sensor_class {
423 NEWTON_METERS = 0x45,
434 CORRECTED_ERRS = 0x50,
435 UNCORRECTABLE_ERRS = 0x51,
443 METERS_SEC_SQUARED = 0x59,
445 CUBIC_METERS_SEC = 0x5B,
447 RADIANS_SEC_SQUARED = 0x5D,
452 * struct scmi_sensor_proto_ops - represents the various operations provided
453 * by SCMI Sensor Protocol
455 * @count_get: get the count of sensors provided by SCMI
456 * @info_get: get the information of the specified sensor
457 * @trip_point_config: selects and configures a trip-point of interest
458 * @reading_get: gets the current value of the sensor
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
464 * @config_get: Get sensor current configuration
465 * @config_set: Set sensor current configuration
467 struct scmi_sensor_proto_ops {
468 int (*count_get)(const struct scmi_protocol_handle *ph);
469 const struct scmi_sensor_info *(*info_get)
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,
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);
485 * struct scmi_reset_proto_ops - represents the various operations provided
486 * by SCMI Reset Protocol
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
495 struct scmi_reset_proto_ops {
496 int (*num_domains_get)(const struct scmi_protocol_handle *ph);
497 const char *(*name_get)(const struct scmi_protocol_handle *ph,
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);
505 enum scmi_voltage_level_mode {
506 SCMI_VOLTAGE_LEVEL_SET_AUTO,
507 SCMI_VOLTAGE_LEVEL_SET_SYNC,
511 * struct scmi_voltage_info - describe one available SCMI Voltage Domain
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.
522 * @async_level_set: True when the voltage domain supports asynchronous level
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
529 struct scmi_voltage_info {
532 bool negative_volts_allowed;
533 bool async_level_set;
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
543 * struct scmi_voltage_proto_ops - represents the various operations provided
544 * by SCMI Voltage Protocol
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
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,
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,
563 int (*level_set)(const struct scmi_protocol_handle *ph, u32 domain_id,
564 enum scmi_voltage_level_mode mode, s32 volt_uV);
565 int (*level_get)(const struct scmi_protocol_handle *ph, u32 domain_id,
570 * struct scmi_notify_ops - represents notifications' operations provided by
572 * @devm_event_notifier_register: Managed registration of a notifier_block for
573 * the requested event
574 * @devm_event_notifier_unregister: Managed unregistration of a notifier_block
575 * for the requested event
576 * @event_notifier_register: Register a notifier_block for the requested event
577 * @event_notifier_unregister: Unregister a notifier_block for the requested
580 * A user can register/unregister its own notifier_block against the wanted
581 * platform instance regarding the desired event identified by the
582 * tuple: (proto_id, evt_id, src_id) using the provided register/unregister
585 * @sdev: The scmi_device to use when calling the devres managed ops devm_
586 * @handle: The handle identifying the platform instance to use, when not
587 * calling the managed ops devm_
588 * @proto_id: The protocol ID as in SCMI Specification
589 * @evt_id: The message ID of the desired event as in SCMI Specification
590 * @src_id: A pointer to the desired source ID if different sources are
591 * possible for the protocol (like domain_id, sensor_id...etc)
593 * @src_id can be provided as NULL if it simply does NOT make sense for
594 * the protocol at hand, OR if the user is explicitly interested in
595 * receiving notifications from ANY existent source associated to the
596 * specified proto_id / evt_id.
598 * Received notifications are finally delivered to the registered users,
599 * invoking the callback provided with the notifier_block *nb as follows:
601 * int user_cb(nb, evt_id, report)
605 * @nb: The notifier block provided by the user
606 * @evt_id: The message ID of the delivered event
607 * @report: A custom struct describing the specific event delivered
609 struct scmi_notify_ops {
610 int (*devm_event_notifier_register)(struct scmi_device *sdev,
611 u8 proto_id, u8 evt_id,
613 struct notifier_block *nb);
614 int (*devm_event_notifier_unregister)(struct scmi_device *sdev,
615 u8 proto_id, u8 evt_id,
617 struct notifier_block *nb);
618 int (*event_notifier_register)(const struct scmi_handle *handle,
619 u8 proto_id, u8 evt_id,
621 struct notifier_block *nb);
622 int (*event_notifier_unregister)(const struct scmi_handle *handle,
623 u8 proto_id, u8 evt_id,
625 struct notifier_block *nb);
629 * struct scmi_handle - Handle returned to ARM SCMI clients for usage.
631 * @dev: pointer to the SCMI device
632 * @version: pointer to the structure containing SCMI version information
633 * @devm_protocol_get: devres managed method to acquire a protocol and get specific
634 * operations and a dedicated protocol handler
635 * @devm_protocol_put: devres managed method to release a protocol
636 * @is_transport_atomic: method to check if the underlying transport for this
637 * instance handle is configured to support atomic
638 * transactions for commands.
639 * Some users of the SCMI stack in the upper layers could
640 * be interested to know if they can assume SCMI
641 * command transactions associated to this handle will
642 * never sleep and act accordingly.
643 * An optional atomic threshold value could be returned
645 * @notify_ops: pointer to set of notifications related operations
649 struct scmi_revision_info *version;
651 const void __must_check *
652 (*devm_protocol_get)(struct scmi_device *sdev, u8 proto,
653 struct scmi_protocol_handle **ph);
654 void (*devm_protocol_put)(struct scmi_device *sdev, u8 proto);
655 bool (*is_transport_atomic)(const struct scmi_handle *handle,
656 unsigned int *atomic_threshold);
658 const struct scmi_notify_ops *notify_ops;
661 enum scmi_std_protocol {
662 SCMI_PROTOCOL_BASE = 0x10,
663 SCMI_PROTOCOL_POWER = 0x11,
664 SCMI_PROTOCOL_SYSTEM = 0x12,
665 SCMI_PROTOCOL_PERF = 0x13,
666 SCMI_PROTOCOL_CLOCK = 0x14,
667 SCMI_PROTOCOL_SENSOR = 0x15,
668 SCMI_PROTOCOL_RESET = 0x16,
669 SCMI_PROTOCOL_VOLTAGE = 0x17,
672 enum scmi_system_events {
673 SCMI_SYSTEM_SHUTDOWN,
674 SCMI_SYSTEM_COLDRESET,
675 SCMI_SYSTEM_WARMRESET,
686 struct scmi_handle *handle;
689 #define to_scmi_dev(d) container_of(d, struct scmi_device, dev)
692 scmi_device_create(struct device_node *np, struct device *parent, int protocol,
694 void scmi_device_destroy(struct scmi_device *scmi_dev);
696 struct scmi_device_id {
703 int (*probe)(struct scmi_device *sdev);
704 void (*remove)(struct scmi_device *sdev);
705 const struct scmi_device_id *id_table;
707 struct device_driver driver;
710 #define to_scmi_driver(d) container_of(d, struct scmi_driver, driver)
712 #if IS_REACHABLE(CONFIG_ARM_SCMI_PROTOCOL)
713 int scmi_driver_register(struct scmi_driver *driver,
714 struct module *owner, const char *mod_name);
715 void scmi_driver_unregister(struct scmi_driver *driver);
718 scmi_driver_register(struct scmi_driver *driver, struct module *owner,
719 const char *mod_name)
724 static inline void scmi_driver_unregister(struct scmi_driver *driver) {}
725 #endif /* CONFIG_ARM_SCMI_PROTOCOL */
727 #define scmi_register(driver) \
728 scmi_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
729 #define scmi_unregister(driver) \
730 scmi_driver_unregister(driver)
733 * module_scmi_driver() - Helper macro for registering a scmi driver
734 * @__scmi_driver: scmi_driver structure
736 * Helper macro for scmi drivers to set up proper module init / exit
737 * functions. Replaces module_init() and module_exit() and keeps people from
738 * printing pointless things to the kernel log when their driver is loaded.
740 #define module_scmi_driver(__scmi_driver) \
741 module_driver(__scmi_driver, scmi_register, scmi_unregister)
744 * module_scmi_protocol() - Helper macro for registering a scmi protocol
745 * @__scmi_protocol: scmi_protocol structure
747 * Helper macro for scmi drivers to set up proper module init / exit
748 * functions. Replaces module_init() and module_exit() and keeps people from
749 * printing pointless things to the kernel log when their driver is loaded.
751 #define module_scmi_protocol(__scmi_protocol) \
752 module_driver(__scmi_protocol, \
753 scmi_protocol_register, scmi_protocol_unregister)
755 struct scmi_protocol;
756 int scmi_protocol_register(const struct scmi_protocol *proto);
757 void scmi_protocol_unregister(const struct scmi_protocol *proto);
759 /* SCMI Notification API - Custom Event Reports */
760 enum scmi_notification_events {
761 SCMI_EVENT_POWER_STATE_CHANGED = 0x0,
762 SCMI_EVENT_CLOCK_RATE_CHANGED = 0x0,
763 SCMI_EVENT_CLOCK_RATE_CHANGE_REQUESTED = 0x1,
764 SCMI_EVENT_PERFORMANCE_LIMITS_CHANGED = 0x0,
765 SCMI_EVENT_PERFORMANCE_LEVEL_CHANGED = 0x1,
766 SCMI_EVENT_SENSOR_TRIP_POINT_EVENT = 0x0,
767 SCMI_EVENT_SENSOR_UPDATE = 0x1,
768 SCMI_EVENT_RESET_ISSUED = 0x0,
769 SCMI_EVENT_BASE_ERROR_EVENT = 0x0,
770 SCMI_EVENT_SYSTEM_POWER_STATE_NOTIFIER = 0x0,
773 struct scmi_power_state_changed_report {
775 unsigned int agent_id;
776 unsigned int domain_id;
777 unsigned int power_state;
780 struct scmi_clock_rate_notif_report {
782 unsigned int agent_id;
783 unsigned int clock_id;
784 unsigned long long rate;
787 struct scmi_system_power_state_notifier_report {
789 unsigned int agent_id;
791 unsigned int system_state;
794 struct scmi_perf_limits_report {
796 unsigned int agent_id;
797 unsigned int domain_id;
798 unsigned int range_max;
799 unsigned int range_min;
802 struct scmi_perf_level_report {
804 unsigned int agent_id;
805 unsigned int domain_id;
806 unsigned int performance_level;
809 struct scmi_sensor_trip_point_report {
811 unsigned int agent_id;
812 unsigned int sensor_id;
813 unsigned int trip_point_desc;
816 struct scmi_sensor_update_report {
818 unsigned int agent_id;
819 unsigned int sensor_id;
820 unsigned int readings_count;
821 struct scmi_sensor_reading readings[];
824 struct scmi_reset_issued_report {
826 unsigned int agent_id;
827 unsigned int domain_id;
828 unsigned int reset_state;
831 struct scmi_base_error_report {
833 unsigned int agent_id;
835 unsigned int cmd_count;
836 unsigned long long reports[];
839 #endif /* _LINUX_SCMI_PROTOCOL_H */