aboutsummaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorAndy Green <andy@openmoko.com>2008-11-19 17:09:51 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-11-19 17:09:51 +0000
commit91621be2cbfa8140a14d7ca4c1cf7de32368273c (patch)
tree6a13ac5ca670ada8b68501eab22a73817512c4ef /drivers/i2c
parent2775b40e6679a921c5ecab729e021176fef56fb6 (diff)
fix-pcf50633-migrate-gta02-peripherals-out.patch
pcf50633.c shouldn't know GTAxx at all. Move to using a platform callback to allow definition of platform devices with pcf50633 as parent device (good for enforcing suspend / resume ordering). Remove all code references to GTAxx from the sources (one string left for compatability). Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/chips/pcf50633.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
index 67459935c3b..850bf934a2a 100644
--- a/drivers/i2c/chips/pcf50633.c
+++ b/drivers/i2c/chips/pcf50633.c
@@ -50,7 +50,6 @@
#include <linux/jiffies.h>
#include <asm/mach-types.h>
-#include <asm/arch/gta02.h>
#include "pcf50633.h"
#include <linux/resume-dependency.h>
@@ -2004,18 +2003,6 @@ static DEVICE_ATTR(dump_regs, 0400, show_dump_regs, NULL);
* Driver initialization
***********************************************************************/
-#ifdef CONFIG_MACH_NEO1973_GTA02
-/* We currently place those platform devices here to make sure the device
- * suspend/resume order is correct */
-static struct platform_device gta01_pm_gps_dev = {
- .name = "neo1973-pm-gps",
-};
-
-static struct platform_device gta01_pm_bt_dev = {
- .name = "neo1973-pm-bt",
-};
-#endif
-
/*
* CARE! This table is modified at runtime!
*/
@@ -2209,14 +2196,15 @@ static int pcf50633_detect(struct i2c_adapter *adapter, int address, int kind)
apm_get_power_status = pcf50633_get_power_status;
data->probe_completed = 1;
-#ifdef CONFIG_MACH_NEO1973_GTA02
- if (machine_is_neo1973_gta02()) {
- gta01_pm_gps_dev.dev.parent = &new_client->dev;
- gta01_pm_bt_dev.dev.parent = &new_client->dev;
- platform_device_register(&gta01_pm_bt_dev);
- platform_device_register(&gta01_pm_gps_dev);
- }
-#endif
+ if (data->pdata->flag_use_apm_emulation)
+ apm_get_power_status = pcf50633_get_power_status;
+
+ /* if platform was interested, give him a chance to register
+ * platform devices that switch power with us as the parent
+ * at registration time -- ensures suspend / resume ordering
+ */
+ if (data->pdata->attach_child_devices)
+ (data->pdata->attach_child_devices)(&new_client->dev);
return 0;
exit_rtc:
@@ -2261,13 +2249,6 @@ static int pcf50633_detach_client(struct i2c_client *client)
if (pcf->pdata->used_features & PCF50633_FEAT_RTC)
rtc_device_unregister(pcf->rtc);
-#ifdef CONFIG_MACH_NEO1973_GTA02
- if (machine_is_neo1973_gta02()) {
- platform_device_unregister(&gta01_pm_bt_dev);
- platform_device_unregister(&gta01_pm_gps_dev);
- }
-#endif
-
sysfs_remove_group(&client->dev.kobj, &pcf_attr_group);
pm_power_off = NULL;
@@ -2465,6 +2446,26 @@ int pcf50633_ready(struct pcf50633_data *pcf)
}
EXPORT_SYMBOL_GPL(pcf50633_ready);
+int pcf50633_wait_for_ready(struct pcf50633_data *pcf, int timeout_ms,
+ char *name)
+{
+ /* so we always go once */
+ timeout_ms += 5;
+
+ while ((timeout_ms >= 5) && (pcf50633_ready(pcf))) {
+ timeout_ms -= 5; /* well, it isn't very accurate, but OK */
+ msleep(5);
+ }
+
+ if (timeout_ms < 5) {
+ printk(KERN_ERR"pcf50633_wait_for_ready: "
+ "%s BAILING on timeout\n", name);
+ return -EBUSY;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(pcf50633_wait_for_ready);
/*
* if backlight resume is selected to be deferred by platform, then it