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

regulator: act8865: support output voltage by VSET2[] bits

For the step-down DC/DC regulators, the output voltage is
selectable by setting VSEL pin that when VSEL is low, output
voltage is programmed by VSET1[] bits, and when VSEL is high,
output voltage is programmed by VSET2[] bits.

The DT property "active-semi,vsel-high" is used to specify
the VSEL pin at high on the board.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Wenyou Yang and committed by
Mark Brown
c86dc03e 6ff33f39

+22 -2
+22 -2
drivers/regulator/act8865-regulator.c
··· 261 261 ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET, "inl67"), 262 262 }; 263 263 264 + static const struct regulator_desc act8865_alt_regulators[] = { 265 + ACT88xx_REG("DCDC_REG1", ACT8865, DCDC1, VSET2, "vp1"), 266 + ACT88xx_REG("DCDC_REG2", ACT8865, DCDC2, VSET2, "vp2"), 267 + ACT88xx_REG("DCDC_REG3", ACT8865, DCDC3, VSET2, "vp3"), 268 + ACT88xx_REG("LDO_REG1", ACT8865, LDO1, VSET, "inl45"), 269 + ACT88xx_REG("LDO_REG2", ACT8865, LDO2, VSET, "inl45"), 270 + ACT88xx_REG("LDO_REG3", ACT8865, LDO3, VSET, "inl67"), 271 + ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET, "inl67"), 272 + }; 273 + 264 274 #ifdef CONFIG_OF 265 275 static const struct of_device_id act8865_dt_ids[] = { 266 276 { .compatible = "active-semi,act8600", .data = (void *)ACT8600 }, ··· 423 413 struct act8865 *act8865; 424 414 unsigned long type; 425 415 int off_reg, off_mask; 416 + int voltage_select = 0; 426 417 427 418 pdata = dev_get_platdata(dev); 428 419 ··· 435 424 return -ENODEV; 436 425 437 426 type = (unsigned long) id->data; 427 + 428 + voltage_select = !!of_get_property(dev->of_node, 429 + "active-semi,vsel-high", 430 + NULL); 438 431 } else { 439 432 type = i2c_id->driver_data; 440 433 } ··· 457 442 off_mask = ACT8846_OFF_SYSMASK; 458 443 break; 459 444 case ACT8865: 460 - regulators = act8865_regulators; 461 - num_regulators = ARRAY_SIZE(act8865_regulators); 445 + if (voltage_select) { 446 + regulators = act8865_alt_regulators; 447 + num_regulators = ARRAY_SIZE(act8865_alt_regulators); 448 + } else { 449 + regulators = act8865_regulators; 450 + num_regulators = ARRAY_SIZE(act8865_regulators); 451 + } 462 452 off_reg = ACT8865_SYS_CTRL; 463 453 off_mask = ACT8865_MSTROFF; 464 454 break;