hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/regulator/tps65217-regulator.c
....@@ -3,7 +3,7 @@
33 *
44 * Regulator driver for TPS65217 PMIC
55 *
6
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6
+ * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
77 *
88 * This program is free software; you can redistribute it and/or
99 * modify it under the terms of the GNU General Public License as
....@@ -56,15 +56,14 @@
5656 2800000, 3000000, 3100000, 3300000,
5757 };
5858
59
-static const struct regulator_linear_range tps65217_uv1_ranges[] = {
59
+static const struct linear_range tps65217_uv1_ranges[] = {
6060 REGULATOR_LINEAR_RANGE(900000, 0, 24, 25000),
61
- REGULATOR_LINEAR_RANGE(1550000, 25, 30, 50000),
62
- REGULATOR_LINEAR_RANGE(1850000, 31, 52, 50000),
61
+ REGULATOR_LINEAR_RANGE(1550000, 25, 52, 50000),
6362 REGULATOR_LINEAR_RANGE(3000000, 53, 55, 100000),
64
- REGULATOR_LINEAR_RANGE(3300000, 56, 62, 0),
63
+ REGULATOR_LINEAR_RANGE(3300000, 56, 63, 0),
6564 };
6665
67
-static const struct regulator_linear_range tps65217_uv2_ranges[] = {
66
+static const struct linear_range tps65217_uv2_ranges[] = {
6867 REGULATOR_LINEAR_RANGE(1500000, 0, 8, 50000),
6968 REGULATOR_LINEAR_RANGE(2000000, 9, 13, 100000),
7069 REGULATOR_LINEAR_RANGE(2450000, 14, 31, 50000),
....@@ -125,7 +124,7 @@
125124 struct tps65217 *tps = rdev_get_drvdata(dev);
126125 unsigned int rid = rdev_get_id(dev);
127126
128
- if (rid < TPS65217_DCDC_1 || rid > TPS65217_LDO_4)
127
+ if (rid > TPS65217_LDO_4)
129128 return -EINVAL;
130129
131130 return tps65217_clear_bits(tps, dev->desc->bypass_reg,
....@@ -138,7 +137,7 @@
138137 struct tps65217 *tps = rdev_get_drvdata(dev);
139138 unsigned int rid = rdev_get_id(dev);
140139
141
- if (rid < TPS65217_DCDC_1 || rid > TPS65217_LDO_4)
140
+ if (rid > TPS65217_LDO_4)
142141 return -EINVAL;
143142
144143 if (!tps->strobes[rid])
....@@ -150,7 +149,7 @@
150149 }
151150
152151 /* Operations permitted on DCDCx, LDO2, LDO3 and LDO4 */
153
-static struct regulator_ops tps65217_pmic_ops = {
152
+static const struct regulator_ops tps65217_pmic_ops = {
154153 .is_enabled = regulator_is_enabled_regmap,
155154 .enable = tps65217_pmic_enable,
156155 .disable = tps65217_pmic_disable,
....@@ -163,7 +162,7 @@
163162 };
164163
165164 /* Operations permitted on LDO1 */
166
-static struct regulator_ops tps65217_pmic_ldo1_ops = {
165
+static const struct regulator_ops tps65217_pmic_ldo1_ops = {
167166 .is_enabled = regulator_is_enabled_regmap,
168167 .enable = tps65217_pmic_enable,
169168 .disable = tps65217_pmic_disable,
....@@ -255,6 +254,9 @@
255254
256255 /* Store default strobe info */
257256 ret = tps65217_reg_read(tps, regulators[i].bypass_reg, &val);
257
+ if (ret)
258
+ return ret;
259
+
258260 tps->strobes[i] = val & regulators[i].bypass_mask;
259261 }
260262