regulator: Provide a selector based set_voltage_sel() operation
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 12 Dec 2010 14:36:17 +0000 (14:36 +0000)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Wed, 12 Jan 2011 14:33:04 +0000 (14:33 +0000)
commite8eef82b2c652d031bee9dff9762325672f5a1e0
treeb4c69b01c190e5e5a285a46dd4b26e4c801ddaa2
parent757902513019e6ee469791ff76f954b19ca8d036
regulator: Provide a selector based set_voltage_sel() operation

Many regulator drivers implement voltage setting by looping through a
table of possible values, normally because the set of available voltages
can't be mapped onto selectors with simple calcuation. Factor out these
loops by providing a variant of set_voltage() which takes a selector rather
than a voltage range as an argument and implementing a loop through the
available selectors in the core.

This is not going to be suitable for use with all devices as when the
regulator voltage can be mapped onto selector values with a simple
calculation the linear scan through the available values will be more
expensive than just doing the calculation, especially for regulators
that provide fine grained voltage control.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
drivers/regulator/core.c
include/linux/regulator/driver.h