summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2021-03-10 13:31:15 -0700
committerCommit Bot <commit-bot@chromium.org>2021-03-19 17:39:50 +0000
commit054968a6d677caeccd59b7f8ec14871d1a33eaba (patch)
tree7afebb11712eab9a92c35943f8e65f0c08adf1e4
parent86fc12a3155e9c89295d64ece856c15f872e0159 (diff)
downloadchrome-ec-054968a6d677caeccd59b7f8ec14871d1a33eaba.tar.gz
isl9241: Add devicetree property for switching frequency
Update the isl9241 driver to support overriding the charger switching frequency using a devicetree property. BUG=b:182300938 BRANCH=none TEST=make buildall, zmake testall TEST=Boot zephyr-ec on volteer, verify ISL9241 charging frequency via register dump. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ic1c3bb24b79ae6e10082cdb79bdb9edc327064a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2754489 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774585 Tested-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--driver/charger/isl9241.h16
-rw-r--r--zephyr/dts/bindings/charger/intersil,isl9241.yaml18
-rw-r--r--zephyr/include/dt-bindings/charger/intersil_isl9241.h18
-rw-r--r--zephyr/shim/include/config_chip.h12
4 files changed, 52 insertions, 12 deletions
diff --git a/driver/charger/isl9241.h b/driver/charger/isl9241.h
index 953d9764b9..0e5acd09df 100644
--- a/driver/charger/isl9241.h
+++ b/driver/charger/isl9241.h
@@ -47,8 +47,11 @@
#define ISL9241_REG_CONTROL1 0x3C
#define ISL9241_CONTROL1_PSYS BIT(3)
#define ISL9241_CONTROL1_LEARN_MODE BIT(12)
+/*
+ * 9:7 - Switching Frequency
+ */
#define ISL9241_CONTROL1_SWITCHING_FREQ_MASK 0x380
-#define ISL9241_CONTROL1_SWITCHING_FREQ_1402KHZ 0
+#define ISL9241_CONTROL1_SWITCHING_FREQ_1420KHZ 0
#define ISL9241_CONTROL1_SWITCHING_FREQ_1180KHZ 1
#define ISL9241_CONTROL1_SWITCHING_FREQ_1020KHZ 2
#define ISL9241_CONTROL1_SWITCHING_FREQ_890KHZ 3
@@ -56,17 +59,6 @@
#define ISL9241_CONTROL1_SWITCHING_FREQ_724KHZ 5
#define ISL9241_CONTROL1_SWITCHING_FREQ_656KHZ 6
#define ISL9241_CONTROL1_SWITCHING_FREQ_600KHZ 7
-/*
- * 9:7 - Switching Frequency
- * <000> 1420kHz
- * <001> 1180kHz
- * <010> 1020kHz
- * <011> 890kHz
- * <100> 808kHz
- * <101> 724kHz
- * <110> 656kHz
- * <111> 600kHz
- */
/* Configures various charger options */
#define ISL9241_REG_CONTROL2 0x3D
diff --git a/zephyr/dts/bindings/charger/intersil,isl9241.yaml b/zephyr/dts/bindings/charger/intersil,isl9241.yaml
new file mode 100644
index 0000000000..7557b949d8
--- /dev/null
+++ b/zephyr/dts/bindings/charger/intersil,isl9241.yaml
@@ -0,0 +1,18 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+description: Intersil ISL9241 Charger IC
+
+compatible: "intersil,isl9241"
+
+include: i2c-device.yaml
+
+properties:
+ switching-frequency:
+ type: int
+ required: false
+ description:
+ Sets the charger switching frequency. If not defined then the switching
+ frequency is configured by the resistor connected to the PROG pin on
+ the board.
diff --git a/zephyr/include/dt-bindings/charger/intersil_isl9241.h b/zephyr/include/dt-bindings/charger/intersil_isl9241.h
new file mode 100644
index 0000000000..5a2742570e
--- /dev/null
+++ b/zephyr/include/dt-bindings/charger/intersil_isl9241.h
@@ -0,0 +1,18 @@
+/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CHARGER_INTERSIL_ISL9241_H_
+#define ZEPHYR_INCLUDE_DT_BINDINGS_CHARGER_INTERSIL_ISL9241_H_
+
+#define SWITCHING_FREQ_1420KHZ 0
+#define SWITCHING_FREQ_1180KHZ 1
+#define SWITCHING_FREQ_1020KHZ 2
+#define SWITCHING_FREQ_890KHZ 3
+#define SWITCHING_FREQ_808KHZ 4
+#define SWITCHING_FREQ_724KHZ 5
+#define SWITCHING_FREQ_656KHZ 6
+#define SWITCHING_FREQ_600KHZ 7
+
+#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CHARGER_INTERSIL_ISL9241_H_ */
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 087de67bed..df83508216 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -137,6 +137,18 @@ enum battery_type {
#define CONFIG_CHARGER_INPUT_CURRENT 512
#endif
+/*
+ * Note - ISL9241 chargers for all channels are configured with the same
+ * switching frequency. Use the first ISL9241 instance found in the device tree.
+ */
+#undef CONFIG_ISL9241_SWITCHING_FREQ
+#define ISL9241_NODE DT_INST(0, intersil_isl9241)
+#if DT_NODE_EXISTS(ISL9241_NODE) && \
+ DT_NODE_HAS_PROP(ISL9241_NODE, switching_frequency)
+#define CONFIG_ISL9241_SWITCHING_FREQ \
+ DT_PROP(ISL9241_NODE, switching_frequency)
+#endif
+
#undef CONFIG_CHIPSET_RESET_HOOK
#ifdef CONFIG_PLATFORM_EC_CHIPSET_RESET_HOOK
#define CONFIG_CHIPSET_RESET_HOOK