From e28026edd40423b99cb9a55002cf1cb246d06631 Mon Sep 17 00:00:00 2001 From: dlg Date: Sat, 15 Apr 2023 03:19:43 +0000 Subject: [PATCH] fixed regulators might rely on other regulators specified by "vin-supply" when turning a fixed regulator on, turn on the regulator specified in vin-supply too. kettenis agrees we should do this. --- sys/dev/ofw/ofw_regulator.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/dev/ofw/ofw_regulator.c b/sys/dev/ofw/ofw_regulator.c index e58b3a684f0..027cb65da37 100644 --- a/sys/dev/ofw/ofw_regulator.c +++ b/sys/dev/ofw/ofw_regulator.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofw_regulator.c,v 1.18 2023/04/07 06:18:26 dlg Exp $ */ +/* $OpenBSD: ofw_regulator.c,v 1.19 2023/04/15 03:19:43 dlg Exp $ */ /* * Copyright (c) 2016 Mark Kettenis * @@ -108,6 +108,14 @@ regulator_fixed_set(int node, int enable) int len; char *prop = "gpio"; + /* + * This regulator may rely on another. That "parent" regulator + * may be used by multiple other devices/regulators, so unless + * we refcnt use of a regulator we can only turn it on. + */ + if (enable) + regulator_enable(OF_getpropint(node, "vin-supply", 0)); + pinctrl_byname(node, "default"); /* The "gpio"/"gpios" property is optional. */ -- 2.20.1