diff options
-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); } |