ipc.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2021 Alibaba Group Holding Limited.
  4. */
  5. #ifndef _SC_IPC_H
  6. #define _SC_IPC_H
  7. #include <linux/device.h>
  8. #include <linux/types.h>
  9. #define AON_RPC_MSG_MAGIC (0xef)
  10. #define LIGHT_AON_RPC_VERSION 1
  11. #define LIGHT_AON_RPC_MSG_NUM 7
  12. struct light_aon_ipc;
  13. enum light_aon_rpc_svc {
  14. LIGHT_AON_RPC_SVC_UNKNOWN = 0,
  15. LIGHT_AON_RPC_SVC_RETURN = 1,
  16. LIGHT_AON_RPC_SVC_PM = 2,
  17. LIGHT_AON_RPC_SVC_MISC = 3,
  18. LIGHT_AON_RPC_SVC_AVFS = 4,
  19. };
  20. enum light_aon_misc_func {
  21. LIGHT_AON_MISC_FUNC_UNKNOWN = 0,
  22. LIGHT_AON_MISC_FUNC_SET_CONTROL = 1,
  23. LIGHT_AON_MISC_FUNC_GET_CONTROL = 2,
  24. LIGHT_AON_MISC_FUNC_WDG_START = 3,
  25. LIGHT_AON_MISC_FUNC_WDG_STOP = 4,
  26. LIGHT_AON_MISC_FUNC_WDG_PING = 5,
  27. LIGHT_AON_MISC_FUNC_WDG_TIMEOUTSET = 6,
  28. LIGHT_AON_MISC_FUNC_WDG_RESTART = 7,
  29. LIGHT_AON_MISC_FUNC_WDG_GET_STATE = 8,
  30. LIGHT_AON_MISC_FUNC_WDG_POWER_OFF = 9,
  31. LIGHT_AON_MISC_FUNC_AON_WDT_ON = 10,
  32. LIGHT_AON_MISC_FUNC_AON_WDT_OFF = 11,
  33. };
  34. enum light_aon_pm_func {
  35. LIGHT_AON_PM_FUNC_UNKNOWN = 0,
  36. LIGHT_AON_PM_FUNC_SET_RESOURCE_REGULATOR = 1,
  37. LIGHT_AON_PM_FUNC_GET_RESOURCE_REGULATOR = 2,
  38. LIGHT_AON_PM_FUNC_SET_RESOURCE_POWER_MODE = 3,
  39. LIGHT_AON_PM_FUNC_PWR_SET = 4,
  40. LIGHT_AON_PM_FUNC_PWR_GET = 5,
  41. };
  42. struct light_aon_rpc_msg_hdr {
  43. uint8_t ver; ///< version of msg hdr
  44. uint8_t size; ///< msg size ,uinit in bytes,the size includes rpc msg header self.
  45. uint8_t svc; ///< rpc main service id
  46. uint8_t func; ///< rpc sub func id of specific service, sent by caller
  47. } __packed __aligned(4);
  48. /*
  49. * Defines for SC PM Power Mode
  50. */
  51. #define LIGHT_AON_PM_PW_MODE_OFF 0 /* Power off */
  52. #define LIGHT_AON_PM_PW_MODE_STBY 1 /* Power in standby */
  53. #define LIGHT_AON_PM_PW_MODE_LP 2 /* Power in low-power */
  54. #define LIGHT_AON_PM_PW_MODE_ON 3 /* Power on */
  55. int light_aon_call_rpc(struct light_aon_ipc *ipc, void *msg, bool have_resp);
  56. int light_aon_get_handle(struct light_aon_ipc **ipc);
  57. int light_aon_misc_set_control(struct light_aon_ipc *ipc, u16 resource, u32 ctrl, u32 val);
  58. int light_aon_misc_get_control(struct light_aon_ipc *ipc, u16 resource, u32 ctrl, u32 *val);
  59. #endif /* _SC_IPC_H */