Commit c54fe7ae5dd0614b85e2c7e9e742ecee791aebcc
1 parent
eed35ef49f
Exists in
smarc_8mm-imx_v2019.04_4.19.35_1.1.0
and in
1 other branch
MLK-21831-2 scu_api: Add sc_misc_get_temp API
Signed-off-by: Ye Li <ye.li@nxp.com>
Showing 3 changed files with 35 additions and 0 deletions Side-by-side Diff
arch/arm/include/asm/arch-imx8/sci/sci.h
... | ... | @@ -82,6 +82,8 @@ |
82 | 82 | void sc_misc_boot_status(sc_ipc_t ipc, sc_misc_boot_status_t status); |
83 | 83 | void sc_misc_build_info(sc_ipc_t ipc, u32 *build, u32 *commit); |
84 | 84 | int sc_misc_otp_fuse_read(sc_ipc_t ipc, u32 word, u32 *val); |
85 | +int sc_misc_get_temp(sc_ipc_t ipc, sc_rsrc_t resource, sc_misc_temp_t temp, | |
86 | + s16 *celsius, s8 *tenths); | |
85 | 87 | |
86 | 88 | /* RM API */ |
87 | 89 | sc_bool_t sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr); |
arch/arm/include/asm/arch-imx8/sci/svc/misc/api.h
drivers/misc/imx8/scu_api.c
... | ... | @@ -302,6 +302,37 @@ |
302 | 302 | return 0; |
303 | 303 | } |
304 | 304 | |
305 | +int sc_misc_get_temp(sc_ipc_t ipc, sc_rsrc_t resource, | |
306 | + sc_misc_temp_t temp, s16 *celsius, s8 *tenths) | |
307 | +{ | |
308 | + struct udevice *dev = gd->arch.scu_dev; | |
309 | + int size = sizeof(struct sc_rpc_msg_s); | |
310 | + struct sc_rpc_msg_s msg; | |
311 | + int ret; | |
312 | + | |
313 | + RPC_VER(&msg) = SC_RPC_VERSION; | |
314 | + RPC_SVC(&msg) = (u8)(SC_RPC_SVC_MISC); | |
315 | + RPC_FUNC(&msg) = (u8)(MISC_FUNC_GET_TEMP); | |
316 | + RPC_U16(&msg, 0U) = (u16)(resource); | |
317 | + RPC_U8(&msg, 2U) = (u8)(temp); | |
318 | + RPC_SIZE(&msg) = 2U; | |
319 | + | |
320 | + ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size); | |
321 | + | |
322 | + if (celsius != NULL) | |
323 | + { | |
324 | + *celsius = RPC_I16(&msg, 0U); | |
325 | + } | |
326 | + | |
327 | + if (tenths != NULL) | |
328 | + { | |
329 | + *tenths = RPC_I8(&msg, 2U); | |
330 | + } | |
331 | + | |
332 | + return ret; | |
333 | +} | |
334 | + | |
335 | + | |
305 | 336 | /* RM */ |
306 | 337 | sc_bool_t sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr) |
307 | 338 | { |