c835a33f492964f854e37afcbe5f5acd7637e0d8
[openwrt/staging/jow.git] / package / kernel / ath10k-ct / patches / 130-ath10k-read-qcom-coexist-support-as-a-u32.patch
1 From 630df9786fdaeb78c21f1e28c9b70ac83a1b482c Mon Sep 17 00:00:00 2001
2 From: Vincent Tremblay <vincent@vtremblay.dev>
3 Date: Sat, 31 Dec 2022 09:24:00 -0500
4 Subject: [PATCH] ath10k: read qcom,coexist-support as a u32
5
6 Read qcom,coexist-support as a u32 instead of a u8
7
8 When we set the property to <1> in the DT (as specified in the doc),
9 "of_property_read_u8" read 0 instead of 1. This is because of the data format.
10
11 By default <1> is written with 32 bits.
12 The problem is that the driver is trying to read a u8.
13
14 The difference can be visualized using hexdump in a running device:
15 Default 32 bits output:
16 =======================
17 0000000 0000 0100
18 0000004
19
20 8 bits output:
21 ==============
22 0000000 0001
23 0000001
24
25 By changing "of_property_read_u8" by "of_property_read_u32", the driver
26 is aligned with the documentation and is able to read the value without
27 modifying the DT.
28
29 The other solution would be to force the value in the DT to be saved as
30 an 8 bits value (qcom,coexist-support = /bits/ 8 <1>),
31 which is against the doc and less intuitive.
32
33 Validation:
34 ===========
35 The patch was tested on a real device and we can see in the debug logs
36 that the feature is properly initialized:
37
38 [ 109.102097] ath10k_ahb a000000.wifi: boot coex_support 1 coex_gpio_pin 52
39
40 Signed-off-by: Vincent Tremblay <vincent@vtremblay.dev>
41
42 --- a/ath10k-5.15/core.c
43 +++ b/ath10k-5.15/core.c
44 @@ -2798,14 +2798,14 @@ done:
45 static void ath10k_core_fetch_btcoex_dt(struct ath10k *ar)
46 {
47 struct device_node *node;
48 - u8 coex_support = 0;
49 + u32 coex_support = 0;
50 int ret;
51
52 node = ar->dev->of_node;
53 if (!node)
54 goto out;
55
56 - ret = of_property_read_u8(node, "qcom,coexist-support", &coex_support);
57 + ret = of_property_read_u32(node, "qcom,coexist-support", &coex_support);
58 if (ret) {
59 ar->coex_support = true;
60 goto out;