kernel: update 3.14 to 3.14.18
[openwrt/openwrt.git] / target / linux / sunxi / patches-3.14 / 230-net-rfkill-changes.patch
index ca71a915a8f698eb6601235652bc15c6db538295..d5e107875e033c8479efaa89d100c1529d1e7f66 100644 (file)
@@ -12,44 +12,25 @@ Signed-off-by: Chen-Yu Tsai <wens@csie.org>
  net/rfkill/rfkill-gpio.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
-diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
-index bd2a5b9..97ec12a 100644
 --- a/net/rfkill/rfkill-gpio.c
 +++ b/net/rfkill/rfkill-gpio.c
-@@ -117,8 +117,8 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
-       if (!rfkill->shutdown_name)
-               return -ENOMEM;
+@@ -26,6 +26,7 @@
+ #include <linux/slab.h>
+ #include <linux/acpi.h>
+ #include <linux/gpio/consumer.h>
++#include <linux/of_gpio.h>
  
--      snprintf(rfkill->reset_name, len + 6 , "%s_reset", rfkill->name);
--      snprintf(rfkill->shutdown_name, len + 9, "%s_shutdown", rfkill->name);
-+      snprintf(rfkill->reset_name, len + 7 , "%s_reset", rfkill->name);
-+      snprintf(rfkill->shutdown_name, len + 10, "%s_shutdown", rfkill->name);
+ #include <linux/rfkill-gpio.h>
  
-       rfkill->clk = devm_clk_get(&pdev->dev, clk_name);
+@@ -39,6 +40,7 @@ struct rfkill_gpio_data {
+       char                    *reset_name;
+       char                    *shutdown_name;
+       struct clk              *clk;
++      int                     clk_frequency;
  
--- 
-2.0.3
-
-From d91c313c08167978c3fb20b327b6a7abb7b00ffd Mon Sep 17 00:00:00 2001
-From: Chen-Yu Tsai <wens@csie.org>
-Date: Fri, 17 Jan 2014 14:47:27 +0800
-Subject: [PATCH] net: rfkill: gpio: use
- clk_prepare_enable/clk_disable_unprepare
-
-rfkill-gpio calls clk_enable() without first calling clk_prepare(),
-resulting in a warning and no effect. Switch to clk_prepare_enable()
-and clk_disable_unprepare.
-
-Signed-off-by: Chen-Yu Tsai <wens@csie.org>
----
- net/rfkill/rfkill-gpio.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
-index 97ec12a..c7081b7 100644
---- a/net/rfkill/rfkill-gpio.c
-+++ b/net/rfkill/rfkill-gpio.c
-@@ -51,10 +51,10 @@ static int rfkill_gpio_set_power(void *data, bool blocked)
+       bool                    clk_enabled;
+ };
+@@ -51,15 +53,15 @@ static int rfkill_gpio_set_power(void *d
                gpiod_set_value(rfkill->shutdown_gpio, 0);
                gpiod_set_value(rfkill->reset_gpio, 0);
                if (!IS_ERR(rfkill->clk) && rfkill->clk_enabled)
@@ -62,96 +43,13 @@ index 97ec12a..c7081b7 100644
                gpiod_set_value(rfkill->reset_gpio, 1);
                gpiod_set_value(rfkill->shutdown_gpio, 1);
        }
--- 
-2.0.3
-
-From f6dc85e22d3215a26f509fb5b34ca34c56a0d8b4 Mon Sep 17 00:00:00 2001
-From: Chen-Yu Tsai <wens@csie.org>
-Date: Fri, 17 Jan 2014 14:47:28 +0800
-Subject: [PATCH] net: rfkill: gpio: fix reversed clock enable state
-
-rfkill-gpio has clk_enabled = blocked, which is true when rfkill
-blocks the device. This results in calling clock enable/disable at
-the wrong time. Reversing the value fixes this.
-
-Signed-off-by: Chen-Yu Tsai <wens@csie.org>
----
- net/rfkill/rfkill-gpio.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
-index c7081b7..3084fa3 100644
---- a/net/rfkill/rfkill-gpio.c
-+++ b/net/rfkill/rfkill-gpio.c
-@@ -59,7 +59,7 @@ static int rfkill_gpio_set_power(void *data, bool blocked)
-               gpiod_set_value(rfkill->shutdown_gpio, 1);
-       }
  
 -      rfkill->clk_enabled = blocked;
 +      rfkill->clk_enabled = !blocked;
  
        return 0;
  }
