Merge branch 'rfkill-gpio-cleanups' of git://git.kernel.org/pub/scm/linux/kernel...
authorJohn W. Linville <linville@tuxdriver.com>
Tue, 6 May 2014 18:43:34 +0000 (14:43 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 6 May 2014 18:43:34 +0000 (14:43 -0400)
arch/arm/mach-tegra/board-paz00.c
include/linux/rfkill-gpio.h
net/rfkill/rfkill-gpio.c

index e4dec9fcb084afe014d8beb09706f946f7b8e734..9c6029ba526fff85005d8195c311138be7074a94 100644 (file)
@@ -23,9 +23,7 @@
 #include "board.h"
 
 static struct rfkill_gpio_platform_data wifi_rfkill_platform_data = {
-       .name           = "wifi_rfkill",
-       .reset_gpio     = 25, /* PD1 */
-       .shutdown_gpio  = 85, /* PK5 */
+       .name   = "wifi_rfkill",
        .type   = RFKILL_TYPE_WLAN,
 };
 
index 4d09f6eab359f8e78b2c5b89b45797dd8fec17de..20bcb55498cd5714028bf7ccf9474b9fa36aa7aa 100644 (file)
  * struct rfkill_gpio_platform_data - platform data for rfkill gpio device.
  * for unused gpio's, the expected value is -1.
  * @name:              name for the gpio rf kill instance
- * @reset_gpio:                GPIO which is used for reseting rfkill switch
- * @shutdown_gpio:     GPIO which is used for shutdown of rfkill switch
- * @power_clk_name:    [optional] name of clk to turn off while blocked
- * @gpio_runtime_close:        clean up platform specific gpio configuration
- * @gpio_runtime_setup:        set up platform specific gpio configuration
  */
 
 struct rfkill_gpio_platform_data {
        char                    *name;
-       int                     reset_gpio;
-       int                     shutdown_gpio;
-       const char              *power_clk_name;
        enum rfkill_type        type;
-       void    (*gpio_runtime_close)(struct platform_device *);
-       int     (*gpio_runtime_setup)(struct platform_device *);
 };
 
 #endif /* __RFKILL_GPIO_H */
index bd2a5b90400cdf2688f249c1bcaaf382a4e918fd..9c4a5eb91cbfd6cb806bee19b3a269abc406d6c1 100644 (file)
@@ -36,8 +36,6 @@ struct rfkill_gpio_data {
        struct gpio_desc        *shutdown_gpio;
 
        struct rfkill           *rfkill_dev;
-       char                    *reset_name;
-       char                    *shutdown_name;
        struct clk              *clk;
 
        bool                    clk_enabled;
@@ -87,10 +85,8 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
 {
        struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data;
        struct rfkill_gpio_data *rfkill;
-       const char *clk_name = NULL;
        struct gpio_desc *gpio;
        int ret;
-       int len;
 
        rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL);
        if (!rfkill)
@@ -101,28 +97,15 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
                if (ret)
                        return ret;
        } else if (pdata) {
-               clk_name = pdata->power_clk_name;
                rfkill->name = pdata->name;
                rfkill->type = pdata->type;
        } else {
                return -ENODEV;
        }
 
-       len = strlen(rfkill->name);
-       rfkill->reset_name = devm_kzalloc(&pdev->dev, len + 7, GFP_KERNEL);
-       if (!rfkill->reset_name)
-               return -ENOMEM;
-
-       rfkill->shutdown_name = devm_kzalloc(&pdev->dev, len + 10, GFP_KERNEL);
-       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);
-
-       rfkill->clk = devm_clk_get(&pdev->dev, clk_name);
+       rfkill->clk = devm_clk_get(&pdev->dev, NULL);
 
-       gpio = devm_gpiod_get_index(&pdev->dev, rfkill->reset_name, 0);
+       gpio = devm_gpiod_get_index(&pdev->dev, "reset", 0);
        if (!IS_ERR(gpio)) {
                ret = gpiod_direction_output(gpio, 0);
                if (ret)
@@ -130,7 +113,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
                rfkill->reset_gpio = gpio;
        }
 
-       gpio = devm_gpiod_get_index(&pdev->dev, rfkill->shutdown_name, 1);
+       gpio = devm_gpiod_get_index(&pdev->dev, "shutdown", 1);
        if (!IS_ERR(gpio)) {
                ret = gpiod_direction_output(gpio, 0);
                if (ret)
@@ -146,14 +129,6 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       if (pdata && pdata->gpio_runtime_setup) {
-               ret = pdata->gpio_runtime_setup(pdev);
-               if (ret) {
-                       dev_err(&pdev->dev, "can't set up gpio\n");
-                       return ret;
-               }
-       }
-
        rfkill->rfkill_dev = rfkill_alloc(rfkill->name, &pdev->dev,
                                          rfkill->type, &rfkill_gpio_ops,
                                          rfkill);
@@ -174,20 +149,23 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
 static int rfkill_gpio_remove(struct platform_device *pdev)
 {
        struct rfkill_gpio_data *rfkill = platform_get_drvdata(pdev);
-       struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data;
 
-       if (pdata && pdata->gpio_runtime_close)
-               pdata->gpio_runtime_close(pdev);
        rfkill_unregister(rfkill->rfkill_dev);
        rfkill_destroy(rfkill->rfkill_dev);
 
        return 0;
 }
 
+#ifdef CONFIG_ACPI
 static const struct acpi_device_id rfkill_acpi_match[] = {
+       { "BCM2E1A", RFKILL_TYPE_BLUETOOTH },
+       { "BCM2E39", RFKILL_TYPE_BLUETOOTH },
+       { "BCM2E3D", RFKILL_TYPE_BLUETOOTH },
        { "BCM4752", RFKILL_TYPE_GPS },
+       { "LNV4752", RFKILL_TYPE_GPS },
        { },
 };
+#endif
 
 static struct platform_driver rfkill_gpio_driver = {
        .probe = rfkill_gpio_probe,