mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-06 11:36:18 +02:00
a95f9f92e2
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@13619 3c298f89-4303-0410-b956-a3cf2f4a3e73
587 lines
17 KiB
Diff
Executable File
587 lines
17 KiB
Diff
Executable File
From 70a0c17968f5151ce4f468785860e04bbc7a9d3c Mon Sep 17 00:00:00 2001
|
|
From: mokopatches <mokopatches@openmoko.org>
|
|
Date: Wed, 16 Jul 2008 14:46:56 +0100
|
|
Subject: [PATCH] gta02-power_control.patch
|
|
|
|
---
|
|
arch/arm/plat-s3c24xx/neo1973_pm_bt.c | 84 +++++++++---
|
|
arch/arm/plat-s3c24xx/neo1973_pm_gps.c | 217 ++++++++++++++++++++++++--------
|
|
arch/arm/plat-s3c24xx/neo1973_pm_gsm.c | 97 ++++++++++++--
|
|
3 files changed, 309 insertions(+), 89 deletions(-)
|
|
|
|
diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_bt.c b/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
|
|
index b1af441..d685ef7 100644
|
|
--- a/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
|
|
+++ b/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
|
|
@@ -19,7 +19,9 @@
|
|
#include <linux/pcf50606.h>
|
|
|
|
#include <asm/hardware.h>
|
|
+#include <asm/mach-types.h>
|
|
#include <asm/arch/gta01.h>
|
|
+#include <asm/arch/gta02.h>
|
|
|
|
#define DRVMSG "FIC Neo1973 Bluetooth Power Management"
|
|
|
|
@@ -27,14 +29,30 @@ static ssize_t bt_read(struct device *dev, struct device_attribute *attr,
|
|
char *buf)
|
|
{
|
|
if (!strcmp(attr->attr.name, "power_on")) {
|
|
- if (pcf50606_onoff_get(pcf50606_global,
|
|
- PCF50606_REGULATOR_D1REG) &&
|
|
- pcf50606_voltage_get(pcf50606_global,
|
|
- PCF50606_REGULATOR_D1REG) == 3100)
|
|
- goto out_1;
|
|
+ switch (machine_arch_type) {
|
|
+ case MACH_TYPE_NEO1973_GTA01:
|
|
+ if (pcf50606_onoff_get(pcf50606_global,
|
|
+ PCF50606_REGULATOR_D1REG) &&
|
|
+ pcf50606_voltage_get(pcf50606_global,
|
|
+ PCF50606_REGULATOR_D1REG) == 3100)
|
|
+ goto out_1;
|
|
+ break;
|
|
+ case MACH_TYPE_NEO1973_GTA02:
|
|
+ if (s3c2410_gpio_getpin(GTA02_GPIO_BT_EN))
|
|
+ goto out_1;
|
|
+ break;
|
|
+ }
|
|
} else if (!strcmp(attr->attr.name, "reset")) {
|
|
- if (s3c2410_gpio_getpin(GTA01_GPIO_BT_EN) == 0)
|
|
- goto out_1;
|
|
+ switch (machine_arch_type) {
|
|
+ case MACH_TYPE_NEO1973_GTA01:
|
|
+ if (s3c2410_gpio_getpin(GTA01_GPIO_BT_EN) == 0)
|
|
+ goto out_1;
|
|
+ break;
|
|
+ case MACH_TYPE_NEO1973_GTA02:
|
|
+ if (s3c2410_gpio_getpin(GTA02_GPIO_BT_EN) == 0)
|
|
+ goto out_1;
|
|
+ break;
|
|
+ }
|
|
}
|
|
|
|
return strlcpy(buf, "0\n", 3);
|
|
@@ -48,20 +66,37 @@ static ssize_t bt_write(struct device *dev, struct device_attribute *attr,
|
|
unsigned long on = simple_strtoul(buf, NULL, 10);
|
|
|
|
if (!strcmp(attr->attr.name, "power_on")) {
|
|
- /* if we are powering up, assert reset, then power, then
|
|
- * release reset */
|
|
- if (on) {
|
|
- s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, 0);
|
|
- pcf50606_voltage_set(pcf50606_global,
|
|
- PCF50606_REGULATOR_D1REG,
|
|
- 3100);
|
|
+ switch (machine_arch_type) {
|
|
+ case MACH_TYPE_NEO1973_GTA01:
|
|
+ /* if we are powering up, assert reset, then power,
|
|
+ * then release reset */
|
|
+ if (on) {
|
|
+ s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, 0);
|
|
+ pcf50606_voltage_set(pcf50606_global,
|
|
+ PCF50606_REGULATOR_D1REG,
|
|
+ 3100);
|
|
+ }
|
|
+ pcf50606_onoff_set(pcf50606_global,
|
|
+ PCF50606_REGULATOR_D1REG, on);
|
|
+ s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, on);
|
|
+ break;
|
|
+ case MACH_TYPE_NEO1973_GTA02:
|
|
+ if (on)
|
|
+ s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, 0);
|
|
+ else
|
|
+ s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, 1);
|
|
+ break;
|
|
}
|
|
- pcf50606_onoff_set(pcf50606_global,
|
|
- PCF50606_REGULATOR_D1REG, on);
|
|
- s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, on);
|
|
} else if (!strcmp(attr->attr.name, "reset")) {
|
|
/* reset is low-active, so we need to invert */
|
|
- s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, on ? 0 : 1);
|
|
+ switch (machine_arch_type) {
|
|
+ case MACH_TYPE_NEO1973_GTA01:
|
|
+ s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, on ? 0 : 1);
|
|
+ break;
|
|
+ case MACH_TYPE_NEO1973_GTA02:
|
|
+ s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, on ? 0 : 1);
|
|
+ break;
|
|
+ }
|
|
}
|
|
|
|
return count;
|
|
@@ -107,9 +142,16 @@ static int __init gta01_bt_probe(struct platform_device *pdev)
|
|
{
|
|
dev_info(&pdev->dev, DRVMSG ": starting\n");
|
|
|
|
- /* we make sure that the voltage is off */
|
|
- pcf50606_onoff_set(pcf50606_global,
|
|
- PCF50606_REGULATOR_D1REG, 0);
|
|
+ switch (machine_arch_type) {
|
|
+ case MACH_TYPE_NEO1973_GTA01:
|
|
+ /* we make sure that the voltage is off */
|
|
+ pcf50606_onoff_set(pcf50606_global,
|
|
+ PCF50606_REGULATOR_D1REG, 0);
|
|
+ break;
|
|
+ case MACH_TYPE_NEO1973_GTA02:
|
|
+ /* FIXME: implementation */
|
|
+ break;
|
|
+ }
|
|
/* we pull reset to low to make sure that the chip doesn't
|
|
* drain power through the reset line */
|
|
s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, 0);
|
|
diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gps.c b/arch/arm/plat-s3c24xx/neo1973_pm_gps.c
|
|
index f8cf719..6bd8054 100644
|
|
--- a/arch/arm/plat-s3c24xx/neo1973_pm_gps.c
|
|
+++ b/arch/arm/plat-s3c24xx/neo1973_pm_gps.c
|
|
@@ -17,10 +17,18 @@
|
|
#include <linux/delay.h>
|
|
#include <linux/platform_device.h>
|
|
|
|
-#include <linux/pcf50606.h>
|
|
-
|
|
#include <asm/hardware.h>
|
|
+
|
|
+#include <asm/mach-types.h>
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA01
|
|
#include <asm/arch/gta01.h>
|
|
+#include <linux/pcf50606.h>
|
|
+#endif
|
|
+
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA02
|
|
+#include <asm/arch/gta02.h>
|
|
+#include <linux/pcf50633.h>
|
|
+#endif
|
|
|
|
/* This is the 2.8V supply for the RTC crystal, the mail clock crystal and
|
|
* the input to VDD_RF */
|
|
@@ -248,15 +256,42 @@ static int gps_power_1v5_get(void)
|
|
/* This is the POWERON pin */
|
|
static void gps_pwron_set(int on)
|
|
{
|
|
- s3c2410_gpio_setpin(GTA01_GPIO_GPS_PWRON, on);
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA01
|
|
+ if (machine_is_neo1973_gta01())
|
|
+ s3c2410_gpio_setpin(GTA01_GPIO_GPS_PWRON, on);
|
|
+#endif /* CONFIG_MACH_NEO1973_GTA01 */
|
|
+
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA02
|
|
+ if (machine_is_neo1973_gta02()) {
|
|
+ if (on)
|
|
+ pcf50633_voltage_set(pcf50633_global,
|
|
+ PCF50633_REGULATOR_LDO5, 3000);
|
|
+ pcf50633_onoff_set(pcf50633_global,
|
|
+ PCF50633_REGULATOR_LDO5, on);
|
|
+ }
|
|
+#endif /* CONFIG_MACH_NEO1973_GTA02 */
|
|
}
|
|
|
|
static int gps_pwron_get(void)
|
|
{
|
|
- if (s3c2410_gpio_getpin(GTA01_GPIO_GPS_PWRON))
|
|
- return 1;
|
|
- else
|
|
- return 0;
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA01
|
|
+ if (machine_is_neo1973_gta01()) {
|
|
+ if (s3c2410_gpio_getpin(GTA01_GPIO_GPS_PWRON))
|
|
+ return 1;
|
|
+ else
|
|
+ return 0;
|
|
+ }
|
|
+#endif /* CONFIG_MACH_NEO1973_GTA01 */
|
|
+
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA02
|
|
+ if (machine_is_neo1973_gta02()) {
|
|
+ if (pcf50633_onoff_get(pcf50633_global, PCF50633_REGULATOR_LDO5))
|
|
+ return 1;
|
|
+ else
|
|
+ return 0;
|
|
+ }
|
|
+#endif /* CONFIG_MACH_NEO1973_GTA02 */
|
|
+ return -1;
|
|
}
|
|
|
|
/* This is the nRESET pin */
|
|
@@ -441,17 +476,40 @@ static DEVICE_ATTR(power_sequence, 0644, power_sequence_read,
|
|
static int gta01_pm_gps_suspend(struct platform_device *pdev,
|
|
pm_message_t state)
|
|
{
|
|
- /* FIXME */
|
|
- gps_power_sequence_down();
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA01
|
|
+ if (machine_is_neo1973_gta01()) {
|
|
+ /* FIXME */
|
|
+ gps_power_sequence_down();
|
|
+ }
|
|
+#endif /* CONFIG_MACH_NEO1973_GTA01 */
|
|
+
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA02
|
|
+ if (machine_is_neo1973_gta02()) {
|
|
+ /* FIXME */
|
|
+ pcf50633_onoff_set(pcf50633_global,
|
|
+ PCF50633_REGULATOR_LDO5, 0);
|
|
+ }
|
|
+#endif /* CONFIG_MACH_NEO1973_GTA02 */
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int gta01_pm_gps_resume(struct platform_device *pdev)
|
|
{
|
|
- /* FIXME */
|
|
- gps_power_sequence_up();
|
|
-
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA01
|
|
+ if (machine_is_neo1973_gta01()) {
|
|
+ /* FIXME */
|
|
+ gps_power_sequence_up();
|
|
+ }
|
|
+#endif /* CONFIG_MACH_NEO1973_GTA01 */
|
|
+
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA02
|
|
+ if (machine_is_neo1973_gta02()) {
|
|
+ /* FIXME */
|
|
+ pcf50633_onoff_set(pcf50633_global,
|
|
+ PCF50633_REGULATOR_LDO5, 1);
|
|
+#endif /* CONFIG_MACH_NEO1973_GTA02 */
|
|
+ }
|
|
return 0;
|
|
}
|
|
#else
|
|
@@ -476,59 +534,110 @@ static struct attribute_group gta01_gps_attr_group = {
|
|
.attrs = gta01_gps_sysfs_entries,
|
|
};
|
|
|
|
+static struct attribute *gta02_gps_sysfs_entries[] = {
|
|
+ &dev_attr_pwron.attr,
|
|
+ NULL
|
|
+};
|
|
+
|
|
+static struct attribute_group gta02_gps_attr_group = {
|
|
+ .name = NULL,
|
|
+ .attrs = gta02_gps_sysfs_entries,
|
|
+};
|
|
+
|
|
static int __init gta01_pm_gps_probe(struct platform_device *pdev)
|
|
{
|
|
- s3c2410_gpio_cfgpin(GTA01_GPIO_GPS_PWRON, S3C2410_GPIO_OUTPUT);
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA01
|
|
+ if (machine_is_neo1973_gta01()) {
|
|
+ s3c2410_gpio_cfgpin(GTA01_GPIO_GPS_PWRON, S3C2410_GPIO_OUTPUT);
|
|
|
|
- switch (system_rev) {
|
|
- case GTA01v3_SYSTEM_REV:
|
|
- break;
|
|
- case GTA01v4_SYSTEM_REV:
|
|
- s3c2410_gpio_cfgpin(GTA01_GPIO_GPS_RESET, S3C2410_GPIO_OUTPUT);
|
|
- break;
|
|
- case GTA01Bv3_SYSTEM_REV:
|
|
- case GTA01Bv4_SYSTEM_REV:
|
|
- s3c2410_gpio_cfgpin(GTA01_GPIO_GPS_EN_3V3, S3C2410_GPIO_OUTPUT);
|
|
- /* fallthrough */
|
|
- case GTA01Bv2_SYSTEM_REV:
|
|
- s3c2410_gpio_cfgpin(GTA01_GPIO_GPS_EN_2V8, S3C2410_GPIO_OUTPUT);
|
|
- s3c2410_gpio_cfgpin(GTA01_GPIO_GPS_EN_3V, S3C2410_GPIO_OUTPUT);
|
|
- s3c2410_gpio_cfgpin(GTA01_GPIO_GPS_RESET, S3C2410_GPIO_OUTPUT);
|
|
- break;
|
|
- default:
|
|
- dev_warn(&pdev->dev, "Unknown GTA01 Revision 0x%x, "
|
|
- "AGPS PM features not available!!!\n",
|
|
- system_rev);
|
|
- return -1;
|
|
- break;
|
|
- }
|
|
+ switch (system_rev) {
|
|
+ case GTA01v3_SYSTEM_REV:
|
|
+ break;
|
|
+ case GTA01v4_SYSTEM_REV:
|
|
+ s3c2410_gpio_cfgpin(GTA01_GPIO_GPS_RESET, S3C2410_GPIO_OUTPUT);
|
|
+ break;
|
|
+ case GTA01Bv3_SYSTEM_REV:
|
|
+ case GTA01Bv4_SYSTEM_REV:
|
|
+ s3c2410_gpio_cfgpin(GTA01_GPIO_GPS_EN_3V3, S3C2410_GPIO_OUTPUT);
|
|
+ /* fallthrough */
|
|
+ case GTA01Bv2_SYSTEM_REV:
|
|
+ s3c2410_gpio_cfgpin(GTA01_GPIO_GPS_EN_2V8, S3C2410_GPIO_OUTPUT);
|
|
+ s3c2410_gpio_cfgpin(GTA01_GPIO_GPS_EN_3V, S3C2410_GPIO_OUTPUT);
|
|
+ s3c2410_gpio_cfgpin(GTA01_GPIO_GPS_RESET, S3C2410_GPIO_OUTPUT);
|
|
+ break;
|
|
+ default:
|
|
+ dev_warn(&pdev->dev, "Unknown GTA01 Revision 0x%x, "
|
|
+ "AGPS PM features not available!!!\n",
|
|
+ system_rev);
|
|
+ return -1;
|
|
+ break;
|
|
+ }
|
|
|
|
- gps_power_sequence_down();
|
|
+ gps_power_sequence_down();
|
|
|
|
- switch (system_rev) {
|
|
- case GTA01v3_SYSTEM_REV:
|
|
- case GTA01v4_SYSTEM_REV:
|
|
- case GTA01Bv2_SYSTEM_REV:
|
|
- gta01_gps_sysfs_entries[ARRAY_SIZE(gta01_gps_sysfs_entries)-3] =
|
|
- &dev_attr_power_tcxo_2v8.attr;
|
|
- break;
|
|
- case GTA01Bv3_SYSTEM_REV:
|
|
- case GTA01Bv4_SYSTEM_REV:
|
|
- gta01_gps_sysfs_entries[ARRAY_SIZE(gta01_gps_sysfs_entries)-3] =
|
|
- &dev_attr_power_core_1v5.attr;
|
|
- gta01_gps_sysfs_entries[ARRAY_SIZE(gta01_gps_sysfs_entries)-2] =
|
|
- &dev_attr_power_vdd_core_1v5.attr;
|
|
- break;
|
|
- }
|
|
+ switch (system_rev) {
|
|
+ case GTA01v3_SYSTEM_REV:
|
|
+ case GTA01v4_SYSTEM_REV:
|
|
+ case GTA01Bv2_SYSTEM_REV:
|
|
+ gta01_gps_sysfs_entries[ARRAY_SIZE(gta01_gps_sysfs_entries)-3] =
|
|
+ &dev_attr_power_tcxo_2v8.attr;
|
|
+ break;
|
|
+ case GTA01Bv3_SYSTEM_REV:
|
|
+ case GTA01Bv4_SYSTEM_REV:
|
|
+ gta01_gps_sysfs_entries[ARRAY_SIZE(gta01_gps_sysfs_entries)-3] =
|
|
+ &dev_attr_power_core_1v5.attr;
|
|
+ gta01_gps_sysfs_entries[ARRAY_SIZE(gta01_gps_sysfs_entries)-2] =
|
|
+ &dev_attr_power_vdd_core_1v5.attr;
|
|
+ break;
|
|
+ }
|
|
|
|
- return sysfs_create_group(&pdev->dev.kobj, >a01_gps_attr_group);
|
|
+ return sysfs_create_group(&pdev->dev.kobj, >a01_gps_attr_group);
|
|
+ }
|
|
+#endif /* CONFIG_MACH_NEO1973_GTA01 */
|
|
+
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA02
|
|
+ if (machine_is_neo1973_gta02()) {
|
|
+ switch (system_rev) {
|
|
+ case GTA02v2_SYSTEM_REV:
|
|
+ case GTA02v3_SYSTEM_REV:
|
|
+ case GTA02v4_SYSTEM_REV:
|
|
+ case GTA02v5_SYSTEM_REV:
|
|
+ case GTA02v6_SYSTEM_REV:
|
|
+ pcf50633_voltage_set(pcf50633_global,
|
|
+ PCF50633_REGULATOR_LDO5, 3000);
|
|
+ pcf50633_onoff_set(pcf50633_global,
|
|
+ PCF50633_REGULATOR_LDO5, 0);
|
|
+ dev_info(&pdev->dev, "FIC Neo1973 GPS Power Managerment:"
|
|
+ "starting\n");
|
|
+ break;
|
|
+ default:
|
|
+ dev_warn(&pdev->dev, "Unknown GTA02 Revision 0x%x, "
|
|
+ "AGPS PM features not available!!!\n",
|
|
+ system_rev);
|
|
+ return -1;
|
|
+ break;
|
|
+ }
|
|
+ return sysfs_create_group(&pdev->dev.kobj, >a02_gps_attr_group);
|
|
+ }
|
|
+#endif /* CONFIG_MACH_NEO1973_GTA02 */
|
|
+ return -1;
|
|
}
|
|
|
|
static int gta01_pm_gps_remove(struct platform_device *pdev)
|
|
{
|
|
- gps_power_sequence_down();
|
|
- sysfs_remove_group(&pdev->dev.kobj, >a01_gps_attr_group);
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA01
|
|
+ if (machine_is_neo1973_gta01()) {
|
|
+ gps_power_sequence_down();
|
|
+ sysfs_remove_group(&pdev->dev.kobj, >a01_gps_attr_group);
|
|
+ }
|
|
+#endif /* CONFIG_MACH_NEO1973_GTA01 */
|
|
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA02
|
|
+ if (machine_is_neo1973_gta02()) {
|
|
+ pcf50633_onoff_set(pcf50633_global, PCF50633_REGULATOR_LDO5, 0);
|
|
+ sysfs_remove_group(&pdev->dev.kobj, >a02_gps_attr_group);
|
|
+ }
|
|
+#endif /* CONFIG_MACH_NEO1973_GTA02 */
|
|
return 0;
|
|
}
|
|
|
|
diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
|
|
index a1615f8..13cb45b 100644
|
|
--- a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
|
|
+++ b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
|
|
@@ -19,8 +19,15 @@
|
|
#include <linux/errno.h>
|
|
|
|
#include <asm/hardware.h>
|
|
+#include <asm/mach-types.h>
|
|
#include <asm/arch/gta01.h>
|
|
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA02
|
|
+#include <asm/arch/gta02.h>
|
|
+#include <linux/pcf50633.h>
|
|
+#include <asm/arch/regs-gpioj.h>
|
|
+#endif
|
|
+
|
|
struct gta01pm_priv {
|
|
int gpio_ngsm_en;
|
|
struct console *con;
|
|
@@ -54,8 +61,16 @@ static ssize_t gsm_read(struct device *dev, struct device_attribute *attr,
|
|
if (s3c2410_gpio_getpin(GTA01_GPIO_MODEM_RST))
|
|
goto out_1;
|
|
} else if (!strcmp(attr->attr.name, "download")) {
|
|
- if (s3c2410_gpio_getpin(GTA01_GPIO_MODEM_DNLOAD))
|
|
- goto out_1;
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA01
|
|
+ if (machine_is_neo1973_gta01())
|
|
+ if (s3c2410_gpio_getpin(GTA01_GPIO_MODEM_DNLOAD))
|
|
+ goto out_1;
|
|
+#endif
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA02
|
|
+ if (machine_is_neo1973_gta02())
|
|
+ if (s3c2410_gpio_getpin(GTA02_GPIO_nDL_GSM))
|
|
+ goto out_1;
|
|
+#endif
|
|
}
|
|
|
|
return strlcpy(buf, "0\n", 3);
|
|
@@ -70,32 +85,67 @@ static ssize_t gsm_write(struct device *dev, struct device_attribute *attr,
|
|
|
|
if (!strcmp(attr->attr.name, "power_on")) {
|
|
if (on) {
|
|
- dev_info(dev, "powering up GSM, thus disconnecting "
|
|
- "serial console\n");
|
|
+ if (gta01_gsm.con) {
|
|
+ dev_info(dev, "powering up GSM, thus "
|
|
+ "disconnecting serial console\n");
|
|
|
|
- if (gta01_gsm.con)
|
|
console_stop(gta01_gsm.con);
|
|
+ }
|
|
|
|
if (gta01_gsm.gpio_ngsm_en)
|
|
s3c2410_gpio_setpin(gta01_gsm.gpio_ngsm_en, 0);
|
|
|
|
+ switch (system_rev) {
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA02
|
|
+ case GTA02v2_SYSTEM_REV:
|
|
+ case GTA02v3_SYSTEM_REV:
|
|
+ case GTA02v4_SYSTEM_REV:
|
|
+ case GTA02v5_SYSTEM_REV:
|
|
+ case GTA02v6_SYSTEM_REV:
|
|
+ pcf50633_gpio_set(pcf50633_global,
|
|
+ PCF50633_GPIO2, 1);
|
|
+ break;
|
|
+#endif
|
|
+ }
|
|
+
|
|
s3c2410_gpio_setpin(GTA01_GPIO_MODEM_ON, 1);
|
|
} else {
|
|
s3c2410_gpio_setpin(GTA01_GPIO_MODEM_ON, 0);
|
|
|
|
+ switch (system_rev) {
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA02
|
|
+ case GTA02v2_SYSTEM_REV:
|
|
+ case GTA02v3_SYSTEM_REV:
|
|
+ case GTA02v4_SYSTEM_REV:
|
|
+ case GTA02v5_SYSTEM_REV:
|
|
+ case GTA02v6_SYSTEM_REV:
|
|
+ pcf50633_gpio_set(pcf50633_global,
|
|
+ PCF50633_GPIO2, 0);
|
|
+ break;
|
|
+#endif
|
|
+ }
|
|
+
|
|
if (gta01_gsm.gpio_ngsm_en)
|
|
s3c2410_gpio_setpin(gta01_gsm.gpio_ngsm_en, 1);
|
|
|
|
- if (gta01_gsm.con)
|
|
+ if (gta01_gsm.con) {
|
|
console_start(gta01_gsm.con);
|
|
|
|
- dev_info(dev, "powered down GSM, thus enabling "
|
|
- "serial console\n");
|
|
+ dev_info(dev, "powered down GSM, thus enabling "
|
|
+ "serial console\n");
|
|
+ }
|
|
}
|
|
} else if (!strcmp(attr->attr.name, "reset")) {
|
|
s3c2410_gpio_setpin(GTA01_GPIO_MODEM_RST, on);
|
|
} else if (!strcmp(attr->attr.name, "download")) {
|
|
- s3c2410_gpio_setpin(GTA01_GPIO_MODEM_DNLOAD, on);
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA01
|
|
+ if (machine_is_neo1973_gta01())
|
|
+ s3c2410_gpio_setpin(GTA01_GPIO_MODEM_DNLOAD, on);
|
|
+#endif
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA02
|
|
+ if (machine_is_neo1973_gta02())
|
|
+ s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, on);
|
|
+#endif
|
|
}
|
|
|
|
return count;
|
|
@@ -111,6 +161,9 @@ static int gta01_gsm_suspend(struct platform_device *pdev, pm_message_t state)
|
|
/* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
|
|
* don't need to do anything here */
|
|
|
|
+ /* disable DL GSM to prevent jack_insert becoming flaoting */
|
|
+ if (machine_is_neo1973_gta02())
|
|
+ s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, 1);
|
|
return 0;
|
|
}
|
|
|
|
@@ -124,6 +177,8 @@ static int gta01_gsm_resume(struct platform_device *pdev)
|
|
if (s3c2410_gpio_getpin(GTA01_GPIO_MODEM_ON) && gta01_gsm.con)
|
|
console_stop(gta01_gsm.con);
|
|
|
|
+ if (machine_is_neo1973_gta02())
|
|
+ s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, 0);
|
|
return 0;
|
|
}
|
|
#else
|
|
@@ -134,7 +189,7 @@ static int gta01_gsm_resume(struct platform_device *pdev)
|
|
static struct attribute *gta01_gsm_sysfs_entries[] = {
|
|
&dev_attr_power_on.attr,
|
|
&dev_attr_reset.attr,
|
|
- NULL,
|
|
+ &dev_attr_download.attr,
|
|
NULL
|
|
};
|
|
|
|
@@ -158,8 +213,18 @@ static int __init gta01_gsm_probe(struct platform_device *pdev)
|
|
gta01_gsm.gpio_ngsm_en = GTA01Bv2_GPIO_nGSM_EN;
|
|
s3c2410_gpio_setpin(GTA01v3_GPIO_nGSM_EN, 0);
|
|
break;
|
|
+#ifdef CONFIG_MACH_NEO1973_GTA02
|
|
+ case GTA02v1_SYSTEM_REV:
|
|
+ case GTA02v2_SYSTEM_REV:
|
|
+ case GTA02v3_SYSTEM_REV:
|
|
+ case GTA02v4_SYSTEM_REV:
|
|
+ case GTA02v5_SYSTEM_REV:
|
|
+ case GTA02v6_SYSTEM_REV:
|
|
+ gta01_gsm.gpio_ngsm_en = 0;
|
|
+ break;
|
|
+#endif
|
|
default:
|
|
- dev_warn(&pdev->dev, "Unknown GTA01 Revision 0x%x, "
|
|
+ dev_warn(&pdev->dev, "Unknown Neo1973 Revision 0x%x, "
|
|
"some PM features not available!!!\n",
|
|
system_rev);
|
|
break;
|
|
@@ -175,9 +240,13 @@ static int __init gta01_gsm_probe(struct platform_device *pdev)
|
|
break;
|
|
}
|
|
|
|
- gta01_gsm.con = find_s3c24xx_console();
|
|
- if (!gta01_gsm.con)
|
|
- dev_warn(&pdev->dev, "cannot find S3C24xx console driver\n");
|
|
+ if (machine_is_neo1973_gta01()) {
|
|
+ gta01_gsm.con = find_s3c24xx_console();
|
|
+ if (!gta01_gsm.con)
|
|
+ dev_warn(&pdev->dev,
|
|
+ "cannot find S3C24xx console driver\n");
|
|
+ } else
|
|
+ gta01_gsm.con = NULL;
|
|
|
|
return sysfs_create_group(&pdev->dev.kobj, >a01_gsm_attr_group);
|
|
}
|
|
--
|
|
1.5.6.3
|
|
|