rockchip: use upstream rfkill patches

This commit is contained in:
aiamadeus 2024-01-19 23:16:27 +08:00
parent 2a4194fa4b
commit 38ed25d038
6 changed files with 97 additions and 36 deletions

View File

@ -44,8 +44,8 @@
modem-rfkill { modem-rfkill {
compatible = "rfkill-gpio"; compatible = "rfkill-gpio";
name = "modem-rfkill"; label = "modem-rfkill";
type = "wwan"; radio-type = "wwan";
reset-gpios = <&gpio0 RK_PB0 GPIO_ACTIVE_LOW>; reset-gpios = <&gpio0 RK_PB0 GPIO_ACTIVE_LOW>;
shutdown-gpios = <&gpio4 RK_PC4 GPIO_ACTIVE_HIGH>; shutdown-gpios = <&gpio4 RK_PC4 GPIO_ACTIVE_HIGH>;
}; };

View File

@ -0,0 +1,66 @@
From d64c732dfc9edcd57feb693c23162117737e426b Mon Sep 17 00:00:00 2001
From: Philipp Zabel <p.zabel@pengutronix.de>
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 <p.zabel@pengutronix.de>
Link: https://lore.kernel.org/r/20230102-rfkill-gpio-dt-v2-2-d1b83758c16d@pengutronix.de
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
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 platform_device *pdev)
{
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 platform_device *pdev)
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);
@@ -157,12 +166,19 @@ 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[] __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),
},
};

View File

@ -0,0 +1,29 @@
From 75c7124ef3bafe0e9d1801d6449196dc3105df24 Mon Sep 17 00:00:00 2001
From: Rob Herring <robh@kernel.org>
Date: Wed, 5 Apr 2023 15:27:17 -0500
Subject: [PATCH] net: rfkill-gpio: Add explicit include for of.h
With linux/acpi.h no longer implicitly including of.h, add an explicit
include of of.h to fix the following error:
net/rfkill/rfkill-gpio.c:181:21: error: implicit declaration of function 'of_match_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
net/rfkill/rfkill-gpio.c | 1 +
1 file changed, 1 insertion(+)
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -8,6 +8,7 @@
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/rfkill.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/slab.h>

View File

@ -1,34 +0,0 @@
From b4aeb93e697e4dbe2d336d01290e92e98acfd83c Mon Sep 17 00:00:00 2001
From: jensen <jensenhuang@friendlyarm.com>
Date: Sat, 15 Oct 2022 18:47:24 +0800
Subject: [PATCH] rfkill: gpio: add of_match_table support
Signed-off-by: jensen <jensenhuang@friendlyarm.com>
---
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),
},
};