aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-s3c2442
diff options
context:
space:
mode:
authorSven Rebhan <odinshorse@googlemail.com>2009-02-23 01:21:42 +0000
committerAndy Green <agreen@octopus.localdomain>2009-02-23 01:21:42 +0000
commitfe11815966f50ece487d00ba135f901e401524a8 (patch)
tree31d337087f8d43807f2f49fa3850989b0a525f60 /arch/arm/mach-s3c2442
parentd47ff22790ae20bf04c264faef0eef81cb07e3f4 (diff)
Care about PCF50633 charger disabled
If we disable CONFIG_CHARGER_PCF50633 the build fails with a bunch of errors. This patch defines placeholders for the functions that require the charger. All users of the function pointers care about the case when they are NULL, so this won't break anything. Furthermore a small restructuring of the mach file was necessary to not sprinkle ifdefs all over. Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
Diffstat (limited to 'arch/arm/mach-s3c2442')
-rw-r--r--arch/arm/mach-s3c2442/mach-gta02.c75
1 files changed, 43 insertions, 32 deletions
diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c
index 603f755f24e..ab731371b87 100644
--- a/arch/arm/mach-s3c2442/mach-gta02.c
+++ b/arch/arm/mach-s3c2442/mach-gta02.c
@@ -378,10 +378,9 @@ static struct s3c2410_uartcfg gta02_uartcfgs[] = {
};
-/* BQ27000 Battery */
-
struct pcf50633 *gta02_pcf;
+#ifdef CONFIG_CHARGER_PCF50633
static int gta02_get_charger_online_status(void)
{
struct pcf50633 *pcf = gta02_pcf;
@@ -396,24 +395,6 @@ static int gta02_get_charger_active_status(void)
return pcf50633_mbc_get_status(pcf) & PCF50633_MBC_USB_ACTIVE;
}
-
-struct bq27000_platform_data bq27000_pdata = {
- .name = "battery",
- .rsense_mohms = 20,
- .hdq_read = hdq_read,
- .hdq_write = hdq_write,
- .hdq_initialized = hdq_initialized,
- .get_charger_online_status = gta02_get_charger_online_status,
- .get_charger_active_status = gta02_get_charger_active_status
-};
-
-struct platform_device bq27000_battery_device = {
- .name = "bq27000-battery",
- .dev = {
- .platform_data = &bq27000_pdata,
- },
-};
-
#define ADC_NOM_CHG_DETECT_1A 6
#define ADC_NOM_CHG_DETECT_USB 43
@@ -467,6 +448,42 @@ static void gta02_pmu_event_callback(struct pcf50633 *pcf, int irq)
}
}
+static void gta02_udc_vbus_draw(unsigned int ma)
+{
+ if (!gta02_pcf)
+ return;
+
+ gta02_usb_vbus_draw = ma;
+
+ schedule_delayed_work(&gta02_charger_work,
+ GTA02_CHARGER_CONFIGURE_TIMEOUT);
+}
+#else /* !CONFIG_CHARGER_PCF50633 */
+#define gta02_get_charger_online_status NULL
+#define gta02_get_charger_active_status NULL
+#define gta02_pmu_event_callback NULL
+#define gta02_udc_vbus_draw NULL
+#endif
+
+/* BQ27000 Battery */
+
+struct bq27000_platform_data bq27000_pdata = {
+ .name = "battery",
+ .rsense_mohms = 20,
+ .hdq_read = hdq_read,
+ .hdq_write = hdq_write,
+ .hdq_initialized = hdq_initialized,
+ .get_charger_online_status = gta02_get_charger_online_status,
+ .get_charger_active_status = gta02_get_charger_active_status
+};
+
+struct platform_device bq27000_battery_device = {
+ .name = "bq27000-battery",
+ .dev = {
+ .platform_data = &bq27000_pdata,
+ },
+};
+
static struct platform_device gta01_pm_gps_dev = {
.name = "neo1973-pm-gps",
};
@@ -900,17 +917,6 @@ static void gta02_udc_command(enum s3c2410_udc_cmd_e cmd)
/* get PMU to set USB current limit accordingly */
-static void gta02_udc_vbus_draw(unsigned int ma)
-{
- if (!gta02_pcf)
- return;
-
- gta02_usb_vbus_draw = ma;
-
- schedule_delayed_work(&gta02_charger_work,
- GTA02_CHARGER_CONFIGURE_TIMEOUT);
-}
-
static struct s3c2410_udc_mach_info gta02_udc_cfg = {
.vbus_draw = gta02_udc_vbus_draw,
.udc_command = gta02_udc_command,
@@ -1637,7 +1643,10 @@ static void __init gta02_machine_init(void)
}
spin_lock_init(&motion_irq_lock);
+
+#ifdef CONFIG_CHARGER_PCF50633
INIT_DELAYED_WORK(&gta02_charger_work, gta02_charger_worker);
+#endif
/* Glamo chip select optimization */
/* *((u32 *)(S3C2410_MEMREG(((1 + 1) << 2)))) = 0x1280; */
@@ -1691,9 +1700,11 @@ static void __init gta02_machine_init(void)
/* Register the HDQ and vibrator as children of pwm device */
gta02_vibrator_dev.dev.parent = &s3c24xx_pwm_device.dev;
+ platform_device_register(&gta02_vibrator_dev);
+#ifdef CONFIG_HDQ_GPIO_BITBANG
gta02_hdq_device.dev.parent = &s3c24xx_pwm_device.dev;
platform_device_register(&gta02_hdq_device);
- platform_device_register(&gta02_vibrator_dev);
+#endif
}