diff --git a/Documentation/devicetree/bindings/regulator/cpr3-regulator.txt b/Documentation/devicetree/bindings/regulator/cpr3-regulator.txt index 846bd22e5fcb..b02d759b1cf7 100644 --- a/Documentation/devicetree/bindings/regulator/cpr3-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/cpr3-regulator.txt @@ -241,6 +241,15 @@ Platform independent properties: time in order to allow hardware closed-loop CPR voltage change requests to reach the PMIC regulator. +- qcom,cpr-thread-has-always-vote-en + Usage: optional; only meaningful for CPR4 controller + Value type: + Definition: Boolean value which indicates that the CPR controller should + be configured to keep thread vote always enabled. This + configuration allows the CPR controller to not consider + MID/DN recommendations from other thread when all sensors + mapped to a thread collapsed. + ================================================= Second Level Nodes - CPR Threads for a Controller ================================================= diff --git a/drivers/regulator/cpr3-regulator.c b/drivers/regulator/cpr3-regulator.c index 95100168f391..2eff0cff234e 100644 --- a/drivers/regulator/cpr3-regulator.c +++ b/drivers/regulator/cpr3-regulator.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -178,6 +178,7 @@ #define CPR4_REG_MISC 0x700 #define CPR4_MISC_RESET_STEP_QUOT_LOOP_EN BIT(2) +#define CPR4_MISC_THREAD_HAS_ALWAYS_VOTE_EN BIT(3) #define CPR4_MISC_MARGIN_TABLE_ROW_SELECT_MASK GENMASK(23, 20) #define CPR4_MISC_MARGIN_TABLE_ROW_SELECT_SHIFT 20 #define CPR4_MISC_TEMP_SENSOR_ID_START_MASK GENMASK(27, 24) @@ -733,6 +734,11 @@ static int cpr3_regulator_init_cpr4(struct cpr3_controller *ctrl) CPR4_MISC_RESET_STEP_QUOT_LOOP_EN, CPR4_MISC_RESET_STEP_QUOT_LOOP_EN); + if (ctrl->thread_has_always_vote_en) + cpr3_masked_write(ctrl, CPR4_REG_MISC, + CPR4_MISC_THREAD_HAS_ALWAYS_VOTE_EN, + CPR4_MISC_THREAD_HAS_ALWAYS_VOTE_EN); + if (ctrl->supports_hw_closed_loop) { if (ctrl->saw_use_unit_mV) pmic_step_size = ctrl->step_volt / 1000; diff --git a/drivers/regulator/cpr3-regulator.h b/drivers/regulator/cpr3-regulator.h index 778f4824bdf6..39d3f820c153 100644 --- a/drivers/regulator/cpr3-regulator.h +++ b/drivers/regulator/cpr3-regulator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -766,6 +766,12 @@ struct cpr3_panic_regs_info { * the CPR controller to first use the default step_quot * and then later switch to the run-time calibrated * step_quot. + * @thread_has_always_vote_en: Boolean value which indicates that this CPR + * controller should be configured to keep thread vote + * always enabled. This configuration allows the CPR + * controller to not consider MID/DN recommendations from + * other thread when all sensors mapped to a thread + * collapsed. * * This structure contains both configuration and runtime state data. The * elements cpr_allowed_sw, use_hw_closed_loop, aggr_corner, cpr_enabled, @@ -879,6 +885,7 @@ struct cpr3_controller { struct notifier_block panic_notifier; bool support_ldo300_vreg; bool reset_step_quot_loop_en; + bool thread_has_always_vote_en; }; /* Used for rounding voltages to the closest physically available set point. */ diff --git a/drivers/regulator/cpr3-util.c b/drivers/regulator/cpr3-util.c index 39ee3c551e02..9e138ce28944 100644 --- a/drivers/regulator/cpr3-util.c +++ b/drivers/regulator/cpr3-util.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1240,6 +1240,16 @@ int cpr3_parse_common_ctrl_data(struct cpr3_controller *ctrl) = of_property_read_bool(ctrl->dev->of_node, "qcom,cpr-reset-step-quot-loop-en"); + /* + * Configure CPR controller to not consider MID/DN recommendations + * from other thread when all sensors mapped to a thread collapsed + * in a multi-thread configuration. + */ + if (ctrl->thread_count > 1) + ctrl->thread_has_always_vote_en + = of_property_read_bool(ctrl->dev->of_node, + "qcom,cpr-thread-has-always-vote-en"); + /* * Regulator device handles are not necessary for CPRh controllers * since communication with the regulators is completely managed