yu.dong | c33b307 | 2024-08-21 23:14:49 -0700 | [diff] [blame^] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2005 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /***************************************************************************** |
| 37 | * |
| 38 | * Filename: |
| 39 | * --------- |
| 40 | * lpwr.h |
| 41 | * |
| 42 | * Project: |
| 43 | * -------- |
| 44 | * Maui_Software |
| 45 | * |
| 46 | * Description: |
| 47 | * ------------ |
| 48 | * This file is intends for low power control |
| 49 | * |
| 50 | * Author: |
| 51 | * ------- |
| 52 | * ------- |
| 53 | * |
| 54 | *============================================================================ |
| 55 | * HISTORY |
| 56 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 57 | *------------------------------------------------------------------------------ |
| 58 | * removed! |
| 59 | * removed! |
| 60 | * removed! |
| 61 | * |
| 62 | * removed! |
| 63 | * removed! |
| 64 | * removed! |
| 65 | * |
| 66 | * removed! |
| 67 | * removed! |
| 68 | * removed! |
| 69 | * |
| 70 | * removed! |
| 71 | * removed! |
| 72 | * removed! |
| 73 | * |
| 74 | * removed! |
| 75 | * removed! |
| 76 | * removed! |
| 77 | * |
| 78 | * removed! |
| 79 | * removed! |
| 80 | * removed! |
| 81 | * |
| 82 | * removed! |
| 83 | * removed! |
| 84 | * removed! |
| 85 | * |
| 86 | * removed! |
| 87 | * removed! |
| 88 | * removed! |
| 89 | * |
| 90 | * removed! |
| 91 | * removed! |
| 92 | * removed! |
| 93 | * |
| 94 | * removed! |
| 95 | * removed! |
| 96 | * removed! |
| 97 | * removed! |
| 98 | * removed! |
| 99 | * removed! |
| 100 | * |
| 101 | *------------------------------------------------------------------------------ |
| 102 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 103 | *============================================================================ |
| 104 | ****************************************************************************/ |
| 105 | #ifndef __LPWR_H__ |
| 106 | #define __LPWR_H__ |
| 107 | |
| 108 | #include "kal_general_types.h" |
| 109 | #include "drv_comm.h" |
| 110 | #include "drvpdn.h" |
| 111 | |
| 112 | #define MAIN_MAX_MODULE 32 |
| 113 | #define SUB_MAX_MODULE 32 |
| 114 | |
| 115 | typedef enum { |
| 116 | LPWR_DRV0_MODULE_GROUP=0, |
| 117 | LPWR_DRV1_MODULE_GROUP, |
| 118 | LPWR_MM_MODULE_GROUP, |
| 119 | LPWR_MAX_MODULE_GROUP, |
| 120 | LPWR_NULL_MODULE_GROUP = 0xfe |
| 121 | } LPWR_MODULE_GROUP; |
| 122 | |
| 123 | typedef struct { |
| 124 | DEVICE_ID_ENUM module_id; |
| 125 | kal_uint8 lpwr_main_sm_handle; |
| 126 | kal_uint32 lpwr_sub_glb_hanlde; //central handle to maintain sub module |
| 127 | kal_uint32 lpwr_sub_sleepDisable; |
| 128 | void (*pdn_enable_ctrl_callback)(void *parameter); |
| 129 | void (*pdn_disable_ctrl_callback)(void *parameter); |
| 130 | } LPWR_MAIN_STRUCT; |
| 131 | |
| 132 | typedef struct { |
| 133 | LPWR_MODULE_GROUP group_id; |
| 134 | kal_uint8 lpwr_group_sm_handle; //from l1 sm module |
| 135 | kal_uint8 lpwr_main_handle_cnt; //central handle to maintain main module |
| 136 | kal_uint32 lpwr_main_sleepDisable; |
| 137 | LPWR_MAIN_STRUCT main_info[MAIN_MAX_MODULE]; |
| 138 | } LPWR_INFO_STRUCT; |
| 139 | |
| 140 | typedef struct |
| 141 | { |
| 142 | DEVICE_ID_ENUM id; |
| 143 | LPWR_MODULE_GROUP group; |
| 144 | } LPWR_GROUP_MAP_STRUCT; |
| 145 | |
| 146 | typedef struct |
| 147 | { |
| 148 | LPWR_MODULE_GROUP group_id; |
| 149 | kal_uint8 main_handle; |
| 150 | DEVICE_ID_ENUM module_id; |
| 151 | } LPWR_STRUCT; |
| 152 | |
| 153 | #if defined (__OLD_PDN_ARCH__) |
| 154 | #if defined(__NEW_DRVPDN_FUNCTION__) |
| 155 | #define DRVPDN_ENABLE2(addr,code,pdn_id) \ |
| 156 | DRVPDN_Enable2(addr,code,pdn_id) |
| 157 | #define DRVPDN_DISABLE2(addr,code,pdn_id) \ |
| 158 | DRVPDN_Disable2(addr,code,pdn_id) |
| 159 | #else |
| 160 | |
| 161 | #define DRVPDN_ENABLE2(addr,code,pdn_id) \ |
| 162 | DRVPDN_Enable(addr,code,pdn_id) |
| 163 | #define DRVPDN_DISABLE2(addr,code,pdn_id) \ |
| 164 | DRVPDN_Disable(addr,code,pdn_id) |
| 165 | #endif |
| 166 | #else //defined (__OLD_PDN_ARCH__) |
| 167 | #define DRVPDN_ENABLE2(pdn_id) \ |
| 168 | DRVPDN_Enable2(pdn_id) |
| 169 | #define DRVPDN_DISABLE2(pdn_id) \ |
| 170 | DRVPDN_Disable2(pdn_id) |
| 171 | #endif //defined (__OLD_PDN_ARCH__) |
| 172 | // MoDIS parser skip start |
| 173 | /*Common module*/ |
| 174 | extern void lpwr_init(void); |
| 175 | extern void lpwr_module_open(LPWR_STRUCT *lpwr_handle, |
| 176 | DEVICE_ID_ENUM module_id, |
| 177 | void (*pdn_enable_ctrl_callback)(void *parameter), |
| 178 | void (*pdn_disable_ctrl_callback)(void *parameter) |
| 179 | ); |
| 180 | /*Main module*/ |
| 181 | extern void lpwr_main_disable(LPWR_STRUCT *lpwr_handle, |
| 182 | void *parameter); |
| 183 | extern void lpwr_main_enable(LPWR_STRUCT *lpwr_handle, |
| 184 | void *parameter); |
| 185 | extern void lpwr_main_fast_disable(LPWR_STRUCT *lpwr_handle); |
| 186 | extern void lpwr_main_fast_enable(LPWR_STRUCT *lpwr_handle); |
| 187 | extern void lpwr_main_fast_disable2(LPWR_STRUCT *lpwr_handle, |
| 188 | void *parameter); |
| 189 | extern void lpwr_main_fast_enable2(LPWR_STRUCT *lpwr_handle, |
| 190 | void *parameter); |
| 191 | /*Sub module*/ |
| 192 | extern kal_uint8 lpwr_get_sub_handle(LPWR_STRUCT *lpwr_handle); |
| 193 | extern void lpwr_free_sub_handle(LPWR_STRUCT *lpwr_handle, kal_uint8 sub_handle); |
| 194 | extern void lpwr_sub_disable(LPWR_STRUCT *lpwr_handle, |
| 195 | kal_uint8 sub_handle, |
| 196 | void (*pdn_disable_ctrl_callback)(void *parameter), |
| 197 | void *parameter); |
| 198 | extern void lpwr_sub_enable(LPWR_STRUCT *lpwr_handle, |
| 199 | kal_uint8 sub_handle, |
| 200 | void (*pdn_enable_ctrl_callback)(void *parameter), |
| 201 | void *parameter); |
| 202 | #if defined (__OLD_PDN_ARCH__) |
| 203 | #if defined(__NEW_DRVPDN_FUNCTION__) |
| 204 | extern void DRVPDN_Enable2(kal_uint32 addr,kal_uint16 code,PDN_DEVICE handle); |
| 205 | extern void DRVPDN_Disable2(kal_uint32 addr,kal_uint16 code,PDN_DEVICE hanlde); |
| 206 | #endif |
| 207 | #else |
| 208 | extern void DRVPDN_Enable2(PDN_DEVICE handle); |
| 209 | extern void DRVPDN_Disable2(PDN_DEVICE hanlde); |
| 210 | #endif |
| 211 | // MoDIS parser skip end |
| 212 | #endif |
| 213 | |