diff options
| -rw-r--r-- | drivers/mfd/tps6586x.c | 4 | ||||
| -rw-r--r-- | drivers/regulator/tps6586x-regulator.c | 68 | ||||
| -rw-r--r-- | include/linux/mfd/tps6586x.h | 2 |
3 files changed, 64 insertions, 10 deletions
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index bbd54414a75d..835e5549ecdd 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c | |||
| @@ -495,6 +495,10 @@ static void tps6586x_print_version(struct i2c_client *client, int version) | |||
| 495 | case TPS658623: | 495 | case TPS658623: |
| 496 | name = "TPS658623"; | 496 | name = "TPS658623"; |
| 497 | break; | 497 | break; |
| 498 | case TPS658640: | ||
| 499 | case TPS658640v2: | ||
| 500 | name = "TPS658640"; | ||
| 501 | break; | ||
| 498 | case TPS658643: | 502 | case TPS658643: |
| 499 | name = "TPS658643"; | 503 | name = "TPS658643"; |
| 500 | break; | 504 | break; |
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c index 32f38a63d944..0a3bb3aecd97 100644 --- a/drivers/regulator/tps6586x-regulator.c +++ b/drivers/regulator/tps6586x-regulator.c | |||
| @@ -63,12 +63,7 @@ struct tps6586x_regulator { | |||
| 63 | int enable_reg[2]; | 63 | int enable_reg[2]; |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | static inline struct device *to_tps6586x_dev(struct regulator_dev *rdev) | 66 | static struct regulator_ops tps6586x_rw_regulator_ops = { |
| 67 | { | ||
| 68 | return rdev_get_dev(rdev)->parent; | ||
| 69 | } | ||
| 70 | |||
| 71 | static struct regulator_ops tps6586x_regulator_ops = { | ||
| 72 | .list_voltage = regulator_list_voltage_table, | 67 | .list_voltage = regulator_list_voltage_table, |
| 73 | .map_voltage = regulator_map_voltage_ascend, | 68 | .map_voltage = regulator_map_voltage_ascend, |
| 74 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 69 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
| @@ -79,6 +74,16 @@ static struct regulator_ops tps6586x_regulator_ops = { | |||
| 79 | .disable = regulator_disable_regmap, | 74 | .disable = regulator_disable_regmap, |
| 80 | }; | 75 | }; |
| 81 | 76 | ||
| 77 | static struct regulator_ops tps6586x_ro_regulator_ops = { | ||
| 78 | .list_voltage = regulator_list_voltage_table, | ||
| 79 | .map_voltage = regulator_map_voltage_ascend, | ||
| 80 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
| 81 | |||
| 82 | .is_enabled = regulator_is_enabled_regmap, | ||
| 83 | .enable = regulator_enable_regmap, | ||
| 84 | .disable = regulator_disable_regmap, | ||
| 85 | }; | ||
| 86 | |||
| 82 | static struct regulator_ops tps6586x_sys_regulator_ops = { | 87 | static struct regulator_ops tps6586x_sys_regulator_ops = { |
| 83 | }; | 88 | }; |
| 84 | 89 | ||
| @@ -106,6 +111,13 @@ static const unsigned int tps6586x_sm2_voltages[] = { | |||
| 106 | 4200000, 4250000, 4300000, 4350000, 4400000, 4450000, 4500000, 4550000, | 111 | 4200000, 4250000, 4300000, 4350000, 4400000, 4450000, 4500000, 4550000, |
| 107 | }; | 112 | }; |
| 108 | 113 | ||
| 114 | static int tps658640_sm2_voltages[] = { | ||
| 115 | 2150000, 2200000, 2250000, 2300000, 2350000, 2400000, 2450000, 2500000, | ||
| 116 | 2550000, 2600000, 2650000, 2700000, 2750000, 2800000, 2850000, 2900000, | ||
| 117 | 2950000, 3000000, 3050000, 3100000, 3150000, 3200000, 3250000, 3300000, | ||
| 118 | 3350000, 3400000, 3450000, 3500000, 3550000, 3600000, 3650000, 3700000, | ||
| 119 | }; | ||
| 120 | |||
| 109 | static const unsigned int tps658643_sm2_voltages[] = { | 121 | static const unsigned int tps658643_sm2_voltages[] = { |
| 110 | 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, | 122 | 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, |
| 111 | 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000, | 123 | 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000, |
| @@ -120,12 +132,16 @@ static const unsigned int tps6586x_dvm_voltages[] = { | |||
| 120 | 1325000, 1350000, 1375000, 1400000, 1425000, 1450000, 1475000, 1500000, | 132 | 1325000, 1350000, 1375000, 1400000, 1425000, 1450000, 1475000, 1500000, |
| 121 | }; | 133 | }; |
| 122 | 134 | ||
| 123 | #define TPS6586X_REGULATOR(_id, _pin_name, vdata, vreg, shift, nbits, \ | 135 | static int tps658640_rtc_voltages[] = { |
| 136 | 2500000, 2850000, 3100000, 3300000, | ||
| 137 | }; | ||
| 138 | |||
| 139 | #define TPS6586X_REGULATOR(_id, _ops, _pin_name, vdata, vreg, shift, nbits, \ | ||
| 124 | ereg0, ebit0, ereg1, ebit1, goreg, gobit) \ | 140 | ereg0, ebit0, ereg1, ebit1, goreg, gobit) \ |
| 125 | .desc = { \ | 141 | .desc = { \ |
| 126 | .supply_name = _pin_name, \ | 142 | .supply_name = _pin_name, \ |
| 127 | .name = "REG-" #_id, \ | 143 | .name = "REG-" #_id, \ |
| 128 | .ops = &tps6586x_regulator_ops, \ | 144 | .ops = &tps6586x_## _ops ## _regulator_ops, \ |
| 129 | .type = REGULATOR_VOLTAGE, \ | 145 | .type = REGULATOR_VOLTAGE, \ |
| 130 | .id = TPS6586X_ID_##_id, \ | 146 | .id = TPS6586X_ID_##_id, \ |
| 131 | .n_voltages = ARRAY_SIZE(vdata##_voltages), \ | 147 | .n_voltages = ARRAY_SIZE(vdata##_voltages), \ |
| @@ -146,14 +162,21 @@ static const unsigned int tps6586x_dvm_voltages[] = { | |||
| 146 | #define TPS6586X_LDO(_id, _pname, vdata, vreg, shift, nbits, \ | 162 | #define TPS6586X_LDO(_id, _pname, vdata, vreg, shift, nbits, \ |
| 147 | ereg0, ebit0, ereg1, ebit1) \ | 163 | ereg0, ebit0, ereg1, ebit1) \ |
| 148 | { \ | 164 | { \ |
| 149 | TPS6586X_REGULATOR(_id, _pname, vdata, vreg, shift, nbits, \ | 165 | TPS6586X_REGULATOR(_id, rw, _pname, vdata, vreg, shift, nbits, \ |
| 166 | ereg0, ebit0, ereg1, ebit1, 0, 0) \ | ||
| 167 | } | ||
| 168 | |||
| 169 | #define TPS6586X_FIXED_LDO(_id, _pname, vdata, vreg, shift, nbits, \ | ||
| 170 | ereg0, ebit0, ereg1, ebit1) \ | ||
| 171 | { \ | ||
| 172 | TPS6586X_REGULATOR(_id, ro, _pname, vdata, vreg, shift, nbits, \ | ||
| 150 | ereg0, ebit0, ereg1, ebit1, 0, 0) \ | 173 | ereg0, ebit0, ereg1, ebit1, 0, 0) \ |
| 151 | } | 174 | } |
| 152 | 175 | ||
| 153 | #define TPS6586X_DVM(_id, _pname, vdata, vreg, shift, nbits, \ | 176 | #define TPS6586X_DVM(_id, _pname, vdata, vreg, shift, nbits, \ |
| 154 | ereg0, ebit0, ereg1, ebit1, goreg, gobit) \ | 177 | ereg0, ebit0, ereg1, ebit1, goreg, gobit) \ |
| 155 | { \ | 178 | { \ |
| 156 | TPS6586X_REGULATOR(_id, _pname, vdata, vreg, shift, nbits, \ | 179 | TPS6586X_REGULATOR(_id, rw, _pname, vdata, vreg, shift, nbits, \ |
| 157 | ereg0, ebit0, ereg1, ebit1, goreg, gobit) \ | 180 | ereg0, ebit0, ereg1, ebit1, goreg, gobit) \ |
| 158 | } | 181 | } |
| 159 | 182 | ||
| @@ -207,6 +230,26 @@ static struct tps6586x_regulator tps658623_regulator[] = { | |||
| 207 | END, 7), | 230 | END, 7), |
| 208 | }; | 231 | }; |
| 209 | 232 | ||
| 233 | static struct tps6586x_regulator tps658640_regulator[] = { | ||
| 234 | TPS6586X_LDO(LDO_3, "vinldo23", tps6586x_ldo0, SUPPLYV4, 0, 3, | ||
| 235 | ENC, 2, END, 2), | ||
| 236 | TPS6586X_LDO(LDO_5, "REG-SYS", tps6586x_ldo0, SUPPLYV6, 0, 3, | ||
| 237 | ENE, 6, ENE, 6), | ||
| 238 | TPS6586X_LDO(LDO_6, "vinldo678", tps6586x_ldo0, SUPPLYV3, 0, 3, | ||
| 239 | ENC, 4, END, 4), | ||
| 240 | TPS6586X_LDO(LDO_7, "vinldo678", tps6586x_ldo0, SUPPLYV3, 3, 3, | ||
| 241 | ENC, 5, END, 5), | ||
| 242 | TPS6586X_LDO(LDO_8, "vinldo678", tps6586x_ldo0, SUPPLYV2, 5, 3, | ||
| 243 | ENC, 6, END, 6), | ||
| 244 | TPS6586X_LDO(LDO_9, "vinldo9", tps6586x_ldo0, SUPPLYV6, 3, 3, | ||
| 245 | ENE, 7, ENE, 7), | ||
| 246 | TPS6586X_LDO(SM_2, "vin-sm2", tps658640_sm2, SUPPLYV2, 0, 5, | ||
| 247 | ENC, 7, END, 7), | ||
| 248 | |||
| 249 | TPS6586X_FIXED_LDO(LDO_RTC, "REG-SYS", tps658640_rtc, SUPPLYV4, 3, 2, | ||
| 250 | V4, 7, V4, 7), | ||
| 251 | }; | ||
| 252 | |||
| 210 | static struct tps6586x_regulator tps658643_regulator[] = { | 253 | static struct tps6586x_regulator tps658643_regulator[] = { |
| 211 | TPS6586X_LDO(SM_2, "vin-sm2", tps658643_sm2, SUPPLYV2, 0, 5, ENC, 7, | 254 | TPS6586X_LDO(SM_2, "vin-sm2", tps658643_sm2, SUPPLYV2, 0, 5, ENC, 7, |
| 212 | END, 7), | 255 | END, 7), |
| @@ -295,6 +338,11 @@ static struct tps6586x_regulator *find_regulator_info(int id, int version) | |||
| 295 | table = tps658623_regulator; | 338 | table = tps658623_regulator; |
| 296 | num = ARRAY_SIZE(tps658623_regulator); | 339 | num = ARRAY_SIZE(tps658623_regulator); |
| 297 | break; | 340 | break; |
| 341 | case TPS658640: | ||
| 342 | case TPS658640v2: | ||
| 343 | table = tps658640_regulator; | ||
| 344 | num = ARRAY_SIZE(tps658640_regulator); | ||
| 345 | break; | ||
| 298 | case TPS658643: | 346 | case TPS658643: |
| 299 | table = tps658643_regulator; | 347 | table = tps658643_regulator; |
| 300 | num = ARRAY_SIZE(tps658643_regulator); | 348 | num = ARRAY_SIZE(tps658643_regulator); |
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h index cbecec2e353a..96187ed9f9bb 100644 --- a/include/linux/mfd/tps6586x.h +++ b/include/linux/mfd/tps6586x.h | |||
| @@ -17,6 +17,8 @@ | |||
| 17 | #define TPS658621A 0x15 | 17 | #define TPS658621A 0x15 |
| 18 | #define TPS658621CD 0x2c | 18 | #define TPS658621CD 0x2c |
| 19 | #define TPS658623 0x1b | 19 | #define TPS658623 0x1b |
| 20 | #define TPS658640 0x01 | ||
| 21 | #define TPS658640v2 0x02 | ||
| 20 | #define TPS658643 0x03 | 22 | #define TPS658643 0x03 |
| 21 | 23 | ||
| 22 | enum { | 24 | enum { |
