diff options
author | kn <kn@cvs.openbsd.org> | 2021-03-22 18:37:27 +0000 |
---|---|---|
committer | kn <kn@cvs.openbsd.org> | 2021-03-22 18:37:27 +0000 |
commit | ce3c28ef63e5f58d3a62b419b213c17e85b66a3f (patch) | |
tree | 6fbfa4c29c44e775109ef54245ce599dc9ba16f5 | |
parent | 12a2a383e3525fe25656981cb6ac0756a36a7347 (diff) |
Update device-tree bindings
Using the DTB from our dtb package this driver no longer attaches
(on a Pinebook Pro)due to renamed bindings:
https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/power/supply/cw2015_battery.yaml
Thanks to kettenis and patrick for pointing this out.
Follow upstream's rename and acccount for the monitor interval now being
milliseconds not seconds anymore.
This makes cwfg(4) export values under hw.sensors as expected when using
/usr/local/share/dtb/arm64/rockchip/rk3399-pinebook-pro.dtb .
Input patrick kettenis
OK kettenis
-rw-r--r-- | sys/dev/fdt/cwfg.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/fdt/cwfg.c b/sys/dev/fdt/cwfg.c index c8f643ab5c2..1a690647f44 100644 --- a/sys/dev/fdt/cwfg.c +++ b/sys/dev/fdt/cwfg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cwfg.c,v 1.1 2020/06/10 17:51:21 patrick Exp $ */ +/* $OpenBSD: cwfg.c,v 1.2 2021/03/22 18:37:26 kn Exp $ */ /* $NetBSD: cwfg.c,v 1.1 2020/01/03 18:00:05 jmcneill Exp $ */ /*- * Copyright (c) 2020 Jared McNeill <jmcneill@invisible.ca> @@ -96,7 +96,7 @@ struct cwfg_softc { struct ksensordev sc_sensordev; }; -#define CWFG_MONITOR_INTERVAL_DEFAULT 8 +#define CWFG_MONITOR_INTERVAL_DEFAULT 5000 #define CWFG_DESIGN_CAPACITY_DEFAULT 2000 #define CWFG_ALERT_LEVEL_DEFAULT 0 @@ -124,7 +124,7 @@ cwfg_match(struct device *parent, void *match, void *aux) { struct i2c_attach_args *ia = aux; - if (strcmp(ia->ia_name, "cellwise,cw201x") == 0) + if (strcmp(ia->ia_name, "cellwise,cw2015") == 0) return 1; return 0; @@ -143,14 +143,14 @@ cwfg_attach(struct device *parent, struct device *self, void *aux) sc->sc_addr = ia->ia_addr; sc->sc_node = *(int *)ia->ia_cookie; - len = OF_getproplen(sc->sc_node, "cellwise,bat-config-info"); + len = OF_getproplen(sc->sc_node, "cellwise,battery-profile"); if (len <= 0) { printf(": missing or invalid battery info\n"); return; } batinfo = malloc(len, M_TEMP, M_WAITOK); - OF_getprop(sc->sc_node, "cellwise,bat-config-info", batinfo, len); + OF_getprop(sc->sc_node, "cellwise,battery-profile", batinfo, len); switch (len) { case BATINFO_SIZE: memcpy(sc->sc_batinfo, batinfo, BATINFO_SIZE); @@ -167,7 +167,7 @@ cwfg_attach(struct device *parent, struct device *self, void *aux) free(batinfo, M_TEMP, len); sc->sc_monitor_interval = OF_getpropint(sc->sc_node, - "cellwise,monitor-interval", CWFG_MONITOR_INTERVAL_DEFAULT); + "cellwise,monitor-interval-ms", CWFG_MONITOR_INTERVAL_DEFAULT); sc->sc_design_capacity = OF_getpropint(sc->sc_node, "cellwise,design-capacity", CWFG_DESIGN_CAPACITY_DEFAULT); sc->sc_alert_level = OF_getpropint(sc->sc_node, |