diff options
author | Matt Wagner <mwagner@nvidia.com> | 2011-11-16 14:33:40 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:52:41 -0800 |
commit | 29c591c6e0ec40116bd0fe5d8b947c420b37992b (patch) | |
tree | 0ef240f3d711ec362f6da80539831c4d43e8f310 /arch/arm/mach-tegra/board-ventana.c | |
parent | f2407b3eaf113450b42569cd5942a082f924f2ba (diff) |
ARM: Tegra 2/Tegra 3: Update bluesleep/rfkill registration
Modifies the bluesleep and rfkill platform driver registration to be more concise
and mirror the style of other similar code.
Change-Id: If5100248d0fe9cf00c1b78acbc72e3f45d173fa9
Signed-off-by: Matt Wagner <mwagner@nvidia.com>
Reviewed-on: http://git-master/r/64601
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
Rebase-Id: R0ec1bc987d0286bfdff3a5db5ccd142050a38872
Diffstat (limited to 'arch/arm/mach-tegra/board-ventana.c')
-rw-r--r-- | arch/arm/mach-tegra/board-ventana.c | 95 |
1 files changed, 32 insertions, 63 deletions
diff --git a/arch/arm/mach-tegra/board-ventana.c b/arch/arm/mach-tegra/board-ventana.c index 4aae246d014d..45333fb01206 100644 --- a/arch/arm/mach-tegra/board-ventana.c +++ b/arch/arm/mach-tegra/board-ventana.c @@ -93,8 +93,6 @@ static struct tegra_ulpi_config ulpi_phy_config = { .clk = "cdev2", }; -#ifdef CONFIG_BCM4329_RFKILL - static struct resource ventana_bcm4329_rfkill_resources[] = { { .name = "bcm4329_nshutdown_gpio", @@ -111,77 +109,49 @@ static struct platform_device ventana_bcm4329_rfkill_device = { .resource = ventana_bcm4329_rfkill_resources, }; -static noinline void __init ventana_bt_rfkill(void) +static void __init ventana_bt_rfkill(void) { /*Add Clock Resource*/ clk_add_alias("bcm4329_32k_clk", ventana_bcm4329_rfkill_device.name, \ "blink", NULL); - - platform_device_register(&ventana_bcm4329_rfkill_device); - return; } -#else -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 | IORESOURCE_IRQ_HIGHEDGE; - - if (platform_device_add_resources(pdev, res, 3)) { - pr_err("unable to add resources to bluesleep device\n"); - goto err_free_res; - } +static struct resource ventana_bluesleep_resources[] = { + [0] = { + .name = "gpio_host_wake", + .start = TEGRA_GPIO_PU6, + .end = TEGRA_GPIO_PU6, + .flags = IORESOURCE_IO, + }, + [1] = { + .name = "gpio_ext_wake", + .start = TEGRA_GPIO_PU1, + .end = TEGRA_GPIO_PU1, + .flags = IORESOURCE_IO, + }, + [2] = { + .name = "host_wake", + .start = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PU6), + .end = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PU6), + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, + }, +}; - if (platform_device_add(pdev)) { - pr_err("unable to add bluesleep device\n"); - goto err_free_res; - } +static struct platform_device ventana_bluesleep_device = { + .name = "bluesleep", + .id = -1, + .num_resources = ARRAY_SIZE(ventana_bluesleep_resources), + .resource = ventana_bluesleep_resources, +}; +static void __init ventana_setup_bluesleep(void) +{ + platform_device_register(&ventana_bluesleep_device); tegra_gpio_enable(TEGRA_GPIO_PU6); tegra_gpio_enable(TEGRA_GPIO_PU1); - - 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 */ @@ -448,6 +418,7 @@ static struct platform_device *ventana_devices[] __initdata = { &tegra_das_device, &spdif_dit_device, &bluetooth_dit_device, + &ventana_bcm4329_rfkill_device, &tegra_pcm_device, &ventana_audio_device, }; @@ -637,9 +608,7 @@ static void __init tegra_ventana_init(void) ventana_power_off_init(); ventana_emc_init(); -#ifdef CONFIG_BT_BLUESLEEP - tegra_setup_bluesleep(); -#endif + ventana_setup_bluesleep(); tegra_release_bootloader_fb(); } |