diff options
-rw-r--r-- | driver/charger/isl9241.h | 16 | ||||
-rw-r--r-- | zephyr/dts/bindings/charger/intersil,isl9241.yaml | 18 | ||||
-rw-r--r-- | zephyr/include/dt-bindings/charger/intersil_isl9241.h | 18 | ||||
-rw-r--r-- | zephyr/shim/include/config_chip.h | 12 |
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 |