svn commit: r356485 - head/sys/arm64/rockchip

Emmanuel Vadot manu at FreeBSD.org
Wed Jan 8 11:29:23 UTC 2020


Author: manu
Date: Wed Jan  8 11:29:22 2020
New Revision: 356485
URL: https://svnweb.freebsd.org/changeset/base/356485

Log:
  rk808: Add min/max for the switch regulators
  
  The two switch regulator are always 3.0V.
  Add a special case in get_voltage that if min=max we directly
  return the value without calculating it.
  
  Reviewed by:	mmel
  Differential Revision:	https://reviews.freebsd.org/D23004

Modified:
  head/sys/arm64/rockchip/rk805.c

Modified: head/sys/arm64/rockchip/rk805.c
==============================================================================
--- head/sys/arm64/rockchip/rk805.c	Wed Jan  8 10:06:32 2020	(r356484)
+++ head/sys/arm64/rockchip/rk805.c	Wed Jan  8 11:29:22 2020	(r356485)
@@ -204,6 +204,7 @@ static struct rk805_regdef rk808_regdefs[] = {
 		.voltage_nstep = 64,
 	},
 	{
+		/* BUCK3 voltage is calculated based on external resistor */
 		.id = RK805_DCDC3,
 		.name = "DCDC_REG3",
 		.enable_reg = RK805_DCDC_EN,
@@ -322,12 +323,16 @@ static struct rk805_regdef rk808_regdefs[] = {
 		.name = "SWITCH_REG1",
 		.enable_reg = RK805_DCDC_EN,
 		.enable_mask = 0x20,
+		.voltage_min = 3000000,
+		.voltage_max = 3000000,
 	},
 	{
 		.id = RK808_SWITCH2,
 		.name = "SWITCH_REG2",
 		.enable_reg = RK805_DCDC_EN,
 		.enable_mask = 0x40,
+		.voltage_min = 3000000,
+		.voltage_max = 3000000,
 	},
 };
 
@@ -449,6 +454,11 @@ rk805_regnode_get_voltage(struct regnode *regnode, int
 	uint8_t val;
 
 	sc = regnode_get_softc(regnode);
+
+	if (sc->def->voltage_min ==  sc->def->voltage_max) {
+		*uvolt = sc->def->voltage_min;
+		return (0);
+	}
 
 	if (!sc->def->voltage_step)
 		return (ENXIO);


More information about the svn-src-head mailing list