power: bq2419x-charger: simplify charging current configuration
Laxman Dewangan [Sat, 1 Jun 2013 10:39:42 +0000 (15:39 +0530)]
When VBUS is detected by the USB driver and call set charging current,
there is lots of logic for cable identification based on different current
value.

All these are not require as cable identification and notification is
done in power supply extcon driver. Simplifying the set_charging_current()
implementation.

bug 1286396

Change-Id: I401b3a7f632722ca797802556c0b5d15e3a0f959
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/234765
Reviewed-by: Automatic_Commit_Validation_User

drivers/power/bq2419x-charger.c

index a4265cf..a881e6c 100644 (file)
@@ -273,28 +273,16 @@ static int bq2419x_set_charging_current(struct regulator_dev *rdev,
 
        bq_charger->in_current_limit = max_uA/1000;
        if ((val & BQ2419x_VBUS_STAT) == BQ2419x_VBUS_UNKNOWN) {
-               bq_charger->status = 0;
                bq_charger->in_current_limit = 500;
-               ret = bq2419x_init(bq_charger);
-               if (ret < 0)
-                       goto error;
-               if (bq_charger->update_status)
-                       bq_charger->update_status(bq_charger->status, 0);
-       } else if (bq_charger->in_current_limit == 500) {
-               bq_charger->status = 1;
-               ret = bq2419x_init(bq_charger);
-               if (ret < 0)
-                       goto error;
-               if (bq_charger->update_status)
-                       bq_charger->update_status(bq_charger->status, 0);
+               bq_charger->status = 0;
        } else {
                bq_charger->status = 1;
-               ret = bq2419x_init(bq_charger);
-               if (ret < 0)
-                       goto error;
-               if (bq_charger->update_status)
-                       bq_charger->update_status(bq_charger->status, 0);
        }
+       ret = bq2419x_init(bq_charger);
+       if (ret < 0)
+               goto error;
+       if (bq_charger->update_status)
+               bq_charger->update_status(bq_charger->status, 0);
        return 0;
 error:
        dev_err(bq_charger->dev, "Charger enable failed, err = %d\n", ret);