--- 
-2.0.3
-
-From 57301a41d4a82902e967f6bd9f09ba6ca31fcbed Mon Sep 17 00:00:00 2001
-From: Chen-Yu Tsai <wens@csie.org>
-Date: Fri, 17 Jan 2014 14:47:29 +0800
-Subject: [PATCH] net: rfkill: gpio: add device tree support
-
-Signed-off-by: Chen-Yu Tsai <wens@csie.org>
----
- .../devicetree/bindings/rfkill/rfkill-gpio.txt     | 26 ++++++++++++++++++++++
- net/rfkill/rfkill-gpio.c                           | 23 +++++++++++++++++++
- 2 files changed, 49 insertions(+)
- create mode 100644 Documentation/devicetree/bindings/rfkill/rfkill-gpio.txt
-
-diff --git a/Documentation/devicetree/bindings/rfkill/rfkill-gpio.txt b/Documentation/devicetree/bindings/rfkill/rfkill-gpio.txt
-new file mode 100644
-index 0000000..8a07ea4
---- /dev/null
-+++ b/Documentation/devicetree/bindings/rfkill/rfkill-gpio.txt
-@@ -0,0 +1,26 @@
-+GPIO controlled RFKILL devices
-+
-+Required properties:
-+- compatible  : Must be "rfkill-gpio".
-+- rfkill-name : Name of RFKILL device
-+- rfkill-type : Type of RFKILL device: 1 for WiFi, 2 for BlueTooth
-+- NAME_shutdown-gpios : GPIO phandle to shutdown control
-+                        (phandle must be the second)
-+- NAME_reset-gpios    : GPIO phandle to reset control
-+
-+NAME must match the rfkill-name property. NAME_shutdown-gpios or
-+NAME_reset-gpios, or both, must be defined.
-+
-+Optional properties:
-+- clocks              : phandle to clock to enable/disable
-+
-+Example:
-+
-+      rfkill_bt: rfkill@0 {
-+              compatible = "rfkill-gpio";
-+              rfkill-name = "bluetooth";
-+              rfkill-type = <2>;
-+              bluetooth_shutdown-gpios = <0>, <&pio 7 18 0>;
-+              bluetooth_reset-gpios = <&pio 7 24 0>;
-+              clocks = <&clk_out_a>;
-+      };
-diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
-index 3084fa3..48381a8 100644
---- a/net/rfkill/rfkill-gpio.c
-+++ b/net/rfkill/rfkill-gpio.c
-@@ -26,6 +26,7 @@
- #include <linux/slab.h>
- #include <linux/acpi.h>
- #include <linux/gpio/consumer.h>
-+#include <linux/of_gpio.h>
- #include <linux/rfkill-gpio.h>
-@@ -83,6 +84,18 @@ static int rfkill_gpio_acpi_probe(struct device *dev,
+@@ -83,6 +85,19 @@ static int rfkill_gpio_acpi_probe(struct
        return 0;
  }
  
@@ -163,6 +61,7 @@ index 3084fa3..48381a8 100644
 +      rfkill->name = np->name;
 +      of_property_read_string(np, "rfkill-name", &rfkill->name);
 +      of_property_read_u32(np, "rfkill-type", &rfkill->type);
++      of_property_read_u32(np, "clock-frequency", &rfkill->clk_frequency);
 +
 +      return 0;
 +}
