diff options
| author | wadesong <wadesong@codeaurora.org> | 2017-11-20 18:16:39 +0800 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-11-20 03:21:18 -0800 |
| commit | ce4fc3f3bd77a6ffbe569661c9b05be6188e2f86 (patch) | |
| tree | feda00370a89f1eaf5744f2d4398b9862722fb7b | |
| parent | b61f412e7216c549a998d273099ecbdec23889b8 (diff) | |
qcacmn: HIF fake apps suspend/resume function relocation
HIF fake apps suspend/resume functions are currently defined in a
PCI-E bus specific file, which will result in 'unknown symbols'
error when WLAN driver is built and loaded with SDIO bus type.
Move all the related functions to a bus type neutral place so
the feature can be enabled for both bus types.
Change-Id: I84391402388ec6c10fe46c39604e63ca663d3611
CRs-Fixed: 2146268
| -rw-r--r-- | hif/inc/hif.h | 14 | ||||
| -rw-r--r-- | hif/src/ce/ce_main.c | 10 | ||||
| -rw-r--r-- | hif/src/ce/ce_tasklet.c | 119 | ||||
| -rw-r--r-- | hif/src/hif_main.c | 111 | ||||
| -rw-r--r-- | hif/src/hif_main.h | 21 |
5 files changed, 143 insertions, 132 deletions
diff --git a/hif/inc/hif.h b/hif/inc/hif.h index b0c2fd385da3..a62db2bd76f8 100644 --- a/hif/inc/hif.h +++ b/hif/inc/hif.h @@ -750,12 +750,22 @@ void hif_set_bundle_mode(struct hif_opaque_softc *hif_ctx, bool enabled, int hif_bus_reset_resume(struct hif_opaque_softc *hif_ctx); void *hif_get_lro_info(int ctx_id, struct hif_opaque_softc *hif_hdl); -#ifdef WLAN_SUSPEND_RESUME_TEST + typedef void (*hif_fake_resume_callback)(uint32_t val); +#ifdef WLAN_SUSPEND_RESUME_TEST void hif_fake_apps_suspend(struct hif_opaque_softc *hif_ctx, hif_fake_resume_callback callback); void hif_fake_apps_resume(struct hif_opaque_softc *hif_ctx); -#endif +#else +static inline void hif_fake_apps_suspend(struct hif_opaque_softc *hif_ctx, + hif_fake_resume_callback callback) +{ +} + +static inline void hif_fake_apps_resume(struct hif_opaque_softc *hif_ctx) +{ +} +#endif /* End of WLAN_SUSPEND_RESUME_TEST */ #ifdef HIF_SDIO /** diff --git a/hif/src/ce/ce_main.c b/hif/src/ce/ce_main.c index e72a4547b614..29c5963f6d51 100644 --- a/hif/src/ce/ce_main.c +++ b/hif/src/ce/ce_main.c @@ -2363,16 +2363,6 @@ static inline void hif_post_static_buf_to_target(struct hif_softc *scn) } #endif -#ifdef WLAN_SUSPEND_RESUME_TEST -static void hif_fake_apps_init_ctx(struct hif_softc *scn) -{ - INIT_WORK(&scn->fake_apps_ctx.resume_work, - hif_fake_apps_resume_work); -} -#else -static inline void hif_fake_apps_init_ctx(struct hif_softc *scn) {} -#endif - /** * hif_config_ce() - configure copy engines * @scn: hif context diff --git a/hif/src/ce/ce_tasklet.c b/hif/src/ce/ce_tasklet.c index fd93f076436a..b0b38ac75229 100644 --- a/hif/src/ce/ce_tasklet.c +++ b/hif/src/ce/ce_tasklet.c @@ -266,125 +266,6 @@ int hif_drain_tasklets(struct hif_softc *scn) return 0; } -#ifdef WLAN_SUSPEND_RESUME_TEST -/** - * hif_fake_apps_resume_work() - Work handler for fake apps resume callback - * @work: The work struct being passed from the linux kernel - * - * Return: none - */ -void hif_fake_apps_resume_work(struct work_struct *work) -{ - struct fake_apps_context *ctx = - container_of(work, struct fake_apps_context, resume_work); - - QDF_BUG(ctx->resume_callback); - ctx->resume_callback(0); - ctx->resume_callback = NULL; -} - -/** - * hif_fake_apps_suspend(): Setup unit-test related suspend state. Call after - * a normal WoW suspend has been completed. - * @hif_ctx: The HIF context to operate on - * @callback: The function to call when fake apps resume is triggered - * - * Set the fake suspend flag such that hif knows that it will need - * to fake the apps resume process using hdd_trigger_fake_apps_resume - * - * Return: none - */ -void hif_fake_apps_suspend(struct hif_opaque_softc *hif_ctx, - hif_fake_resume_callback callback) -{ - struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); - - scn->fake_apps_ctx.resume_callback = callback; - set_bit(HIF_FA_SUSPENDED_BIT, &scn->fake_apps_ctx.state); -} - -/** - * hif_fake_apps_resume(): Cleanup unit-test related suspend state. Call before - * doing a normal WoW resume if suspend was initiated via fake apps - * suspend. - * @hif_ctx: The HIF context to operate on - * - * Return: none - */ -void hif_fake_apps_resume(struct hif_opaque_softc *hif_ctx) -{ - struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); - - clear_bit(HIF_FA_SUSPENDED_BIT, &scn->fake_apps_ctx.state); - scn->fake_apps_ctx.resume_callback = NULL; -} - -/** - * hif_interrupt_is_fake_apps_resume(): Determines if the raised irq should - * trigger a fake apps resume. - * @hif_ctx: The HIF context to operate on - * @ce_id: The copy engine Id from the originating interrupt - * - * Return: true if the raised irq should trigger a fake apps resume - */ -static bool hif_interrupt_is_fake_apps_resume(struct hif_opaque_softc *hif_ctx, - int ce_id) -{ - struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); - uint8_t ul_pipe, dl_pipe; - int ul_is_polled, dl_is_polled; - QDF_STATUS status; - - if (!test_bit(HIF_FA_SUSPENDED_BIT, &scn->fake_apps_ctx.state)) - return false; - - /* ensure passed ce_id matches wake irq */ - /* dl_pipe will be populated with the wake irq number */ - status = hif_map_service_to_pipe(hif_ctx, HTC_CTRL_RSVD_SVC, - &ul_pipe, &dl_pipe, - &ul_is_polled, &dl_is_polled); - - if (status) { - HIF_ERROR("%s: pipe_mapping failure", __func__); - return false; - } - - return ce_id == dl_pipe; -} - -/** - * hif_trigger_fake_apps_resume(): Trigger a fake apps resume by scheduling the - * previously registered callback for execution - * @hif_ctx: The HIF context to operate on - * - * Return: None - */ -static void hif_trigger_fake_apps_resume(struct hif_opaque_softc *hif_ctx) -{ - struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); - - if (!test_and_clear_bit(HIF_FA_SUSPENDED_BIT, - &scn->fake_apps_ctx.state)) - return; - - schedule_work(&scn->fake_apps_ctx.resume_work); -} - -#else - -static inline bool -hif_interrupt_is_fake_apps_resume(struct hif_opaque_softc *hif_ctx, int ce_id) -{ - return false; -} - -static inline void -hif_trigger_fake_apps_resume(struct hif_opaque_softc *hif_ctx) -{ -} - -#endif /* End of WLAN_SUSPEND_RESUME_TEST */ - /** * hif_snoc_interrupt_handler() - hif_snoc_interrupt_handler * @irq: irq coming from kernel diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c index ba553465c840..9d998b5b5b0c 100644 --- a/hif/src/hif_main.c +++ b/hif/src/hif_main.c @@ -1148,3 +1148,114 @@ void hif_set_ce_service_max_rx_ind_flush(struct hif_opaque_softc *hif, hif_ctx->ce_service_max_rx_ind_flush = ce_service_max_rx_ind_flush; } + +#ifdef WLAN_SUSPEND_RESUME_TEST +void hif_fake_apps_init_ctx(struct hif_softc *scn) +{ + INIT_WORK(&scn->fake_apps_ctx.resume_work, + hif_fake_apps_resume_work); +} + +/** + * hif_fake_apps_resume_work() - Work handler for fake apps resume callback + * @work: The work struct being passed from the linux kernel + * + * Return: none + */ +void hif_fake_apps_resume_work(struct work_struct *work) +{ + struct fake_apps_context *ctx = + container_of(work, struct fake_apps_context, resume_work); + + QDF_BUG(ctx->resume_callback); + ctx->resume_callback(0); + ctx->resume_callback = NULL; +} + +/** + * hif_fake_apps_suspend(): Setup unit-test related suspend state. Call after + * a normal WoW suspend has been completed. + * @hif_ctx: The HIF context to operate on + * @callback: The function to call when fake apps resume is triggered + * + * Set the fake suspend flag such that hif knows that it will need + * to fake the apps resume process using hdd_trigger_fake_apps_resume + * + * Return: none + */ +void hif_fake_apps_suspend(struct hif_opaque_softc *hif_ctx, + hif_fake_resume_callback callback) +{ + struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); + + scn->fake_apps_ctx.resume_callback = callback; + set_bit(HIF_FA_SUSPENDED_BIT, &scn->fake_apps_ctx.state); +} + +/** + * hif_fake_apps_resume(): Cleanup unit-test related suspend state. Call before + * doing a normal WoW resume if suspend was initiated via fake apps + * suspend. + * @hif_ctx: The HIF context to operate on + * + * Return: none + */ +void hif_fake_apps_resume(struct hif_opaque_softc *hif_ctx) +{ + struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); + + clear_bit(HIF_FA_SUSPENDED_BIT, &scn->fake_apps_ctx.state); + scn->fake_apps_ctx.resume_callback = NULL; +} + +/** + * hif_interrupt_is_fake_apps_resume(): Determines if the raised irq should + * trigger a fake apps resume. + * @hif_ctx: The HIF context to operate on + * @ce_id: The copy engine Id from the originating interrupt + * + * Return: true if the raised irq should trigger a fake apps resume + */ +bool hif_interrupt_is_fake_apps_resume(struct hif_opaque_softc *hif_ctx, + int ce_id) +{ + struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); + uint8_t ul_pipe, dl_pipe; + int ul_is_polled, dl_is_polled; + QDF_STATUS status; + + if (!test_bit(HIF_FA_SUSPENDED_BIT, &scn->fake_apps_ctx.state)) + return false; + + /* ensure passed ce_id matches wake irq */ + /* dl_pipe will be populated with the wake irq number */ + status = hif_map_service_to_pipe(hif_ctx, HTC_CTRL_RSVD_SVC, + &ul_pipe, &dl_pipe, + &ul_is_polled, &dl_is_polled); + + if (status) { + HIF_ERROR("%s: pipe_mapping failure", __func__); + return false; + } + + return ce_id == dl_pipe; +} + +/** + * hif_trigger_fake_apps_resume(): Trigger a fake apps resume by scheduling the + * previously registered callback for execution + * @hif_ctx: The HIF context to operate on + * + * Return: None + */ +void hif_trigger_fake_apps_resume(struct hif_opaque_softc *hif_ctx) +{ + struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); + + if (!test_and_clear_bit(HIF_FA_SUSPENDED_BIT, + &scn->fake_apps_ctx.state)) + return; + + schedule_work(&scn->fake_apps_ctx.resume_work); +} +#endif /* End of WLAN_SUSPEND_RESUME_TEST */ diff --git a/hif/src/hif_main.h b/hif/src/hif_main.h index a6cee3b0d166..9d286a27757b 100644 --- a/hif/src/hif_main.h +++ b/hif/src/hif_main.h @@ -116,8 +116,27 @@ enum hif_fake_apps_state_bits { HIF_FA_SUSPENDED_BIT = 0 }; +void hif_fake_apps_init_ctx(struct hif_softc *scn); void hif_fake_apps_resume_work(struct work_struct *work); -#endif /* WLAN_SUSPEND_RESUME_TEST */ +bool hif_interrupt_is_fake_apps_resume(struct hif_opaque_softc *hif_ctx, + int ce_id); +void hif_trigger_fake_apps_resume(struct hif_opaque_softc *hif_ctx); +#else +static inline void hif_fake_apps_init_ctx(struct hif_softc *scn) +{ +} + +static inline bool +hif_interrupt_is_fake_apps_resume(struct hif_opaque_softc *hif_ctx, int ce_id) +{ + return false; +} + +static inline void +hif_trigger_fake_apps_resume(struct hif_opaque_softc *hif_ctx) +{ +} +#endif /* End of WLAN_SUSPEND_RESUME_TEST */ struct hif_softc { struct hif_opaque_softc osc; |
