diff options
author | Anantha Idapalapati <aidapalapati@nvidia.com> | 2010-08-10 15:17:44 +0530 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-02-18 15:10:09 -0800 |
commit | 7a552541475bf74492cf586030470b1222040a63 (patch) | |
tree | 8e3e8b5d2bbf55e18a2b0ac30711a49873c90fae | |
parent | 3dd8821fd5ff588ac45e7fdd7b71f1cdc5c1eb22 (diff) |
tegra bluesleep: creating a bluesleep platform device.
Based on CONFIG_BT_BLUESLEEP configuration variable, a bluesleep device
will be created and used to actively manage the BT device power.
Bug 791669, 773186
(cherry picked from commit 011a705248274804c80c12af5366693e6662829b)
Reviewed-on: http://git-master/r/6851
Change-Id: If5275ecfc920a038ec96928ea7f7f739f5051e33
(cherry picked from commit ae1bf987d38b15d6688cd2152ee4b4624211c113)
Reviewed-on: http://git-master/r/19868
Reviewed-by: Anantha Idapalapati <aidapalapati@nvidia.com>
Tested-by: Anantha Idapalapati <aidapalapati@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
-rw-r--r-- | arch/arm/mach-tegra/board-ventana.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-ventana.c b/arch/arm/mach-tegra/board-ventana.c index a52820790521..4bf15a6b8919 100644 --- a/arch/arm/mach-tegra/board-ventana.c +++ b/arch/arm/mach-tegra/board-ventana.c @@ -170,6 +170,60 @@ static noinline void __init ventana_bt_rfkill(void) static inline void ventana_bt_rfkill(void) { } #endif +#ifdef CONFIG_BT_BLUESLEEP +static noinline void __init tegra_setup_bluesleep(void) +{ + struct platform_device *pdev = NULL; + struct resource *res; + + pdev = platform_device_alloc("bluesleep", 0); + if (!pdev) { + pr_err("unable to allocate platform device for bluesleep"); + return; + } + + res = kzalloc(sizeof(struct resource) * 3, GFP_KERNEL); + if (!res) { + pr_err("unable to allocate resource for bluesleep\n"); + goto err_free_dev; + } + + res[0].name = "gpio_host_wake"; + res[0].start = TEGRA_GPIO_PU6; + res[0].end = TEGRA_GPIO_PU6; + res[0].flags = IORESOURCE_IO; + + res[1].name = "gpio_ext_wake"; + res[1].start = TEGRA_GPIO_PU1; + res[1].end = TEGRA_GPIO_PU1; + res[1].flags = IORESOURCE_IO; + + res[2].name = "host_wake"; + res[2].start = gpio_to_irq(TEGRA_GPIO_PU6); + res[2].end = gpio_to_irq(TEGRA_GPIO_PU6); + res[2].flags = IORESOURCE_IRQ; + + if (platform_device_add_resources(pdev, res, 3)) { + pr_err("unable to add resources to bluesleep device\n"); + goto err_free_res; + } + + if (platform_device_add(pdev)) { + pr_err("unable to add bluesleep device\n"); + goto err_free_res; + } + return; + +err_free_res: + kfree(res); +err_free_dev: + platform_device_put(pdev); + return; +} +#else +static inline void tegra_setup_bluesleep(void) { } +#endif + static __initdata struct tegra_clk_init_table ventana_clk_init_table[] = { /* name parent rate enabled */ { "uartd", "pll_p", 216000000, true}, @@ -785,6 +839,9 @@ static void __init tegra_ventana_init(void) ventana_bt_rfkill(); ventana_power_off_init(); ventana_emc_init(); +#ifdef CONFIG_BT_BLUESLEEP + tegra_setup_bluesleep(); +#endif } int __init tegra_ventana_protected_aperture_init(void) |