qcacmn: Remove cds_get_context in HIF
Refactor Transport Layer from cds_get_context and pass the hif context to all the API's to operate. Change-Id: I1dedda76357f844e08fd422bf9eb15af70587eae CRs-Fixed: 967765
This commit is contained in:
@@ -576,9 +576,9 @@ int hif_check_fw_reg(struct ol_softc *scn);
|
||||
int hif_check_soc_status(struct ol_softc *scn);
|
||||
void hif_disable_isr(void *scn);
|
||||
void hif_reset_soc(void *scn);
|
||||
void hif_disable_aspm(void);
|
||||
void hif_save_htc_htt_config_endpoint(int htc_endpoint);
|
||||
CDF_STATUS hif_open(enum ath_hal_bus_type bus_type);
|
||||
void hif_disable_aspm(void *);
|
||||
void hif_save_htc_htt_config_endpoint(void *hif_ctx, int htc_endpoint);
|
||||
CDF_STATUS hif_open(cdf_device_t cdf_ctx, enum ath_hal_bus_type bus_type);
|
||||
void hif_close(void *hif_ctx);
|
||||
CDF_STATUS hif_enable(void *hif_ctx, struct device *dev, void *bdev,
|
||||
const hif_bus_id *bid, enum ath_hal_bus_type bus_type,
|
||||
@@ -592,7 +592,7 @@ int hif_pm_runtime_get(void *hif_ctx);
|
||||
void hif_pm_runtime_get_noresume(void *hif_ctx);
|
||||
int hif_pm_runtime_put(void *hif_ctx);
|
||||
struct hif_pm_runtime_lock *hif_runtime_lock_init(const char *name);
|
||||
void hif_runtime_lock_deinit(struct hif_pm_runtime_lock *lock);
|
||||
void hif_runtime_lock_deinit(void *hif_ctx, struct hif_pm_runtime_lock *lock);
|
||||
int hif_pm_runtime_prevent_suspend(void *ol_sc,
|
||||
struct hif_pm_runtime_lock *lock);
|
||||
int hif_pm_runtime_allow_suspend(void *ol_sc,
|
||||
@@ -614,8 +614,8 @@ static inline int hif_pm_runtime_put(void *hif_ctx)
|
||||
static inline struct hif_pm_runtime_lock *hif_runtime_lock_init(
|
||||
const char *name)
|
||||
{ return NULL; }
|
||||
static inline void hif_runtime_lock_deinit(struct hif_pm_runtime_lock *lock)
|
||||
{}
|
||||
static inline void
|
||||
hif_runtime_lock_deinit(void *hif_ctx, struct hif_pm_runtime_lock *lock) {}
|
||||
|
||||
static inline int hif_pm_runtime_prevent_suspend(void *ol_sc,
|
||||
struct hif_pm_runtime_lock *lock)
|
||||
@@ -631,21 +631,21 @@ static inline int hif_pm_runtime_prevent_suspend_timeout(void *ol_sc,
|
||||
void hif_enable_power_management(void *hif_ctx);
|
||||
void hif_disable_power_management(void *hif_ctx);
|
||||
|
||||
void hif_vote_link_down(void);
|
||||
void hif_vote_link_up(void);
|
||||
bool hif_can_suspend_link(void);
|
||||
void hif_vote_link_down(void *);
|
||||
void hif_vote_link_up(void *);
|
||||
bool hif_can_suspend_link(void *);
|
||||
|
||||
int hif_bus_resume(void);
|
||||
int hif_bus_suspend(void);
|
||||
int hif_bus_resume(void *);
|
||||
int hif_bus_suspend(void *);
|
||||
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
int hif_pre_runtime_suspend(void);
|
||||
void hif_pre_runtime_resume(void);
|
||||
int hif_runtime_suspend(void);
|
||||
int hif_runtime_resume(void);
|
||||
void hif_process_runtime_suspend_success(void);
|
||||
void hif_process_runtime_suspend_failure(void);
|
||||
void hif_process_runtime_resume_success(void);
|
||||
int hif_pre_runtime_suspend(void *hif_ctx);
|
||||
void hif_pre_runtime_resume(void *hif_ctx);
|
||||
int hif_runtime_suspend(void *hif_ctx);
|
||||
int hif_runtime_resume(void *hif_ctx);
|
||||
void hif_process_runtime_suspend_success(void *);
|
||||
void hif_process_runtime_suspend_failure(void *);
|
||||
void hif_process_runtime_resume_success(void *);
|
||||
#endif
|
||||
|
||||
int hif_dump_registers(struct ol_softc *scn);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
||||
*
|
||||
@@ -94,7 +94,7 @@ void hif_napi_enable_irq(struct ol_softc *hif, int id);
|
||||
int hif_napi_schedule(struct ol_softc *scn, int ce_id);
|
||||
|
||||
/* called by hdd_napi, which is called by kernel */
|
||||
int hif_napi_poll(struct napi_struct *napi, int budget);
|
||||
int hif_napi_poll(void *hif_ctx, struct napi_struct *napi, int budget);
|
||||
|
||||
#ifdef FEATURE_NAPI_DEBUG
|
||||
#define NAPI_DEBUG(fmt, ...) \
|
||||
|
@@ -1848,7 +1848,7 @@ int hif_config_ce(hif_handle_t hif_hdl)
|
||||
scn->notice_send = true;
|
||||
|
||||
cdf_mem_zero(&soc_info, sizeof(soc_info));
|
||||
ret = icnss_get_soc_info(&soc_info);
|
||||
ret = icnss_get_soc_info(scn, &soc_info);
|
||||
if (ret < 0) {
|
||||
HIF_ERROR("%s: icnss_get_soc_info error = %d", __func__, ret);
|
||||
return CDF_STATUS_NOT_INITIALIZED;
|
||||
@@ -1957,7 +1957,7 @@ int hif_config_ce(hif_handle_t hif_hdl)
|
||||
if (rv != CDF_STATUS_SUCCESS)
|
||||
goto err;
|
||||
else
|
||||
init_tasklet_workers();
|
||||
init_tasklet_workers(scn);
|
||||
|
||||
HIF_TRACE("%s: X, ret = %d\n", __func__, rv);
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
||||
*
|
||||
@@ -71,15 +71,30 @@ static inline void ce_irq_status(struct ol_softc *scn,
|
||||
*host_status = hif_read32_mb(scn->mem + offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* struct tasklet_work
|
||||
*
|
||||
* @id: ce_id
|
||||
* @work: work
|
||||
*/
|
||||
struct tasklet_work {
|
||||
enum ce_id_type id;
|
||||
void *data;
|
||||
struct work_struct work;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* reschedule_ce_tasklet_work_handler() - reschedule work
|
||||
* @ce_id: ce_id
|
||||
* @work: struct work_struct
|
||||
*
|
||||
* Return: N/A
|
||||
*/
|
||||
static void reschedule_ce_tasklet_work_handler(int ce_id)
|
||||
static void reschedule_ce_tasklet_work_handler(struct work_struct *work)
|
||||
{
|
||||
struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
struct tasklet_work *ce_work = container_of(work, struct tasklet_work,
|
||||
work);
|
||||
struct ol_softc *scn = ce_work->data;
|
||||
struct HIF_CE_state *hif_ce_state;
|
||||
|
||||
if (NULL == scn) {
|
||||
@@ -92,38 +107,13 @@ static void reschedule_ce_tasklet_work_handler(int ce_id)
|
||||
HIF_ERROR("%s: wlan driver is unloaded", __func__);
|
||||
return;
|
||||
}
|
||||
tasklet_schedule(&hif_ce_state->tasklets[ce_id].intr_tq);
|
||||
tasklet_schedule(&hif_ce_state->tasklets[ce_work->id].intr_tq);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* struct tasklet_work
|
||||
*
|
||||
* @id: ce_id
|
||||
* @work: work
|
||||
*/
|
||||
struct tasklet_work {
|
||||
enum ce_id_type id;
|
||||
struct work_struct work;
|
||||
};
|
||||
|
||||
static struct tasklet_work tasklet_workers[CE_ID_MAX];
|
||||
static bool work_initialized;
|
||||
|
||||
/**
|
||||
* work_handler() - work_handler
|
||||
* @work: struct work_struct
|
||||
*
|
||||
* Return: N/A
|
||||
*/
|
||||
static void work_handler(struct work_struct *work)
|
||||
{
|
||||
struct tasklet_work *tmp;
|
||||
|
||||
tmp = container_of(work, struct tasklet_work, work);
|
||||
reschedule_ce_tasklet_work_handler(tmp->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* init_tasklet_work() - init_tasklet_work
|
||||
* @work: struct work_struct
|
||||
@@ -147,16 +137,19 @@ static void init_tasklet_work(struct work_struct *work,
|
||||
|
||||
/**
|
||||
* init_tasklet_workers() - init_tasklet_workers
|
||||
* @scn: HIF Context
|
||||
*
|
||||
* Return: N/A
|
||||
*/
|
||||
void init_tasklet_workers(void)
|
||||
void init_tasklet_workers(struct ol_softc *scn)
|
||||
{
|
||||
uint32_t id;
|
||||
|
||||
for (id = 0; id < CE_ID_MAX; id++) {
|
||||
tasklet_workers[id].id = id;
|
||||
init_tasklet_work(&tasklet_workers[id].work, work_handler);
|
||||
tasklet_workers[id].data = scn;
|
||||
init_tasklet_work(&tasklet_workers[id].work,
|
||||
reschedule_ce_tasklet_work_handler);
|
||||
}
|
||||
work_initialized = true;
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#ifndef __CE_TASKLET_H__
|
||||
#define __CE_TASKLET_H__
|
||||
#include "ce_main.h"
|
||||
void init_tasklet_workers(void);
|
||||
void init_tasklet_workers(struct ol_softc *scn);
|
||||
void ce_tasklet_init(struct HIF_CE_state *hif_ce_state, uint32_t mask);
|
||||
void ce_tasklet_kill(struct HIF_CE_state *hif_ce_state);
|
||||
CDF_STATUS ce_register_irq(struct HIF_CE_state *hif_ce_state, uint32_t mask);
|
||||
|
@@ -281,9 +281,9 @@ void *hif_get_targetdef(struct ol_softc *scn)
|
||||
*
|
||||
* Return: n/a
|
||||
*/
|
||||
void hif_vote_link_down(void)
|
||||
void hif_vote_link_down(void *hif_ctx)
|
||||
{
|
||||
struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
struct ol_softc *scn = hif_ctx;
|
||||
CDF_BUG(scn);
|
||||
|
||||
scn->linkstate_vote--;
|
||||
@@ -302,9 +302,9 @@ void hif_vote_link_down(void)
|
||||
*
|
||||
* Return: n/a
|
||||
*/
|
||||
void hif_vote_link_up(void)
|
||||
void hif_vote_link_up(void *hif_ctx)
|
||||
{
|
||||
struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
struct ol_softc *scn = hif_ctx;
|
||||
CDF_BUG(scn);
|
||||
|
||||
scn->linkstate_vote++;
|
||||
@@ -324,9 +324,9 @@ void hif_vote_link_up(void)
|
||||
*
|
||||
* Return: false if hif will guarantee link up durring suspend.
|
||||
*/
|
||||
bool hif_can_suspend_link(void)
|
||||
bool hif_can_suspend_link(void *hif_ctx)
|
||||
{
|
||||
struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
struct ol_softc *scn = hif_ctx;
|
||||
CDF_BUG(scn);
|
||||
|
||||
return scn->linkstate_vote == 0;
|
||||
@@ -405,19 +405,12 @@ cdf_size_t init_buffer_count(cdf_size_t maxSize)
|
||||
*/
|
||||
int hif_init_cdf_ctx(void *hif_ctx)
|
||||
{
|
||||
cdf_device_t cdf_ctx;
|
||||
struct ol_softc *scn = (struct ol_softc *)hif_ctx;
|
||||
|
||||
cdf_ctx = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
|
||||
if (!cdf_ctx) {
|
||||
HIF_ERROR("%s: CDF is NULL", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
cdf_device_t cdf_ctx = scn->cdf_dev;
|
||||
|
||||
cdf_ctx->drv = &scn->aps_osdev;
|
||||
cdf_ctx->drv_hdl = scn->aps_osdev.bdev;
|
||||
cdf_ctx->dev = scn->aps_osdev.device;
|
||||
scn->cdf_dev = cdf_ctx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -443,9 +436,9 @@ void hif_deinit_cdf_ctx(void *hif_ctx)
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void hif_save_htc_htt_config_endpoint(int htc_endpoint)
|
||||
void hif_save_htc_htt_config_endpoint(void *hif_ctx, int htc_endpoint)
|
||||
{
|
||||
struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
struct ol_softc *scn = hif_ctx;
|
||||
|
||||
if (!scn) {
|
||||
HIF_ERROR("%s: error: scn or scn->hif_sc is NULL!",
|
||||
@@ -498,7 +491,7 @@ void hif_get_hw_info(struct ol_softc *scn, u32 *version, u32 *revision,
|
||||
*
|
||||
* Return: scn
|
||||
*/
|
||||
CDF_STATUS hif_open(enum ath_hal_bus_type bus_type)
|
||||
CDF_STATUS hif_open(cdf_device_t cdf_ctx, enum ath_hal_bus_type bus_type)
|
||||
{
|
||||
struct ol_softc *scn;
|
||||
v_CONTEXT_t cds_context;
|
||||
@@ -514,6 +507,7 @@ CDF_STATUS hif_open(enum ath_hal_bus_type bus_type)
|
||||
}
|
||||
|
||||
cdf_mem_zero(scn, sizeof(*scn));
|
||||
scn->cdf_dev = cdf_ctx;
|
||||
cfg = hif_get_ini_handle(scn);
|
||||
cfg->max_no_of_peers = 1;
|
||||
cdf_atomic_init(&scn->wow_done);
|
||||
@@ -594,7 +588,7 @@ CDF_STATUS hif_enable(void *hif_ctx, struct device *dev,
|
||||
}
|
||||
|
||||
if (ADRASTEA_BU)
|
||||
hif_vote_link_up();
|
||||
hif_vote_link_up(hif_ctx);
|
||||
|
||||
if (hif_config_ce(scn)) {
|
||||
HIF_ERROR("%s: Target probe failed.", __func__);
|
||||
@@ -663,7 +657,7 @@ void hif_disable(void *hif_ctx, enum hif_disable_type type)
|
||||
hif_stop(scn);
|
||||
|
||||
if (ADRASTEA_BU)
|
||||
hif_vote_link_down();
|
||||
hif_vote_link_down(hif_ctx);
|
||||
|
||||
if (scn->aps_osdev.bdev)
|
||||
hif_disable_bus(scn->aps_osdev.bdev);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
||||
*
|
||||
@@ -398,7 +398,7 @@ int hif_napi_schedule(struct ol_softc *scn, int ce_id)
|
||||
* Returns:
|
||||
* int: the amount of work done in this poll ( <= budget)
|
||||
*/
|
||||
int hif_napi_poll(struct napi_struct *napi, int budget)
|
||||
int hif_napi_poll(void *hif_ctx, struct napi_struct *napi, int budget)
|
||||
{
|
||||
int rc = 0; /* default: no work done, also takes care of error */
|
||||
int normalized, bucket;
|
||||
@@ -413,7 +413,7 @@ int hif_napi_poll(struct napi_struct *napi, int budget)
|
||||
container_of(napi, struct qca_napi_info, napi);
|
||||
napi_info->stats[cpu].napi_polls++;
|
||||
|
||||
hif = (struct ol_softc *)cds_get_context(CDF_MODULE_ID_HIF);
|
||||
hif = hif_ctx;
|
||||
if (unlikely(NULL == hif))
|
||||
CDF_ASSERT(hif != NULL); /* emit a warning if hif NULL */
|
||||
else {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
||||
*
|
||||
@@ -331,14 +331,15 @@ void icnss_dispatch_ce_irq(struct ol_softc *scn)
|
||||
*
|
||||
* Return: 0 for success
|
||||
*/
|
||||
int icnss_get_soc_info(struct icnss_soc_info *info)
|
||||
int icnss_get_soc_info(void *hif_ctx, struct icnss_soc_info *info)
|
||||
{
|
||||
struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
struct ol_softc *scn = hif_ctx;
|
||||
|
||||
if (!scn) {
|
||||
HIF_ERROR("%s: SCN = NULL", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
info->v_addr = scn->mem;
|
||||
info->p_addr = scn->mem_pa;
|
||||
info->version = 0;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
||||
*
|
||||
@@ -128,7 +128,7 @@ int icnss_ce_request_irq(int ce_id,
|
||||
int icnss_ce_free_irq(int irq, void *context);
|
||||
void icnss_enable_irq(unsigned int ce_id);
|
||||
void icnss_disable_irq(unsigned int ce_id);
|
||||
int icnss_get_soc_info(struct icnss_soc_info *info);
|
||||
int icnss_get_soc_info(void *hif_ctx, struct icnss_soc_info *info);
|
||||
int icnss_get_ce_id(int irq);
|
||||
#endif /* _ICNSS_WLAN_H_ */
|
||||
#endif /* HIF_PCI */
|
||||
|
@@ -1765,9 +1765,8 @@ static inline int hif_drain_tasklets(struct ol_softc *scn)
|
||||
*
|
||||
* Return: 0 for success and non-zero for failure
|
||||
*/
|
||||
static int hif_bus_suspend_link_up(void)
|
||||
static int hif_bus_suspend_link_up(struct ol_softc *scn)
|
||||
{
|
||||
struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
struct pci_dev *pdev;
|
||||
int status;
|
||||
|
||||
@@ -1795,9 +1794,8 @@ static int hif_bus_suspend_link_up(void)
|
||||
*
|
||||
* Return: 0 for success and non-zero for failure
|
||||
*/
|
||||
static int hif_bus_resume_link_up(void)
|
||||
static int hif_bus_resume_link_up(struct ol_softc *scn)
|
||||
{
|
||||
struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
struct pci_dev *pdev;
|
||||
|
||||
if (!scn)
|
||||
@@ -1827,9 +1825,8 @@ static int hif_bus_resume_link_up(void)
|
||||
*
|
||||
* Return: 0 for success and non-zero for failure
|
||||
*/
|
||||
static int hif_bus_suspend_link_down(void)
|
||||
static int hif_bus_suspend_link_down(struct ol_softc *scn)
|
||||
{
|
||||
struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
struct pci_dev *pdev;
|
||||
struct HIF_CE_state *hif_state;
|
||||
int status = 0;
|
||||
@@ -1868,9 +1865,8 @@ static int hif_bus_suspend_link_down(void)
|
||||
*
|
||||
* Return: 0 for success and non-zero for failure
|
||||
*/
|
||||
static int hif_bus_resume_link_down(void)
|
||||
static int hif_bus_resume_link_down(struct ol_softc *scn)
|
||||
{
|
||||
struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
struct pci_dev *pdev;
|
||||
|
||||
if (!scn)
|
||||
@@ -1896,12 +1892,13 @@ static int hif_bus_resume_link_down(void)
|
||||
*
|
||||
* Return: 0 for success and non-zero error code for failure
|
||||
*/
|
||||
int hif_bus_suspend(void)
|
||||
int hif_bus_suspend(void *hif_ctx)
|
||||
{
|
||||
if (hif_can_suspend_link())
|
||||
return hif_bus_suspend_link_down();
|
||||
struct ol_softc *scn = hif_ctx;
|
||||
if (hif_can_suspend_link(scn))
|
||||
return hif_bus_suspend_link_down(scn);
|
||||
else
|
||||
return hif_bus_suspend_link_up();
|
||||
return hif_bus_suspend_link_up(scn);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1911,12 +1908,13 @@ int hif_bus_suspend(void)
|
||||
*
|
||||
* Return: 0 for success and non-zero error code for failure
|
||||
*/
|
||||
int hif_bus_resume(void)
|
||||
int hif_bus_resume(void *hif_ctx)
|
||||
{
|
||||
if (hif_can_suspend_link())
|
||||
return hif_bus_resume_link_down();
|
||||
struct ol_softc *scn = hif_ctx;
|
||||
if (hif_can_suspend_link(scn))
|
||||
return hif_bus_resume_link_down(scn);
|
||||
else
|
||||
return hif_bus_resume_link_up();
|
||||
return hif_bus_resume_link_up(scn);
|
||||
}
|
||||
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
@@ -1926,9 +1924,9 @@ int hif_bus_resume(void)
|
||||
*
|
||||
* indexes into the runtime pm state and sets it.
|
||||
*/
|
||||
static void __hif_runtime_pm_set_state(enum hif_pm_runtime_state state)
|
||||
static void __hif_runtime_pm_set_state(struct ol_softc *scn,
|
||||
enum hif_pm_runtime_state state)
|
||||
{
|
||||
struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
struct hif_pci_softc *sc;
|
||||
|
||||
if (NULL == scn) {
|
||||
@@ -1941,17 +1939,15 @@ static void __hif_runtime_pm_set_state(enum hif_pm_runtime_state state)
|
||||
cdf_atomic_set(&sc->pm_state, state);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
/**
|
||||
* hif_runtime_pm_set_state_inprogress(): adjust runtime pm state
|
||||
*
|
||||
* Notify hif that a runtime pm opperation has started
|
||||
*/
|
||||
static void hif_runtime_pm_set_state_inprogress(void)
|
||||
static void hif_runtime_pm_set_state_inprogress(struct ol_softc *scn)
|
||||
{
|
||||
__hif_runtime_pm_set_state(HIF_PM_RUNTIME_STATE_INPROGRESS);
|
||||
__hif_runtime_pm_set_state(scn, HIF_PM_RUNTIME_STATE_INPROGRESS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1959,9 +1955,9 @@ static void hif_runtime_pm_set_state_inprogress(void)
|
||||
*
|
||||
* Notify hif that a the runtime pm state should be on
|
||||
*/
|
||||
static void hif_runtime_pm_set_state_on(void)
|
||||
static void hif_runtime_pm_set_state_on(struct ol_softc *scn)
|
||||
{
|
||||
__hif_runtime_pm_set_state(HIF_PM_RUNTIME_STATE_ON);
|
||||
__hif_runtime_pm_set_state(scn, HIF_PM_RUNTIME_STATE_ON);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1969,14 +1965,14 @@ static void hif_runtime_pm_set_state_on(void)
|
||||
*
|
||||
* Notify hif that a runtime suspend attempt has been completed successfully
|
||||
*/
|
||||
static void hif_runtime_pm_set_state_suspended(void)
|
||||
static void hif_runtime_pm_set_state_suspended(struct ol_softc *scn)
|
||||
{
|
||||
__hif_runtime_pm_set_state(HIF_PM_RUNTIME_STATE_SUSPENDED);
|
||||
__hif_runtime_pm_set_state(scn, HIF_PM_RUNTIME_STATE_SUSPENDED);
|
||||
}
|
||||
|
||||
static inline struct hif_pci_softc *get_sc(void)
|
||||
static inline struct hif_pci_softc *get_sc(void *hif_ctx)
|
||||
{
|
||||
struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
struct ol_softc *scn = hif_ctx;
|
||||
|
||||
if (NULL == scn) {
|
||||
HIF_ERROR("%s: Could not disable ASPM scn is null",
|
||||
@@ -1990,9 +1986,9 @@ static inline struct hif_pci_softc *get_sc(void)
|
||||
/**
|
||||
* hif_log_runtime_suspend_success() - log a successful runtime suspend
|
||||
*/
|
||||
static void hif_log_runtime_suspend_success(void)
|
||||
static void hif_log_runtime_suspend_success(void *hif_ctx)
|
||||
{
|
||||
struct hif_pci_softc *sc = get_sc();
|
||||
struct hif_pci_softc *sc = get_sc(hif_ctx);
|
||||
if (sc == NULL)
|
||||
return;
|
||||
|
||||
@@ -2006,9 +2002,9 @@ static void hif_log_runtime_suspend_success(void)
|
||||
* log a failed runtime suspend
|
||||
* mark last busy to prevent immediate runtime suspend
|
||||
*/
|
||||
static void hif_log_runtime_suspend_failure(void)
|
||||
static void hif_log_runtime_suspend_failure(void *hif_ctx)
|
||||
{
|
||||
struct hif_pci_softc *sc = get_sc();
|
||||
struct hif_pci_softc *sc = get_sc(hif_ctx);
|
||||
if (sc == NULL)
|
||||
return;
|
||||
|
||||
@@ -2021,9 +2017,9 @@ static void hif_log_runtime_suspend_failure(void)
|
||||
* log a successfull runtime resume
|
||||
* mark last busy to prevent immediate runtime suspend
|
||||
*/
|
||||
static void hif_log_runtime_resume_success(void)
|
||||
static void hif_log_runtime_resume_success(void *hif_ctx)
|
||||
{
|
||||
struct hif_pci_softc *sc = get_sc();
|
||||
struct hif_pci_softc *sc = get_sc(hif_ctx);
|
||||
if (sc == NULL)
|
||||
return;
|
||||
|
||||
@@ -2037,9 +2033,9 @@ static void hif_log_runtime_resume_success(void)
|
||||
* mark last busy to delay a retry.
|
||||
* adjust the runtime_pm state.
|
||||
*/
|
||||
void hif_process_runtime_suspend_failure(void)
|
||||
void hif_process_runtime_suspend_failure(void *hif_ctx)
|
||||
{
|
||||
struct hif_pci_softc *sc = get_sc();
|
||||
struct hif_pci_softc *sc = get_sc(hif_ctx);
|
||||
|
||||
hif_log_runtime_suspend_failure();
|
||||
if (sc != NULL)
|
||||
@@ -2058,14 +2054,14 @@ void hif_process_runtime_suspend_failure(void)
|
||||
*
|
||||
* return -EINVAL if the bus won't go down. otherwise return 0
|
||||
*/
|
||||
int hif_pre_runtime_suspend(void)
|
||||
int hif_pre_runtime_suspend(void *hif_ctx)
|
||||
{
|
||||
if (!hif_can_suspend_link()) {
|
||||
if (!hif_can_suspend_link(hif_ctx)) {
|
||||
HIF_ERROR("Runtime PM not supported for link up suspend");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hif_runtime_pm_set_state_inprogress();
|
||||
hif_runtime_pm_set_state_inprogress(hif_ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2075,10 +2071,10 @@ int hif_pre_runtime_suspend(void)
|
||||
* Record the success.
|
||||
* adjust the runtime_pm state
|
||||
*/
|
||||
void hif_process_runtime_suspend_success(void)
|
||||
void hif_process_runtime_suspend_success(void *hif_ctx)
|
||||
{
|
||||
hif_runtime_pm_set_state_suspended();
|
||||
hif_log_runtime_suspend_success();
|
||||
hif_runtime_pm_set_state_suspended(hif_ctx);
|
||||
hif_log_runtime_suspend_success(hif_ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2086,9 +2082,9 @@ void hif_process_runtime_suspend_success(void)
|
||||
*
|
||||
* update the runtime pm state.
|
||||
*/
|
||||
void hif_pre_runtime_resume(void)
|
||||
void hif_pre_runtime_resume(void *hif_ctx)
|
||||
{
|
||||
hif_runtime_pm_set_state_inprogress();
|
||||
hif_runtime_pm_set_state_inprogress(hif_ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2097,9 +2093,9 @@ void hif_pre_runtime_resume(void)
|
||||
* record the success.
|
||||
* adjust the runtime_pm state
|
||||
*/
|
||||
void hif_process_runtime_resume_success(void)
|
||||
void hif_process_runtime_resume_success(void *hif_ctx)
|
||||
{
|
||||
struct hif_pci_softc *sc = get_sc();
|
||||
struct hif_pci_softc *sc = get_sc(hif_ctx);
|
||||
|
||||
hif_log_runtime_resume_success();
|
||||
if (sc != NULL)
|
||||
@@ -2113,9 +2109,9 @@ void hif_process_runtime_resume_success(void)
|
||||
*
|
||||
* Return: 0 for success and non-zero error code for failure
|
||||
*/
|
||||
int hif_runtime_suspend(void)
|
||||
int hif_runtime_suspend(void *hif_ctx)
|
||||
{
|
||||
return hif_bus_suspend();
|
||||
return hif_bus_suspend(hif_ctx);
|
||||
}
|
||||
|
||||
#ifdef WLAN_FEATURE_FASTPATH
|
||||
@@ -2126,10 +2122,9 @@ int hif_runtime_suspend(void)
|
||||
* since runtime pm may cause ce_send_fast to skip the register
|
||||
* write.
|
||||
*/
|
||||
static void hif_fastpath_resume(void)
|
||||
static void hif_fastpath_resume(void *hif_ctx)
|
||||
{
|
||||
struct ol_softc *scn =
|
||||
(struct ol_softc *)cds_get_context(CDF_MODULE_ID_HIF);
|
||||
struct ol_softc *scn = hif_ctx;
|
||||
struct CE_state *ce_state;
|
||||
|
||||
if (!scn)
|
||||
@@ -2149,7 +2144,7 @@ static void hif_fastpath_resume(void)
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void hif_fastpath_resume(void) {}
|
||||
static void hif_fastpath_resume(void *hif_ctx) {}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2158,11 +2153,11 @@ static void hif_fastpath_resume(void) {}
|
||||
*
|
||||
* Return: 0 for success and non-zero error code for failure
|
||||
*/
|
||||
int hif_runtime_resume(void)
|
||||
int hif_runtime_resume(void *hif_ctx)
|
||||
{
|
||||
int status = hif_bus_resume();
|
||||
int status = hif_bus_resume(hif_ctx);
|
||||
|
||||
hif_fastpath_resume();
|
||||
hif_fastpath_resume(hif_ctx);
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -2219,9 +2214,9 @@ void hif_reset_soc(void *ol_sc)
|
||||
#endif
|
||||
}
|
||||
|
||||
void hif_disable_aspm(void)
|
||||
void hif_disable_aspm(void *hif_ctx)
|
||||
{
|
||||
struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
struct ol_softc *scn = hif_ctx;
|
||||
struct hif_pci_softc *sc;
|
||||
|
||||
if (NULL == scn) {
|
||||
@@ -2730,7 +2725,6 @@ CDF_STATUS hif_enable_bus(struct ol_softc *ol_sc,
|
||||
HIF_TRACE("%s: con_mode = 0x%x, device_id = 0x%x",
|
||||
__func__, cds_get_conparam(), id->device);
|
||||
|
||||
ol_sc = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
if (!ol_sc) {
|
||||
HIF_ERROR("%s: hif_ctx is NULL", __func__);
|
||||
return CDF_STATUS_E_NOMEM;
|
||||
@@ -3299,11 +3293,11 @@ struct hif_pm_runtime_lock *hif_runtime_lock_init(const char *name)
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void hif_runtime_lock_deinit(struct hif_pm_runtime_lock *data)
|
||||
void hif_runtime_lock_deinit(void *hif_ctx, struct hif_pm_runtime_lock *data)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct hif_pm_runtime_lock *context = data;
|
||||
struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
|
||||
struct ol_softc *scn = hif_ctx;
|
||||
struct hif_pci_softc *sc;
|
||||
|
||||
if (!scn)
|
||||
|
@@ -142,7 +142,7 @@ int hif_dump_registers(struct ol_softc *scn)
|
||||
*
|
||||
* Return: 0 for success and non-zero for failure
|
||||
*/
|
||||
int hif_bus_suspend(void)
|
||||
int hif_bus_suspend(void *hif_ctx)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ int hif_bus_suspend(void)
|
||||
*
|
||||
* Return: 0 for success and non-zero for failure
|
||||
*/
|
||||
int hif_bus_resume(void)
|
||||
int hif_bus_resume(void *hif_ctx)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ void hif_enable_power_gating(void *hif_ctx)
|
||||
*
|
||||
* Return: n/a
|
||||
*/
|
||||
void hif_disable_aspm(void)
|
||||
void hif_disable_aspm(void *hif_ctx)
|
||||
{
|
||||
}
|
||||
|
||||
|
54
htc/htc.c
54
htc/htc.c
@@ -879,3 +879,57 @@ void htc_ipa_get_ce_resource(HTC_HANDLE htc_handle,
|
||||
}
|
||||
}
|
||||
#endif /* IPA_OFFLOAD */
|
||||
|
||||
/**
|
||||
* htc_vote_link_down - API to vote for link down
|
||||
* @htc_handle: HTC handle
|
||||
*
|
||||
* API for upper layers to call HIF to vote for link down
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void htc_vote_link_down(HTC_HANDLE htc_handle)
|
||||
{
|
||||
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(htc_handle);
|
||||
|
||||
if (!target->hif_dev)
|
||||
return;
|
||||
|
||||
hif_vote_link_down(target->hif_dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* htc_vote_link_up - API to vote for link up
|
||||
* @htc_handle: HTC Handle
|
||||
*
|
||||
* API for upper layers to call HIF to vote for link up
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void htc_vote_link_up(HTC_HANDLE htc_handle)
|
||||
{
|
||||
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(htc_handle);
|
||||
|
||||
if (!target->hif_dev)
|
||||
return;
|
||||
|
||||
hif_vote_link_up(target->hif_dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* htc_can_suspend_link - API to query HIF for link status
|
||||
* @htc_handle: HTC Handle
|
||||
*
|
||||
* API for upper layers to call HIF to query if the link can suspend
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
bool htc_can_suspend_link(HTC_HANDLE htc_handle)
|
||||
{
|
||||
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(htc_handle);
|
||||
|
||||
if (!target->hif_dev)
|
||||
return false;
|
||||
|
||||
return hif_can_suspend_link(target->hif_dev);
|
||||
}
|
||||
|
@@ -702,8 +702,10 @@ int htc_runtime_suspend(void);
|
||||
int htc_runtime_resume(void);
|
||||
|
||||
/* Disable ASPM : Disable PCIe low power */
|
||||
void htc_disable_aspm(void);
|
||||
|
||||
void htc_disable_aspm(HTC_HANDLE HTCHandle);
|
||||
bool htc_can_suspend_link(HTC_HANDLE HTCHandle);
|
||||
void htc_vote_link_down(HTC_HANDLE HTCHandle);
|
||||
void htc_vote_link_up(HTC_HANDLE HTCHandle);
|
||||
#ifdef IPA_OFFLOAD
|
||||
void htc_ipa_get_ce_resource(HTC_HANDLE htc_handle,
|
||||
cdf_dma_addr_t *ce_sr_base_paddr,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
||||
*
|
||||
@@ -36,6 +36,24 @@ unsigned int htc_credit_flow = 1;
|
||||
#define DEBUG_CREDIT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* htc_update_htc_htt_config - API to update HIF with the HTT endpoint info
|
||||
* @target: HTC handle
|
||||
* @endpoint: Endpoint on which HTT messages flow
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
#ifdef HIF_PCI
|
||||
void htc_update_htc_htt_config(HTC_TARGET *target, int endpoint)
|
||||
{
|
||||
hif_save_htc_htt_config_endpoint(target->hif_dev, endpoint);
|
||||
}
|
||||
#else
|
||||
void htc_update_htc_htt_config(HTC_TARGET *target, int endpoint)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
|
||||
HTC_SERVICE_CONNECT_REQ *pConnectReq,
|
||||
HTC_SERVICE_CONNECT_RESP *pConnectResp)
|
||||
@@ -335,7 +353,10 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
|
||||
|
||||
} while (false);
|
||||
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-htc_connect_service \n"));
|
||||
if (HTT_SERVICE_GROUP == (pConnectReq->service_id >> 8))
|
||||
htc_update_htc_htt_config(target, assignedEndpoint);
|
||||
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-htc_connect_service\n"));
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -363,7 +384,12 @@ void htc_fw_event_handler(void *context, CDF_STATUS status)
|
||||
}
|
||||
|
||||
/* Disable ASPM : disable PCIe low power */
|
||||
void htc_disable_aspm(void)
|
||||
void htc_disable_aspm(HTC_HANDLE HTCHandle)
|
||||
{
|
||||
hif_disable_aspm();
|
||||
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
|
||||
|
||||
if (!target->hif_dev)
|
||||
return;
|
||||
|
||||
hif_disable_aspm(target->hif_dev);
|
||||
}
|
||||
|
Reference in New Issue
Block a user