summaryrefslogtreecommitdiff
path: root/arch/arm/mach-omap2/board-minnow-wireless.c
blob: 672917cfff34037b99954ebd33e50c4b03efb611 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
 * linux/arch/arm/mach-omap2/board-minnow-wireless.c
 *
 * Copyright (C) 2013 Motorola Mobility, Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include <linux/wl127x-rfkill.h>
#include "common.h"



void change_vio_mode(int source, int value)
{
	printk(KERN_DEBUG "Entering change_vio_mode\n");
#if 0
	static int bt_request;
    static int wifi_request;

    /*If have DC-DC converter, skip it*/
    if (misc_cpcap == NULL)
		return;

    mutex_lock(&vio_access);
    if (source == 0)
		bt_request = value;
    else if (source == 1)
		wifi_request = value;
    else {
		printk(KERN_ERR "unknown source to vio ");
		mutex_unlock(&vio_access);
		return;
    }

    if (bt_request | wifi_request)
		cpcap_regacc_write(misc_cpcap, CPCAP_REG_S3C,
			0, CPCAP_BIT_SW3STBY);
    else
		cpcap_regacc_write(misc_cpcap, CPCAP_REG_S3C,
			CPCAP_BIT_SW3STBY, CPCAP_BIT_SW3STBY);

    mutex_unlock(&vio_access);
#endif
}


static int minnow_wl1271_init(void);
static int minnow_wl1271_release(void);
static int minnow_wl1271_enable(void);
static int minnow_wl1271_disable(void);

static struct wl127x_rfkill_platform_data minnow_wl1271_pdata = {
    .bt_nshutdown_gpio = -1,
    .fm_enable_gpio = -1,
    .bt_hw_init = minnow_wl1271_init,
    .bt_hw_release = minnow_wl1271_release,
    .bt_hw_enable = minnow_wl1271_enable,
    .bt_hw_disable = minnow_wl1271_disable,
};

static int minnow_wl1271_init(void)
{
    return 0;
}

static int minnow_wl1271_release(void)
{
    return 0;
}

static int minnow_wl1271_enable(void)
{
    /* FIXME
     * Change vio mode dynamically if necessary
     */
    change_vio_mode(0, 1);
    return 0;
}

static int minnow_wl1271_disable(void)
{
    /* FIXME
     * Change vio mode dynamically if necessary
     */
    change_vio_mode(0, 0);
    return 0;
}

static struct platform_device minnow_wl1271_device = {
    .name = "wl127x-rfkill",
    .id = 0,
    .dev.platform_data = &minnow_wl1271_pdata,
};

void __init minnow_bt_init(void)
{
	/* TODO use device tree once ported */
    minnow_wl1271_pdata.bt_nshutdown_gpio = 83;

	platform_device_register(&minnow_wl1271_device);
}