summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunlong Jia <yunlong.jia@ecs.corp-partner.google.com>2022-02-11 12:09:28 +0000
committerCommit Bot <commit-bot@chromium.org>2022-02-16 22:50:30 +0000
commitc458a885ce2d0d8a576af4237563105c8b24b67e (patch)
treee5ab85acb73241e1ce6844f9443b3e8968ccd434
parent069f0fe23aa86f56d861d519f1db4365cb8103ed (diff)
downloadchrome-ec-c458a885ce2d0d8a576af4237563105c8b24b67e.tar.gz
pazquel: Change PVC mode of DA9313 to improve high frequency noise
Our team found the source of high frequency noise coming from the DA9313. Change the DA9313 PVC mode as follows: S0 -> S3 : PVC operates in auto frequency mode S3 -> S0 : PVC operates in fixed frequency mode and no more high frequency noise heard BUG=b:218973914 BRANCH=trogdor TEST=test again and no more high frequency noise heard Signed-off-by: Yunlong Jia <yunlong.jia@ecs.corp-partner.google.com> Change-Id: If6ef403ea80dc1a006fd259d58ced7373b39c0ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3455503 Reviewed-by: Bob Moragues <moragues@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
-rw-r--r--board/pazquel/board.c28
-rw-r--r--board/pazquel/board.h5
2 files changed, 33 insertions, 0 deletions
diff --git a/board/pazquel/board.c b/board/pazquel/board.c
index 2b06f53f33..1d3a601fad 100644
--- a/board/pazquel/board.c
+++ b/board/pazquel/board.c
@@ -356,6 +356,29 @@ void board_tcpc_init(void)
}
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+static void da9313_pvc_mode_ctrl(int enable)
+{
+ /*
+ * On enable, PVC operates in automatic frequency mode.
+ * On disable, PVC operates in fixed frequency mode.
+ */
+ if (enable)
+ i2c_update8(I2C_PORT_POWER, DA9313_I2C_ADDR_FLAGS,
+ DA9313_REG_PVC_CTRL,
+ DA9313_PVC_CTRL_PVC_MODE, MASK_SET);
+ else
+ i2c_update8(I2C_PORT_POWER, DA9313_I2C_ADDR_FLAGS,
+ DA9313_REG_PVC_CTRL,
+ DA9313_PVC_CTRL_PVC_MODE, MASK_CLR);
+}
+
+void da9313_init(void)
+{
+ /* PVC operates in fixed frequency mode in S0. */
+ da9313_pvc_mode_ctrl(0);
+}
+DECLARE_HOOK(HOOK_INIT, da9313_init, HOOK_PRIO_DEFAULT+1);
+
void board_hibernate(void)
{
int i;
@@ -387,12 +410,17 @@ static void board_chipset_suspend(void)
*/
gpio_set_level(GPIO_ENABLE_BACKLIGHT, 0);
pwm_enable(PWM_CH_DISPLIGHT, 0);
+
+ /* PVC operates in automatic frequency mode in S3. */
+ da9313_pvc_mode_ctrl(1);
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
/* Called on AP S3 -> S0 transition */
static void board_chipset_resume(void)
{
+ /* PVC operates in fixed frequency mode in S0. */
+ da9313_pvc_mode_ctrl(0);
/* Turn on display and keyboard backlight in S0. */
gpio_set_level(GPIO_ENABLE_BACKLIGHT, 1);
if (pwm_get_duty(PWM_CH_DISPLIGHT))
diff --git a/board/pazquel/board.h b/board/pazquel/board.h
index f3a0d55b17..b55fe0974e 100644
--- a/board/pazquel/board.h
+++ b/board/pazquel/board.h
@@ -72,6 +72,11 @@
#define GPIO_WP_L GPIO_EC_WP_ODL
#define GPIO_SWITCHCAP_PG GPIO_SWITCHCAP_GPIO_1
#define GPIO_ACOK_OD GPIO_CHG_ACOK_OD
+/* Da9313 */
+#define DA9313_I2C_ADDR_FLAGS 0x68
+#define DA9313_REG_PVC_CTRL 0x04
+#define DA9313_PVC_CTRL_PVC_MODE BIT(1)
+#define DA9313_PVC_CTRL_PVC_EN BIT(0)
#ifndef __ASSEMBLER__