ath10k.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] wifi: ath10k: read qcom,coexist-support as a u32
@ 2023-03-12 19:42 Vincent Tremblay
  2023-03-13  6:39 ` Kalle Valo
  2023-03-13 18:28 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Vincent Tremblay @ 2023-03-12 19:42 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Vincent Tremblay

Read qcom,coexist-support as a u32 instead of a u8

When we set the property to <1> in the DT (as specified in the doc),
"of_property_read_u8" read 0 instead of 1. This is because of the data format.

By default <1> is written with 32 bits.
The problem is that the driver is trying to read a u8.

The difference can be visualized using hexdump in a running device:
Default 32 bits output:
=======================
0000000 0000 0100
0000004

8 bits output:
==============
0000000 0001
0000001

By changing "of_property_read_u8" by "of_property_read_u32", the driver
is aligned with the documentation and is able to read the value without
modifying the DT.

The other solution would be to force the value in the DT to be saved as
an 8 bits value (qcom,coexist-support = /bits/ 8 <1>),
which is against the doc and less intuitive.

Validation:
===========
The patch was tested on a real device and we can see in the debug logs
that the feature is properly initialized:

[  109.102097] ath10k_ahb a000000.wifi: boot coex_support 1 coex_gpio_pin 52

Signed-off-by: Vincent Tremblay <vincent@vtremblay.dev>
---
 drivers/net/wireless/ath/ath10k/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c
b/drivers/net/wireless/ath/ath10k/core.c
index 5eb131ab916f..802d6a12dc1e 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2355,14 +2355,14 @@ static int ath10k_download_cal_data(struct ath10k *ar)
 static void ath10k_core_fetch_btcoex_dt(struct ath10k *ar)
 {
        struct device_node *node;
-       u8 coex_support = 0;
+       u32 coex_support = 0;
        int ret;

        node = ar->dev->of_node;
        if (!node)
                goto out;

-       ret = of_property_read_u8(node, "qcom,coexist-support", &coex_support);
+       ret = of_property_read_u32(node, "qcom,coexist-support", &coex_support);
        if (ret) {
                ar->coex_support = true;
                goto out;

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] wifi: ath10k: read qcom,coexist-support as a u32
  2023-03-12 19:42 [PATCH v2] wifi: ath10k: read qcom,coexist-support as a u32 Vincent Tremblay
@ 2023-03-13  6:39 ` Kalle Valo
  2023-03-13 18:28 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2023-03-13  6:39 UTC (permalink / raw)
  To: Vincent Tremblay; +Cc: ath10k, linux-wireless

Vincent Tremblay <vincent@vtremblay.dev> writes:

> Read qcom,coexist-support as a u32 instead of a u8
>
> When we set the property to <1> in the DT (as specified in the doc),
> "of_property_read_u8" read 0 instead of 1. This is because of the data format.
>
> By default <1> is written with 32 bits.
> The problem is that the driver is trying to read a u8.
>
> The difference can be visualized using hexdump in a running device:
> Default 32 bits output:
> =======================
> 0000000 0000 0100
> 0000004
>
> 8 bits output:
> ==============
> 0000000 0001
> 0000001
>
> By changing "of_property_read_u8" by "of_property_read_u32", the driver
> is aligned with the documentation and is able to read the value without
> modifying the DT.
>
> The other solution would be to force the value in the DT to be saved as
> an 8 bits value (qcom,coexist-support = /bits/ 8 <1>),
> which is against the doc and less intuitive.
>
> Validation:
> ===========
> The patch was tested on a real device and we can see in the debug logs
> that the feature is properly initialized:
>
> [  109.102097] ath10k_ahb a000000.wifi: boot coex_support 1 coex_gpio_pin 52
>
> Signed-off-by: Vincent Tremblay <vincent@vtremblay.dev>

What are the changes in v2? Please always include a list of changes,
more info in the wiki below.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] wifi: ath10k: read qcom,coexist-support as a u32
  2023-03-12 19:42 [PATCH v2] wifi: ath10k: read qcom,coexist-support as a u32 Vincent Tremblay
  2023-03-13  6:39 ` Kalle Valo
@ 2023-03-13 18:28 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2023-03-13 18:28 UTC (permalink / raw)
  To: Vincent Tremblay; +Cc: ath10k, linux-wireless, Vincent Tremblay

Vincent Tremblay <vincent@vtremblay.dev> wrote:

> Read qcom,coexist-support as a u32 instead of a u8
> 
> When we set the property to <1> in the DT (as specified in the doc),
> "of_property_read_u8" read 0 instead of 1. This is because of the data format.
> 
> By default <1> is written with 32 bits.
> The problem is that the driver is trying to read a u8.
> 
> The difference can be visualized using hexdump in a running device:
> Default 32 bits output:
> =======================
> 0000000 0000 0100
> 0000004
> 
> 8 bits output:
> ==============
> 0000000 0001
> 0000001
> 
> By changing "of_property_read_u8" by "of_property_read_u32", the driver
> is aligned with the documentation and is able to read the value without
> modifying the DT.
> 
> The other solution would be to force the value in the DT to be saved as
> an 8 bits value (qcom,coexist-support = /bits/ 8 <1>),
> which is against the doc and less intuitive.
> 
> Validation:
> ===========
> The patch was tested on a real device and we can see in the debug logs
> that the feature is properly initialized:
> 
> [  109.102097] ath10k_ahb a000000.wifi: boot coex_support 1 coex_gpio_pin 52
> 
> Signed-off-by: Vincent Tremblay <vincent@vtremblay.dev>

Fails to apply:

error: git diff header lacks filename information when removing 1 leading pathname component (line 6)
stg import: Diff does not apply cleanly

Patch set to Changes Requested.

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/CA+RD57MwUfAzF2u31Ews4uT0+A6uhjwwd40O=9uyZihap4nxdA@mail.gmail.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-13 18:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-12 19:42 [PATCH v2] wifi: ath10k: read qcom,coexist-support as a u32 Vincent Tremblay
2023-03-13  6:39 ` Kalle Valo
2023-03-13 18:28 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).