diff mbox series

iwinfo: devices: add Qualcomm Atheros IPQ8074 WiSoC

Message ID 20230106095654.250611-1-robimarko@gmail.com
State Accepted
Headers show
Series iwinfo: devices: add Qualcomm Atheros IPQ8074 WiSoC | expand

Commit Message

Robert Marko Jan. 6, 2023, 9:56 a.m. UTC
Add detection of the Qualcomm Atheros IPQ8074 WiSoC using the compatible
string from device tree.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
 devices.txt      | 1 +
 iwinfo_nl80211.c | 5 +++++
 2 files changed, 6 insertions(+)

Comments

Jo-Philipp Wich Jan. 6, 2023, 10:42 p.m. UTC | #1
Hi Robert,

I know that you're just expanding existing code (which I recently noticed for
the first time) but I think that adding more and more if/else clauses with
further hardware matches for purely cosmetic reasons* is a good way forward.

At the very least a mechanism should be added to configure this
FDT-to-PCI-ID-to-name mapping in the devices.txt file directly.


*) Many hardware entries are simply added to show a fancy radio name instead
   of "Generic MAC80211" radio but don't add non-defaults values such as power
   offsets or antenna gains.


Regards,
Jo
Christian Marangi Jan. 7, 2023, 12:49 a.m. UTC | #2
On Fri, Jan 06, 2023 at 11:42:46PM +0100, Jo-Philipp Wich wrote:
> Hi Robert,
> 
> I know that you're just expanding existing code (which I recently noticed for
> the first time) but I think that adding more and more if/else clauses with
> further hardware matches for purely cosmetic reasons* is a good way forward.
> 
> At the very least a mechanism should be added to configure this
> FDT-to-PCI-ID-to-name mapping in the devices.txt file directly.
> 
> 
> *) Many hardware entries are simply added to show a fancy radio name instead
>    of "Generic MAC80211" radio but don't add non-defaults values such as power
>    offsets or antenna gains.
> 
> 

Just to make sure I got this right. The idea here is to drop the
function for the compatible parsing and add some kind support for it
directly in devices.txt? 

Would an additional column to devices.txt enough for this?
And enforce subsystem and device_id to 0xffff to fallback to compatible
matching in this specific case?

Can't see any other simple way for it than adding an entire new column
to the file and hardcode the other values to select this particular
mode.

I wonder if a good idea would be use another type of format... like a
JSON and convert the txt to it? Would make the thing much easier to handle.
Robert Marko Jan. 7, 2023, 9:43 p.m. UTC | #3
On Fri, 6 Jan 2023 at 23:43, Jo-Philipp Wich <jo@mein.io> wrote:
>
> Hi Robert,
>
> I know that you're just expanding existing code (which I recently noticed for
> the first time) but I think that adding more and more if/else clauses with
> further hardware matches for purely cosmetic reasons* is a good way forward.
>
> At the very least a mechanism should be added to configure this
> FDT-to-PCI-ID-to-name mapping in the devices.txt file directly.
>
>
> *) Many hardware entries are simply added to show a fancy radio name instead
>    of "Generic MAC80211" radio but don't add non-defaults values such as power
>    offsets or antenna gains.

Jo, I agree that adding more if/else isn't ideal but this is pretty
much what has been
done so far and I dont have time or ideas on how to improve this.

And yeah, devices are added just to display the SoC name instead of the generic
name and that's pretty much it.

Regards,
Robert
>
>
> Regards,
> Jo
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff mbox series

Patch

diff --git a/devices.txt b/devices.txt
index e0663b8..bc0257c 100644
--- a/devices.txt
+++ b/devices.txt
@@ -167,6 +167,7 @@ 
 0x168c 0x003c 0x1a56 0x1420    0      0  "Qualcomm Atheros" "QCA9862"
 0x168c 0x003c 0x19b6 0xd03c    0      0  "Mikrotik" "R11e-5HacT"
 0x168c 0x003c 0x168c 0x4019    0      0  "Qualcomm Atheros" "IPQ4019"
+0x168c 0x8074 0x168c 0x8074    0      0  "Qualcomm Atheros" "IPQ8074"
 0x168c 0x003c 0x19b6 0xd075    0      0  "Mikrotik" "R11e-5HacD"
 0x168c 0x0040 0x168c 0x0002    0      0  "Qualcomm Atheros" "QCA9990"
 0x168c 0x0046 0x168c 0xcafe    0      0  "Qualcomm Atheros" "QCA9984"
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index a78343f..916192f 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -3491,6 +3491,11 @@  static int nl80211_hardware_id_from_fdt(struct iwinfo_hardware_id *id, const cha
 		id->device_id = 0x003c;
 		id->subsystem_vendor_id = 0x168c;
 		id->subsystem_device_id = 0x4019;
+	} else if (!strcmp(compat, "qcom,ipq8074-wifi")) {
+		id->vendor_id = 0x168c;
+		id->device_id = 0x8074;
+		id->subsystem_vendor_id = 0x168c;
+		id->subsystem_device_id = 0x8074;
 	} else if (!strcmp(compat, "mediatek,mt7622-wmac")) {
 		id->vendor_id = 0x14c3;
 		id->device_id = 0x7622;