From 93686b7596f6b2618cda591da95fe5d3c9320d38 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Wed, 28 Feb 2024 23:53:01 +0800 Subject: [PATCH] rockchip: replace local rfkill hack with upstream patch Signed-off-by: Tianling Shen (cherry picked from commit f7dc31b451ed4bc319e53afb9ff3171152ce0799) --- ...-v6.3-net-rfkill-gpio-add-DT-support.patch | 67 +++++++++++++++++++ ...kill-gpio-add-of_match_table-support.patch | 34 ---------- 2 files changed, 67 insertions(+), 34 deletions(-) create mode 100644 target/linux/rockchip/patches-5.15/028-v6.3-net-rfkill-gpio-add-DT-support.patch delete mode 100644 target/linux/rockchip/patches-5.15/620-rfkill-gpio-add-of_match_table-support.patch diff --git a/target/linux/rockchip/patches-5.15/028-v6.3-net-rfkill-gpio-add-DT-support.patch b/target/linux/rockchip/patches-5.15/028-v6.3-net-rfkill-gpio-add-DT-support.patch new file mode 100644 index 0000000000..53a1a2dee8 --- /dev/null +++ b/target/linux/rockchip/patches-5.15/028-v6.3-net-rfkill-gpio-add-DT-support.patch @@ -0,0 +1,67 @@ +From d64c732dfc9edcd57feb693c23162117737e426b Mon Sep 17 00:00:00 2001 +From: Philipp Zabel +Date: Mon, 2 Jan 2023 18:29:34 +0100 +Subject: [PATCH] net: rfkill: gpio: add DT support + +Allow probing rfkill-gpio via device tree. This hooks up the already +existing support that was started in commit 262c91ee5e52 ("net: +rfkill: gpio: prepare for DT and ACPI support") via the "rfkill-gpio" +compatible, with the "name" and "type" properties renamed to "label" +and "radio-type", respectively, in the device tree case. + +Signed-off-by: Philipp Zabel +Link: https://lore.kernel.org/r/20230102-rfkill-gpio-dt-v2-2-d1b83758c16d@pengutronix.de +Signed-off-by: Johannes Berg +--- + net/rfkill/rfkill-gpio.c | 20 ++++++++++++++++++-- + 1 file changed, 18 insertions(+), 2 deletions(-) + +--- a/net/rfkill/rfkill-gpio.c ++++ b/net/rfkill/rfkill-gpio.c +@@ -75,6 +75,8 @@ static int rfkill_gpio_probe(struct plat + { + struct rfkill_gpio_data *rfkill; + struct gpio_desc *gpio; ++ const char *name_property; ++ const char *type_property; + const char *type_name; + int ret; + +@@ -82,8 +84,15 @@ static int rfkill_gpio_probe(struct plat + if (!rfkill) + return -ENOMEM; + +- device_property_read_string(&pdev->dev, "name", &rfkill->name); +- device_property_read_string(&pdev->dev, "type", &type_name); ++ if (dev_of_node(&pdev->dev)) { ++ name_property = "label"; ++ type_property = "radio-type"; ++ } else { ++ name_property = "name"; ++ type_property = "type"; ++ } ++ device_property_read_string(&pdev->dev, name_property, &rfkill->name); ++ device_property_read_string(&pdev->dev, type_property, &type_name); + + if (!rfkill->name) + rfkill->name = dev_name(&pdev->dev); +@@ -165,12 +174,19 @@ static const struct acpi_device_id rfkil + MODULE_DEVICE_TABLE(acpi, rfkill_acpi_match); + #endif + ++static const struct of_device_id rfkill_of_match[] __maybe_unused = { ++ { .compatible = "rfkill-gpio", }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rfkill_of_match); ++ + static struct platform_driver rfkill_gpio_driver = { + .probe = rfkill_gpio_probe, + .remove = rfkill_gpio_remove, + .driver = { + .name = "rfkill_gpio", + .acpi_match_table = ACPI_PTR(rfkill_acpi_match), ++ .of_match_table = of_match_ptr(rfkill_of_match), + }, + }; + diff --git a/target/linux/rockchip/patches-5.15/620-rfkill-gpio-add-of_match_table-support.patch b/target/linux/rockchip/patches-5.15/620-rfkill-gpio-add-of_match_table-support.patch deleted file mode 100644 index 7b8a50ff46..0000000000 --- a/target/linux/rockchip/patches-5.15/620-rfkill-gpio-add-of_match_table-support.patch +++ /dev/null @@ -1,34 +0,0 @@ -From b4aeb93e697e4dbe2d336d01290e92e98acfd83c Mon Sep 17 00:00:00 2001 -From: jensen -Date: Sat, 15 Oct 2022 18:47:24 +0800 -Subject: [PATCH] rfkill: gpio: add of_match_table support - -Signed-off-by: jensen ---- - net/rfkill/rfkill-gpio.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - ---- a/net/rfkill/rfkill-gpio.c -+++ b/net/rfkill/rfkill-gpio.c -@@ -164,6 +164,13 @@ static const struct acpi_device_id rfkil - }; - MODULE_DEVICE_TABLE(acpi, rfkill_acpi_match); - #endif -+#ifdef CONFIG_OF -+static struct of_device_id rfkill_gpio_of_match[] = { -+ { .compatible = "rfkill-gpio" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(of, rfkill_gpio_of_match); -+#endif - - static struct platform_driver rfkill_gpio_driver = { - .probe = rfkill_gpio_probe, -@@ -171,6 +178,7 @@ static struct platform_driver rfkill_gpi - .driver = { - .name = "rfkill_gpio", - .acpi_match_table = ACPI_PTR(rfkill_acpi_match), -+ .of_match_table = of_match_ptr(rfkill_gpio_of_match), - }, - }; -