scmi.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-11-26 GuEe-GUI first version
  9. */
  10. #ifndef __SCMI_H__
  11. #define __SCMI_H__
  12. #include <rtdef.h>
  13. #include <drivers/misc.h>
  14. #include <drivers/byteorder.h>
  15. #define SCMI_PROTOCOL_ID_BASE 0x10
  16. #define SCMI_PROTOCOL_ID_POWER 0x11
  17. #define SCMI_PROTOCOL_ID_SYSTEM 0x12
  18. #define SCMI_PROTOCOL_ID_PERF 0x13
  19. #define SCMI_PROTOCOL_ID_CLOCK 0x14
  20. #define SCMI_PROTOCOL_ID_SENSOR 0x15
  21. #define SCMI_PROTOCOL_ID_RESET 0x16
  22. #define SCMI_PROTOCOL_ID_VOLTAGE 0x17
  23. #define SCMI_PROTOCOL_ID_POWERCAP 0x18
  24. #define SCMI_PROTOCOL_ID_PINCTRL 0x19
  25. #define SCMI_SUCCESS 0 /* Success */
  26. #define SCMI_ERR_SUPPORT (-1) /* Not supported */
  27. #define SCMI_ERR_PARAMS (-2) /* Invalid Parameters */
  28. #define SCMI_ERR_ACCESS (-3) /* Invalid access/permission denied */
  29. #define SCMI_ERR_ENTRY (-4) /* Not found */
  30. #define SCMI_ERR_RANGE (-5) /* Value out of range */
  31. #define SCMI_ERR_BUSY (-6) /* Device busy */
  32. #define SCMI_ERR_COMMS (-7) /* Communication Error */
  33. #define SCMI_ERR_GENERIC (-8) /* Generic Error */
  34. #define SCMI_ERR_HARDWARE (-9) /* Hardware Error */
  35. #define SCMI_ERR_PROTOCOL (-10) /* Protocol Error */
  36. #define SCMI_MAX_STR_SIZE 64
  37. #define SCMI_SHORT_NAME_MAX_SIZE 16
  38. #define SCMI_MAX_NUM_RATES 16
  39. struct rt_scmi_device;
  40. typedef void (*rt_scmi_msg_callback)(struct rt_scmi_device *sdev, rt_uint8_t *msg, rt_size_t size);
  41. /*
  42. * struct rt_scmi_msg - Context of a SCMI message sent and the response received
  43. *
  44. */
  45. struct rt_scmi_msg
  46. {
  47. struct rt_scmi_device *sdev;
  48. rt_scmi_msg_callback rx_callback;
  49. rt_uint32_t message_id;
  50. rt_uint8_t *in_msg;
  51. rt_size_t in_msg_size;
  52. rt_uint8_t *out_msg;
  53. rt_size_t out_msg_size;
  54. };
  55. /* Helper macro to match a message on input/output array references */
  56. #define RT_SCMI_MSG_RAW(MSG_ID, IN, IN_SIZE, OUT, OUT_SIZE) \
  57. (struct rt_scmi_msg) { \
  58. .message_id = MSG_ID, \
  59. .in_msg = (rt_uint8_t *)(IN), \
  60. .in_msg_size = IN_SIZE, \
  61. .out_msg = (rt_uint8_t *)(OUT), \
  62. .out_msg_size = OUT_SIZE, \
  63. }
  64. #define RT_SCMI_MSG_IN_OUT(MSG_ID, IN, OUT) \
  65. RT_SCMI_MSG_RAW(MSG_ID, IN, sizeof(*(IN)), OUT, sizeof(*(OUT)))
  66. #define RT_SCMI_MSG_IN(MSG_ID, IN) \
  67. RT_SCMI_MSG_RAW(MSG_ID, IN, sizeof(*(IN)), RT_NULL, 0)
  68. #define RT_SCMI_MSG_OUT(MSG_ID, OUT) \
  69. RT_SCMI_MSG_RAW(MSG_ID, RT_NULL, 0, OUT, sizeof(*(OUT)))
  70. #define SCMI_HDR_TOKEN(token) (((token) << 18) & RT_GENMASK(31, 18))
  71. #define SCMI_HDR_PROTOCOL_ID(proto) (((proto) << 10) & RT_GENMASK(17, 10))
  72. #define SCMI_HDR_MESSAGE_TYPE(type) (((type) << 18) & RT_GENMASK(9, 8))
  73. #define SCMI_HDR_MESSAGE_ID(id) ((id) & RT_GENMASK(7, 0))
  74. rt_inline rt_uint32_t scmi_header(unsigned msg_id, unsigned msg_type,
  75. unsigned protocol_id, unsigned token)
  76. {
  77. return SCMI_HDR_TOKEN(token) |
  78. SCMI_HDR_MESSAGE_TYPE(msg_type) |
  79. SCMI_HDR_PROTOCOL_ID(protocol_id) |
  80. SCMI_HDR_MESSAGE_ID(msg_id);
  81. }
  82. enum scmi_common_message_id
  83. {
  84. SCMI_COM_MSG_VERSION = 0x0,
  85. SCMI_COM_MSG_ATTRIBUTES = 0x1,
  86. SCMI_COM_MSG_MESSAGE_ATTRIBUTES = 0x2,
  87. };
  88. /*
  89. * SCMI Power Protocol
  90. */
  91. enum scmi_power_protocol_cmd
  92. {
  93. SCMI_POWER_DOMAIN_ATTRIBUTES = 0x3,
  94. SCMI_POWER_STATE_SET = 0x4,
  95. SCMI_POWER_STATE_GET = 0x5,
  96. SCMI_POWER_STATE_NOTIFY = 0x6,
  97. SCMI_POWER_DOMAIN_NAME_GET = 0x8,
  98. };
  99. /**
  100. * struct scmi_power_attributes - Response payload for SCMI_COM_MSG_ATTRIBUTES command
  101. */
  102. struct scmi_power_attributes
  103. {
  104. rt_le32_t state;
  105. rt_le16_t num_domains;
  106. rt_le16_t reserved;
  107. rt_le32_t stats_addr_low;
  108. rt_le32_t stats_addr_high;
  109. rt_le32_t stats_size;
  110. };
  111. /**
  112. * struct scmi_power_state_set_in - Message payload for SCMI_POWER_STATE_SET command
  113. */
  114. struct scmi_power_state_set_in
  115. {
  116. rt_le32_t flags;
  117. rt_le32_t domain;
  118. #define SCMI_POWER_STATE_TYPE_SHIFT 30
  119. #define SCMI_POWER_STATE_ID_MASK (RT_BIT(28) - 1)
  120. #define SCMI_POWER_STATE_PARAM(type, id) ((((type) & RT_BIT(0)) << SCMI_POWER_STATE_TYPE_SHIFT) | ((id) & SCMI_POWER_STATE_ID_MASK))
  121. #define SCMI_POWER_STATE_GENERIC_ON SCMI_POWER_STATE_PARAM(0, 0)
  122. #define SCMI_POWER_STATE_GENERIC_OFF SCMI_POWER_STATE_PARAM(1, 0)
  123. rt_le32_t state;
  124. };
  125. /**
  126. * struct scmi_power_state_set_out - Response payload for SCMI_POWER_STATE_SET command
  127. */
  128. struct scmi_power_state_set_out
  129. {
  130. rt_le32_t state;
  131. };
  132. /*
  133. * SCMI Clock Protocol
  134. */
  135. enum scmi_clock_message_id
  136. {
  137. SCMI_CLOCK_ATTRIBUTES = 0x3,
  138. SCMI_CLOCK_DESCRIBE_RATES = 0x4,
  139. SCMI_CLOCK_RATE_SET = 0x5,
  140. SCMI_CLOCK_RATE_GET = 0x6,
  141. SCMI_CLOCK_CONFIG_SET = 0x7,
  142. SCMI_CLOCK_NAME_GET = 0x8,
  143. };
  144. /**
  145. * struct scmi_clk_attributes - Response payload for SCMI_COM_MSG_ATTRIBUTES command
  146. */
  147. struct scmi_clk_attributes
  148. {
  149. rt_le32_t status;
  150. rt_le16_t num_clocks;
  151. rt_uint8_t max_async_req;
  152. rt_uint8_t reserved;
  153. };
  154. /**
  155. * struct scmi_clk_describe_attributes_in - Message payload for SCMI_CLOCK_ATTRIBUTES command
  156. */
  157. struct scmi_clk_describe_attributes_in
  158. {
  159. rt_le32_t clock_id;
  160. };
  161. /**
  162. * struct scmi_clk_describe_attributes_out - Response payload for SCMI_CLOCK_ATTRIBUTES command
  163. * clock in response to a clock enable request from an agent
  164. */
  165. struct scmi_clk_describe_attributes_out
  166. {
  167. rt_le32_t status;
  168. rt_le32_t attributes;
  169. #define CLOCK_ENABLE RT_BIT(0)
  170. #define SUPPORTS_RATE_CHANGED_NOTIF(x) ((x) & RT_BIT(31))
  171. #define SUPPORTS_RATE_CHANGE_REQUESTED_NOTIF(x) ((x) & RT_BIT(30))
  172. #define SUPPORTS_EXTENDED_NAMES(x) ((x) & RT_BIT(29))
  173. rt_uint8_t name[SCMI_SHORT_NAME_MAX_SIZE];
  174. rt_le32_t clock_enable_latency;
  175. };
  176. /**
  177. * struct scmi_clk_describe_rates_in - Message payload for SCMI_CLOCK_DESCRIBE_RATES command
  178. */
  179. struct scmi_clk_describe_rates_in
  180. {
  181. rt_le32_t id;
  182. rt_le32_t rate_index;
  183. };
  184. /**
  185. * struct scmi_clk_describe_rates_out - Response payload for SCMI_CLOCK_DESCRIBE_RATES command
  186. */
  187. struct scmi_clk_describe_rates_out
  188. {
  189. rt_le32_t status;
  190. rt_le32_t num_rates_flags;
  191. #define SCMI_NUM_RETURNED(x) ((x) & 0xfff)
  192. #define SCMI_RATE_DISCRETE(x) !((x) & RT_BIT(12))
  193. #define SCMI_NUM_REMAINING(x) ((x) >> 16)
  194. struct
  195. {
  196. rt_le32_t value_low;
  197. rt_le32_t value_high;
  198. } rate[];
  199. #define SCMI_RATE_TO_U64(X) \
  200. ({ \
  201. typeof(X) x = (X); \
  202. rt_le32_to_cpu((x).value_low) | (rt_uint64_t)rt_le32_to_cpu((x).value_high) << 32; \
  203. })
  204. };
  205. /**
  206. * struct scmi_clk_state_in - Message payload for SCMI_CLOCK_RATE_SET command
  207. */
  208. struct scmi_clk_rate_set_in
  209. {
  210. #define SCMI_CLK_RATE_ASYNC_NOTIFY RT_BIT(0)
  211. #define SCMI_CLK_RATE_ASYNC_NORESP (RT_BIT(0) | RT_BIT(1))
  212. #define SCMI_CLK_RATE_ROUND_DOWN 0
  213. #define SCMI_CLK_RATE_ROUND_UP RT_BIT(2)
  214. #define SCMI_CLK_RATE_ROUND_CLOSEST RT_BIT(3)
  215. rt_le32_t flags;
  216. rt_le32_t clock_id;
  217. rt_le32_t rate_lsb;
  218. rt_le32_t rate_msb;
  219. };
  220. /**
  221. * struct scmi_clk_rate_set_out - Response payload for SCMI_CLOCK_RATE_SET command
  222. */
  223. struct scmi_clk_rate_set_out
  224. {
  225. rt_le32_t status;
  226. };
  227. /**
  228. * struct scmi_clk_state_in - Message payload for SCMI_CLOCK_RATE_GET command
  229. */
  230. struct scmi_clk_rate_get_in
  231. {
  232. rt_le32_t clock_id;
  233. };
  234. /**
  235. * struct scmi_clk_rate_get_out - Response payload for SCMI_CLOCK_RATE_GET command
  236. */
  237. struct scmi_clk_rate_get_out
  238. {
  239. rt_le32_t status;
  240. rt_le32_t rate_lsb;
  241. rt_le32_t rate_msb;
  242. };
  243. /**
  244. * struct scmi_clk_state_in - Message payload for SCMI_CLOCK_CONFIG_SET command
  245. */
  246. struct scmi_clk_state_in
  247. {
  248. rt_le32_t clock_id;
  249. rt_le32_t attributes;
  250. rt_le32_t ext_config_val;
  251. };
  252. /**
  253. * struct scmi_clk_state_out - Response payload for SCMI_CLOCK_CONFIG_SET command
  254. */
  255. struct scmi_clk_state_out
  256. {
  257. rt_le32_t status;
  258. };
  259. /**
  260. * struct scmi_clk_name_in - Message payload for SCMI_CLOCK_NAME_GET command
  261. */
  262. struct scmi_clk_name_in
  263. {
  264. rt_le32_t clock_id;
  265. };
  266. /**
  267. * struct scmi_clk_name_out - Response payload for SCMI_CLOCK_NAME_GET command
  268. */
  269. struct scmi_clk_name_out
  270. {
  271. rt_le32_t status;
  272. rt_le32_t flags;
  273. rt_uint8_t name[SCMI_MAX_STR_SIZE];
  274. };
  275. /*
  276. * SCMI Sensor Domain Protocol
  277. */
  278. enum scmi_sensor_message_id
  279. {
  280. SCMI_SENSOR_DESCRIPTION_GET = 0x3,
  281. SCMI_SENSOR_TRIP_POINT_NOTIFY = 0x4,
  282. SCMI_SENSOR_TRIP_POINT_CONFIG = 0x5,
  283. SCMI_SENSOR_READING_GET = 0x6,
  284. SCMI_SENSOR_AXIS_DESCRIPTION_GET = 0x7,
  285. SCMI_SENSOR_LIST_UPDATE_INTERVALS = 0x8,
  286. SCMI_SENSOR_CONFIG_GET = 0x9,
  287. SCMI_SENSOR_CONFIG_SET = 0xa,
  288. SCMI_SENSOR_CONTINUOUS_UPDATE_NOTIFY = 0xb,
  289. SCMI_SENSOR_NAME_GET = 0xc,
  290. SCMI_SENSOR_AXIS_NAME_GET = 0xd,
  291. };
  292. enum scmi_sensor_type
  293. {
  294. SCMI_SENSOR_TYPE_NONE = 0x0,
  295. SCMI_SENSOR_TYPE_UNSPEC = 0x1,
  296. SCMI_SENSOR_TYPE_TEMPERATURE_C = 0x2,
  297. SCMI_SENSOR_TYPE_TEMPERATURE_F = 0x3,
  298. SCMI_SENSOR_TYPE_TEMPERATURE_K = 0x4,
  299. SCMI_SENSOR_TYPE_VOLTAGE = 0x5,
  300. SCMI_SENSOR_TYPE_CURRENT = 0x6,
  301. SCMI_SENSOR_TYPE_POWER = 0x7,
  302. SCMI_SENSOR_TYPE_ENERGY = 0x8,
  303. SCMI_SENSOR_TYPE_CHARGE = 0x9,
  304. SCMI_SENSOR_TYPE_VOLTAMPERE = 0xa,
  305. SCMI_SENSOR_TYPE_NITS = 0xb,
  306. SCMI_SENSOR_TYPE_LUMENS = 0xc,
  307. SCMI_SENSOR_TYPE_LUX = 0xd,
  308. SCMI_SENSOR_TYPE_CANDELAS = 0xe,
  309. SCMI_SENSOR_TYPE_KPA = 0xf,
  310. SCMI_SENSOR_TYPE_PSI = 0x10,
  311. SCMI_SENSOR_TYPE_NEWTON = 0x11,
  312. SCMI_SENSOR_TYPE_CFM = 0x12,
  313. SCMI_SENSOR_TYPE_RPM = 0x13,
  314. SCMI_SENSOR_TYPE_HERTZ = 0x14,
  315. SCMI_SENSOR_TYPE_SECS = 0x15,
  316. SCMI_SENSOR_TYPE_MINS = 0x16,
  317. SCMI_SENSOR_TYPE_HOURS = 0x17,
  318. SCMI_SENSOR_TYPE_DAYS = 0x18,
  319. SCMI_SENSOR_TYPE_WEEKS = 0x19,
  320. SCMI_SENSOR_TYPE_MILS = 0x1a,
  321. SCMI_SENSOR_TYPE_INCHES = 0x1b,
  322. SCMI_SENSOR_TYPE_FEET = 0x1c,
  323. SCMI_SENSOR_TYPE_CUBIC_INCHES = 0x1d,
  324. SCMI_SENSOR_TYPE_CUBIC_FEET = 0x1e,
  325. SCMI_SENSOR_TYPE_METERS = 0x1f,
  326. SCMI_SENSOR_TYPE_CUBIC_CM = 0x20,
  327. SCMI_SENSOR_TYPE_CUBIC_METERS = 0x21,
  328. SCMI_SENSOR_TYPE_LITERS = 0x22,
  329. SCMI_SENSOR_TYPE_FLUID_OUNCES = 0x23,
  330. SCMI_SENSOR_TYPE_RADIANS = 0x24,
  331. SCMI_SENSOR_TYPE_STERADIANS = 0x25,
  332. SCMI_SENSOR_TYPE_REVOLUTIONS = 0x26,
  333. SCMI_SENSOR_TYPE_CYCLES = 0x27,
  334. SCMI_SENSOR_TYPE_GRAVITIES = 0x28,
  335. SCMI_SENSOR_TYPE_OUNCES = 0x29,
  336. SCMI_SENSOR_TYPE_POUNDS = 0x2a,
  337. SCMI_SENSOR_TYPE_FOOT_POUNDS = 0x2b,
  338. SCMI_SENSOR_TYPE_OUNCE_INCHES = 0x2c,
  339. SCMI_SENSOR_TYPE_GAUSS = 0x2d,
  340. SCMI_SENSOR_TYPE_GILBERTS = 0x2e,
  341. SCMI_SENSOR_TYPE_HENRIES = 0x2f,
  342. SCMI_SENSOR_TYPE_FARADS = 0x30,
  343. SCMI_SENSOR_TYPE_OHMS = 0x31,
  344. SCMI_SENSOR_TYPE_SIEMENS = 0x32,
  345. SCMI_SENSOR_TYPE_MOLES = 0x33,
  346. SCMI_SENSOR_TYPE_BECQUERELS = 0x34,
  347. SCMI_SENSOR_TYPE_PPM = 0x35,
  348. SCMI_SENSOR_TYPE_DECIBELS = 0x36,
  349. SCMI_SENSOR_TYPE_DBA = 0x37,
  350. SCMI_SENSOR_TYPE_DBC = 0x38,
  351. SCMI_SENSOR_TYPE_GRAYS = 0x39,
  352. SCMI_SENSOR_TYPE_SIEVERTS = 0x3a,
  353. SCMI_SENSOR_TYPE_COLOR_TEMP_K = 0x3b,
  354. SCMI_SENSOR_TYPE_BITS = 0x3c,
  355. SCMI_SENSOR_TYPE_BYTES = 0x3d,
  356. SCMI_SENSOR_TYPE_WORDS = 0x3e,
  357. SCMI_SENSOR_TYPE_DWORDS = 0x3f,
  358. SCMI_SENSOR_TYPE_QWORDS = 0x40,
  359. SCMI_SENSOR_TYPE_PERCENTAGE = 0x41,
  360. SCMI_SENSOR_TYPE_PASCALS = 0x42,
  361. SCMI_SENSOR_TYPE_COUNTS = 0x43,
  362. SCMI_SENSOR_TYPE_GRAMS = 0x44,
  363. SCMI_SENSOR_TYPE_NEWTON_METERS = 0x45,
  364. SCMI_SENSOR_TYPE_HITS = 0x46,
  365. SCMI_SENSOR_TYPE_MISSES = 0x47,
  366. SCMI_SENSOR_TYPE_RETRIES = 0x48,
  367. SCMI_SENSOR_TYPE_OVERRUNS = 0x49,
  368. SCMI_SENSOR_TYPE_UNDERRUNS = 0x4a,
  369. SCMI_SENSOR_TYPE_COLLISIONS = 0x4b,
  370. SCMI_SENSOR_TYPE_PACKETS = 0x4c,
  371. SCMI_SENSOR_TYPE_MESSAGES = 0x4d,
  372. SCMI_SENSOR_TYPE_CHARS = 0x4e,
  373. SCMI_SENSOR_TYPE_ERRORS = 0x4f,
  374. SCMI_SENSOR_TYPE_CORRECTED_ERRS = 0x50,
  375. SCMI_SENSOR_TYPE_UNCORRECTABLE_ERRS = 0x51,
  376. SCMI_SENSOR_TYPE_SQ_MILS = 0x52,
  377. SCMI_SENSOR_TYPE_SQ_INCHES = 0x53,
  378. SCMI_SENSOR_TYPE_SQ_FEET = 0x54,
  379. SCMI_SENSOR_TYPE_SQ_CM = 0x55,
  380. SCMI_SENSOR_TYPE_SQ_METERS = 0x56,
  381. SCMI_SENSOR_TYPE_RADIANS_SEC = 0x57,
  382. SCMI_SENSOR_TYPE_BPM = 0x58,
  383. SCMI_SENSOR_TYPE_METERS_SEC_SQUARED = 0x59,
  384. SCMI_SENSOR_TYPE_METERS_SEC = 0x5a,
  385. SCMI_SENSOR_TYPE_CUBIC_METERS_SEC = 0x5b,
  386. SCMI_SENSOR_TYPE_MM_MERCURY = 0x5c,
  387. SCMI_SENSOR_TYPE_RADIANS_SEC_SQUARED = 0x5d,
  388. SCMI_SENSOR_TYPE_OEM_UNIT = 0xff
  389. };
  390. /**
  391. * struct scmi_sensor_attributes - Response payload for SCMI_COM_MSG_ATTRIBUTES command
  392. */
  393. struct scmi_sensor_attributes
  394. {
  395. rt_le16_t num_sensors;
  396. rt_uint8_t max_requests;
  397. rt_uint8_t reserved;
  398. rt_le32_t reg_addr_low;
  399. rt_le32_t reg_addr_high;
  400. rt_le32_t reg_size;
  401. };
  402. /**
  403. * struct scmi_sensor_description_get_in - Payload for SCMI_SENSOR_DESCRIPTION_GET command
  404. */
  405. struct scmi_sensor_description_get_in
  406. {
  407. rt_le32_t desc_index;
  408. };
  409. /**
  410. * struct scmi_sensor_description_get_out - Response payload for SCMI_SENSOR_DESCRIPTION_GET command
  411. */
  412. struct scmi_sensor_description_get_out
  413. {
  414. rt_le32_t status;
  415. #define SCMI_SENSOR_DESC_RETURNED_NR(x) RT_FIELD_GET(RT_GENMASK(11, 0), (x))
  416. #define SCMI_SENSOR_DESC_REMAINING_NR(x) RT_FIELD_GET(RT_GENMASK(31, 16), (x))
  417. rt_le32_t num_sensor_flags;
  418. struct
  419. {
  420. rt_le32_t id;
  421. #define SCMI_SENSOR_ASYNC_READ(x) RT_FIELD_GET(RT_BIT(31), (x))
  422. #define SCMI_SENSOR_EXT_NAMES(x) RT_FIELD_GET(RT_BIT(29), (x))
  423. #define SCMI_SENSOR_TRIP_POINTS_NR(x) RT_FIELD_GET(RT_GENMASK(7, 0), (x))
  424. rt_le32_t attributes_low;
  425. #define SCMI_SENSOR_SCALE(x) RT_FIELD_GET(RT_GENMASK(15, 11), (x))
  426. #define SCMI_SENSOR_SCALE_SIGN RT_BIT(4)
  427. #define SCMI_SENSOR_SCALE_EXTEND RT_GENMASK(31, 5)
  428. #define SCMI_SENSOR_TYPE(x) RT_FIELD_GET(RT_GENMASK(7, 0), (x))
  429. rt_le32_t attributes_high;
  430. rt_uint8_t name[SCMI_SHORT_NAME_MAX_SIZE];
  431. rt_le32_t power;
  432. rt_le32_t resolution;
  433. rt_le32_t min_range_low;
  434. rt_le32_t min_range_high;
  435. rt_le32_t max_range_low;
  436. rt_le32_t max_range_high;
  437. } desc[];
  438. };
  439. /**
  440. * struct scmi_scmi_sensor_axis_description_get_in - Payload for SCMI_SENSOR_AXIS_DESCRIPTION_GET command
  441. */
  442. struct scmi_scmi_sensor_axis_description_get_in
  443. {
  444. rt_le32_t id;
  445. rt_le32_t axis_desc_index;
  446. };
  447. /**
  448. * struct scmi_scmi_sensor_axis_description_get_out - Response payload for SCMI_SENSOR_AXIS_DESCRIPTION_GET command
  449. */
  450. struct scmi_scmi_sensor_axis_description_get_out
  451. {
  452. rt_le32_t status;
  453. #define SCMI_SENSOR_AXIS_RETURNED_NR(x) RT_FIELD_GET(RT_GENMASK(5, 0), (x))
  454. #define SCMI_SENSOR_AXIS_REMAINING_NR(x) RT_FIELD_GET(RT_GENMASK(31, 26), (x))
  455. rt_le32_t num_axis_flags;
  456. struct
  457. {
  458. rt_le32_t axis_id;
  459. #define SCMI_SENSOR_AXIS_EXT_AXIS_NAME(x) RT_FIELD_GET(RT_BIT(9), (x))
  460. rt_le32_t axis_attributes_low;
  461. #define SCMI_SENSOR_AXIS_SCALE(x) RT_FIELD_GET(RT_GENMASK(15, 11), (x))
  462. #define SCMI_SENSOR_AXIS_TYPE(x) RT_FIELD_GET(RT_GENMASK(7, 0), (x))
  463. rt_le32_t axis_attributes_high;
  464. rt_uint8_t name[SCMI_SHORT_NAME_MAX_SIZE];
  465. rt_le32_t axis_resolution;
  466. rt_le32_t axis_min_range_low;
  467. rt_le32_t axis_min_range_high;
  468. rt_le32_t axis_max_range_low;
  469. rt_le32_t axis_max_range_high;
  470. } desc[];
  471. };
  472. /**
  473. * struct scmi_sensor_list_update_intervals_in - Payload for SCMI_SENSOR_LIST_UPDATE_INTERVALS command
  474. */
  475. struct scmi_sensor_list_update_intervals_in
  476. {
  477. rt_le32_t id;
  478. rt_le32_t index;
  479. };
  480. /**
  481. * struct scmi_sensor_list_update_intervals_out - Response payload for SCMI_SENSOR_LIST_UPDATE_INTERVALS command
  482. */
  483. struct scmi_sensor_list_update_intervals_out
  484. {
  485. rt_le32_t status;
  486. rt_le32_t flags;
  487. rt_le32_t intervals[];
  488. };
  489. /**
  490. * struct scmi_sensor_trip_point_notify_in - Payload for SCMI_SENSOR_TRIP_POINT_NOTIFY command
  491. */
  492. struct scmi_sensor_trip_point_notify_in
  493. {
  494. rt_le32_t id;
  495. #define SCMI_SENSOR_NOTIFY_ALL RT_BIT(0)
  496. rt_le32_t event_control;
  497. };
  498. /**
  499. * struct scmi_sensor_trip_point_notify_out - Response payload for SCMI_SENSOR_TRIP_POINT_NOTIFY command
  500. */
  501. struct scmi_sensor_trip_point_notify_out
  502. {
  503. rt_le32_t status;
  504. };
  505. /**
  506. * struct scmi_sensor_trip_point_config_in - Payload for SCMI_SENSOR_TRIP_POINT_CONFIG command
  507. */
  508. struct scmi_sensor_trip_point_config_in
  509. {
  510. rt_le32_t id;
  511. #define SCMI_SENSOR_TRIP_POINT_EVENT_MASK 0x3
  512. #define SCMI_SENSOR_TRIP_POINT_DISABLED 0x0
  513. #define SCMI_SENSOR_TRIP_POINT_POSITIVE 0x1
  514. #define SCMI_SENSOR_TRIP_POINT_NEGATIVE 0x2
  515. #define SCMI_SENSOR_TRIP_POINT_BOTH 0x3
  516. #define SCMI_SENSOR_TRIP_POINT_ID(x) (((x) & 0xff) << 4)
  517. rt_le32_t trip_point_ev_ctrl;
  518. rt_le32_t trip_point_val_low;
  519. rt_le32_t trip_point_val_high;
  520. };
  521. /**
  522. * struct scmi_sensor_trip_point_config_out - Response payload for SCMI_SENSOR_TRIP_POINT_CONFIG command
  523. */
  524. struct scmi_sensor_trip_point_config_out
  525. {
  526. rt_le32_t status;
  527. };
  528. /**
  529. * struct scmi_sensor_config_get_in - Payload for SCMI_SENSOR_CONFIG_GET command
  530. */
  531. struct scmi_sensor_config_get_in
  532. {
  533. rt_le32_t id;
  534. };
  535. /**
  536. * struct scmi_sensor_config_get_out - Response payload for SCMI_SENSOR_CONFIG_GET command
  537. */
  538. struct scmi_sensor_config_get_out
  539. {
  540. rt_le32_t status;
  541. #define SCMI_SENSOR_INTERVALS_SEC(x) RT_FIELD_GET(RT_GENMASK(31, 16), (x))
  542. #define SCMI_SENSOR_INTERVALS_EXP(x) RT_FIELD_GET(RT_GENMASK(15, 11), (x)) /* SEC x (10 ^ EXP) */
  543. #define SCMI_SENSOR_TEMP_RP(x) RT_FIELD_GET(RT_BIT(1), (x))
  544. #define SCMI_SENSOR_STATUS_EN(x) RT_FIELD_GET(RT_BIT(0), (x))
  545. rt_le32_t config;
  546. };
  547. /**
  548. * struct scmi_sensor_config_set_in - Payload for SCMI_SENSOR_CONFIG_SET command
  549. */
  550. struct scmi_sensor_config_set_in
  551. {
  552. rt_le32_t id;
  553. rt_le32_t config;
  554. };
  555. /**
  556. * struct scmi_sensor_config_set_out - Response payload for SCMI_SENSOR_CONFIG_SET command
  557. */
  558. struct scmi_sensor_config_set_out
  559. {
  560. rt_le32_t status;
  561. };
  562. /**
  563. * struct scmi_sensor_reading_in - Payload for SCMI_SENSOR_READING_GET command
  564. */
  565. struct scmi_sensor_reading_in
  566. {
  567. rt_le32_t id;
  568. #define SCMI_SENSOR_FLAG_ASYNC RT_BIT(0)
  569. rt_le32_t flags;
  570. };
  571. /**
  572. * struct scmi_sensor_reading_out - Response payload for SCMI_SENSOR_READING_GET command
  573. */
  574. struct scmi_sensor_reading_out
  575. {
  576. rt_le32_t status;
  577. struct
  578. {
  579. rt_le32_t value_low;
  580. rt_le32_t value_high;
  581. rt_le32_t timestamp_low;
  582. rt_le32_t timestamp_high;
  583. } readings[];
  584. };
  585. /**
  586. * struct scmi_sensor_continuous_update_notify_in - Payload for SCMI_SENSOR_CONTINUOUS_UPDATE_NOTIFY command
  587. */
  588. struct scmi_sensor_continuous_update_notify_in
  589. {
  590. rt_le32_t id;
  591. #define SCMI_SENSOR_FLAG_NOTIFY_ENABLE RT_BIT(0)
  592. rt_le32_t notify_enable;
  593. };
  594. /**
  595. * struct scmi_sensor_continuous_update_notify_out - Response payload for SCMI_SENSOR_CONTINUOUS_UPDATE_NOTIFY command
  596. */
  597. struct scmi_sensor_continuous_update_notify_out
  598. {
  599. rt_le32_t status;
  600. };
  601. /**
  602. * struct scmi_sensor_name_in - Payload for SCMI_SENSOR_NAME_GET command
  603. */
  604. struct scmi_sensor_name_in
  605. {
  606. rt_le32_t id;
  607. };
  608. /**
  609. * struct scmi_sensor_name_out - Response payload for SCMI_SENSOR_NAME_GET command
  610. */
  611. struct scmi_sensor_name_out
  612. {
  613. rt_le32_t status;
  614. rt_le32_t flags;
  615. rt_uint8_t name[SCMI_MAX_STR_SIZE];
  616. };
  617. /**
  618. * struct scmi_sensor_axis_name_in - Payload for SCMI_SENSOR_AXIS_NAME_GET command
  619. */
  620. struct scmi_sensor_axis_name_in
  621. {
  622. rt_le32_t id;
  623. rt_le32_t axis_id;
  624. };
  625. /**
  626. * struct scmi_sensor_axis_name_out - Response payload for SCMI_SENSOR_AXIS_NAME_GET command
  627. */
  628. struct scmi_sensor_axis_name_out
  629. {
  630. rt_le32_t status;
  631. rt_le32_t flags;
  632. struct
  633. {
  634. rt_le32_t axis_id;
  635. rt_uint8_t name[SCMI_MAX_STR_SIZE];
  636. } desc[];
  637. };
  638. /*
  639. * SCMI Reset Domain Protocol
  640. */
  641. enum scmi_reset_message_id
  642. {
  643. SCMI_RESET_DOMAIN_ATTRIBUTES = 0x3,
  644. SCMI_RESET_RESET = 0x4,
  645. };
  646. #define SCMI_RESET_ATTRIBUTES_FLAG_ASYNC RT_BIT(31)
  647. #define SCMI_RESET_ATTRIBUTES_FLAG_NOTIF RT_BIT(30)
  648. /**
  649. * struct scmi_reset_attr_in - Payload for SCMI_RESET_DOMAIN_ATTRIBUTES message
  650. */
  651. struct scmi_reset_attr_in
  652. {
  653. rt_le32_t domain_id;
  654. };
  655. /**
  656. * struct scmi_reset_attr_out - Payload for SCMI_RESET_DOMAIN_ATTRIBUTES response
  657. */
  658. struct scmi_reset_attr_out
  659. {
  660. rt_le32_t status;
  661. rt_le32_t attributes;
  662. rt_le32_t latency;
  663. rt_uint8_t name[SCMI_SHORT_NAME_MAX_SIZE];
  664. };
  665. /**
  666. * struct scmi_reset_in - Message payload for SCMI_RESET_RESET command
  667. */
  668. struct scmi_reset_in
  669. {
  670. rt_le32_t domain_id;
  671. #define SCMI_RESET_FLAG_RESET RT_BIT(0)
  672. #define SCMI_RESET_FLAG_ASSERT RT_BIT(1)
  673. #define SCMI_RESET_FLAG_ASYNC RT_BIT(2)
  674. rt_le32_t flags;
  675. #define SCMI_ARCH_COLD_RESET 0
  676. rt_le32_t reset_state;
  677. };
  678. /**
  679. * struct scmi_reset_out - Response payload for SCMI_RESET_RESET command
  680. */
  681. struct scmi_reset_out
  682. {
  683. rt_le32_t status;
  684. };
  685. /*
  686. * SCMI Voltage Domain Protocol
  687. */
  688. enum scmi_voltage_domain_message_id
  689. {
  690. SCMI_VOLTAGE_DOMAIN_ATTRIBUTES = 0x3,
  691. SCMI_VOLTAGE_DOMAIN_CONFIG_SET = 0x5,
  692. SCMI_VOLTAGE_DOMAIN_CONFIG_GET = 0x6,
  693. SCMI_VOLTAGE_DOMAIN_LEVEL_SET = 0x7,
  694. SCMI_VOLTAGE_DOMAIN_LEVEL_GET = 0x8,
  695. };
  696. #define SCMI_VOLTAGE_CONFIG_MASK RT_GENMASK(3, 0)
  697. #define SCMI_VOLTAGE_CONFIG_OFF 0
  698. #define SCMI_VOLTAGE_CONFIG_ON 0x7
  699. /**
  700. * struct scmi_voltage_attributes - Response payload for SCMI_COM_MSG_ATTRIBUTES command
  701. */
  702. struct scmi_voltage_attributes
  703. {
  704. rt_le32_t status;
  705. rt_le16_t num_domains;
  706. rt_le16_t reserved;
  707. };
  708. /**
  709. * struct scmi_voltage_attr_in - Payload for SCMI_VOLTAGE_DOMAIN_ATTRIBUTES message
  710. */
  711. struct scmi_voltage_attr_in
  712. {
  713. rt_le32_t domain_id;
  714. };
  715. /**
  716. * struct scmi_voltage_attr_out - Payload for SCMI_VOLTAGE_DOMAIN_ATTRIBUTES response
  717. */
  718. struct scmi_voltage_attr_out
  719. {
  720. rt_le32_t status;
  721. rt_le32_t attributes;
  722. char name[SCMI_SHORT_NAME_MAX_SIZE];
  723. };
  724. /**
  725. * struct scmi_voltage_config_set_in - Message payload for SCMI_VOLTAGE_DOMAIN_CONFIG_SET cmd
  726. */
  727. struct scmi_voltage_config_set_in
  728. {
  729. rt_le32_t domain_id;
  730. rt_le32_t config;
  731. };
  732. /**
  733. * struct scmi_voltage_config_set_out - Response for SCMI_VOLTAGE_DOMAIN_CONFIG_SET command
  734. */
  735. struct scmi_voltage_config_set_out
  736. {
  737. rt_le32_t status;
  738. };
  739. /**
  740. * struct scmi_voltage_config_get_in - Message payload for SCMI_VOLTAGE_CONFIG_GET cmd
  741. */
  742. struct scmi_voltage_config_get_in
  743. {
  744. rt_le32_t domain_id;
  745. };
  746. /**
  747. * struct scmi_voltage_config_get_out - Response for SCMI_VOLTAGE_CONFIG_GET command
  748. */
  749. struct scmi_voltage_config_get_out
  750. {
  751. rt_le32_t status;
  752. rt_le32_t config;
  753. };
  754. /**
  755. * struct scmi_voltage_level_set_in - Message payload for SCMI_VOLTAGE_DOMAIN_LEVEL_SET cmd
  756. */
  757. struct scmi_voltage_level_set_in
  758. {
  759. rt_le32_t domain_id;
  760. rt_le32_t flags;
  761. rt_le32_t voltage_level;
  762. };
  763. /**
  764. * struct scmi_voltage_level_set_out - Response for SCMI_VOLTAGE_DOMAIN_LEVEL_SET command
  765. */
  766. struct scmi_voltage_level_set_out
  767. {
  768. rt_le32_t status;
  769. };
  770. /**
  771. * struct scmi_voltage_level_get_in - Message payload for SCMI_VOLTAGE_DOMAIN_LEVEL_GET cmd
  772. */
  773. struct scmi_voltage_level_get_in
  774. {
  775. rt_le32_t domain_id;
  776. };
  777. /**
  778. * struct scmi_voltage_level_get_out - Response for SCMI_VOLTAGE_DOMAIN_LEVEL_GET command
  779. */
  780. struct scmi_voltage_level_get_out
  781. {
  782. rt_le32_t status;
  783. rt_le32_t voltage_level;
  784. };
  785. /*
  786. * SCMI Pinctrl Protocol
  787. */
  788. enum scmi_pinctrl_message_id
  789. {
  790. SCMI_PINCTRL_ATTRIBUTES = 0x3,
  791. SCMI_PINCTRL_LIST_ASSOCIATIONS = 0x4,
  792. SCMI_PINCTRL_SETTINGS_GET = 0x5,
  793. SCMI_PINCTRL_SETTINGS_CONFIGURE = 0x6,
  794. SCMI_PINCTRL_REQUEST = 0x7,
  795. SCMI_PINCTRL_RELEASE = 0x8,
  796. SCMI_PINCTRL_NAME_GET = 0x9,
  797. SCMI_PINCTRL_SET_PERMISSIONS = 0xa,
  798. };
  799. enum scmi_pinctrl_selector_type
  800. {
  801. SCMI_PINCTRL_TYPE_PIN = 0,
  802. SCMI_PINCTRL_TYPE_GROUP,
  803. SCMI_PINCTRL_TYPE_FUNCTION,
  804. };
  805. enum scmi_pinctrl_conf_type
  806. {
  807. SCMI_PINCTRL_DEFAULT = 0,
  808. SCMI_PINCTRL_BIAS_BUS_HOLD = 1,
  809. SCMI_PINCTRL_BIAS_DISABLE = 2,
  810. SCMI_PINCTRL_BIAS_HIGH_IMPEDANCE = 3,
  811. SCMI_PINCTRL_BIAS_PULL_UP = 4,
  812. SCMI_PINCTRL_BIAS_PULL_DEFAULT = 5,
  813. SCMI_PINCTRL_BIAS_PULL_DOWN = 6,
  814. SCMI_PINCTRL_DRIVE_OPEN_DRAIN = 7,
  815. SCMI_PINCTRL_DRIVE_OPEN_SOURCE = 8,
  816. SCMI_PINCTRL_DRIVE_PUSH_PULL = 9,
  817. SCMI_PINCTRL_DRIVE_STRENGTH = 10,
  818. SCMI_PINCTRL_INPUT_DEBOUNCE = 11,
  819. SCMI_PINCTRL_INPUT_MODE = 12,
  820. SCMI_PINCTRL_PULL_MODE = 13,
  821. SCMI_PINCTRL_INPUT_VALUE = 14,
  822. SCMI_PINCTRL_INPUT_SCHMITT = 15,
  823. SCMI_PINCTRL_LOW_POWER_MODE = 16,
  824. SCMI_PINCTRL_OUTPUT_MODE = 17,
  825. SCMI_PINCTRL_OUTPUT_VALUE = 18,
  826. SCMI_PINCTRL_POWER_SOURCE = 19,
  827. SCMI_PINCTRL_SLEW_RATE = 20,
  828. SCMI_PINCTRL_OEM_START = 192,
  829. SCMI_PINCTRL_OEM_END = 255,
  830. };
  831. /**
  832. * struct scmi_pinctrl_protocol_attributes - Response payload for SCMI_COM_MSG_ATTRIBUTES command
  833. */
  834. struct scmi_pinctrl_protocol_attributes
  835. {
  836. rt_le32_t status;
  837. #define SCMI_PINCTRL_GROUPS_NR(x) RT_FIELD_GET(RT_GENMASK(31, 16), (x))
  838. #define SCMI_PINCTRL_PINS_NR(x) RT_FIELD_GET(RT_GENMASK(15, 0), (x))
  839. #define SCMI_PINCTRL_FUNCTIONS_NR(x) RT_FIELD_GET(RT_GENMASK(15, 0), (x))
  840. rt_le32_t attributes_low;
  841. rt_le32_t attributes_high;
  842. };
  843. /**
  844. * struct scmi_pinctrl_attributes_in - Message payload for SCMI_PINCTRL_ATTRIBUTES command
  845. */
  846. struct scmi_pinctrl_attributes_in
  847. {
  848. rt_le32_t identifier;
  849. rt_le32_t flags;
  850. };
  851. /**
  852. * struct scmi_pinctrl_attributes_out - Response payload for SCMI_PINCTRL_ATTRIBUTES command
  853. */
  854. struct scmi_pinctrl_attributes_out
  855. {
  856. #define SCMI_PINCTRL_EXT_NAME_FLAG(x) RT_FIELD_GET(RT_BIT(31), (x))
  857. #define SCMI_PINCTRL_NUM_ELEMS(x) RT_FIELD_GET(RT_GENMASK(15, 0), (x))
  858. rt_le32_t status;
  859. rt_le32_t attributes;
  860. rt_uint8_t name[SCMI_SHORT_NAME_MAX_SIZE];
  861. };
  862. /**
  863. * struct scmi_pinctrl_list_assoc_in - Message payload for SCMI_PINCTRL_LIST_ASSOCIATIONS command
  864. */
  865. struct scmi_pinctrl_list_assoc_in
  866. {
  867. rt_le32_t identifier;
  868. rt_le32_t flags;
  869. rt_le32_t index;
  870. };
  871. /**
  872. * struct scmi_pinctrl_list_assoc_out - Response payload for SCMI_PINCTRL_LIST_ASSOCIATIONS command
  873. */
  874. struct scmi_pinctrl_list_assoc_out
  875. {
  876. #define SCMI_PINCTRL_REMAINING(x) RT_FIELD_GET(RT_GENMASK(31, 16), (x))
  877. #define SCMI_PINCTRL_RETURNED(x) RT_FIELD_GET(RT_GENMASK(11, 0), (x))
  878. rt_le32_t status;
  879. rt_le32_t flags;
  880. rt_le16_t array[];
  881. };
  882. /**
  883. * struct scmi_pinctrl_settings_get_in - Message payload for SCMI_PINCTRL_SETTINGS_GET command
  884. */
  885. struct scmi_pinctrl_settings_get_in
  886. {
  887. #define SCMI_PINCTRL_CONFIG_FLAG_MASK RT_GENMASK(19, 18)
  888. #define SCMI_PINCTRL_SELECTOR_MASK RT_GENMASK(17, 16)
  889. #define SCMI_PINCTRL_SKIP_CONFIGS_MASK RT_GENMASK(15, 8)
  890. #define SCMI_PINCTRL_CONFIG_TYPE_MASK RT_GENMASK(7, 0)
  891. rt_le32_t identifier;
  892. rt_le32_t attributes;
  893. };
  894. /**
  895. * struct scmi_pinctrl_settings_get_out - Response payload for SCMI_PINCTRL_SETTINGS_GET command
  896. */
  897. struct scmi_pinctrl_settings_get_out
  898. {
  899. rt_le32_t status;
  900. rt_le32_t function_selected;
  901. rt_le32_t num_configs;
  902. rt_le32_t configs[];
  903. };
  904. /**
  905. * struct scmi_pinctrl_settings_conf_in - Message payload for SCMI_PINCTRL_SETTINGS_CONFIGURE command
  906. */
  907. struct scmi_pinctrl_settings_conf_in
  908. {
  909. rt_le32_t identifier;
  910. rt_le32_t function_id;
  911. rt_le32_t attributes;
  912. rt_le32_t configs[];
  913. };
  914. /**
  915. * struct scmi_pinctrl_settings_conf_out - Response payload for SCMI_PINCTRL_SETTINGS_CONFIGURE command
  916. */
  917. struct scmi_pinctrl_settings_conf_out
  918. {
  919. rt_le32_t status;
  920. };
  921. /**
  922. * struct scmi_pinctrl_request_in - Message payload for SCMI_PINCTRL_REQUEST command
  923. */
  924. struct scmi_pinctrl_request_in
  925. {
  926. rt_le32_t identifier;
  927. rt_le32_t flags;
  928. };
  929. /**
  930. * struct scmi_pinctrl_request_out - Response payload for SCMI_PINCTRL_REQUEST command
  931. */
  932. struct scmi_pinctrl_request_out
  933. {
  934. rt_le32_t status;
  935. };
  936. /**
  937. * struct scmi_pinctrl_request_in - Message payload for SCMI_PINCTRL_NAME_GET command
  938. */
  939. struct scmi_pinctrl_name_get_in
  940. {
  941. rt_le32_t identifier;
  942. rt_le32_t flags;
  943. };
  944. /**
  945. * struct scmi_pinctrl_name_get_out - Response payload for SCMI_PINCTRL_NAME_GET command
  946. */
  947. struct scmi_pinctrl_name_get_out
  948. {
  949. rt_le32_t status;
  950. rt_le32_t flags;
  951. rt_uint8_t name[SCMI_MAX_STR_SIZE];
  952. };
  953. struct scmi_agent;
  954. struct rt_scmi_device_id
  955. {
  956. rt_uint8_t protocol_id;
  957. const char *name;
  958. };
  959. struct rt_scmi_device
  960. {
  961. struct rt_device parent;
  962. const char *name;
  963. rt_uint8_t protocol_id;
  964. struct scmi_agent *agent;
  965. };
  966. struct rt_scmi_driver
  967. {
  968. struct rt_driver parent;
  969. const char *name;
  970. const struct rt_scmi_device_id *ids;
  971. rt_err_t (*probe)(struct rt_scmi_device *sdev);
  972. rt_err_t (*remove)(struct rt_scmi_device *sdev);
  973. rt_err_t (*shutdown)(struct rt_scmi_device *sdev);
  974. };
  975. rt_err_t rt_scmi_driver_register(struct rt_scmi_driver *driver);
  976. rt_err_t rt_scmi_device_register(struct rt_scmi_device *device);
  977. #define RT_SCMI_DRIVER_EXPORT(driver) RT_DRIVER_EXPORT(driver, scmi, BUILIN)
  978. rt_err_t rt_scmi_process_msg(struct rt_scmi_device *sdev, struct rt_scmi_msg *msg);
  979. const char *rt_scmi_strerror(rt_base_t err);
  980. #endif /* __SCMI_H__ */