OSDN Git Service

power: supply: use power efficient workingqueues
authorJulian Liu <wlootlxt123@gmail.com>
Sun, 27 Oct 2019 14:25:31 +0000 (22:25 +0800)
committer0ranko0P <ranko0p@outlook.com>
Tue, 24 Dec 2019 20:42:44 +0000 (04:42 +0800)
* YEEEEEEE

drivers/power/supply/qcom/battery.c
drivers/power/supply/qcom/qpnp-fg-gen3.c
drivers/power/supply/qcom/qpnp-smb2.c
drivers/power/supply/qcom/smb-lib.c

index 74217a9..2684900 100644 (file)
@@ -379,7 +379,7 @@ static void pl_taper_work(struct work_struct *work)
                rerun_election(chip->fcc_votable);
                pl_dbg(chip, PR_PARALLEL, "taper entry scheduling work after %d ms\n",
                                PL_TAPER_WORK_DELAY_MS);
-               schedule_delayed_work(&chip->pl_taper_work,
+               queue_delayed_work(system_power_efficient_wq, &chip->pl_taper_work,
                                msecs_to_jiffies(PL_TAPER_WORK_DELAY_MS));
                return;
        }
@@ -530,7 +530,7 @@ static int pl_fcc_vote_callback(struct votable *votable, void *data,
                        vote(chip->pl_awake_votable, FCC_STEPPER_VOTER,
                                        true, 0);
                        get_fcc_step_update_params(chip, total_fcc_ua, 0);
-                       schedule_delayed_work(&chip->fcc_step_update_work, 0);
+                       queue_delayed_work(system_power_efficient_wq, &chip->fcc_step_update_work, 0);
 
                        return 0;
                }
@@ -552,7 +552,7 @@ static int pl_fcc_vote_callback(struct votable *votable, void *data,
                                        true, 0);
                        get_fcc_step_update_params(chip, master_fcc_ua,
                                        slave_fcc_ua);
-                       schedule_delayed_work(&chip->fcc_step_update_work, 0);
+                       queue_delayed_work(system_power_efficient_wq, &chip->fcc_step_update_work, 0);
                } else {
                        /*
                         * If there is an increase in slave share
@@ -796,7 +796,7 @@ stepper_exit:
        chip->slave_fcc_ua = parallel_fcc;
 
        if (reschedule_ms) {
-               schedule_delayed_work(&chip->fcc_step_update_work,
+               queue_delayed_work(system_power_efficient_wq, &chip->fcc_step_update_work,
                                msecs_to_jiffies(reschedule_ms));
                pr_debug("Rescheduling FCC_STEPPER work\n");
        } else {
@@ -877,7 +877,7 @@ static int usb_icl_vote_callback(struct votable *votable, void *data,
        if (icl_ua <= 1400000)
                vote(chip->pl_enable_votable_indirect, USBIN_I_VOTER, false, 0);
        else
-               schedule_delayed_work(&chip->status_change_work,
+               queue_delayed_work(system_power_efficient_wq, &chip->status_change_work,
                                                msecs_to_jiffies(PL_DELAY_MS));
 
        /* rerun AICL */
@@ -998,7 +998,7 @@ static int pl_disable_vote_callback(struct votable *votable,
                        if (pval.intval == POWER_SUPPLY_CHARGE_TYPE_TAPER) {
                                pl_dbg(chip, PR_PARALLEL,
                                        "pl enabled in Taper scheduing work\n");
-                               schedule_delayed_work(&chip->pl_taper_work, 0);
+                               queue_delayed_work(system_power_efficient_wq, &chip->pl_taper_work, 0);
                        }
                }
        } else {
@@ -1023,7 +1023,7 @@ static int pl_disable_vote_callback(struct votable *votable,
 
                cancel_delayed_work_sync(&chip->pl_awake_work);
                if (chip->pl_awake_votable)
-                       schedule_delayed_work(&chip->pl_awake_work,
+                       queue_delayed_work(system_power_efficient_wq, &chip->pl_awake_work,
                                                        msecs_to_jiffies(5000));
        }
 
@@ -1152,7 +1152,7 @@ static void handle_main_charge_type(struct pl_data *chip)
                && (pval.intval == POWER_SUPPLY_CHARGE_TYPE_TAPER)) {
                chip->charge_type = pval.intval;
                pl_dbg(chip, PR_PARALLEL, "taper entry scheduling work\n");
-               schedule_delayed_work(&chip->pl_taper_work, 0);
+               queue_delayed_work(system_power_efficient_wq, &chip->pl_taper_work, 0);
                return;
        }
 
@@ -1307,7 +1307,7 @@ static int pl_notifier_call(struct notifier_block *nb,
        if ((strcmp(psy->desc->name, "parallel") == 0)
            || (strcmp(psy->desc->name, "battery") == 0)
            || (strcmp(psy->desc->name, "main") == 0))
-               schedule_delayed_work(&chip->status_change_work, 0);
+               queue_delayed_work(system_power_efficient_wq, &chip->status_change_work, 0);
 
        return NOTIFY_OK;
 }
index 6a785be..a7d673f 100644 (file)
@@ -2581,7 +2581,7 @@ static void fg_ttf_update(struct fg_chip *chip)
        chip->ttf.last_ttf = 0;
        chip->ttf.last_ms = 0;
        mutex_unlock(&chip->ttf.lock);
-       schedule_delayed_work(&chip->ttf_work, msecs_to_jiffies(delay_ms));
+       queue_delayed_work(system_power_efficient_wq, &chip->ttf_work, msecs_to_jiffies(delay_ms));
 }
 
 static void restore_cycle_counter(struct fg_chip *chip)
