diff options
Diffstat (limited to 'arch/arm/mach-exynos/board-gps-bcm475x.c')
-rw-r--r-- | arch/arm/mach-exynos/board-gps-bcm475x.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/arch/arm/mach-exynos/board-gps-bcm475x.c b/arch/arm/mach-exynos/board-gps-bcm475x.c index 7b9a1c7..841c1de 100644 --- a/arch/arm/mach-exynos/board-gps-bcm475x.c +++ b/arch/arm/mach-exynos/board-gps-bcm475x.c @@ -6,10 +6,18 @@ #include <plat/gpio-cfg.h> #include <mach/board-gps.h> -#if !defined(CONFIG_MACH_M0_GRANDECTC) +#if !defined(CONFIG_MACH_M0_GRANDECTC) && !defined(CONFIG_MACH_M0_DUOSCTC) static struct device *gps_dev; +static ssize_t hwrev_show(struct device *dev, \ +struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "%x\n", system_rev); +} + +static DEVICE_ATTR(hwrev, S_IRUGO, hwrev_show, NULL); + static int __init gps_bcm475x_init(void) { int n_rst_pin = 0; @@ -28,28 +36,32 @@ static int __init gps_bcm475x_init(void) s3c_gpio_setpull(GPIO_GPS_RTS, S3C_GPIO_PULL_NONE); #ifdef CONFIG_MACH_P2 - n_rst_pin = GPIO_GPS_nRST_28V; - n_rst_nc_pin = GPIO_GPS_nRST; + n_rst_pin = system_rev >= 5 ? + GPIO_GPS_nRST_28V : GPIO_GPS_nRST; #else n_rst_pin = GPIO_GPS_nRST; - n_rst_nc_pin = 0; #endif - if (gpio_request(n_rst_pin, "GPS_nRST")) + if (gpio_request(n_rst_pin, "GPS_nRST")) { WARN(1, "fail to request gpio (GPS_nRST)\n"); + device_destroy(sec_class, gps_dev->devt); + return 1; + } + + if (device_create_file(gps_dev, &dev_attr_hwrev) < 0) { + pr_err("Failed to create device file(%s)!\n", + dev_attr_hwrev.attr.name); + } s3c_gpio_setpull(n_rst_pin, S3C_GPIO_PULL_UP); s3c_gpio_cfgpin(n_rst_pin, S3C_GPIO_OUTPUT); gpio_direction_output(n_rst_pin, 1); - if (gpio_request(GPIO_GPS_PWR_EN, "GPS_PWR_EN")) + if (gpio_request(GPIO_GPS_PWR_EN, "GPS_PWR_EN")) { WARN(1, "fail to request gpio (GPS_PWR_EN)\n"); - -#ifdef CONFIG_MACH_P2 - gpio_set_value(n_rst_nc_pin, 0); - s3c_gpio_cfgpin(n_rst_nc_pin, S3C_GPIO_OUTPUT); - s3c_gpio_setpull(n_rst_nc_pin, S3C_GPIO_PULL_NONE); -#endif + device_destroy(sec_class, gps_dev->devt); + return 1; + } s3c_gpio_setpull(GPIO_GPS_PWR_EN, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(GPIO_GPS_PWR_EN, S3C_GPIO_OUTPUT); @@ -61,6 +73,8 @@ static int __init gps_bcm475x_init(void) gpio_export_link(gps_dev, "GPS_nRST", n_rst_pin); gpio_export_link(gps_dev, "GPS_PWR_EN", GPIO_GPS_PWR_EN); + printk(KERN_DEBUG "%s - system_rev : %x\n", __func__, system_rev); + return 0; } |