aboutsummaryrefslogtreecommitdiffstats
path: root/net/rfkill
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2013-10-16 06:53:43 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-10-28 10:05:25 -0400
commitef91ffaa033001c2ba65d3c9659f1a75886d0aa3 (patch)
treef858ccc0b4b4c5eefe18cfbb79414bdfda85518c /net/rfkill
parent262c91ee5e524238d4dabf908c88f8518ed334ce (diff)
net: rfkill: gpio: add ACPI support
Including ACPI ID for Broadcom GPS receiver BCM4752. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Rhyland Klein <rklein@nvidia.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/rfkill')
-rw-r--r--net/rfkill/rfkill-gpio.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index 2dd78c628d86..5620d3c07479 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -24,6 +24,8 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/clk.h> 25#include <linux/clk.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/acpi.h>
28#include <linux/acpi_gpio.h>
27 29
28#include <linux/rfkill-gpio.h> 30#include <linux/rfkill-gpio.h>
29 31
@@ -70,6 +72,23 @@ static const struct rfkill_ops rfkill_gpio_ops = {
70 .set_block = rfkill_gpio_set_power, 72 .set_block = rfkill_gpio_set_power,
71}; 73};
72 74
75static int rfkill_gpio_acpi_probe(struct device *dev,
76 struct rfkill_gpio_data *rfkill)
77{
78 const struct acpi_device_id *id;
79
80 id = acpi_match_device(dev->driver->acpi_match_table, dev);
81 if (!id)
82 return -ENODEV;
83
84 rfkill->name = dev_name(dev);
85 rfkill->type = (unsigned)id->driver_data;
86 rfkill->reset_gpio = acpi_get_gpio_by_index(dev, 0, NULL);
87 rfkill->shutdown_gpio = acpi_get_gpio_by_index(dev, 1, NULL);
88
89 return 0;
90}
91
73static int rfkill_gpio_probe(struct platform_device *pdev) 92static int rfkill_gpio_probe(struct platform_device *pdev)
74{ 93{
75 struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data; 94 struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data;
@@ -82,7 +101,11 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
82 if (!rfkill) 101 if (!rfkill)
83 return -ENOMEM; 102 return -ENOMEM;
84 103
85 if (pdata) { 104 if (ACPI_HANDLE(&pdev->dev)) {
105 ret = rfkill_gpio_acpi_probe(&pdev->dev, rfkill);
106 if (ret)
107 return ret;
108 } else if (pdata) {
86 clk_name = pdata->power_clk_name; 109 clk_name = pdata->power_clk_name;
87 rfkill->name = pdata->name; 110 rfkill->name = pdata->name;
88 rfkill->type = pdata->type; 111 rfkill->type = pdata->type;
@@ -170,12 +193,18 @@ static int rfkill_gpio_remove(struct platform_device *pdev)
170 return 0; 193 return 0;
171} 194}
172 195
196static const struct acpi_device_id rfkill_acpi_match[] = {
197 { "BCM4752", RFKILL_TYPE_GPS },
198 { },
199};
200
173static struct platform_driver rfkill_gpio_driver = { 201static struct platform_driver rfkill_gpio_driver = {
174 .probe = rfkill_gpio_probe, 202 .probe = rfkill_gpio_probe,
175 .remove = rfkill_gpio_remove, 203 .remove = rfkill_gpio_remove,
176 .driver = { 204 .driver = {
177 .name = "rfkill_gpio", 205 .name = "rfkill_gpio",
178 .owner = THIS_MODULE, 206 .owner = THIS_MODULE,
207 .acpi_match_table = ACPI_PTR(rfkill_acpi_match),
179 }, 208 },
180}; 209};
181 210