mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 06:09:23 -04:00
qcacld-3.0: Make cdf_device_t as global device structure
aps_osdev/NIC_DEV is not needed in cld driver. Remove it's reference in BMI and pktlog code. Use global cdf_device context for memory allocations in BMI and pktlog files. Initialize cdf_device global structure in HDD. Change-Id: Idf257e196f86b8f0aae669ce05950a1212e5fd99 CRs-Fixed: 967765
This commit is contained in:
parent
04d3d6a364
commit
48152e1a16
7 changed files with 63 additions and 17 deletions
|
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
#include "i_bmi.h"
|
||||
#include "cds_api.h"
|
||||
|
||||
/* APIs visible to the driver */
|
||||
|
||||
|
|
@ -58,6 +59,7 @@ bmi_command_test(uint32_t command, uint32_t address, uint8_t *data,
|
|||
CDF_STATUS bmi_init(struct ol_softc *scn)
|
||||
{
|
||||
struct bmi_info *info;
|
||||
cdf_device_t cdf_dev = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
|
||||
|
||||
if (!scn) {
|
||||
BMI_ERR("Invalid scn Context");
|
||||
|
|
@ -65,12 +67,18 @@ CDF_STATUS bmi_init(struct ol_softc *scn)
|
|||
return CDF_STATUS_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
if (!cdf_dev->dev) {
|
||||
BMI_ERR("%s: Invalid Device Pointer", __func__);
|
||||
return CDF_STATUS_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
info = hif_get_bmi_ctx(scn);
|
||||
info->bmi_done = false;
|
||||
|
||||
if (!info->bmi_cmd_buff) {
|
||||
info->bmi_cmd_buff = cdf_os_mem_alloc_consistent(scn->cdf_dev,
|
||||
MAX_BMI_CMDBUF_SZ, &info->bmi_cmd_da, 0);
|
||||
info->bmi_cmd_buff =
|
||||
cdf_os_mem_alloc_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
&info->bmi_cmd_da, 0);
|
||||
if (!info->bmi_cmd_buff) {
|
||||
BMI_ERR("No Memory for BMI Command");
|
||||
return CDF_STATUS_E_NOMEM;
|
||||
|
|
@ -78,8 +86,9 @@ CDF_STATUS bmi_init(struct ol_softc *scn)
|
|||
}
|
||||
|
||||
if (!info->bmi_rsp_buff) {
|
||||
info->bmi_rsp_buff = cdf_os_mem_alloc_consistent(scn->cdf_dev,
|
||||
MAX_BMI_CMDBUF_SZ, &info->bmi_rsp_da, 0);
|
||||
info->bmi_rsp_buff =
|
||||
cdf_os_mem_alloc_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
&info->bmi_rsp_da, 0);
|
||||
if (!info->bmi_rsp_buff) {
|
||||
BMI_ERR("No Memory for BMI Response");
|
||||
goto end;
|
||||
|
|
@ -87,7 +96,7 @@ CDF_STATUS bmi_init(struct ol_softc *scn)
|
|||
}
|
||||
return CDF_STATUS_SUCCESS;
|
||||
end:
|
||||
cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
cdf_os_mem_free_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
info->bmi_cmd_buff, info->bmi_cmd_da, 0);
|
||||
info->bmi_cmd_buff = NULL;
|
||||
return CDF_STATUS_E_NOMEM;
|
||||
|
|
@ -96,16 +105,22 @@ end:
|
|||
void bmi_cleanup(struct ol_softc *scn)
|
||||
{
|
||||
struct bmi_info *info = hif_get_bmi_ctx(scn);
|
||||
cdf_device_t cdf_dev = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
|
||||
|
||||
if (!cdf_dev->dev) {
|
||||
BMI_ERR("%s: Invalid Device Pointer", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (info->bmi_cmd_buff) {
|
||||
cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
cdf_os_mem_free_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
info->bmi_cmd_buff, info->bmi_cmd_da, 0);
|
||||
info->bmi_cmd_buff = NULL;
|
||||
info->bmi_cmd_da = 0;
|
||||
}
|
||||
|
||||
if (info->bmi_rsp_buff) {
|
||||
cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
cdf_os_mem_free_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
info->bmi_rsp_buff, info->bmi_rsp_da, 0);
|
||||
info->bmi_rsp_buff = NULL;
|
||||
info->bmi_rsp_da = 0;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
#include "i_bmi.h"
|
||||
#include "cds_api.h"
|
||||
|
||||
/* APIs visible to the driver */
|
||||
|
||||
|
|
@ -276,6 +277,7 @@ CDF_STATUS bmi_done_local(struct ol_softc *scn)
|
|||
int status;
|
||||
uint32_t cid;
|
||||
struct bmi_info *info;
|
||||
cdf_device_t cdf_dev = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
|
||||
|
||||
if (!scn) {
|
||||
BMI_ERR("Invalid scn context");
|
||||
|
|
@ -283,6 +285,11 @@ CDF_STATUS bmi_done_local(struct ol_softc *scn)
|
|||
return CDF_STATUS_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
if (!cdf_dev->dev) {
|
||||
BMI_ERR("%s: Invalid device pointer", __func__);
|
||||
return CDF_STATUS_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
info = hif_get_bmi_ctx(scn);
|
||||
if (info->bmi_done) {
|
||||
BMI_DBG("bmi_done_local skipped");
|
||||
|
|
@ -310,14 +317,14 @@ CDF_STATUS bmi_done_local(struct ol_softc *scn)
|
|||
}
|
||||
|
||||
if (info->bmi_cmd_buff) {
|
||||
cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
cdf_os_mem_free_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
info->bmi_cmd_buff, info->bmi_cmd_da, 0);
|
||||
info->bmi_cmd_buff = NULL;
|
||||
info->bmi_cmd_da = 0;
|
||||
}
|
||||
|
||||
if (info->bmi_rsp_buff) {
|
||||
cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
cdf_os_mem_free_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
info->bmi_rsp_buff, info->bmi_rsp_da, 0);
|
||||
info->bmi_rsp_buff = NULL;
|
||||
info->bmi_rsp_da = 0;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
* to the Linux Foundation.
|
||||
*/
|
||||
#include "i_bmi.h"
|
||||
#include "cds_api.h"
|
||||
/* This need to defined in firmware interface files.
|
||||
* Defining here to address compilation issues.
|
||||
* Will be deleted once firmware interface files for
|
||||
|
|
@ -83,6 +84,7 @@ bmi_done_local(struct ol_softc *scn)
|
|||
struct bmi_info *info = hif_get_bmi_ctx(scn);
|
||||
uint8_t *bmi_cmd_buff = info->bmi_cmd_buff;
|
||||
uint8_t *bmi_rsp_buff = info->bmi_rsp_buff;
|
||||
cdf_device_t cdf_dev = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
|
||||
|
||||
if (info->bmi_done) {
|
||||
BMI_ERR("Command disallowed");
|
||||
|
|
@ -93,6 +95,12 @@ bmi_done_local(struct ol_softc *scn)
|
|||
BMI_ERR("No Memory Allocated for BMI CMD/RSP Buffer");
|
||||
return CDF_STATUS_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
if (!cdf_dev->dev) {
|
||||
BMI_ERR("%s Invalid Device pointer", __func__);
|
||||
return CDF_STATUS_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
cid = BMI_DONE;
|
||||
|
||||
cdf_mem_copy(bmi_cmd_buff, &cid, sizeof(cid));
|
||||
|
|
@ -113,14 +121,14 @@ bmi_done_local(struct ol_softc *scn)
|
|||
}
|
||||
|
||||
if (info->bmi_cmd_buff) {
|
||||
cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
cdf_os_mem_free_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
info->bmi_cmd_buff, info->bmi_cmd_da, 0);
|
||||
info->bmi_cmd_buff = NULL;
|
||||
info->bmi_cmd_da = 0;
|
||||
}
|
||||
|
||||
if (info->bmi_rsp_buff) {
|
||||
cdf_os_mem_free_consistent(scn->cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
cdf_os_mem_free_consistent(cdf_dev, MAX_BMI_CMDBUF_SZ,
|
||||
info->bmi_rsp_buff, info->bmi_rsp_da, 0);
|
||||
info->bmi_rsp_buff = NULL;
|
||||
info->bmi_rsp_da = 0;
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ static int __ol_transfer_bin_file(struct ol_softc *scn, ATH_BIN_FILE file,
|
|||
struct hif_target_info *tgt_info = hif_get_target_info_handle(scn);
|
||||
uint32_t target_type = tgt_info->target_type;
|
||||
struct bmi_info *bmi_ctx = hif_get_bmi_ctx(scn);
|
||||
cdf_device_t cdf_dev = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
|
||||
|
||||
switch (file) {
|
||||
default:
|
||||
|
|
@ -248,7 +249,7 @@ static int __ol_transfer_bin_file(struct ol_softc *scn, ATH_BIN_FILE file,
|
|||
break;
|
||||
}
|
||||
|
||||
if (request_firmware(&fw_entry, filename, scn->aps_osdev.device) != 0) {
|
||||
if (request_firmware(&fw_entry, filename, cdf_dev->dev) != 0) {
|
||||
BMI_ERR("%s: Failed to get %s", __func__, filename);
|
||||
|
||||
if (file == ATH_OTP_FILE)
|
||||
|
|
@ -262,7 +263,7 @@ static int __ol_transfer_bin_file(struct ol_softc *scn, ATH_BIN_FILE file,
|
|||
BMI_INFO("%s: Trying to load default %s",
|
||||
__func__, filename);
|
||||
if (request_firmware(&fw_entry, filename,
|
||||
scn->aps_osdev.device) != 0) {
|
||||
cdf_dev->dev) != 0) {
|
||||
BMI_ERR("%s: Failed to get %s",
|
||||
__func__, filename);
|
||||
return -1;
|
||||
|
|
@ -488,8 +489,8 @@ static struct ol_softc *ramdump_scn;
|
|||
* Ramdump information.
|
||||
*/
|
||||
struct ramdump_info {
|
||||
void *base;
|
||||
unsigned long size;
|
||||
void *base;
|
||||
unsigned long size;
|
||||
};
|
||||
|
||||
#if defined(CONFIG_CNSS) && !defined(QCA_WIFI_3_0)
|
||||
|
|
|
|||
|
|
@ -185,6 +185,21 @@ static void hdd_hif_close(void *hif_ctx)
|
|||
hif_close(hif_ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_init_cdf_ctx() - API to initialize global CDF Device structure
|
||||
* @dev: Device Pointer
|
||||
* @bdev: Bus Device pointer
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void hdd_init_cdf_ctx(struct device *dev, void *bdev)
|
||||
{
|
||||
cdf_device_t cdf_dev = cds_get_context(CDF_MODULE_ID_CDF_DEVICE);
|
||||
|
||||
cdf_dev->dev = dev;
|
||||
cdf_dev->drv_hdl = bdev;
|
||||
}
|
||||
|
||||
/**
|
||||
* wlan_hdd_probe() - handles probe request
|
||||
*
|
||||
|
|
@ -234,6 +249,8 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
|
|||
goto err_hdd_deinit;
|
||||
}
|
||||
|
||||
hdd_init_cdf_ctx(dev, bdev);
|
||||
|
||||
ret = hdd_hif_open(dev, bdev, bid, bus_type, reinit);
|
||||
|
||||
if (ret)
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ struct ol_pktlog_dev_t {
|
|||
ol_ath_generic_softc_handle scn;
|
||||
char *name;
|
||||
bool tgt_pktlog_enabled;
|
||||
osdev_t sc_osdev;
|
||||
};
|
||||
|
||||
#define PKTLOG_SYSCTL_SIZE 14
|
||||
|
|
|
|||
|
|
@ -353,7 +353,6 @@ int pktlog_enable(struct ol_softc *scn, int32_t log_state)
|
|||
}
|
||||
|
||||
pl_info = pl_dev->pl_info;
|
||||
pl_dev->sc_osdev = &scn->aps_osdev;
|
||||
|
||||
if (!pl_info)
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue