mfd: twl-core: regulator configuration for twl6030 V1V8, V2V1 SMPS
[linux-2.6.git] / drivers / power / z2_battery.c
index 81304c0..636ebb2 100644 (file)
@@ -134,6 +134,8 @@ static int z2_batt_ps_init(struct z2_charger *charger, int props)
        enum power_supply_property *prop;
        struct z2_battery_info *info = charger->info;
 
+       if (info->charge_gpio >= 0)
+               props++;        /* POWER_SUPPLY_PROP_STATUS */
        if (info->batt_tech >= 0)
                props++;        /* POWER_SUPPLY_PROP_TECHNOLOGY */
        if (info->batt_I2C_reg >= 0)
@@ -213,10 +215,10 @@ static int __devinit z2_batt_probe(struct i2c_client *client,
                if (ret)
                        goto err2;
 
-               set_irq_type(gpio_to_irq(info->charge_gpio),
-                               IRQ_TYPE_EDGE_BOTH);
+               irq_set_irq_type(gpio_to_irq(info->charge_gpio),
+                                IRQ_TYPE_EDGE_BOTH);
                ret = request_irq(gpio_to_irq(info->charge_gpio),
-                               z2_charge_switch_irq, IRQF_DISABLED,
+                               z2_charge_switch_irq, 0,
                                "AC Detect", charger);
                if (ret)
                        goto err3;
@@ -269,24 +271,33 @@ static int __devexit z2_batt_remove(struct i2c_client *client)
 }
 
 #ifdef CONFIG_PM
-static int z2_batt_suspend(struct i2c_client *client, pm_message_t state)
+static int z2_batt_suspend(struct device *dev)
 {
+       struct i2c_client *client = to_i2c_client(dev);
        struct z2_charger *charger = i2c_get_clientdata(client);
 
        flush_work_sync(&charger->bat_work);
        return 0;
 }
 
-static int z2_batt_resume(struct i2c_client *client)
+static int z2_batt_resume(struct device *dev)
 {
+       struct i2c_client *client = to_i2c_client(dev);
        struct z2_charger *charger = i2c_get_clientdata(client);
 
        schedule_work(&charger->bat_work);
        return 0;
 }
+
+static const struct dev_pm_ops z2_battery_pm_ops = {
+       .suspend        = z2_batt_suspend,
+       .resume         = z2_batt_resume,
+};
+
+#define        Z2_BATTERY_PM_OPS       (&z2_battery_pm_ops)
+
 #else
-#define z2_batt_suspend NULL
-#define z2_batt_resume NULL
+#define        Z2_BATTERY_PM_OPS       (NULL)
 #endif
 
 static const struct i2c_device_id z2_batt_id[] = {
@@ -299,11 +310,10 @@ static struct i2c_driver z2_batt_driver = {
        .driver = {
                .name   = "z2-battery",
                .owner  = THIS_MODULE,
+               .pm     = Z2_BATTERY_PM_OPS
        },
        .probe          = z2_batt_probe,
-       .remove         = z2_batt_remove,
-       .suspend        = z2_batt_suspend,
-       .resume         = z2_batt_resume,
+       .remove         = __devexit_p(z2_batt_remove),
        .id_table       = z2_batt_id,
 };