[PATCH 4/4] Move charger initialization from core to mbc driver.

Balaji Rao balajirrao at openmoko.org
Tue Dec 23 15:59:19 CET 2008


When irq_handler is called from core, the irqs might not have been yet
registered - which means, the initial charger state was not being set
properly.

Signed-off-by: Balaji Rao <balajirrao at openmoko.org>
---
 drivers/mfd/pcf50633-core.c      |    9 ---------
 drivers/power/pcf50633-charger.c |    7 +++++++
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c
index bdf93c1..f668b9a 100644
--- a/drivers/mfd/pcf50633-core.c
+++ b/drivers/mfd/pcf50633-core.c
@@ -480,7 +480,6 @@ static int pcf50633_probe(struct i2c_client *client,
 	struct pcf50633 *pcf;
 	struct pcf50633_platform_data *pdata;
 	int i, ret = 0;
-	u8 mbcs1;
 	int version;
 	int variant;
 
@@ -571,14 +570,6 @@ static int pcf50633_probe(struct i2c_client *client,
 		dev_err(pcf->dev, "IRQ %u cannot be enabled as wake-up "
 		        "source in this hardware revision\n", client->irq);
 
-	/* Cold Intialization */
-	mbcs1 = pcf50633_reg_read(pcf, PCF50633_REG_MBCS1);
-
-	if (mbcs1 & 0x01)
-		pcf50633_irq_call_handler(pcf, PCF50633_IRQ_USBINS);
-	if (mbcs1 & 0x04)
-		pcf50633_irq_call_handler(pcf, PCF50633_IRQ_ADPINS);
-
 	ret = sysfs_create_group(&client->dev.kobj, &pcf_attr_group);
 	if (ret)
 		dev_err(pcf->dev, "error creating sysfs entries\n");
diff --git a/drivers/power/pcf50633-charger.c b/drivers/power/pcf50633-charger.c
index 866972b..8ade32a 100644
--- a/drivers/power/pcf50633-charger.c
+++ b/drivers/power/pcf50633-charger.c
@@ -293,6 +293,7 @@ int __init pcf50633_mbc_probe(struct platform_device *pdev)
 	struct pcf50633 *pcf;
 	struct pcf50633_mbc *mbc;
 	int ret;
+	u8 mbcs1;
 
 	pcf = platform_get_drvdata(pdev);
 	mbc = &pcf->mbc;
@@ -364,6 +365,12 @@ int __init pcf50633_mbc_probe(struct platform_device *pdev)
 	if (ret)
 		dev_err(pcf->dev, "failed to register ac\n");
 
+	mbcs1 = pcf50633_reg_read(pcf, PCF50633_REG_MBCS1);
+	if (mbcs1 & 0x01)
+		pcf50633_mbc_irq_handler(pcf, PCF50633_IRQ_USBINS, NULL);
+	if (mbcs1 & 0x04)
+		pcf50633_mbc_irq_handler(pcf, PCF50633_IRQ_ADPINS, NULL);
+
 	/* Disable automatic charging restart. Manually setting RESUME
 	 * won't have effect otherwise
 	 */
-- 
1.6.0.3



More information about the openmoko-kernel mailing list