qcacmn: Restructure HIF Runtime PM module
Currently, different modules had different ways of allowing and preventing runtime suspend. Multiple debug mechanisms were introduced and workarounds are present as well bloating the runtime PM module. This change is done to clean up and restructure HIF runtime PM module. Modules using Runtime PM module need to register with an ID present in hif_rtpm_client_id. hif_rtpm_get() will increment the device usage_count and prevent device from suspending. Based on argument type, if system is suspended, subsequent resume action will be done. hif_rtpm_put() will decrement the usage_count of device and if it is NULL, based on type of put call, idle sequence will start. Register HIF module and update respective get and put calls done from HIF module. Change-Id: I23747f0f7208e689c1c9eb55789aa81945f596ec CRs-Fixed: 3169272
This commit is contained in:

committed by
Madan Koyyalamudi

parent
65161e36f3
commit
4021d4b379
637
hif/inc/hif.h
637
hif/inc/hif.h
@@ -1147,89 +1147,6 @@ typedef enum {
|
||||
*/
|
||||
hif_pm_wake_irq_type hif_pm_get_wake_irq_type(struct hif_opaque_softc *hif_ctx);
|
||||
|
||||
/**
|
||||
* enum wlan_rtpm_dbgid - runtime pm put/get debug id
|
||||
* @RTPM_ID_RESVERD: Reserved
|
||||
* @RTPM_ID_WMI: WMI sending msg, expect put happen at
|
||||
* tx completion from CE level directly.
|
||||
* @RTPM_ID_HTC: pkt sending by HTT_DATA_MSG_SVC, expect
|
||||
* put from fw response or just in
|
||||
* htc_issue_packets
|
||||
* @RTPM_ID_QOS_NOTIFY: pm qos notifer
|
||||
* @RTPM_ID_DP_TX_DESC_ALLOC_FREE: tx desc alloc/free
|
||||
* @RTPM_ID_CE_SEND_FAST: operation in ce_send_fast, not include
|
||||
* the pkt put happens outside this function
|
||||
* @RTPM_ID_SUSPEND_RESUME: suspend/resume in hdd
|
||||
* @RTPM_ID_DW_TX_HW_ENQUEUE: operation in functin dp_tx_hw_enqueue
|
||||
* @RTPM_ID_HAL_REO_CMD: HAL_REO_CMD operation
|
||||
* @RTPM_ID_DP_PRINT_RING_STATS: operation in dp_print_ring_stats
|
||||
* @RTPM_ID_PM_STOP: operation in hif_pm_runtime_stop
|
||||
* @RTPM_ID_CONN_DISCONNECT:operation when issue disconnect
|
||||
* @RTPM_ID_SOC_REMOVE: operation in soc remove
|
||||
* @RTPM_ID_DRIVER_UNLOAD: operation in driver unload
|
||||
* @RTPM_ID_CE_INTR_HANDLER: operation from ce interrupt handler
|
||||
* @RTPM_ID_WAKE_INTR_HANDLER: operation from wake interrupt handler
|
||||
* @RTPM_ID_SOC_IDLE_SHUTDOWN: operation in soc idle shutdown
|
||||
* @RTPM_ID_HIF_FORCE_WAKE: operation in hif force wake
|
||||
*/
|
||||
/* New value added to the enum must also be reflected in function
|
||||
* rtpm_string_from_dbgid()
|
||||
*/
|
||||
typedef enum {
|
||||
RTPM_ID_RESVERD = 0,
|
||||
RTPM_ID_WMI,
|
||||
RTPM_ID_HTC,
|
||||
RTPM_ID_QOS_NOTIFY,
|
||||
RTPM_ID_DP_TX_DESC_ALLOC_FREE,
|
||||
RTPM_ID_CE_SEND_FAST,
|
||||
RTPM_ID_SUSPEND_RESUME,
|
||||
RTPM_ID_DW_TX_HW_ENQUEUE,
|
||||
RTPM_ID_HAL_REO_CMD,
|
||||
RTPM_ID_DP_PRINT_RING_STATS,
|
||||
RTPM_ID_PM_STOP,
|
||||
RTPM_ID_CONN_DISCONNECT,
|
||||
RTPM_ID_SOC_REMOVE,
|
||||
RTPM_ID_DRIVER_UNLOAD,
|
||||
RTPM_ID_CE_INTR_HANDLER,
|
||||
RTPM_ID_WAKE_INTR_HANDLER,
|
||||
RTPM_ID_SOC_IDLE_SHUTDOWN,
|
||||
RTPM_ID_HIF_FORCE_WAKE,
|
||||
|
||||
RTPM_ID_MAX,
|
||||
} wlan_rtpm_dbgid;
|
||||
|
||||
/**
|
||||
* rtpm_string_from_dbgid() - Convert dbgid to respective string
|
||||
* @id - debug id
|
||||
*
|
||||
* Debug support function to convert dbgid to string.
|
||||
* Please note to add new string in the array at index equal to
|
||||
* its enum value in wlan_rtpm_dbgid.
|
||||
*/
|
||||
static inline char *rtpm_string_from_dbgid(wlan_rtpm_dbgid id)
|
||||
{
|
||||
static const char *strings[] = { "RTPM_ID_RESVERD",
|
||||
"RTPM_ID_WMI",
|
||||
"RTPM_ID_HTC",
|
||||
"RTPM_ID_QOS_NOTIFY",
|
||||
"RTPM_ID_DP_TX_DESC_ALLOC_FREE",
|
||||
"RTPM_ID_CE_SEND_FAST",
|
||||
"RTPM_ID_SUSPEND_RESUME",
|
||||
"RTPM_ID_DW_TX_HW_ENQUEUE",
|
||||
"RTPM_ID_HAL_REO_CMD",
|
||||
"RTPM_ID_DP_PRINT_RING_STATS",
|
||||
"RTPM_ID_PM_STOP",
|
||||
"RTPM_ID_CONN_DISCONNECT",
|
||||
"RTPM_ID_SOC_REMOVE",
|
||||
"RTPM_ID_DRIVER_UNLOAD",
|
||||
"RTPM_ID_CE_INTR_HANDLER",
|
||||
"RTPM_ID_WAKE_INTR_HANDLER",
|
||||
"RTPM_ID_SOC_IDLE_SHUTDOWN",
|
||||
"RTPM_ID_MAX"};
|
||||
|
||||
return (char *)strings[id];
|
||||
}
|
||||
|
||||
/**
|
||||
* enum hif_ep_vote_type - hif ep vote type
|
||||
* HIF_EP_VOTE_DP_ACCESS: vote type is specific DP
|
||||
@@ -1253,191 +1170,401 @@ enum hif_ep_vote_access {
|
||||
};
|
||||
|
||||
/**
|
||||
* enum hif_pm_link_state - hif link state
|
||||
* HIF_PM_LINK_STATE_DOWN: hif link state is down
|
||||
* HIF_PM_LINK_STATE_UP: hif link state is up
|
||||
* enum hif_rpm_id - modules registered with runtime pm module
|
||||
* @HIF_RTPM_ID_RESERVED: Reserved ID
|
||||
* @HIF_RTPM_ID_HAL_REO_CMD: HAL REO commands
|
||||
* @HIF_RTPM_ID_WMI: WMI commands Tx
|
||||
* @HIF_RTPM_ID_HTT: HTT commands Tx
|
||||
* @HIF_RTPM_ID_DP_TX: Datapath Tx path
|
||||
* @HIF_RTPM_ID_DP_RING_STATS: Datapath ring stats
|
||||
* @HIF_RTPM_ID_CE_SEND_FAST: CE Tx buffer posting
|
||||
* @HIF_RTPM_ID_FORCE_WAKE: Force wake request
|
||||
* @HIF_RTPM_ID_PREVENT_LINKDOWN: Prevent linkdown by not allowing runtime PM
|
||||
* @HIF_RTPM_ID_PREVENT_ALLOW_LOCK: Generic ID for runtime PM lock contexts
|
||||
* @HIF_RTPM_ID_MAX: Max id
|
||||
*/
|
||||
enum hif_pm_link_state {
|
||||
HIF_PM_LINK_STATE_DOWN,
|
||||
HIF_PM_LINK_STATE_UP
|
||||
enum hif_rtpm_client_id {
|
||||
HIF_RTPM_ID_RESERVED,
|
||||
HIF_RTPM_ID_HAL_REO_CMD,
|
||||
HIF_RTPM_ID_WMI,
|
||||
HIF_RTPM_ID_HTT,
|
||||
HIF_RTPM_ID_DP,
|
||||
HIF_RTPM_ID_DP_RING_STATS,
|
||||
HIF_RTPM_ID_CE,
|
||||
HIF_RTPM_ID_FORCE_WAKE,
|
||||
HIF_RTPM_ID_PM_QOS_NOTIFY,
|
||||
HIF_RTPM_ID_WIPHY_SUSPEND,
|
||||
HIF_RTPM_ID_MAX
|
||||
};
|
||||
|
||||
/**
|
||||
* enum hif_pm_htc_stats - hif runtime PM stats for HTC layer
|
||||
* HIF_PM_HTC_STATS_GET_HTT_RESPONSE: PM stats for RTPM GET for HTT packets
|
||||
with response
|
||||
* HIF_PM_HTC_STATS_GET_HTT_NO_RESPONSE: PM stats for RTPM GET for HTT packets
|
||||
with no response
|
||||
* HIF_PM_HTC_STATS_PUT_HTT_RESPONSE: PM stats for RTPM PUT for HTT packets
|
||||
with response
|
||||
* HIF_PM_HTC_STATS_PUT_HTT_NO_RESPONSE: PM stats for RTPM PUT for HTT packets
|
||||
with no response
|
||||
* HIF_PM_HTC_STATS_PUT_HTT_ERROR: PM stats for RTPM PUT for failed HTT packets
|
||||
* HIF_PM_HTC_STATS_PUT_HTC_CLEANUP: PM stats for RTPM PUT during HTC cleanup
|
||||
* HIF_PM_HTC_STATS_GET_HTC_KICK_QUEUES: PM stats for RTPM GET done during
|
||||
* htc_kick_queues()
|
||||
* HIF_PM_HTC_STATS_PUT_HTC_KICK_QUEUES: PM stats for RTPM PUT done during
|
||||
* htc_kick_queues()
|
||||
* HIF_PM_HTC_STATS_GET_HTT_FETCH_PKTS: PM stats for RTPM GET while fetching
|
||||
* HTT packets from endpoint TX queue
|
||||
* HIF_PM_HTC_STATS_PUT_HTT_FETCH_PKTS: PM stats for RTPM PUT while fetching
|
||||
* HTT packets from endpoint TX queue
|
||||
* enum hif_rpm_type - Get and Put calls types
|
||||
* HIF_RTPM_GET_ASYNC: Increment usage count and when system is suspended
|
||||
* schedule resume process, return depends on pm state.
|
||||
* HIF_RTPM_GET_FORCE: Increment usage count and when system is suspended
|
||||
* shedule resume process, returns success irrespective of
|
||||
* pm_state.
|
||||
* HIF_RTPM_GET_SYNC: Increment usage count and when system is suspended,
|
||||
* wait till process is resumed.
|
||||
* HIF_RTPM_GET_NORESUME: Only increments usage count.
|
||||
* HIF_RTPM_PUT_ASYNC: Decrements usage count and puts system in idle state.
|
||||
* HIF_RTPM_PUT_SYNC_SUSPEND: Decrements usage count and puts system in
|
||||
* suspended state.
|
||||
* HIF_RTPM_PUT_NOIDLE: Decrements usage count.
|
||||
*/
|
||||
enum hif_pm_htc_stats {
|
||||
HIF_PM_HTC_STATS_GET_HTT_RESPONSE,
|
||||
HIF_PM_HTC_STATS_GET_HTT_NO_RESPONSE,
|
||||
HIF_PM_HTC_STATS_PUT_HTT_RESPONSE,
|
||||
HIF_PM_HTC_STATS_PUT_HTT_NO_RESPONSE,
|
||||
HIF_PM_HTC_STATS_PUT_HTT_ERROR,
|
||||
HIF_PM_HTC_STATS_PUT_HTC_CLEANUP,
|
||||
HIF_PM_HTC_STATS_GET_HTC_KICK_QUEUES,
|
||||
HIF_PM_HTC_STATS_PUT_HTC_KICK_QUEUES,
|
||||
HIF_PM_HTC_STATS_GET_HTT_FETCH_PKTS,
|
||||
HIF_PM_HTC_STATS_PUT_HTT_FETCH_PKTS,
|
||||
enum rpm_type {
|
||||
HIF_RTPM_GET_ASYNC,
|
||||
HIF_RTPM_GET_FORCE,
|
||||
HIF_RTPM_GET_SYNC,
|
||||
HIF_RTPM_GET_NORESUME,
|
||||
HIF_RTPM_PUT_ASYNC,
|
||||
HIF_RTPM_PUT_SYNC_SUSPEND,
|
||||
HIF_RTPM_PUT_NOIDLE,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct hif_pm_runtime_lock - data structure for preventing runtime suspend
|
||||
* @list - global list of runtime locks
|
||||
* @active - true if this lock is preventing suspend
|
||||
* @name - character string for tracking this lock
|
||||
*/
|
||||
struct hif_pm_runtime_lock {
|
||||
struct list_head list;
|
||||
bool active;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
struct hif_pm_runtime_lock;
|
||||
|
||||
void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx);
|
||||
int hif_pm_runtime_get_sync(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid);
|
||||
int hif_pm_runtime_put_sync_suspend(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid);
|
||||
int hif_pm_runtime_request_resume(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid);
|
||||
int hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid,
|
||||
bool is_critical_ctx);
|
||||
void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid);
|
||||
int hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid);
|
||||
int hif_pm_runtime_put_noidle(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid);
|
||||
void hif_pm_runtime_mark_last_busy(struct hif_opaque_softc *hif_ctx);
|
||||
int hif_runtime_lock_init(qdf_runtime_lock_t *lock, const char *name);
|
||||
void hif_runtime_lock_deinit(struct hif_opaque_softc *hif_ctx,
|
||||
struct hif_pm_runtime_lock *lock);
|
||||
int hif_pm_runtime_prevent_suspend(struct hif_opaque_softc *ol_sc,
|
||||
struct hif_pm_runtime_lock *lock);
|
||||
int hif_pm_runtime_allow_suspend(struct hif_opaque_softc *ol_sc,
|
||||
struct hif_pm_runtime_lock *lock);
|
||||
bool hif_pm_runtime_is_suspended(struct hif_opaque_softc *hif_ctx);
|
||||
void hif_pm_runtime_suspend_lock(struct hif_opaque_softc *hif_ctx);
|
||||
void hif_pm_runtime_suspend_unlock(struct hif_opaque_softc *hif_ctx);
|
||||
int hif_pm_runtime_get_monitor_wake_intr(struct hif_opaque_softc *hif_ctx);
|
||||
void hif_pm_runtime_set_monitor_wake_intr(struct hif_opaque_softc *hif_ctx,
|
||||
int val);
|
||||
void hif_pm_runtime_check_and_request_resume(struct hif_opaque_softc *hif_ctx);
|
||||
void hif_pm_runtime_mark_dp_rx_busy(struct hif_opaque_softc *hif_ctx);
|
||||
int hif_pm_runtime_is_dp_rx_busy(struct hif_opaque_softc *hif_ctx);
|
||||
qdf_time_t hif_pm_runtime_get_dp_rx_busy_mark(struct hif_opaque_softc *hif_ctx);
|
||||
int hif_pm_runtime_sync_resume(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid);
|
||||
void hif_pm_runtime_update_stats(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid,
|
||||
enum hif_pm_htc_stats stats);
|
||||
/**
|
||||
* hif_rtpm_register() - Register a module with runtime PM.
|
||||
* @id: ID of the module which needs to be registered
|
||||
* @hif_rpm_cbk: callback to be called when get was called in suspended state.
|
||||
* @prevent_multiple_get: not allow simultaneous get calls or put calls
|
||||
*
|
||||
* Return: success status if successfully registered
|
||||
*/
|
||||
QDF_STATUS hif_rtpm_register(uint32_t id, void (*hif_rpm_cbk)(void));
|
||||
|
||||
/**
|
||||
* hif_pm_set_link_state() - set link state during RTPM
|
||||
* @hif_sc: HIF Context
|
||||
* hif_rtpm_deregister() - Deregister the module
|
||||
* @id: ID of the module which needs to be de-registered
|
||||
*/
|
||||
QDF_STATUS hif_rtpm_deregister(uint32_t id);
|
||||
|
||||
/**
|
||||
* hif_runtime_lock_init() - API to initialize Runtime PM context
|
||||
* @lock: QDF lock context
|
||||
* @name: Context name
|
||||
*
|
||||
* This API initializes the Runtime PM context of the caller and
|
||||
* return the pointer.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void hif_pm_set_link_state(struct hif_opaque_softc *hif_handle, uint8_t val);
|
||||
int hif_runtime_lock_init(qdf_runtime_lock_t *lock, const char *name);
|
||||
|
||||
/**
|
||||
* hif_is_link_state_up() - Is link state up
|
||||
* @hif_sc: HIF Context
|
||||
* hif_runtime_lock_deinit() - This API frees the runtime pm context
|
||||
* @data: Runtime PM context
|
||||
*
|
||||
* Return: 1 link is up, 0 link is down
|
||||
* Return: void
|
||||
*/
|
||||
uint8_t hif_pm_get_link_state(struct hif_opaque_softc *hif_handle);
|
||||
void hif_runtime_lock_deinit(struct hif_pm_runtime_lock *data);
|
||||
|
||||
/**
|
||||
* hif_rtpm_get() - Increment usage_count on the device to avoid suspend.
|
||||
* @type: get call types from hif_rpm_type
|
||||
* @id: ID of the module calling get()
|
||||
*
|
||||
* A get operation will prevent a runtime suspend until a
|
||||
* corresponding put is done. This api should be used when accessing bus.
|
||||
*
|
||||
* CONTRARY TO THE REGULAR RUNTIME PM, WHEN THE BUS IS SUSPENDED,
|
||||
* THIS API WILL ONLY REQUEST THE RESUME AND NOT DO A GET!!!
|
||||
*
|
||||
* return: success if a get has been issued, else error code.
|
||||
*/
|
||||
QDF_STATUS hif_rtpm_get(uint8_t type, uint32_t id);
|
||||
|
||||
/**
|
||||
* hif_pm_runtime_put() - do a put operation on the device
|
||||
* @type: put call types from hif_rpm_type
|
||||
* @id: ID of the module calling put()
|
||||
*
|
||||
* A put operation will allow a runtime suspend after a corresponding
|
||||
* get was done. This api should be used when finished accessing bus.
|
||||
*
|
||||
* This api will return a failure if runtime pm is stopped
|
||||
* This api will return failure if it would decrement the usage count below 0.
|
||||
*
|
||||
* return: QDF_STATUS_SUCCESS if the put is performed
|
||||
*/
|
||||
QDF_STATUS hif_rtpm_put(uint8_t type, uint32_t id);
|
||||
|
||||
/**
|
||||
* hif_pm_runtime_prevent_suspend() - Prevent Runtime suspend
|
||||
* @data: runtime PM lock
|
||||
*
|
||||
* This function will prevent runtime suspend, by incrementing
|
||||
* device's usage count.
|
||||
*
|
||||
* Return: status
|
||||
*/
|
||||
int hif_pm_runtime_prevent_suspend(struct hif_pm_runtime_lock *data);
|
||||
|
||||
/**
|
||||
* hif_pm_runtime_allow_suspend() - Allow Runtime suspend
|
||||
* @data: runtime PM lock
|
||||
*
|
||||
* This function will allow runtime suspend, by decrementing
|
||||
* device's usage count.
|
||||
*
|
||||
* Return: status
|
||||
*/
|
||||
int hif_pm_runtime_allow_suspend(struct hif_pm_runtime_lock *data);
|
||||
|
||||
/**
|
||||
* hif_rtpm_request_resume() - Request resume if bus is suspended
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void hif_rtpm_request_resume(void);
|
||||
|
||||
/**
|
||||
* hif_rtpm_sync_resume() - Invoke synchronous runtime resume.
|
||||
*
|
||||
* This function will invoke synchronous runtime resume.
|
||||
*
|
||||
* Return: status
|
||||
*/
|
||||
QDF_STATUS hif_rtpm_sync_resume(void);
|
||||
|
||||
/**
|
||||
* hif_rtpm_check_and_request_resume() - check if bus is suspended and
|
||||
* request resume.
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void hif_rtpm_check_and_request_resume(void);
|
||||
|
||||
/**
|
||||
* hif_rtpm_set_client_job() - Set job for the client.
|
||||
* @client_id: Client id for which job needs to be set
|
||||
*
|
||||
* If get failed due to system being in suspended state, set the client job so
|
||||
* when system resumes the client's job is called.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void hif_rtpm_set_client_job(uint32_t client_id);
|
||||
|
||||
/**
|
||||
* hif_rtpm_mark_last_busy() - Mark last busy to delay retry to suspend
|
||||
* @id: ID marking last busy
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void hif_rtpm_mark_last_busy(uint32_t id);
|
||||
|
||||
/**
|
||||
* hif_rtpm_get_monitor_wake_intr() - API to get monitor_wake_intr
|
||||
*
|
||||
* monitor_wake_intr variable can be used to indicate if driver expects wake
|
||||
* MSI for runtime PM
|
||||
*
|
||||
* Return: monitor_wake_intr variable
|
||||
*/
|
||||
int hif_rtpm_get_monitor_wake_intr(void);
|
||||
|
||||
/**
|
||||
* hif_rtpm_set_monitor_wake_intr() - API to set monitor_wake_intr
|
||||
* @val: value to set
|
||||
*
|
||||
* monitor_wake_intr variable can be used to indicate if driver expects wake
|
||||
* MSI for runtime PM
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void hif_rtpm_set_monitor_wake_intr(int val);
|
||||
|
||||
/**
|
||||
* hif_pre_runtime_suspend() - book keeping before beginning runtime suspend.
|
||||
* @hif_ctx: HIF context
|
||||
*
|
||||
* Makes sure that the pci link will be taken down by the suspend opperation.
|
||||
* If the hif layer is configured to leave the bus on, runtime suspend will
|
||||
* not save any power.
|
||||
*
|
||||
* Set the runtime suspend state to SUSPENDING.
|
||||
*
|
||||
* return -EINVAL if the bus won't go down. otherwise return 0
|
||||
*/
|
||||
int hif_pre_runtime_suspend(struct hif_opaque_softc *hif_ctx);
|
||||
|
||||
/**
|
||||
* hif_pre_runtime_resume() - bookkeeping before beginning runtime resume
|
||||
*
|
||||
* update the runtime pm state to RESUMING.
|
||||
* Return: void
|
||||
*/
|
||||
void hif_pre_runtime_resume(void);
|
||||
|
||||
/**
|
||||
* hif_process_runtime_suspend_success() - bookkeeping of suspend success
|
||||
*
|
||||
* Record the success.
|
||||
* update the runtime_pm state to SUSPENDED
|
||||
* Return: void
|
||||
*/
|
||||
void hif_process_runtime_suspend_success(void);
|
||||
|
||||
/**
|
||||
* hif_process_runtime_suspend_failure() - bookkeeping of suspend failure
|
||||
*
|
||||
* Record the failure.
|
||||
* mark last busy to delay a retry.
|
||||
* update the runtime_pm state back to ON
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void hif_process_runtime_suspend_failure(void);
|
||||
|
||||
/**
|
||||
* hif_process_runtime_suspend_failure() - bookkeeping of resuming link up
|
||||
*
|
||||
* update the runtime_pm state to RESUMING_LINKUP
|
||||
* Return: void
|
||||
*/
|
||||
void hif_process_runtime_resume_linkup(void);
|
||||
|
||||
/**
|
||||
* hif_process_runtime_resume_success() - bookkeeping after a runtime resume
|
||||
*
|
||||
* record the success.
|
||||
* update the runtime_pm state to SUSPENDED
|
||||
* Return: void
|
||||
*/
|
||||
void hif_process_runtime_resume_success(void);
|
||||
|
||||
/**
|
||||
* hif_rtpm_print_prevent_list() - list the clients preventing suspend.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void hif_rtpm_print_prevent_list(void);
|
||||
|
||||
/**
|
||||
* hif_rtpm_suspend_lock() - spin_lock on marking runtime suspend
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void hif_rtpm_suspend_lock(void);
|
||||
|
||||
/**
|
||||
* hif_rtpm_suspend_unlock() - spin_unlock on marking runtime suspend
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void hif_rtpm_suspend_unlock(void);
|
||||
|
||||
/**
|
||||
* hif_runtime_suspend() - do the bus suspend part of a runtime suspend
|
||||
* @hif_ctx: HIF context
|
||||
*
|
||||
* Return: 0 for success and non-zero error code for failure
|
||||
*/
|
||||
int hif_runtime_suspend(struct hif_opaque_softc *hif_ctx);
|
||||
|
||||
/**
|
||||
* hif_runtime_resume() - do the bus resume part of a runtime resume
|
||||
* @hif_ctx: HIF context
|
||||
*
|
||||
* Return: 0 for success and non-zero error code for failure
|
||||
*/
|
||||
int hif_runtime_resume(struct hif_opaque_softc *hif_ctx);
|
||||
|
||||
/**
|
||||
* hif_fastpath_resume() - resume fastpath for runtimepm
|
||||
* @hif_ctx: HIF context
|
||||
*
|
||||
* ensure that the fastpath write index register is up to date
|
||||
* since runtime pm may cause ce_send_fast to skip the register
|
||||
* write.
|
||||
*
|
||||
* fastpath only applicable to legacy copy engine
|
||||
*/
|
||||
void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx);
|
||||
#else
|
||||
struct hif_pm_runtime_lock {
|
||||
const char *name;
|
||||
};
|
||||
static inline void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx) {}
|
||||
static inline int
|
||||
hif_pm_runtime_get_sync(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid)
|
||||
{ return 0; }
|
||||
static inline int
|
||||
hif_pm_runtime_put_sync_suspend(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid)
|
||||
{ return 0; }
|
||||
static inline int
|
||||
hif_pm_runtime_request_resume(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid)
|
||||
{ return 0; }
|
||||
static inline void
|
||||
hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid)
|
||||
{}
|
||||
|
||||
static inline int
|
||||
hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx, wlan_rtpm_dbgid rtpm_dbgid,
|
||||
bool is_critical_ctx)
|
||||
{ return 0; }
|
||||
static inline int
|
||||
hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx, wlan_rtpm_dbgid rtpm_dbgid)
|
||||
{ return 0; }
|
||||
static inline int
|
||||
hif_pm_runtime_put_noidle(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid)
|
||||
{ return 0; }
|
||||
static inline void
|
||||
hif_pm_runtime_mark_last_busy(struct hif_opaque_softc *hif_ctx) {};
|
||||
static inline int hif_runtime_lock_init(qdf_runtime_lock_t *lock,
|
||||
const char *name)
|
||||
{ return 0; }
|
||||
static inline void
|
||||
hif_runtime_lock_deinit(struct hif_opaque_softc *hif_ctx,
|
||||
struct hif_pm_runtime_lock *lock) {}
|
||||
|
||||
static inline int hif_pm_runtime_prevent_suspend(struct hif_opaque_softc *ol_sc,
|
||||
struct hif_pm_runtime_lock *lock)
|
||||
{ return 0; }
|
||||
static inline int hif_pm_runtime_allow_suspend(struct hif_opaque_softc *ol_sc,
|
||||
struct hif_pm_runtime_lock *lock)
|
||||
{ return 0; }
|
||||
static inline bool hif_pm_runtime_is_suspended(struct hif_opaque_softc *hif_ctx)
|
||||
{ return false; }
|
||||
static inline void
|
||||
hif_pm_runtime_suspend_lock(struct hif_opaque_softc *hif_ctx)
|
||||
{ return; }
|
||||
static inline void
|
||||
hif_pm_runtime_suspend_unlock(struct hif_opaque_softc *hif_ctx)
|
||||
{ return; }
|
||||
static inline int
|
||||
hif_pm_runtime_get_monitor_wake_intr(struct hif_opaque_softc *hif_ctx)
|
||||
{ return 0; }
|
||||
static inline void
|
||||
hif_pm_runtime_set_monitor_wake_intr(struct hif_opaque_softc *hif_ctx, int val)
|
||||
{ return; }
|
||||
static inline void
|
||||
hif_pm_runtime_check_and_request_resume(struct hif_opaque_softc *hif_ctx)
|
||||
{ return; }
|
||||
static inline void
|
||||
hif_pm_runtime_mark_dp_rx_busy(struct hif_opaque_softc *hif_ctx) {};
|
||||
static inline int
|
||||
hif_pm_runtime_is_dp_rx_busy(struct hif_opaque_softc *hif_ctx)
|
||||
{ return 0; }
|
||||
static inline qdf_time_t
|
||||
hif_pm_runtime_get_dp_rx_busy_mark(struct hif_opaque_softc *hif_ctx)
|
||||
{ return 0; }
|
||||
static inline int hif_pm_runtime_sync_resume(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid)
|
||||
{ return 0; }
|
||||
static inline
|
||||
void hif_pm_set_link_state(struct hif_opaque_softc *hif_handle, uint8_t val)
|
||||
QDF_STATUS hif_rtpm_register(uint32_t id, void (*hif_rpm_cbk)(void))
|
||||
{ return QDF_STATUS_SUCCESS; }
|
||||
|
||||
static inline
|
||||
QDF_STATUS hif_rtpm_deregister(uint32_t id)
|
||||
{ return QDF_STATUS_SUCCESS; }
|
||||
|
||||
static inline
|
||||
int hif_runtime_lock_init(qdf_runtime_lock_t *lock, const char *name)
|
||||
{ return 0; }
|
||||
|
||||
static inline
|
||||
void hif_runtime_lock_deinit(struct hif_pm_runtime_lock *data)
|
||||
{}
|
||||
|
||||
static inline
|
||||
void hif_pm_runtime_update_stats(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid,
|
||||
enum hif_pm_htc_stats stats)
|
||||
int hif_rtpm_get(uint8_t type, uint32_t id)
|
||||
{ return QDF_STATUS_SUCCESS; }
|
||||
|
||||
static inline
|
||||
QDF_STATUS hif_rtpm_put(uint8_t type, uint32_t id)
|
||||
{ return QDF_STATUS_SUCCESS; }
|
||||
|
||||
static inline
|
||||
int hif_pm_runtime_allow_suspend(struct hif_pm_runtime_lock *data)
|
||||
{ return 0; }
|
||||
|
||||
static inline
|
||||
int hif_pm_runtime_prevent_suspend(struct hif_pm_runtime_lock *data)
|
||||
{ return 0; }
|
||||
|
||||
static inline
|
||||
QDF_STATUS hif_rtpm_sync_resume(void)
|
||||
{ return QDF_STATUS_SUCCESS; }
|
||||
|
||||
static inline
|
||||
void hif_rtpm_request_resume(void)
|
||||
{}
|
||||
|
||||
static inline
|
||||
void hif_rtpm_check_and_request_resume(void)
|
||||
{}
|
||||
|
||||
static inline
|
||||
void hif_rtpm_set_client_job(uint32_t client_id)
|
||||
{}
|
||||
|
||||
static inline
|
||||
void hif_rtpm_print_prevent_list(void)
|
||||
{}
|
||||
|
||||
static inline
|
||||
void hif_rtpm_suspend_unlock(void)
|
||||
{}
|
||||
|
||||
static inline
|
||||
void hif_rtpm_suspend_lock(void)
|
||||
{}
|
||||
|
||||
static inline
|
||||
int hif_rtpm_get_monitor_wake_intr(void)
|
||||
{ return 0; }
|
||||
|
||||
static inline
|
||||
void hif_rtpm_set_monitor_wake_intr(int val)
|
||||
{}
|
||||
|
||||
static inline
|
||||
void hif_rtpm_mark_last_busy(uint32_t id)
|
||||
{}
|
||||
#endif
|
||||
|
||||
@@ -1445,8 +1572,9 @@ void hif_enable_power_management(struct hif_opaque_softc *hif_ctx,
|
||||
bool is_packet_log_enabled);
|
||||
void hif_disable_power_management(struct hif_opaque_softc *hif_ctx);
|
||||
|
||||
void hif_vote_link_down(struct hif_opaque_softc *hif_ctx);
|
||||
void hif_vote_link_up(struct hif_opaque_softc *hif_ctx);
|
||||
void hif_vote_link_down(struct hif_opaque_softc *hif_ctx);
|
||||
|
||||
bool hif_can_suspend_link(struct hif_opaque_softc *hif_ctx);
|
||||
|
||||
#ifdef IPA_OFFLOAD
|
||||
@@ -1583,21 +1711,6 @@ int hif_apps_enable_irqs_except_wake_irq(struct hif_opaque_softc *hif_ctx);
|
||||
*/
|
||||
int hif_apps_disable_irqs_except_wake_irq(struct hif_opaque_softc *hif_ctx);
|
||||
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
void hif_print_runtime_pm_prevent_list(struct hif_opaque_softc *hif_ctx);
|
||||
int hif_pre_runtime_suspend(struct hif_opaque_softc *hif_ctx);
|
||||
void hif_pre_runtime_resume(struct hif_opaque_softc *hif_ctx);
|
||||
int hif_runtime_suspend(struct hif_opaque_softc *hif_ctx);
|
||||
int hif_runtime_resume(struct hif_opaque_softc *hif_ctx);
|
||||
void hif_process_runtime_suspend_success(struct hif_opaque_softc *hif_ctx);
|
||||
void hif_process_runtime_suspend_failure(struct hif_opaque_softc *hif_ctx);
|
||||
void hif_process_runtime_resume_success(struct hif_opaque_softc *hif_ctx);
|
||||
#else
|
||||
static inline void
|
||||
hif_print_runtime_pm_prevent_list(struct hif_opaque_softc *hif_ctx)
|
||||
{}
|
||||
#endif
|
||||
|
||||
int hif_get_irq_num(struct hif_opaque_softc *scn, int *irq, uint32_t size);
|
||||
int hif_dump_registers(struct hif_opaque_softc *scn);
|
||||
int ol_copy_ramdump(struct hif_opaque_softc *scn);
|
||||
|
@@ -2933,12 +2933,10 @@ hif_pci_ce_recv_data(struct CE_handle *copyeng, void *ce_context,
|
||||
struct HIF_CE_state *hif_state = pipe_info->HIF_CE_state;
|
||||
struct CE_state *ce_state = (struct CE_state *) copyeng;
|
||||
struct hif_softc *scn = HIF_GET_SOFTC(hif_state);
|
||||
struct hif_opaque_softc *hif_ctx = GET_HIF_OPAQUE_HDL(scn);
|
||||
struct hif_msg_callbacks *msg_callbacks =
|
||||
&pipe_info->pipe_callbacks;
|
||||
struct hif_msg_callbacks *msg_callbacks = &pipe_info->pipe_callbacks;
|
||||
|
||||
do {
|
||||
hif_pm_runtime_mark_last_busy(hif_ctx);
|
||||
hif_rtpm_mark_last_busy(HIF_RTPM_ID_CE);
|
||||
qdf_nbuf_unmap_single(scn->qdf_dev,
|
||||
(qdf_nbuf_t) transfer_context,
|
||||
QDF_DMA_FROM_DEVICE);
|
||||
|
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@@ -118,7 +119,6 @@ int ce_send_fast(struct CE_handle *copyeng, qdf_nbuf_t msdu,
|
||||
{
|
||||
struct CE_state *ce_state = (struct CE_state *)copyeng;
|
||||
struct hif_softc *scn = ce_state->scn;
|
||||
struct hif_opaque_softc *hif_hdl = GET_HIF_OPAQUE_HDL(scn);
|
||||
struct CE_ring_state *src_ring = ce_state->src_ring;
|
||||
u_int32_t ctrl_addr = ce_state->ctrl_addr;
|
||||
unsigned int nentries_mask = src_ring->nentries_mask;
|
||||
@@ -147,8 +147,7 @@ int ce_send_fast(struct CE_handle *copyeng, qdf_nbuf_t msdu,
|
||||
* Request runtime PM resume if it has already suspended and make
|
||||
* sure there is no PCIe link access.
|
||||
*/
|
||||
if (hif_pm_runtime_get(hif_hdl,
|
||||
RTPM_ID_CE_SEND_FAST, false) != 0)
|
||||
if (hif_rtpm_get(HIF_RTPM_GET_ASYNC, HIF_RTPM_ID_CE) != 0)
|
||||
ok_to_send = false;
|
||||
|
||||
if (ok_to_send) {
|
||||
@@ -191,8 +190,6 @@ int ce_send_fast(struct CE_handle *copyeng, qdf_nbuf_t msdu,
|
||||
struct CE_src_desc *shadow_src_desc =
|
||||
CE_SRC_RING_TO_DESC(shadow_base, write_index);
|
||||
|
||||
hif_pm_runtime_get_noresume(hif_hdl, RTPM_ID_HTC);
|
||||
|
||||
/*
|
||||
* First fill out the ring descriptor for the HTC HTT frame
|
||||
* header. These are uncached writes. Should we use a local
|
||||
@@ -281,7 +278,7 @@ int ce_send_fast(struct CE_handle *copyeng, qdf_nbuf_t msdu,
|
||||
} else {
|
||||
ce_state->state = CE_PENDING;
|
||||
}
|
||||
hif_pm_runtime_put(hif_hdl, RTPM_ID_CE_SEND_FAST);
|
||||
hif_rtpm_put(HIF_RTPM_PUT_ASYNC, HIF_RTPM_ID_CE);
|
||||
}
|
||||
|
||||
qdf_spin_unlock_bh(&ce_state->ce_index_lock);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -144,30 +144,6 @@ QDF_STATUS hif_ipci_enable_bus(
|
||||
*/
|
||||
void hif_ipci_disable_bus(struct hif_softc *scn);
|
||||
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
/**
|
||||
* hif_ipci_get_rpm_ctx() - Map corresponding hif_runtime_pm_ctx
|
||||
* @scn: hif context
|
||||
*
|
||||
* This function will map and return the corresponding
|
||||
* hif_runtime_pm_ctx based on ipcie interface.
|
||||
*
|
||||
* Return: struct hif_runtime_pm_ctx pointer
|
||||
*/
|
||||
struct hif_runtime_pm_ctx *hif_ipci_get_rpm_ctx(struct hif_softc *hif_sc);
|
||||
|
||||
/**
|
||||
* hif_ipci_get_dev() - Map corresponding device structure
|
||||
* @scn: hif context
|
||||
*
|
||||
* This function will map and return the corresponding
|
||||
* device structure based on ipcie interface.
|
||||
*
|
||||
* Return: struct device pointer
|
||||
*/
|
||||
struct device *hif_ipci_get_dev(struct hif_softc *hif_sc);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* hif_ipci_bus_configure() - configure the pcie bus
|
||||
* @hif_sc: pointer to the hif context.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2018, 2020-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@@ -277,18 +277,6 @@ void hif_disable_bus(struct hif_softc *hif_sc)
|
||||
hif_sc->bus_ops.hif_disable_bus(hif_sc);
|
||||
}
|
||||
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
struct hif_runtime_pm_ctx *hif_bus_get_rpm_ctx(struct hif_softc *hif_sc)
|
||||
{
|
||||
return hif_sc->bus_ops.hif_bus_get_rpm_ctx(hif_sc);
|
||||
}
|
||||
|
||||
struct device *hif_bus_get_dev(struct hif_softc *hif_sc)
|
||||
{
|
||||
return hif_sc->bus_ops.hif_bus_get_dev(hif_sc);
|
||||
}
|
||||
#endif
|
||||
|
||||
int hif_bus_configure(struct hif_softc *hif_sc)
|
||||
{
|
||||
return hif_sc->bus_ops.hif_bus_configure(hif_sc);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2018, 2020-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@@ -49,11 +49,6 @@ struct hif_bus_ops {
|
||||
const struct hif_bus_id *bid,
|
||||
enum hif_enable_type type);
|
||||
void (*hif_disable_bus)(struct hif_softc *hif_sc);
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
struct hif_runtime_pm_ctx *(*hif_bus_get_rpm_ctx)(
|
||||
struct hif_softc *hif_sc);
|
||||
struct device *(*hif_bus_get_dev)(struct hif_softc *hif_sc);
|
||||
#endif
|
||||
int (*hif_bus_configure)(struct hif_softc *hif_sc);
|
||||
QDF_STATUS (*hif_get_config_item)(struct hif_softc *hif_sc,
|
||||
int opcode, void *config, uint32_t config_len);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -47,10 +47,6 @@ QDF_STATUS hif_initialize_ipci_ops(struct hif_softc *hif_sc)
|
||||
bus_ops->hif_nointrs = &hif_ipci_nointrs;
|
||||
bus_ops->hif_enable_bus = &hif_ipci_enable_bus;
|
||||
bus_ops->hif_disable_bus = &hif_ipci_disable_bus;
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
bus_ops->hif_bus_get_rpm_ctx = &hif_ipci_get_rpm_ctx;
|
||||
bus_ops->hif_bus_get_dev = &hif_ipci_get_dev;
|
||||
#endif
|
||||
bus_ops->hif_bus_configure = &hif_ipci_bus_configure;
|
||||
bus_ops->hif_get_config_item = &hif_dummy_get_config_item;
|
||||
bus_ops->hif_set_mailbox_swap = &hif_dummy_set_mailbox_swap;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@@ -57,10 +57,6 @@ QDF_STATUS hif_initialize_pci_ops(struct hif_softc *hif_sc)
|
||||
bus_ops->hif_nointrs = &hif_pci_nointrs;
|
||||
bus_ops->hif_enable_bus = &hif_pci_enable_bus;
|
||||
bus_ops->hif_disable_bus = &hif_pci_disable_bus;
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
bus_ops->hif_bus_get_rpm_ctx = &hif_pci_get_rpm_ctx;
|
||||
bus_ops->hif_bus_get_dev = &hif_pci_get_dev;
|
||||
#endif
|
||||
bus_ops->hif_bus_configure = &hif_pci_bus_configure;
|
||||
bus_ops->hif_get_config_item = &hif_dummy_get_config_item;
|
||||
bus_ops->hif_set_mailbox_swap = &hif_dummy_set_mailbox_swap;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@@ -40,10 +40,6 @@ QDF_STATUS hif_pci_enable_bus(struct hif_softc *scn,
|
||||
const struct hif_bus_id *bid,
|
||||
enum hif_enable_type type);
|
||||
void hif_pci_disable_bus(struct hif_softc *scn);
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
struct hif_runtime_pm_ctx *hif_pci_get_rpm_ctx(struct hif_softc *hif_sc);
|
||||
struct device *hif_pci_get_dev(struct hif_softc *hif_sc);
|
||||
#endif
|
||||
int hif_pci_bus_configure(struct hif_softc *scn);
|
||||
void hif_pci_irq_disable(struct hif_softc *scn, int ce_id);
|
||||
void hif_pci_irq_enable(struct hif_softc *scn, int ce_id);
|
||||
|
@@ -450,6 +450,38 @@ void *hif_get_dev_ba_ce(struct hif_opaque_softc *hif_handle)
|
||||
|
||||
qdf_export_symbol(hif_get_dev_ba_ce);
|
||||
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
void hif_runtime_prevent_linkdown(struct hif_softc *scn, bool is_get)
|
||||
{
|
||||
if (is_get)
|
||||
qdf_runtime_pm_prevent_suspend(&scn->prevent_linkdown_lock);
|
||||
else
|
||||
qdf_runtime_pm_allow_suspend(&scn->prevent_linkdown_lock);
|
||||
}
|
||||
|
||||
static inline
|
||||
void hif_rtpm_lock_init(struct hif_softc *scn)
|
||||
{
|
||||
qdf_runtime_lock_init(&scn->prevent_linkdown_lock);
|
||||
}
|
||||
|
||||
static inline
|
||||
void hif_rtpm_lock_deinit(struct hif_softc *scn)
|
||||
{
|
||||
qdf_runtime_lock_deinit(&scn->prevent_linkdown_lock);
|
||||
}
|
||||
#else
|
||||
static inline
|
||||
void hif_rtpm_lock_init(struct hif_softc *scn)
|
||||
{
|
||||
}
|
||||
|
||||
static inline
|
||||
void hif_rtpm_lock_deinit(struct hif_softc *scn)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WLAN_CE_INTERRUPT_THRESHOLD_CONFIG
|
||||
/**
|
||||
* hif_get_cfg_from_psoc() - Retrieve ini cfg from psoc
|
||||
@@ -935,7 +967,6 @@ struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx,
|
||||
sizeof(struct hif_driver_state_callbacks));
|
||||
scn->bus_type = bus_type;
|
||||
|
||||
hif_pm_set_link_state(GET_HIF_OPAQUE_HDL(scn), HIF_PM_LINK_STATE_DOWN);
|
||||
hif_allow_ep_vote_access(GET_HIF_OPAQUE_HDL(scn));
|
||||
hif_get_cfg_from_psoc(scn, psoc);
|
||||
|
||||
@@ -949,6 +980,8 @@ struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx,
|
||||
goto out;
|
||||
}
|
||||
|
||||
hif_rtpm_lock_init(scn);
|
||||
|
||||
hif_cpuhp_register(scn);
|
||||
hif_latency_detect_timer_init(scn);
|
||||
|
||||
@@ -1006,6 +1039,7 @@ void hif_close(struct hif_opaque_softc *hif_ctx)
|
||||
hif_uninit_rri_on_ddr(scn);
|
||||
hif_cleanup_static_buf_to_target(scn);
|
||||
hif_cpuhp_unregister(scn);
|
||||
hif_rtpm_lock_deinit(scn);
|
||||
|
||||
hif_bus_close(scn);
|
||||
|
||||
@@ -1253,7 +1287,6 @@ QDF_STATUS hif_enable(struct hif_opaque_softc *hif_ctx, struct device *dev,
|
||||
return status;
|
||||
}
|
||||
|
||||
hif_pm_set_link_state(GET_HIF_OPAQUE_HDL(scn), HIF_PM_LINK_STATE_UP);
|
||||
status = hif_hal_attach(scn);
|
||||
if (status != QDF_STATUS_SUCCESS) {
|
||||
hif_err("hal attach failed");
|
||||
@@ -1311,7 +1344,6 @@ void hif_disable(struct hif_opaque_softc *hif_ctx, enum hif_disable_type type)
|
||||
|
||||
hif_hal_detach(scn);
|
||||
|
||||
hif_pm_set_link_state(hif_ctx, HIF_PM_LINK_STATE_DOWN);
|
||||
hif_disable_bus(scn);
|
||||
|
||||
hif_wlan_disable(scn);
|
||||
@@ -2098,12 +2130,11 @@ hif_pm_wake_irq_type hif_pm_get_wake_irq_type(struct hif_opaque_softc *hif_ctx)
|
||||
irqreturn_t hif_wake_interrupt_handler(int irq, void *context)
|
||||
{
|
||||
struct hif_softc *scn = context;
|
||||
struct hif_opaque_softc *hif_ctx = GET_HIF_OPAQUE_HDL(scn);
|
||||
|
||||
hif_info("wake interrupt received on irq %d", irq);
|
||||
|
||||
hif_pm_runtime_set_monitor_wake_intr(hif_ctx, 0);
|
||||
hif_pm_runtime_request_resume(hif_ctx, RTPM_ID_WAKE_INTR_HANDLER);
|
||||
hif_rtpm_set_monitor_wake_intr(0);
|
||||
hif_rtpm_request_resume();
|
||||
|
||||
if (scn->initial_wakeup_cb)
|
||||
scn->initial_wakeup_cb(scn->initial_wakeup_priv);
|
||||
|
@@ -307,6 +307,9 @@ struct hif_softc {
|
||||
#ifdef HIF_DETECTION_LATENCY_ENABLE
|
||||
struct hif_latency_detect latency_detect;
|
||||
#endif
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
qdf_runtime_lock_t prevent_linkdown_lock;
|
||||
#endif
|
||||
#ifdef SYSTEM_PM_CHECK
|
||||
qdf_atomic_t sys_pm_state;
|
||||
#endif
|
||||
@@ -446,10 +449,6 @@ QDF_STATUS hif_bus_open(struct hif_softc *ol_sc,
|
||||
QDF_STATUS hif_enable_bus(struct hif_softc *ol_sc, struct device *dev,
|
||||
void *bdev, const struct hif_bus_id *bid, enum hif_enable_type type);
|
||||
void hif_disable_bus(struct hif_softc *scn);
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
struct hif_runtime_pm_ctx *hif_bus_get_rpm_ctx(struct hif_softc *hif_sc);
|
||||
struct device *hif_bus_get_dev(struct hif_softc *hif_sc);
|
||||
#endif
|
||||
void hif_bus_prevent_linkdown(struct hif_softc *scn, bool flag);
|
||||
int hif_bus_get_context_size(enum qdf_bus_type bus_type);
|
||||
void hif_read_phy_mem_base(struct hif_softc *scn, qdf_dma_addr_t *bar_value);
|
||||
@@ -557,4 +556,21 @@ static inline
|
||||
void hif_uninit_rri_on_ddr(struct hif_softc *scn) {}
|
||||
#endif
|
||||
void hif_cleanup_static_buf_to_target(struct hif_softc *scn);
|
||||
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
/**
|
||||
* hif_runtime_prevent_linkdown() - prevent or allow a runtime pm from occurring
|
||||
* @scn: hif context
|
||||
* @is_get: prevent linkdown if true otherwise allow
|
||||
*
|
||||
* this api should only be called as part of bus prevent linkdown
|
||||
*/
|
||||
void hif_runtime_prevent_linkdown(struct hif_softc *scn, bool is_get);
|
||||
#else
|
||||
static inline
|
||||
void hif_runtime_prevent_linkdown(struct hif_softc * scn, bool is_get)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __HIF_MAIN_H__ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -18,122 +19,266 @@
|
||||
#define __HIF_RUNTIME_PM_H__
|
||||
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
|
||||
/**
|
||||
* enum hif_pm_runtime_state - Driver States for Runtime Power Management
|
||||
* HIF_PM_RUNTIME_STATE_NONE: runtime pm is off
|
||||
* HIF_PM_RUNTIME_STATE_ON: runtime pm is active and link is active
|
||||
* HIF_PM_RUNTIME_STATE_RESUMING: a runtime resume is in progress
|
||||
* HIF_PM_RUNTIME_STATE_SUSPENDING: a runtime suspend is in progress
|
||||
* HIF_PM_RUNTIME_STATE_SUSPENDED: the driver is runtime suspended
|
||||
*/
|
||||
enum hif_pm_runtime_state {
|
||||
HIF_PM_RUNTIME_STATE_NONE,
|
||||
HIF_PM_RUNTIME_STATE_ON,
|
||||
HIF_PM_RUNTIME_STATE_RESUMING,
|
||||
HIF_PM_RUNTIME_STATE_SUSPENDING,
|
||||
HIF_PM_RUNTIME_STATE_SUSPENDED,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct hif_pm_runtime_lock - data structure for preventing runtime suspend
|
||||
* @list - global list of runtime locks
|
||||
* @active - true if this lock is preventing suspend
|
||||
* @name - character string for tracking this lock
|
||||
*/
|
||||
struct hif_pm_runtime_lock {
|
||||
struct list_head list;
|
||||
bool active;
|
||||
uint32_t timeout;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
/* Debugging stats for RTPM for HTC layer */
|
||||
struct hif_pm_runtime_htc_stats {
|
||||
uint32_t rtpm_get_htt_resp;
|
||||
uint32_t rtpm_get_htt_no_resp;
|
||||
uint32_t rtpm_put_htt_resp;
|
||||
uint32_t rtpm_put_htt_no_resp;
|
||||
uint32_t rtpm_put_htt_error;
|
||||
uint32_t rtpm_put_htc_cleanup;
|
||||
uint32_t rtpm_get_htc_kick_queues;
|
||||
uint32_t rtpm_put_htc_kick_queues;
|
||||
uint32_t rtpm_get_htt_fetch_pkts;
|
||||
uint32_t rtpm_put_htt_fetch_pkts;
|
||||
};
|
||||
|
||||
/* Debugging stats for Runtime PM */
|
||||
struct hif_pci_pm_stats {
|
||||
u32 suspended;
|
||||
u32 suspend_err;
|
||||
u32 resumed;
|
||||
atomic_t runtime_get;
|
||||
atomic_t runtime_put;
|
||||
atomic_t runtime_get_dbgid[RTPM_ID_MAX];
|
||||
atomic_t runtime_put_dbgid[RTPM_ID_MAX];
|
||||
uint64_t runtime_get_timestamp_dbgid[RTPM_ID_MAX];
|
||||
uint64_t runtime_put_timestamp_dbgid[RTPM_ID_MAX];
|
||||
u32 request_resume;
|
||||
atomic_t allow_suspend;
|
||||
atomic_t prevent_suspend;
|
||||
u32 prevent_suspend_timeout;
|
||||
u32 allow_suspend_timeout;
|
||||
u32 runtime_get_err;
|
||||
wlan_rtpm_dbgid last_resume_rtpm_dbgid;
|
||||
void *last_busy_marker;
|
||||
qdf_time_t last_busy_timestamp;
|
||||
unsigned long suspend_jiffies;
|
||||
struct hif_pm_runtime_htc_stats pm_stats_htc;
|
||||
};
|
||||
|
||||
struct hif_runtime_pm_ctx {
|
||||
atomic_t pm_state;
|
||||
atomic_t monitor_wake_intr;
|
||||
uint32_t prevent_suspend_cnt;
|
||||
struct hif_pci_pm_stats pm_stats;
|
||||
struct work_struct pm_work;
|
||||
spinlock_t runtime_lock; /* Generic spinlock for Runtime PM */
|
||||
qdf_spinlock_t runtime_suspend_lock;
|
||||
qdf_timer_t runtime_timer;
|
||||
struct list_head prevent_suspend_list;
|
||||
unsigned long runtime_timer_expires;
|
||||
qdf_runtime_lock_t prevent_linkdown_lock;
|
||||
atomic_t pm_dp_rx_busy;
|
||||
qdf_time_t dp_last_busy_timestamp;
|
||||
#ifdef WLAN_OPEN_SOURCE
|
||||
struct dentry *pm_dentry;
|
||||
#endif
|
||||
};
|
||||
|
||||
#include <linux/pm_runtime.h>
|
||||
|
||||
static inline int hif_pm_request_resume(struct device *dev)
|
||||
/**
|
||||
* enum hif_rtpm_state - Driver States for Runtime Power Management
|
||||
* @HIF_RTPM_STATE_NONE: runtime pm is off
|
||||
* @HIF_RTPM_STATE_ON: runtime pm is active and link is active
|
||||
* @HIF_RTPM_STATE_RESUMING: a runtime resume is in progress
|
||||
* @HIF_RTPM_STATE_RESUMING_LINKUP: Link is up during resume
|
||||
* @HIF_RTPM_STATE_SUSPENDING: a runtime suspend is in progress
|
||||
* @HIF_RTPM_STATE_SUSPENDED: the driver is runtime suspended
|
||||
*/
|
||||
enum hif_rtpm_state {
|
||||
HIF_RTPM_STATE_NONE,
|
||||
HIF_RTPM_STATE_ON,
|
||||
HIF_RTPM_STATE_RESUMING_LINKUP,
|
||||
HIF_RTPM_STATE_RESUMING,
|
||||
HIF_RTPM_STATE_SUSPENDING,
|
||||
HIF_RTPM_STATE_SUSPENDED,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct hif_rtpm_state_stats - Runtime PM stats
|
||||
* @resume_count: count of resume calls done
|
||||
* @suspend_count: count of suspend calls done
|
||||
* @suspend_err_count: count of suspend calls failed
|
||||
* @resume_ts: Last resume call timestamp
|
||||
* @suspend_ts: Last suspend call timestamp
|
||||
* @suspend_err_ts: Last suspend call fail timestamp
|
||||
* @last_busy_ts: Last busy timestamp marked
|
||||
* @request_resume_ts: Last request resume done timestamp
|
||||
* @request_resume_ts: Client ID requesting resume
|
||||
*/
|
||||
struct hif_rtpm_state_stats {
|
||||
uint32_t resume_count;
|
||||
uint32_t suspend_count;
|
||||
uint32_t suspend_err_count;
|
||||
uint64_t resume_ts;
|
||||
uint64_t suspend_ts;
|
||||
uint64_t suspend_err_ts;
|
||||
uint64_t last_busy_ts;
|
||||
uint32_t last_busy_id;
|
||||
void *last_busy_marker;
|
||||
uint64_t request_resume_ts;
|
||||
uint64_t request_resume_id;
|
||||
uint32_t prevent_suspend;
|
||||
uint32_t allow_suspend;
|
||||
uint32_t runtime_get_err;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct hif_rtpm_client - Runtime PM client structure
|
||||
* @hif_rtpm_cbk: Callback during resume if get called at suspend and failed
|
||||
* @prevent_multiple_get: Client restricted to not calling get and put calls
|
||||
* simultaneously
|
||||
* @active_count: current active status of client
|
||||
* @get_count: count of get calls by this client
|
||||
* @put_count: count of put calls by this client
|
||||
* @get_ts: Last get called timestamp
|
||||
* @put_ts: Last put called timestamp
|
||||
* @request_resume_ts: client request resume timestamp
|
||||
*/
|
||||
struct hif_rtpm_client {
|
||||
void (*hif_rtpm_cbk)(void);
|
||||
qdf_atomic_t active_count;
|
||||
qdf_atomic_t get_count;
|
||||
qdf_atomic_t put_count;
|
||||
uint32_t last_busy_cnt;
|
||||
uint64_t get_ts;
|
||||
uint64_t put_ts;
|
||||
uint64_t last_busy_ts;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct hif_rtpm_ctx - Runtime power management context
|
||||
* @runtime_lock: Lock to sync state changes with get calls
|
||||
* @runtime_suspend_lock: Suspend lock
|
||||
* @client_count: Number of clients currently registered
|
||||
* @clients: clients registered to use runtime PM module
|
||||
* @pm_state: Current runtime pm state
|
||||
* @pending_job: bitmap to set the client job to be called at resume
|
||||
* @monitor_wake_intr: Monitor waking MSI for runtime PM
|
||||
* @stats: Runtime PM stats
|
||||
* @pm_entry: debug fs entry
|
||||
*/
|
||||
struct hif_rtpm_ctx {
|
||||
bool enable_rpm;
|
||||
struct device *dev;
|
||||
qdf_spinlock_t runtime_lock;
|
||||
qdf_spinlock_t runtime_suspend_lock;
|
||||
unsigned int client_count;
|
||||
struct hif_rtpm_client *clients[HIF_RTPM_ID_MAX];
|
||||
qdf_spinlock_t prevent_list_lock;
|
||||
struct list_head prevent_list;
|
||||
uint32_t prevent_cnt;
|
||||
qdf_atomic_t pm_state;
|
||||
unsigned long pending_job;
|
||||
qdf_atomic_t monitor_wake_intr;
|
||||
struct hif_rtpm_state_stats stats;
|
||||
struct dentry *pm_dentry;
|
||||
};
|
||||
|
||||
/**
|
||||
* __hif_rtpm_enabled() - Check if runtime pm is enabled from kernel
|
||||
* @dev: device structure
|
||||
*
|
||||
* Return: true if enabled.
|
||||
*/
|
||||
static inline bool __hif_rtpm_enabled(struct device *dev)
|
||||
{
|
||||
return pm_request_resume(dev);
|
||||
return pm_runtime_enabled(dev);
|
||||
}
|
||||
|
||||
static inline int __hif_pm_runtime_get(struct device *dev)
|
||||
/**
|
||||
* __hif_rtpm_get() - Increment dev usage count and call resume function
|
||||
* @dev: device structure
|
||||
*
|
||||
* Increments usage count and internally queue resume work
|
||||
*
|
||||
* Return: 1 if state is active. 0 if resume is requested. Error otherwise.
|
||||
*/
|
||||
static inline int __hif_rtpm_get(struct device *dev)
|
||||
{
|
||||
return pm_runtime_get(dev);
|
||||
}
|
||||
|
||||
static inline int hif_pm_runtime_put_auto(struct device *dev)
|
||||
/**
|
||||
* __hif_rtpm_get_noresume() - Only increment dev usage count
|
||||
* @dev: device structure
|
||||
*
|
||||
* Return: Void
|
||||
*/
|
||||
static inline void __hif_rtpm_get_noresume(struct device *dev)
|
||||
{
|
||||
pm_runtime_get_noresume(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* __hif_rtpm_get_sync() - Increment usage count and set state to active
|
||||
* @dev: device structure
|
||||
*
|
||||
* Return: 1 if state is already active, 0 if state active was done.
|
||||
* Error otherwise.
|
||||
*/
|
||||
static inline int __hif_rtpm_get_sync(struct device *dev)
|
||||
{
|
||||
return pm_runtime_get_sync(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* __hif_rtpm_put_auto() - Decrement usage count and call suspend function
|
||||
* @dev: device structure
|
||||
*
|
||||
* Decrements usage count and queue suspend work if usage count is 0
|
||||
*
|
||||
* Return: 0 if success. Error otherwise.
|
||||
*/
|
||||
static inline int __hif_rtpm_put_auto(struct device *dev)
|
||||
{
|
||||
return pm_runtime_put_autosuspend(dev);
|
||||
}
|
||||
|
||||
void hif_pm_runtime_open(struct hif_softc *scn);
|
||||
void hif_pm_runtime_start(struct hif_softc *scn);
|
||||
void hif_pm_runtime_stop(struct hif_softc *scn);
|
||||
void hif_pm_runtime_close(struct hif_softc *scn);
|
||||
void hif_runtime_prevent_linkdown(struct hif_softc *scn, bool flag);
|
||||
/**
|
||||
* __hif_rtpm_put_noidle() - Decrement usage count
|
||||
* @dev: device structure
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
static inline void __hif_rtpm_put_noidle(struct device *dev)
|
||||
{
|
||||
pm_runtime_put_noidle(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* __hif_rtpm_put_sync_suspend() - Decrement usage count
|
||||
* @dev: device structure
|
||||
*
|
||||
* Decrement usage_count of device and if 0 synchrounsly call suspend function
|
||||
*
|
||||
* Return: 0 if success. Error otherwise
|
||||
*/
|
||||
static inline int __hif_rtpm_put_sync_suspend(struct device *dev)
|
||||
{
|
||||
return pm_runtime_put_sync_suspend(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* __hif_rtpm_mark_last_busy() - Mark last busy timestamp
|
||||
* @dev: device structure
|
||||
*
|
||||
* Return: Void
|
||||
*/
|
||||
static inline void __hif_rtpm_mark_last_busy(struct device *dev)
|
||||
{
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* __hif_rtpm_resume() - Do Runtime PM Resume of bus
|
||||
* dev: device structure
|
||||
*
|
||||
* Return: 0 if success. Error otherwise
|
||||
*/
|
||||
static inline int __hif_rtpm_resume(struct device *dev)
|
||||
{
|
||||
return pm_runtime_resume(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* __hif_rtpm_request_resume() - Queue resume work
|
||||
* dev: device structure
|
||||
*
|
||||
* Return: 1 if already active. 0 if successfully queued. Error otherwise
|
||||
*/
|
||||
static inline int __hif_rtpm_request_resume(struct device *dev)
|
||||
{
|
||||
return pm_request_resume(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* hif_rtpm_open() - initialize runtime pm
|
||||
* @scn: hif ctx
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void hif_rtpm_open(struct hif_softc *scn);
|
||||
|
||||
/**
|
||||
* hif_rtpm_close() - close runtime pm
|
||||
* @scn: hif ctx
|
||||
*
|
||||
* ensure runtime_pm is stopped before closing the driver
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void hif_rtpm_close(struct hif_softc *scn);
|
||||
|
||||
/**
|
||||
* hif_rtpm_start() - start the runtime pm
|
||||
* @scn: hif context
|
||||
*
|
||||
* After this call, runtime pm will be active.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void hif_rtpm_start(struct hif_softc *scn);
|
||||
|
||||
/**
|
||||
* hif_rtpm_stop() - stop runtime pm
|
||||
* @scn: hif context
|
||||
*
|
||||
* Turns off runtime pm and frees corresponding resources
|
||||
* that were acquired by hif_rtpm_start().
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void hif_rtpm_stop(struct hif_softc *scn);
|
||||
#else
|
||||
static inline void hif_pm_runtime_open(struct hif_softc *scn) {}
|
||||
static inline void hif_pm_runtime_start(struct hif_softc *scn) {}
|
||||
static inline void hif_pm_runtime_stop(struct hif_softc *scn) {}
|
||||
static inline void hif_pm_runtime_close(struct hif_softc *scn) {}
|
||||
static inline void hif_runtime_prevent_linkdown(struct hif_softc *scn,
|
||||
bool flag) {}
|
||||
static inline void hif_rtpm_open(struct hif_softc *scn) {}
|
||||
static inline void hif_rtpm_close(struct hif_softc *scn) {}
|
||||
static inline void hif_rtpm_start(struct hif_softc *scn) {}
|
||||
static inline void hif_rtpm_stop(struct hif_softc *scn) {}
|
||||
#endif /* FEATURE_RUNTIME_PM */
|
||||
#endif /* __HIF_RUNTIME_PM_H__ */
|
||||
|
@@ -44,31 +44,15 @@
|
||||
|
||||
#include "ipci_api.h"
|
||||
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
inline struct hif_runtime_pm_ctx *hif_ipci_get_rpm_ctx(struct hif_softc *scn)
|
||||
{
|
||||
struct hif_ipci_softc *sc = HIF_GET_IPCI_SOFTC(scn);
|
||||
|
||||
return &sc->rpm_ctx;
|
||||
}
|
||||
|
||||
inline struct device *hif_ipci_get_dev(struct hif_softc *scn)
|
||||
{
|
||||
struct hif_ipci_softc *sc = HIF_GET_IPCI_SOFTC(scn);
|
||||
|
||||
return sc->dev;
|
||||
}
|
||||
#endif
|
||||
|
||||
void hif_ipci_enable_power_management(struct hif_softc *hif_sc,
|
||||
bool is_packet_log_enabled)
|
||||
{
|
||||
hif_pm_runtime_start(hif_sc);
|
||||
hif_rtpm_start(hif_sc);
|
||||
}
|
||||
|
||||
void hif_ipci_disable_power_management(struct hif_softc *hif_ctx)
|
||||
{
|
||||
hif_pm_runtime_stop(hif_ctx);
|
||||
hif_rtpm_stop(hif_ctx);
|
||||
}
|
||||
|
||||
void hif_ipci_display_stats(struct hif_softc *hif_ctx)
|
||||
@@ -92,7 +76,7 @@ QDF_STATUS hif_ipci_open(struct hif_softc *hif_ctx, enum qdf_bus_type bus_type)
|
||||
struct hif_ipci_softc *sc = HIF_GET_IPCI_SOFTC(hif_ctx);
|
||||
|
||||
hif_ctx->bus_type = bus_type;
|
||||
hif_pm_runtime_open(hif_ctx);
|
||||
hif_rtpm_open(hif_ctx);
|
||||
|
||||
qdf_spinlock_create(&sc->irq_lock);
|
||||
|
||||
@@ -162,7 +146,7 @@ disable_wlan:
|
||||
|
||||
void hif_ipci_close(struct hif_softc *hif_sc)
|
||||
{
|
||||
hif_pm_runtime_close(hif_sc);
|
||||
hif_rtpm_close(hif_sc);
|
||||
hif_ce_close(hif_sc);
|
||||
}
|
||||
|
||||
@@ -369,11 +353,11 @@ int hif_ipci_bus_suspend_noirq(struct hif_softc *scn)
|
||||
* have scheduled CE2 tasklet, so suspend activity can
|
||||
* be aborted.
|
||||
* Similar scenario for runtime suspend case, would be
|
||||
* handled by hif_pm_runtime_check_and_request_resume
|
||||
* handled by hif_rtpm_check_and_request_resume
|
||||
* in hif_ce_interrupt_handler.
|
||||
*
|
||||
*/
|
||||
if (!hif_pm_runtime_get_monitor_wake_intr(GET_HIF_OPAQUE_HDL(scn)) &&
|
||||
if (!hif_rtpm_get_monitor_wake_intr() &&
|
||||
hif_get_num_active_tasklets(scn)) {
|
||||
hif_err("Tasklets are pending, abort sys suspend_noirq");
|
||||
return -EBUSY;
|
||||
@@ -424,8 +408,7 @@ static irqreturn_t hif_ce_interrupt_handler(int irq, void *context)
|
||||
{
|
||||
struct ce_tasklet_entry *tasklet_entry = context;
|
||||
|
||||
hif_pm_runtime_check_and_request_resume(
|
||||
GET_HIF_OPAQUE_HDL(tasklet_entry->hif_ce_state));
|
||||
hif_rtpm_check_and_request_resume();
|
||||
return ce_dispatch_interrupt(tasklet_entry->ce_id, tasklet_entry);
|
||||
}
|
||||
|
||||
|
@@ -90,9 +90,6 @@ struct hif_ipci_softc {
|
||||
qdf_spinlock_t register_access_lock;
|
||||
qdf_spinlock_t irq_lock;
|
||||
bool grp_irqs_disabled;
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
struct hif_runtime_pm_ctx rpm_ctx;
|
||||
#endif
|
||||
|
||||
void (*hif_ipci_get_soc_info)(struct hif_ipci_softc *sc,
|
||||
struct device *dev);
|
||||
|
@@ -1080,7 +1080,7 @@ void hif_pci_enable_power_management(struct hif_softc *hif_sc,
|
||||
return;
|
||||
}
|
||||
|
||||
hif_pm_runtime_start(hif_sc);
|
||||
hif_rtpm_start(hif_sc);
|
||||
|
||||
if (!is_packet_log_enabled)
|
||||
hif_enable_power_gating(pci_ctx);
|
||||
@@ -1111,7 +1111,7 @@ void hif_pci_disable_power_management(struct hif_softc *hif_ctx)
|
||||
return;
|
||||
}
|
||||
|
||||
hif_pm_runtime_stop(hif_ctx);
|
||||
hif_rtpm_stop(hif_ctx);
|
||||
}
|
||||
|
||||
void hif_pci_display_stats(struct hif_softc *hif_ctx)
|
||||
@@ -1151,7 +1151,7 @@ QDF_STATUS hif_pci_open(struct hif_softc *hif_ctx, enum qdf_bus_type bus_type)
|
||||
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(hif_ctx);
|
||||
|
||||
hif_ctx->bus_type = bus_type;
|
||||
hif_pm_runtime_open(hif_ctx);
|
||||
hif_rtpm_open(hif_ctx);
|
||||
|
||||
qdf_spinlock_create(&sc->irq_lock);
|
||||
|
||||
@@ -1790,7 +1790,7 @@ timer_free:
|
||||
*/
|
||||
void hif_pci_close(struct hif_softc *hif_sc)
|
||||
{
|
||||
hif_pm_runtime_close(hif_sc);
|
||||
hif_rtpm_close(hif_sc);
|
||||
hif_ce_close(hif_sc);
|
||||
}
|
||||
|
||||
@@ -2234,40 +2234,6 @@ void hif_pci_disable_bus(struct hif_softc *scn)
|
||||
hif_info("X");
|
||||
}
|
||||
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
/**
|
||||
* hif_pci_get_rpm_ctx() - Map corresponding hif_runtime_pm_ctx
|
||||
* @scn: hif context
|
||||
*
|
||||
* This function will map and return the corresponding
|
||||
* hif_runtime_pm_ctx based on pcie interface.
|
||||
*
|
||||
* Return: struct hif_runtime_pm_ctx pointer
|
||||
*/
|
||||
struct hif_runtime_pm_ctx *hif_pci_get_rpm_ctx(struct hif_softc *scn)
|
||||
{
|
||||
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn);
|
||||
|
||||
return &sc->rpm_ctx;
|
||||
}
|
||||
|
||||
/**
|
||||
* hif_pci_get_dev() - Map corresponding device structure
|
||||
* @scn: hif context
|
||||
*
|
||||
* This function will map and return the corresponding
|
||||
* device structure based on pcie interface.
|
||||
*
|
||||
* Return: struct device pointer
|
||||
*/
|
||||
struct device *hif_pci_get_dev(struct hif_softc *scn)
|
||||
{
|
||||
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn);
|
||||
|
||||
return sc->dev;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define OL_ATH_PCI_PM_CONTROL 0x44
|
||||
|
||||
#ifdef CONFIG_PLD_PCIE_CNSS
|
||||
@@ -4010,7 +3976,7 @@ int hif_force_wake_request(struct hif_opaque_softc *hif_handle)
|
||||
struct hif_pci_softc *pci_scn = HIF_GET_PCI_SOFTC(scn);
|
||||
|
||||
/* Prevent runtime PM or trigger resume firstly */
|
||||
if (hif_pm_runtime_get_sync(hif_handle, RTPM_ID_HIF_FORCE_WAKE)) {
|
||||
if (hif_rtpm_get(HIF_RTPM_GET_SYNC, HIF_RTPM_ID_FORCE_WAKE)) {
|
||||
hif_err("runtime pm get failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -4082,7 +4048,7 @@ int hif_force_wake_release(struct hif_opaque_softc *hif_handle)
|
||||
HIF_STATS_INC(pci_scn, mhi_force_wake_release_success, 1);
|
||||
|
||||
/* Release runtime PM force wake */
|
||||
ret = hif_pm_runtime_put(hif_handle, RTPM_ID_HIF_FORCE_WAKE);
|
||||
ret = hif_rtpm_put(HIF_RTPM_PUT_ASYNC, HIF_RTPM_ID_FORCE_WAKE);
|
||||
if (ret) {
|
||||
hif_err("runtime pm put failure");
|
||||
return ret;
|
||||
|
@@ -140,9 +140,6 @@ struct hif_pci_softc {
|
||||
qdf_spinlock_t irq_lock;
|
||||
qdf_work_t reschedule_tasklet_work;
|
||||
uint32_t lcr_val;
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
struct hif_runtime_pm_ctx rpm_ctx;
|
||||
#endif
|
||||
int (*hif_enable_pci)(struct hif_pci_softc *sc, struct pci_dev *pdev,
|
||||
const struct pci_device_id *id);
|
||||
void (*hif_pci_deinit)(struct hif_pci_softc *sc);
|
||||
|
Reference in New Issue
Block a user