@@ -170,7 +69,7 @@ index 3084fa3..48381a8 100644
  static int rfkill_gpio_probe(struct platform_device *pdev)
  {
        struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data;
-@@ -100,6 +113,10 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
+@@ -100,6 +115,10 @@ static int rfkill_gpio_probe(struct plat
                ret = rfkill_gpio_acpi_probe(&pdev->dev, rfkill);
                if (ret)
                        return ret;
@@ -181,7 +80,22 @@ index 3084fa3..48381a8 100644
        } else if (pdata) {
                clk_name = pdata->power_clk_name;
                rfkill->name = pdata->name;
-@@ -189,6 +206,11 @@ static const struct acpi_device_id rfkill_acpi_match[] = {
+@@ -117,10 +136,12 @@ static int rfkill_gpio_probe(struct plat
+       if (!rfkill->shutdown_name)
+               return -ENOMEM;
+-      snprintf(rfkill->reset_name, len + 6 , "%s_reset", rfkill->name);
+-      snprintf(rfkill->shutdown_name, len + 9, "%s_shutdown", rfkill->name);
++      snprintf(rfkill->reset_name, len + 7 , "%s_reset", rfkill->name);
++      snprintf(rfkill->shutdown_name, len + 10, "%s_shutdown", rfkill->name);
+       rfkill->clk = devm_clk_get(&pdev->dev, clk_name);
++      if (!IS_ERR(rfkill->clk) && rfkill->clk_frequency > 0)
++              clk_set_rate(rfkill->clk, rfkill->clk_frequency);
+       gpio = devm_gpiod_get_index(&pdev->dev, rfkill->reset_name, 0);
+       if (!IS_ERR(gpio)) {
+@@ -189,6 +210,11 @@ static const struct acpi_device_id rfkil
        { },
  };
  
@@ -193,7 +107,7 @@ index 3084fa3..48381a8 100644
  static struct platform_driver rfkill_gpio_driver = {
        .probe = rfkill_gpio_probe,
        .remove = rfkill_gpio_remove,
-@@ -196,6 +218,7 @@ static struct platform_driver rfkill_gpio_driver = {
+@@ -196,6 +222,7 @@ static struct platform_driver rfkill_gpi
                .name = "rfkill_gpio",
                .owner = THIS_MODULE,
                .acpi_match_table = ACPI_PTR(rfkill_acpi_match),
@@ -201,71 +115,34 @@ index 3084fa3..48381a8 100644
        },
  };
  
--- 
-2.0.3
-
-From 83c43937ee8c5fcb38241a8e89c2b93e5b0f9526 Mon Sep 17 00:00:00 2001
-From: Chen-Yu Tsai <wens@csie.org>
-Date: Fri, 17 Jan 2014 14:47:30 +0800
-Subject: [PATCH] net: rfkill: gpio: add clock-frequency device tree property
-
-Some devices, such as Broadcom Bluetooth devices, require a specific
-clock rate for the clock tied to the rfkill device. Add clock-frequency
-property so we can specify this from the device tree.
-
-Signed-off-by: Chen-Yu Tsai <wens@csie.org>
----
- Documentation/devicetree/bindings/rfkill/rfkill-gpio.txt | 2 ++
- net/rfkill/rfkill-gpio.c                                 | 4 ++++
- 2 files changed, 6 insertions(+)
-
-diff --git a/Documentation/devicetree/bindings/rfkill/rfkill-gpio.txt b/Documentation/devicetree/bindings/rfkill/rfkill-gpio.txt
-index 8a07ea4..8b8db0a 100644
---- a/Documentation/devicetree/bindings/rfkill/rfkill-gpio.txt
+--- /dev/null
 +++ b/Documentation/devicetree/bindings/rfkill/rfkill-gpio.txt
-@@ -13,6 +13,7 @@ NAME_reset-gpios, or both, must be defined.
- Optional properties:
- - clocks              : phandle to clock to enable/disable
+@@ -0,0 +1,28 @@
++GPIO controlled RFKILL devices
++
++Required properties:
++- compatible  : Must be "rfkill-gpio".
++- rfkill-name : Name of RFKILL device
++- rfkill-type : Type of RFKILL device: 1 for WiFi, 2 for BlueTooth
++- NAME_shutdown-gpios : GPIO phandle to shutdown control
++                        (phandle must be the second)
++- NAME_reset-gpios    : GPIO phandle to reset control
++
++NAME must match the rfkill-name property. NAME_shutdown-gpios or
++NAME_reset-gpios, or both, must be defined.
++
++Optional properties:
++- clocks              : phandle to clock to enable/disable
 +- clock-frequency     : clock rate to set for the given clock
- Example:
-@@ -23,4 +24,5 @@ Example:
-               bluetooth_shutdown-gpios = <0>, <&pio 7 18 0>;
-               bluetooth_reset-gpios = <&pio 7 24 0>;
-               clocks = <&clk_out_a>;
++
++Example:
++
++      rfkill_bt: rfkill@0 {
++              compatible = "rfkill-gpio";
++              rfkill-name = "bluetooth";
++              rfkill-type = <2>;
++              bluetooth_shutdown-gpios = <0>, <&pio 7 18 0>;
++              bluetooth_reset-gpios = <&pio 7 24 0>;
++              clocks = <&clk_out_a>;
 +              clock-frequency = <32678>;
-       };
-diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
-index 48381a8..3092681 100644
---- a/net/rfkill/rfkill-gpio.c
-+++ b/net/rfkill/rfkill-gpio.c
-@@ -40,6 +40,7 @@ struct rfkill_gpio_data {
-       char                    *reset_name;
-       char                    *shutdown_name;
-       struct clk              *clk;
-+      int                     clk_frequency;
-       bool                    clk_enabled;
- };
-@@ -92,6 +93,7 @@ static int rfkill_gpio_dt_probe(struct device *dev,
-       rfkill->name = np->name;
-       of_property_read_string(np, "rfkill-name", &rfkill->name);
-       of_property_read_u32(np, "rfkill-type", &rfkill->type);
-+      of_property_read_u32(np, "clock-frequency", &rfkill->clk_frequency);
-       return 0;
- }
-@@ -138,6 +140,8 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
-       snprintf(rfkill->shutdown_name, len + 10, "%s_shutdown", rfkill->name);
-       rfkill->clk = devm_clk_get(&pdev->dev, clk_name);
-+      if (!IS_ERR(rfkill->clk) && rfkill->clk_frequency > 0)
-+              clk_set_rate(rfkill->clk, rfkill->clk_frequency);
-       gpio = devm_gpiod_get_index(&pdev->dev, rfkill->reset_name, 0);
-       if (!IS_ERR(gpio)) {
--- 
-2.0.3
-
++      };