svn commit: r356893 - head/sys/arm64/rockchip
Emmanuel Vadot
manu at FreeBSD.org
Sun Jan 19 19:56:51 UTC 2020
Author: manu
Date: Sun Jan 19 19:56:50 2020
New Revision: 356893
URL: https://svnweb.freebsd.org/changeset/base/356893
Log:
rk805: Add a regnode_init method
This method will set the desired voltaged based on values in the DTS.
It will not enable the regulator, this is the job of either a consumer
or regnode_set_constraint SYSINIT if the regulator is boot_on or always_on.
Reviewed by: mmel
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D23216
Modified:
head/sys/arm64/rockchip/rk805.c
Modified: head/sys/arm64/rockchip/rk805.c
==============================================================================
--- head/sys/arm64/rockchip/rk805.c Sun Jan 19 19:56:05 2020 (r356892)
+++ head/sys/arm64/rockchip/rk805.c Sun Jan 19 19:56:50 2020 (r356893)
@@ -97,6 +97,9 @@ struct rk805_softc {
int nregs;
};
+static int rk805_regnode_set_voltage(struct regnode *regnode, int min_uvolt,
+ int max_uvolt, int *udelay);
+
static struct rk805_regdef rk805_regdefs[] = {
{
.id = RK805_DCDC1,
@@ -354,7 +357,26 @@ rk805_write(device_t dev, uint8_t reg, uint8_t data)
static int
rk805_regnode_init(struct regnode *regnode)
{
- return (0);
+ struct rk805_reg_sc *sc;
+ struct regnode_std_param *param;
+ int rv, udelay;
+
+ sc = regnode_get_softc(regnode);
+ param = regnode_get_stdparam(regnode);
+ if (param->min_uvolt == 0)
+ return (0);
+
+ /*
+ * Set the regulator at the correct voltage
+ * Do not enable it, this is will be done either by a
+ * consumer or by regnode_set_constraint if boot_on is true
+ */
+ rv = rk805_regnode_set_voltage(regnode, param->min_uvolt,
+ param->max_uvolt, &udelay);
+ if (rv != 0)
+ DELAY(udelay);
+
+ return (rv);
}
static int
More information about the svn-src-all
mailing list