From ebb3f320edcc6c4665a71ea060ef2ce6a83402b0 Mon Sep 17 00:00:00 2001 From: merge Date: Mon, 8 Dec 2008 22:50:52 +0000 Subject: MERGE-via-pending-tracking-hist-MERGE-via-stable-tracking-fix-s3c2410_ts-fifo-allocation-1228776491 pending-tracking-hist top was MERGE-via-stable-tracking-fix-s3c2410_ts-fifo-allocation-1228776491 / a85a8a282939b4f6800081f67e1d568e0b97bd7a ... parent commitmessage: From: merge MERGE-via-stable-tracking-hist-fix-s3c2410_ts-fifo-allocation stable-tracking-hist top was fix-s3c2410_ts-fifo-allocation / 56a57ba0d4c1d60869250d5f89fae61544f01012 ... parent commitmessage: From: Nelson Castillo Fix s3c2410_ts FIFO allocation When I added the FIFO improving the interrupts handlers I introduced a bug. The FIFO is allocated after the interrupts are requested. This makes the kernel crash if the touchscreen generates activity before the allocation takes place. This patch fixes the bug. I reproduced it and tested the fix in a GTA02. - Fix bug - Fix a typo Reported-by: Andy Green Signed-off-by: Nelson Castillo --- arch/arm/mach-s3c2440/mach-gta02.c | 92 ++++++++++++++++++++++++++++---------- 1 file changed, 68 insertions(+), 24 deletions(-) (limited to 'arch/arm/mach-s3c2440') diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c index e90f82bdfc3..d2556ed3a3a 100644 --- a/arch/arm/mach-s3c2440/mach-gta02.c +++ b/arch/arm/mach-s3c2440/mach-gta02.c @@ -557,6 +557,9 @@ static void gta02_charger_worker(struct work_struct *work) #define GTA02_CHARGER_CONFIGURE_TIMEOUT ((3000 * HZ) / 1000) static void gta02_pmu_event_callback(struct pcf50633 *pcf, int irq) { + int ret; + int happy_with_power = 0; + if (irq == PCF50633_IRQ_USBINS) { schedule_delayed_work(>a02_charger_work, GTA02_CHARGER_CONFIGURE_TIMEOUT); @@ -564,6 +567,44 @@ static void gta02_pmu_event_callback(struct pcf50633 *pcf, int irq) } else if (irq == PCF50633_IRQ_USBREM) { cancel_delayed_work_sync(>a02_charger_work); gta02_usb_vbus_draw = 0; + } else if (irq == PCF50633_ABOUT_TO_INCREASE_POWER) { + + /* + * we can't let this proceed until we are happy about + * power arrangements, because it is going to bring up + * the backlight and double our power consumption. + * + * With Qi/A6 anyway, until now we could boot just from + * USB 100mA limit and no or low battery. So we need + * to check for low battery and if so, spin here until + * USB enumerated power, or charger comes + */ + + while (!happy_with_power) { + ret = pcf50633_check_power_available(pcf); +// dev_info(pcf->dev, "available power = %d\n", ret); + switch (ret) { + case PCF50633_PA_DEAD_BATTERY_ONLY: + /* turn ourselves off */ + pcf50633_reg_write(pcf, PCF50633_REG_OOSHDWN, + 0x01); + break; + case PCF50633_PA_USB_100mA_AND_DEAD_BATTERY: + /* + * loop waiting for eg 500mA USB + * enumeration by host + */ + break; + default: + /* + * one way or another we can afford to + * use more power + */ + happy_with_power = 1; + continue; + } + msleep(1000); + } } } @@ -628,6 +669,7 @@ static char *gta02_batteries[] = { "battery", }; + struct pcf50633_platform_data gta02_pcf_pdata = { .resumers = { [0] = PCF50633_INT1_USBINS | @@ -765,6 +807,7 @@ struct pcf50633_platform_data gta02_pcf_pdata = { .probe_done = gta02_pmu_attach_child_devices, .regulator_registered = gta02_pmu_regulator_registered, .mbc_event_callback = gta02_pmu_event_callback, + .good_main_battery_adc_threshold = 500 }; static void mangle_pmu_pdata_by_system_rev(void) @@ -1004,6 +1047,8 @@ static void gta02_udc_vbus_draw(unsigned int ma) return; } + printk(KERN_ERR "******** UDC gta02_pcf_pdata.pcf ma = %d\n", ma); + gta02_usb_vbus_draw = ma; schedule_delayed_work(>a02_charger_work, @@ -1608,20 +1653,7 @@ __setup("hardware_ecc=", hardware_ecc_setup); /* these are the guys that don't need to be children of PMU */ static struct platform_device *gta02_devices[] __initdata = { - >a02_version_device, - &s3c_device_usb, - &s3c_device_wdt, - >a02_memconfig_device, - &s3c_device_sdi, &s3c_device_usbgadget, - &s3c_device_nand, - >a02_nor_flash, - - &sc32440_fiq_device, - &s3c24xx_pwm_device, - >a02_led_dev, - >a02_pm_wlan_dev, /* not dependent on PMU */ - &s3c_device_iis, &s3c_device_i2c0, }; @@ -1629,6 +1661,15 @@ static struct platform_device *gta02_devices[] __initdata = { /* these guys DO need to be children of PMU */ static struct platform_device *gta02_devices_pmu_children[] = { + &s3c_device_usb, + &sc32440_fiq_device, + &s3c24xx_pwm_device, + &s3c_device_nand, + >a02_nor_flash, + >a02_pm_wlan_dev, /* not dependent on PMU */ + >a02_version_device, + &s3c_device_wdt, + >a02_memconfig_device, &s3c_device_ts, /* input 1 */ >a02_pm_gsm_dev, >a02_pm_usbhost_dev, @@ -1636,6 +1677,8 @@ static struct platform_device *gta02_devices_pmu_children[] = { &s3c_device_spi_acc2, /* input 3 */ >a02_button_dev, /* input 4 */ >a02_resume_reason_device, + &s3c_device_sdi, + >a02_led_dev, }; static void gta02_pmu_regulator_registered(struct pcf50633 *pcf, int id) @@ -1645,23 +1688,24 @@ static void gta02_pmu_regulator_registered(struct pcf50633 *pcf, int id) regulator = pcf->pmic.pdev[id]; switch(id) { - case PCF50633_REGULATOR_LDO4: - pdev = >a01_pm_bt_dev; - break; - case PCF50633_REGULATOR_LDO5: - pdev = >a01_pm_gps_dev; - break; - case PCF50633_REGULATOR_HCLDO: - pdev = >a02_glamo_dev; - break; - default: - return; + case PCF50633_REGULATOR_LDO4: + pdev = >a01_pm_bt_dev; + break; + case PCF50633_REGULATOR_LDO5: + pdev = >a01_pm_gps_dev; + break; + case PCF50633_REGULATOR_HCLDO: + pdev = >a02_glamo_dev; + break; + default: + return; } pdev->dev.parent = ®ulator->dev; platform_device_register(pdev); } + /* this is called when pc50633 is probed, unfortunately quite late in the * day since it is an I2C bus device. Here we can belatedly define some * platform devices with the advantage that we can mark the pcf50633 as the -- cgit v1.2.3