From b34654bd5514a1708895e0fe8285947532652338 Mon Sep 17 00:00:00 2001 From: Mohit Khanna Date: Fri, 7 Feb 2020 11:38:27 -0800 Subject: [PATCH] qcacmn: Callback to get current bandwidth level Add HIF callbacks to get current bandwidth level from upper layers. Change-Id: I18524558296f4b7d684f18b0e6615b2a0516b6d2 CRs-Fixed: 2602029 --- hif/inc/hif.h | 3 ++- hif/src/hif_main.c | 13 +++++++++++++ hif/src/hif_main.h | 9 +++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/hif/inc/hif.h b/hif/inc/hif.h index 0d142b7420..e7f6d7425a 100644 --- a/hif/inc/hif.h +++ b/hif/inc/hif.h @@ -537,7 +537,7 @@ struct htc_callbacks { * @is_recovery_in_progress: Query if driver state is recovery in progress * @is_load_unload_in_progress: Query if driver state Load/Unload in Progress * @is_driver_unloading: Query if driver is unloading. - * + * @get_bandwidth_level: Query current bandwidth level for the driver * This Structure provides callback pointer for HIF to query hdd for driver * states. */ @@ -548,6 +548,7 @@ struct hif_driver_state_callbacks { bool (*is_load_unload_in_progress)(void *context); bool (*is_driver_unloading)(void *context); bool (*is_target_ready)(void *context); + int (*get_bandwidth_level)(void *context); }; /* This API detaches the HTC layer from the HIF device */ diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c index 62710bbcee..f324c6b3a4 100644 --- a/hif/src/hif_main.c +++ b/hif/src/hif_main.c @@ -1219,6 +1219,19 @@ bool hif_is_target_ready(struct hif_softc *scn) } qdf_export_symbol(hif_is_target_ready); +int hif_get_bandwidth_level(struct hif_opaque_softc *hif_handle) +{ + struct hif_softc *scn = HIF_GET_SOFTC(hif_handle); + struct hif_driver_state_callbacks *cbk = hif_get_callbacks_handle(scn); + + if (cbk && cbk->get_bandwidth_level) + return cbk->get_bandwidth_level(cbk->context); + + return 0; +} + +qdf_export_symbol(hif_get_bandwidth_level); + /** * hif_batch_send() - API to access hif specific function * ce_batch_send. diff --git a/hif/src/hif_main.h b/hif/src/hif_main.h index adf7c29682..13495824ec 100644 --- a/hif/src/hif_main.h +++ b/hif/src/hif_main.h @@ -324,6 +324,15 @@ bool hif_is_driver_unloading(struct hif_softc *scn); bool hif_is_load_or_unload_in_progress(struct hif_softc *scn); bool hif_is_recovery_in_progress(struct hif_softc *scn); bool hif_is_target_ready(struct hif_softc *scn); + +/** + * hif_get_bandwidth_level() - API to get the current bandwidth level + * @scn: HIF Context + * + * Return: PLD bandwidth level + */ +int hif_get_bandwidth_level(struct hif_opaque_softc *hif_handle); + void hif_wlan_disable(struct hif_softc *scn); int hif_target_sleep_state_adjust(struct hif_softc *scn, bool sleep_ok,