power: supply: charger-manager: Don't start charging in cable nofitication
authorJonghwa Lee <jonghwa3.lee@samsung.com>
Thu, 14 May 2020 23:04:32 +0000 (16:04 -0700)
committerSebastian Reichel <sre@kernel.org>
Fri, 28 Aug 2020 17:27:45 +0000 (19:27 +0200)
Prevents direct charging control in cable notification and only set the
input current limit according to cable type.  Leave the enabling of
charing to cm_monitor() where charging management proceeds.  We may lose
a few ms to enable charging compared to before, but it's more important
that charging is enabled always in safe context.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/charger-manager.c

index d10bf89..d3b2ed3 100644 (file)
@@ -907,7 +907,8 @@ static void charger_extcon_work(struct work_struct *work)
                        cable->min_uA, cable->max_uA);
        }
 
-       try_charger_enable(cable->cm, cable->attached);
+       cancel_delayed_work(&cm_monitor_work);
+       queue_delayed_work(cm_wq, &cm_monitor_work, 0);
 }
 
 /**
@@ -931,15 +932,6 @@ static int charger_extcon_notifier(struct notifier_block *self,
        cable->attached = event;
 
        /*
-        * Setup monitoring to check battery state
-        * when charger cable is attached.
-        */
-       if (cable->attached && is_polling_required(cable->cm)) {
-               cancel_work_sync(&setup_polling);
-               schedule_work(&setup_polling);
-       }
-
-       /*
         * Setup work for controlling charger(regulator)
         * according to charger cable.
         */