diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-02-22 10:49:32 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-02-22 10:49:32 -0800 |
commit | 0175ec3a28c695562a08fdccf73f2ec5ed744e2f (patch) | |
tree | 46a4c6f25bbdd6c4be387d1ae1c4d037e96d219d /drivers | |
parent | 603ac530f13506e6ce5db4ab953ede4d292c5327 (diff) | |
parent | 7f62cb8861190e7cc1018ff37597fc49b2eaafa8 (diff) |
Merge tag 'regulator-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown:
"This has been a very quiet release for the regulator API: there's one
new driver for the Maxim MAX20411, some DT schema conversions and some
small tweaks and improvements but really nothing major at all"
* tag 'regulator-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (22 commits)
regulator: max597x: Align for simple_mfd_i2c driver
regulator: max20411: Fix off-by-one for n_voltages setting
regulator: max597x: Remove unused variable
regulator: tps65219: use generic set_bypass()
regulator: s5m8767: Bounds check id indexing into arrays
regulator: max77802: Bounds check regulator id against opmode
regulator: max20411: Convert to i2c's .probe_new()
regulator: scmi: Allow for zero voltage domains
regulator: max20411: Directly include bitfield.h
regulator: Introduce Maxim MAX20411 Step-Down converter
regulator: dt-bindings: Describe Maxim MAX20411
regulator: dt-bindings: qcom-labibb: Allow regulator-common properties
regulator: dt-bindings: fixed-regulator: allow gpios property
regulator: tps65219: use IS_ERR() to detect an error pointer
regulator: mcp16502: add enum MCP16502_REG_HPM description
regulator: fixed-helper: use the correct function name in comment
regulator: act8945a: fix non-kernel-doc comments
dt-bindings: regulators: convert non-smd RPM Regulators bindings to dt-schema
regulator: dt-bindings: Convert Fairchild FAN53555 to DT schema
regulator: dt-bindings: qcom,usb-vbus-regulator: change node name
...
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/regulator/Kconfig | 8 | ||||
-rw-r--r-- | drivers/regulator/Makefile | 1 | ||||
-rw-r--r-- | drivers/regulator/act8945a-regulator.c | 6 | ||||
-rw-r--r-- | drivers/regulator/fixed-helper.c | 2 | ||||
-rw-r--r-- | drivers/regulator/max20411-regulator.c | 163 | ||||
-rw-r--r-- | drivers/regulator/max597x-regulator.c | 52 | ||||
-rw-r--r-- | drivers/regulator/max77802-regulator.c | 34 | ||||
-rw-r--r-- | drivers/regulator/mcp16502.c | 1 | ||||
-rw-r--r-- | drivers/regulator/s5m8767.c | 6 | ||||
-rw-r--r-- | drivers/regulator/scmi-regulator.c | 16 | ||||
-rw-r--r-- | drivers/regulator/tps65219-regulator.c | 24 |
11 files changed, 247 insertions, 66 deletions
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 820c9a0788e5..aae28d0a489c 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -655,6 +655,14 @@ config REGULATOR_MAX20086 protectorvia I2C bus. The regulator has 2 or 4 outputs depending on the device model. This driver is only capable to turn on/off them. +config REGULATOR_MAX20411 + tristate "Maxim MAX20411 High-Efficiency Single Step-Down Converter" + depends on I2C + select REGMAP_I2C + help + This driver controls the Maxim MAX20411 family of high-efficiency, + syncrhonous step-down converters. + config REGULATOR_MAX77686 tristate "Maxim 77686 regulator" depends on MFD_MAX77686 || COMPILE_TEST diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index b9f5eb35bf5f..ee383d8fc835 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -80,6 +80,7 @@ obj-$(CONFIG_REGULATOR_MAX8973) += max8973-regulator.o obj-$(CONFIG_REGULATOR_MAX8997) += max8997-regulator.o obj-$(CONFIG_REGULATOR_MAX8998) += max8998.o obj-$(CONFIG_REGULATOR_MAX20086) += max20086-regulator.o +obj-$(CONFIG_REGULATOR_MAX20411) += max20411-regulator.o obj-$(CONFIG_REGULATOR_MAX77686) += max77686-regulator.o obj-$(CONFIG_REGULATOR_MAX77693) += max77693-regulator.o obj-$(CONFIG_REGULATOR_MAX77802) += max77802-regulator.o diff --git a/drivers/regulator/act8945a-regulator.c b/drivers/regulator/act8945a-regulator.c index 6a62f946ccae..1db1c6423779 100644 --- a/drivers/regulator/act8945a-regulator.c +++ b/drivers/regulator/act8945a-regulator.c @@ -15,7 +15,7 @@ #include <linux/regulator/machine.h> #include <dt-bindings/regulator/active-semi,8945a-regulator.h> -/** +/* * ACT8945A Global Register Map. */ #define ACT8945A_SYS_MODE 0x00 @@ -46,13 +46,13 @@ #define ACT8945A_LDO4_CTRL 0x65 #define ACT8945A_LDO4_SUS 0x66 -/** +/* * Field Definitions. */ #define ACT8945A_ENA 0x80 /* ON - [7] */ #define ACT8945A_VSEL_MASK 0x3F /* VSET - [5:0] */ -/** +/* * ACT8945A Voltage Number */ #define ACT8945A_VOLTAGE_NUM 64 diff --git a/drivers/regulator/fixed-helper.c b/drivers/regulator/fixed-helper.c index 2c6098e6f4bc..0eb2442456f0 100644 --- a/drivers/regulator/fixed-helper.c +++ b/drivers/regulator/fixed-helper.c @@ -20,7 +20,7 @@ static void regulator_fixed_release(struct device *dev) } /** - * regulator_register_fixed_name - register a no-op fixed regulator + * regulator_register_always_on - register an always-on regulator with a fixed name * @id: platform device id * @name: name to be used for the regulator * @supplies: consumers for this regulator diff --git a/drivers/regulator/max20411-regulator.c b/drivers/regulator/max20411-regulator.c new file mode 100644 index 000000000000..83dacb4ff173 --- /dev/null +++ b/drivers/regulator/max20411-regulator.c @@ -0,0 +1,163 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022, Linaro Ltd. + */ + +#include <linux/bitfield.h> +#include <linux/gpio/consumer.h> +#include <linux/i2c.h> +#include <linux/module.h> +#include <linux/of_platform.h> +#include <linux/regmap.h> +#include <linux/regulator/driver.h> +#include <linux/regulator/machine.h> +#include <linux/regulator/of_regulator.h> + +#define MAX20411_UV_STEP 6250 +#define MAX20411_BASE_UV 243750 +#define MAX20411_MIN_SEL 41 /* 0.5V */ +#define MAX20411_MAX_SEL 165 /* 1.275V */ +#define MAX20411_VID_OFFSET 0x7 +#define MAX20411_VID_MASK 0xff +#define MAX20411_SLEW_OFFSET 0x6 +#define MAX20411_SLEW_DVS_MASK 0xc +#define MAX20411_SLEW_SR_MASK 0x3 + +struct max20411 { + struct device *dev; + struct device_node *of_node; + struct regulator_desc desc; + struct regulator_dev *rdev; + struct regmap *regmap; +}; + +static const unsigned int max20411_slew_rates[] = { 13100, 6600, 3300, 1600 }; + +static int max20411_enable_time(struct regulator_dev *rdev) +{ + int voltage, rate, ret; + unsigned int val; + + /* get voltage */ + ret = regmap_read(rdev->regmap, rdev->desc->vsel_reg, &val); + if (ret) + return ret; + + val &= rdev->desc->vsel_mask; + voltage = regulator_list_voltage_linear(rdev, val); + + /* get rate */ + ret = regmap_read(rdev->regmap, MAX20411_SLEW_OFFSET, &val); + if (ret) + return ret; + + val = FIELD_GET(MAX20411_SLEW_SR_MASK, val); + rate = max20411_slew_rates[val]; + + return DIV_ROUND_UP(voltage, rate); +} + +static const struct regmap_config max20411_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = 0xe, +}; + +static const struct regulator_ops max20411_ops = { + .get_voltage_sel = regulator_get_voltage_sel_regmap, + .set_voltage_sel = regulator_set_voltage_sel_regmap, + .list_voltage = regulator_list_voltage_linear, + .enable_time = max20411_enable_time, +}; + +static const struct regulator_desc max20411_desc = { + .ops = &max20411_ops, + .owner = THIS_MODULE, + .type = REGULATOR_VOLTAGE, + .supply_name = "vin", + .name = "max20411", + + /* + * voltage = 0.24375V + selector * 6.25mV + * with valid selector between 41 to 165 (0.5V to 1.275V) + */ + .min_uV = MAX20411_BASE_UV, + .uV_step = MAX20411_UV_STEP, + .linear_min_sel = MAX20411_MIN_SEL, + .n_voltages = MAX20411_MAX_SEL + 1, + + .vsel_reg = MAX20411_VID_OFFSET, + .vsel_mask = MAX20411_VID_MASK, + + .ramp_reg = MAX20411_SLEW_OFFSET, + .ramp_mask = MAX20411_SLEW_DVS_MASK, + .ramp_delay_table = max20411_slew_rates, + .n_ramp_values = ARRAY_SIZE(max20411_slew_rates), +}; + +static int max20411_probe(struct i2c_client *client) +{ + struct regulator_init_data *init_data; + struct device *dev = &client->dev; + struct regulator_config cfg = {}; + struct max20411 *max20411; + + max20411 = devm_kzalloc(dev, sizeof(*max20411), GFP_KERNEL); + if (!max20411) + return -ENOMEM; + + max20411->regmap = devm_regmap_init_i2c(client, &max20411_regmap_config); + if (IS_ERR(max20411->regmap)) { + dev_err(dev, "Failed to allocate regmap!\n"); + return PTR_ERR(max20411->regmap); + } + + max20411->dev = dev; + max20411->of_node = dev->of_node; + + max20411->desc = max20411_desc; + init_data = of_get_regulator_init_data(max20411->dev, max20411->of_node, &max20411->desc); + if (!init_data) + return -ENODATA; + + cfg.dev = max20411->dev; + cfg.init_data = init_data; + cfg.of_node = max20411->of_node; + cfg.driver_data = max20411; + + cfg.ena_gpiod = gpiod_get(max20411->dev, "enable", GPIOD_ASIS); + if (IS_ERR(cfg.ena_gpiod)) + return dev_err_probe(dev, PTR_ERR(cfg.ena_gpiod), + "unable to acquire enable gpio\n"); + + max20411->rdev = devm_regulator_register(max20411->dev, &max20411->desc, &cfg); + if (IS_ERR(max20411->rdev)) + dev_err(max20411->dev, "Failed to register regulator\n"); + + return PTR_ERR_OR_ZERO(max20411->rdev); +} + +static const struct of_device_id of_max20411_match_tbl[] = { + { .compatible = "maxim,max20411", }, + { }, +}; +MODULE_DEVICE_TABLE(of, of_max20411_match_tbl); + +static const struct i2c_device_id max20411_id[] = { + { "max20411", 0 }, + { }, +}; +MODULE_DEVICE_TABLE(i2c, max20411_id); + +static struct i2c_driver max20411_i2c_driver = { + .driver = { + .name = "max20411", + .of_match_table = of_max20411_match_tbl, + }, + .probe_new = max20411_probe, + .id_table = max20411_id, +}; +module_i2c_driver(max20411_i2c_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/regulator/max597x-regulator.c b/drivers/regulator/max597x-regulator.c index 39f803ff0a90..f0fb0f56e420 100644 --- a/drivers/regulator/max597x-regulator.c +++ b/drivers/regulator/max597x-regulator.c @@ -357,12 +357,6 @@ static int max597x_irq_handler(int irq, struct regulator_irq_data *rid, return 0; } -static const struct regmap_config max597x_regmap_config = { - .reg_bits = 8, - .val_bits = 8, - .max_register = MAX_REGISTERS, -}; - static int max597x_adc_range(struct regmap *regmap, const int ch, u32 *irng, u32 *mon_rng) { @@ -431,41 +425,59 @@ static int max597x_setup_irq(struct device *dev, static int max597x_regulator_probe(struct platform_device *pdev) { - - - struct max597x_data *max597x = dev_get_drvdata(pdev->dev.parent); + struct max597x_data *max597x; + struct regmap *regmap = dev_get_regmap(pdev->dev.parent, NULL); struct max597x_regulator *data; - + struct i2c_client *i2c = to_i2c_client(pdev->dev.parent); struct regulator_config config = { }; struct regulator_dev *rdev; struct regulator_dev *rdevs[MAX5970_NUM_SWITCHES]; - int num_switches = max597x->num_switches; + int num_switches; int ret, i; + if (!regmap) + return -EPROBE_DEFER; + + max597x = devm_kzalloc(&i2c->dev, sizeof(struct max597x_data), GFP_KERNEL); + if (!max597x) + return -ENOMEM; + + i2c_set_clientdata(i2c, max597x); + + if (of_device_is_compatible(i2c->dev.of_node, "maxim,max5978")) + max597x->num_switches = MAX597x_TYPE_MAX5978; + else if (of_device_is_compatible(i2c->dev.of_node, "maxim,max5970")) + max597x->num_switches = MAX597x_TYPE_MAX5970; + else + return -ENODEV; + + i2c_set_clientdata(i2c, max597x); + num_switches = max597x->num_switches; + for (i = 0; i < num_switches; i++) { data = - devm_kzalloc(max597x->dev, sizeof(struct max597x_regulator), + devm_kzalloc(&i2c->dev, sizeof(struct max597x_regulator), GFP_KERNEL); if (!data) return -ENOMEM; data->num_switches = num_switches; - data->regmap = max597x->regmap; + data->regmap = regmap; - ret = max597x_adc_range(data->regmap, i, &max597x->irng[i], &max597x->mon_rng[i]); + ret = max597x_adc_range(regmap, i, &max597x->irng[i], &max597x->mon_rng[i]); if (ret < 0) return ret; data->irng = max597x->irng[i]; data->mon_rng = max597x->mon_rng[i]; - config.dev = max597x->dev; + config.dev = &i2c->dev; config.driver_data = (void *)data; config.regmap = data->regmap; - rdev = devm_regulator_register(max597x->dev, + rdev = devm_regulator_register(&i2c->dev, ®ulators[i], &config); if (IS_ERR(rdev)) { - dev_err(max597x->dev, "failed to register regulator %s\n", + dev_err(&i2c->dev, "failed to register regulator %s\n", regulators[i].name); return PTR_ERR(rdev); } @@ -473,12 +485,12 @@ static int max597x_regulator_probe(struct platform_device *pdev) max597x->shunt_micro_ohms[i] = data->shunt_micro_ohms; } - if (max597x->irq) { + if (i2c->irq) { ret = - max597x_setup_irq(max597x->dev, max597x->irq, rdevs, num_switches, + max597x_setup_irq(&i2c->dev, i2c->irq, rdevs, num_switches, data); if (ret) { - dev_err(max597x->dev, "IRQ setup failed"); + dev_err(&i2c->dev, "IRQ setup failed"); return ret; } } diff --git a/drivers/regulator/max77802-regulator.c b/drivers/regulator/max77802-regulator.c index 21e0eb0f43f9..befe5f319819 100644 --- a/drivers/regulator/max77802-regulator.c +++ b/drivers/regulator/max77802-regulator.c @@ -94,9 +94,11 @@ static int max77802_set_suspend_disable(struct regulator_dev *rdev) { unsigned int val = MAX77802_OFF_PWRREQ; struct max77802_regulator_prv *max77802 = rdev_get_drvdata(rdev); - int id = rdev_get_id(rdev); + unsigned int id = rdev_get_id(rdev); int shift = max77802_get_opmode_shift(id); + if (WARN_ON_ONCE(id >= ARRAY_SIZE(max77802->opmode))) + return -EINVAL; max77802->opmode[id] = val; return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, rdev->desc->enable_mask, val << shift); @@ -110,7 +112,7 @@ static int max77802_set_suspend_disable(struct regulator_dev *rdev) static int max77802_set_mode(struct regulator_dev *rdev, unsigned int mode) { struct max77802_regulator_prv *max77802 = rdev_get_drvdata(rdev); - int id = rdev_get_id(rdev); + unsigned int id = rdev_get_id(rdev); unsigned int val; int shift = max77802_get_opmode_shift(id); @@ -127,6 +129,9 @@ static int max77802_set_mode(struct regulator_dev *rdev, unsigned int mode) return -EINVAL; } + if (WARN_ON_ONCE(id >= ARRAY_SIZE(max77802->opmode))) + return -EINVAL; + max77802->opmode[id] = val; return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, rdev->desc->enable_mask, val << shift); @@ -135,8 +140,10 @@ static int max77802_set_mode(struct regulator_dev *rdev, unsigned int mode) static unsigned max77802_get_mode(struct regulator_dev *rdev) { struct max77802_regulator_prv *max77802 = rdev_get_drvdata(rdev); - int id = rdev_get_id(rdev); + unsigned int id = rdev_get_id(rdev); + if (WARN_ON_ONCE(id >= ARRAY_SIZE(max77802->opmode))) + return -EINVAL; return max77802_map_mode(max77802->opmode[id]); } @@ -160,10 +167,13 @@ static int max77802_set_suspend_mode(struct regulator_dev *rdev, unsigned int mode) { struct max77802_regulator_prv *max77802 = rdev_get_drvdata(rdev); - int id = rdev_get_id(rdev); + unsigned int id = rdev_get_id(rdev); unsigned int val; int shift = max77802_get_opmode_shift(id); + if (WARN_ON_ONCE(id >= ARRAY_SIZE(max77802->opmode))) + return -EINVAL; + /* * If the regulator has been disabled for suspend * then is invalid to try setting a suspend mode. @@ -209,9 +219,11 @@ static int max77802_set_suspend_mode(struct regulator_dev *rdev, static int max77802_enable(struct regulator_dev *rdev) { struct max77802_regulator_prv *max77802 = rdev_get_drvdata(rdev); - int id = rdev_get_id(rdev); + unsigned int id = rdev_get_id(rdev); int shift = max77802_get_opmode_shift(id); + if (WARN_ON_ONCE(id >= ARRAY_SIZE(max77802->opmode))) + return -EINVAL; if (max77802->opmode[id] == MAX77802_OFF_PWRREQ) max77802->opmode[id] = MAX77802_OPMODE_NORMAL; @@ -495,7 +507,7 @@ static int max77802_pmic_probe(struct platform_device *pdev) for (i = 0; i < MAX77802_REG_MAX; i++) { struct regulator_dev *rdev; - int id = regulators[i].id; + unsigned int id = regulators[i].id; int shift = max77802_get_opmode_shift(id); int ret; @@ -513,10 +525,12 @@ static int max77802_pmic_probe(struct platform_device *pdev) * the hardware reports OFF as the regulator operating mode. * Default to operating mode NORMAL in that case. */ - if (val == MAX77802_STATUS_OFF) - max77802->opmode[id] = MAX77802_OPMODE_NORMAL; - else - max77802->opmode[id] = val; + if (id < ARRAY_SIZE(max77802->opmode)) { + if (val == MAX77802_STATUS_OFF) + max77802->opmode[id] = MAX77802_OPMODE_NORMAL; + else + max77802->opmode[id] = val; + } rdev = devm_regulator_register(&pdev->dev, ®ulators[i], &config); diff --git a/drivers/regulator/mcp16502.c b/drivers/regulator/mcp16502.c index 042668385678..abee1b09008d 100644 --- a/drivers/regulator/mcp16502.c +++ b/drivers/regulator/mcp16502.c @@ -77,6 +77,7 @@ * @MCP16502_REG_A: active state register * @MCP16502_REG_LPM: low power mode state register * @MCP16502_REG_HIB: hibernate state register + * @MCP16502_REG_HPM: high-performance mode register * @MCP16502_REG_SEQ: startup sequence register * @MCP16502_REG_CFG: configuration register */ diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c index 35269f998210..754c6fcc6e64 100644 --- a/drivers/regulator/s5m8767.c +++ b/drivers/regulator/s5m8767.c @@ -923,10 +923,14 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) for (i = 0; i < pdata->num_regulators; i++) { const struct sec_voltage_desc *desc; - int id = pdata->regulators[i].id; + unsigned int id = pdata->regulators[i].id; int enable_reg, enable_val; struct regulator_dev *rdev; + BUILD_BUG_ON(ARRAY_SIZE(regulators) != ARRAY_SIZE(reg_voltage_map)); + if (WARN_ON_ONCE(id >= ARRAY_SIZE(regulators))) + continue; + desc = reg_voltage_map[id]; if (desc) { regulators[id].n_voltages = diff --git a/drivers/regulator/scmi-regulator.c b/drivers/regulator/scmi-regulator.c index b9918f4fd241..29ab217297d6 100644 --- a/drivers/regulator/scmi-regulator.c +++ b/drivers/regulator/scmi-regulator.c @@ -311,16 +311,12 @@ static int scmi_regulator_probe(struct scmi_device *sdev) return PTR_ERR(voltage_ops); num_doms = voltage_ops->num_domains_get(ph); - if (num_doms <= 0) { - if (!num_doms) { - dev_err(&sdev->dev, - "number of voltage domains invalid\n"); - num_doms = -EINVAL; - } else { - dev_err(&sdev->dev, - "failed to get voltage domains - err:%d\n", - num_doms); - } + if (!num_doms) + return 0; + + if (num_doms < 0) { + dev_err(&sdev->dev, "failed to get voltage domains - err:%d\n", + num_doms); return num_doms; } diff --git a/drivers/regulator/tps65219-regulator.c b/drivers/regulator/tps65219-regulator.c index c484c943e467..4b5acaa45049 100644 --- a/drivers/regulator/tps65219-regulator.c +++ b/drivers/regulator/tps65219-regulator.c @@ -173,24 +173,6 @@ static unsigned int tps65219_get_mode(struct regulator_dev *dev) return REGULATOR_MODE_NORMAL; } -/* - * generic regulator_set_bypass_regmap does not fully match requirements - * TPS65219 Requires explicitly that regulator is disabled before switch - */ -static int tps65219_set_bypass(struct regulator_dev *dev, bool enable) -{ - struct tps65219 *tps = rdev_get_drvdata(dev); - unsigned int rid = rdev_get_id(dev); - - if (dev->desc->ops->is_enabled(dev)) { - dev_err(tps->dev, - "%s LDO%d enabled, must be shut down to set bypass ", - __func__, rid); - return -EBUSY; - } - return regulator_set_bypass_regmap(dev, enable); -} - /* Operations permitted on BUCK1/2/3 */ static const struct regulator_ops tps65219_bucks_ops = { .is_enabled = regulator_is_enabled_regmap, @@ -217,7 +199,7 @@ static const struct regulator_ops tps65219_ldos_1_2_ops = { .set_voltage_sel = regulator_set_voltage_sel_regmap, .list_voltage = regulator_list_voltage_linear_range, .map_voltage = regulator_map_voltage_linear_range, - .set_bypass = tps65219_set_bypass, + .set_bypass = regulator_set_bypass_regmap, .get_bypass = regulator_get_bypass_regmap, }; @@ -342,7 +324,7 @@ static int tps65219_regulator_probe(struct platform_device *pdev) &config); if (IS_ERR(rdev)) { dev_err(tps->dev, "failed to register %s regulator\n", - pdev->name); + regulators[i].name); return PTR_ERR(rdev); } rdevtbl[i] = rdev; @@ -367,7 +349,7 @@ static int tps65219_regulator_probe(struct platform_device *pdev) irq_data[i].type = irq_type; tps65219_get_rdev_by_name(irq_type->regulator_name, rdevtbl, rdev); - if (rdev < 0) { + if (IS_ERR(rdev)) { dev_err(tps->dev, "Failed to get rdev for %s\n", irq_type->regulator_name); return -EINVAL; |