Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: act8865: Configure register access for act8600

This can be used to expose the act8600 registers via debugfs.

Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Maarten ter Huurne and committed by
Mark Brown
c5c9c2df 005e4685

+73 -1
+73 -1
drivers/regulator/act8865-regulator.c
··· 139 139 int off_mask; 140 140 }; 141 141 142 + static const struct regmap_range act8600_reg_ranges[] = { 143 + regmap_reg_range(0x00, 0x01), 144 + regmap_reg_range(0x10, 0x10), 145 + regmap_reg_range(0x12, 0x12), 146 + regmap_reg_range(0x20, 0x20), 147 + regmap_reg_range(0x22, 0x22), 148 + regmap_reg_range(0x30, 0x30), 149 + regmap_reg_range(0x32, 0x32), 150 + regmap_reg_range(0x40, 0x41), 151 + regmap_reg_range(0x50, 0x51), 152 + regmap_reg_range(0x60, 0x61), 153 + regmap_reg_range(0x70, 0x71), 154 + regmap_reg_range(0x80, 0x81), 155 + regmap_reg_range(0x91, 0x91), 156 + regmap_reg_range(0xA1, 0xA1), 157 + regmap_reg_range(0xA8, 0xAA), 158 + regmap_reg_range(0xB0, 0xB0), 159 + regmap_reg_range(0xB2, 0xB2), 160 + regmap_reg_range(0xC1, 0xC1), 161 + }; 162 + 163 + static const struct regmap_range act8600_reg_ro_ranges[] = { 164 + regmap_reg_range(0xAA, 0xAA), 165 + regmap_reg_range(0xC1, 0xC1), 166 + }; 167 + 168 + static const struct regmap_range act8600_reg_volatile_ranges[] = { 169 + regmap_reg_range(0x00, 0x01), 170 + regmap_reg_range(0x12, 0x12), 171 + regmap_reg_range(0x22, 0x22), 172 + regmap_reg_range(0x32, 0x32), 173 + regmap_reg_range(0x41, 0x41), 174 + regmap_reg_range(0x51, 0x51), 175 + regmap_reg_range(0x61, 0x61), 176 + regmap_reg_range(0x71, 0x71), 177 + regmap_reg_range(0x81, 0x81), 178 + regmap_reg_range(0xA8, 0xA8), 179 + regmap_reg_range(0xAA, 0xAA), 180 + regmap_reg_range(0xB0, 0xB0), 181 + regmap_reg_range(0xC1, 0xC1), 182 + }; 183 + 184 + static const struct regmap_access_table act8600_write_ranges_table = { 185 + .yes_ranges = act8600_reg_ranges, 186 + .n_yes_ranges = ARRAY_SIZE(act8600_reg_ranges), 187 + .no_ranges = act8600_reg_ro_ranges, 188 + .n_no_ranges = ARRAY_SIZE(act8600_reg_ro_ranges), 189 + }; 190 + 191 + static const struct regmap_access_table act8600_read_ranges_table = { 192 + .yes_ranges = act8600_reg_ranges, 193 + .n_yes_ranges = ARRAY_SIZE(act8600_reg_ranges), 194 + }; 195 + 196 + static const struct regmap_access_table act8600_volatile_ranges_table = { 197 + .yes_ranges = act8600_reg_volatile_ranges, 198 + .n_yes_ranges = ARRAY_SIZE(act8600_reg_volatile_ranges), 199 + }; 200 + 201 + static const struct regmap_config act8600_regmap_config = { 202 + .reg_bits = 8, 203 + .val_bits = 8, 204 + .max_register = 0xFF, 205 + .wr_table = &act8600_write_ranges_table, 206 + .rd_table = &act8600_read_ranges_table, 207 + .volatile_table = &act8600_volatile_ranges_table, 208 + }; 209 + 142 210 static const struct regmap_config act8865_regmap_config = { 143 211 .reg_bits = 8, 144 212 .val_bits = 8, ··· 486 418 struct device *dev = &client->dev; 487 419 int i, ret, num_regulators; 488 420 struct act8865 *act8865; 421 + const struct regmap_config *regmap_config; 489 422 unsigned long type; 490 423 int off_reg, off_mask; 491 424 int voltage_select = 0; ··· 513 444 case ACT8600: 514 445 regulators = act8600_regulators; 515 446 num_regulators = ARRAY_SIZE(act8600_regulators); 447 + regmap_config = &act8600_regmap_config; 516 448 off_reg = -1; 517 449 off_mask = -1; 518 450 break; 519 451 case ACT8846: 520 452 regulators = act8846_regulators; 521 453 num_regulators = ARRAY_SIZE(act8846_regulators); 454 + regmap_config = &act8865_regmap_config; 522 455 off_reg = ACT8846_GLB_OFF_CTRL; 523 456 off_mask = ACT8846_OFF_SYSMASK; 524 457 break; ··· 532 461 regulators = act8865_regulators; 533 462 num_regulators = ARRAY_SIZE(act8865_regulators); 534 463 } 464 + regmap_config = &act8865_regmap_config; 535 465 off_reg = ACT8865_SYS_CTRL; 536 466 off_mask = ACT8865_MSTROFF; 537 467 break; ··· 553 481 if (!act8865) 554 482 return -ENOMEM; 555 483 556 - act8865->regmap = devm_regmap_init_i2c(client, &act8865_regmap_config); 484 + act8865->regmap = devm_regmap_init_i2c(client, regmap_config); 557 485 if (IS_ERR(act8865->regmap)) { 558 486 ret = PTR_ERR(act8865->regmap); 559 487 dev_err(dev, "Failed to allocate register map: %d\n", ret);