@@ -3161,7 +3161,7 @@ static void sram_dump_work(struct work_struct *work)
        fg_dbg(chip, FG_STATUS, "SRAM Dump done at %lld.%d\n",
                quotient, remainder);
 resched:
-       schedule_delayed_work(&chip->sram_dump_work,
+       queue_delayed_work(system_power_efficient_wq, &chip->sram_dump_work,
                        msecs_to_jiffies(fg_sram_dump_period_ms));
 }
 
@@ -3189,7 +3189,7 @@ static int fg_sram_dump_sysfs(const char *val, const struct kernel_param *kp)
 
        chip = power_supply_get_drvdata(bms_psy);
        if (fg_sram_dump)
-               schedule_delayed_work(&chip->sram_dump_work,
+               queue_delayed_work(system_power_efficient_wq, &chip->sram_dump_work,
                                msecs_to_jiffies(fg_sram_dump_period_ms));
        else
                cancel_delayed_work_sync(&chip->sram_dump_work);
@@ -3756,7 +3756,7 @@ static void ttf_work(struct work_struct *work)
                /* keep the wake lock and prime the IBATT and VBATT buffers */
                if (ttf < 0) {
                        /* delay for one FG cycle */
-                       schedule_delayed_work(&chip->ttf_work,
+                       queue_delayed_work(system_power_efficient_wq, &chip->ttf_work,
                                                        msecs_to_jiffies(1500));
                        mutex_unlock(&chip->ttf.lock);
                        return;
@@ -3773,7 +3773,7 @@ static void ttf_work(struct work_struct *work)
        }
 
        /* recurse every 10 seconds */
-       schedule_delayed_work(&chip->ttf_work, msecs_to_jiffies(10000));
+       queue_delayed_work(system_power_efficient_wq, &chip->ttf_work, msecs_to_jiffies(10000));
 end_work:
        vote(chip->awake_votable, TTF_PRIMING, false, 0);
        mutex_unlock(&chip->ttf.lock);
@@ -4530,7 +4530,7 @@ static irqreturn_t fg_batt_missing_irq_handler(int irq, void *data)
        }
 
        clear_battery_profile(chip);
-       schedule_delayed_work(&chip->profile_load_work, 0);
+       queue_delayed_work(system_power_efficient_wq, &chip->profile_load_work, 0);
 
        if (chip->fg_psy)
                power_supply_changed(chip->fg_psy);
@@ -5386,7 +5386,7 @@ static void soc_work_fn(struct work_struct *work)
                prev_soc = soc;
        }
 
