Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 May 2021 16:04:16 GMT
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 182717da8880 - main - arm64: allwinner: axp81x: Add support for regnode_status
Message-ID:  <202105211604.14LG4GII005109@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=182717da888023a8d0d1a66d579b5a5429b8681d

commit 182717da888023a8d0d1a66d579b5a5429b8681d
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2021-05-16 14:14:47 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2021-05-21 15:37:37 +0000

    arm64: allwinner: axp81x: Add support for regnode_status
    
    This method is used to know if a regulator is enabled or not.
    
    Sponsored by:   Diablotin Systems
    Differential Revision:  https://reviews.freebsd.org/D30290
---
 sys/arm/allwinner/axp81x.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/sys/arm/allwinner/axp81x.c b/sys/arm/allwinner/axp81x.c
index 85971a7773c4..df083ec49e32 100644
--- a/sys/arm/allwinner/axp81x.c
+++ b/sys/arm/allwinner/axp81x.c
@@ -850,6 +850,22 @@ axp8xx_regnode_voltage_to_reg(struct axp8xx_reg_sc *sc, int min_uvolt,
 	return (0);
 }
 
+static int
+axp8xx_regnode_status(struct regnode *regnode, int *status)
+{
+	struct axp8xx_reg_sc *sc;
+	uint8_t val;
+
+	sc = regnode_get_softc(regnode);
+
+	*status = 0;
+	axp8xx_read(sc->base_dev, sc->def->enable_reg, &val, 1);
+	if (val & sc->def->enable_mask)
+		*status = REGULATOR_STATUS_ENABLED;
+
+	return (0);
+}
+
 static int
 axp8xx_regnode_set_voltage(struct regnode *regnode, int min_uvolt,
     int max_uvolt, int *udelay)
@@ -899,6 +915,7 @@ static regnode_method_t axp8xx_regnode_methods[] = {
 	/* Regulator interface */
 	REGNODEMETHOD(regnode_init,		axp8xx_regnode_init),
 	REGNODEMETHOD(regnode_enable,		axp8xx_regnode_enable),
+	REGNODEMETHOD(regnode_status,		axp8xx_regnode_status),
 	REGNODEMETHOD(regnode_set_voltage,	axp8xx_regnode_set_voltage),
 	REGNODEMETHOD(regnode_get_voltage,	axp8xx_regnode_get_voltage),
 	REGNODEMETHOD(regnode_check_voltage,	regnode_method_check_voltage),



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105211604.14LG4GII005109>