ARM: tegra: paz00: Use software nodes to describe GPIOs for WiFi rfkill
Complete conversion of the WiFi rfkill device to use device properties/ software nodes by utilizing PROPERTY_ENTRY_GPIO() instead of a lookup table. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
parent
1613e604df
commit
237c5c9581
@ -8,35 +8,49 @@
|
|||||||
* Copyright (C) 2010 Google, Inc.
|
* Copyright (C) 2010 Google, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/property.h>
|
#include <linux/err.h>
|
||||||
#include <linux/gpio/machine.h>
|
#include <linux/gpio/machine.h>
|
||||||
|
#include <linux/gpio/property.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/printk.h>
|
||||||
|
#include <linux/property.h>
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
||||||
static struct property_entry wifi_rfkill_prop[] __initdata = {
|
static const struct software_node tegra_gpiochip_node = {
|
||||||
|
.name = "tegra-gpio",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct property_entry wifi_rfkill_prop[] __initconst = {
|
||||||
PROPERTY_ENTRY_STRING("name", "wifi_rfkill"),
|
PROPERTY_ENTRY_STRING("name", "wifi_rfkill"),
|
||||||
PROPERTY_ENTRY_STRING("type", "wlan"),
|
PROPERTY_ENTRY_STRING("type", "wlan"),
|
||||||
{ },
|
PROPERTY_ENTRY_GPIO("reset-gpios",
|
||||||
|
&tegra_gpiochip_node, 25, GPIO_ACTIVE_HIGH),
|
||||||
|
PROPERTY_ENTRY_GPIO("shutdown-gpios",
|
||||||
|
&tegra_gpiochip_node, 85, GPIO_ACTIVE_HIGH),
|
||||||
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct platform_device wifi_rfkill_device = {
|
static const struct platform_device_info wifi_rfkill_info __initconst = {
|
||||||
.name = "rfkill_gpio",
|
.name = "rfkill_gpio",
|
||||||
.id = -1,
|
.id = PLATFORM_DEVID_NONE,
|
||||||
};
|
.properties = wifi_rfkill_prop,
|
||||||
|
|
||||||
static struct gpiod_lookup_table wifi_gpio_lookup = {
|
|
||||||
.dev_id = "rfkill_gpio",
|
|
||||||
.table = {
|
|
||||||
GPIO_LOOKUP("tegra-gpio", 25, "reset", 0),
|
|
||||||
GPIO_LOOKUP("tegra-gpio", 85, "shutdown", 0),
|
|
||||||
{ },
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void __init tegra_paz00_wifikill_init(void)
|
void __init tegra_paz00_wifikill_init(void)
|
||||||
{
|
{
|
||||||
device_create_managed_software_node(&wifi_rfkill_device.dev, wifi_rfkill_prop, NULL);
|
struct platform_device *pd;
|
||||||
gpiod_add_lookup_table(&wifi_gpio_lookup);
|
int err;
|
||||||
platform_device_register(&wifi_rfkill_device);
|
|
||||||
|
err = software_node_register(&tegra_gpiochip_node);
|
||||||
|
if (err) {
|
||||||
|
pr_err("failed to register %s node: %d\n",
|
||||||
|
tegra_gpiochip_node.name, err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pd = platform_device_register_full(&wifi_rfkill_info);
|
||||||
|
err = PTR_ERR_OR_ZERO(pd);
|
||||||
|
if (err)
|
||||||
|
pr_err("failed to register WiFi rfkill device: %d\n", err);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user