Skip to content

Commit 2bc2b87

Browse files
Abhishek KumarKalle Valo
authored andcommitted
ath10k: add option for chip-id based BDF selection
In some devices difference in chip-id should be enough to pick the right BDF. Add another support for chip-id based BDF selection. With this new option, ath10k supports 2 fallback options. The board name with chip-id as option looks as follows board name 'bus=snoc,qmi-board-id=ff,qmi-chip-id=320' Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.2.2-00696-QCAHLSWMTPL-1 Tested-on: QCA6174 HW3.2 WLAN.RM.4.4.1-00157-QCARMSWPZ-1 Signed-off-by: Abhishek Kumar <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Reviewed-by: Rakesh Pillai <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/20201207231824.v3.1.Ia6b95087ca566f77423f3802a78b946f7b593ff5@changeid
1 parent 8a71f34 commit 2bc2b87

File tree

1 file changed

+32
-11
lines changed
  • drivers/net/wireless/ath/ath10k

1 file changed

+32
-11
lines changed

drivers/net/wireless/ath/ath10k/core.c

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,8 @@ static int ath10k_core_search_bd(struct ath10k *ar,
13501350

13511351
static int ath10k_core_fetch_board_data_api_n(struct ath10k *ar,
13521352
const char *boardname,
1353-
const char *fallback_boardname,
1353+
const char *fallback_boardname1,
1354+
const char *fallback_boardname2,
13541355
const char *filename)
13551356
{
13561357
size_t len, magic_len;
@@ -1399,8 +1400,11 @@ static int ath10k_core_fetch_board_data_api_n(struct ath10k *ar,
13991400
ret = ath10k_core_search_bd(ar, boardname, data, len);
14001401

14011402
/* if we didn't find it and have a fallback name, try that */
1402-
if (ret == -ENOENT && fallback_boardname)
1403-
ret = ath10k_core_search_bd(ar, fallback_boardname, data, len);
1403+
if (ret == -ENOENT && fallback_boardname1)
1404+
ret = ath10k_core_search_bd(ar, fallback_boardname1, data, len);
1405+
1406+
if (ret == -ENOENT && fallback_boardname2)
1407+
ret = ath10k_core_search_bd(ar, fallback_boardname2, data, len);
14041408

14051409
if (ret == -ENOENT) {
14061410
ath10k_err(ar,
@@ -1420,7 +1424,8 @@ static int ath10k_core_fetch_board_data_api_n(struct ath10k *ar,
14201424
}
14211425

14221426
static int ath10k_core_create_board_name(struct ath10k *ar, char *name,
1423-
size_t name_len, bool with_variant)
1427+
size_t name_len, bool with_variant,
1428+
bool with_chip_id)
14241429
{
14251430
/* strlen(',variant=') + strlen(ar->id.bdf_ext) */
14261431
char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 };
@@ -1439,7 +1444,7 @@ static int ath10k_core_create_board_name(struct ath10k *ar, char *name,
14391444
}
14401445

14411446
if (ar->id.qmi_ids_valid) {
1442-
if (with_variant && ar->id.bdf_ext[0] != '\0')
1447+
if (with_chip_id)
14431448
scnprintf(name, name_len,
14441449
"bus=%s,qmi-board-id=%x,qmi-chip-id=%x%s",
14451450
ath10k_bus_str(ar->hif.bus),
@@ -1483,21 +1488,36 @@ static int ath10k_core_create_eboard_name(struct ath10k *ar, char *name,
14831488

14841489
int ath10k_core_fetch_board_file(struct ath10k *ar, int bd_ie_type)
14851490
{
1486-
char boardname[100], fallback_boardname[100];
1491+
char boardname[100], fallback_boardname1[100], fallback_boardname2[100];
14871492
int ret;
14881493

14891494
if (bd_ie_type == ATH10K_BD_IE_BOARD) {
1495+
/* With variant and chip id */
14901496
ret = ath10k_core_create_board_name(ar, boardname,
1491-
sizeof(boardname), true);
1497+
sizeof(boardname), true,
1498+
true);
14921499
if (ret) {
14931500
ath10k_err(ar, "failed to create board name: %d", ret);
14941501
return ret;
14951502
}
14961503

1497-
ret = ath10k_core_create_board_name(ar, fallback_boardname,
1498-
sizeof(boardname), false);
1504+
/* Without variant and only chip-id */
1505+
ret = ath10k_core_create_board_name(ar, fallback_boardname1,
1506+
sizeof(boardname), false,
1507+
true);
14991508
if (ret) {
1500-
ath10k_err(ar, "failed to create fallback board name: %d", ret);
1509+
ath10k_err(ar, "failed to create 1st fallback board name: %d",
1510+
ret);
1511+
return ret;
1512+
}
1513+
1514+
/* Without variant and without chip-id */
1515+
ret = ath10k_core_create_board_name(ar, fallback_boardname2,
1516+
sizeof(boardname), false,
1517+
false);
1518+
if (ret) {
1519+
ath10k_err(ar, "failed to create 2nd fallback board name: %d",
1520+
ret);
15011521
return ret;
15021522
}
15031523
} else if (bd_ie_type == ATH10K_BD_IE_BOARD_EXT) {
@@ -1511,7 +1531,8 @@ int ath10k_core_fetch_board_file(struct ath10k *ar, int bd_ie_type)
15111531

15121532
ar->bd_api = 2;
15131533
ret = ath10k_core_fetch_board_data_api_n(ar, boardname,
1514-
fallback_boardname,
1534+
fallback_boardname1,
1535+
fallback_boardname2,
15151536
ATH10K_BOARD_API2_FILE);
15161537
if (!ret)
15171538
goto success;

0 commit comments

Comments
 (0)