google/gru: update the pwm regulator

As David commented the "Bob and other follow-ons match Gru, Kevin should
be the special case here", and update the calculations value for gru/bob
board.

From the actual tests, some regulator voltage than the actual set of less
than 20mv on bob board. (e.g: little-cpus and Center-logic) Update the
{min, max} regulator voltage for Bob board. Make sure we get the accurate
voltage.

BUG=chrome-os-partner:61497
BRANCH=none
TEST=boot up Bob, measure the voltage for little cpu and C-logic.

Change-Id: Iad881b41d67708776bfb681487cf8cec8518064e
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 25e133815f49018e7496c75077b8559c207350a4
Original-Change-Id: I3098c742c7ec355c88f45bd1d93f878a7976a6b4
Original-Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Original-Signed-off-by: Shasha Zhao <Sarah_Zhao@asus.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/424523
Original-Reviewed-by: David Schneider <dnschneid@chromium.org>
Original-Reviewed-by: Brian Norris <briannorris@chromium.org>
Original-Signed-off-by: Shasha Zhao <Sarah_Zhao@asus.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/430403
Original-Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/18460
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Caesar Wang 2017-01-04 18:26:04 +08:00 committed by Patrick Georgi
parent d56fae18dc
commit 8c454aaafa
1 changed files with 20 additions and 10 deletions

View File

@ -29,28 +29,38 @@
* clock dividers we actually get 3337. * clock dividers we actually get 3337.
*/ */
#define PWM_PERIOD 3337 #define PWM_PERIOD 3337
#define PWM_DESIGN_VOLTAGE_MIN 8000 #define PWM_DESIGN_VOLTAGE_MIN_OUTDATED 8000
#define PWM_DESIGN_VOLTAGE_MAX 15000 #define PWM_DESIGN_VOLTAGE_MAX_OUTDATED 15000
/* Later boards (Kevin rev6+, Gru rev2+) use different regulator ranges. */ /* Later boards (Kevin rev6+, Gru rev2+) use different regulator ranges. */
int pwm_design_voltage_later[][2] = { int kevin6_pwm_design_voltage[][2] = {
[PWM_REGULATOR_GPU] = {7858, 12177}, [PWM_REGULATOR_GPU] = {7858, 12177},
[PWM_REGULATOR_BIG] = {7987, 13022}, [PWM_REGULATOR_BIG] = {7987, 13022},
[PWM_REGULATOR_LIT] = {7991, 13037}, [PWM_REGULATOR_LIT] = {7991, 13037},
[PWM_REGULATOR_CENTERLOG] = {8001, 10497} [PWM_REGULATOR_CENTERLOG] = {8001, 10497}
}; };
int pwm_design_voltage[][2] = {
[PWM_REGULATOR_GPU] = {7864, 12177},
[PWM_REGULATOR_BIG] = {8001, 13022},
[PWM_REGULATOR_LIT] = {7977, 13078},
[PWM_REGULATOR_CENTERLOG] = {7994, 10499}
};
void pwm_regulator_configure(enum pwm_regulator pwm, int millivolt) void pwm_regulator_configure(enum pwm_regulator pwm, int millivolt)
{ {
int duty_ns, voltage_max, voltage_min; int duty_ns, voltage_max, voltage_min;
int voltage = millivolt * 10; /* for higer calculation accuracy */ int voltage = millivolt * 10; /* for higer calculation accuracy */
voltage_min = PWM_DESIGN_VOLTAGE_MIN; voltage_min = pwm_design_voltage[pwm][0];
voltage_max = PWM_DESIGN_VOLTAGE_MAX; voltage_max = pwm_design_voltage[pwm][1];
if (!(IS_ENABLED(CONFIG_BOARD_GOOGLE_KEVIN) && board_id() < 6) && if ((IS_ENABLED(CONFIG_BOARD_GOOGLE_KEVIN) && board_id() < 6) ||
!(IS_ENABLED(CONFIG_BOARD_GOOGLE_GRU) && board_id() < 2)) { (IS_ENABLED(CONFIG_BOARD_GOOGLE_GRU) && board_id() < 2)) {
voltage_min = pwm_design_voltage_later[pwm][0]; voltage_min = PWM_DESIGN_VOLTAGE_MIN_OUTDATED;
voltage_max = pwm_design_voltage_later[pwm][1]; voltage_max = PWM_DESIGN_VOLTAGE_MAX_OUTDATED;
} else if (IS_ENABLED(CONFIG_BOARD_GOOGLE_KEVIN) && board_id() >= 6){
voltage_min = kevin6_pwm_design_voltage[pwm][0];
voltage_max = kevin6_pwm_design_voltage[pwm][1];
} }
assert(voltage <= voltage_max && voltage >= voltage_min); assert(voltage <= voltage_max && voltage >= voltage_min);