mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-13 00:17:23 +00:00
misc: imx8: add sc_misc_get_temp
Add sc_misc_get_temp to support get temperature Signed-off-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
parent
5fbc667d8a
commit
7752a0fef7
3 changed files with 31 additions and 0 deletions
|
@ -72,6 +72,8 @@ void sc_misc_get_boot_dev(sc_ipc_t ipc, sc_rsrc_t *boot_dev);
|
||||||
void sc_misc_boot_status(sc_ipc_t ipc, sc_misc_boot_status_t status);
|
void sc_misc_boot_status(sc_ipc_t ipc, sc_misc_boot_status_t status);
|
||||||
void sc_misc_build_info(sc_ipc_t ipc, u32 *build, u32 *commit);
|
void sc_misc_build_info(sc_ipc_t ipc, u32 *build, u32 *commit);
|
||||||
int sc_misc_otp_fuse_read(sc_ipc_t ipc, u32 word, u32 *val);
|
int sc_misc_otp_fuse_read(sc_ipc_t ipc, u32 word, u32 *val);
|
||||||
|
int sc_misc_get_temp(sc_ipc_t ipc, sc_rsrc_t resource, sc_misc_temp_t temp,
|
||||||
|
s16 *celsius, s8 *tenths);
|
||||||
|
|
||||||
/* RM API */
|
/* RM API */
|
||||||
sc_bool_t sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr);
|
sc_bool_t sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr);
|
||||||
|
|
|
@ -26,5 +26,6 @@
|
||||||
#define SC_MISC_REL_CONTAINER 2U /* Release container */
|
#define SC_MISC_REL_CONTAINER 2U /* Release container */
|
||||||
|
|
||||||
typedef u8 sc_misc_boot_status_t;
|
typedef u8 sc_misc_boot_status_t;
|
||||||
|
typedef u8 sc_misc_temp_t;
|
||||||
|
|
||||||
#endif /* SC_MISC_API_H */
|
#endif /* SC_MISC_API_H */
|
||||||
|
|
|
@ -273,6 +273,34 @@ int sc_misc_otp_fuse_read(sc_ipc_t ipc, u32 word, u32 *val)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int sc_misc_get_temp(sc_ipc_t ipc, sc_rsrc_t resource, sc_misc_temp_t temp,
|
||||||
|
s16 *celsius, s8 *tenths)
|
||||||
|
{
|
||||||
|
struct udevice *dev = gd->arch.scu_dev;
|
||||||
|
int size = sizeof(struct sc_rpc_msg_s);
|
||||||
|
struct sc_rpc_msg_s msg;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
RPC_VER(&msg) = SC_RPC_VERSION;
|
||||||
|
RPC_SVC(&msg) = (u8)SC_RPC_SVC_MISC;
|
||||||
|
RPC_FUNC(&msg) = (u8)MISC_FUNC_GET_TEMP;
|
||||||
|
RPC_U16(&msg, 0U) = (u16)resource;
|
||||||
|
RPC_U8(&msg, 2U) = (u8)temp;
|
||||||
|
RPC_SIZE(&msg) = 2U;
|
||||||
|
|
||||||
|
ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (celsius)
|
||||||
|
*celsius = RPC_I16(&msg, 0U);
|
||||||
|
|
||||||
|
if (tenths)
|
||||||
|
*tenths = RPC_I8(&msg, 2U);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* RM */
|
/* RM */
|
||||||
sc_bool_t sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr)
|
sc_bool_t sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue