69 lines
1.8 KiB
Diff
69 lines
1.8 KiB
Diff
---
|
|
net/rfkill/rfkill-gpio.c | 23 +++++++++++++++++++++++
|
|
1 file changed, 23 insertions(+)
|
|
|
|
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
|
|
index f5afc9bcd..f731cd0a2 100644
|
|
--- a/net/rfkill/rfkill-gpio.c
|
|
+++ b/net/rfkill/rfkill-gpio.c
|
|
@@ -13,6 +13,7 @@
|
|
#include <linux/slab.h>
|
|
#include <linux/acpi.h>
|
|
#include <linux/gpio/consumer.h>
|
|
+#include <linux/of_gpio.h>
|
|
|
|
struct rfkill_gpio_data {
|
|
const char *name;
|
|
@@ -71,6 +72,18 @@ static int rfkill_gpio_acpi_probe(struct device *dev,
|
|
return devm_acpi_dev_add_driver_gpios(dev, acpi_rfkill_default_gpios);
|
|
}
|
|
|
|
+static int rfkill_gpio_dt_probe(struct device *dev,
|
|
+ struct rfkill_gpio_data *rfkill)
|
|
+{
|
|
+ struct device_node * np = dev->of_node;
|
|
+
|
|
+ rfkill->name = np->name;
|
|
+ of_property_read_string(np, "rfkill-name", &rfkill->name);
|
|
+ of_property_read_u32(np, "rfkill-type", &rfkill->type);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static int rfkill_gpio_probe(struct platform_device *pdev)
|
|
{
|
|
struct rfkill_gpio_data *rfkill;
|
|
@@ -94,6 +107,10 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
|
|
ret = rfkill_gpio_acpi_probe(&pdev->dev, rfkill);
|
|
if (ret)
|
|
return ret;
|
|
+ } else if (&pdev->dev.of_node) {
|
|
+ ret = rfkill_gpio_dt_probe(&pdev->dev, rfkill);
|
|
+ if (ret)
|
|
+ return ret;
|
|
}
|
|
|
|
rfkill->clk = devm_clk_get(&pdev->dev, NULL);
|
|
@@ -157,12 +174,18 @@ static const struct acpi_device_id rfkill_acpi_match[] = {
|
|
MODULE_DEVICE_TABLE(acpi, rfkill_acpi_match);
|
|
#endif
|
|
|
|
+static const struct of_device_id rfkill_of_match[] = {
|
|
+ { .compatible = "rfkill-gpio", },
|
|
+ {},
|
|
+};
|
|
+
|
|
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),
|
|
},
|
|
};
|
|
|
|
--
|
|
2.17.1
|
|
|