BT was using BT_REG_ON and Wlan was using WL_REG_ON.
4329 ORs both these GPIOs. However, there are problems
with BT_REG_ON while coming out of LP0 suspend.
So temporaraily have both wifi and BT use the same GPIO
for power on. For BT, set the BT_REG_ON to output low.
Change-Id: I75606ba124418fc7c606b434e4b7968fbc046228
Signed-off-by: Jaikumar Ganesh <jaikumar@google.com>
#define BT_WAKE_GPIO TEGRA_GPIO_PU1
#define BT_HOST_WAKE_GPIO TEGRA_GPIO_PU6
+extern void change_power_brcm_4329(bool);
static struct rfkill *bt_rfkill;
struct bcm_bt_lpm {
{
// rfkill_ops callback. Turn transmitter on when blocked is false
if (!blocked) {
+ change_power_brcm_4329(true);
gpio_direction_output(BT_RESET_GPIO, 1);
- gpio_direction_output(BT_SHUTDOWN_GPIO, 1);
+ gpio_direction_output(BT_SHUTDOWN_GPIO, 0);
} else {
+ change_power_brcm_4329(false);
gpio_direction_output(BT_SHUTDOWN_GPIO, 0);
gpio_direction_output(BT_RESET_GPIO, 0);
}
#include "gpio-names.h"
#define STINGRAY_WLAN_IRQ TEGRA_GPIO_PU5
-#define STINGRAY_WLAN_PWR TEGRA_GPIO_PU4
#define STINGRAY_WLAN_RST TEGRA_GPIO_PU2
#define ATAG_STINGRAY_MAC 0x57464d41
pr_debug("%s: %d\n", __func__, on);
mdelay(100);
- gpio_set_value(STINGRAY_WLAN_PWR, on);
+ change_power_brcm_4329(on);
mdelay(100);
gpio_set_value(STINGRAY_WLAN_RST, on);
mdelay(200);
static void __init stingray_wlan_gpio(void)
{
- tegra_gpio_enable(STINGRAY_WLAN_PWR);
- gpio_request(STINGRAY_WLAN_PWR, "wlan_pwr");
- gpio_direction_output(STINGRAY_WLAN_PWR, 0);
-
tegra_gpio_enable(STINGRAY_WLAN_RST);
gpio_request(STINGRAY_WLAN_RST, "wlan_rst");
gpio_direction_output(STINGRAY_WLAN_RST, 0);
}
__tagtable(ATAG_BDADDR, parse_tag_bdaddr);
+static DEFINE_SPINLOCK(brcm_4329_enable_lock);
+static int brcm_4329_enable_count;
+
static void stingray_w1_init(void)
{
tegra_w1_device.dev.platform_data = &tegra_w1_pdata;
}
}
+void change_power_brcm_4329(bool enable) {
+ unsigned long flags;
+
+ spin_lock_irqsave(&brcm_4329_enable_lock, flags);
+ if (enable) {
+ gpio_set_value(TEGRA_GPIO_PU4, enable);
+ brcm_4329_enable_count++;
+ // The following shouldn't happen but protect
+ // if the user doesn't cleanup.
+ if (brcm_4329_enable_count > 2)
+ brcm_4329_enable_count = 2;
+ } else {
+ if (brcm_4329_enable_count > 0)
+ brcm_4329_enable_count--;
+ if (!brcm_4329_enable_count)
+ gpio_set_value(TEGRA_GPIO_PU4, enable);
+ }
+ spin_unlock_irqrestore(&brcm_4329_enable_lock, flags);
+}
+
static void __init tegra_stingray_init(void)
{
struct clk *clk;
tegra_dvfs_rail_disable_by_name("vdd_core");
}
+ /* Enable 4329 Power GPIO */
+ tegra_gpio_enable(TEGRA_GPIO_PU4);
+ gpio_request(TEGRA_GPIO_PU4, "4329_pwr");
+ gpio_direction_output(TEGRA_GPIO_PU4, 0);
+
stingray_pinmux_init();
tegra_clk_init_from_table(stingray_clk_init_table);
void stingray_gps_init(void);
int stingray_qbp_usb_hw_bypass_enabled(void);
void stingray_init_emc(void);
+void change_power_brcm_4329(bool);
/* as defined in the bootloader*/
#define HWREV(x) (((x)>>16) & 0xFFFF)