ath10k: pass cal data location as an argument to ath10k_download_cal_{file|dt}
Both ath10k_download_cal_file() and ath10k_download_cal_dt() uses hard coded file pointer (ar->cal_file) and device tree entry (qcom,ath10k-calibration-data) respectively to get calibration data content. There is a need to use those two functions in qca4019 calibration download sequence with different file pointer and device tree entry name. Modify those two functions to take cal data location as an argument. So that it can serve the purpose for other file pointer and device tree entry. This is just preparation before adding actual qca4019 calibration download sequence. No functional changes. Signed-off-by: Raja Mani <rmani@qti.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
parent
649a17659b
commit
7b7d0d6171
1 changed files with 11 additions and 13 deletions
|
@ -462,18 +462,18 @@ exit:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ath10k_download_cal_file(struct ath10k *ar)
|
static int ath10k_download_cal_file(struct ath10k *ar,
|
||||||
|
const struct firmware *file)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!ar->cal_file)
|
if (!file)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
if (IS_ERR(ar->cal_file))
|
if (IS_ERR(file))
|
||||||
return PTR_ERR(ar->cal_file);
|
return PTR_ERR(file);
|
||||||
|
|
||||||
ret = ath10k_download_board_data(ar, ar->cal_file->data,
|
ret = ath10k_download_board_data(ar, file->data, file->size);
|
||||||
ar->cal_file->size);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ath10k_err(ar, "failed to download cal_file data: %d\n", ret);
|
ath10k_err(ar, "failed to download cal_file data: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -484,7 +484,7 @@ static int ath10k_download_cal_file(struct ath10k *ar)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ath10k_download_cal_dt(struct ath10k *ar)
|
static int ath10k_download_cal_dt(struct ath10k *ar, const char *dt_name)
|
||||||
{
|
{
|
||||||
struct device_node *node;
|
struct device_node *node;
|
||||||
int data_len;
|
int data_len;
|
||||||
|
@ -498,8 +498,7 @@ static int ath10k_download_cal_dt(struct ath10k *ar)
|
||||||
*/
|
*/
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
if (!of_get_property(node, "qcom,ath10k-calibration-data",
|
if (!of_get_property(node, dt_name, &data_len)) {
|
||||||
&data_len)) {
|
|
||||||
/* The calibration data node is optional */
|
/* The calibration data node is optional */
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
@ -517,8 +516,7 @@ static int ath10k_download_cal_dt(struct ath10k *ar)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = of_property_read_u8_array(node, "qcom,ath10k-calibration-data",
|
ret = of_property_read_u8_array(node, dt_name, data, data_len);
|
||||||
data, data_len);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ath10k_warn(ar, "failed to read calibration data from DT: %d\n",
|
ath10k_warn(ar, "failed to read calibration data from DT: %d\n",
|
||||||
ret);
|
ret);
|
||||||
|
@ -1258,7 +1256,7 @@ static int ath10k_download_cal_data(struct ath10k *ar)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = ath10k_download_cal_file(ar);
|
ret = ath10k_download_cal_file(ar, ar->cal_file);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
ar->cal_mode = ATH10K_CAL_MODE_FILE;
|
ar->cal_mode = ATH10K_CAL_MODE_FILE;
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -1268,7 +1266,7 @@ static int ath10k_download_cal_data(struct ath10k *ar)
|
||||||
"boot did not find a calibration file, try DT next: %d\n",
|
"boot did not find a calibration file, try DT next: %d\n",
|
||||||
ret);
|
ret);
|
||||||
|
|
||||||
ret = ath10k_download_cal_dt(ar);
|
ret = ath10k_download_cal_dt(ar, "qcom,ath10k-calibration-data");
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
ar->cal_mode = ATH10K_CAL_MODE_DT;
|
ar->cal_mode = ATH10K_CAL_MODE_DT;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
Loading…
Add table
Reference in a new issue