]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hwmon: (pmbus) Do not set regulators_node for single-channel chips
authorGuenter Roeck <linux@roeck-us.net>
Sat, 22 Mar 2025 14:26:02 +0000 (07:26 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 23 Apr 2025 14:18:27 +0000 (07:18 -0700)
Single-channel regulators do not need and should not have a "regulators"
node. We can not entirely remove it due to existing bindings. To solve the
problem for new drivers, provide additional macros PMBUS_REGULATOR_ONE_NODE
and PMBUS_REGULATOR_STEP_ONE_NODE and convert existing drivers to use those
macros. The exception is the ir38064 driver because its devicetree files
and its description do not require or use the nested regulators node.

Modify PMBUS_REGULATOR_STEP_ONE and PMBUS_REGULATOR_ONE to set the
regulators_node pointer to NULL.

Cc: Cedricjustine.Encarnacion@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20250322142602.560042-1-linux@roeck-us.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/lm25066.c
drivers/hwmon/pmbus/mpq7932.c
drivers/hwmon/pmbus/pmbus.h
drivers/hwmon/pmbus/tda38640.c
drivers/hwmon/pmbus/tps25990.c

index 40b0dda32ea6f06c1867834e6b77dea71974a7f7..dd7275a67a0abe640ff6c0fcfa0d187129acea1b 100644 (file)
@@ -437,7 +437,7 @@ static int lm25066_write_word_data(struct i2c_client *client, int page, int reg,
 
 #if IS_ENABLED(CONFIG_SENSORS_LM25066_REGULATOR)
 static const struct regulator_desc lm25066_reg_desc[] = {
-       PMBUS_REGULATOR_ONE("vout"),
+       PMBUS_REGULATOR_ONE_NODE("vout"),
 };
 #endif
 
index c1e2d0cb2fd086726ba3897affccaf273bfcb912..8f10e37a7a7677186284852f77606971d338d5b0 100644 (file)
@@ -51,8 +51,8 @@ static const struct regulator_desc mpq7932_regulators_desc[] = {
 };
 
 static const struct regulator_desc mpq7932_regulators_desc_one[] = {
-       PMBUS_REGULATOR_STEP_ONE("buck", MPQ7932_N_VOLTAGES,
-                                MPQ7932_UV_STEP, MPQ7932_BUCK_UV_MIN),
+       PMBUS_REGULATOR_STEP_ONE_NODE("buck", MPQ7932_N_VOLTAGES,
+                                     MPQ7932_UV_STEP, MPQ7932_BUCK_UV_MIN),
 };
 #endif
 
index 742dafc443903183d738e28b68fcf438ee0c922a..d2e9bfb5320fc423be091817e103d88c8d09265d 100644 (file)
@@ -509,11 +509,11 @@ int pmbus_regulator_init_cb(struct regulator_dev *rdev,
 
 #define PMBUS_REGULATOR(_name, _id)   PMBUS_REGULATOR_STEP(_name, _id, 0, 0, 0)
 
-#define PMBUS_REGULATOR_STEP_ONE(_name, _voltages, _step, _min_uV)  \
+#define __PMBUS_REGULATOR_STEP_ONE(_name, _node, _voltages, _step, _min_uV)  \
        {                                                       \
                .name = (_name),                                \
                .of_match = of_match_ptr(_name),                \
-               .regulators_node = of_match_ptr("regulators"),  \
+               .regulators_node = of_match_ptr(_node),         \
                .ops = &pmbus_regulator_ops,                    \
                .type = REGULATOR_VOLTAGE,                      \
                .owner = THIS_MODULE,                           \
@@ -523,7 +523,19 @@ int pmbus_regulator_init_cb(struct regulator_dev *rdev,
                .init_cb = pmbus_regulator_init_cb,             \
        }
 
-#define PMBUS_REGULATOR_ONE(_name)   PMBUS_REGULATOR_STEP_ONE(_name, 0, 0, 0)
+/*
+ * _NODE macros are defined for historic reasons and MUST NOT be used in new
+ * drivers.
+ */
+#define PMBUS_REGULATOR_STEP_ONE_NODE(_name, _voltages, _step, _min_uV)  \
+       __PMBUS_REGULATOR_STEP_ONE(_name, "regulators", _voltages, _step, _min_uV)
+
+#define PMBUS_REGULATOR_ONE_NODE(_name)        PMBUS_REGULATOR_STEP_ONE_NODE(_name, 0, 0, 0)
+
+#define PMBUS_REGULATOR_STEP_ONE(_name, _voltages, _step, _min_uV)  \
+       __PMBUS_REGULATOR_STEP_ONE(_name, NULL, _voltages, _step, _min_uV)
+
+#define PMBUS_REGULATOR_ONE(_name)     PMBUS_REGULATOR_STEP_ONE(_name, 0, 0, 0)
 
 /* Function declarations */
 
index 07fe58c244850064b48c7f12e3680102053fed03..d902d39f49f4d7398e726754dbc562bf2efc53c0 100644 (file)
@@ -15,7 +15,7 @@
 #include "pmbus.h"
 
 static const struct regulator_desc __maybe_unused tda38640_reg_desc[] = {
-       PMBUS_REGULATOR_ONE("vout"),
+       PMBUS_REGULATOR_ONE_NODE("vout"),
 };
 
 struct tda38640_data {
index 0d2655e69549fcee471a628367ff401bd069721e..c13edd7e1abfc560e722ff3c7f6fc4d14f954939 100644 (file)
@@ -333,7 +333,7 @@ static int tps25990_write_byte_data(struct i2c_client *client,
 
 #if IS_ENABLED(CONFIG_SENSORS_TPS25990_REGULATOR)
 static const struct regulator_desc tps25990_reg_desc[] = {
-       PMBUS_REGULATOR_ONE("vout"),
+       PMBUS_REGULATOR_ONE_NODE("vout"),
 };
 #endif