regulator: cpr3: Configure CPR4 to keep thread vote

Configure CPR4 controller to always keep thread vote
when both HW threads enabled so that the controller
does not consider MID/DN recommendations from other
thread when all sensors mapped to a thread collapsed.

CRs-Fixed: 2233565
Change-Id: I4c6a78b9b7e161da0be9b65bacfc601bde9f5c7a
Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
This commit is contained in:
Tirupathi Reddy 2018-05-17 11:15:14 +05:30
commit 2b798d627e
4 changed files with 35 additions and 3 deletions

View file

@ -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: <empty>
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
=================================================

View file

@ -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;

View file

@ -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. */

View file

@ -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