mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 06:09:23 -04:00
icnss2: Add code to download BDF from device specific path
Add code to download bdf from device specific path, if the file is not present then it returns error. Change-Id: I6358be8a9e09c0caa5f4478d08f1959e0a0f1c44 Signed-off-by: Mohammed Siddiq <msiddiq@codeaurora.org>
This commit is contained in:
parent
f838988d41
commit
a1b300e054
3 changed files with 40 additions and 12 deletions
|
|
@ -3089,6 +3089,8 @@ static int icnss_msa_dt_parse(struct icnss_priv *priv)
|
|||
icnss_pr_dbg("MSA pa: %pa, MSA va: 0x%pK MSA Memory Size: 0x%x\n",
|
||||
&priv->msa_pa, (void *)priv->msa_va, priv->msa_mem_size);
|
||||
|
||||
priv->use_prefix_path = of_property_read_bool(priv->pdev->dev.of_node,
|
||||
"qcom,fw-prefix");
|
||||
return 0;
|
||||
|
||||
out:
|
||||
|
|
@ -3174,6 +3176,23 @@ int icnss_get_iova_ipa(struct icnss_priv *priv, u64 *addr, u64 *size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void icnss_add_fw_prefix_name(struct icnss_priv *priv, char *prefix_name,
|
||||
char *name)
|
||||
{
|
||||
if (!priv)
|
||||
return;
|
||||
|
||||
if (!priv->use_prefix_path) {
|
||||
scnprintf(prefix_name, ICNSS_MAX_FILE_NAME, "%s", name);
|
||||
return;
|
||||
}
|
||||
|
||||
scnprintf(prefix_name, ICNSS_MAX_FILE_NAME,
|
||||
QCA6750_PATH_PREFIX "%s", name);
|
||||
|
||||
icnss_pr_dbg("File added with prefix: %s\n", prefix_name);
|
||||
}
|
||||
|
||||
static const struct platform_device_id icnss_platform_id_table[] = {
|
||||
{ .name = "wcn6750", .driver_data = WCN6750_DEVICE_ID, },
|
||||
{ .name = "adrastea", .driver_data = ADRASTEA_DEVICE_ID, },
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
#define THERMAL_NAME_LENGTH 20
|
||||
#define ICNSS_SMEM_VALUE_MASK 0xFFFFFFFF
|
||||
#define ICNSS_SMEM_SEQ_NO_POS 16
|
||||
#define QCA6750_PATH_PREFIX "qca6750/"
|
||||
#define ICNSS_MAX_FILE_NAME 20
|
||||
|
||||
extern uint64_t dynamic_feature_mask;
|
||||
|
||||
|
|
@ -335,6 +337,7 @@ struct icnss_priv {
|
|||
u32 msi_base_data;
|
||||
struct icnss_control_params ctrl_params;
|
||||
u8 cal_done;
|
||||
u8 use_prefix_path;
|
||||
u32 ce_irqs[ICNSS_MAX_IRQ_REGISTRATIONS];
|
||||
u32 srng_irqs[IWCN_MAX_IRQ_REGISTRATIONS];
|
||||
phys_addr_t mem_base_pa;
|
||||
|
|
@ -447,5 +450,7 @@ int icnss_get_iova(struct icnss_priv *priv, u64 *addr, u64 *size);
|
|||
int icnss_get_iova_ipa(struct icnss_priv *priv, u64 *addr, u64 *size);
|
||||
int icnss_get_cpr_info(struct icnss_priv *priv);
|
||||
int icnss_update_cpr_info(struct icnss_priv *priv);
|
||||
void icnss_add_fw_prefix_name(struct icnss_priv *priv, char *prefix_name,
|
||||
char *name);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
#define WLFW_CLIENT_ID 0x4b4e454c
|
||||
#define QMI_ERR_PLAT_CCPM_CLK_INIT_FAILED 0x77
|
||||
|
||||
#define MAX_BDF_FILE_NAME 13
|
||||
#define BDF_FILE_NAME_PREFIX "bdwlan"
|
||||
#define ELF_BDF_FILE_NAME "bdwlan.elf"
|
||||
#define ELF_BDF_FILE_NAME_PREFIX "bdwlan.e"
|
||||
|
|
@ -712,42 +711,43 @@ static int icnss_get_bdf_file_name(struct icnss_priv *priv,
|
|||
u32 bdf_type, char *filename,
|
||||
u32 filename_len)
|
||||
{
|
||||
char filename_tmp[ICNSS_MAX_FILE_NAME];
|
||||
int ret = 0;
|
||||
|
||||
switch (bdf_type) {
|
||||
case ICNSS_BDF_ELF:
|
||||
if (priv->board_id == 0xFF)
|
||||
snprintf(filename, filename_len, ELF_BDF_FILE_NAME);
|
||||
snprintf(filename_tmp, filename_len, ELF_BDF_FILE_NAME);
|
||||
else if (priv->board_id < 0xFF)
|
||||
snprintf(filename, filename_len,
|
||||
snprintf(filename_tmp, filename_len,
|
||||
ELF_BDF_FILE_NAME_PREFIX "%02x",
|
||||
priv->board_id);
|
||||
else
|
||||
snprintf(filename, filename_len,
|
||||
snprintf(filename_tmp, filename_len,
|
||||
BDF_FILE_NAME_PREFIX "%02x.e%02x",
|
||||
priv->board_id >> 8 & 0xFF,
|
||||
priv->board_id & 0xFF);
|
||||
break;
|
||||
case ICNSS_BDF_BIN:
|
||||
if (priv->board_id == 0xFF)
|
||||
snprintf(filename, filename_len, BIN_BDF_FILE_NAME);
|
||||
snprintf(filename_tmp, filename_len, BIN_BDF_FILE_NAME);
|
||||
else if (priv->board_id < 0xFF)
|
||||
snprintf(filename, filename_len,
|
||||
snprintf(filename_tmp, filename_len,
|
||||
BIN_BDF_FILE_NAME_PREFIX "%02x",
|
||||
priv->board_id);
|
||||
else
|
||||
snprintf(filename, filename_len,
|
||||
snprintf(filename_tmp, filename_len,
|
||||
BDF_FILE_NAME_PREFIX "%02x.b%02x",
|
||||
priv->board_id >> 8 & 0xFF,
|
||||
priv->board_id & 0xFF);
|
||||
break;
|
||||
case ICNSS_BDF_REGDB:
|
||||
snprintf(filename, filename_len, REGDB_FILE_NAME);
|
||||
snprintf(filename_tmp, filename_len, REGDB_FILE_NAME);
|
||||
break;
|
||||
case ICNSS_BDF_DUMMY:
|
||||
icnss_pr_dbg("CNSS_BDF_DUMMY is set, sending dummy BDF\n");
|
||||
snprintf(filename, filename_len, DUMMY_BDF_FILE_NAME);
|
||||
ret = MAX_BDF_FILE_NAME;
|
||||
snprintf(filename_tmp, filename_len, DUMMY_BDF_FILE_NAME);
|
||||
ret = ICNSS_MAX_FILE_NAME;
|
||||
break;
|
||||
default:
|
||||
icnss_pr_err("Invalid BDF type: %d\n",
|
||||
|
|
@ -755,6 +755,10 @@ static int icnss_get_bdf_file_name(struct icnss_priv *priv,
|
|||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret >= 0)
|
||||
icnss_add_fw_prefix_name(priv, filename, filename_tmp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -763,7 +767,7 @@ int icnss_wlfw_bdf_dnld_send_sync(struct icnss_priv *priv, u32 bdf_type)
|
|||
struct wlfw_bdf_download_req_msg_v01 *req;
|
||||
struct wlfw_bdf_download_resp_msg_v01 *resp;
|
||||
struct qmi_txn txn;
|
||||
char filename[MAX_BDF_FILE_NAME];
|
||||
char filename[ICNSS_MAX_FILE_NAME];
|
||||
const struct firmware *fw_entry = NULL;
|
||||
const u8 *temp;
|
||||
unsigned int remaining;
|
||||
|
|
@ -786,7 +790,7 @@ int icnss_wlfw_bdf_dnld_send_sync(struct icnss_priv *priv, u32 bdf_type)
|
|||
filename, sizeof(filename));
|
||||
if (ret > 0) {
|
||||
temp = DUMMY_BDF_FILE_NAME;
|
||||
remaining = MAX_BDF_FILE_NAME;
|
||||
remaining = ICNSS_MAX_FILE_NAME;
|
||||
goto bypass_bdf;
|
||||
} else if (ret < 0) {
|
||||
goto err_req_fw;
|
||||
|
|
|
|||
Loading…
Reference in a new issue