diff options
author | Werner Almesberger <werner@openmoko.org> | 2008-11-19 17:11:18 +0000 |
---|---|---|
committer | Andy Green <agreen@pads.home.warmcat.com> | 2008-11-19 17:11:18 +0000 |
commit | a4240473c8db6aeeccf652463013f8d587424cb3 (patch) | |
tree | 2a1e37d9360357e39a83f318d997991019274aaf /arch | |
parent | 6c0fd2797073f5a133c943cf62e131dfc0699f83 (diff) |
fix-wlan-share-bringup.patch
Use the same code for bringup during initialization and when switching
the module on/off through sysfs.
This also solves the problem of not resetting the WLAN module, which
was caused by fix-set-wlan-power-mgt-to-default-on.patch only partially
reverting the power-off default introduced with
introduce-gta02-pm-wlan.patch.
Signed-off-by: Werner Almesberger <werner@openmoko.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/plat-s3c24xx/gta02_pm_wlan.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/arch/arm/plat-s3c24xx/gta02_pm_wlan.c b/arch/arm/plat-s3c24xx/gta02_pm_wlan.c index 7c6154d4970..b55ba241494 100644 --- a/arch/arm/plat-s3c24xx/gta02_pm_wlan.c +++ b/arch/arm/plat-s3c24xx/gta02_pm_wlan.c @@ -26,25 +26,13 @@ #include <linux/delay.h> -static ssize_t gta02_wlan_read(struct device *dev, - struct device_attribute *attr, char *buf) -{ - if (s3c2410_gpio_getpin(GTA02_CHIP_PWD)) - return strlcpy(buf, "0\n", 3); - - return strlcpy(buf, "1\n", 3); -} -static ssize_t gta02_wlan_write(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) +static void gta02_wlan_power(int on) { - unsigned long on = simple_strtoul(buf, NULL, 10) & 1; - if (!on) { s3c2410_gpio_setpin(GTA02_CHIP_PWD, 1); s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET, 0); - - return count; + return; } /* power up sequencing */ @@ -56,6 +44,23 @@ static ssize_t gta02_wlan_write(struct device *dev, msleep(100); s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET, 1); +} + +static ssize_t gta02_wlan_read(struct device *dev, + struct device_attribute *attr, char *buf) +{ + if (s3c2410_gpio_getpin(GTA02_CHIP_PWD)) + return strlcpy(buf, "0\n", 3); + + return strlcpy(buf, "1\n", 3); +} + +static ssize_t gta02_wlan_write(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) +{ + unsigned long on = simple_strtoul(buf, NULL, 10) & 1; + + gta02_wlan_power(on); return count; } @@ -100,12 +105,9 @@ static int __init gta02_wlan_probe(struct platform_device *pdev) dev_info(&pdev->dev, "starting\n"); - /* Power is down */ - s3c2410_gpio_setpin(GTA02_CHIP_PWD, !default_state); s3c2410_gpio_cfgpin(GTA02_CHIP_PWD, S3C2410_GPIO_OUTPUT); - /* reset is asserted */ - s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET, default_state); s3c2410_gpio_cfgpin(GTA02_GPIO_nWLAN_RESET, S3C2410_GPIO_OUTPUT); + gta02_wlan_power(default_state); return sysfs_create_group(&pdev->dev.kobj, >a02_wlan_attr_group); } |