diff options
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/configs/gta02-moredrivers-defconfig | 7 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/Kconfig | 6 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/neo1973_pm_bt.c | 59 |
3 files changed, 70 insertions, 2 deletions
diff --git a/arch/arm/configs/gta02-moredrivers-defconfig b/arch/arm/configs/gta02-moredrivers-defconfig index ef68a69eee9..823a3da8339 100644 --- a/arch/arm/configs/gta02-moredrivers-defconfig +++ b/arch/arm/configs/gta02-moredrivers-defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.28-rc4 -# Thu Nov 20 09:10:06 2008 +# Thu Nov 27 08:12:15 2008 # CONFIG_ARM=y CONFIG_HAVE_PWM=y @@ -628,7 +628,9 @@ CONFIG_WIRELESS_EXT=y CONFIG_WIRELESS_EXT_SYSFS=y # CONFIG_MAC80211 is not set # CONFIG_IEEE80211 is not set -# CONFIG_RFKILL is not set +CONFIG_RFKILL=y +CONFIG_RFKILL_INPUT=y +CONFIG_RFKILL_LEDS=y # CONFIG_NET_9P is not set # @@ -875,6 +877,7 @@ CONFIG_USB_ARMLINUX=y CONFIG_USB_EPSON2888=y CONFIG_USB_KC2190=y CONFIG_USB_NET_ZAURUS=m +# CONFIG_USB_HSO is not set # CONFIG_WAN is not set CONFIG_PPP=m CONFIG_PPP_MULTILINK=y diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig index 54b0ec4fa62..1bd3141a1d8 100644 --- a/arch/arm/plat-s3c24xx/Kconfig +++ b/arch/arm/plat-s3c24xx/Kconfig @@ -83,4 +83,10 @@ config MACH_SMDK help Common machine code for SMDK2410 and SMDK2440 +config MACH_NEO1973 + bool + select RFKILL + help + Common machine code for Neo1973 hardware + endif diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_bt.c b/arch/arm/plat-s3c24xx/neo1973_pm_bt.c index d3a046cada1..336c61e443c 100644 --- a/arch/arm/plat-s3c24xx/neo1973_pm_bt.c +++ b/arch/arm/plat-s3c24xx/neo1973_pm_bt.c @@ -15,6 +15,7 @@ #include <linux/init.h> #include <linux/kernel.h> #include <linux/platform_device.h> +#include <linux/rfkill.h> #include <linux/err.h> #include <mach/hardware.h> @@ -70,6 +71,41 @@ static ssize_t bt_read(struct device *dev, struct device_attribute *attr, } } +static int bt_rfkill_toggle_radio(void *data, enum rfkill_state state) +{ + struct device *dev = data; + unsigned long on = (state == RFKILL_STATE_ON); + unsigned int vol; + + if (machine_is_neo1973_gta01()) { + /* if we are powering up, assert reset, then power, + * then release reset */ + if (on) { + neo1973_gpb_setpin(GTA01_GPIO_BT_EN, 0); + pcf50606_voltage_set(pcf50606_global, + PCF50606_REGULATOR_D1REG, + 3100); + } + pcf50606_onoff_set(pcf50606_global, + PCF50606_REGULATOR_D1REG, on); + neo1973_gpb_setpin(GTA01_GPIO_BT_EN, on); + } else if (machine_is_neo1973_gta02()) { + if (s3c2410_gpio_getpin(GTA02_GPIO_BT_EN) == on) + return 0; + neo1973_gpb_setpin(GTA02_GPIO_BT_EN, !on); + pcf50633_voltage_set(pcf50633_global, + PCF50633_REGULATOR_LDO4, on ? 3200 : 0); + pcf50633_onoff_set(pcf50633_global, + PCF50633_REGULATOR_LDO4, on); + vol = pcf50633_voltage_get(pcf50633_global, + PCF50633_REGULATOR_LDO4); + dev_info(dev, "GTA02 Set PCF50633 LDO4 = %d\n", vol); + neo1973_gpb_setpin(GTA02_GPIO_BT_EN, on); + } + + return 0; +} + static ssize_t bt_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { @@ -79,6 +115,11 @@ static ssize_t bt_write(struct device *dev, struct device_attribute *attr, struct regulator *regulator; if (!strcmp(attr->attr.name, "power_on")) { + struct rfkill *rfkill = dev_get_drvdata(dev); + enum rfkill_state state = on ? RFKILL_STATE_ON : RFKILL_STATE_OFF; + bt_rfkill_toggle_radio(dev, state); + rfkill->state = state; + if (machine_is_neo1973_gta01()) { /* if we are powering up, assert reset, then power, * then release reset */ @@ -164,6 +205,7 @@ static struct attribute_group gta01_bt_attr_group = { static int __init gta01_bt_probe(struct platform_device *pdev) { + struct rfkill *rfkill; struct regulator *regulator; struct gta01_pm_bt_data *bt_data; @@ -194,16 +236,32 @@ static int __init gta01_bt_probe(struct platform_device *pdev) neo1973_gpb_setpin(GTA02_GPIO_BT_EN, 0); } + rfkill = rfkill_allocate(&pdev->dev, RFKILL_TYPE_BLUETOOTH); + + rfkill->name = pdev->name; + rfkill->data = pdev; + rfkill->state = -1; + rfkill->toggle_radio = bt_rfkill_toggle_radio; + + rfkill_register(rfkill); + + platform_set_drvdata(pdev, rfkill); + return sysfs_create_group(&pdev->dev.kobj, >a01_bt_attr_group); } static int gta01_bt_remove(struct platform_device *pdev) { + struct rfkill *rfkill = platform_get_drvdata(pdev); + struct gta01_pm_bt_data *bt_data; struct regulator *regulator; sysfs_remove_group(&pdev->dev.kobj, >a01_bt_attr_group); + rfkill_unregister(rfkill); + rfkill_free(rfkill); + bt_data = dev_get_drvdata(&pdev->dev); if (!bt_data || !bt_data->regulator) return 0; @@ -216,6 +274,7 @@ static int gta01_bt_remove(struct platform_device *pdev) regulator_put(regulator); +>>>>>>> patched return 0; } |