diff mbox series

wifi: ath10k: Default to board.bin for legacy board data file

Message ID 20230825202610.1580132-1-dmitry.baryshkov@linaro.org
State New
Headers show
Series wifi: ath10k: Default to board.bin for legacy board data file | expand

Commit Message

Dmitry Baryshkov Aug. 25, 2023, 8:26 p.m. UTC
Default to 'board.bin' for the legacy board data file, in case the
hw_params array doesn't list hw-specific board data file name (e.g. for
WCN3990).

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/net/wireless/ath/ath10k/core.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Kalle Valo Aug. 26, 2023, 5:44 a.m. UTC | #1
Dmitry Baryshkov <dmitry.baryshkov@linaro.org> writes:

> Default to 'board.bin' for the legacy board data file, in case the
> hw_params array doesn't list hw-specific board data file name (e.g. for
> WCN3990).
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Could you provide more background _why_ this is needed. What are you
trying to fix?
Dmitry Baryshkov Aug. 26, 2023, 1:56 p.m. UTC | #2
On Sat, 26 Aug 2023 at 08:44, Kalle Valo <kvalo@kernel.org> wrote:
>
> Dmitry Baryshkov <dmitry.baryshkov@linaro.org> writes:
>
> > Default to 'board.bin' for the legacy board data file, in case the
> > hw_params array doesn't list hw-specific board data file name (e.g. for
> > WCN3990).
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>
> Could you provide more background _why_ this is needed. What are you
> trying to fix?

Sure. For wcn3990 we do not have the
`ath10k_hw_params_list[].fw.board' set. So if the board data is not
present in `board-2.bin', the driver will skip looking into
`board.bin' and will error out.

I had two options: either to set the `.fw.board' in
`ath10k_hw_params_list', or to provide this default. Granted that the
check for `fw.board' also prevents the `board-%s-%s.bin' lookup, I
opted for the second option.

Maybe I should just set the .fw.board to "board.bin" and
.fw.board_size to 26328 (?)
Kalle Valo Dec. 4, 2023, 12:16 p.m. UTC | #3
Dmitry Baryshkov <dmitry.baryshkov@linaro.org> writes:

> On Sat, 26 Aug 2023 at 08:44, Kalle Valo <kvalo@kernel.org> wrote:
>>
>> Dmitry Baryshkov <dmitry.baryshkov@linaro.org> writes:
>>
>> > Default to 'board.bin' for the legacy board data file, in case the
>> > hw_params array doesn't list hw-specific board data file name (e.g. for
>> > WCN3990).
>> >
>> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>
>> Could you provide more background _why_ this is needed. What are you
>> trying to fix?
>
> Sure. For wcn3990 we do not have the
> `ath10k_hw_params_list[].fw.board' set. So if the board data is not
> present in `board-2.bin', the driver will skip looking into
> `board.bin' and will error out.
>
> I had two options: either to set the `.fw.board' in
> `ath10k_hw_params_list', or to provide this default. Granted that the
> check for `fw.board' also prevents the `board-%s-%s.bin' lookup, I
> opted for the second option.

Ah, now I understand.

> Maybe I should just set the .fw.board to "board.bin" and
> .fw.board_size to 26328 (?)

Yeah, I think that would be much better to set those fields for WCN3990.
Please also include to the commit message the description you wrote
above.

I can't remember anymore why even have this struct
ath10k_hw_params_fw::board field in the first, most likely due to some
legacy reasons before we had board-2.bin. I suspect all the fields even
contain the same "board.bin" string so in theory the field is not really
needed.
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 6cdb225b7eac..806e5968e0ef 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1271,11 +1271,6 @@  static int ath10k_core_fetch_board_data_api_1(struct ath10k *ar, int bd_ie_type)
 	char boardname[100];
 
 	if (bd_ie_type == ATH10K_BD_IE_BOARD) {
-		if (!ar->hw_params.fw.board) {
-			ath10k_err(ar, "failed to find board file fw entry\n");
-			return -EINVAL;
-		}
-
 		scnprintf(boardname, sizeof(boardname), "board-%s-%s.bin",
 			  ath10k_bus_str(ar->hif.bus), dev_name(ar->dev));
 
@@ -1285,7 +1280,8 @@  static int ath10k_core_fetch_board_data_api_1(struct ath10k *ar, int bd_ie_type)
 		if (IS_ERR(ar->normal_mode_fw.board)) {
 			fw = ath10k_fetch_fw_file(ar,
 						  ar->hw_params.fw.dir,
-						  ar->hw_params.fw.board);
+						  ar->hw_params.fw.board ?:
+						  "board.bin");
 			ar->normal_mode_fw.board = fw;
 		}