WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
plat_pm.h
浏览该文件的文档.
1/*
2 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2015-2023. All rights reserved.
3 * Description: plat pm head file.
4 * Create: 2015-04-10
5 */
6
7#ifndef __PLAT_PM_H__
8#define __PLAT_PM_H__
9
10/*****************************************************************************
11 1 Include other Head file
12*****************************************************************************/
13#include <linux/mutex.h>
14#include <linux/kernel.h>
15#include <linux/version.h>
16#if defined(_PRE_OS_VERSION) && defined(_PRE_OS_VERSION_LINUX) && (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION)
17#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
18#include <linux/pm_wakeup.h>
19#endif
20#endif
21#include "plat_pm_wlan.h"
22/*****************************************************************************
23 2 Define macro
24*****************************************************************************/
25#define BT_LOCK_NAME "bt_wake_lock"
26
27#define FIRMWARE_CFG_INIT_OK 0x01
28
29#define SUCCESS (0)
30#define FAILURE (1)
31
32#define GNSS_AGREE_SLEEP (1)
33#define GNSS_NOT_AGREE_SLEEP (0)
34
35#define BT_TRY_SLEEP 0
36#define BT_SLEEP 1
37#define BT_WKUPING 2
38#define BT_ACTIVE 3
39
40#define HOST_DISALLOW_TO_SLEEP (0)
41#define HOST_ALLOW_TO_SLEEP (1)
42#define HOST_WKING_FROM_SLEEP (2)
43
44#define BT_PM_ENABLE 1
45#define BT_PM_DISABLE 0
46
47#define WAIT_DEVACK_MSEC (10)
48#define WAIT_DEVACK_CNT (10)
49#define WAIT_DEVACK_TIMEOUT_MSEC (2000)
50
51/* 超时时间要大于wkup dev work中的最长执行时间,否则超时以后进入DFR和work中会同时操作tty,导致冲突 */
52#define WAIT_WKUPDEV_MSEC (10000)
53
54#define WAIT_BT_SLP_ACK_MSEC 1000
55#define WKUP_BT_RETRY_TIMES 3
56#define WAIT_BT_PMENABLE_ACK_MSEC 1000
57
58#define NEED_WAIT_NEXT_GPIO 0x55
59#define WAIT_GPIO_INTR_DONE 0x5a
60
68
69
70/* BFGX系统上电加载异常类型 */
90
91/* wifi系统上电加载异常类型 */
106
108 BT_SLP_STAGE_INIT = 0, // 初始
109 BT_SLP_REQ_SND = 1, // sleep request发送完成
110 BT_SLP_ALLOW_RCV = 2, // 收到allow sleep response
111 BT_SLP_DISALLOW_RCV = 3, // 收到allow sleep response
112 BT_SLP_CMD_SND = 4, // 允许睡眠reg设置完成
113};
114
115/*****************************************************************************
116 3 STRUCT DEFINE
117*****************************************************************************/
118typedef struct {
119 osal_s32 (*bt_open_wcpu_cb)(osal_void);
120 osal_s32 (*bcpu_is_depends_on_wcpu_cb)(osal_void);
121 osal_s32 (*bt_is_shutdown_cb)(osal_void);
123
124/* private data for pm driver */
126 /* wlan interface pointer */
128 /* board customize info */
131 /* mutex for sync */
132 struct mutex host_mutex;
133 /* flag for firmware cfg file init */
135};
136
137/*****************************************************************************
138 4 EXTERN VARIABLE
139*****************************************************************************/
140
141/*****************************************************************************
142 5 EXTERN FUNCTION
143*****************************************************************************/
144extern struct pm_drv_data *pm_get_drvdata(void);
146extern void bfgx_print_subsys_state(void);
151extern void bt_wake_lock(void);
152extern void bt_wake_unlock(void);
153
159int bt_open_wcpu(void);
160
161#define WKUP_BCPU_EVENT 0x1
162#define OPEN_BCPU_EVENT 0x2
163#define BCPU_WORK_EVENT 0x3
164#define W2B_SHUTDOWN_EVENT 0x4
172
173#endif
174
int osal_s32
Definition osal_types.h:19
long osal_slong
Definition osal_types.h:21
unsigned char osal_u8
Definition osal_types.h:11
void osal_void
Definition osal_types.h:29
unsigned int osal_u32
Definition osal_types.h:13
unsigned long osal_ulong
Definition osal_types.h:15
int bt_pf_pm_disable(void)
int bt_open_wcpu(void)
bt_power_on_exception_enum
Definition plat_pm.h:71
@ BT_POWER_TTY_FLOW_ENABLE_FAIL
Definition plat_pm.h:77
@ BT_POWER_OPEN_CMD_FAIL
Definition plat_pm.h:86
@ BT_POWER_SUCCESS
Definition plat_pm.h:73
@ BT_POWER_WIFI_OFF_BOOT_UP_FAIL
Definition plat_pm.h:82
@ BT_POWER_WIFI_DERESET_BCPU_FAIL
Definition plat_pm.h:79
@ BT_POWER_WIFI_ON_BOOT_UP_FAIL
Definition plat_pm.h:80
@ BT_POWER_WAKEUP_FAIL
Definition plat_pm.h:85
@ BT_POWER_FAILED
Definition plat_pm.h:72
@ BT_POWER_DOWNLOAD_FIRMWARE_FAIL
Definition plat_pm.h:83
@ BT_POWER_ENUM_BUTT
Definition plat_pm.h:88
@ BT_POWER_PULL_POWER_GPIO_FAIL
Definition plat_pm.h:75
@ BT_POWER_TTY_OPEN_FAIL
Definition plat_pm.h:76
void bt_wake_unlock(void)
osal_s32 pm_bcpu_ops_register(pm_bcpu_ops *bcpu_ops)
struct pm_drv_data * pm_get_drvdata(void)
wifi_power_on_exception_enum
Definition plat_pm.h:92
@ WIFI_POWER_SUCCESS
Definition plat_pm.h:94
@ WIFI_POWER_REPROBLE_DEVICE_FAIL
Definition plat_pm.h:103
@ WIFI_POWER_BFGX_ON_BOOT_UP_FAIL
Definition plat_pm.h:100
@ WIFI_POWER_BFGX_DERESET_WCPU_FAIL
Definition plat_pm.h:101
@ WIFI_POWER_BFGX_ON_FIRMWARE_DOWNLOAD_FAIL
Definition plat_pm.h:102
@ WIFI_POWER_PULL_POWER_GPIO_FAIL
Definition plat_pm.h:95
@ WIFI_POWER_FAIL
Definition plat_pm.h:93
@ WIFI_POWER_BFGX_OFF_FIRMWARE_DOWNLOAD_FAIL
Definition plat_pm.h:98
@ WIFI_POWER_ENUM_BUTT
Definition plat_pm.h:104
@ WIFI_POWER_BFGX_OFF_BOOT_UP_FAIL
Definition plat_pm.h:97
osal_void pm_host_lock_mux(osal_void)
void host_pm_b2w_vote_work(osal_u8 is_work)
osal_s32 bcpu_is_depends_on_wcpu(void)
int bt_pf_pm_enable(void)
osal_s32 bt_try_open_wcpu(osal_void)
osal_s32 wlan_power_on(void)
osal_s32 bt_is_shutdown(void)
void bt_pm_set_packet_cnt(osal_u32 delt)
bt_pm_sleep_stage
Definition plat_pm.h:107
@ BT_SLP_REQ_SND
Definition plat_pm.h:109
@ BT_SLP_STAGE_INIT
Definition plat_pm.h:108
@ BT_SLP_CMD_SND
Definition plat_pm.h:112
@ BT_SLP_ALLOW_RCV
Definition plat_pm.h:110
@ BT_SLP_DISALLOW_RCV
Definition plat_pm.h:111
osal_s32 wlan_power_off(void)
void bfgx_print_subsys_state(void)
osal_slong pm_bcpu_notify_wcpu(osal_u32 events)
osal_s32 get_b2h_gpio_irq(osal_u32 *irq)
void bt_wake_lock(void)
osal_s32 wlan_is_shutdown(void)
osal_void pm_host_unlock_mux(osal_void)
osal_s32 host_wkup_bt_device(void)
uart_state_enum
Definition plat_pm.h:61
@ UART_NOT_READY
Definition plat_pm.h:62
@ UART_READY
Definition plat_pm.h:63
@ UART_BPS_CHG_SEND_COMPLETE
Definition plat_pm.h:66
@ UART_BPS_CHG_SEND_ACK
Definition plat_pm.h:64
@ UART_BPS_CHG_IN_PROGRESS
Definition plat_pm.h:65
void bt_start_sleep_timer(void)
Definition board.h:73
Definition plat_pm.h:118
Definition plat_pm.h:125
struct wlan_pm_s * wlan_pm_info
Definition plat_pm.h:127
board_info * board
Definition plat_pm.h:129
struct mutex host_mutex
Definition plat_pm.h:132
pm_bcpu_ops * bcpu_ops
Definition plat_pm.h:130
osal_ulong firmware_cfg_init_flag
Definition plat_pm.h:134
Definition plat_pm_wlan.h:109