summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorMatt Wagner <mwagner@nvidia.com>2011-11-16 14:33:40 -0800
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:52:41 -0800
commit29c591c6e0ec40116bd0fe5d8b947c420b37992b (patch)
tree0ef240f3d711ec362f6da80539831c4d43e8f310 /arch
parentf2407b3eaf113450b42569cd5942a082f924f2ba (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')
-rw-r--r--arch/arm/mach-tegra/board-cardhu.c92
-rw-r--r--arch/arm/mach-tegra/board-enterprise.c84
-rw-r--r--arch/arm/mach-tegra/board-ventana.c95
-rw-r--r--arch/arm/mach-tegra/board-whistler.c97
4 files changed, 121 insertions, 247 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu.c b/arch/arm/mach-tegra/board-cardhu.c
index 10267288f805..a63e32186080 100644
--- a/arch/arm/mach-tegra/board-cardhu.c
+++ b/arch/arm/mach-tegra/board-cardhu.c
@@ -100,7 +100,6 @@ static struct tegra_utmip_config utmi_phy_config[] = {
},
};
-#ifdef CONFIG_BCM4329_RFKILL
static struct resource cardhu_bcm4329_rfkill_resources[] = {
{
.name = "bcm4329_nshutdown_gpio",
@@ -117,72 +116,41 @@ static struct platform_device cardhu_bcm4329_rfkill_device = {
.resource = cardhu_bcm4329_rfkill_resources,
};
-static noinline void __init cardhu_bt_rfkill(void)
-{
- platform_device_register(&cardhu_bcm4329_rfkill_device);
+static struct resource cardhu_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,
+ },
+};
- return;
-}
-#else
-static inline void cardhu_bt_rfkill(void) { }
-#endif
+static struct platform_device cardhu_bluesleep_device = {
+ .name = "bluesleep",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(cardhu_bluesleep_resources),
+ .resource = cardhu_bluesleep_resources,
+};
-#ifdef CONFIG_BT_BLUESLEEP
-static noinline void __init tegra_setup_bluesleep(void)
+static noinline void __init cardhu_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;
- }
-
- if (platform_device_add(pdev)) {
- pr_err("unable to add bluesleep device\n");
- goto err_free_res;
- }
+ platform_device_register(&cardhu_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 cardhu_clk_init_table[] = {
/* name parent rate enabled */
@@ -587,6 +555,7 @@ static struct platform_device *cardhu_devices[] __initdata = {
&tegra_spdif_device,
&spdif_dit_device,
&bluetooth_dit_device,
+ &cardhu_bcm4329_rfkill_device,
&tegra_pcm_device,
&cardhu_audio_device,
&tegra_hda_device,
@@ -970,8 +939,7 @@ static void __init tegra_cardhu_init(void)
cardhu_panel_init();
cardhu_pmon_init();
cardhu_sensors_init();
- cardhu_bt_rfkill();
- tegra_setup_bluesleep();
+ cardhu_setup_bluesleep();
cardhu_sata_init();
//audio_wired_jack_init();
cardhu_pins_state_init();
diff --git a/arch/arm/mach-tegra/board-enterprise.c b/arch/arm/mach-tegra/board-enterprise.c
index ed87360062bc..f3b10467f8e7 100644
--- a/arch/arm/mach-tegra/board-enterprise.c
+++ b/arch/arm/mach-tegra/board-enterprise.c
@@ -99,7 +99,6 @@ static struct tegra_utmip_config utmi_phy_config[] = {
},
};
-#ifdef CONFIG_BCM4329_RFKILL
static struct resource enterprise_bcm4329_rfkill_resources[] = {
{
.name = "bcm4329_nshutdown_gpio",
@@ -116,66 +115,39 @@ static struct platform_device enterprise_bcm4329_rfkill_device = {
.resource = enterprise_bcm4329_rfkill_resources,
};
-static noinline void __init enterprise_bt_rfkill(void)
-{
- platform_device_register(&enterprise_bcm4329_rfkill_device);
+static struct resource enterprise_bluesleep_resources[] = {
+ [0] = {
+ .name = "gpio_host_wake",
+ .start = TEGRA_GPIO_PS2,
+ .end = TEGRA_GPIO_PS2,
+ .flags = IORESOURCE_IO,
+ },
+ [1] = {
+ .name = "gpio_ext_wake",
+ .start = TEGRA_GPIO_PE7,
+ .end = TEGRA_GPIO_PE7,
+ .flags = IORESOURCE_IO,
+ },
+ [2] = {
+ .name = "host_wake",
+ .start = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PS2),
+ .end = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PS2),
+ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
+ },
+};
- return;
-}
-#else
-static inline void enterprise_bt_rfkill(void) { }
-#endif
+static struct platform_device enterprise_bluesleep_device = {
+ .name = "bluesleep",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(enterprise_bluesleep_resources),
+ .resource = enterprise_bluesleep_resources,
+};
static void __init enterprise_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_PS2;
- res[0].end = TEGRA_GPIO_PS2;
- res[0].flags = IORESOURCE_IO;
-
- res[1].name = "gpio_ext_wake";
- res[1].start = TEGRA_GPIO_PE7;
- res[1].end = TEGRA_GPIO_PE7;
- res[1].flags = IORESOURCE_IO;
-
- res[2].name = "host_wake";
- res[2].start = gpio_to_irq(TEGRA_GPIO_PS2);
- res[2].end = gpio_to_irq(TEGRA_GPIO_PS2);
- 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;
- }
-
- if (platform_device_add(pdev)) {
- pr_err("unable to add bluesleep device\n");
- goto err_free_res;
- }
+ platform_device_register(&enterprise_bluesleep_device);
tegra_gpio_enable(TEGRA_GPIO_PS2);
tegra_gpio_enable(TEGRA_GPIO_PE7);
-
- return;
-
-err_free_res:
- kfree(res);
-err_free_dev:
- platform_device_put(pdev);
return;
}
@@ -543,6 +515,7 @@ static struct platform_device *enterprise_devices[] __initdata = {
&tegra_spdif_device,
&spdif_dit_device,
&bluetooth_dit_device,
+ &enterprise_bcm4329_rfkill_device,
&baseband_dit_device,
&tegra_pcm_device,
&enterprise_audio_device,
@@ -849,7 +822,6 @@ static void __init tegra_enterprise_init(void)
enterprise_gps_init();
enterprise_baseband_init();
enterprise_panel_init();
- enterprise_bt_rfkill();
enterprise_setup_bluesleep();
enterprise_emc_init();
enterprise_sensors_init();
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();
}
diff --git a/arch/arm/mach-tegra/board-whistler.c b/arch/arm/mach-tegra/board-whistler.c
index 0f0fa84d0e40..c27ec1edc5a0 100644
--- a/arch/arm/mach-tegra/board-whistler.c
+++ b/arch/arm/mach-tegra/board-whistler.c
@@ -158,8 +158,6 @@ static void __init whistler_uart_init(void)
ARRAY_SIZE(whistler_uart_devices));
}
-#ifdef CONFIG_BCM4329_RFKILL
-
static struct resource whistler_bcm4329_rfkill_resources[] = {
{
.name = "bcm4329_nshutdown_gpio",
@@ -176,72 +174,41 @@ static struct platform_device whistler_bcm4329_rfkill_device = {
.resource = whistler_bcm4329_rfkill_resources,
};
-static noinline void __init whistler_bt_rfkill(void)
-{
- platform_device_register(&whistler_bcm4329_rfkill_device);
- return;
-}
-#else
-static inline void whistler_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 whistler_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 whistler_bluesleep_device = {
+ .name = "bluesleep",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(whistler_bluesleep_resources),
+ .resource = whistler_bluesleep_resources,
+};
+static void __init whistler_setup_bluesleep(void)
+{
+ platform_device_register(&whistler_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 struct tegra_utmip_config utmi_phy_config[] = {
[0] = {
@@ -402,6 +369,7 @@ static struct platform_device *whistler_devices[] __initdata = {
&tegra_das_device,
&spdif_dit_device,
&bluetooth_dit_device,
+ &whistler_bcm4329_rfkill_device,
&tegra_pcm_device,
&whistler_audio_device,
};
@@ -524,16 +492,13 @@ static void __init tegra_whistler_init(void)
whistler_sensors_init();
whistler_touch_init();
whistler_kbc_init();
- whistler_bt_rfkill();
whistler_gps_init();
whistler_usb_init();
whistler_scroll_init();
whistler_power_off_init();
whistler_emc_init();
whistler_baseband_init();
-#ifdef CONFIG_BT_BLUESLEEP
- tegra_setup_bluesleep();
-#endif
+ whistler_setup_bluesleep();
tegra_release_bootloader_fb();
}