mt_lp_api.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (c) 2023, MediaTek Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef MT_LP_API_H
  7. #define MT_LP_API_H
  8. #include <lpm/mt_lp_rm.h>
  9. #if MTK_PUBEVENT_ENABLE
  10. #include <vendor_pubsub_events.h>
  11. #endif
  12. /* Ufs clk enum for PLAT_RC_CLKBUF_STATUS */
  13. enum rc_update_ex_ufs_ref_clk {
  14. UFS_REF_CLK_OFF = 0,
  15. UFS_REF_CLK_ON,
  16. };
  17. /* Enum for flight mode */
  18. enum rc_update_ex_flight_mode {
  19. FLIGHT_MODE_OFF = 0,
  20. FLIGHT_MODE_ON,
  21. };
  22. struct mt_lpm_pubevent_data {
  23. unsigned int u32;
  24. };
  25. enum mt_lpm_pubevents_id {
  26. MT_LPM_PUBEVENTS_BBLPM_ENTER,
  27. MT_LPM_PUBEVENTS_BBLPM_LEAVE,
  28. MT_LPM_PUBEVENTS_TARGET_CORE,
  29. MT_LPM_PUBEVENTS_SYS_POWER_OFF,
  30. MT_LPM_PUBEVENTS_SYS_POWER_ON,
  31. };
  32. struct mt_lp_publish_event {
  33. unsigned int id;
  34. struct mt_lpm_pubevent_data val;
  35. };
  36. #if MTK_PUBEVENT_ENABLE
  37. #define MT_LP_PUBLISH_EVENT(x) ({\
  38. PUBLISH_EVENT_ARG(lpm_publish_event, (const void *)(x)); })
  39. #define MT_LP_SUSPEND_PUBLISH_EVENT(x) ({\
  40. PUBLISH_EVENT_ARG(suspend_publish_event, (const void *)(x)); })
  41. #define MT_LP_SUBSCRIBE_SUSPEND(func) SUBSCRIBE_TO_EVENT(suspend_publish_event, func)
  42. #define MT_LP_SUBSCRIBE_LPM(func) SUBSCRIBE_TO_EVENT(lpm_publish_event, func)
  43. #else
  44. #define MT_LP_PUBLISH_EVENT(x) ({ (void)x; })
  45. #define MT_LP_SUSPEND_PUBLISH_EVENT(x) ({ (void)x; })
  46. #define MT_LP_SUBSCRIBE_SUSPEND(func)
  47. #define MT_LP_SUBSCRIBE_LPM(func)
  48. #endif
  49. /* MTK low power API types for audio */
  50. enum mt_lp_api_audio_type {
  51. AUDIO_AFE_ENTER,
  52. AUDIO_AFE_LEAVE,
  53. AUDIO_DSP_ENTER,
  54. AUDIO_DSP_LEAVE,
  55. };
  56. /* MTK low power API types for usb */
  57. enum mt_lp_api_usb_type {
  58. LPM_USB_ENTER,
  59. LPM_USB_LEAVE,
  60. };
  61. int mt_audio_update(int type);
  62. int mtk_usb_update(int type);
  63. #endif /* MT_LP_API_H */