Matt DeVillier has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/44418 )
Change subject: superio/ite/common: Add support for closed-loop mode ......................................................................
superio/ite/common: Add support for closed-loop mode
Add support for tachometer closed loop mode, and programming of initial RPM vs initial PWM value.
Change-Id: Idff29331c979f8518021103b6f8d19e75e657e3a Signed-off-by: Matt DeVillier matt.devillier@gmail.com --- M src/superio/ite/common/env_ctrl.c M src/superio/ite/common/env_ctrl.h M src/superio/ite/common/env_ctrl_chip.h 3 files changed, 23 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/18/44418/1
diff --git a/src/superio/ite/common/env_ctrl.c b/src/superio/ite/common/env_ctrl.c index 8668110..c87f32d 100644 --- a/src/superio/ite/common/env_ctrl.c +++ b/src/superio/ite/common/env_ctrl.c @@ -128,13 +128,19 @@ pwm_ctrl = ITE_EC_FAN_CTL_PWM_MODE_AUTOMATIC; pwm_ctrl |= ITE_EC_FAN_CTL_TEMPIN(conf->tmpin);
- pwm_start = ITE_EC_FAN_CTL_PWM_START_DUTY(conf->pwm_start); - - if (CONFIG(SUPERIO_ITE_ENV_CTRL_7BIT_SLOPE_REG)) { - pwm_auto = conf->slope & 0x7f; - } else { - pwm_start |= ITE_EC_FAN_CTL_PWM_SLOPE_BIT6(conf->slope); + if (conf->clsd_loop) { + pwm_ctrl |= ITE_EC_FAN_PWM_CLSD_LOOP; + pwm_start = ITE_EC_FAN_CTL_PWM_START_RPM(conf->rpm_start); pwm_auto = ITE_EC_FAN_CTL_PWM_SLOPE_LOWER(conf->slope); + } else { + pwm_start = ITE_EC_FAN_CTL_PWM_START_DUTY(conf->pwm_start); + + if (CONFIG(SUPERIO_ITE_ENV_CTRL_7BIT_SLOPE_REG)) { + pwm_auto = conf->slope & 0x7f; + } else { + pwm_start |= ITE_EC_FAN_CTL_PWM_SLOPE_BIT6(conf->slope); + pwm_auto = ITE_EC_FAN_CTL_PWM_SLOPE_LOWER(conf->slope); + } }
if (conf->smoothing) diff --git a/src/superio/ite/common/env_ctrl.h b/src/superio/ite/common/env_ctrl.h index 7bce809..145c6c1 100644 --- a/src/superio/ite/common/env_ctrl.h +++ b/src/superio/ite/common/env_ctrl.h @@ -91,6 +91,7 @@ ? (0x1e + ((x)-4)) \ : (0x15 + ((x)-1)) \ ) +#define ITE_EC_FAN_PWM_CLSD_LOOP (1 << 2)
#if CONFIG(SUPERIO_ITE_ENV_CTRL_5FANS) #define ITE_EC_FAN_CTL_TEMPIN_MASK (7 << 3) @@ -110,6 +111,13 @@ ? ITE_EC_FAN_MAX_PWM \ : (_p * ITE_EC_FAN_MAX_PWM) / 100; \ }) +#define ITE_EC_FAN_CTL_PWM_RPM(p) \ + ({ \ + const unsigned int _p = p; \ + (_p >= 4080) \ + ? 0xFF \ + : (_p / 16); \ + })
#define ITE_EC_HIGH_TEMP_LIMIT(x) (0x40 + ((x-1) * 2)) #define ITE_EC_LOW_TEMP_LIMIT(x) (0x41 + ((x-1) * 2)) @@ -178,6 +186,7 @@ /* Common for ITE_EC_FAN_CTL_PWM_START */ #define ITE_EC_FAN_CTL_PWM_SLOPE_BIT6(s) (((s) & 0x40) << 1) #define ITE_EC_FAN_CTL_PWM_START_DUTY(p) ITE_EC_FAN_CTL_PWM_DUTY(p) +#define ITE_EC_FAN_CTL_PWM_START_RPM(p) ITE_EC_FAN_CTL_PWM_RPM(p)
/* Common for ITE_EC_FAN_CTL_PWM_AUTO */ #define ITE_EC_FAN_CTL_AUTO_SMOOTHING_EN (1 << 7) diff --git a/src/superio/ite/common/env_ctrl_chip.h b/src/superio/ite/common/env_ctrl_chip.h index fa896e4..1e1446b 100644 --- a/src/superio/ite/common/env_ctrl_chip.h +++ b/src/superio/ite/common/env_ctrl_chip.h @@ -60,6 +60,8 @@ u8 smoothing; /* enable smoothing */ u8 pwm_start; /* start at this duty cycle (%) */ u8 slope; /* increase duty cycle by `slope`%/°C */ + u8 clsd_loop; /* tachometer closed-loop mode enable */ + u8 rpm_start; /* start at this RPM (clsd_loop = 1) */ };
struct ite_ec_fan_config {
Hello Paul Menzel, Angel Pons, Felix Held,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/44418
to look at the new patch set (#2).
Change subject: superio/ite/common: Add support for closed-loop mode ......................................................................
superio/ite/common: Add support for closed-loop mode
Add support for tachometer closed loop mode, and programming of initial RPM vs initial PWM value.
Change-Id: Idff29331c979f8518021103b6f8d19e75e657e3a Signed-off-by: Matt DeVillier matt.devillier@gmail.com --- M src/superio/ite/common/env_ctrl.c M src/superio/ite/common/env_ctrl.h M src/superio/ite/common/env_ctrl_chip.h 3 files changed, 23 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/18/44418/2
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44418 )
Change subject: superio/ite/common: Add support for closed-loop mode ......................................................................
Patch Set 2: Code-Review+2
Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/44418 )
Change subject: superio/ite/common: Add support for closed-loop mode ......................................................................
superio/ite/common: Add support for closed-loop mode
Add support for tachometer closed loop mode, and programming of initial RPM vs initial PWM value.
Change-Id: Idff29331c979f8518021103b6f8d19e75e657e3a Signed-off-by: Matt DeVillier matt.devillier@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/44418 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Felix Held felix-coreboot@felixheld.de --- M src/superio/ite/common/env_ctrl.c M src/superio/ite/common/env_ctrl.h M src/superio/ite/common/env_ctrl_chip.h 3 files changed, 23 insertions(+), 6 deletions(-)
Approvals: build bot (Jenkins): Verified Felix Held: Looks good to me, approved
diff --git a/src/superio/ite/common/env_ctrl.c b/src/superio/ite/common/env_ctrl.c index 8668110..c87f32d 100644 --- a/src/superio/ite/common/env_ctrl.c +++ b/src/superio/ite/common/env_ctrl.c @@ -128,13 +128,19 @@ pwm_ctrl = ITE_EC_FAN_CTL_PWM_MODE_AUTOMATIC; pwm_ctrl |= ITE_EC_FAN_CTL_TEMPIN(conf->tmpin);
- pwm_start = ITE_EC_FAN_CTL_PWM_START_DUTY(conf->pwm_start); - - if (CONFIG(SUPERIO_ITE_ENV_CTRL_7BIT_SLOPE_REG)) { - pwm_auto = conf->slope & 0x7f; - } else { - pwm_start |= ITE_EC_FAN_CTL_PWM_SLOPE_BIT6(conf->slope); + if (conf->clsd_loop) { + pwm_ctrl |= ITE_EC_FAN_PWM_CLSD_LOOP; + pwm_start = ITE_EC_FAN_CTL_PWM_START_RPM(conf->rpm_start); pwm_auto = ITE_EC_FAN_CTL_PWM_SLOPE_LOWER(conf->slope); + } else { + pwm_start = ITE_EC_FAN_CTL_PWM_START_DUTY(conf->pwm_start); + + if (CONFIG(SUPERIO_ITE_ENV_CTRL_7BIT_SLOPE_REG)) { + pwm_auto = conf->slope & 0x7f; + } else { + pwm_start |= ITE_EC_FAN_CTL_PWM_SLOPE_BIT6(conf->slope); + pwm_auto = ITE_EC_FAN_CTL_PWM_SLOPE_LOWER(conf->slope); + } }
if (conf->smoothing) diff --git a/src/superio/ite/common/env_ctrl.h b/src/superio/ite/common/env_ctrl.h index 7bce809..145c6c1 100644 --- a/src/superio/ite/common/env_ctrl.h +++ b/src/superio/ite/common/env_ctrl.h @@ -91,6 +91,7 @@ ? (0x1e + ((x)-4)) \ : (0x15 + ((x)-1)) \ ) +#define ITE_EC_FAN_PWM_CLSD_LOOP (1 << 2)
#if CONFIG(SUPERIO_ITE_ENV_CTRL_5FANS) #define ITE_EC_FAN_CTL_TEMPIN_MASK (7 << 3) @@ -110,6 +111,13 @@ ? ITE_EC_FAN_MAX_PWM \ : (_p * ITE_EC_FAN_MAX_PWM) / 100; \ }) +#define ITE_EC_FAN_CTL_PWM_RPM(p) \ + ({ \ + const unsigned int _p = p; \ + (_p >= 4080) \ + ? 0xFF \ + : (_p / 16); \ + })
#define ITE_EC_HIGH_TEMP_LIMIT(x) (0x40 + ((x-1) * 2)) #define ITE_EC_LOW_TEMP_LIMIT(x) (0x41 + ((x-1) * 2)) @@ -178,6 +186,7 @@ /* Common for ITE_EC_FAN_CTL_PWM_START */ #define ITE_EC_FAN_CTL_PWM_SLOPE_BIT6(s) (((s) & 0x40) << 1) #define ITE_EC_FAN_CTL_PWM_START_DUTY(p) ITE_EC_FAN_CTL_PWM_DUTY(p) +#define ITE_EC_FAN_CTL_PWM_START_RPM(p) ITE_EC_FAN_CTL_PWM_RPM(p)
/* Common for ITE_EC_FAN_CTL_PWM_AUTO */ #define ITE_EC_FAN_CTL_AUTO_SMOOTHING_EN (1 << 7) diff --git a/src/superio/ite/common/env_ctrl_chip.h b/src/superio/ite/common/env_ctrl_chip.h index fa896e4..2bb0780 100644 --- a/src/superio/ite/common/env_ctrl_chip.h +++ b/src/superio/ite/common/env_ctrl_chip.h @@ -60,6 +60,8 @@ u8 smoothing; /* enable smoothing */ u8 pwm_start; /* start at this duty cycle (%) */ u8 slope; /* increase duty cycle by `slope`%/°C */ + u8 clsd_loop; /* tachometer closed-loop mode enable */ + u16 rpm_start; /* start at this RPM (clsd_loop = 1) */ };
struct ite_ec_fan_config {