You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge tag 'regulator-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into next/drivers
The pxa regulator branch removes the bq24022 driver, while a lot of other regulator drivers got added in the regulator tree. This resolves the trivial conflicts by merging in the regulator patches that are already merged into v3.4. Conflicts: drivers/regulator/Kconfig drivers/regulator/Makefile Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
TWL family of regulators
|
||||
|
||||
Required properties:
|
||||
For twl6030 regulators/LDOs
|
||||
- compatible:
|
||||
- "ti,twl6030-vaux1" for VAUX1 LDO
|
||||
- "ti,twl6030-vaux2" for VAUX2 LDO
|
||||
- "ti,twl6030-vaux3" for VAUX3 LDO
|
||||
- "ti,twl6030-vmmc" for VMMC LDO
|
||||
- "ti,twl6030-vpp" for VPP LDO
|
||||
- "ti,twl6030-vusim" for VUSIM LDO
|
||||
- "ti,twl6030-vana" for VANA LDO
|
||||
- "ti,twl6030-vcxio" for VCXIO LDO
|
||||
- "ti,twl6030-vdac" for VDAC LDO
|
||||
- "ti,twl6030-vusb" for VUSB LDO
|
||||
- "ti,twl6030-v1v8" for V1V8 LDO
|
||||
- "ti,twl6030-v2v1" for V2V1 LDO
|
||||
- "ti,twl6030-clk32kg" for CLK32KG RESOURCE
|
||||
- "ti,twl6030-vdd1" for VDD1 SMPS
|
||||
- "ti,twl6030-vdd2" for VDD2 SMPS
|
||||
- "ti,twl6030-vdd3" for VDD3 SMPS
|
||||
For twl6025 regulators/LDOs
|
||||
- compatible:
|
||||
- "ti,twl6025-ldo1" for LDO1 LDO
|
||||
- "ti,twl6025-ldo2" for LDO2 LDO
|
||||
- "ti,twl6025-ldo3" for LDO3 LDO
|
||||
- "ti,twl6025-ldo4" for LDO4 LDO
|
||||
- "ti,twl6025-ldo5" for LDO5 LDO
|
||||
- "ti,twl6025-ldo6" for LDO6 LDO
|
||||
- "ti,twl6025-ldo7" for LDO7 LDO
|
||||
- "ti,twl6025-ldoln" for LDOLN LDO
|
||||
- "ti,twl6025-ldousb" for LDOUSB LDO
|
||||
- "ti,twl6025-smps3" for SMPS3 SMPS
|
||||
- "ti,twl6025-smps4" for SMPS4 SMPS
|
||||
- "ti,twl6025-vio" for VIO SMPS
|
||||
For twl4030 regulators/LDOs
|
||||
- compatible:
|
||||
- "ti,twl4030-vaux1" for VAUX1 LDO
|
||||
- "ti,twl4030-vaux2" for VAUX2 LDO
|
||||
- "ti,twl5030-vaux2" for VAUX2 LDO
|
||||
- "ti,twl4030-vaux3" for VAUX3 LDO
|
||||
- "ti,twl4030-vaux4" for VAUX4 LDO
|
||||
- "ti,twl4030-vmmc1" for VMMC1 LDO
|
||||
- "ti,twl4030-vmmc2" for VMMC2 LDO
|
||||
- "ti,twl4030-vpll1" for VPLL1 LDO
|
||||
- "ti,twl4030-vpll2" for VPLL2 LDO
|
||||
- "ti,twl4030-vsim" for VSIM LDO
|
||||
- "ti,twl4030-vdac" for VDAC LDO
|
||||
- "ti,twl4030-vintana2" for VINTANA2 LDO
|
||||
- "ti,twl4030-vio" for VIO LDO
|
||||
- "ti,twl4030-vdd1" for VDD1 SMPS
|
||||
- "ti,twl4030-vdd2" for VDD2 SMPS
|
||||
- "ti,twl4030-vintana1" for VINTANA1 LDO
|
||||
- "ti,twl4030-vintdig" for VINTDIG LDO
|
||||
- "ti,twl4030-vusb1v5" for VUSB1V5 LDO
|
||||
- "ti,twl4030-vusb1v8" for VUSB1V8 LDO
|
||||
- "ti,twl4030-vusb3v1" for VUSB3V1 LDO
|
||||
|
||||
Optional properties:
|
||||
- Any optional property defined in bindings/regulator/regulator.txt
|
||||
|
||||
Example:
|
||||
|
||||
xyz: regulator@0 {
|
||||
compatible = "ti,twl6030-vaux1";
|
||||
regulator-min-microvolt = <1000000>;
|
||||
regulator-max-microvolt = <3000000>;
|
||||
};
|
||||
@@ -271,3 +271,8 @@ IOMAP
|
||||
pcim_iounmap()
|
||||
pcim_iomap_table() : array of mapped addresses indexed by BAR
|
||||
pcim_iomap_regions() : do request_region() and iomap() on multiple BARs
|
||||
|
||||
REGULATOR
|
||||
devm_regulator_get()
|
||||
devm_regulator_put()
|
||||
devm_regulator_bulk_get()
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include <linux/usb/ulpi.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/regulator/machine.h>
|
||||
#include <linux/regulator/fixed.h>
|
||||
|
||||
#include <media/soc_camera.h>
|
||||
|
||||
@@ -570,6 +572,11 @@ static int __init pcm037_otg_mode(char *options)
|
||||
}
|
||||
__setup("otg_mode=", pcm037_otg_mode);
|
||||
|
||||
static struct regulator_consumer_supply dummy_supplies[] = {
|
||||
REGULATOR_SUPPLY("vdd33a", "smsc911x"),
|
||||
REGULATOR_SUPPLY("vddvario", "smsc911x"),
|
||||
};
|
||||
|
||||
/*
|
||||
* Board specific initialization.
|
||||
*/
|
||||
@@ -579,6 +586,8 @@ static void __init pcm037_init(void)
|
||||
|
||||
imx31_soc_init();
|
||||
|
||||
regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
|
||||
|
||||
mxc_iomux_set_gpr(MUX_PGP_UH2, 1);
|
||||
|
||||
mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins),
|
||||
|
||||
@@ -60,7 +60,6 @@ static struct regulator_consumer_supply supply_ldo_c[] = {
|
||||
*/
|
||||
static struct regulator_consumer_supply supply_ldo_d[] = {
|
||||
{
|
||||
.dev = NULL,
|
||||
.supply = "vana15", /* Powers the SoC (CPU etc) */
|
||||
},
|
||||
};
|
||||
@@ -92,7 +91,6 @@ static struct regulator_consumer_supply supply_ldo_k[] = {
|
||||
*/
|
||||
static struct regulator_consumer_supply supply_ldo_ext[] = {
|
||||
{
|
||||
.dev = NULL,
|
||||
.supply = "vext", /* External power */
|
||||
},
|
||||
};
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/smsc911x.h>
|
||||
#include <linux/regulator/machine.h>
|
||||
#include <linux/regulator/fixed.h>
|
||||
|
||||
#include <mach/hardware.h>
|
||||
|
||||
@@ -148,6 +150,11 @@ static struct irq_chip expio_irq_chip = {
|
||||
.irq_unmask = expio_unmask_irq,
|
||||
};
|
||||
|
||||
static struct regulator_consumer_supply dummy_supplies[] = {
|
||||
REGULATOR_SUPPLY("vdd33a", "smsc911x"),
|
||||
REGULATOR_SUPPLY("vddvario", "smsc911x"),
|
||||
};
|
||||
|
||||
int __init mxc_expio_init(u32 base, u32 p_irq)
|
||||
{
|
||||
int i;
|
||||
@@ -188,6 +195,8 @@ int __init mxc_expio_init(u32 base, u32 p_irq)
|
||||
irq_set_chained_handler(p_irq, mxc_expio_irq_handler);
|
||||
|
||||
/* Register Lan device on the debugboard */
|
||||
regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
|
||||
|
||||
smsc911x_resources[0].start = LAN9217_BASE_ADDR(base);
|
||||
smsc911x_resources[0].end = LAN9217_BASE_ADDR(base) + 0x100 - 1;
|
||||
platform_device_register(&smsc_lan9217_device);
|
||||
|
||||
+44
-5
@@ -617,6 +617,8 @@ add_regulator_linked(int num, struct regulator_init_data *pdata,
|
||||
unsigned num_consumers, unsigned long features)
|
||||
{
|
||||
unsigned sub_chip_id;
|
||||
struct twl_regulator_driver_data drv_data;
|
||||
|
||||
/* regulator framework demands init_data ... */
|
||||
if (!pdata)
|
||||
return NULL;
|
||||
@@ -626,7 +628,19 @@ add_regulator_linked(int num, struct regulator_init_data *pdata,
|
||||
pdata->num_consumer_supplies = num_consumers;
|
||||
}
|
||||
|
||||
pdata->driver_data = (void *)features;
|
||||
if (pdata->driver_data) {
|
||||
/* If we have existing drv_data, just add the flags */
|
||||
struct twl_regulator_driver_data *tmp;
|
||||
tmp = pdata->driver_data;
|
||||
tmp->features |= features;
|
||||
} else {
|
||||
/* add new driver data struct, used only during init */
|
||||
drv_data.features = features;
|
||||
drv_data.set_voltage = NULL;
|
||||
drv_data.get_voltage = NULL;
|
||||
drv_data.data = NULL;
|
||||
pdata->driver_data = &drv_data;
|
||||
}
|
||||
|
||||
/* NOTE: we currently ignore regulator IRQs, e.g. for short circuits */
|
||||
sub_chip_id = twl_map[TWL_MODULE_PM_MASTER].sid;
|
||||
@@ -749,9 +763,9 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
|
||||
|
||||
/* we need to connect regulators to this transceiver */
|
||||
if (twl_has_regulator() && child) {
|
||||
usb1v5.dev = child;
|
||||
usb1v8.dev = child;
|
||||
usb3v1.dev = child;
|
||||
usb1v5.dev_name = dev_name(child);
|
||||
usb1v8.dev_name = dev_name(child);
|
||||
usb3v1.dev_name = dev_name(child);
|
||||
}
|
||||
}
|
||||
if (twl_has_usb() && pdata->usb && twl_class_is_6030()) {
|
||||
@@ -797,7 +811,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
|
||||
return PTR_ERR(child);
|
||||
/* we need to connect regulators to this transceiver */
|
||||
if (twl_has_regulator() && child)
|
||||
usb3v3.dev = child;
|
||||
usb3v3.dev_name = dev_name(child);
|
||||
} else if (twl_has_regulator() && twl_class_is_6030()) {
|
||||
if (features & TWL6025_SUBCLASS)
|
||||
child = add_regulator(TWL6025_REG_LDOUSB,
|
||||
@@ -933,6 +947,31 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
|
||||
/* twl6030 regulators */
|
||||
if (twl_has_regulator() && twl_class_is_6030() &&
|
||||
!(features & TWL6025_SUBCLASS)) {
|
||||
child = add_regulator(TWL6030_REG_VDD1, pdata->vdd1,
|
||||
features);
|
||||
if (IS_ERR(child))
|
||||
return PTR_ERR(child);
|
||||
|
||||
child = add_regulator(TWL6030_REG_VDD2, pdata->vdd2,
|
||||
features);
|
||||
if (IS_ERR(child))
|
||||
return PTR_ERR(child);
|
||||
|
||||
child = add_regulator(TWL6030_REG_VDD3, pdata->vdd3,
|
||||
features);
|
||||
if (IS_ERR(child))
|
||||
return PTR_ERR(child);
|
||||
|
||||
child = add_regulator(TWL6030_REG_V1V8, pdata->v1v8,
|
||||
features);
|
||||
if (IS_ERR(child))
|
||||
return PTR_ERR(child);
|
||||
|
||||
child = add_regulator(TWL6030_REG_V2V1, pdata->v2v1,
|
||||
features);
|
||||
if (IS_ERR(child))
|
||||
return PTR_ERR(child);
|
||||
|
||||
child = add_regulator(TWL6030_REG_VMMC, pdata->vmmc,
|
||||
features);
|
||||
if (IS_ERR(child))
|
||||
|
||||
+204
-165
@@ -74,6 +74,73 @@ config REGULATOR_GPIO
|
||||
and the platform has to provide a mapping of GPIO-states
|
||||
to target volts/amps.
|
||||
|
||||
config REGULATOR_AD5398
|
||||
tristate "Analog Devices AD5398/AD5821 regulators"
|
||||
depends on I2C
|
||||
help
|
||||
This driver supports AD5398 and AD5821 current regulator chips.
|
||||
If building into module, its name is ad5398.ko.
|
||||
|
||||
config REGULATOR_AAT2870
|
||||
tristate "AnalogicTech AAT2870 Regulators"
|
||||
depends on MFD_AAT2870_CORE
|
||||
help
|
||||
If you have a AnalogicTech AAT2870 say Y to enable the
|
||||
regulator driver.
|
||||
|
||||
config REGULATOR_DA903X
|
||||
tristate "Dialog Semiconductor DA9030/DA9034 regulators"
|
||||
depends on PMIC_DA903X
|
||||
help
|
||||
Say y here to support the BUCKs and LDOs regulators found on
|
||||
Dialog Semiconductor DA9030/DA9034 PMIC.
|
||||
|
||||
config REGULATOR_DA9052
|
||||
tristate "Dialog Semiconductor DA9052/DA9053 regulators"
|
||||
depends on PMIC_DA9052
|
||||
help
|
||||
This driver supports the voltage regulators of DA9052-BC and
|
||||
DA9053-AA/Bx PMIC.
|
||||
|
||||
config REGULATOR_ANATOP
|
||||
tristate "Freescale i.MX on-chip ANATOP LDO regulators"
|
||||
depends on MFD_ANATOP
|
||||
help
|
||||
Say y here to support Freescale i.MX on-chip ANATOP LDOs
|
||||
regulators. It is recommended that this option be
|
||||
enabled on i.MX6 platform.
|
||||
|
||||
config REGULATOR_MC13XXX_CORE
|
||||
tristate
|
||||
|
||||
config REGULATOR_MC13783
|
||||
tristate "Freescale MC13783 regulator driver"
|
||||
depends on MFD_MC13783
|
||||
select REGULATOR_MC13XXX_CORE
|
||||
help
|
||||
Say y here to support the regulators found on the Freescale MC13783
|
||||
PMIC.
|
||||
|
||||
config REGULATOR_MC13892
|
||||
tristate "Freescale MC13892 regulator driver"
|
||||
depends on MFD_MC13XXX
|
||||
select REGULATOR_MC13XXX_CORE
|
||||
help
|
||||
Say y here to support the regulators found on the Freescale MC13892
|
||||
PMIC.
|
||||
|
||||
config REGULATOR_ISL6271A
|
||||
tristate "Intersil ISL6271A Power regulator"
|
||||
depends on I2C
|
||||
help
|
||||
This driver supports ISL6271A voltage regulator chip.
|
||||
|
||||
config REGULATOR_88PM8607
|
||||
bool "Marvell 88PM8607 Power regulators"
|
||||
depends on MFD_88PM860X=y
|
||||
help
|
||||
This driver supports 88PM8607 voltage regulator chips.
|
||||
|
||||
config REGULATOR_MAX1586
|
||||
tristate "Maxim 1586/1587 voltage regulator"
|
||||
depends on I2C
|
||||
@@ -128,6 +195,142 @@ config REGULATOR_MAX8998
|
||||
via I2C bus. The provided regulator is suitable for S3C6410
|
||||
and S5PC1XX chips to control VCC_CORE and VCC_USIM voltages.
|
||||
|
||||
config REGULATOR_PCAP
|
||||
tristate "Motorola PCAP2 regulator driver"
|
||||
depends on EZX_PCAP
|
||||
help
|
||||
This driver provides support for the voltage regulators of the
|
||||
PCAP2 PMIC.
|
||||
|
||||
config REGULATOR_LP3971
|
||||
tristate "National Semiconductors LP3971 PMIC regulator driver"
|
||||
depends on I2C
|
||||
help
|
||||
Say Y here to support the voltage regulators and convertors
|
||||
on National Semiconductors LP3971 PMIC
|
||||
|
||||
config REGULATOR_LP3972
|
||||
tristate "National Semiconductors LP3972 PMIC regulator driver"
|
||||
depends on I2C
|
||||
help
|
||||
Say Y here to support the voltage regulators and convertors
|
||||
on National Semiconductors LP3972 PMIC
|
||||
|
||||
config REGULATOR_PCF50633
|
||||
tristate "NXP PCF50633 regulator driver"
|
||||
depends on MFD_PCF50633
|
||||
help
|
||||
Say Y here to support the voltage regulators and convertors
|
||||
on PCF50633
|
||||
|
||||
config REGULATOR_S5M8767
|
||||
tristate "Samsung S5M8767A voltage regulator"
|
||||
depends on MFD_S5M_CORE
|
||||
help
|
||||
This driver supports a Samsung S5M8767A voltage output regulator
|
||||
via I2C bus. S5M8767A have 9 Bucks and 28 LDOs output and
|
||||
supports DVS mode with 8bits of output voltage control.
|
||||
|
||||
config REGULATOR_AB3100
|
||||
tristate "ST-Ericsson AB3100 Regulator functions"
|
||||
depends on AB3100_CORE
|
||||
default y if AB3100_CORE
|
||||
help
|
||||
These regulators correspond to functionality in the
|
||||
AB3100 analog baseband dealing with power regulators
|
||||
for the system.
|
||||
|
||||
config REGULATOR_AB8500
|
||||
bool "ST-Ericsson AB8500 Power Regulators"
|
||||
depends on AB8500_CORE
|
||||
help
|
||||
This driver supports the regulators found on the ST-Ericsson mixed
|
||||
signal AB8500 PMIC
|
||||
|
||||
config REGULATOR_DBX500_PRCMU
|
||||
bool
|
||||
|
||||
config REGULATOR_DB8500_PRCMU
|
||||
bool "ST-Ericsson DB8500 Voltage Domain Regulators"
|
||||
depends on MFD_DB8500_PRCMU
|
||||
select REGULATOR_DBX500_PRCMU
|
||||
help
|
||||
This driver supports the voltage domain regulators controlled by the
|
||||
DB8500 PRCMU
|
||||
|
||||
config REGULATOR_TPS6105X
|
||||
tristate "TI TPS6105X Power regulators"
|
||||
depends on TPS6105X
|
||||
default y if TPS6105X
|
||||
help
|
||||
This driver supports TPS61050/TPS61052 voltage regulator chips.
|
||||
It is a single boost converter primarily for white LEDs and
|
||||
audio amplifiers.
|
||||
|
||||
config REGULATOR_TPS62360
|
||||
tristate "TI TPS62360 Power Regulator"
|
||||
depends on I2C
|
||||
select REGMAP_I2C
|
||||
help
|
||||
This driver supports TPS62360 voltage regulator chip. This
|
||||
regulator is meant for processor core supply. This chip is
|
||||
high-frequency synchronous step down dc-dc converter optimized
|
||||
for battery-powered portable applications.
|
||||
|
||||
config REGULATOR_TPS65023
|
||||
tristate "TI TPS65023 Power regulators"
|
||||
depends on I2C
|
||||
select REGMAP_I2C
|
||||
help
|
||||
This driver supports TPS65023 voltage regulator chips. TPS65023 provides
|
||||
three step-down converters and two general-purpose LDO voltage regulators.
|
||||
It supports TI's software based Class-2 SmartReflex implementation.
|
||||
|
||||
config REGULATOR_TPS6507X
|
||||
tristate "TI TPS6507X Power regulators"
|
||||
depends on I2C
|
||||
help
|
||||
This driver supports TPS6507X voltage regulator chips. TPS6507X provides
|
||||
three step-down converters and two general-purpose LDO voltage regulators.
|
||||
It supports TI's software based Class-2 SmartReflex implementation.
|
||||
|
||||
config REGULATOR_TPS65217
|
||||
tristate "TI TPS65217 Power regulators"
|
||||
depends on MFD_TPS65217
|
||||
help
|
||||
This driver supports TPS65217 voltage regulator chips. TPS65217
|
||||
provides three step-down converters and four general-purpose LDO
|
||||
voltage regulators. It supports software based voltage control
|
||||
for different voltage domains
|
||||
|
||||
config REGULATOR_TPS6524X
|
||||
tristate "TI TPS6524X Power regulators"
|
||||
depends on SPI
|
||||
help
|
||||
This driver supports TPS6524X voltage regulator chips. TPS6524X
|
||||
provides three step-down converters and two general-purpose LDO
|
||||
voltage regulators. This device is interfaced using a customized
|
||||
serial interface currently supported on the sequencer serial
|
||||
port controller.
|
||||
|
||||
config REGULATOR_TPS6586X
|
||||
tristate "TI TPS6586X Power regulators"
|
||||
depends on MFD_TPS6586X
|
||||
help
|
||||
This driver supports TPS6586X voltage regulator chips.
|
||||
|
||||
config REGULATOR_TPS65910
|
||||
tristate "TI TPS65910/TPS65911 Power Regulators"
|
||||
depends on MFD_TPS65910
|
||||
help
|
||||
This driver supports TPS65910/TPS65911 voltage regulator chips.
|
||||
|
||||
config REGULATOR_TPS65912
|
||||
tristate "TI TPS65912 Power regulator"
|
||||
depends on (MFD_TPS65912_I2C || MFD_TPS65912_SPI)
|
||||
help
|
||||
This driver supports TPS65912 voltage regulator chip.
|
||||
|
||||
config REGULATOR_TWL4030
|
||||
bool "TI TWL4030/TWL5030/TWL6030/TPS659x0 PMIC"
|
||||
depends on TWL4030_CORE
|
||||
@@ -136,7 +339,7 @@ config REGULATOR_TWL4030
|
||||
this family of companion chips.
|
||||
|
||||
config REGULATOR_WM831X
|
||||
tristate "Wolfson Microelcronics WM831x PMIC regulators"
|
||||
tristate "Wolfson Microelectronics WM831x PMIC regulators"
|
||||
depends on MFD_WM831X
|
||||
help
|
||||
Support the voltage and current regulators of the WM831x series
|
||||
@@ -163,169 +366,5 @@ config REGULATOR_WM8994
|
||||
This driver provides support for the voltage regulators on the
|
||||
WM8994 CODEC.
|
||||
|
||||
config REGULATOR_DA903X
|
||||
tristate "Support regulators on Dialog Semiconductor DA9030/DA9034 PMIC"
|
||||
depends on PMIC_DA903X
|
||||
help
|
||||
Say y here to support the BUCKs and LDOs regulators found on
|
||||
Dialog Semiconductor DA9030/DA9034 PMIC.
|
||||
|
||||
config REGULATOR_DA9052
|
||||
tristate "Dialog DA9052/DA9053 regulators"
|
||||
depends on PMIC_DA9052
|
||||
help
|
||||
This driver supports the voltage regulators of DA9052-BC and
|
||||
DA9053-AA/Bx PMIC.
|
||||
|
||||
config REGULATOR_PCF50633
|
||||
tristate "PCF50633 regulator driver"
|
||||
depends on MFD_PCF50633
|
||||
help
|
||||
Say Y here to support the voltage regulators and convertors
|
||||
on PCF50633
|
||||
|
||||
config REGULATOR_LP3971
|
||||
tristate "National Semiconductors LP3971 PMIC regulator driver"
|
||||
depends on I2C
|
||||
help
|
||||
Say Y here to support the voltage regulators and convertors
|
||||
on National Semiconductors LP3971 PMIC
|
||||
|
||||
config REGULATOR_LP3972
|
||||
tristate "National Semiconductors LP3972 PMIC regulator driver"
|
||||
depends on I2C
|
||||
help
|
||||
Say Y here to support the voltage regulators and convertors
|
||||
on National Semiconductors LP3972 PMIC
|
||||
|
||||
config REGULATOR_PCAP
|
||||
tristate "PCAP2 regulator driver"
|
||||
depends on EZX_PCAP
|
||||
help
|
||||
This driver provides support for the voltage regulators of the
|
||||
PCAP2 PMIC.
|
||||
|
||||
config REGULATOR_MC13XXX_CORE
|
||||
tristate
|
||||
|
||||
config REGULATOR_MC13783
|
||||
tristate "Support regulators on Freescale MC13783 PMIC"
|
||||
depends on MFD_MC13783
|
||||
select REGULATOR_MC13XXX_CORE
|
||||
help
|
||||
Say y here to support the regulators found on the Freescale MC13783
|
||||
PMIC.
|
||||
|
||||
config REGULATOR_MC13892
|
||||
tristate "Support regulators on Freescale MC13892 PMIC"
|
||||
depends on MFD_MC13XXX
|
||||
select REGULATOR_MC13XXX_CORE
|
||||
help
|
||||
Say y here to support the regulators found on the Freescale MC13892
|
||||
PMIC.
|
||||
|
||||
config REGULATOR_AB3100
|
||||
tristate "ST-Ericsson AB3100 Regulator functions"
|
||||
depends on AB3100_CORE
|
||||
default y if AB3100_CORE
|
||||
help
|
||||
These regulators correspond to functionality in the
|
||||
AB3100 analog baseband dealing with power regulators
|
||||
for the system.
|
||||
|
||||
config REGULATOR_TPS6105X
|
||||
tristate "TI TPS6105X Power regulators"
|
||||
depends on TPS6105X
|
||||
default y if TPS6105X
|
||||
help
|
||||
This driver supports TPS61050/TPS61052 voltage regulator chips.
|
||||
It is a single boost converter primarily for white LEDs and
|
||||
audio amplifiers.
|
||||
|
||||
config REGULATOR_TPS65023
|
||||
tristate "TI TPS65023 Power regulators"
|
||||
depends on I2C
|
||||
select REGMAP_I2C
|
||||
help
|
||||
This driver supports TPS65023 voltage regulator chips. TPS65023 provides
|
||||
three step-down converters and two general-purpose LDO voltage regulators.
|
||||
It supports TI's software based Class-2 SmartReflex implementation.
|
||||
|
||||
config REGULATOR_TPS6507X
|
||||
tristate "TI TPS6507X Power regulators"
|
||||
depends on I2C
|
||||
help
|
||||
This driver supports TPS6507X voltage regulator chips. TPS6507X provides
|
||||
three step-down converters and two general-purpose LDO voltage regulators.
|
||||
It supports TI's software based Class-2 SmartReflex implementation.
|
||||
|
||||
config REGULATOR_TPS65912
|
||||
tristate "TI TPS65912 Power regulator"
|
||||
depends on (MFD_TPS65912_I2C || MFD_TPS65912_SPI)
|
||||
help
|
||||
This driver supports TPS65912 voltage regulator chip.
|
||||
|
||||
config REGULATOR_88PM8607
|
||||
bool "Marvell 88PM8607 Power regulators"
|
||||
depends on MFD_88PM860X=y
|
||||
help
|
||||
This driver supports 88PM8607 voltage regulator chips.
|
||||
|
||||
config REGULATOR_ISL6271A
|
||||
tristate "Intersil ISL6271A Power regulator"
|
||||
depends on I2C
|
||||
help
|
||||
This driver supports ISL6271A voltage regulator chip.
|
||||
|
||||
config REGULATOR_AD5398
|
||||
tristate "Analog Devices AD5398/AD5821 regulators"
|
||||
depends on I2C
|
||||
help
|
||||
This driver supports AD5398 and AD5821 current regulator chips.
|
||||
If building into module, its name is ad5398.ko.
|
||||
|
||||
config REGULATOR_AB8500
|
||||
bool "ST-Ericsson AB8500 Power Regulators"
|
||||
depends on AB8500_CORE
|
||||
help
|
||||
This driver supports the regulators found on the ST-Ericsson mixed
|
||||
signal AB8500 PMIC
|
||||
|
||||
config REGULATOR_DB8500_PRCMU
|
||||
bool "ST-Ericsson DB8500 Voltage Domain Regulators"
|
||||
depends on MFD_DB8500_PRCMU
|
||||
help
|
||||
This driver supports the voltage domain regulators controlled by the
|
||||
DB8500 PRCMU
|
||||
|
||||
config REGULATOR_TPS6586X
|
||||
tristate "TI TPS6586X Power regulators"
|
||||
depends on MFD_TPS6586X
|
||||
help
|
||||
This driver supports TPS6586X voltage regulator chips.
|
||||
|
||||
config REGULATOR_TPS6524X
|
||||
tristate "TI TPS6524X Power regulators"
|
||||
depends on SPI
|
||||
help
|
||||
This driver supports TPS6524X voltage regulator chips. TPS6524X
|
||||
provides three step-down converters and two general-purpose LDO
|
||||
voltage regulators. This device is interfaced using a customized
|
||||
serial interface currently supported on the sequencer serial
|
||||
port controller.
|
||||
|
||||
config REGULATOR_TPS65910
|
||||
tristate "TI TPS65910 Power Regulator"
|
||||
depends on MFD_TPS65910
|
||||
help
|
||||
This driver supports TPS65910 voltage regulator chips.
|
||||
|
||||
config REGULATOR_AAT2870
|
||||
tristate "AnalogicTech AAT2870 Regulators"
|
||||
depends on MFD_AAT2870_CORE
|
||||
help
|
||||
If you have a AnalogicTech AAT2870 say Y to enable the
|
||||
regulator driver.
|
||||
|
||||
endif
|
||||
|
||||
|
||||
+28
-22
@@ -3,49 +3,55 @@
|
||||
#
|
||||
|
||||
|
||||
obj-$(CONFIG_REGULATOR) += core.o dummy.o
|
||||
obj-$(CONFIG_REGULATOR) += core.o dummy.o fixed-helper.o
|
||||
obj-$(CONFIG_OF) += of_regulator.o
|
||||
obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o
|
||||
obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o
|
||||
obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o
|
||||
|
||||
obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o
|
||||
obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o
|
||||
obj-$(CONFIG_REGULATOR_AB8500) += ab8500.o
|
||||
obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o
|
||||
obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
|
||||
obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
|
||||
obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
|
||||
obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o
|
||||
obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o
|
||||
obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
|
||||
obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_MAX8649) += max8649.o
|
||||
obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o
|
||||
obj-$(CONFIG_REGULATOR_MAX8925) += max8925-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_MAX8952) += max8952.o
|
||||
obj-$(CONFIG_REGULATOR_MAX8997) += max8997.o
|
||||
obj-$(CONFIG_REGULATOR_MAX8998) += max8998.o
|
||||
obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o
|
||||
obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o
|
||||
obj-$(CONFIG_REGULATOR_TPS6105X) += tps6105x-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TPS62360) += tps62360-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TPS65217) += tps65217-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o
|
||||
obj-$(CONFIG_REGULATOR_WM831X) += wm831x-isink.o
|
||||
obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o
|
||||
obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_WM8994) += wm8994-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
|
||||
obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o
|
||||
obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o
|
||||
obj-$(CONFIG_REGULATOR_TPS6105X) += tps6105x-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o
|
||||
obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_AB8500) += ab8500.o
|
||||
obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
|
||||
obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o
|
||||
obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o
|
||||
|
||||
|
||||
ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <linux/mfd/aat2870.h>
|
||||
|
||||
struct aat2870_regulator {
|
||||
struct platform_device *pdev;
|
||||
struct aat2870_data *aat2870;
|
||||
struct regulator_desc desc;
|
||||
|
||||
const int *voltages; /* uV */
|
||||
@@ -60,7 +60,7 @@ static int aat2870_ldo_set_voltage_sel(struct regulator_dev *rdev,
|
||||
unsigned selector)
|
||||
{
|
||||
struct aat2870_regulator *ri = rdev_get_drvdata(rdev);
|
||||
struct aat2870_data *aat2870 = dev_get_drvdata(ri->pdev->dev.parent);
|
||||
struct aat2870_data *aat2870 = ri->aat2870;
|
||||
|
||||
return aat2870->update(aat2870, ri->voltage_addr, ri->voltage_mask,
|
||||
selector << ri->voltage_shift);
|
||||
@@ -69,7 +69,7 @@ static int aat2870_ldo_set_voltage_sel(struct regulator_dev *rdev,
|
||||
static int aat2870_ldo_get_voltage_sel(struct regulator_dev *rdev)
|
||||
{
|
||||
struct aat2870_regulator *ri = rdev_get_drvdata(rdev);
|
||||
struct aat2870_data *aat2870 = dev_get_drvdata(ri->pdev->dev.parent);
|
||||
struct aat2870_data *aat2870 = ri->aat2870;
|
||||
u8 val;
|
||||
int ret;
|
||||
|
||||
@@ -83,7 +83,7 @@ static int aat2870_ldo_get_voltage_sel(struct regulator_dev *rdev)
|
||||
static int aat2870_ldo_enable(struct regulator_dev *rdev)
|
||||
{
|
||||
struct aat2870_regulator *ri = rdev_get_drvdata(rdev);
|
||||
struct aat2870_data *aat2870 = dev_get_drvdata(ri->pdev->dev.parent);
|
||||
struct aat2870_data *aat2870 = ri->aat2870;
|
||||
|
||||
return aat2870->update(aat2870, ri->enable_addr, ri->enable_mask,
|
||||
ri->enable_mask);
|
||||
@@ -92,7 +92,7 @@ static int aat2870_ldo_enable(struct regulator_dev *rdev)
|
||||
static int aat2870_ldo_disable(struct regulator_dev *rdev)
|
||||
{
|
||||
struct aat2870_regulator *ri = rdev_get_drvdata(rdev);
|
||||
struct aat2870_data *aat2870 = dev_get_drvdata(ri->pdev->dev.parent);
|
||||
struct aat2870_data *aat2870 = ri->aat2870;
|
||||
|
||||
return aat2870->update(aat2870, ri->enable_addr, ri->enable_mask, 0);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ static int aat2870_ldo_disable(struct regulator_dev *rdev)
|
||||
static int aat2870_ldo_is_enabled(struct regulator_dev *rdev)
|
||||
{
|
||||
struct aat2870_regulator *ri = rdev_get_drvdata(rdev);
|
||||
struct aat2870_data *aat2870 = dev_get_drvdata(ri->pdev->dev.parent);
|
||||
struct aat2870_data *aat2870 = ri->aat2870;
|
||||
u8 val;
|
||||
int ret;
|
||||
|
||||
@@ -185,7 +185,7 @@ static int aat2870_regulator_probe(struct platform_device *pdev)
|
||||
dev_err(&pdev->dev, "Invalid device ID, %d\n", pdev->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
ri->pdev = pdev;
|
||||
ri->aat2870 = dev_get_drvdata(pdev->dev.parent);
|
||||
|
||||
rdev = regulator_register(&ri->desc, &pdev->dev,
|
||||
pdev->dev.platform_data, ri, NULL);
|
||||
|
||||
@@ -201,7 +201,7 @@ static int ab8500_list_voltage(struct regulator_dev *rdev, unsigned selector)
|
||||
return info->voltages[selector];
|
||||
}
|
||||
|
||||
static int ab8500_regulator_get_voltage(struct regulator_dev *rdev)
|
||||
static int ab8500_regulator_get_voltage_sel(struct regulator_dev *rdev)
|
||||
{
|
||||
int ret, val;
|
||||
struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
|
||||
@@ -229,11 +229,9 @@ static int ab8500_regulator_get_voltage(struct regulator_dev *rdev)
|
||||
/* vintcore has a different layout */
|
||||
val = regval & info->voltage_mask;
|
||||
if (info->desc.id == AB8500_LDO_INTCORE)
|
||||
ret = info->voltages[val >> 0x3];
|
||||
return val >> 0x3;
|
||||
else
|
||||
ret = info->voltages[val];
|
||||
|
||||
return ret;
|
||||
return val;
|
||||
}
|
||||
|
||||
static int ab8500_get_best_voltage_index(struct regulator_dev *rdev,
|
||||
@@ -320,7 +318,7 @@ static struct regulator_ops ab8500_regulator_ops = {
|
||||
.enable = ab8500_regulator_enable,
|
||||
.disable = ab8500_regulator_disable,
|
||||
.is_enabled = ab8500_regulator_is_enabled,
|
||||
.get_voltage = ab8500_regulator_get_voltage,
|
||||
.get_voltage_sel = ab8500_regulator_get_voltage_sel,
|
||||
.set_voltage = ab8500_regulator_set_voltage,
|
||||
.list_voltage = ab8500_list_voltage,
|
||||
.enable_time = ab8500_regulator_enable_time,
|
||||
|
||||
@@ -94,8 +94,8 @@ static int ad5398_set_current_limit(struct regulator_dev *rdev, int min_uA, int
|
||||
if (max_uA > chip->max_uA || max_uA < chip->min_uA)
|
||||
return -EINVAL;
|
||||
|
||||
selector = ((min_uA - chip->min_uA) * chip->current_level +
|
||||
range_uA - 1) / range_uA;
|
||||
selector = DIV_ROUND_UP((min_uA - chip->min_uA) * chip->current_level,
|
||||
range_uA);
|
||||
if (ad5398_calc_current(chip, selector) > max_uA)
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/mfd/anatop.h>
|
||||
#include <linux/regulator/driver.h>
|
||||
#include <linux/regulator/of_regulator.h>
|
||||
|
||||
struct anatop_regulator {
|
||||
const char *name;
|
||||
u32 control_reg;
|
||||
struct anatop *mfd;
|
||||
int vol_bit_shift;
|
||||
int vol_bit_width;
|
||||
int min_bit_val;
|
||||
int min_voltage;
|
||||
int max_voltage;
|
||||
struct regulator_desc rdesc;
|
||||
struct regulator_init_data *initdata;
|
||||
};
|
||||
|
||||
static int anatop_set_voltage(struct regulator_dev *reg, int min_uV,
|
||||
int max_uV, unsigned *selector)
|
||||
{
|
||||
struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
|
||||
u32 val, sel;
|
||||
int uv;
|
||||
|
||||
uv = min_uV;
|
||||
dev_dbg(®->dev, "%s: uv %d, min %d, max %d\n", __func__,
|
||||
uv, anatop_reg->min_voltage,
|
||||
anatop_reg->max_voltage);
|
||||
|
||||
if (uv < anatop_reg->min_voltage) {
|
||||
if (max_uV > anatop_reg->min_voltage)
|
||||
uv = anatop_reg->min_voltage;
|
||||
else
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!anatop_reg->control_reg)
|
||||
return -ENOTSUPP;
|
||||
|
||||
sel = DIV_ROUND_UP(uv - anatop_reg->min_voltage, 25000);
|
||||
if (sel * 25000 + anatop_reg->min_voltage > anatop_reg->max_voltage)
|
||||
return -EINVAL;
|
||||
val = anatop_reg->min_bit_val + sel;
|
||||
*selector = sel;
|
||||
dev_dbg(®->dev, "%s: calculated val %d\n", __func__, val);
|
||||
anatop_set_bits(anatop_reg->mfd,
|
||||
anatop_reg->control_reg,
|
||||
anatop_reg->vol_bit_shift,
|
||||
anatop_reg->vol_bit_width,
|
||||
val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int anatop_get_voltage_sel(struct regulator_dev *reg)
|
||||
{
|
||||
struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
|
||||
u32 val;
|
||||
|
||||
if (!anatop_reg->control_reg)
|
||||
return -ENOTSUPP;
|
||||
|
||||
val = anatop_get_bits(anatop_reg->mfd,
|
||||
anatop_reg->control_reg,
|
||||
anatop_reg->vol_bit_shift,
|
||||
anatop_reg->vol_bit_width);
|
||||
|
||||
return val - anatop_reg->min_bit_val;
|
||||
}
|
||||
|
||||
static int anatop_list_voltage(struct regulator_dev *reg, unsigned selector)
|
||||
{
|
||||
struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
|
||||
int uv;
|
||||
|
||||
uv = anatop_reg->min_voltage + selector * 25000;
|
||||
dev_dbg(®->dev, "vddio = %d, selector = %u\n", uv, selector);
|
||||
|
||||
return uv;
|
||||
}
|
||||
|
||||
static struct regulator_ops anatop_rops = {
|
||||
.set_voltage = anatop_set_voltage,
|
||||
.get_voltage_sel = anatop_get_voltage_sel,
|
||||
.list_voltage = anatop_list_voltage,
|
||||
};
|
||||
|
||||
static int __devinit anatop_regulator_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *np = dev->of_node;
|
||||
struct regulator_desc *rdesc;
|
||||
struct regulator_dev *rdev;
|
||||
struct anatop_regulator *sreg;
|
||||
struct regulator_init_data *initdata;
|
||||
struct anatop *anatopmfd = dev_get_drvdata(pdev->dev.parent);
|
||||
int ret = 0;
|
||||
|
||||
initdata = of_get_regulator_init_data(dev, np);
|
||||
sreg = devm_kzalloc(dev, sizeof(*sreg), GFP_KERNEL);
|
||||
if (!sreg)
|
||||
return -ENOMEM;
|
||||
sreg->initdata = initdata;
|
||||
sreg->name = kstrdup(of_get_property(np, "regulator-name", NULL),
|
||||
GFP_KERNEL);
|
||||
rdesc = &sreg->rdesc;
|
||||
memset(rdesc, 0, sizeof(*rdesc));
|
||||
rdesc->name = sreg->name;
|
||||
rdesc->ops = &anatop_rops;
|
||||
rdesc->type = REGULATOR_VOLTAGE;
|
||||
rdesc->owner = THIS_MODULE;
|
||||
sreg->mfd = anatopmfd;
|
||||
ret = of_property_read_u32(np, "reg", &sreg->control_reg);
|
||||
if (ret) {
|
||||
dev_err(dev, "no reg property set\n");
|
||||
goto anatop_probe_end;
|
||||
}
|
||||
ret = of_property_read_u32(np, "anatop-vol-bit-width",
|
||||
&sreg->vol_bit_width);
|
||||
if (ret) {
|
||||
dev_err(dev, "no anatop-vol-bit-width property set\n");
|
||||
goto anatop_probe_end;
|
||||
}
|
||||
ret = of_property_read_u32(np, "anatop-vol-bit-shift",
|
||||
&sreg->vol_bit_shift);
|
||||
if (ret) {
|
||||
dev_err(dev, "no anatop-vol-bit-shift property set\n");
|
||||
goto anatop_probe_end;
|
||||
}
|
||||
ret = of_property_read_u32(np, "anatop-min-bit-val",
|
||||
&sreg->min_bit_val);
|
||||
if (ret) {
|
||||
dev_err(dev, "no anatop-min-bit-val property set\n");
|
||||
goto anatop_probe_end;
|
||||
}
|
||||
ret = of_property_read_u32(np, "anatop-min-voltage",
|
||||
&sreg->min_voltage);
|
||||
if (ret) {
|
||||
dev_err(dev, "no anatop-min-voltage property set\n");
|
||||
goto anatop_probe_end;
|
||||
}
|
||||
ret = of_property_read_u32(np, "anatop-max-voltage",
|
||||
&sreg->max_voltage);
|
||||
if (ret) {
|
||||
dev_err(dev, "no anatop-max-voltage property set\n");
|
||||
goto anatop_probe_end;
|
||||
}
|
||||
|
||||
rdesc->n_voltages = (sreg->max_voltage - sreg->min_voltage)
|
||||
/ 25000 + 1;
|
||||
|
||||
/* register regulator */
|
||||
rdev = regulator_register(rdesc, dev,
|
||||
initdata, sreg, pdev->dev.of_node);
|
||||
if (IS_ERR(rdev)) {
|
||||
dev_err(dev, "failed to register %s\n",
|
||||
rdesc->name);
|
||||
ret = PTR_ERR(rdev);
|
||||
goto anatop_probe_end;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, rdev);
|
||||
|
||||
anatop_probe_end:
|
||||
if (ret)
|
||||
kfree(sreg->name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __devexit anatop_regulator_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct regulator_dev *rdev = platform_get_drvdata(pdev);
|
||||
struct anatop_regulator *sreg = rdev_get_drvdata(rdev);
|
||||
const char *name = sreg->name;
|
||||
|
||||
regulator_unregister(rdev);
|
||||
kfree(name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct of_device_id __devinitdata of_anatop_regulator_match_tbl[] = {
|
||||
{ .compatible = "fsl,anatop-regulator", },
|
||||
{ /* end */ }
|
||||
};
|
||||
|
||||
static struct platform_driver anatop_regulator = {
|
||||
.driver = {
|
||||
.name = "anatop_regulator",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = of_anatop_regulator_match_tbl,
|
||||
},
|
||||
.probe = anatop_regulator_probe,
|
||||
.remove = anatop_regulator_remove,
|
||||
};
|
||||
|
||||
static int __init anatop_regulator_init(void)
|
||||
{
|
||||
return platform_driver_register(&anatop_regulator);
|
||||
}
|
||||
postcore_initcall(anatop_regulator_init);
|
||||
|
||||
static void __exit anatop_regulator_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&anatop_regulator);
|
||||
}
|
||||
module_exit(anatop_regulator_exit);
|
||||
|
||||
MODULE_AUTHOR("Nancy Chen <Nancy.Chen@freescale.com>, "
|
||||
"Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>");
|
||||
MODULE_DESCRIPTION("ANATOP Regulator driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
+143
-57
@@ -13,8 +13,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "%s: " fmt, __func__
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/debugfs.h>
|
||||
@@ -54,9 +52,7 @@ static LIST_HEAD(regulator_map_list);
|
||||
static bool has_full_constraints;
|
||||
static bool board_wants_dummy_regulator;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
static struct dentry *debugfs_root;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* struct regulator_map
|
||||
@@ -84,9 +80,7 @@ struct regulator {
|
||||
char *supply_name;
|
||||
struct device_attribute dev_attr;
|
||||
struct regulator_dev *rdev;
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct dentry *debugfs;
|
||||
#endif
|
||||
};
|
||||
|
||||
static int _regulator_is_enabled(struct regulator_dev *rdev);
|
||||
@@ -154,7 +148,7 @@ static struct device_node *of_get_regulator(struct device *dev, const char *supp
|
||||
regnode = of_parse_phandle(dev->of_node, prop_name, 0);
|
||||
|
||||
if (!regnode) {
|
||||
dev_warn(dev, "%s property in node %s references invalid phandle",
|
||||
dev_dbg(dev, "Looking up %s property in node %s failed",
|
||||
prop_name, dev->of_node->full_name);
|
||||
return NULL;
|
||||
}
|
||||
@@ -807,6 +801,11 @@ static void print_constraints(struct regulator_dev *rdev)
|
||||
count += sprintf(buf + count, "standby");
|
||||
|
||||
rdev_info(rdev, "%s\n", buf);
|
||||
|
||||
if ((constraints->min_uV != constraints->max_uV) &&
|
||||
!(constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE))
|
||||
rdev_warn(rdev,
|
||||
"Voltage range but no REGULATOR_CHANGE_VOLTAGE\n");
|
||||
}
|
||||
|
||||
static int machine_constraints_voltage(struct regulator_dev *rdev,
|
||||
@@ -996,7 +995,6 @@ static int set_supply(struct regulator_dev *rdev,
|
||||
/**
|
||||
* set_consumer_device_supply - Bind a regulator to a symbolic supply
|
||||
* @rdev: regulator source
|
||||
* @consumer_dev: device the supply applies to
|
||||
* @consumer_dev_name: dev_name() string for device supply applies to
|
||||
* @supply: symbolic name for supply
|
||||
*
|
||||
@@ -1004,22 +1002,14 @@ static int set_supply(struct regulator_dev *rdev,
|
||||
* sources to symbolic names for supplies for use by devices. Devices
|
||||
* should use these symbolic names to request regulators, avoiding the
|
||||
* need to provide board-specific regulator names as platform data.
|
||||
*
|
||||
* Only one of consumer_dev and consumer_dev_name may be specified.
|
||||
*/
|
||||
static int set_consumer_device_supply(struct regulator_dev *rdev,
|
||||
struct device *consumer_dev, const char *consumer_dev_name,
|
||||
const char *supply)
|
||||
const char *consumer_dev_name,
|
||||
const char *supply)
|
||||
{
|
||||
struct regulator_map *node;
|
||||
int has_dev;
|
||||
|
||||
if (consumer_dev && consumer_dev_name)
|
||||
return -EINVAL;
|
||||
|
||||
if (!consumer_dev_name && consumer_dev)
|
||||
consumer_dev_name = dev_name(consumer_dev);
|
||||
|
||||
if (supply == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -1039,11 +1029,12 @@ static int set_consumer_device_supply(struct regulator_dev *rdev,
|
||||
if (strcmp(node->supply, supply) != 0)
|
||||
continue;
|
||||
|
||||
dev_dbg(consumer_dev, "%s/%s is '%s' supply; fail %s/%s\n",
|
||||
dev_name(&node->regulator->dev),
|
||||
node->regulator->desc->name,
|
||||
supply,
|
||||
dev_name(&rdev->dev), rdev_get_name(rdev));
|
||||
pr_debug("%s: %s/%s is '%s' supply; fail %s/%s\n",
|
||||
consumer_dev_name,
|
||||
dev_name(&node->regulator->dev),
|
||||
node->regulator->desc->name,
|
||||
supply,
|
||||
dev_name(&rdev->dev), rdev_get_name(rdev));
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
@@ -1142,12 +1133,10 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
|
||||
goto attr_err;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
regulator->debugfs = debugfs_create_dir(regulator->supply_name,
|
||||
rdev->debugfs);
|
||||
if (IS_ERR_OR_NULL(regulator->debugfs)) {
|
||||
if (!regulator->debugfs) {
|
||||
rdev_warn(rdev, "Failed to create debugfs directory\n");
|
||||
regulator->debugfs = NULL;
|
||||
} else {
|
||||
debugfs_create_u32("uA_load", 0444, regulator->debugfs,
|
||||
®ulator->uA_load);
|
||||
@@ -1156,7 +1145,6 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
|
||||
debugfs_create_u32("max_uV", 0444, regulator->debugfs,
|
||||
®ulator->max_uV);
|
||||
}
|
||||
#endif
|
||||
|
||||
mutex_unlock(&rdev->mutex);
|
||||
return regulator;
|
||||
@@ -1320,6 +1308,40 @@ struct regulator *regulator_get(struct device *dev, const char *id)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regulator_get);
|
||||
|
||||
static void devm_regulator_release(struct device *dev, void *res)
|
||||
{
|
||||
regulator_put(*(struct regulator **)res);
|
||||
}
|
||||
|
||||
/**
|
||||
* devm_regulator_get - Resource managed regulator_get()
|
||||
* @dev: device for regulator "consumer"
|
||||
* @id: Supply name or regulator ID.
|
||||
*
|
||||
* Managed regulator_get(). Regulators returned from this function are
|
||||
* automatically regulator_put() on driver detach. See regulator_get() for more
|
||||
* information.
|
||||
*/
|
||||
struct regulator *devm_regulator_get(struct device *dev, const char *id)
|
||||
{
|
||||
struct regulator **ptr, *regulator;
|
||||
|
||||
ptr = devres_alloc(devm_regulator_release, sizeof(*ptr), GFP_KERNEL);
|
||||
if (!ptr)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
regulator = regulator_get(dev, id);
|
||||
if (!IS_ERR(regulator)) {
|
||||
*ptr = regulator;
|
||||
devres_add(dev, ptr);
|
||||
} else {
|
||||
devres_free(ptr);
|
||||
}
|
||||
|
||||
return regulator;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_regulator_get);
|
||||
|
||||
/**
|
||||
* regulator_get_exclusive - obtain exclusive access to a regulator.
|
||||
* @dev: device for regulator "consumer"
|
||||
@@ -1365,9 +1387,7 @@ void regulator_put(struct regulator *regulator)
|
||||
mutex_lock(®ulator_list_mutex);
|
||||
rdev = regulator->rdev;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
debugfs_remove_recursive(regulator->debugfs);
|
||||
#endif
|
||||
|
||||
/* remove any sysfs entries */
|
||||
if (regulator->dev) {
|
||||
@@ -1387,6 +1407,34 @@ void regulator_put(struct regulator *regulator)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regulator_put);
|
||||
|
||||
static int devm_regulator_match(struct device *dev, void *res, void *data)
|
||||
{
|
||||
struct regulator **r = res;
|
||||
if (!r || !*r) {
|
||||
WARN_ON(!r || !*r);
|
||||
return 0;
|
||||
}
|
||||
return *r == data;
|
||||
}
|
||||
|
||||
/**
|
||||
* devm_regulator_put - Resource managed regulator_put()
|
||||
* @regulator: regulator to free
|
||||
*
|
||||
* Deallocate a regulator allocated with devm_regulator_get(). Normally
|
||||
* this function will not need to be called and the resource management
|
||||
* code will ensure that the resource is freed.
|
||||
*/
|
||||
void devm_regulator_put(struct regulator *regulator)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = devres_destroy(regulator->dev, devm_regulator_release,
|
||||
devm_regulator_match, regulator);
|
||||
WARN_ON(rc);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_regulator_put);
|
||||
|
||||
static int _regulator_can_change_status(struct regulator_dev *rdev)
|
||||
{
|
||||
if (!rdev->constraints)
|
||||
@@ -1842,8 +1890,12 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
old_selector = ret;
|
||||
delay = rdev->desc->ops->set_voltage_time_sel(rdev,
|
||||
ret = rdev->desc->ops->set_voltage_time_sel(rdev,
|
||||
old_selector, selector);
|
||||
if (ret < 0)
|
||||
rdev_warn(rdev, "set_voltage_time_sel() failed: %d\n", ret);
|
||||
else
|
||||
delay = ret;
|
||||
}
|
||||
|
||||
if (best_val != INT_MAX) {
|
||||
@@ -2394,13 +2446,59 @@ int regulator_bulk_get(struct device *dev, int num_consumers,
|
||||
return 0;
|
||||
|
||||
err:
|
||||
for (i = 0; i < num_consumers && consumers[i].consumer; i++)
|
||||
while (--i >= 0)
|
||||
regulator_put(consumers[i].consumer);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regulator_bulk_get);
|
||||
|
||||
/**
|
||||
* devm_regulator_bulk_get - managed get multiple regulator consumers
|
||||
*
|
||||
* @dev: Device to supply
|
||||
* @num_consumers: Number of consumers to register
|
||||
* @consumers: Configuration of consumers; clients are stored here.
|
||||
*
|
||||
* @return 0 on success, an errno on failure.
|
||||
*
|
||||
* This helper function allows drivers to get several regulator
|
||||
* consumers in one operation with management, the regulators will
|
||||
* automatically be freed when the device is unbound. If any of the
|
||||
* regulators cannot be acquired then any regulators that were
|
||||
* allocated will be freed before returning to the caller.
|
||||
*/
|
||||
int devm_regulator_bulk_get(struct device *dev, int num_consumers,
|
||||
struct regulator_bulk_data *consumers)
|
||||
{
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
for (i = 0; i < num_consumers; i++)
|
||||
consumers[i].consumer = NULL;
|
||||
|
||||
for (i = 0; i < num_consumers; i++) {
|
||||
consumers[i].consumer = devm_regulator_get(dev,
|
||||
consumers[i].supply);
|
||||
if (IS_ERR(consumers[i].consumer)) {
|
||||
ret = PTR_ERR(consumers[i].consumer);
|
||||
dev_err(dev, "Failed to get supply '%s': %d\n",
|
||||
consumers[i].supply, ret);
|
||||
consumers[i].consumer = NULL;
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
for (i = 0; i < num_consumers && consumers[i].consumer; i++)
|
||||
devm_regulator_put(consumers[i].consumer);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_regulator_bulk_get);
|
||||
|
||||
static void regulator_bulk_enable_async(void *data, async_cookie_t cookie)
|
||||
{
|
||||
struct regulator_bulk_data *bulk = data;
|
||||
@@ -2444,12 +2542,9 @@ int regulator_bulk_enable(int num_consumers,
|
||||
return 0;
|
||||
|
||||
err:
|
||||
for (i = 0; i < num_consumers; i++)
|
||||
if (consumers[i].ret == 0)
|
||||
regulator_disable(consumers[i].consumer);
|
||||
else
|
||||
pr_err("Failed to enable %s: %d\n",
|
||||
consumers[i].supply, consumers[i].ret);
|
||||
pr_err("Failed to enable %s: %d\n", consumers[i].supply, ret);
|
||||
while (--i >= 0)
|
||||
regulator_disable(consumers[i].consumer);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -2463,8 +2558,8 @@ EXPORT_SYMBOL_GPL(regulator_bulk_enable);
|
||||
* @return 0 on success, an errno on failure
|
||||
*
|
||||
* This convenience API allows consumers to disable multiple regulator
|
||||
* clients in a single API call. If any consumers cannot be enabled
|
||||
* then any others that were disabled will be disabled again prior to
|
||||
* clients in a single API call. If any consumers cannot be disabled
|
||||
* then any others that were disabled will be enabled again prior to
|
||||
* return.
|
||||
*/
|
||||
int regulator_bulk_disable(int num_consumers,
|
||||
@@ -2473,7 +2568,7 @@ int regulator_bulk_disable(int num_consumers,
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
for (i = 0; i < num_consumers; i++) {
|
||||
for (i = num_consumers - 1; i >= 0; --i) {
|
||||
ret = regulator_disable(consumers[i].consumer);
|
||||
if (ret != 0)
|
||||
goto err;
|
||||
@@ -2483,7 +2578,7 @@ int regulator_bulk_disable(int num_consumers,
|
||||
|
||||
err:
|
||||
pr_err("Failed to disable %s: %d\n", consumers[i].supply, ret);
|
||||
for (--i; i >= 0; --i)
|
||||
for (++i; i < num_consumers; ++i)
|
||||
regulator_enable(consumers[i].consumer);
|
||||
|
||||
return ret;
|
||||
@@ -2710,11 +2805,9 @@ static int add_regulator_attributes(struct regulator_dev *rdev)
|
||||
|
||||
static void rdev_init_debugfs(struct regulator_dev *rdev)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
rdev->debugfs = debugfs_create_dir(rdev_get_name(rdev), debugfs_root);
|
||||
if (IS_ERR(rdev->debugfs) || !rdev->debugfs) {
|
||||
if (!rdev->debugfs) {
|
||||
rdev_warn(rdev, "Failed to create debugfs directory\n");
|
||||
rdev->debugfs = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2722,7 +2815,6 @@ static void rdev_init_debugfs(struct regulator_dev *rdev)
|
||||
&rdev->use_count);
|
||||
debugfs_create_u32("open_count", 0444, rdev->debugfs,
|
||||
&rdev->open_count);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2855,7 +2947,6 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
|
||||
if (init_data) {
|
||||
for (i = 0; i < init_data->num_consumer_supplies; i++) {
|
||||
ret = set_consumer_device_supply(rdev,
|
||||
init_data->consumer_supplies[i].dev,
|
||||
init_data->consumer_supplies[i].dev_name,
|
||||
init_data->consumer_supplies[i].supply);
|
||||
if (ret < 0) {
|
||||
@@ -2902,9 +2993,7 @@ void regulator_unregister(struct regulator_dev *rdev)
|
||||
return;
|
||||
|
||||
mutex_lock(®ulator_list_mutex);
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
debugfs_remove_recursive(rdev->debugfs);
|
||||
#endif
|
||||
flush_work_sync(&rdev->disable_work.work);
|
||||
WARN_ON(rdev->open_count);
|
||||
unset_regulator_supplies(rdev);
|
||||
@@ -3114,12 +3203,14 @@ static ssize_t supply_map_read_file(struct file *file, char __user *user_buf,
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct file_operations supply_map_fops = {
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
.read = supply_map_read_file,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
static int __init regulator_init(void)
|
||||
{
|
||||
@@ -3127,17 +3218,12 @@ static int __init regulator_init(void)
|
||||
|
||||
ret = class_register(®ulator_class);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
debugfs_root = debugfs_create_dir("regulator", NULL);
|
||||
if (IS_ERR(debugfs_root) || !debugfs_root) {
|
||||
if (!debugfs_root)
|
||||
pr_warn("regulator: Failed to create debugfs directory\n");
|
||||
debugfs_root = NULL;
|
||||
}
|
||||
|
||||
if (IS_ERR(debugfs_create_file("supply_map", 0444, debugfs_root,
|
||||
NULL, &supply_map_fops)))
|
||||
pr_warn("regulator: Failed to create supplies debugfs\n");
|
||||
#endif
|
||||
debugfs_create_file("supply_map", 0444, debugfs_root, NULL,
|
||||
&supply_map_fops);
|
||||
|
||||
regulator_dummy_init();
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ static int da903x_set_ldo_voltage(struct regulator_dev *rdev,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
|
||||
val = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
|
||||
*selector = val;
|
||||
val <<= info->vol_shift;
|
||||
mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
|
||||
@@ -202,7 +202,7 @@ static int da9030_set_ldo1_15_voltage(struct regulator_dev *rdev,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
|
||||
val = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
|
||||
*selector = val;
|
||||
val <<= info->vol_shift;
|
||||
mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
|
||||
@@ -233,10 +233,10 @@ static int da9030_set_ldo14_voltage(struct regulator_dev *rdev,
|
||||
|
||||
thresh = (info->max_uV + info->min_uV) / 2;
|
||||
if (min_uV < thresh) {
|
||||
val = (thresh - min_uV + info->step_uV - 1) / info->step_uV;
|
||||
val = DIV_ROUND_UP(thresh - min_uV, info->step_uV);
|
||||
val |= 0x4;
|
||||
} else {
|
||||
val = (min_uV - thresh + info->step_uV - 1) / info->step_uV;
|
||||
val = DIV_ROUND_UP(min_uV - thresh, info->step_uV);
|
||||
}
|
||||
|
||||
*selector = val;
|
||||
@@ -281,7 +281,7 @@ static int da9034_set_dvc_voltage(struct regulator_dev *rdev,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
|
||||
val = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
|
||||
*selector = val;
|
||||
val <<= info->vol_shift;
|
||||
mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
|
||||
@@ -307,7 +307,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
|
||||
val = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
|
||||
val = (val >= 20) ? val - 12 : ((val > 7) ? 8 : val);
|
||||
*selector = val;
|
||||
val <<= info->vol_shift;
|
||||
|
||||
@@ -18,74 +18,11 @@
|
||||
#include <linux/regulator/machine.h>
|
||||
#include <linux/regulator/db8500-prcmu.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
/*
|
||||
* power state reference count
|
||||
*/
|
||||
static int power_state_active_cnt; /* will initialize to zero */
|
||||
static DEFINE_SPINLOCK(power_state_active_lock);
|
||||
|
||||
static void power_state_active_enable(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&power_state_active_lock, flags);
|
||||
power_state_active_cnt++;
|
||||
spin_unlock_irqrestore(&power_state_active_lock, flags);
|
||||
}
|
||||
|
||||
static int power_state_active_disable(void)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&power_state_active_lock, flags);
|
||||
if (power_state_active_cnt <= 0) {
|
||||
pr_err("power state: unbalanced enable/disable calls\n");
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
power_state_active_cnt--;
|
||||
out:
|
||||
spin_unlock_irqrestore(&power_state_active_lock, flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Exported interface for CPUIdle only. This function is called when interrupts
|
||||
* are turned off. Hence, no locking.
|
||||
*/
|
||||
int power_state_active_is_enabled(void)
|
||||
{
|
||||
return (power_state_active_cnt > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* struct db8500_regulator_info - db8500 regulator information
|
||||
* @dev: device pointer
|
||||
* @desc: regulator description
|
||||
* @rdev: regulator device pointer
|
||||
* @is_enabled: status of the regulator
|
||||
* @epod_id: id for EPOD (power domain)
|
||||
* @is_ramret: RAM retention switch for EPOD (power domain)
|
||||
* @operating_point: operating point (only for vape, to be removed)
|
||||
*
|
||||
*/
|
||||
struct db8500_regulator_info {
|
||||
struct device *dev;
|
||||
struct regulator_desc desc;
|
||||
struct regulator_dev *rdev;
|
||||
bool is_enabled;
|
||||
u16 epod_id;
|
||||
bool is_ramret;
|
||||
bool exclude_from_power_state;
|
||||
unsigned int operating_point;
|
||||
};
|
||||
#include "dbx500-prcmu.h"
|
||||
|
||||
static int db8500_regulator_enable(struct regulator_dev *rdev)
|
||||
{
|
||||
struct db8500_regulator_info *info = rdev_get_drvdata(rdev);
|
||||
struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
|
||||
|
||||
if (info == NULL)
|
||||
return -EINVAL;
|
||||
@@ -93,16 +30,18 @@ static int db8500_regulator_enable(struct regulator_dev *rdev)
|
||||
dev_vdbg(rdev_get_dev(rdev), "regulator-%s-enable\n",
|
||||
info->desc.name);
|
||||
|
||||
info->is_enabled = true;
|
||||
if (!info->exclude_from_power_state)
|
||||
power_state_active_enable();
|
||||
if (!info->is_enabled) {
|
||||
info->is_enabled = true;
|
||||
if (!info->exclude_from_power_state)
|
||||
power_state_active_enable();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int db8500_regulator_disable(struct regulator_dev *rdev)
|
||||
{
|
||||
struct db8500_regulator_info *info = rdev_get_drvdata(rdev);
|
||||
struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
|
||||
int ret = 0;
|
||||
|
||||
if (info == NULL)
|
||||
@@ -111,16 +50,18 @@ static int db8500_regulator_disable(struct regulator_dev *rdev)
|
||||
dev_vdbg(rdev_get_dev(rdev), "regulator-%s-disable\n",
|
||||
info->desc.name);
|
||||
|
||||
info->is_enabled = false;
|
||||
if (!info->exclude_from_power_state)
|
||||
ret = power_state_active_disable();
|
||||
if (info->is_enabled) {
|
||||
info->is_enabled = false;
|
||||
if (!info->exclude_from_power_state)
|
||||
ret = power_state_active_disable();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int db8500_regulator_is_enabled(struct regulator_dev *rdev)
|
||||
{
|
||||
struct db8500_regulator_info *info = rdev_get_drvdata(rdev);
|
||||
struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
|
||||
|
||||
if (info == NULL)
|
||||
return -EINVAL;
|
||||
@@ -197,7 +138,7 @@ static int disable_epod(u16 epod_id, bool ramret)
|
||||
*/
|
||||
static int db8500_regulator_switch_enable(struct regulator_dev *rdev)
|
||||
{
|
||||
struct db8500_regulator_info *info = rdev_get_drvdata(rdev);
|
||||
struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
|
||||
int ret;
|
||||
|
||||
if (info == NULL)
|
||||
@@ -221,7 +162,7 @@ out:
|
||||
|
||||
static int db8500_regulator_switch_disable(struct regulator_dev *rdev)
|
||||
{
|
||||
struct db8500_regulator_info *info = rdev_get_drvdata(rdev);
|
||||
struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
|
||||
int ret;
|
||||
|
||||
if (info == NULL)
|
||||
@@ -245,7 +186,7 @@ out:
|
||||
|
||||
static int db8500_regulator_switch_is_enabled(struct regulator_dev *rdev)
|
||||
{
|
||||
struct db8500_regulator_info *info = rdev_get_drvdata(rdev);
|
||||
struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
|
||||
|
||||
if (info == NULL)
|
||||
return -EINVAL;
|
||||
@@ -266,8 +207,8 @@ static struct regulator_ops db8500_regulator_switch_ops = {
|
||||
/*
|
||||
* Regulator information
|
||||
*/
|
||||
static struct db8500_regulator_info
|
||||
db8500_regulator_info[DB8500_NUM_REGULATORS] = {
|
||||
static struct dbx500_regulator_info
|
||||
dbx500_regulator_info[DB8500_NUM_REGULATORS] = {
|
||||
[DB8500_REGULATOR_VAPE] = {
|
||||
.desc = {
|
||||
.name = "db8500-vape",
|
||||
@@ -476,12 +417,12 @@ static int __devinit db8500_regulator_probe(struct platform_device *pdev)
|
||||
int i, err;
|
||||
|
||||
/* register all regulators */
|
||||
for (i = 0; i < ARRAY_SIZE(db8500_regulator_info); i++) {
|
||||
struct db8500_regulator_info *info;
|
||||
for (i = 0; i < ARRAY_SIZE(dbx500_regulator_info); i++) {
|
||||
struct dbx500_regulator_info *info;
|
||||
struct regulator_init_data *init_data = &db8500_init_data[i];
|
||||
|
||||
/* assign per-regulator data */
|
||||
info = &db8500_regulator_info[i];
|
||||
info = &dbx500_regulator_info[i];
|
||||
info->dev = &pdev->dev;
|
||||
|
||||
/* register with the regulator framework */
|
||||
@@ -494,7 +435,7 @@ static int __devinit db8500_regulator_probe(struct platform_device *pdev)
|
||||
|
||||
/* if failing, unregister all earlier regulators */
|
||||
while (--i >= 0) {
|
||||
info = &db8500_regulator_info[i];
|
||||
info = &dbx500_regulator_info[i];
|
||||
regulator_unregister(info->rdev);
|
||||
}
|
||||
return err;
|
||||
@@ -503,17 +444,22 @@ static int __devinit db8500_regulator_probe(struct platform_device *pdev)
|
||||
dev_dbg(rdev_get_dev(info->rdev),
|
||||
"regulator-%s-probed\n", info->desc.name);
|
||||
}
|
||||
err = ux500_regulator_debug_init(pdev,
|
||||
dbx500_regulator_info,
|
||||
ARRAY_SIZE(dbx500_regulator_info));
|
||||
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
static int __exit db8500_regulator_remove(struct platform_device *pdev)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(db8500_regulator_info); i++) {
|
||||
struct db8500_regulator_info *info;
|
||||
info = &db8500_regulator_info[i];
|
||||
ux500_regulator_debug_exit();
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(dbx500_regulator_info); i++) {
|
||||
struct dbx500_regulator_info *info;
|
||||
info = &dbx500_regulator_info[i];
|
||||
|
||||
dev_vdbg(rdev_get_dev(info->rdev),
|
||||
"regulator-%s-remove\n", info->desc.name);
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
/*
|
||||
* Copyright (C) ST-Ericsson SA 2010
|
||||
*
|
||||
* License Terms: GNU General Public License v2
|
||||
* Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson
|
||||
* Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
|
||||
*
|
||||
* UX500 common part of Power domain regulators
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/regulator/driver.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "dbx500-prcmu.h"
|
||||
|
||||
/*
|
||||
* power state reference count
|
||||
*/
|
||||
static int power_state_active_cnt; /* will initialize to zero */
|
||||
static DEFINE_SPINLOCK(power_state_active_lock);
|
||||
|
||||
int power_state_active_get(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
int cnt;
|
||||
|
||||
spin_lock_irqsave(&power_state_active_lock, flags);
|
||||
cnt = power_state_active_cnt;
|
||||
spin_unlock_irqrestore(&power_state_active_lock, flags);
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
void power_state_active_enable(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&power_state_active_lock, flags);
|
||||
power_state_active_cnt++;
|
||||
spin_unlock_irqrestore(&power_state_active_lock, flags);
|
||||
}
|
||||
|
||||
int power_state_active_disable(void)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&power_state_active_lock, flags);
|
||||
if (power_state_active_cnt <= 0) {
|
||||
pr_err("power state: unbalanced enable/disable calls\n");
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
power_state_active_cnt--;
|
||||
out:
|
||||
spin_unlock_irqrestore(&power_state_active_lock, flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_REGULATOR_DEBUG
|
||||
|
||||
static struct ux500_regulator_debug {
|
||||
struct dentry *dir;
|
||||
struct dentry *status_file;
|
||||
struct dentry *power_state_cnt_file;
|
||||
struct dbx500_regulator_info *regulator_array;
|
||||
int num_regulators;
|
||||
u8 *state_before_suspend;
|
||||
u8 *state_after_suspend;
|
||||
} rdebug;
|
||||
|
||||
void ux500_regulator_suspend_debug(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < rdebug.num_regulators; i++)
|
||||
rdebug.state_before_suspend[i] =
|
||||
rdebug.regulator_array[i].is_enabled;
|
||||
}
|
||||
|
||||
void ux500_regulator_resume_debug(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < rdebug.num_regulators; i++)
|
||||
rdebug.state_after_suspend[i] =
|
||||
rdebug.regulator_array[i].is_enabled;
|
||||
}
|
||||
|
||||
static int ux500_regulator_power_state_cnt_print(struct seq_file *s, void *p)
|
||||
{
|
||||
struct device *dev = s->private;
|
||||
int err;
|
||||
|
||||
/* print power state count */
|
||||
err = seq_printf(s, "ux500-regulator power state count: %i\n",
|
||||
power_state_active_get());
|
||||
if (err < 0)
|
||||
dev_err(dev, "seq_printf overflow\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ux500_regulator_power_state_cnt_open(struct inode *inode,
|
||||
struct file *file)
|
||||
{
|
||||
return single_open(file, ux500_regulator_power_state_cnt_print,
|
||||
inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations ux500_regulator_power_state_cnt_fops = {
|
||||
.open = ux500_regulator_power_state_cnt_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int ux500_regulator_status_print(struct seq_file *s, void *p)
|
||||
{
|
||||
struct device *dev = s->private;
|
||||
int err;
|
||||
int i;
|
||||
|
||||
/* print dump header */
|
||||
err = seq_printf(s, "ux500-regulator status:\n");
|
||||
if (err < 0)
|
||||
dev_err(dev, "seq_printf overflow\n");
|
||||
|
||||
err = seq_printf(s, "%31s : %8s : %8s\n", "current",
|
||||
"before", "after");
|
||||
if (err < 0)
|
||||
dev_err(dev, "seq_printf overflow\n");
|
||||
|
||||
for (i = 0; i < rdebug.num_regulators; i++) {
|
||||
struct dbx500_regulator_info *info;
|
||||
/* Access per-regulator data */
|
||||
info = &rdebug.regulator_array[i];
|
||||
|
||||
/* print status */
|
||||
err = seq_printf(s, "%20s : %8s : %8s : %8s\n", info->desc.name,
|
||||
info->is_enabled ? "enabled" : "disabled",
|
||||
rdebug.state_before_suspend[i] ? "enabled" : "disabled",
|
||||
rdebug.state_after_suspend[i] ? "enabled" : "disabled");
|
||||
if (err < 0)
|
||||
dev_err(dev, "seq_printf overflow\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ux500_regulator_status_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ux500_regulator_status_print,
|
||||
inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations ux500_regulator_status_fops = {
|
||||
.open = ux500_regulator_status_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
int __attribute__((weak)) dbx500_regulator_testcase(
|
||||
struct dbx500_regulator_info *regulator_info,
|
||||
int num_regulators)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __devinit
|
||||
ux500_regulator_debug_init(struct platform_device *pdev,
|
||||
struct dbx500_regulator_info *regulator_info,
|
||||
int num_regulators)
|
||||
{
|
||||
/* create directory */
|
||||
rdebug.dir = debugfs_create_dir("ux500-regulator", NULL);
|
||||
if (!rdebug.dir)
|
||||
goto exit_no_debugfs;
|
||||
|
||||
/* create "status" file */
|
||||
rdebug.status_file = debugfs_create_file("status",
|
||||
S_IRUGO, rdebug.dir, &pdev->dev,
|
||||
&ux500_regulator_status_fops);
|
||||
if (!rdebug.status_file)
|
||||
goto exit_destroy_dir;
|
||||
|
||||
/* create "power-state-count" file */
|
||||
rdebug.power_state_cnt_file = debugfs_create_file("power-state-count",
|
||||
S_IRUGO, rdebug.dir, &pdev->dev,
|
||||
&ux500_regulator_power_state_cnt_fops);
|
||||
if (!rdebug.power_state_cnt_file)
|
||||
goto exit_destroy_status;
|
||||
|
||||
rdebug.regulator_array = regulator_info;
|
||||
rdebug.num_regulators = num_regulators;
|
||||
|
||||
rdebug.state_before_suspend = kzalloc(num_regulators, GFP_KERNEL);
|
||||
if (!rdebug.state_before_suspend) {
|
||||
dev_err(&pdev->dev,
|
||||
"could not allocate memory for saving state\n");
|
||||
goto exit_destroy_power_state;
|
||||
}
|
||||
|
||||
rdebug.state_after_suspend = kzalloc(num_regulators, GFP_KERNEL);
|
||||
if (!rdebug.state_after_suspend) {
|
||||
dev_err(&pdev->dev,
|
||||
"could not allocate memory for saving state\n");
|
||||
goto exit_free;
|
||||
}
|
||||
|
||||
dbx500_regulator_testcase(regulator_info, num_regulators);
|
||||
return 0;
|
||||
|
||||
exit_free:
|
||||
kfree(rdebug.state_before_suspend);
|
||||
exit_destroy_power_state:
|
||||
debugfs_remove(rdebug.power_state_cnt_file);
|
||||
exit_destroy_status:
|
||||
debugfs_remove(rdebug.status_file);
|
||||
exit_destroy_dir:
|
||||
debugfs_remove(rdebug.dir);
|
||||
exit_no_debugfs:
|
||||
dev_err(&pdev->dev, "failed to create debugfs entries.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
int __devexit ux500_regulator_debug_exit(void)
|
||||
{
|
||||
debugfs_remove_recursive(rdebug.dir);
|
||||
kfree(rdebug.state_after_suspend);
|
||||
kfree(rdebug.state_before_suspend);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) ST-Ericsson SA 2010
|
||||
*
|
||||
* Author: Bengt Jonsson <bengt.jonsson@stericsson.com> for ST-Ericsson,
|
||||
* Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson
|
||||
*
|
||||
* License Terms: GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DBX500_REGULATOR_H
|
||||
#define DBX500_REGULATOR_H
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
/**
|
||||
* struct dbx500_regulator_info - dbx500 regulator information
|
||||
* @dev: device pointer
|
||||
* @desc: regulator description
|
||||
* @rdev: regulator device pointer
|
||||
* @is_enabled: status of the regulator
|
||||
* @epod_id: id for EPOD (power domain)
|
||||
* @is_ramret: RAM retention switch for EPOD (power domain)
|
||||
* @operating_point: operating point (only for vape, to be removed)
|
||||
*
|
||||
*/
|
||||
struct dbx500_regulator_info {
|
||||
struct device *dev;
|
||||
struct regulator_desc desc;
|
||||
struct regulator_dev *rdev;
|
||||
bool is_enabled;
|
||||
u16 epod_id;
|
||||
bool is_ramret;
|
||||
bool exclude_from_power_state;
|
||||
unsigned int operating_point;
|
||||
};
|
||||
|
||||
void power_state_active_enable(void);
|
||||
int power_state_active_disable(void);
|
||||
|
||||
|
||||
#ifdef CONFIG_REGULATOR_DEBUG
|
||||
int ux500_regulator_debug_init(struct platform_device *pdev,
|
||||
struct dbx500_regulator_info *regulator_info,
|
||||
int num_regulators);
|
||||
|
||||
int ux500_regulator_debug_exit(void);
|
||||
#else
|
||||
|
||||
static inline int ux500_regulator_debug_init(struct platform_device *pdev,
|
||||
struct dbx500_regulator_info *regulator_info,
|
||||
int num_regulators)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ux500_regulator_debug_exit(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,53 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regulator/machine.h>
|
||||
#include <linux/regulator/fixed.h>
|
||||
|
||||
struct fixed_regulator_data {
|
||||
struct fixed_voltage_config cfg;
|
||||
struct regulator_init_data init_data;
|
||||
struct platform_device pdev;
|
||||
};
|
||||
|
||||
static void regulator_fixed_release(struct device *dev)
|
||||
{
|
||||
struct fixed_regulator_data *data = container_of(dev,
|
||||
struct fixed_regulator_data, pdev.dev);
|
||||
kfree(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* regulator_register_fixed - register a no-op fixed regulator
|
||||
* @name: supply name
|
||||
* @id: platform device id
|
||||
* @supplies: consumers for this regulator
|
||||
* @num_supplies: number of consumers
|
||||
*/
|
||||
struct platform_device *regulator_register_fixed(int id,
|
||||
struct regulator_consumer_supply *supplies, int num_supplies)
|
||||
{
|
||||
struct fixed_regulator_data *data;
|
||||
|
||||
data = kzalloc(sizeof(*data), GFP_KERNEL);
|
||||
if (!data)
|
||||
return NULL;
|
||||
|
||||
data->cfg.supply_name = "dummy";
|
||||
data->cfg.microvolts = 0;
|
||||
data->cfg.gpio = -EINVAL;
|
||||
data->cfg.enabled_at_boot = 1;
|
||||
data->cfg.init_data = &data->init_data;
|
||||
|
||||
data->init_data.constraints.always_on = 1;
|
||||
data->init_data.consumer_supplies = supplies;
|
||||
data->init_data.num_consumer_supplies = num_supplies;
|
||||
|
||||
data->pdev.name = "reg-fixed-voltage";
|
||||
data->pdev.id = id;
|
||||
data->pdev.dev.platform_data = &data->cfg;
|
||||
data->pdev.dev.release = regulator_fixed_release;
|
||||
|
||||
platform_device_register(&data->pdev);
|
||||
|
||||
return &data->pdev;
|
||||
}
|
||||
@@ -192,7 +192,9 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
|
||||
drvdata->desc.type = REGULATOR_VOLTAGE;
|
||||
drvdata->desc.owner = THIS_MODULE;
|
||||
drvdata->desc.ops = &fixed_voltage_ops;
|
||||
drvdata->desc.n_voltages = 1;
|
||||
|
||||
if (config->microvolts)
|
||||
drvdata->desc.n_voltages = 1;
|
||||
|
||||
drvdata->microvolts = config->microvolts;
|
||||
drvdata->gpio = config->gpio;
|
||||
|
||||
@@ -63,23 +63,15 @@ static int isl6271a_set_voltage(struct regulator_dev *dev,
|
||||
unsigned *selector)
|
||||
{
|
||||
struct isl_pmic *pmic = rdev_get_drvdata(dev);
|
||||
int vsel, err, data;
|
||||
int err, data;
|
||||
|
||||
if (minuV < ISL6271A_VOLTAGE_MIN || minuV > ISL6271A_VOLTAGE_MAX)
|
||||
return -EINVAL;
|
||||
if (maxuV < ISL6271A_VOLTAGE_MIN || maxuV > ISL6271A_VOLTAGE_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
/* Align to 50000 mV */
|
||||
vsel = minuV - (minuV % ISL6271A_VOLTAGE_STEP);
|
||||
|
||||
/* If the result fell out of [minuV,maxuV] range, put it back */
|
||||
if (vsel < minuV)
|
||||
vsel += ISL6271A_VOLTAGE_STEP;
|
||||
|
||||
/* Convert the microvolts to data for the chip */
|
||||
data = (vsel - ISL6271A_VOLTAGE_MIN) / ISL6271A_VOLTAGE_STEP;
|
||||
|
||||
data = DIV_ROUND_UP(minuV - ISL6271A_VOLTAGE_MIN,
|
||||
ISL6271A_VOLTAGE_STEP);
|
||||
*selector = data;
|
||||
|
||||
mutex_lock(&pmic->mtx);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user