Skip to content

Commit 425fcb1

Browse files
johnweberchrillomat
authored andcommitted
wand-rfkill: Change gpio depending on wandboard revision
Wandboard rev C1 uses different GPIO for certain wireless control functions. Use the revision sense gpio to determine which gpio to use depending on revision.
1 parent 9b7593b commit 425fcb1

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

arch/arm/mach-imx/devices/wand-rfkill.c

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ struct wand_rfkill_data {
3434
const char *shutdown_name;
3535
};
3636

37-
/*struct wand_rfkill_data {
38-
struct rfkill *wifi_rfkill_dev, *bt_rfkill_dev;
39-
int wifi_shutdown_gpio, bt_shutdown_gpio;
40-
const char *wifi_shutdown_name, bt_shutdown_name;
41-
};*/
42-
4337
static int wand_rfkill_set_block(void *data, bool blocked)
4438
{
4539
struct wand_rfkill_data *rfkill = data;
@@ -63,13 +57,21 @@ static const struct rfkill_ops wand_rfkill_ops = {
6357

6458
static int wand_rfkill_wifi_probe(struct device *dev,
6559
struct device_node *np,
66-
struct wand_rfkill_data *rfkill)
60+
struct wand_rfkill_data *rfkill,
61+
int wand_rev)
6762
{
6863
int ret;
6964
int wl_ref_on, wl_rst_n, wl_reg_on, wl_wake, wl_host_wake;
7065

71-
wl_ref_on = of_get_named_gpio(np, "wifi-ref-on", 0);
72-
wl_rst_n = of_get_named_gpio(np, "wifi-rst-n", 0);
66+
if(wand_rev){
67+
wl_ref_on = of_get_named_gpio(np, "wifi-ref-on-revc1", 0);
68+
wl_rst_n = of_get_named_gpio(np, "wifi-rst-n-revc1", 0);
69+
}
70+
else {
71+
wl_ref_on = of_get_named_gpio(np, "wifi-ref-on", 0);
72+
wl_rst_n = of_get_named_gpio(np, "wifi-rst-n", 0);
73+
}
74+
7375
wl_reg_on = of_get_named_gpio(np, "wifi-reg-on", 0);
7476
wl_wake = of_get_named_gpio(np, "wifi-wake", 0);
7577
wl_host_wake = of_get_named_gpio(np, "wifi-host-wake", 0);
@@ -134,14 +136,22 @@ static int wand_rfkill_wifi_probe(struct device *dev,
134136

135137
static int wand_rfkill_bt_probe(struct device *dev,
136138
struct device_node *np,
137-
struct wand_rfkill_data *rfkill)
139+
struct wand_rfkill_data *rfkill,
140+
int wand_rev)
138141
{
139142
int ret;
140143
int bt_on, bt_wake, bt_host_wake;
141144

142-
bt_on = of_get_named_gpio(np, "bluetooth-on", 0);
143-
bt_wake = of_get_named_gpio(np, "bluetooth-wake", 0);
144-
bt_host_wake = of_get_named_gpio(np, "bluetooth-host-wake", 0);
145+
if(wand_rev) {
146+
bt_on = of_get_named_gpio(np, "bluetooth-on-revc1", 0);
147+
bt_wake = of_get_named_gpio(np, "bluetooth-wake-revc1", 0);
148+
bt_host_wake = of_get_named_gpio(np, "bluetooth-host-wake-revc1", 0);
149+
}
150+
else{
151+
bt_on = of_get_named_gpio(np, "bluetooth-on", 0);
152+
bt_wake = of_get_named_gpio(np, "bluetooth-wake", 0);
153+
bt_host_wake = of_get_named_gpio(np, "bluetooth-host-wake", 0);
154+
}
145155

146156
if (!gpio_is_valid(bt_on) || !gpio_is_valid(bt_wake) ||
147157
!gpio_is_valid(bt_host_wake)) {
@@ -240,12 +250,12 @@ static int wand_rfkill_probe(struct platform_device *pdev)
240250
dev_info(&pdev->dev,"wandboard is rev B0\n");
241251

242252
/* setup WiFi */
243-
ret = wand_rfkill_wifi_probe(&pdev->dev, pdev->dev.of_node, &rfkill[0]);
253+
ret = wand_rfkill_wifi_probe(&pdev->dev, pdev->dev.of_node, &rfkill[0], wand_rev);
244254
if (ret < 0)
245255
goto fail_free_rfkill;
246256

247257
/* setup bluetooth */
248-
ret = wand_rfkill_bt_probe(&pdev->dev, pdev->dev.of_node, &rfkill[1]);
258+
ret = wand_rfkill_bt_probe(&pdev->dev, pdev->dev.of_node, &rfkill[1], wand_rev);
249259
if (ret < 0)
250260
goto fail_unregister_wifi;
251261

0 commit comments

Comments
 (0)