Skip to content

Commit 23d3f73

Browse files
author
Dmitry Rakhchev
committed
charger: bq25180: add support for bq25188
RT1002-22: add support for bq25188. There are some new features in bq25188 when compared to bq25180. Otherwise, they are mostly identical. Update driver to allow bq25188 ID, make sure previosly reserved bit is masked on read. No support for new features.
1 parent 8f5cdc1 commit 23d3f73

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/charger/charger_bq25180.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ LOG_MODULE_REGISTER(bq25180, CONFIG_CHARGER_LOG_LEVEL);
4545
#define BQ25180_WATCHDOG_DISABLE 0x03
4646
#define BQ25180_DEVICE_ID_MSK GENMASK(3, 0)
4747
#define BQ25180_DEVICE_ID 0x00
48+
#define BQ25188_DEVICE_ID 0x04
4849
#define BQ25180_SHIP_RST_EN_RST_SHIP_MSK GENMASK(6, 5)
4950
#define BQ25180_SHIP_RST_EN_RST_SHIP_ADAPTER 0x20
5051
#define BQ25180_SHIP_RST_EN_RST_SHIP_BUTTON 0x40
@@ -205,6 +206,7 @@ static int bq25180_get_charge_voltage(const struct device *dev, uint32_t *const_
205206
if (ret < 0) {
206207
return ret;
207208
}
209+
val &= BQ25180_VBAT_MSK;
208210

209211
*const_charge_voltage_uv = bq25180_vbatreg_to_mv(val) * 1000;
210212

@@ -324,7 +326,7 @@ static int bq25180_init(const struct device *dev)
324326
}
325327

326328
val &= BQ25180_DEVICE_ID_MSK;
327-
if (val != BQ25180_DEVICE_ID) {
329+
if ((val != BQ25180_DEVICE_ID) && (val != BQ25188_DEVICE_ID)) {
328330
LOG_ERR("Invalid device id: %02x", val);
329331
return -EINVAL;
330332
}

0 commit comments

Comments
 (0)