summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-tegra/board-paz00.c
blob: 3ec810b6f1a7fe15a5c0002b8203768f7ddfbec0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// SPDX-License-Identifier: GPL-2.0-only
/*
 * arch/arm/mach-tegra/board-paz00.c
 *
 * Copyright (C) 2011 Marc Dietrich <marvin24@gmx.de>
 *
 * Based on board-harmony.c
 * Copyright (C) 2010 Google, Inc.
 */

#include <linux/err.h>
#include <linux/gpio/machine.h>
#include <linux/gpio/property.h>
#include <linux/platform_device.h>
#include <linux/printk.h>
#include <linux/property.h>

#include "board.h"

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("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 const struct platform_device_info wifi_rfkill_info __initconst = {
	.name		= "rfkill_gpio",
	.id		= PLATFORM_DEVID_NONE,
	.properties	= wifi_rfkill_prop,
};

void __init tegra_paz00_wifikill_init(void)
{
	struct platform_device *pd;
	int err;

	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);
}