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