From: Jaikumar Ganesh Date: Wed, 15 Dec 2010 00:46:05 +0000 (-0800) Subject: [ARM] tegra: stingray: Rename rfkill driver to stingray-bluetooth. X-Git-Tag: firefly_0821_release~9834^2~245 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=36b2376b0a80a081d518309416bc60636fe7e107;p=firefly-linux-kernel-4.4.55.git [ARM] tegra: stingray: Rename rfkill driver to stingray-bluetooth. This rename is being done with the future addition of low power driver to rfkill driver. Change-Id: I678a579af60aea8c72cee43c36cc292260350033 Signed-off-by: Jaikumar Ganesh --- diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index eeb20d894823..3fc877683894 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile @@ -67,7 +67,7 @@ obj-${CONFIG_MACH_STINGRAY} += board-stingray-sensors.o obj-${CONFIG_MACH_STINGRAY} += board-stingray-wlan_nvs.o obj-${CONFIG_MACH_STINGRAY} += board-stingray-touch.o obj-${CONFIG_MACH_STINGRAY} += board-stingray-power.o -obj-${CONFIG_MACH_STINGRAY} += board-stingray-rfkill.o +obj-${CONFIG_MACH_STINGRAY} += board-stingray-bluetooth.o obj-${CONFIG_MACH_STINGRAY} += board-stingray-gps.o obj-${CONFIG_MACH_STINGRAY} += board-stingray-usbnet.o obj-${CONFIG_MACH_STINGRAY} += board-stingray-bootinfo.o diff --git a/arch/arm/mach-tegra/board-stingray-bluetooth.c b/arch/arm/mach-tegra/board-stingray-bluetooth.c new file mode 100644 index 000000000000..bdad69390dbf --- /dev/null +++ b/arch/arm/mach-tegra/board-stingray-bluetooth.c @@ -0,0 +1,125 @@ +/* + * Bluetooth Broadcomm rfkill power control via GPIO + * + * Copyright (C) 2010 Google, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include +#include +#include + +#include "gpio-names.h" + +#define BT_SHUTDOWN_GPIO TEGRA_GPIO_PI7 +#define BT_RESET_GPIO TEGRA_GPIO_PU0 + +static struct rfkill *bt_rfkill; + +static int bcm4329_bt_rfkill_set_power(void *data, bool blocked) +{ + if (blocked) { + gpio_direction_output(BT_SHUTDOWN_GPIO, 0); + gpio_direction_output(BT_RESET_GPIO, 0); + } else { + gpio_direction_output(BT_RESET_GPIO, 1); + gpio_direction_output(BT_SHUTDOWN_GPIO, 1); + } + + return 0; +} + +static const struct rfkill_ops bcm4329_bt_rfkill_ops = { + .set_block = bcm4329_bt_rfkill_set_power, +}; + +static int bcm4329_rfkill_probe(struct platform_device *pdev) +{ + int rc = 0; + bool default_state = true; /* off */ + + tegra_gpio_enable(BT_RESET_GPIO); + rc = gpio_request(BT_RESET_GPIO, "bcm4329_nreset_gpip"); + if (unlikely(rc)) + return rc; + + + tegra_gpio_enable(BT_SHUTDOWN_GPIO); + rc = gpio_request(BT_SHUTDOWN_GPIO, "bcm4329_nshutdown_gpio"); + if (unlikely(rc)) + return rc; + + bcm4329_bt_rfkill_set_power(NULL, default_state); + + bt_rfkill = rfkill_alloc("bcm4329 Bluetooth", &pdev->dev, + RFKILL_TYPE_BLUETOOTH, &bcm4329_bt_rfkill_ops, + NULL); + + if (unlikely(!bt_rfkill)) + return -ENOMEM; + + rfkill_set_states(bt_rfkill, default_state, false); + + rc = rfkill_register(bt_rfkill); + + if (unlikely(rc)) + rfkill_destroy(bt_rfkill); + + return 0; +} + +static int bcm4329_rfkill_remove(struct platform_device *pdev) +{ + rfkill_unregister(bt_rfkill); + rfkill_destroy(bt_rfkill); + gpio_free(BT_SHUTDOWN_GPIO); + gpio_free(BT_RESET_GPIO); + + return 0; +} + +static struct platform_driver bcm4329_rfkill_platform_driver = { + .probe = bcm4329_rfkill_probe, + .remove = bcm4329_rfkill_remove, + .driver = { + .name = "bcm4329_rfkill", + .owner = THIS_MODULE, + }, +}; + +static int __init bcm4329_rfkill_init(void) +{ + if (!machine_is_stingray()) + return 0; + return platform_driver_register(&bcm4329_rfkill_platform_driver); +} + +static void __exit bcm4329_rfkill_exit(void) +{ + platform_driver_unregister(&bcm4329_rfkill_platform_driver); +} + +module_init(bcm4329_rfkill_init); +module_exit(bcm4329_rfkill_exit); + +MODULE_ALIAS("platform:bcm4329"); +MODULE_DESCRIPTION("bcm4329_rfkill"); +MODULE_AUTHOR("Jaikumar Ganesh "); +MODULE_LICENSE("GPL"); diff --git a/arch/arm/mach-tegra/board-stingray-rfkill.c b/arch/arm/mach-tegra/board-stingray-rfkill.c deleted file mode 100644 index bdad69390dbf..000000000000 --- a/arch/arm/mach-tegra/board-stingray-rfkill.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Bluetooth Broadcomm rfkill power control via GPIO - * - * Copyright (C) 2010 Google, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include -#include - -#include "gpio-names.h" - -#define BT_SHUTDOWN_GPIO TEGRA_GPIO_PI7 -#define BT_RESET_GPIO TEGRA_GPIO_PU0 - -static struct rfkill *bt_rfkill; - -static int bcm4329_bt_rfkill_set_power(void *data, bool blocked) -{ - if (blocked) { - gpio_direction_output(BT_SHUTDOWN_GPIO, 0); - gpio_direction_output(BT_RESET_GPIO, 0); - } else { - gpio_direction_output(BT_RESET_GPIO, 1); - gpio_direction_output(BT_SHUTDOWN_GPIO, 1); - } - - return 0; -} - -static const struct rfkill_ops bcm4329_bt_rfkill_ops = { - .set_block = bcm4329_bt_rfkill_set_power, -}; - -static int bcm4329_rfkill_probe(struct platform_device *pdev) -{ - int rc = 0; - bool default_state = true; /* off */ - - tegra_gpio_enable(BT_RESET_GPIO); - rc = gpio_request(BT_RESET_GPIO, "bcm4329_nreset_gpip"); - if (unlikely(rc)) - return rc; - - - tegra_gpio_enable(BT_SHUTDOWN_GPIO); - rc = gpio_request(BT_SHUTDOWN_GPIO, "bcm4329_nshutdown_gpio"); - if (unlikely(rc)) - return rc; - - bcm4329_bt_rfkill_set_power(NULL, default_state); - - bt_rfkill = rfkill_alloc("bcm4329 Bluetooth", &pdev->dev, - RFKILL_TYPE_BLUETOOTH, &bcm4329_bt_rfkill_ops, - NULL); - - if (unlikely(!bt_rfkill)) - return -ENOMEM; - - rfkill_set_states(bt_rfkill, default_state, false); - - rc = rfkill_register(bt_rfkill); - - if (unlikely(rc)) - rfkill_destroy(bt_rfkill); - - return 0; -} - -static int bcm4329_rfkill_remove(struct platform_device *pdev) -{ - rfkill_unregister(bt_rfkill); - rfkill_destroy(bt_rfkill); - gpio_free(BT_SHUTDOWN_GPIO); - gpio_free(BT_RESET_GPIO); - - return 0; -} - -static struct platform_driver bcm4329_rfkill_platform_driver = { - .probe = bcm4329_rfkill_probe, - .remove = bcm4329_rfkill_remove, - .driver = { - .name = "bcm4329_rfkill", - .owner = THIS_MODULE, - }, -}; - -static int __init bcm4329_rfkill_init(void) -{ - if (!machine_is_stingray()) - return 0; - return platform_driver_register(&bcm4329_rfkill_platform_driver); -} - -static void __exit bcm4329_rfkill_exit(void) -{ - platform_driver_unregister(&bcm4329_rfkill_platform_driver); -} - -module_init(bcm4329_rfkill_init); -module_exit(bcm4329_rfkill_exit); - -MODULE_ALIAS("platform:bcm4329"); -MODULE_DESCRIPTION("bcm4329_rfkill"); -MODULE_AUTHOR("Jaikumar Ganesh "); -MODULE_LICENSE("GPL");