-       schedule_delayed_work(
+       queue_delayed_work(system_power_efficient_wq, 
                &chip->soc_work, msecs_to_jiffies(SOC_WORK_MS));
 }
 
@@ -5542,7 +5542,7 @@ static void soc_monitor_work(struct work_struct *work)
                        chip->param.batt_soc, chip->param.batt_raw_soc,
                        chip->param.batt_ma, chip->charge_status);
 
-       schedule_delayed_work(&chip->soc_monitor_work,
+       queue_delayed_work(system_power_efficient_wq, &chip->soc_monitor_work,
                        msecs_to_jiffies(MONITOR_SOC_WAIT_PER_MS));
 }
 
@@ -5745,11 +5745,11 @@ static int fg_gen3_probe(struct platform_device *pdev)
        }
 
        device_init_wakeup(chip->dev, true);
-       schedule_delayed_work(&chip->profile_load_work, 0);
-       schedule_delayed_work(&chip->soc_work, 0);
+       queue_delayed_work(system_power_efficient_wq, &chip->profile_load_work, 0);
+       queue_delayed_work(system_power_efficient_wq, &chip->soc_work, 0);
 
        chip->param.batt_soc = -EINVAL;
-       schedule_delayed_work(&chip->soc_monitor_work,
+       queue_delayed_work(system_power_efficient_wq, &chip->soc_monitor_work,
                        msecs_to_jiffies(MONITOR_SOC_WAIT_MS));
 
        pr_debug("FG GEN3 driver probed successfully\n");
@@ -5787,9 +5787,9 @@ static int fg_gen3_resume(struct device *dev)
        if (rc < 0)
                pr_err("Error in configuring ESR timer, rc=%d\n", rc);
 
-       schedule_delayed_work(&chip->ttf_work, 0);
+       queue_delayed_work(system_power_efficient_wq, &chip->ttf_work, 0);
        if (fg_sram_dump)
-               schedule_delayed_work(&chip->sram_dump_work,
+               queue_delayed_work(system_power_efficient_wq, &chip->sram_dump_work,
                                msecs_to_jiffies(fg_sram_dump_period_ms));
 
        if (!work_pending(&chip->status_change_work)) {
@@ -5802,7 +5802,7 @@ static int fg_gen3_resume(struct device *dev)
        chip->param.update_now = true;
        spin_unlock(&chip->suspend_lock);
 
-       schedule_delayed_work(&chip->soc_monitor_work,
+       queue_delayed_work(system_power_efficient_wq, &chip->soc_monitor_work,
                        msecs_to_jiffies(MONITOR_SOC_WAIT_MS));
 
        return 0;
index 258ced3..f7a94a7 100644 (file)
@@ -2513,7 +2513,7 @@ static int smb2_probe(struct platform_device *pdev)
                usb_present, chg->real_charger_type,
                batt_present, batt_health, batt_charge_type);
 
-       schedule_delayed_work(&chg->reg_work, 60 * HZ);
+       queue_delayed_work(system_power_efficient_wq, &chg->reg_work, 60 * HZ);
        return rc;
 
 cleanup:
index 84d6086..6ec22ab 100644 (file)
@@ -166,7 +166,7 @@ static void smblib_monitor_low_temp_work(struct work_struct *work)
                        jeita_cc_delta_ua = 0;
                }
        }
-       schedule_delayed_work(&chg->monitor_low_temp_work,
+       queue_delayed_work(system_power_efficient_wq, &chg->monitor_low_temp_work,
                                msecs_to_jiffies(CHG_MONITOR_WORK_DELAY_MS));
 
 }
@@ -3772,15 +3772,15 @@ void smblib_usb_plugin_locked(struct smb_charger *chg)
 
                /* Schedule work to enable parallel charger */
                vote(chg->awake_votable, PL_DELAY_VOTER, true, 0);
-               schedule_delayed_work(&chg->pl_enable_work,
+               queue_delayed_work(system_power_efficient_wq, &chg->pl_enable_work,
                                        msecs_to_jiffies(PL_DELAY_MS));
-               schedule_delayed_work(&chg->monitor_low_temp_work,
+               queue_delayed_work(system_power_efficient_wq, &chg->monitor_low_temp_work,
                                msecs_to_jiffies(CHG_MONITOR_WORK_DELAY_MS));
 /*
-               schedule_delayed_work(&chg->cc_float_charge_work,
+               queue_delayed_work(system_power_efficient_wq, &chg->cc_float_charge_work,
                                        msecs_to_jiffies(CC_FLOAT_WORK_START_DELAY_MS));
 */
-               schedule_delayed_work(&chg->typec_reenable_work,
+               queue_delayed_work(system_power_efficient_wq, &chg->typec_reenable_work,
                                        msecs_to_jiffies(300));
        } else {
                cancel_delayed_work_sync(&chg->charger_type_recheck);
@@ -3871,7 +3871,7 @@ irqreturn_t smblib_handle_icl_change(int irq, void *data)
                        delay = 0;
 
                cancel_delayed_work_sync(&chg->icl_change_work);
-               schedule_delayed_work(&chg->icl_change_work,
+               queue_delayed_work(system_power_efficient_wq, &chg->icl_change_work,
                                                msecs_to_jiffies(delay));
        }
 
@@ -4040,7 +4040,7 @@ static void smblib_handle_hvdcp_3p0_auth_done(struct smb_charger *chg,
                        current_ua = DCP_CURRENT_UA;
 
                if (!chg->check_vbus_once) {
-                       schedule_delayed_work(&chg->check_vbus_work,
+                       queue_delayed_work(system_power_efficient_wq, &chg->check_vbus_work,
                                msecs_to_jiffies(CHECK_VBUS_WORK_DELAY_MS));
                        chg->check_vbus_once = true;
                }
@@ -4224,7 +4224,7 @@ static void smblib_handle_apsd_done(struct smb_charger *chg, bool rising)
                break;
        case DCP_CHARGER_BIT:
                if (chg->wa_flags & QC_CHARGER_DETECTION_WA_BIT)
-                       schedule_delayed_work(&chg->hvdcp_detect_work,
+                       queue_delayed_work(system_power_efficient_wq, &chg->hvdcp_detect_work,
                                              msecs_to_jiffies(HVDCP_DET_MS));
                break;
        default:
@@ -4745,7 +4745,7 @@ static void smblib_handle_typec_cc_state_change(struct smb_charger *chg)
                smblib_dbg(chg, PR_OEM, "TypeC %s insertion\n",
                        smblib_typec_mode_name[chg->typec_mode]);
                smblib_handle_typec_insertion(chg);
-               schedule_delayed_work(&chg->charger_type_recheck, msecs_to_jiffies(20000));
+               queue_delayed_work(system_power_efficient_wq, &chg->charger_type_recheck, msecs_to_jiffies(20000));
        } else if (chg->typec_present &&
                                chg->typec_mode == POWER_SUPPLY_TYPEC_NONE) {
                cancel_delayed_work_sync(&chg->charger_type_recheck);
@@ -4789,7 +4789,7 @@ irqreturn_t smblib_handle_usb_typec_change(int irq, void *data)
                cancel_delayed_work_sync(&chg->uusb_otg_work);
                vote(chg->awake_votable, OTG_DELAY_VOTER, true, 0);
                smblib_dbg(chg, PR_INTERRUPT, "Scheduling OTG work\n");
-               schedule_delayed_work(&chg->uusb_otg_work,
+               queue_delayed_work(system_power_efficient_wq, &chg->uusb_otg_work,
                                msecs_to_jiffies(chg->otg_delay_ms));
                return IRQ_HANDLED;
        }
@@ -4833,7 +4833,7 @@ irqreturn_t smblib_handle_high_duty_cycle(int irq, void *data)
        if (chg->irq_info[HIGH_DUTY_CYCLE_IRQ].irq)
                disable_irq_nosync(chg->irq_info[HIGH_DUTY_CYCLE_IRQ].irq);
 
-       schedule_delayed_work(&chg->clear_hdc_work, msecs_to_jiffies(60));
+       queue_delayed_work(system_power_efficient_wq, &chg->clear_hdc_work, msecs_to_jiffies(60));
 
        return IRQ_HANDLED;
 }
@@ -4899,7 +4899,7 @@ irqreturn_t smblib_handle_switcher_power_ok(int irq, void *data)
                         * permanently suspending the input if the boost-back
                         * condition is unintentionally hit.
                         */
-                       schedule_delayed_work(&chg->bb_removal_work,
+                       queue_delayed_work(system_power_efficient_wq, &chg->bb_removal_work,
                                msecs_to_jiffies(BOOST_BACK_UNVOTE_DELAY_MS));
                }
        }
@@ -5132,7 +5132,7 @@ static void smblib_otg_oc_work(struct work_struct *work)
         * triggered then it is likely that the software based soft start was
         * successful and the VBUS < 1V restriction should be re-enabled.
         */
-       schedule_delayed_work(&chg->otg_ss_done_work, msecs_to_jiffies(500));
+       queue_delayed_work(system_power_efficient_wq, &chg->otg_ss_done_work, msecs_to_jiffies(500));
 
        rc = _smblib_vbus_regulator_disable(chg->vbus_vreg->rdev);
        if (rc < 0) {
@@ -5306,7 +5306,7 @@ static void smblib_reg_work(struct work_struct *work)
        rc = smblib_get_prop_usb_present(chg, &val);
        if (rc < 0) {
                pr_err("Couldn't get usb present rc=%d\n", rc);
-               schedule_delayed_work(&chg->reg_work,
+               queue_delayed_work(system_power_efficient_wq, &chg->reg_work,
                                        NOT_CHARGING_PERIOD_S * HZ);
                return;
        }
@@ -5381,10 +5381,10 @@ static void smblib_reg_work(struct work_struct *work)
                smblib_dbg(chg, PR_OEM, "Type-C orientation[%d], Type-C mode[%d], Real Charge Type[%d]\n",
                                        typec_orientation, typec_mode, charge_type);
 
-               schedule_delayed_work(&chg->reg_work, CHARGING_PERIOD_S * HZ);
+               queue_delayed_work(system_power_efficient_wq, &chg->reg_work, CHARGING_PERIOD_S * HZ);
        }
        else
-               schedule_delayed_work(&chg->reg_work, NOT_CHARGING_PERIOD_S * HZ);
+               queue_delayed_work(system_power_efficient_wq, &chg->reg_work, NOT_CHARGING_PERIOD_S * HZ);
 }
 
 static void smblib_legacy_detection_work(struct work_struct *work)
@@ -5486,7 +5486,7 @@ unlock:
 
        mutex_unlock(&chg->lock);
 
-       schedule_delayed_work(&chg->cc_float_charge_work,
+       queue_delayed_work(system_power_efficient_wq, &chg->cc_float_charge_work,
                                        msecs_to_jiffies(200));
 
 }
@@ -5551,7 +5551,7 @@ static void smblib_charger_type_recheck(struct work_struct *work)
 
 check_next:
        check_count++;
-       schedule_delayed_work(&chg->charger_type_recheck, msecs_to_jiffies(recheck_time));
+       queue_delayed_work(system_power_efficient_wq, &chg->charger_type_recheck, msecs_to_jiffies(recheck_time));
 }
 
 static int smblib_create_votables(struct smb_charger *chg)