Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
4fd1f509
Commit
4fd1f509
authored
Oct 21, 2018
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'regulator-4.20' into regulator-next
parents
35a7f35a
d8b2a8e9
Changes
55
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
55 changed files
with
3108 additions
and
1112 deletions
+3108
-1112
Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt
Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt
+9
-8
Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
.../devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
+23
-0
Documentation/devicetree/bindings/regulator/rohm,bd71837-regulator.txt
.../devicetree/bindings/regulator/rohm,bd71837-regulator.txt
+9
-3
Documentation/devicetree/bindings/regulator/st,stpmic1-regulator.txt
...on/devicetree/bindings/regulator/st,stpmic1-regulator.txt
+68
-0
arch/arm/mach-imx/mach-mx21ads.c
arch/arm/mach-imx/mach-mx21ads.c
+11
-1
arch/arm/mach-imx/mach-mx27ads.c
arch/arm/mach-imx/mach-mx27ads.c
+11
-1
arch/arm/mach-mmp/brownstone.c
arch/arm/mach-mmp/brownstone.c
+11
-1
arch/arm/mach-omap1/board-ams-delta.c
arch/arm/mach-omap1/board-ams-delta.c
+10
-2
arch/arm/mach-omap2/pdata-quirks.c
arch/arm/mach-omap2/pdata-quirks.c
+15
-1
arch/arm/mach-pxa/em-x270.c
arch/arm/mach-pxa/em-x270.c
+0
-1
arch/arm/mach-pxa/ezx.c
arch/arm/mach-pxa/ezx.c
+22
-11
arch/arm/mach-pxa/magician.c
arch/arm/mach-pxa/magician.c
+1
-1
arch/arm/mach-pxa/raumfeld.c
arch/arm/mach-pxa/raumfeld.c
+10
-2
arch/arm/mach-pxa/zeus.c
arch/arm/mach-pxa/zeus.c
+21
-2
arch/arm/mach-s3c64xx/mach-crag6410.c
arch/arm/mach-s3c64xx/mach-crag6410.c
+0
-1
arch/arm/mach-s3c64xx/mach-smdk6410.c
arch/arm/mach-s3c64xx/mach-smdk6410.c
+0
-1
arch/arm/mach-sa1100/assabet.c
arch/arm/mach-sa1100/assabet.c
+14
-7
arch/arm/mach-sa1100/generic.c
arch/arm/mach-sa1100/generic.c
+3
-2
arch/arm/mach-sa1100/generic.h
arch/arm/mach-sa1100/generic.h
+2
-1
arch/arm/mach-sa1100/shannon.c
arch/arm/mach-sa1100/shannon.c
+2
-2
arch/sh/boards/mach-ecovec24/setup.c
arch/sh/boards/mach-ecovec24/setup.c
+25
-2
arch/x86/platform/intel-mid/device_libs/platform_bcm43xx.c
arch/x86/platform/intel-mid/device_libs/platform_bcm43xx.c
+14
-3
drivers/gpio/gpiolib.c
drivers/gpio/gpiolib.c
+17
-2
drivers/mfd/rohm-bd718x7.c
drivers/mfd/rohm-bd718x7.c
+75
-87
drivers/regulator/Kconfig
drivers/regulator/Kconfig
+20
-1
drivers/regulator/Makefile
drivers/regulator/Makefile
+3
-1
drivers/regulator/arizona-ldo1.c
drivers/regulator/arizona-ldo1.c
+1
-1
drivers/regulator/axp20x-regulator.c
drivers/regulator/axp20x-regulator.c
+2
-1
drivers/regulator/bd71837-regulator.c
drivers/regulator/bd71837-regulator.c
+0
-645
drivers/regulator/bd718x7-regulator.c
drivers/regulator/bd718x7-regulator.c
+1119
-0
drivers/regulator/core.c
drivers/regulator/core.c
+65
-59
drivers/regulator/da9052-regulator.c
drivers/regulator/da9052-regulator.c
+1
-1
drivers/regulator/da9055-regulator.c
drivers/regulator/da9055-regulator.c
+1
-1
drivers/regulator/da9211-regulator.c
drivers/regulator/da9211-regulator.c
+5
-5
drivers/regulator/fixed-helper.c
drivers/regulator/fixed-helper.c
+0
-1
drivers/regulator/fixed.c
drivers/regulator/fixed.c
+37
-20
drivers/regulator/helpers.c
drivers/regulator/helpers.c
+238
-5
drivers/regulator/isl9305.c
drivers/regulator/isl9305.c
+4
-0
drivers/regulator/lm363x-regulator.c
drivers/regulator/lm363x-regulator.c
+4
-2
drivers/regulator/lochnagar-regulator.c
drivers/regulator/lochnagar-regulator.c
+254
-0
drivers/regulator/lp8788-ldo.c
drivers/regulator/lp8788-ldo.c
+4
-3
drivers/regulator/max8952.c
drivers/regulator/max8952.c
+1
-0
drivers/regulator/max8973-regulator.c
drivers/regulator/max8973-regulator.c
+1
-0
drivers/regulator/max8997-regulator.c
drivers/regulator/max8997-regulator.c
+2
-2
drivers/regulator/mc13xxx-regulator-core.c
drivers/regulator/mc13xxx-regulator-core.c
+1
-1
drivers/regulator/of_regulator.c
drivers/regulator/of_regulator.c
+22
-22
drivers/regulator/qcom-rpmh-regulator.c
drivers/regulator/qcom-rpmh-regulator.c
+10
-7
drivers/regulator/qcom_smd-regulator.c
drivers/regulator/qcom_smd-regulator.c
+77
-0
drivers/regulator/s5m8767.c
drivers/regulator/s5m8767.c
+13
-12
drivers/regulator/stpmic1_regulator.c
drivers/regulator/stpmic1_regulator.c
+674
-0
drivers/regulator/tps65090-regulator.c
drivers/regulator/tps65090-regulator.c
+1
-0
include/linux/gpio/consumer.h
include/linux/gpio/consumer.h
+1
-0
include/linux/mfd/rohm-bd718x7.h
include/linux/mfd/rohm-bd718x7.h
+155
-176
include/linux/regulator/driver.h
include/linux/regulator/driver.h
+19
-1
include/linux/regulator/fixed.h
include/linux/regulator/fixed.h
+0
-3
No files found.
Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt
View file @
4fd1f509
* ROHM BD71837 Power Management Integrated Circuit bindings
* ROHM BD71837
and BD71847
Power Management Integrated Circuit bindings
BD71837MWV
is a programmable Power Management IC for powering single-core,
dual-core, and quad-core SoCs such as NXP-i.MX 8M. It is optimized for
low BOM cost and compact solution footprint. It integrates 8 Buck
egulators and 7 LDOs to provide all the power rails required by the SoC and
the commonly used peripheral
s.
BD71837MWV
and BD71847MWV are programmable Power Management ICs for powering
single-core, dual-core, and quad-core SoCs such as NXP-i.MX 8M. They are
optimized for low BOM cost and compact solution footprint. BD71837MWV
integrates 8 Buck regulators and 7 LDOs. BD71847MWV contains 6 Buck regulators
and 6 LDO
s.
Datasheet for
PMIC
is available at:
Datasheet for
BD71837
is available at:
https://www.rohm.com/datasheet/BD71837MWV/bd71837mwv-e
Required properties:
- compatible : Should be "rohm,bd71837".
- compatible : Should be "rohm,bd71837" for bd71837
"rohm,bd71847" for bd71847.
- reg : I2C slave address.
- interrupt-parent : Phandle to the parent interrupt controller.
- interrupts : The interrupt line the device is connected to.
...
...
Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
View file @
4fd1f509
...
...
@@ -26,6 +26,7 @@ Regulator nodes are identified by their compatible:
"qcom,rpm-pm8998-regulators"
"qcom,rpm-pma8084-regulators"
"qcom,rpm-pmi8998-regulators"
"qcom,rpm-pms405-regulators"
- vdd_s1-supply:
- vdd_s2-supply:
...
...
@@ -188,6 +189,24 @@ Regulator nodes are identified by their compatible:
Definition: reference to regulator supplying the input pin, as
described in the data sheet
- vdd_s1-supply:
- vdd_s2-supply:
- vdd_s3-supply:
- vdd_s4-supply:
- vdd_s5-supply:
- vdd_l1_l2-supply:
- vdd_l3_l8-supply:
- vdd_l4-supply:
- vdd_l5_l6-supply:
- vdd_l7-supply:
- vdd_l3_l8-supply:
- vdd_l9-supply:
- vdd_l10_l11_l12_l13-supply:
Usage: optional (pms405 only)
Value type: <phandle>
Definition: reference to regulator supplying the input pin, as
described in the data sheet
The regulator node houses sub-nodes for each regulator within the device. Each
sub-node is identified using the node's name, with valid values listed for each
of the pmics below.
...
...
@@ -222,6 +241,10 @@ pma8084:
pmi8998:
bob
pms405:
s1, s2, s3, s4, s5, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12,
l13
The content of each sub-node is defined by the standard binding for regulators -
see regulator.txt.
...
...
Documentation/devicetree/bindings/regulator/rohm,bd71837-regulator.txt
View file @
4fd1f509
ROHM BD71837
Power Management Integrated Circuit (PMIC)
regulator bindings
ROHM BD71837
and BD71847 Power Management Integrated Circuit
regulator bindings
Required properties:
- regulator-name: should be "buck1", ..., "buck8" and "ldo1", ..., "ldo7"
- regulator-name: should be "buck1", ..., "buck8" and "ldo1", ..., "ldo7" for
BD71837. For BD71847 names should be "buck1", ..., "buck6"
and "ldo1", ..., "ldo6"
List of regulators provided by this controller. BD71837 regulators node
should be sub node of the BD71837 MFD node. See BD71837 MFD bindings at
...
...
@@ -16,10 +18,14 @@ disabled by driver at startup. LDO5 and LDO6 are supplied by those and
if they are disabled at startup the voltage monitoring for LDO5/LDO6 will
cause PMIC to reset.
The valid names for regulator nodes are:
The valid names for
BD71837
regulator nodes are:
BUCK1, BUCK2, BUCK3, BUCK4, BUCK5, BUCK6, BUCK7, BUCK8
LDO1, LDO2, LDO3, LDO4, LDO5, LDO6, LDO7
The valid names for BD71847 regulator nodes are:
BUCK1, BUCK2, BUCK3, BUCK4, BUCK5, BUCK6
LDO1, LDO2, LDO3, LDO4, LDO5, LDO6
Optional properties:
- Any optional property defined in bindings/regulator/regulator.txt
...
...
Documentation/devicetree/bindings/regulator/st,stpmic1-regulator.txt
0 → 100644
View file @
4fd1f509
STMicroelectronics STPMIC1 Voltage regulators
Regulator Nodes are optional depending on needs.
Available Regulators in STPMIC1 device are:
- buck1 for Buck BUCK1
- buck2 for Buck BUCK2
- buck3 for Buck BUCK3
- buck4 for Buck BUCK4
- ldo1 for LDO LDO1
- ldo2 for LDO LDO2
- ldo3 for LDO LDO3
- ldo4 for LDO LDO4
- ldo5 for LDO LDO5
- ldo6 for LDO LDO6
- vref_ddr for LDO Vref DDR
- boost for Buck BOOST
- pwr_sw1 for VBUS_OTG switch
- pwr_sw2 for SW_OUT switch
Switches are fixed voltage regulators with only enable/disable capability.
Optional properties:
- st,mask-reset: mask reset for this regulator: the regulator configuration
is maintained during pmic reset.
- regulator-pull-down: enable high pull down
if not specified light pull down is used
- regulator-over-current-protection:
if set, all regulators are switched off in case of over-current detection
on this regulator,
if not set, the driver only sends an over-current event.
- interrupt-parent: phandle to the parent interrupt controller
- interrupts: index of current limit detection interrupt
- <regulator>-supply: phandle to the parent supply/regulator node
each regulator supply can be described except vref_ddr.
Example:
regulators {
compatible = "st,stpmic1-regulators";
ldo6-supply = <&v3v3>;
vdd_core: buck1 {
regulator-name = "vdd_core";
interrupts = <IT_CURLIM_BUCK1 0>;
interrupt-parent = <&pmic>;
st,mask-reset;
regulator-pull-down;
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1200000>;
};
v3v3: buck4 {
regulator-name = "v3v3";
interrupts = <IT_CURLIM_BUCK4 0>;
interrupt-parent = <&mypmic>;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
v1v8: ldo6 {
regulator-name = "v1v8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-over-current-protection;
};
};
arch/arm/mach-imx/mach-mx21ads.c
View file @
4fd1f509
...
...
@@ -18,6 +18,7 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/physmap.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>
#include <linux/gpio.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h>
...
...
@@ -175,6 +176,7 @@ static struct resource mx21ads_mmgpio_resource =
DEFINE_RES_MEM_NAMED
(
MX21ADS_IO_REG
,
SZ_2
,
"dat"
);
static
struct
bgpio_pdata
mx21ads_mmgpio_pdata
=
{
.
label
=
"mx21ads-mmgpio"
,
.
base
=
MX21ADS_MMGPIO_BASE
,
.
ngpio
=
16
,
};
...
...
@@ -203,7 +205,6 @@ static struct regulator_init_data mx21ads_lcd_regulator_init_data = {
static
struct
fixed_voltage_config
mx21ads_lcd_regulator_pdata
=
{
.
supply_name
=
"LCD"
,
.
microvolts
=
3300000
,
.
gpio
=
MX21ADS_IO_LCDON
,
.
enable_high
=
1
,
.
init_data
=
&
mx21ads_lcd_regulator_init_data
,
};
...
...
@@ -216,6 +217,14 @@ static struct platform_device mx21ads_lcd_regulator = {
},
};
static
struct
gpiod_lookup_table
mx21ads_lcd_regulator_gpiod_table
=
{
.
dev_id
=
"reg-fixed-voltage.0"
,
/* Let's hope ID 0 is what we get */
.
table
=
{
GPIO_LOOKUP
(
"mx21ads-mmgpio"
,
9
,
NULL
,
GPIO_ACTIVE_HIGH
),
{
},
},
};
/*
* Connected is a portrait Sharp-QVGA display
* of type: LQ035Q7DB02
...
...
@@ -311,6 +320,7 @@ static void __init mx21ads_late_init(void)
{
imx21_add_mxc_mmc
(
0
,
&
mx21ads_sdhc_pdata
);
gpiod_add_lookup_table
(
&
mx21ads_lcd_regulator_gpiod_table
);
platform_add_devices
(
platform_devices
,
ARRAY_SIZE
(
platform_devices
));
mx21ads_cs8900_resources
[
1
].
start
=
...
...
arch/arm/mach-imx/mach-mx27ads.c
View file @
4fd1f509
...
...
@@ -16,6 +16,7 @@
#include <linux/gpio/driver.h>
/* Needed for gpio_to_irq() */
#include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
...
...
@@ -230,10 +231,17 @@ static struct regulator_init_data mx27ads_lcd_regulator_init_data = {
static
struct
fixed_voltage_config
mx27ads_lcd_regulator_pdata
=
{
.
supply_name
=
"LCD"
,
.
microvolts
=
3300000
,
.
gpio
=
MX27ADS_LCD_GPIO
,
.
init_data
=
&
mx27ads_lcd_regulator_init_data
,
};
static
struct
gpiod_lookup_table
mx27ads_lcd_regulator_gpiod_table
=
{
.
dev_id
=
"reg-fixed-voltage.0"
,
/* Let's hope ID 0 is what we get */
.
table
=
{
GPIO_LOOKUP
(
"LCD"
,
0
,
NULL
,
GPIO_ACTIVE_HIGH
),
{
},
},
};
static
void
__init
mx27ads_regulator_init
(
void
)
{
struct
gpio_chip
*
vchip
;
...
...
@@ -247,6 +255,8 @@ static void __init mx27ads_regulator_init(void)
vchip
->
set
=
vgpio_set
;
gpiochip_add_data
(
vchip
,
NULL
);
gpiod_add_lookup_table
(
&
mx27ads_lcd_regulator_gpiod_table
);
platform_device_register_data
(
NULL
,
"reg-fixed-voltage"
,
PLATFORM_DEVID_AUTO
,
&
mx27ads_lcd_regulator_pdata
,
...
...
arch/arm/mach-mmp/brownstone.c
View file @
4fd1f509
...
...
@@ -15,6 +15,7 @@
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/gpio-pxa.h>
#include <linux/gpio/machine.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/max8649.h>
#include <linux/regulator/fixed.h>
...
...
@@ -148,7 +149,6 @@ static struct regulator_init_data brownstone_v_5vp_data = {
static
struct
fixed_voltage_config
brownstone_v_5vp
=
{
.
supply_name
=
"v_5vp"
,
.
microvolts
=
5000000
,
.
gpio
=
GPIO_5V_ENABLE
,
.
enable_high
=
1
,
.
enabled_at_boot
=
1
,
.
init_data
=
&
brownstone_v_5vp_data
,
...
...
@@ -162,6 +162,15 @@ static struct platform_device brownstone_v_5vp_device = {
},
};
static
struct
gpiod_lookup_table
brownstone_v_5vp_gpiod_table
=
{
.
dev_id
=
"reg-fixed-voltage.1"
,
/* .id set to 1 above */
.
table
=
{
GPIO_LOOKUP
(
"gpio-pxa"
,
GPIO_5V_ENABLE
,
NULL
,
GPIO_ACTIVE_HIGH
),
{
},
},
};
static
struct
max8925_platform_data
brownstone_max8925_info
=
{
.
irq_base
=
MMP_NR_IRQS
,
};
...
...
@@ -217,6 +226,7 @@ static void __init brownstone_init(void)
mmp2_add_isram
(
&
mmp2_isram_platdata
);
/* enable 5v regulator */
gpiod_add_lookup_table
(
&
brownstone_v_5vp_gpiod_table
);
platform_device_register
(
&
brownstone_v_5vp_device
);
}
...
...
arch/arm/mach-omap1/board-ams-delta.c
View file @
4fd1f509
...
...
@@ -300,7 +300,6 @@ static struct regulator_init_data modem_nreset_data = {
static
struct
fixed_voltage_config
modem_nreset_config
=
{
.
supply_name
=
"modem_nreset"
,
.
microvolts
=
3300000
,
.
gpio
=
AMS_DELTA_GPIO_PIN_MODEM_NRESET
,
.
startup_delay
=
25000
,
.
enable_high
=
1
,
.
enabled_at_boot
=
1
,
...
...
@@ -315,6 +314,15 @@ static struct platform_device modem_nreset_device = {
},
};
static
struct
gpiod_lookup_table
ams_delta_nreset_gpiod_table
=
{
.
dev_id
=
"reg-fixed-voltage"
,
.
table
=
{
GPIO_LOOKUP
(
LATCH2_LABEL
,
LATCH2_PIN_MODEM_NRESET
,
NULL
,
GPIO_ACTIVE_HIGH
),
{
},
},
};
struct
modem_private_data
{
struct
regulator
*
regulator
;
};
...
...
@@ -568,7 +576,6 @@ static struct regulator_init_data keybrd_pwr_initdata = {
static
struct
fixed_voltage_config
keybrd_pwr_config
=
{
.
supply_name
=
"keybrd_pwr"
,
.
microvolts
=
5000000
,
.
gpio
=
AMS_DELTA_GPIO_PIN_KEYBRD_PWR
,
.
enable_high
=
1
,
.
init_data
=
&
keybrd_pwr_initdata
,
};
...
...
@@ -602,6 +609,7 @@ static struct platform_device *ams_delta_devices[] __initdata = {
};
static
struct
gpiod_lookup_table
*
ams_delta_gpio_tables
[]
__initdata
=
{
&
ams_delta_nreset_gpiod_table
,
&
ams_delta_audio_gpio_table
,
&
keybrd_pwr_gpio_table
,
&
ams_delta_lcd_gpio_table
,
...
...
arch/arm/mach-omap2/pdata-quirks.c
View file @
4fd1f509
...
...
@@ -10,6 +10,7 @@
#include <linux/clk.h>
#include <linux/davinci_emac.h>
#include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/of_platform.h>
...
...
@@ -328,7 +329,6 @@ static struct regulator_init_data pandora_vmmc3 = {
static
struct
fixed_voltage_config
pandora_vwlan
=
{
.
supply_name
=
"vwlan"
,
.
microvolts
=
1800000
,
/* 1.8V */
.
gpio
=
PANDORA_WIFI_NRESET_GPIO
,
.
startup_delay
=
50000
,
/* 50ms */
.
enable_high
=
1
,
.
init_data
=
&
pandora_vmmc3
,
...
...
@@ -342,6 +342,19 @@ static struct platform_device pandora_vwlan_device = {
},
};
static
struct
gpiod_lookup_table
pandora_vwlan_gpiod_table
=
{
.
dev_id
=
"reg-fixed-voltage.1"
,
.
table
=
{
/*
* As this is a low GPIO number it should be at the first
* GPIO bank.
*/
GPIO_LOOKUP
(
"gpio-0-31"
,
PANDORA_WIFI_NRESET_GPIO
,
NULL
,
GPIO_ACTIVE_HIGH
),
{
},
},
};
static
void
pandora_wl1251_init_card
(
struct
mmc_card
*
card
)
{
/*
...
...
@@ -403,6 +416,7 @@ static void __init pandora_wl1251_init(void)
static
void
__init
omap3_pandora_legacy_init
(
void
)
{
platform_device_register
(
&
pandora_backlight
);
gpiod_add_lookup_table
(
&
pandora_vwlan_gpiod_table
);
platform_device_register
(
&
pandora_vwlan_device
);
omap_hsmmc_init
(
pandora_mmc3
);
omap_hsmmc_late_init
(
pandora_mmc3
);
...
...
arch/arm/mach-pxa/em-x270.c
View file @
4fd1f509
...
...
@@ -986,7 +986,6 @@ static struct fixed_voltage_config camera_dummy_config = {
.
supply_name
=
"camera_vdd"
,
.
input_supply
=
"vcc cam"
,
.
microvolts
=
2800000
,
.
gpio
=
-
1
,
.
enable_high
=
0
,
.
init_data
=
&
camera_dummy_initdata
,
};
...
...
arch/arm/mach-pxa/ezx.c
View file @
4fd1f509
...
...
@@ -21,6 +21,7 @@
#include <linux/regulator/fixed.h>
#include <linux/input.h>
#include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/gpio_keys.h>
#include <linux/leds-lp3944.h>
#include <linux/platform_data/i2c-pxa.h>
...
...
@@ -698,31 +699,39 @@ static struct pxa27x_keypad_platform_data e2_keypad_platform_data = {
#if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_A910)
/* camera */
static
struct
regulator_consumer_supply
camera_
dummy
_supplies
[]
=
{
static
struct
regulator_consumer_supply
camera_
regulator
_supplies
[]
=
{
REGULATOR_SUPPLY
(
"vdd"
,
"0-005d"
),
};
static
struct
regulator_init_data
camera_
dummy
_initdata
=
{
.
consumer_supplies
=
camera_
dummy
_supplies
,
.
num_consumer_supplies
=
ARRAY_SIZE
(
camera_
dummy
_supplies
),
static
struct
regulator_init_data
camera_
regulator
_initdata
=
{
.
consumer_supplies
=
camera_
regulator
_supplies
,
.
num_consumer_supplies
=
ARRAY_SIZE
(
camera_
regulator
_supplies
),
.
constraints
=
{
.
valid_ops_mask
=
REGULATOR_CHANGE_STATUS
,
},
};
static
struct
fixed_voltage_config
camera_
dummy
_config
=
{
static
struct
fixed_voltage_config
camera_
regulator
_config
=
{
.
supply_name
=
"camera_vdd"
,
.
microvolts
=
2800000
,
.
gpio
=
GPIO50_nCAM_EN
,
.
enable_high
=
0
,
.
init_data
=
&
camera_
dummy
_initdata
,
.
init_data
=
&
camera_
regulator
_initdata
,
};
static
struct
platform_device
camera_supply_
dummy
_device
=
{
static
struct
platform_device
camera_supply_
regulator
_device
=
{
.
name
=
"reg-fixed-voltage"
,
.
id
=
1
,
.
dev
=
{
.
platform_data
=
&
camera_dummy_config
,
.
platform_data
=
&
camera_regulator_config
,
},
};
static
struct
gpiod_lookup_table
camera_supply_gpiod_table
=
{
.
dev_id
=
"reg-fixed-voltage.1"
,
.
table
=
{
GPIO_LOOKUP
(
"gpio-pxa"
,
GPIO50_nCAM_EN
,
NULL
,
GPIO_ACTIVE_HIGH
),
{
},
},
};
#endif
...
...
@@ -800,7 +809,7 @@ static struct i2c_board_info a780_i2c_board_info[] = {
static
struct
platform_device
*
a780_devices
[]
__initdata
=
{
&
a780_gpio_keys
,
&
camera_supply_
dummy
_device
,
&
camera_supply_
regulator
_device
,
};
static
void
__init
a780_init
(
void
)
...
...
@@ -823,6 +832,7 @@ static void __init a780_init(void)
if
(
a780_camera_init
()
==
0
)
pxa_set_camera_info
(
&
a780_pxacamera_platform_data
);
gpiod_add_lookup_table
(
&
camera_supply_gpiod_table
);
pwm_add_table
(
ezx_pwm_lookup
,
ARRAY_SIZE
(
ezx_pwm_lookup
));
platform_add_devices
(
ARRAY_AND_SIZE
(
ezx_devices
));
platform_add_devices
(
ARRAY_AND_SIZE
(
a780_devices
));
...
...
@@ -1098,7 +1108,7 @@ static struct i2c_board_info __initdata a910_i2c_board_info[] = {
static
struct
platform_device
*
a910_devices
[]
__initdata
=
{
&
a910_gpio_keys
,
&
camera_supply_
dummy
_device
,
&
camera_supply_
regulator
_device
,
};
static
void
__init
a910_init
(
void
)
...
...
@@ -1121,6 +1131,7 @@ static void __init a910_init(void)
if
(
a910_camera_init
()
==
0
)
pxa_set_camera_info
(
&
a910_pxacamera_platform_data
);
gpiod_add_lookup_table
(
&
camera_supply_gpiod_table
);
pwm_add_table
(
ezx_pwm_lookup
,
ARRAY_SIZE
(
ezx_pwm_lookup
));
platform_add_devices
(
ARRAY_AND_SIZE
(
ezx_devices
));
platform_add_devices
(
ARRAY_AND_SIZE
(
a910_devices
));
...
...
arch/arm/mach-pxa/magician.c
View file @
4fd1f509
...
...
@@ -18,6 +18,7 @@
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/gpio_keys.h>
#include <linux/input.h>
#include <linux/mfd/htc-pasic3.h>
...
...
@@ -696,7 +697,6 @@ static struct regulator_init_data vads7846_regulator = {
static
struct
fixed_voltage_config
vads7846
=
{
.
supply_name
=
"vads7846"
,
.
microvolts
=
3300000
,
/* probably */
.
gpio
=
-
EINVAL
,
.
startup_delay
=
0
,
.
init_data
=
&
vads7846_regulator
,
};
...
...
arch/arm/mach-pxa/raumfeld.c
View file @
4fd1f509
...
...
@@ -886,7 +886,6 @@ static struct regulator_init_data audio_va_initdata = {
static
struct
fixed_voltage_config
audio_va_config
=
{
.
supply_name
=
"audio_va"
,
.
microvolts
=
5000000
,
.
gpio
=
GPIO_AUDIO_VA_ENABLE
,
.
enable_high
=
1
,
.
enabled_at_boot
=
0
,
.
init_data
=
&
audio_va_initdata
,
...
...
@@ -900,6 +899,15 @@ static struct platform_device audio_va_device = {
},
};
static
struct
gpiod_lookup_table
audio_va_gpiod_table
=
{
.
dev_id
=
"reg-fixed-voltage.0"
,
.
table
=
{
GPIO_LOOKUP
(
"gpio-pxa"
,
GPIO_AUDIO_VA_ENABLE
,
NULL
,
GPIO_ACTIVE_HIGH
),
{
},
},
};
/* Dummy supplies for Codec's VD/VLC */
static
struct
regulator_consumer_supply
audio_dummy_supplies
[]
=
{
...
...
@@ -918,7 +926,6 @@ static struct regulator_init_data audio_dummy_initdata = {
static
struct
fixed_voltage_config
audio_dummy_config
=
{
.
supply_name
=
"audio_vd"
,
.
microvolts
=
3300000
,
.
gpio
=
-
1
,
.
init_data
=
&
audio_dummy_initdata
,
};
...
...
@@ -1033,6 +1040,7 @@ static void __init raumfeld_audio_init(void)
else
gpio_direction_output
(
GPIO_MCLK_RESET
,
1
);
gpiod_add_lookup_table
(
&
audio_va_gpiod_table
);
platform_add_devices
(
ARRAY_AND_SIZE
(
audio_regulator_devices
));
}
...
...
arch/arm/mach-pxa/zeus.c
View file @
4fd1f509
...
...
@@ -17,6 +17,7 @@
#include <linux/irq.h>
#include <linux/pm.h>
#include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/serial_8250.h>
#include <linux/dm9000.h>
#include <linux/mmc/host.h>
...
...
@@ -410,7 +411,6 @@ static struct regulator_init_data can_regulator_init_data = {
static
struct
fixed_voltage_config
can_regulator_pdata
=
{
.
supply_name
=
"CAN_SHDN"
,
.
microvolts
=
3300000
,
.
gpio
=
ZEUS_CAN_SHDN_GPIO
,
.
init_data
=
&
can_regulator_init_data
,
};
...
...
@@ -422,6 +422,15 @@ static struct platform_device can_regulator_device = {
},
};
static
struct
gpiod_lookup_table
can_regulator_gpiod_table
=
{
.
dev_id
=
"reg-fixed-voltage.0"
,
.
table
=
{
GPIO_LOOKUP
(
"gpio-pxa"
,
ZEUS_CAN_SHDN_GPIO
,
NULL
,
GPIO_ACTIVE_HIGH
),
{
},
},
};
static
struct
mcp251x_platform_data
zeus_mcp2515_pdata
=
{
.
oscillator_frequency
=
16
*
1000
*
1000
,
};
...
...
@@ -538,7 +547,6 @@ static struct regulator_init_data zeus_ohci_regulator_data = {
static
struct
fixed_voltage_config
zeus_ohci_regulator_config
=
{
.
supply_name
=
"vbus2"
,
.
microvolts
=
5000000
,
/* 5.0V */
.
gpio
=
ZEUS_USB2_PWREN_GPIO
,
.
enable_high
=
1
,
.
startup_delay
=
0
,
.
init_data
=
&
zeus_ohci_regulator_data
,
...
...
@@ -552,6 +560,15 @@ static struct platform_device zeus_ohci_regulator_device = {
},
};
static
struct
gpiod_lookup_table
zeus_ohci_regulator_gpiod_table
=
{
.
dev_id
=
"reg-fixed-voltage.0"
,
.
table
=
{
GPIO_LOOKUP
(
"gpio-pxa"
,
ZEUS_USB2_PWREN_GPIO
,
NULL
,
GPIO_ACTIVE_HIGH
),
{
},
},
};
static
struct
pxaohci_platform_data
zeus_ohci_platform_data
=
{
.
port_mode
=
PMM_NPS_MODE
,
/* Clear Power Control Polarity Low and set Power Sense
...
...
@@ -855,6 +872,8 @@ static void __init zeus_init(void)
pxa2xx_mfp_config
(
ARRAY_AND_SIZE
(
zeus_pin_config
));
gpiod_add_lookup_table
(
&
can_regulator_gpiod_table
);
gpiod_add_lookup_table
(
&
zeus_ohci_regulator_gpiod_table
);
platform_add_devices
(
zeus_devices
,
ARRAY_SIZE
(
zeus_devices
));
zeus_register_ohci
();
...
...
arch/arm/mach-s3c64xx/mach-crag6410.c
View file @
4fd1f509
...
...
@@ -352,7 +352,6 @@ static struct fixed_voltage_config wallvdd_pdata = {
.
supply_name
=
"WALLVDD"
,
.
microvolts
=
5000000
,
.
init_data
=
&
wallvdd_data
,
.
gpio
=
-
EINVAL
,
};
static
struct
platform_device
wallvdd_device
=
{
...
...
arch/arm/mach-s3c64xx/mach-smdk6410.c
View file @
4fd1f509
...
...
@@ -222,7 +222,6 @@ static struct fixed_voltage_config smdk6410_b_pwr_5v_pdata = {
.
supply_name
=
"B_PWR_5V"
,
.
microvolts
=
5000000
,
.
init_data
=
&
smdk6410_b_pwr_5v_data
,
.
gpio
=
-
EINVAL
,
};
static
struct
platform_device
smdk6410_b_pwr_5v
=
{
...
...
arch/arm/mach-sa1100/assabet.c
View file @
4fd1f509
...
...
@@ -101,7 +101,7 @@ static int __init assabet_init_gpio(void __iomem *reg, u32 def_val)
assabet_bcr_gc
=
gc
;
return
gc
->
base
;
return
0
;
}
/*
...
...
@@ -471,6 +471,14 @@ static struct fixed_voltage_config assabet_cf_vcc_pdata __initdata = {
.
enable_high
=
1
,
};
static
struct
gpiod_lookup_table
assabet_cf_vcc_gpio_table
=
{
.
dev_id
=
"reg-fixed-voltage.0"
,
.
table
=
{
GPIO_LOOKUP
(
"assabet"
,
0
,
NULL
,
GPIO_ACTIVE_HIGH
),
{
},
},
};
static
void
__init
assabet_init
(
void
)
{
/*
...
...
@@ -517,9 +525,11 @@ static void __init assabet_init(void)
neponset_resources
,
ARRAY_SIZE
(
neponset_resources
));
#endif
}
else
{
gpiod_add_lookup_table
(
&
assabet_cf_vcc_gpio_table
);
sa11x0_register_fixed_regulator
(
0
,
&
assabet_cf_vcc_pdata
,
assabet_cf_vcc_consumers
,
ARRAY_SIZE
(
assabet_cf_vcc_consumers
));
assabet_cf_vcc_consumers
,
ARRAY_SIZE
(
assabet_cf_vcc_consumers
),
true
);
}
...
...
@@ -802,7 +812,6 @@ fs_initcall(assabet_leds_init);
void
__init
assabet_init_irq
(
void
)
{
unsigned
int
assabet_gpio_base
;
u32
def_val
;
sa1100_init_irq
();
...
...
@@ -817,9 +826,7 @@ void __init assabet_init_irq(void)
*
* This must precede any driver calls to BCR_set() or BCR_clear().
*/
assabet_gpio_base
=
assabet_init_gpio
((
void
*
)
&
ASSABET_BCR
,
def_val
);
assabet_cf_vcc_pdata
.
gpio
=
assabet_gpio_base
+
0
;
assabet_init_gpio
((
void
*
)
&
ASSABET_BCR
,
def_val
);
}
MACHINE_START
(
ASSABET
,
"Intel-Assabet"
)
...
...
arch/arm/mach-sa1100/generic.c
View file @
4fd1f509
...
...
@@ -348,7 +348,8 @@ void __init sa11x0_init_late(void)
int
__init
sa11x0_register_fixed_regulator
(
int
n
,
struct
fixed_voltage_config
*
cfg
,
struct
regulator_consumer_supply
*
supplies
,
unsigned
num_supplies
)
struct
regulator_consumer_supply
*
supplies
,
unsigned
num_supplies
,
bool
uses_gpio
)
{
struct
regulator_init_data
*
id
;
...
...
@@ -356,7 +357,7 @@ int __init sa11x0_register_fixed_regulator(int n,
if
(
!
cfg
->
init_data
)
return
-
ENOMEM
;
if
(
cfg
->
gpio
<
0
)
if
(
!
uses_gpio
)
id
->
constraints
.
always_on
=
1
;
id
->
constraints
.
name
=
cfg
->
supply_name
;
id
->
constraints
.
min_uV
=
cfg
->
microvolts
;
...
...
arch/arm/mach-sa1100/generic.h
View file @
4fd1f509
...
...
@@ -54,4 +54,5 @@ void sa11x0_register_pcmcia(int socket, struct gpiod_lookup_table *);
struct
fixed_voltage_config
;
struct
regulator_consumer_supply
;
int
sa11x0_register_fixed_regulator
(
int
n
,
struct
fixed_voltage_config
*
cfg
,
struct
regulator_consumer_supply
*
supplies
,
unsigned
num_supplies
);
struct
regulator_consumer_supply
*
supplies
,
unsigned
num_supplies
,
bool
uses_gpio
);
arch/arm/mach-sa1100/shannon.c
View file @
4fd1f509
...
...
@@ -102,14 +102,14 @@ static struct fixed_voltage_config shannon_cf_vcc_pdata __initdata = {
.
supply_name
=
"cf-power"
,
.
microvolts
=
3300000
,
.
enabled_at_boot
=
1
,
.
gpio
=
-
EINVAL
,
};
static
void
__init
shannon_init
(
void
)
{
sa11x0_register_fixed_regulator
(
0
,
&
shannon_cf_vcc_pdata
,
shannon_cf_vcc_consumers
,
ARRAY_SIZE
(
shannon_cf_vcc_consumers
));
ARRAY_SIZE
(
shannon_cf_vcc_consumers
),
false
);
sa11x0_register_pcmcia
(
0
,
&
shannon_pcmcia0_gpio_table
);
sa11x0_register_pcmcia
(
1
,
&
shannon_pcmcia1_gpio_table
);
sa11x0_ppc_configure_mcp
();
...
...
arch/sh/boards/mach-ecovec24/setup.c
View file @
4fd1f509
...
...
@@ -633,7 +633,6 @@ static struct regulator_init_data cn12_power_init_data = {
static
struct
fixed_voltage_config
cn12_power_info
=
{
.
supply_name
=
"CN12 SD/MMC Vdd"
,
.
microvolts
=
3300000
,
.
gpio
=
GPIO_PTB7
,
.
enable_high
=
1
,
.
init_data
=
&
cn12_power_init_data
,
};
...
...
@@ -646,6 +645,16 @@ static struct platform_device cn12_power = {
},
};
static
struct
gpiod_lookup_table
cn12_power_gpiod_table
=
{
.
dev_id
=
"reg-fixed-voltage.0"
,
.
table
=
{
/* Offset 7 on port B */
GPIO_LOOKUP
(
"sh7724_pfc"
,
GPIO_PTB7
,
NULL
,
GPIO_ACTIVE_HIGH
),
{
},
},
};
#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
/* SDHI0 */
static
struct
regulator_consumer_supply
sdhi0_power_consumers
[]
=
...
...
@@ -665,7 +674,6 @@ static struct regulator_init_data sdhi0_power_init_data = {
static
struct
fixed_voltage_config
sdhi0_power_info
=
{
.
supply_name
=
"CN11 SD/MMC Vdd"
,
.
microvolts
=
3300000
,
.
gpio
=
GPIO_PTB6
,
.
enable_high
=
1
,
.
init_data
=
&
sdhi0_power_init_data
,
};
...
...
@@ -678,6 +686,16 @@ static struct platform_device sdhi0_power = {
},
};
static
struct
gpiod_lookup_table
sdhi0_power_gpiod_table
=
{
.
dev_id
=
"reg-fixed-voltage.1"
,
.
table
=
{
/* Offset 6 on port B */
GPIO_LOOKUP
(
"sh7724_pfc"
,
GPIO_PTB6
,
NULL
,
GPIO_ACTIVE_HIGH
),
{
},
},
};
static
struct
tmio_mmc_data
sdhi0_info
=
{
.
chan_priv_tx
=
(
void
*
)
SHDMA_SLAVE_SDHI0_TX
,
.
chan_priv_rx
=
(
void
*
)
SHDMA_SLAVE_SDHI0_RX
,
...
...
@@ -1413,6 +1431,11 @@ static int __init arch_setup(void)
DMA_MEMORY_EXCLUSIVE
);
platform_device_add
(
ecovec_ceu_devices
[
1
]);
gpiod_add_lookup_table
(
&
cn12_power_gpiod_table
);
#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
gpiod_add_lookup_table
(
&
sdhi0_power_gpiod_table
);
#endif
return
platform_add_devices
(
ecovec_devices
,
ARRAY_SIZE
(
ecovec_devices
));
}
...
...
arch/x86/platform/intel-mid/device_libs/platform_bcm43xx.c
View file @
4fd1f509
...
...
@@ -10,7 +10,7 @@
* of the License.
*/
#include <linux/gpio.h>
#include <linux/gpio
/machine
.h>
#include <linux/platform_device.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/fixed.h>
...
...
@@ -43,7 +43,6 @@ static struct fixed_voltage_config bcm43xx_vmmc = {
* real voltage and signaling are still 1.8V.
*/
.
microvolts
=
2000000
,
/* 1.8V */
.
gpio
=
-
EINVAL
,
.
startup_delay
=
250
*
1000
,
/* 250ms */
.
enable_high
=
1
,
/* active high */
.
enabled_at_boot
=
0
,
/* disabled at boot */
...
...
@@ -58,11 +57,23 @@ static struct platform_device bcm43xx_vmmc_regulator = {
},
};
static
struct
gpiod_lookup_table
bcm43xx_vmmc_gpio_table
=
{
.
dev_id
=
"reg-fixed-voltage.0"
,
.
table
=
{
GPIO_LOOKUP
(
"0000:00:0c.0"
,
-
1
,
NULL
,
GPIO_ACTIVE_LOW
),
{}
},
};
static
int
__init
bcm43xx_regulator_register
(
void
)
{
struct
gpiod_lookup_table
*
table
=
&
bcm43xx_vmmc_gpio_table
;
struct
gpiod_lookup
*
lookup
=
table
->
table
;
int
ret
;
bcm43xx_vmmc
.
gpio
=
get_gpio_by_name
(
WLAN_SFI_GPIO_ENABLE_NAME
);
lookup
[
0
].
chip_hwnum
=
get_gpio_by_name
(
WLAN_SFI_GPIO_ENABLE_NAME
);
gpiod_add_lookup_table
(
table
);
ret
=
platform_device_register
(
&
bcm43xx_vmmc_regulator
);
if
(
ret
)
{
pr_err
(
"%s: vmmc regulator register failed
\n
"
,
__func__
);
...
...
drivers/gpio/gpiolib.c
View file @
4fd1f509
...
...
@@ -3909,8 +3909,23 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
* the device name as label
*/
status
=
gpiod_request
(
desc
,
con_id
?
con_id
:
devname
);
if
(
status
<
0
)
return
ERR_PTR
(
status
);
if
(
status
<
0
)
{
if
(
status
==
-
EBUSY
&&
flags
&
GPIOD_FLAGS_BIT_NONEXCLUSIVE
)
{
/*
* This happens when there are several consumers for
* the same GPIO line: we just return here without
* further initialization. It is a bit if a hack.
* This is necessary to support fixed regulators.
*
* FIXME: Make this more sane and safe.
*/
dev_info
(
dev
,
"nonexclusive access to GPIO for %s
\n
"
,
con_id
?
con_id
:
devname
);
return
desc
;
}
else
{
return
ERR_PTR
(
status
);
}
}
status
=
gpiod_configure_flags
(
desc
,
con_id
,
lookupflags
,
flags
);
if
(
status
<
0
)
{
...
...
drivers/mfd/rohm-bd718x7.c
View file @
4fd1f509
...
...
@@ -2,26 +2,21 @@
//
// Copyright (C) 2018 ROHM Semiconductors
//
// ROHM BD71837MWV PMIC driver
// ROHM BD71837MWV
and BD71847MWV
PMIC driver
//
// Datasheet available from
// Datasheet
for BD71837MWV
available from
// https://www.rohm.com/datasheet/BD71837MWV/bd71837mwv-e
#include <linux/gpio_keys.h>
#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/mfd/rohm-bd718x7.h>
#include <linux/mfd/core.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/regmap.h>
/*
* gpio_keys.h requires definiton of bool. It is brought in
* by above includes. Keep this as last until gpio_keys.h gets fixed.
*/
#include <linux/gpio_keys.h>
static
const
u8
supported_revisions
[]
=
{
0xA2
/* BD71837 */
};
#include <linux/types.h>
static
struct
gpio_keys_button
button
=
{
.
code
=
KEY_POWER
,
...
...
@@ -35,42 +30,42 @@ static struct gpio_keys_platform_data bd718xx_powerkey_data = {
.
name
=
"bd718xx-pwrkey"
,
};
static
struct
mfd_cell
bd718
37
_mfd_cells
[]
=
{
static
struct
mfd_cell
bd718
xx
_mfd_cells
[]
=
{
{
.
name
=
"gpio-keys"
,
.
platform_data
=
&
bd718xx_powerkey_data
,
.
pdata_size
=
sizeof
(
bd718xx_powerkey_data
),
},
{
.
name
=
"bd718
37
-clk"
,
},
{
.
name
=
"bd718
37
-pmic"
,
},
{
.
name
=
"bd718
xx
-clk"
,
},
{
.
name
=
"bd718
xx
-pmic"
,
},
};
static
const
struct
regmap_irq
bd718
37
_irqs
[]
=
{
REGMAP_IRQ_REG
(
BD718
37_INT_SWRST
,
0
,
BD71837
_INT_SWRST_MASK
),
REGMAP_IRQ_REG
(
BD718
37_INT_PWRBTN_S
,
0
,
BD71837
_INT_PWRBTN_S_MASK
),
REGMAP_IRQ_REG
(
BD718
37_INT_PWRBTN_L
,
0
,
BD71837
_INT_PWRBTN_L_MASK
),
REGMAP_IRQ_REG
(
BD718
37_INT_PWRBTN
,
0
,
BD71837
_INT_PWRBTN_MASK
),
REGMAP_IRQ_REG
(
BD718
37_INT_WDOG
,
0
,
BD71837
_INT_WDOG_MASK
),
REGMAP_IRQ_REG
(
BD718
37_INT_ON_REQ
,
0
,
BD71837
_INT_ON_REQ_MASK
),
REGMAP_IRQ_REG
(
BD718
37_INT_STBY_REQ
,
0
,
BD71837
_INT_STBY_REQ_MASK
),
static
const
struct
regmap_irq
bd718
xx
_irqs
[]
=
{
REGMAP_IRQ_REG
(
BD718
XX_INT_SWRST
,
0
,
BD718XX
_INT_SWRST_MASK
),
REGMAP_IRQ_REG
(
BD718
XX_INT_PWRBTN_S
,
0
,
BD718XX
_INT_PWRBTN_S_MASK
),
REGMAP_IRQ_REG
(
BD718
XX_INT_PWRBTN_L
,
0
,
BD718XX
_INT_PWRBTN_L_MASK
),
REGMAP_IRQ_REG
(
BD718
XX_INT_PWRBTN
,
0
,
BD718XX
_INT_PWRBTN_MASK
),
REGMAP_IRQ_REG
(
BD718
XX_INT_WDOG
,
0
,
BD718XX
_INT_WDOG_MASK
),
REGMAP_IRQ_REG
(
BD718
XX_INT_ON_REQ
,
0
,
BD718XX
_INT_ON_REQ_MASK
),
REGMAP_IRQ_REG
(
BD718
XX_INT_STBY_REQ
,
0
,
BD718XX
_INT_STBY_REQ_MASK
),
};
static
struct
regmap_irq_chip
bd718
37
_irq_chip
=
{
.
name
=
"bd718
37
-irq"
,
.
irqs
=
bd718
37
_irqs
,
.
num_irqs
=
ARRAY_SIZE
(
bd718
37
_irqs
),
static
struct
regmap_irq_chip
bd718
xx
_irq_chip
=
{
.
name
=
"bd718
xx
-irq"
,
.
irqs
=
bd718
xx
_irqs
,
.
num_irqs
=
ARRAY_SIZE
(
bd718
xx
_irqs
),
.
num_regs
=
1
,
.
irq_reg_stride
=
1
,
.
status_base
=
BD718
37
_REG_IRQ
,
.
mask_base
=
BD718
37
_REG_MIRQ
,
.
ack_base
=
BD718
37
_REG_IRQ
,
.
status_base
=
BD718
XX
_REG_IRQ
,
.
mask_base
=
BD718
XX
_REG_MIRQ
,
.
ack_base
=
BD718
XX
_REG_IRQ
,
.
init_ack_masked
=
true
,
.
mask_invert
=
false
,
};
static
const
struct
regmap_range
pmic_status_range
=
{
.
range_min
=
BD718
37
_REG_IRQ
,
.
range_max
=
BD718
37
_REG_POW_STATE
,
.
range_min
=
BD718
XX
_REG_IRQ
,
.
range_max
=
BD718
XX
_REG_POW_STATE
,
};
static
const
struct
regmap_access_table
volatile_regs
=
{
...
...
@@ -78,67 +73,53 @@ static const struct regmap_access_table volatile_regs = {
.
n_yes_ranges
=
1
,
};
static
const
struct
regmap_config
bd718
37
_regmap_config
=
{
static
const
struct
regmap_config
bd718
xx
_regmap_config
=
{
.
reg_bits
=
8
,
.
val_bits
=
8
,
.
volatile_table
=
&
volatile_regs
,
.
max_register
=
BD718
37
_MAX_REGISTER
-
1
,
.
max_register
=
BD718
XX
_MAX_REGISTER
-
1
,
.
cache_type
=
REGCACHE_RBTREE
,
};
static
int
bd718
37
_i2c_probe
(
struct
i2c_client
*
i2c
,
static
int
bd718
xx
_i2c_probe
(
struct
i2c_client
*
i2c
,
const
struct
i2c_device_id
*
id
)
{
struct
bd71837
*
bd71837
;
int
ret
,
i
;
unsigned
int
val
;
bd71837
=
devm_kzalloc
(
&
i2c
->
dev
,
sizeof
(
struct
bd71837
),
GFP_KERNEL
);
struct
bd718xx
*
bd718xx
;
int
ret
;
if
(
!
bd71837
)
return
-
ENOMEM
;
bd71837
->
chip_irq
=
i2c
->
irq
;
if
(
!
bd71837
->
chip_irq
)
{
if
(
!
i2c
->
irq
)
{
dev_err
(
&
i2c
->
dev
,
"No IRQ configured
\n
"
);
return
-
EINVAL
;
}
bd71837
->
dev
=
&
i2c
->
dev
;
dev_set_drvdata
(
&
i2c
->
dev
,
bd71837
);
bd718xx
=
devm_kzalloc
(
&
i2c
->
dev
,
sizeof
(
struct
bd718xx
),
GFP_KERNEL
);
bd71837
->
regmap
=
devm_regmap_init_i2c
(
i2c
,
&
bd71837_regmap_config
);
if
(
IS_ERR
(
bd71837
->
regmap
))
{
dev_err
(
&
i2c
->
dev
,
"regmap initialization failed
\n
"
);
return
PTR_ERR
(
bd71837
->
regmap
);
}
if
(
!
bd718xx
)
return
-
ENOMEM
;
ret
=
regmap_read
(
bd71837
->
regmap
,
BD71837_REG_REV
,
&
val
);
if
(
ret
)
{
dev_err
(
&
i2c
->
dev
,
"Read BD71837_REG_DEVICE failed
\n
"
);
return
ret
;
}
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
supported_revisions
);
i
++
)
if
(
supported_revisions
[
i
]
==
val
)
break
;
bd718xx
->
chip_irq
=
i2c
->
irq
;
bd718xx
->
chip_type
=
(
unsigned
int
)
of_device_get_match_data
(
&
i2c
->
dev
);
bd718xx
->
dev
=
&
i2c
->
dev
;
dev_set_drvdata
(
&
i2c
->
dev
,
bd718xx
);
if
(
i
==
ARRAY_SIZE
(
supported_revisions
))
{
dev_err
(
&
i2c
->
dev
,
"Unsupported chip revision
\n
"
);
return
-
ENODEV
;
bd718xx
->
regmap
=
devm_regmap_init_i2c
(
i2c
,
&
bd718xx_regmap_config
);
if
(
IS_ERR
(
bd718xx
->
regmap
))
{
dev_err
(
&
i2c
->
dev
,
"regmap initialization failed
\n
"
);
return
PTR_ERR
(
bd718xx
->
regmap
);
}
ret
=
devm_regmap_add_irq_chip
(
&
i2c
->
dev
,
bd718
37
->
regmap
,
bd718
37
->
chip_irq
,
IRQF_ONESHOT
,
0
,
&
bd718
37_irq_chip
,
&
bd71837
->
irq_data
);
ret
=
devm_regmap_add_irq_chip
(
&
i2c
->
dev
,
bd718
xx
->
regmap
,
bd718
xx
->
chip_irq
,
IRQF_ONESHOT
,
0
,
&
bd718
xx_irq_chip
,
&
bd718xx
->
irq_data
);
if
(
ret
)
{
dev_err
(
&
i2c
->
dev
,
"Failed to add irq_chip
\n
"
);
return
ret
;
}
/* Configure short press to 10 milliseconds */
ret
=
regmap_update_bits
(
bd718
37
->
regmap
,
BD718
37
_REG_PWRONCONFIG0
,
ret
=
regmap_update_bits
(
bd718
xx
->
regmap
,
BD718
XX
_REG_PWRONCONFIG0
,
BD718XX_PWRBTN_PRESS_DURATION_MASK
,
BD718XX_PWRBTN_SHORT_PRESS_10MS
);
if
(
ret
)
{
...
...
@@ -148,8 +129,8 @@ static int bd71837_i2c_probe(struct i2c_client *i2c,
}
/* Configure long press to 10 seconds */
ret
=
regmap_update_bits
(
bd718
37
->
regmap
,
BD718
37
_REG_PWRONCONFIG1
,
ret
=
regmap_update_bits
(
bd718
xx
->
regmap
,
BD718
XX
_REG_PWRONCONFIG1
,
BD718XX_PWRBTN_PRESS_DURATION_MASK
,
BD718XX_PWRBTN_LONG_PRESS_10S
);
...
...
@@ -159,7 +140,7 @@ static int bd71837_i2c_probe(struct i2c_client *i2c,
return
ret
;
}
ret
=
regmap_irq_get_virq
(
bd718
37
->
irq_data
,
BD71837
_INT_PWRBTN_S
);
ret
=
regmap_irq_get_virq
(
bd718
xx
->
irq_data
,
BD718XX
_INT_PWRBTN_S
);
if
(
ret
<
0
)
{
dev_err
(
&
i2c
->
dev
,
"Failed to get the IRQ
\n
"
);
...
...
@@ -168,44 +149,51 @@ static int bd71837_i2c_probe(struct i2c_client *i2c,
button
.
irq
=
ret
;
ret
=
devm_mfd_add_devices
(
bd718
37
->
dev
,
PLATFORM_DEVID_AUTO
,
bd718
37
_mfd_cells
,
ARRAY_SIZE
(
bd718
37
_mfd_cells
),
NULL
,
0
,
regmap_irq_get_domain
(
bd718
37
->
irq_data
));
ret
=
devm_mfd_add_devices
(
bd718
xx
->
dev
,
PLATFORM_DEVID_AUTO
,
bd718
xx
_mfd_cells
,
ARRAY_SIZE
(
bd718
xx
_mfd_cells
),
NULL
,
0
,
regmap_irq_get_domain
(
bd718
xx
->
irq_data
));
if
(
ret
)
dev_err
(
&
i2c
->
dev
,
"Failed to create subdevices
\n
"
);
return
ret
;
}
static
const
struct
of_device_id
bd71837_of_match
[]
=
{
{
.
compatible
=
"rohm,bd71837"
,
},
static
const
struct
of_device_id
bd718xx_of_match
[]
=
{
{
.
compatible
=
"rohm,bd71837"
,
.
data
=
(
void
*
)
BD718XX_TYPE_BD71837
,
},
{
.
compatible
=
"rohm,bd71847"
,
.
data
=
(
void
*
)
BD718XX_TYPE_BD71847
,
},
{
}
};
MODULE_DEVICE_TABLE
(
of
,
bd718
37
_of_match
);
MODULE_DEVICE_TABLE
(
of
,
bd718
xx
_of_match
);
static
struct
i2c_driver
bd718
37
_i2c_driver
=
{
static
struct
i2c_driver
bd718
xx
_i2c_driver
=
{
.
driver
=
{
.
name
=
"rohm-bd718x7"
,
.
of_match_table
=
bd718
37
_of_match
,
.
of_match_table
=
bd718
xx
_of_match
,
},
.
probe
=
bd718
37
_i2c_probe
,
.
probe
=
bd718
xx
_i2c_probe
,
};
static
int
__init
bd718
37
_i2c_init
(
void
)
static
int
__init
bd718
xx
_i2c_init
(
void
)
{
return
i2c_add_driver
(
&
bd718
37
_i2c_driver
);
return
i2c_add_driver
(
&
bd718
xx
_i2c_driver
);
}
/* Initialise early so consumer devices can complete system boot */
subsys_initcall
(
bd718
37
_i2c_init
);
subsys_initcall
(
bd718
xx
_i2c_init
);
static
void
__exit
bd718
37
_i2c_exit
(
void
)
static
void
__exit
bd718
xx
_i2c_exit
(
void
)
{
i2c_del_driver
(
&
bd718
37
_i2c_driver
);
i2c_del_driver
(
&
bd718
xx
_i2c_driver
);
}
module_exit
(
bd718
37
_i2c_exit
);
module_exit
(
bd718
xx
_i2c_exit
);
MODULE_AUTHOR
(
"Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>"
);
MODULE_DESCRIPTION
(
"ROHM BD71837 Power Management IC driver"
);
MODULE_DESCRIPTION
(
"ROHM BD71837
/BD71847
Power Management IC driver"
);
MODULE_LICENSE
(
"GPL"
);
drivers/regulator/Kconfig
View file @
4fd1f509
...
...
@@ -189,7 +189,7 @@ config REGULATOR_BD718XX
and LDO regulators.
This driver can also be built as a module. If so, the module
will be called bd718
3
7-regulator.
will be called bd718
x
7-regulator.
config REGULATOR_BD9571MWV
tristate "ROHM BD9571MWV Regulators"
...
...
@@ -356,6 +356,13 @@ config REGULATOR_LM363X
One boost output voltage is configurable and always on.
Other LDOs are used for the display module.
config REGULATOR_LOCHNAGAR
tristate "Cirrus Logic Lochnagar regulator driver"
depends on MFD_LOCHNAGAR
help
This enables regulator support on the Cirrus Logic Lochnagar audio
development board.
config REGULATOR_LP3971
tristate "National Semiconductors LP3971 PMIC regulator driver"
depends on I2C
...
...
@@ -803,6 +810,18 @@ config REGULATOR_STM32_VREFBUF
This driver can also be built as a module. If so, the module
will be called stm32-vrefbuf.
config REGULATOR_STPMIC1
tristate "STMicroelectronics STPMIC1 PMIC Regulators"
depends on MFD_STPMIC1
help
This driver supports STMicroelectronics STPMIC1 PMIC voltage
regulators and switches. The STPMIC1 regulators supply power to
an application processor as well as to external system
peripherals such as DDR, Flash memories and system devices.
To compile this driver as a module, choose M here: the
module will be called stpmic1_regulator.
config REGULATOR_TI_ABB
tristate "TI Adaptive Body Bias on-chip LDO"
depends on ARCH_OMAP
...
...
drivers/regulator/Makefile
View file @
4fd1f509
...
...
@@ -27,7 +27,7 @@ obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o
obj-$(CONFIG_REGULATOR_AS3722)
+=
as3722-regulator.o
obj-$(CONFIG_REGULATOR_AXP20X)
+=
axp20x-regulator.o
obj-$(CONFIG_REGULATOR_BCM590XX)
+=
bcm590xx-regulator.o
obj-$(CONFIG_REGULATOR_BD718XX)
+=
bd718
3
7-regulator.o
obj-$(CONFIG_REGULATOR_BD718XX)
+=
bd718
x
7-regulator.o
obj-$(CONFIG_REGULATOR_BD9571MWV)
+=
bd9571mwv-regulator.o
obj-$(CONFIG_REGULATOR_DA903X)
+=
da903x.o
obj-$(CONFIG_REGULATOR_DA9052)
+=
da9052-regulator.o
...
...
@@ -46,6 +46,7 @@ obj-$(CONFIG_REGULATOR_HI655X) += hi655x-regulator.o
obj-$(CONFIG_REGULATOR_ISL6271A)
+=
isl6271a-regulator.o
obj-$(CONFIG_REGULATOR_ISL9305)
+=
isl9305.o
obj-$(CONFIG_REGULATOR_LM363X)
+=
lm363x-regulator.o
obj-$(CONFIG_REGULATOR_LOCHNAGAR)
+=
lochnagar-regulator.o
obj-$(CONFIG_REGULATOR_LP3971)
+=
lp3971.o
obj-$(CONFIG_REGULATOR_LP3972)
+=
lp3972.o
obj-$(CONFIG_REGULATOR_LP872X)
+=
lp872x.o
...
...
@@ -101,6 +102,7 @@ obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o
obj-$(CONFIG_REGULATOR_SC2731)
+=
sc2731-regulator.o
obj-$(CONFIG_REGULATOR_SKY81452)
+=
sky81452-regulator.o
obj-$(CONFIG_REGULATOR_STM32_VREFBUF)
+=
stm32-vrefbuf.o
obj-$(CONFIG_REGULATOR_STPMIC1)
+=
stpmic1_regulator.o
obj-$(CONFIG_REGULATOR_STW481X_VMMC)
+=
stw481x-vmmc.o
obj-$(CONFIG_REGULATOR_SY8106A)
+=
sy8106a-regulator.o
obj-$(CONFIG_REGULATOR_TI_ABB)
+=
ti-abb-regulator.o
...
...
drivers/regulator/arizona-ldo1.c
View file @
4fd1f509
...
...
@@ -260,7 +260,7 @@ static int arizona_ldo1_common_init(struct platform_device *pdev,
* so clean up would happen at the wrong time
*/
config
.
ena_gpiod
=
gpiod_get_optional
(
parent_dev
,
"wlf,ldoena"
,
GPIOD_OUT_LOW
);
GPIOD_OUT_LOW
|
GPIOD_FLAGS_BIT_NONEXCLUSIVE
);
if
(
IS_ERR
(
config
.
ena_gpiod
))
return
PTR_ERR
(
config
.
ena_gpiod
);
...
...
drivers/regulator/axp20x-regulator.c
View file @
4fd1f509
...
...
@@ -509,10 +509,10 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
/*
* AXP803/AXP813 DCDC work frequency setting has the same
* range and step as AXP22X, but at a different register.
* Fall through to the check below.
* (See include/linux/mfd/axp20x.h)
*/
reg
=
AXP803_DCDC_FREQ_CTRL
;
/* Fall through to the check below.*/
case
AXP806_ID
:
/*
* AXP806 also have DCDC work frequency setting register at a
...
...
@@ -520,6 +520,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
*/
if
(
axp20x
->
variant
==
AXP806_ID
)
reg
=
AXP806_DCDC_FREQ_CTRL
;
/* Fall through */
case
AXP221_ID
:
case
AXP223_ID
:
case
AXP809_ID
:
...
...
drivers/regulator/bd71837-regulator.c
deleted
100644 → 0
View file @
35a7f35a
This diff is collapsed.
Click to expand it.
drivers/regulator/bd718x7-regulator.c
0 → 100644
View file @
4fd1f509
This diff is collapsed.
Click to expand it.
drivers/regulator/core.c
View file @
4fd1f509
...
...
@@ -426,19 +426,24 @@ static ssize_t name_show(struct device *dev, struct device_attribute *attr,
}
static
DEVICE_ATTR_RO
(
name
);
static
ssize_t
regulator_print_opmode
(
char
*
buf
,
int
mode
)
static
const
char
*
regulator_opmode_to_str
(
int
mode
)
{
switch
(
mode
)
{
case
REGULATOR_MODE_FAST
:
return
sprintf
(
buf
,
"fast
\n
"
)
;
return
"fast"
;
case
REGULATOR_MODE_NORMAL
:
return
sprintf
(
buf
,
"normal
\n
"
)
;
return
"normal"
;
case
REGULATOR_MODE_IDLE
:
return
sprintf
(
buf
,
"idle
\n
"
)
;
return
"idle"
;
case
REGULATOR_MODE_STANDBY
:
return
sprintf
(
buf
,
"standby
\n
"
)
;
return
"standby"
;
}
return
sprintf
(
buf
,
"unknown
\n
"
);
return
"unknown"
;
}
static
ssize_t
regulator_print_opmode
(
char
*
buf
,
int
mode
)
{
return
sprintf
(
buf
,
"%s
\n
"
,
regulator_opmode_to_str
(
mode
));
}
static
ssize_t
regulator_opmode_show
(
struct
device
*
dev
,
...
...
@@ -2783,6 +2788,11 @@ static int regulator_map_voltage(struct regulator_dev *rdev, int min_uV,
if
(
desc
->
ops
->
list_voltage
==
regulator_list_voltage_linear_range
)
return
regulator_map_voltage_linear_range
(
rdev
,
min_uV
,
max_uV
);
if
(
desc
->
ops
->
list_voltage
==
regulator_list_voltage_pickable_linear_range
)
return
regulator_map_voltage_pickable_linear_range
(
rdev
,
min_uV
,
max_uV
);
return
regulator_map_voltage_iterate
(
rdev
,
min_uV
,
max_uV
);
}
...
...
@@ -3470,21 +3480,23 @@ int regulator_set_current_limit(struct regulator *regulator,
}
EXPORT_SYMBOL_GPL
(
regulator_set_current_limit
);
static
int
_regulator_get_current_limit_unlocked
(
struct
regulator_dev
*
rdev
)
{
/* sanity check */
if
(
!
rdev
->
desc
->
ops
->
get_current_limit
)
return
-
EINVAL
;
return
rdev
->
desc
->
ops
->
get_current_limit
(
rdev
);
}
static
int
_regulator_get_current_limit
(
struct
regulator_dev
*
rdev
)
{
int
ret
;
regulator_lock
(
rdev
);
/* sanity check */
if
(
!
rdev
->
desc
->
ops
->
get_current_limit
)
{
ret
=
-
EINVAL
;
goto
out
;
}
ret
=
rdev
->
desc
->
ops
->
get_current_limit
(
rdev
);
out:
ret
=
_regulator_get_current_limit_unlocked
(
rdev
);
regulator_unlock
(
rdev
);
return
ret
;
}
...
...
@@ -3549,21 +3561,23 @@ int regulator_set_mode(struct regulator *regulator, unsigned int mode)
}
EXPORT_SYMBOL_GPL
(
regulator_set_mode
);
static
unsigned
int
_regulator_get_mode_unlocked
(
struct
regulator_dev
*
rdev
)
{
/* sanity check */
if
(
!
rdev
->
desc
->
ops
->
get_mode
)
return
-
EINVAL
;
return
rdev
->
desc
->
ops
->
get_mode
(
rdev
);
}
static
unsigned
int
_regulator_get_mode
(
struct
regulator_dev
*
rdev
)
{
int
ret
;
regulator_lock
(
rdev
);
/* sanity check */
if
(
!
rdev
->
desc
->
ops
->
get_mode
)
{
ret
=
-
EINVAL
;
goto
out
;
}
ret
=
rdev
->
desc
->
ops
->
get_mode
(
rdev
);
out:
ret
=
_regulator_get_mode_unlocked
(
rdev
);
regulator_unlock
(
rdev
);
return
ret
;
}
...
...
@@ -4455,41 +4469,33 @@ void regulator_unregister(struct regulator_dev *rdev)
EXPORT_SYMBOL_GPL
(
regulator_unregister
);
#ifdef CONFIG_SUSPEND
static
int
_regulator_suspend
(
struct
device
*
dev
,
void
*
data
)
{
struct
regulator_dev
*
rdev
=
dev_to_rdev
(
dev
);
suspend_state_t
*
state
=
data
;
int
ret
;
regulator_lock
(
rdev
);
ret
=
suspend_set_state
(
rdev
,
*
state
);
regulator_unlock
(
rdev
);
return
ret
;
}
/**
* regulator_suspend - prepare regulators for system wide suspend
* @
state: system suspend state
* @
dev: ``&struct device`` pointer that is passed to _regulator_suspend()
*
* Configure each regulator with it's suspend operating parameters for state.
*/
static
int
regulator_suspend
(
struct
device
*
dev
)
{
struct
regulator_dev
*
rdev
=
dev_to_rdev
(
dev
);
suspend_state_t
state
=
pm_suspend_target_state
;
int
ret
;
regulator_lock
(
rdev
);
ret
=
suspend_set_state
(
rdev
,
state
);
regulator_unlock
(
rdev
);
return
class_for_each_device
(
&
regulator_class
,
NULL
,
&
state
,
_regulator_suspend
);
return
ret
;
}
static
int
_regulator_resume
(
struct
device
*
dev
,
void
*
data
)
static
int
regulator_resume
(
struct
device
*
dev
)
{
int
ret
=
0
;
suspend_state_t
state
=
pm_suspend_target_state
;
struct
regulator_dev
*
rdev
=
dev_to_rdev
(
dev
);
suspend_state_t
*
state
=
data
;
struct
regulator_state
*
rstate
;
int
ret
=
0
;
rstate
=
regulator_get_suspend_state
(
rdev
,
*
state
);
rstate
=
regulator_get_suspend_state
(
rdev
,
state
);
if
(
rstate
==
NULL
)
return
0
;
...
...
@@ -4504,15 +4510,6 @@ static int _regulator_resume(struct device *dev, void *data)
return
ret
;
}
static
int
regulator_resume
(
struct
device
*
dev
)
{
suspend_state_t
state
=
pm_suspend_target_state
;
return
class_for_each_device
(
&
regulator_class
,
NULL
,
&
state
,
_regulator_resume
);
}
#else
/* !CONFIG_SUSPEND */
#define regulator_suspend NULL
...
...
@@ -4670,17 +4667,23 @@ static void regulator_summary_show_subtree(struct seq_file *s,
struct
regulation_constraints
*
c
;
struct
regulator
*
consumer
;
struct
summary_data
summary_data
;
unsigned
int
opmode
;
if
(
!
rdev
)
return
;
seq_printf
(
s
,
"%*s%-*s %3d %4d %6d "
,
regulator_lock_nested
(
rdev
,
level
);
opmode
=
_regulator_get_mode_unlocked
(
rdev
);
seq_printf
(
s
,
"%*s%-*s %3d %4d %6d %7s "
,
level
*
3
+
1
,
""
,
30
-
level
*
3
,
rdev_get_name
(
rdev
),
rdev
->
use_count
,
rdev
->
open_count
,
rdev
->
bypass_count
);
rdev
->
use_count
,
rdev
->
open_count
,
rdev
->
bypass_count
,
regulator_opmode_to_str
(
opmode
));
seq_printf
(
s
,
"%5dmV "
,
_regulator_get_voltage
(
rdev
)
/
1000
);
seq_printf
(
s
,
"%5dmA "
,
_regulator_get_current_limit
(
rdev
)
/
1000
);
seq_printf
(
s
,
"%5dmA "
,
_regulator_get_current_limit_unlocked
(
rdev
)
/
1000
);
c
=
rdev
->
constraints
;
if
(
c
)
{
...
...
@@ -4709,7 +4712,8 @@ static void regulator_summary_show_subtree(struct seq_file *s,
switch
(
rdev
->
desc
->
type
)
{
case
REGULATOR_VOLTAGE
:
seq_printf
(
s
,
"%37dmV %5dmV"
,
seq_printf
(
s
,
"%37dmA %5dmV %5dmV"
,
consumer
->
uA_load
/
1000
,
consumer
->
voltage
[
PM_SUSPEND_ON
].
min_uV
/
1000
,
consumer
->
voltage
[
PM_SUSPEND_ON
].
max_uV
/
1000
);
break
;
...
...
@@ -4726,6 +4730,8 @@ static void regulator_summary_show_subtree(struct seq_file *s,
class_for_each_device
(
&
regulator_class
,
NULL
,
&
summary_data
,
regulator_summary_show_children
);
regulator_unlock
(
rdev
);
}
static
int
regulator_summary_show_roots
(
struct
device
*
dev
,
void
*
data
)
...
...
@@ -4741,8 +4747,8 @@ static int regulator_summary_show_roots(struct device *dev, void *data)
static
int
regulator_summary_show
(
struct
seq_file
*
s
,
void
*
data
)
{
seq_puts
(
s
,
" regulator use open bypass voltage current min max
\n
"
);
seq_puts
(
s
,
"-------------------------------------------------------------------------------
\n
"
);
seq_puts
(
s
,
" regulator use open bypass
opmode
voltage current min max
\n
"
);
seq_puts
(
s
,
"-------------------------------------------------------------------------------
--------
\n
"
);
class_for_each_device
(
&
regulator_class
,
NULL
,
s
,
regulator_summary_show_roots
);
...
...
drivers/regulator/da9052-regulator.c
View file @
4fd1f509
...
...
@@ -420,7 +420,7 @@ static int da9052_regulator_probe(struct platform_device *pdev)
config
.
dev
=
&
pdev
->
dev
;
config
.
driver_data
=
regulator
;
config
.
regmap
=
da9052
->
regmap
;
if
(
pdata
&&
pdata
->
regulators
)
{
if
(
pdata
)
{
config
.
init_data
=
pdata
->
regulators
[
cell
->
id
];
}
else
{
#ifdef CONFIG_OF
...
...
drivers/regulator/da9055-regulator.c
View file @
4fd1f509
...
...
@@ -612,7 +612,7 @@ static int da9055_regulator_probe(struct platform_device *pdev)
config
.
driver_data
=
regulator
;
config
.
regmap
=
da9055
->
regmap
;
if
(
pdata
&&
pdata
->
regulators
)
{
if
(
pdata
)
{
config
.
init_data
=
pdata
->
regulators
[
pdev
->
id
];
}
else
{
ret
=
da9055_regulator_dt_init
(
pdev
,
regulator
,
&
config
,
...
...
drivers/regulator/da9211-regulator.c
View file @
4fd1f509
...
...
@@ -294,11 +294,11 @@ static struct da9211_pdata *da9211_parse_regulators_dt(
pdata
->
init_data
[
n
]
=
da9211_matches
[
i
].
init_data
;
pdata
->
reg_node
[
n
]
=
da9211_matches
[
i
].
of_node
;
pdata
->
gpiod_ren
[
n
]
=
devm_gpiod_get_from_of_node
(
dev
,
da9211_matches
[
i
].
of_node
,
"enable"
,
0
,
GPIOD_OUT_HIGH
,
"da9211-enable"
);
da9211_matches
[
i
].
of_node
,
"enable"
,
0
,
GPIOD_OUT_HIGH
|
GPIOD_FLAGS_BIT_NONEXCLUSIVE
,
"da9211-enable"
);
n
++
;
}
...
...
drivers/regulator/fixed-helper.c
View file @
4fd1f509
...
...
@@ -43,7 +43,6 @@ struct platform_device *regulator_register_always_on(int id, const char *name,
}
data
->
cfg
.
microvolts
=
uv
;
data
->
cfg
.
gpio
=
-
EINVAL
;
data
->
cfg
.
enabled_at_boot
=
1
;
data
->
cfg
.
init_data
=
&
data
->
init_data
;
...
...
drivers/regulator/fixed.c
View file @
4fd1f509
...
...
@@ -24,10 +24,9 @@
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/fixed.h>
#include <linux/gpio.h>
#include <linux/gpio
/consumer
.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/regulator/of_regulator.h>
#include <linux/regulator/machine.h>
...
...
@@ -78,15 +77,16 @@ of_get_fixed_voltage_config(struct device *dev,
if
(
init_data
->
constraints
.
boot_on
)
config
->
enabled_at_boot
=
true
;
config
->
gpio
=
of_get_named_gpio
(
np
,
"gpio"
,
0
);
if
((
config
->
gpio
<
0
)
&&
(
config
->
gpio
!=
-
ENOENT
))
return
ERR_PTR
(
config
->
gpio
);
of_property_read_u32
(
np
,
"startup-delay-us"
,
&
config
->
startup_delay
);
config
->
enable_high
=
of_property_read_bool
(
np
,
"enable-active-high"
);
config
->
gpio_is_open_drain
=
of_property_read_bool
(
np
,
"gpio-open-drain"
);
/*
* FIXME: we pulled active low/high and open drain handling into
* gpiolib so it will be handled there. Delete this in the second
* step when we also remove the custom inversion handling for all
* legacy boardfiles.
*/
config
->
enable_high
=
1
;
config
->
gpio_is_open_drain
=
0
;
if
(
of_find_property
(
np
,
"vin-supply"
,
NULL
))
config
->
input_supply
=
"vin"
;
...
...
@@ -102,6 +102,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
struct
fixed_voltage_config
*
config
;
struct
fixed_voltage_data
*
drvdata
;
struct
regulator_config
cfg
=
{
};
enum
gpiod_flags
gflags
;
int
ret
;
drvdata
=
devm_kzalloc
(
&
pdev
->
dev
,
sizeof
(
struct
fixed_voltage_data
),
...
...
@@ -150,25 +151,41 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
drvdata
->
desc
.
fixed_uV
=
config
->
microvolts
;
if
(
gpio_is_valid
(
config
->
gpio
))
{
cfg
.
ena_gpio
=
config
->
gpio
;
if
(
pdev
->
dev
.
of_node
)
cfg
.
ena_gpio_initialized
=
true
;
}
cfg
.
ena_gpio_invert
=
!
config
->
enable_high
;
if
(
config
->
enabled_at_boot
)
{
if
(
config
->
enable_high
)
cfg
.
ena_gpio_flags
|=
GPIOF_OUT_INI
T_HIGH
;
gflags
=
GPIOD_OU
T_HIGH
;
else
cfg
.
ena_gpio_flags
|=
GPIOF_OUT_INI
T_LOW
;
gflags
=
GPIOD_OU
T_LOW
;
}
else
{
if
(
config
->
enable_high
)
cfg
.
ena_gpio_flags
|=
GPIOF_OUT_INI
T_LOW
;
gflags
=
GPIOD_OU
T_LOW
;
else
cfg
.
ena_gpio_flags
|=
GPIOF_OUT_INI
T_HIGH
;
gflags
=
GPIOD_OU
T_HIGH
;
}
if
(
config
->
gpio_is_open_drain
)
cfg
.
ena_gpio_flags
|=
GPIOF_OPEN_DRAIN
;
if
(
config
->
gpio_is_open_drain
)
{
if
(
gflags
==
GPIOD_OUT_HIGH
)
gflags
=
GPIOD_OUT_HIGH_OPEN_DRAIN
;
else
gflags
=
GPIOD_OUT_LOW_OPEN_DRAIN
;
}
/*
* Some fixed regulators share the enable line between two
* regulators which makes it necessary to get a handle on the
* same descriptor for two different consumers. This will get
* the GPIO descriptor, but only the first call will initialize
* it so any flags such as inversion or open drain will only
* be set up by the first caller and assumed identical on the
* next caller.
*
* FIXME: find a better way to deal with this.
*/
gflags
|=
GPIOD_FLAGS_BIT_NONEXCLUSIVE
;
cfg
.
ena_gpiod
=
devm_gpiod_get_optional
(
&
pdev
->
dev
,
NULL
,
gflags
);
if
(
IS_ERR
(
cfg
.
ena_gpiod
))
return
PTR_ERR
(
cfg
.
ena_gpiod
);
cfg
.
dev
=
&
pdev
->
dev
;
cfg
.
init_data
=
config
->
init_data
;
...
...
drivers/regulator/helpers.c
View file @
4fd1f509
...
...
@@ -103,6 +103,128 @@ int regulator_disable_regmap(struct regulator_dev *rdev)
}
EXPORT_SYMBOL_GPL
(
regulator_disable_regmap
);
static
int
regulator_range_selector_to_index
(
struct
regulator_dev
*
rdev
,
unsigned
int
rval
)
{
int
i
;
if
(
!
rdev
->
desc
->
linear_range_selectors
)
return
-
EINVAL
;
rval
&=
rdev
->
desc
->
vsel_range_mask
;
for
(
i
=
0
;
i
<
rdev
->
desc
->
n_linear_ranges
;
i
++
)
{
if
(
rdev
->
desc
->
linear_range_selectors
[
i
]
==
rval
)
return
i
;
}
return
-
EINVAL
;
}
/**
* regulator_get_voltage_sel_pickable_regmap - pickable range get_voltage_sel
*
* @rdev: regulator to operate on
*
* Regulators that use regmap for their register I/O and use pickable
* ranges can set the vsel_reg, vsel_mask, vsel_range_reg and vsel_range_mask
* fields in their descriptor and then use this as their get_voltage_vsel
* operation, saving some code.
*/
int
regulator_get_voltage_sel_pickable_regmap
(
struct
regulator_dev
*
rdev
)
{
unsigned
int
r_val
;
int
range
;
unsigned
int
val
;
int
ret
,
i
;
unsigned
int
voltages_in_range
=
0
;
if
(
!
rdev
->
desc
->
linear_ranges
)
return
-
EINVAL
;
ret
=
regmap_read
(
rdev
->
regmap
,
rdev
->
desc
->
vsel_reg
,
&
val
);
if
(
ret
!=
0
)
return
ret
;
ret
=
regmap_read
(
rdev
->
regmap
,
rdev
->
desc
->
vsel_range_reg
,
&
r_val
);
if
(
ret
!=
0
)
return
ret
;
val
&=
rdev
->
desc
->
vsel_mask
;
val
>>=
ffs
(
rdev
->
desc
->
vsel_mask
)
-
1
;
range
=
regulator_range_selector_to_index
(
rdev
,
r_val
);
if
(
range
<
0
)
return
-
EINVAL
;
for
(
i
=
0
;
i
<
range
;
i
++
)
voltages_in_range
+=
(
rdev
->
desc
->
linear_ranges
[
i
].
max_sel
-
rdev
->
desc
->
linear_ranges
[
i
].
min_sel
)
+
1
;
return
val
+
voltages_in_range
;
}
EXPORT_SYMBOL_GPL
(
regulator_get_voltage_sel_pickable_regmap
);
/**
* regulator_set_voltage_sel_pickable_regmap - pickable range set_voltage_sel
*
* @rdev: regulator to operate on
* @sel: Selector to set
*
* Regulators that use regmap for their register I/O and use pickable
* ranges can set the vsel_reg, vsel_mask, vsel_range_reg and vsel_range_mask
* fields in their descriptor and then use this as their set_voltage_vsel
* operation, saving some code.
*/
int
regulator_set_voltage_sel_pickable_regmap
(
struct
regulator_dev
*
rdev
,
unsigned
int
sel
)
{
unsigned
int
range
;
int
ret
,
i
;
unsigned
int
voltages_in_range
=
0
;
for
(
i
=
0
;
i
<
rdev
->
desc
->
n_linear_ranges
;
i
++
)
{
voltages_in_range
=
(
rdev
->
desc
->
linear_ranges
[
i
].
max_sel
-
rdev
->
desc
->
linear_ranges
[
i
].
min_sel
)
+
1
;
if
(
sel
<
voltages_in_range
)
break
;
sel
-=
voltages_in_range
;
}
if
(
i
==
rdev
->
desc
->
n_linear_ranges
)
return
-
EINVAL
;
sel
<<=
ffs
(
rdev
->
desc
->
vsel_mask
)
-
1
;
sel
+=
rdev
->
desc
->
linear_ranges
[
i
].
min_sel
;
range
=
rdev
->
desc
->
linear_range_selectors
[
i
];
if
(
rdev
->
desc
->
vsel_reg
==
rdev
->
desc
->
vsel_range_reg
)
{
ret
=
regmap_update_bits
(
rdev
->
regmap
,
rdev
->
desc
->
vsel_reg
,
rdev
->
desc
->
vsel_range_mask
|
rdev
->
desc
->
vsel_mask
,
sel
|
range
);
}
else
{
ret
=
regmap_update_bits
(
rdev
->
regmap
,
rdev
->
desc
->
vsel_range_reg
,
rdev
->
desc
->
vsel_range_mask
,
range
);
if
(
ret
)
return
ret
;
ret
=
regmap_update_bits
(
rdev
->
regmap
,
rdev
->
desc
->
vsel_reg
,
rdev
->
desc
->
vsel_mask
,
sel
);
}
if
(
ret
)
return
ret
;
if
(
rdev
->
desc
->
apply_bit
)
ret
=
regmap_update_bits
(
rdev
->
regmap
,
rdev
->
desc
->
apply_reg
,
rdev
->
desc
->
apply_bit
,
rdev
->
desc
->
apply_bit
);
return
ret
;
}
EXPORT_SYMBOL_GPL
(
regulator_set_voltage_sel_pickable_regmap
);
/**
* regulator_get_voltage_sel_regmap - standard get_voltage_sel for regmap users
*
...
...
@@ -321,20 +443,91 @@ int regulator_map_voltage_linear_range(struct regulator_dev *rdev,
ret
+=
range
->
min_sel
;
break
;
/*
* Map back into a voltage to verify we're still in bounds.
* If we are not, then continue checking rest of the ranges.
*/
voltage
=
rdev
->
desc
->
ops
->
list_voltage
(
rdev
,
ret
);
if
(
voltage
>=
min_uV
&&
voltage
<=
max_uV
)
break
;
}
if
(
i
==
rdev
->
desc
->
n_linear_ranges
)
return
-
EINVAL
;
/* Map back into a voltage to verify we're still in bounds */
voltage
=
rdev
->
desc
->
ops
->
list_voltage
(
rdev
,
ret
);
if
(
voltage
<
min_uV
||
voltage
>
max_uV
)
return
ret
;
}
EXPORT_SYMBOL_GPL
(
regulator_map_voltage_linear_range
);
/**
* regulator_map_voltage_pickable_linear_range - map_voltage, pickable ranges
*
* @rdev: Regulator to operate on
* @min_uV: Lower bound for voltage
* @max_uV: Upper bound for voltage
*
* Drivers providing pickable linear_ranges in their descriptor can use
* this as their map_voltage() callback.
*/
int
regulator_map_voltage_pickable_linear_range
(
struct
regulator_dev
*
rdev
,
int
min_uV
,
int
max_uV
)
{
const
struct
regulator_linear_range
*
range
;
int
ret
=
-
EINVAL
;
int
voltage
,
i
;
unsigned
int
selector
=
0
;
if
(
!
rdev
->
desc
->
n_linear_ranges
)
{
BUG_ON
(
!
rdev
->
desc
->
n_linear_ranges
);
return
-
EINVAL
;
}
for
(
i
=
0
;
i
<
rdev
->
desc
->
n_linear_ranges
;
i
++
)
{
int
linear_max_uV
;
range
=
&
rdev
->
desc
->
linear_ranges
[
i
];
linear_max_uV
=
range
->
min_uV
+
(
range
->
max_sel
-
range
->
min_sel
)
*
range
->
uV_step
;
if
(
!
(
min_uV
<=
linear_max_uV
&&
max_uV
>=
range
->
min_uV
))
{
selector
+=
(
range
->
max_sel
-
range
->
min_sel
+
1
);
continue
;
}
if
(
min_uV
<=
range
->
min_uV
)
min_uV
=
range
->
min_uV
;
/* range->uV_step == 0 means fixed voltage range */
if
(
range
->
uV_step
==
0
)
{
ret
=
0
;
}
else
{
ret
=
DIV_ROUND_UP
(
min_uV
-
range
->
min_uV
,
range
->
uV_step
);
if
(
ret
<
0
)
return
ret
;
}
ret
+=
selector
;
voltage
=
rdev
->
desc
->
ops
->
list_voltage
(
rdev
,
ret
);
/*
* Map back into a voltage to verify we're still in bounds.
* We may have overlapping voltage ranges. Hence we don't
* exit but retry until we have checked all ranges.
*/
if
(
voltage
<
min_uV
||
voltage
>
max_uV
)
selector
+=
(
range
->
max_sel
-
range
->
min_sel
+
1
);
else
break
;
}
if
(
i
==
rdev
->
desc
->
n_linear_ranges
)
return
-
EINVAL
;
return
ret
;
}
EXPORT_SYMBOL_GPL
(
regulator_map_voltage_linear_range
);
EXPORT_SYMBOL_GPL
(
regulator_map_voltage_
pickable_
linear_range
);
/**
* regulator_list_voltage_linear - List voltages with simple calculation
...
...
@@ -360,6 +553,46 @@ int regulator_list_voltage_linear(struct regulator_dev *rdev,
}
EXPORT_SYMBOL_GPL
(
regulator_list_voltage_linear
);
/**
* regulator_list_voltage_pickable_linear_range - pickable range list voltages
*
* @rdev: Regulator device
* @selector: Selector to convert into a voltage
*
* list_voltage() operation, intended to be used by drivers utilizing pickable
* ranges helpers.
*/
int
regulator_list_voltage_pickable_linear_range
(
struct
regulator_dev
*
rdev
,
unsigned
int
selector
)
{
const
struct
regulator_linear_range
*
range
;
int
i
;
unsigned
int
all_sels
=
0
;
if
(
!
rdev
->
desc
->
n_linear_ranges
)
{
BUG_ON
(
!
rdev
->
desc
->
n_linear_ranges
);
return
-
EINVAL
;
}
for
(
i
=
0
;
i
<
rdev
->
desc
->
n_linear_ranges
;
i
++
)
{
unsigned
int
sels_in_range
;
range
=
&
rdev
->
desc
->
linear_ranges
[
i
];
sels_in_range
=
range
->
max_sel
-
range
->
min_sel
;
if
(
all_sels
+
sels_in_range
>=
selector
)
{
selector
-=
all_sels
;
return
range
->
min_uV
+
(
range
->
uV_step
*
selector
);
}
all_sels
+=
(
sels_in_range
+
1
);
}
return
-
EINVAL
;
}
EXPORT_SYMBOL_GPL
(
regulator_list_voltage_pickable_linear_range
);
/**
* regulator_list_voltage_linear_range - List voltages for linear ranges
*
...
...
drivers/regulator/isl9305.c
View file @
4fd1f509
...
...
@@ -84,6 +84,7 @@ static const struct regulator_desc isl9305_regulators[] = {
.
enable_mask
=
ISL9305_DCD1_EN
,
.
supply_name
=
"VINDCD1"
,
.
ops
=
&
isl9305_ops
,
.
owner
=
THIS_MODULE
,
},
[
ISL9305_DCD2
]
=
{
.
name
=
"DCD2"
,
...
...
@@ -98,6 +99,7 @@ static const struct regulator_desc isl9305_regulators[] = {
.
enable_mask
=
ISL9305_DCD2_EN
,
.
supply_name
=
"VINDCD2"
,
.
ops
=
&
isl9305_ops
,
.
owner
=
THIS_MODULE
,
},
[
ISL9305_LDO1
]
=
{
.
name
=
"LDO1"
,
...
...
@@ -112,6 +114,7 @@ static const struct regulator_desc isl9305_regulators[] = {
.
enable_mask
=
ISL9305_LDO1_EN
,
.
supply_name
=
"VINLDO1"
,
.
ops
=
&
isl9305_ops
,
.
owner
=
THIS_MODULE
,
},
[
ISL9305_LDO2
]
=
{
.
name
=
"LDO2"
,
...
...
@@ -126,6 +129,7 @@ static const struct regulator_desc isl9305_regulators[] = {
.
enable_mask
=
ISL9305_LDO2_EN
,
.
supply_name
=
"VINLDO2"
,
.
ops
=
&
isl9305_ops
,
.
owner
=
THIS_MODULE
,
},
};
...
...
drivers/regulator/lm363x-regulator.c
View file @
4fd1f509
...
...
@@ -227,9 +227,11 @@ static struct gpio_desc *lm363x_regulator_of_get_enable_gpio(struct device *dev,
*/
switch
(
id
)
{
case
LM3632_LDO_POS
:
return
devm_gpiod_get_index_optional
(
dev
,
"enable"
,
0
,
GPIOD_OUT_LOW
);
return
devm_gpiod_get_index_optional
(
dev
,
"enable"
,
0
,
GPIOD_OUT_LOW
|
GPIOD_FLAGS_BIT_NONEXCLUSIVE
);
case
LM3632_LDO_NEG
:
return
devm_gpiod_get_index_optional
(
dev
,
"enable"
,
1
,
GPIOD_OUT_LOW
);
return
devm_gpiod_get_index_optional
(
dev
,
"enable"
,
1
,
GPIOD_OUT_LOW
|
GPIOD_FLAGS_BIT_NONEXCLUSIVE
);
default:
return
NULL
;
}
...
...
drivers/regulator/lochnagar-regulator.c
0 → 100644
View file @
4fd1f509
// SPDX-License-Identifier: GPL-2.0
//
// Lochnagar regulator driver
//
// Copyright (c) 2017-2018 Cirrus Logic, Inc. and
// Cirrus Logic International Semiconductor Ltd.
//
// Author: Charles Keepax <ckeepax@opensource.cirrus.com>
#include <linux/bitops.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/of_regulator.h>
#include <linux/mfd/lochnagar.h>
static
const
struct
regulator_ops
lochnagar_micvdd_ops
=
{
.
enable
=
regulator_enable_regmap
,
.
disable
=
regulator_disable_regmap
,
.
is_enabled
=
regulator_is_enabled_regmap
,
.
list_voltage
=
regulator_list_voltage_linear_range
,
.
map_voltage
=
regulator_map_voltage_linear_range
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
set_voltage_sel
=
regulator_set_voltage_sel_regmap
,
};
static
const
struct
regulator_linear_range
lochnagar_micvdd_ranges
[]
=
{
REGULATOR_LINEAR_RANGE
(
1000000
,
0
,
0xC
,
50000
),
REGULATOR_LINEAR_RANGE
(
1700000
,
0xD
,
0x1F
,
100000
),
};
static
int
lochnagar_micbias_enable
(
struct
regulator_dev
*
rdev
)
{
struct
lochnagar
*
lochnagar
=
rdev_get_drvdata
(
rdev
);
int
ret
;
mutex_lock
(
&
lochnagar
->
analogue_config_lock
);
ret
=
regulator_enable_regmap
(
rdev
);
if
(
ret
<
0
)
goto
err
;
ret
=
lochnagar_update_config
(
lochnagar
);
err:
mutex_unlock
(
&
lochnagar
->
analogue_config_lock
);
return
ret
;
}
static
int
lochnagar_micbias_disable
(
struct
regulator_dev
*
rdev
)
{
struct
lochnagar
*
lochnagar
=
rdev_get_drvdata
(
rdev
);
int
ret
;
mutex_lock
(
&
lochnagar
->
analogue_config_lock
);
ret
=
regulator_disable_regmap
(
rdev
);
if
(
ret
<
0
)
goto
err
;
ret
=
lochnagar_update_config
(
lochnagar
);
err:
mutex_unlock
(
&
lochnagar
->
analogue_config_lock
);
return
ret
;
}
static
const
struct
regulator_ops
lochnagar_micbias_ops
=
{
.
enable
=
lochnagar_micbias_enable
,
.
disable
=
lochnagar_micbias_disable
,
.
is_enabled
=
regulator_is_enabled_regmap
,
};
static
const
struct
regulator_ops
lochnagar_vddcore_ops
=
{
.
enable
=
regulator_enable_regmap
,
.
disable
=
regulator_disable_regmap
,
.
is_enabled
=
regulator_is_enabled_regmap
,
.
list_voltage
=
regulator_list_voltage_linear_range
,
.
map_voltage
=
regulator_map_voltage_linear_range
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
set_voltage_sel
=
regulator_set_voltage_sel_regmap
,
};
static
const
struct
regulator_linear_range
lochnagar_vddcore_ranges
[]
=
{
REGULATOR_LINEAR_RANGE
(
600000
,
0x8
,
0x41
,
12500
),
};
enum
lochnagar_regulators
{
LOCHNAGAR_MICVDD
,
LOCHNAGAR_MIC1VDD
,
LOCHNAGAR_MIC2VDD
,
LOCHNAGAR_VDDCORE
,
};
static
int
lochnagar_micbias_of_parse
(
struct
device_node
*
np
,
const
struct
regulator_desc
*
desc
,
struct
regulator_config
*
config
)
{
struct
lochnagar
*
lochnagar
=
config
->
driver_data
;
int
shift
=
(
desc
->
id
-
LOCHNAGAR_MIC1VDD
)
*
LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT
;
int
mask
=
LOCHNAGAR2_P1_MICBIAS_SRC_MASK
<<
shift
;
unsigned
int
val
;
int
ret
;
ret
=
of_property_read_u32
(
np
,
"cirrus,micbias-input"
,
&
val
);
if
(
ret
>=
0
)
{
mutex_lock
(
&
lochnagar
->
analogue_config_lock
);
ret
=
regmap_update_bits
(
lochnagar
->
regmap
,
LOCHNAGAR2_ANALOGUE_PATH_CTRL2
,
mask
,
val
<<
shift
);
mutex_unlock
(
&
lochnagar
->
analogue_config_lock
);
if
(
ret
<
0
)
{
dev_err
(
lochnagar
->
dev
,
"Failed to update micbias source: %d
\n
"
,
ret
);
return
ret
;
}
}
return
0
;
}
static
const
struct
regulator_desc
lochnagar_regulators
[]
=
{
[
LOCHNAGAR_MICVDD
]
=
{
.
name
=
"MICVDD"
,
.
supply_name
=
"SYSVDD"
,
.
type
=
REGULATOR_VOLTAGE
,
.
n_voltages
=
32
,
.
ops
=
&
lochnagar_micvdd_ops
,
.
id
=
LOCHNAGAR_MICVDD
,
.
of_match
=
of_match_ptr
(
"MICVDD"
),
.
enable_reg
=
LOCHNAGAR2_MICVDD_CTRL1
,
.
enable_mask
=
LOCHNAGAR2_MICVDD_REG_ENA_MASK
,
.
vsel_reg
=
LOCHNAGAR2_MICVDD_CTRL2
,
.
vsel_mask
=
LOCHNAGAR2_MICVDD_VSEL_MASK
,
.
linear_ranges
=
lochnagar_micvdd_ranges
,
.
n_linear_ranges
=
ARRAY_SIZE
(
lochnagar_micvdd_ranges
),
.
enable_time
=
3000
,
.
ramp_delay
=
1000
,
.
owner
=
THIS_MODULE
,
},
[
LOCHNAGAR_MIC1VDD
]
=
{
.
name
=
"MIC1VDD"
,
.
supply_name
=
"MICBIAS1"
,
.
type
=
REGULATOR_VOLTAGE
,
.
ops
=
&
lochnagar_micbias_ops
,
.
id
=
LOCHNAGAR_MIC1VDD
,
.
of_match
=
of_match_ptr
(
"MIC1VDD"
),
.
of_parse_cb
=
lochnagar_micbias_of_parse
,
.
enable_reg
=
LOCHNAGAR2_ANALOGUE_PATH_CTRL2
,
.
enable_mask
=
LOCHNAGAR2_P1_INPUT_BIAS_ENA_MASK
,
.
owner
=
THIS_MODULE
,
},
[
LOCHNAGAR_MIC2VDD
]
=
{
.
name
=
"MIC2VDD"
,
.
supply_name
=
"MICBIAS2"
,
.
type
=
REGULATOR_VOLTAGE
,
.
ops
=
&
lochnagar_micbias_ops
,
.
id
=
LOCHNAGAR_MIC2VDD
,
.
of_match
=
of_match_ptr
(
"MIC2VDD"
),
.
of_parse_cb
=
lochnagar_micbias_of_parse
,
.
enable_reg
=
LOCHNAGAR2_ANALOGUE_PATH_CTRL2
,
.
enable_mask
=
LOCHNAGAR2_P2_INPUT_BIAS_ENA_MASK
,
.
owner
=
THIS_MODULE
,
},
[
LOCHNAGAR_VDDCORE
]
=
{
.
name
=
"VDDCORE"
,
.
supply_name
=
"SYSVDD"
,
.
type
=
REGULATOR_VOLTAGE
,
.
n_voltages
=
57
,
.
ops
=
&
lochnagar_vddcore_ops
,
.
id
=
LOCHNAGAR_VDDCORE
,
.
of_match
=
of_match_ptr
(
"VDDCORE"
),
.
enable_reg
=
LOCHNAGAR2_VDDCORE_CDC_CTRL1
,
.
enable_mask
=
LOCHNAGAR2_VDDCORE_CDC_REG_ENA_MASK
,
.
vsel_reg
=
LOCHNAGAR2_VDDCORE_CDC_CTRL2
,
.
vsel_mask
=
LOCHNAGAR2_VDDCORE_CDC_VSEL_MASK
,
.
linear_ranges
=
lochnagar_vddcore_ranges
,
.
n_linear_ranges
=
ARRAY_SIZE
(
lochnagar_vddcore_ranges
),
.
enable_time
=
3000
,
.
ramp_delay
=
1000
,
.
owner
=
THIS_MODULE
,
},
};
static
int
lochnagar_regulator_probe
(
struct
platform_device
*
pdev
)
{
struct
device
*
dev
=
&
pdev
->
dev
;
struct
lochnagar
*
lochnagar
=
dev_get_drvdata
(
dev
->
parent
);
struct
regulator_config
config
=
{
};
struct
regulator_dev
*
rdev
;
int
ret
,
i
;
config
.
dev
=
lochnagar
->
dev
;
config
.
regmap
=
lochnagar
->
regmap
;
config
.
driver_data
=
lochnagar
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
lochnagar_regulators
);
i
++
)
{
const
struct
regulator_desc
*
desc
=
&
lochnagar_regulators
[
i
];
rdev
=
devm_regulator_register
(
dev
,
desc
,
&
config
);
if
(
IS_ERR
(
rdev
))
{
ret
=
PTR_ERR
(
rdev
);
dev_err
(
dev
,
"Failed to register %s regulator: %d
\n
"
,
desc
->
name
,
ret
);
return
ret
;
}
}
return
0
;
}
static
struct
platform_driver
lochnagar_regulator_driver
=
{
.
driver
=
{
.
name
=
"lochnagar-regulator"
,
},
.
probe
=
lochnagar_regulator_probe
,
};
module_platform_driver
(
lochnagar_regulator_driver
);
MODULE_AUTHOR
(
"Charles Keepax <ckeepax@opensource.cirrus.com>"
);
MODULE_DESCRIPTION
(
"Regulator driver for Cirrus Logic Lochnagar Board"
);
MODULE_LICENSE
(
"GPL v2"
);
MODULE_ALIAS
(
"platform:lochnagar-regulator"
);
drivers/regulator/lp8788-ldo.c
View file @
4fd1f509
...
...
@@ -503,9 +503,10 @@ static int lp8788_config_ldo_enable_mode(struct platform_device *pdev,
/* FIXME: check default mode for GPIO here: high or low? */
ldo
->
ena_gpiod
=
devm_gpiod_get_index_optional
(
&
pdev
->
dev
,
"enable"
,
enable_id
,
GPIOD_OUT_HIGH
);
"enable"
,
enable_id
,
GPIOD_OUT_HIGH
|
GPIOD_FLAGS_BIT_NONEXCLUSIVE
);
if
(
IS_ERR
(
ldo
->
ena_gpiod
))
return
PTR_ERR
(
ldo
->
ena_gpiod
);
...
...
drivers/regulator/max8952.c
View file @
4fd1f509
...
...
@@ -230,6 +230,7 @@ static int max8952_pmic_probe(struct i2c_client *client,
gflags
=
GPIOD_OUT_HIGH
;
else
gflags
=
GPIOD_OUT_LOW
;
gflags
|=
GPIOD_FLAGS_BIT_NONEXCLUSIVE
;
gpiod
=
devm_gpiod_get_optional
(
&
client
->
dev
,
"max8952,en"
,
gflags
);
...
...
drivers/regulator/max8973-regulator.c
View file @
4fd1f509
...
...
@@ -758,6 +758,7 @@ static int max8973_probe(struct i2c_client *client,
gflags
=
GPIOD_OUT_HIGH
;
else
gflags
=
GPIOD_OUT_LOW
;
gflags
|=
GPIOD_FLAGS_BIT_NONEXCLUSIVE
;
gpiod
=
devm_gpiod_get_optional
(
&
client
->
dev
,
"maxim,enable"
,
gflags
);
...
...
drivers/regulator/max8997-regulator.c
View file @
4fd1f509
...
...
@@ -929,8 +929,8 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev,
break
;
if
(
i
==
ARRAY_SIZE
(
regulators
))
{
dev_warn
(
&
pdev
->
dev
,
"don't know how to configure regulator %
s
\n
"
,
reg_np
->
name
);
dev_warn
(
&
pdev
->
dev
,
"don't know how to configure regulator %
pOFn
\n
"
,
reg_np
);
continue
;
}
...
...
drivers/regulator/mc13xxx-regulator-core.c
View file @
4fd1f509
...
...
@@ -203,7 +203,7 @@ struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt(
if
(
!
found
)
dev_warn
(
&
pdev
->
dev
,
"Unknown regulator: %
s
\n
"
,
child
->
name
);
"Unknown regulator: %
pOFn
\n
"
,
child
);
}
of_node_put
(
parent
);
...
...
drivers/regulator/of_regulator.c
View file @
4fd1f509
...
...
@@ -95,8 +95,8 @@ static void of_get_regulation_constraints(struct device_node *np,
if
(
!
ret
)
constraints
->
settling_time_up
=
pval
;
if
(
constraints
->
settling_time_up
&&
constraints
->
settling_time
)
{
pr_warn
(
"%
s
: ambiguous configuration for settling time, ignoring 'regulator-settling-time-up-us'
\n
"
,
np
->
name
);
pr_warn
(
"%
pOFn
: ambiguous configuration for settling time, ignoring 'regulator-settling-time-up-us'
\n
"
,
np
);
constraints
->
settling_time_up
=
0
;
}
...
...
@@ -105,8 +105,8 @@ static void of_get_regulation_constraints(struct device_node *np,
if
(
!
ret
)
constraints
->
settling_time_down
=
pval
;
if
(
constraints
->
settling_time_down
&&
constraints
->
settling_time
)
{
pr_warn
(
"%
s
: ambiguous configuration for settling time, ignoring 'regulator-settling-time-down-us'
\n
"
,
np
->
name
);
pr_warn
(
"%
pOFn
: ambiguous configuration for settling time, ignoring 'regulator-settling-time-down-us'
\n
"
,
np
);
constraints
->
settling_time_down
=
0
;
}
...
...
@@ -127,12 +127,12 @@ static void of_get_regulation_constraints(struct device_node *np,
if
(
desc
&&
desc
->
of_map_mode
)
{
mode
=
desc
->
of_map_mode
(
pval
);
if
(
mode
==
REGULATOR_MODE_INVALID
)
pr_err
(
"%
s: invalid mode %u
\n
"
,
np
->
name
,
pval
);
pr_err
(
"%
pOFn: invalid mode %u
\n
"
,
np
,
pval
);
else
constraints
->
initial_mode
=
mode
;
}
else
{
pr_warn
(
"%
s
: mapping for mode %d not defined
\n
"
,
np
->
name
,
pval
);
pr_warn
(
"%
pOFn
: mapping for mode %d not defined
\n
"
,
np
,
pval
);
}
}
...
...
@@ -144,14 +144,14 @@ static void of_get_regulation_constraints(struct device_node *np,
ret
=
of_property_read_u32_index
(
np
,
"regulator-allowed-modes"
,
i
,
&
pval
);
if
(
ret
)
{
pr_err
(
"%
s
: couldn't read allowed modes index %d, ret=%d
\n
"
,
np
->
name
,
i
,
ret
);
pr_err
(
"%
pOFn
: couldn't read allowed modes index %d, ret=%d
\n
"
,
np
,
i
,
ret
);
break
;
}
mode
=
desc
->
of_map_mode
(
pval
);
if
(
mode
==
REGULATOR_MODE_INVALID
)
pr_err
(
"%
s
: invalid regulator-allowed-modes element %u
\n
"
,
np
->
name
,
pval
);
pr_err
(
"%
pOFn
: invalid regulator-allowed-modes element %u
\n
"
,
np
,
pval
);
else
constraints
->
valid_modes_mask
|=
mode
;
}
...
...
@@ -159,7 +159,7 @@ static void of_get_regulation_constraints(struct device_node *np,
constraints
->
valid_ops_mask
|=
REGULATOR_CHANGE_MODE
;
}
else
{
pr_warn
(
"%
s: mode mapping not defined
\n
"
,
np
->
name
);
pr_warn
(
"%
pOFn: mode mapping not defined
\n
"
,
np
);
}
}
...
...
@@ -197,13 +197,13 @@ static void of_get_regulation_constraints(struct device_node *np,
if
(
desc
&&
desc
->
of_map_mode
)
{
mode
=
desc
->
of_map_mode
(
pval
);
if
(
mode
==
REGULATOR_MODE_INVALID
)
pr_err
(
"%
s
: invalid mode %u
\n
"
,
np
->
name
,
pval
);
pr_err
(
"%
pOFn
: invalid mode %u
\n
"
,
np
,
pval
);
else
suspend_state
->
mode
=
mode
;
}
else
{
pr_warn
(
"%
s
: mapping for mode %d not defined
\n
"
,
np
->
name
,
pval
);
pr_warn
(
"%
pOFn
: mapping for mode %d not defined
\n
"
,
np
,
pval
);
}
}
...
...
@@ -349,8 +349,8 @@ int of_regulator_match(struct device *dev, struct device_node *node,
match
->
desc
);
if
(
!
match
->
init_data
)
{
dev_err
(
dev
,
"failed to parse DT for regulator %
s
\n
"
,
child
->
name
);
"failed to parse DT for regulator %
pOFn
\n
"
,
child
);
of_node_put
(
child
);
return
-
EINVAL
;
}
...
...
@@ -399,16 +399,16 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
init_data
=
of_get_regulator_init_data
(
dev
,
child
,
desc
);
if
(
!
init_data
)
{
dev_err
(
dev
,
"failed to parse DT for regulator %
s
\n
"
,
child
->
name
);
"failed to parse DT for regulator %
pOFn
\n
"
,
child
);
break
;
}
if
(
desc
->
of_parse_cb
)
{
if
(
desc
->
of_parse_cb
(
child
,
desc
,
config
))
{
dev_err
(
dev
,
"driver callback failed to parse DT for regulator %
s
\n
"
,
child
->
name
);
"driver callback failed to parse DT for regulator %
pOFn
\n
"
,
child
);
init_data
=
NULL
;
break
;
}
...
...
drivers/regulator/qcom-rpmh-regulator.c
View file @
4fd1f509
...
...
@@ -414,7 +414,7 @@ static int rpmh_regulator_init_vreg(struct rpmh_vreg *vreg, struct device *dev,
break
;
if
(
!
rpmh_data
->
name
)
{
dev_err
(
dev
,
"Unknown regulator %
s
\n
"
,
node
->
nam
e
);
dev_err
(
dev
,
"Unknown regulator %
pOFn
\n
"
,
nod
e
);
return
-
EINVAL
;
}
...
...
@@ -423,8 +423,8 @@ static int rpmh_regulator_init_vreg(struct rpmh_vreg *vreg, struct device *dev,
vreg
->
addr
=
cmd_db_read_addr
(
rpmh_resource_name
);
if
(
!
vreg
->
addr
)
{
dev_err
(
dev
,
"%
s
: could not find RPMh address for resource %s
\n
"
,
node
->
name
,
rpmh_resource_name
);
dev_err
(
dev
,
"%
pOFn
: could not find RPMh address for resource %s
\n
"
,
node
,
rpmh_resource_name
);
return
-
ENODEV
;
}
...
...
@@ -469,13 +469,13 @@ static int rpmh_regulator_init_vreg(struct rpmh_vreg *vreg, struct device *dev,
rdev
=
devm_regulator_register
(
dev
,
&
vreg
->
rdesc
,
&
reg_config
);
if
(
IS_ERR
(
rdev
))
{
ret
=
PTR_ERR
(
rdev
);
dev_err
(
dev
,
"%
s
: devm_regulator_register() failed, ret=%d
\n
"
,
node
->
name
,
ret
);
dev_err
(
dev
,
"%
pOFn
: devm_regulator_register() failed, ret=%d
\n
"
,
node
,
ret
);
return
ret
;
}
dev_dbg
(
dev
,
"%
s
regulator registered for RPMh resource %s @ 0x%05X
\n
"
,
node
->
name
,
rpmh_resource_name
,
vreg
->
addr
);
dev_dbg
(
dev
,
"%
pOFn
regulator registered for RPMh resource %s @ 0x%05X
\n
"
,
node
,
rpmh_resource_name
,
vreg
->
addr
);
return
0
;
}
...
...
@@ -504,6 +504,7 @@ static unsigned int rpmh_regulator_pmic4_ldo_of_map_mode(unsigned int rpmh_mode)
break
;
default:
mode
=
REGULATOR_MODE_INVALID
;
break
;
}
return
mode
;
...
...
@@ -537,6 +538,7 @@ rpmh_regulator_pmic4_smps_of_map_mode(unsigned int rpmh_mode)
break
;
default:
mode
=
REGULATOR_MODE_INVALID
;
break
;
}
return
mode
;
...
...
@@ -566,6 +568,7 @@ static unsigned int rpmh_regulator_pmic4_bob_of_map_mode(unsigned int rpmh_mode)
break
;
default:
mode
=
REGULATOR_MODE_INVALID
;
break
;
}
return
mode
;
...
...
drivers/regulator/qcom_smd-regulator.c
View file @
4fd1f509
...
...
@@ -420,6 +420,60 @@ static const struct regulator_desc pmi8998_bob = {
.
ops
=
&
rpm_bob_ops
,
};
static
const
struct
regulator_desc
pms405_hfsmps3
=
{
.
linear_ranges
=
(
struct
regulator_linear_range
[])
{
REGULATOR_LINEAR_RANGE
(
320000
,
0
,
215
,
8000
),
},
.
n_linear_ranges
=
1
,
.
n_voltages
=
216
,
.
ops
=
&
rpm_smps_ldo_ops
,
};
static
const
struct
regulator_desc
pms405_nldo300
=
{
.
linear_ranges
=
(
struct
regulator_linear_range
[])
{
REGULATOR_LINEAR_RANGE
(
312000
,
0
,
127
,
8000
),
},
.
n_linear_ranges
=
1
,
.
n_voltages
=
128
,
.
ops
=
&
rpm_smps_ldo_ops
,
};
static
const
struct
regulator_desc
pms405_nldo1200
=
{
.
linear_ranges
=
(
struct
regulator_linear_range
[])
{
REGULATOR_LINEAR_RANGE
(
312000
,
0
,
127
,
8000
),
},
.
n_linear_ranges
=
1
,
.
n_voltages
=
128
,
.
ops
=
&
rpm_smps_ldo_ops
,
};
static
const
struct
regulator_desc
pms405_pldo50
=
{
.
linear_ranges
=
(
struct
regulator_linear_range
[])
{
REGULATOR_LINEAR_RANGE
(
1664000
,
0
,
128
,
16000
),
},
.
n_linear_ranges
=
1
,
.
n_voltages
=
129
,
.
ops
=
&
rpm_smps_ldo_ops
,
};
static
const
struct
regulator_desc
pms405_pldo150
=
{
.
linear_ranges
=
(
struct
regulator_linear_range
[])
{
REGULATOR_LINEAR_RANGE
(
1664000
,
0
,
128
,
16000
),
},
.
n_linear_ranges
=
1
,
.
n_voltages
=
129
,
.
ops
=
&
rpm_smps_ldo_ops
,
};
static
const
struct
regulator_desc
pms405_pldo600
=
{
.
linear_ranges
=
(
struct
regulator_linear_range
[])
{
REGULATOR_LINEAR_RANGE
(
1256000
,
0
,
98
,
8000
),
},
.
n_linear_ranges
=
1
,
.
n_voltages
=
99
,
.
ops
=
&
rpm_smps_ldo_ops
,
};
struct
rpm_regulator_data
{
const
char
*
name
;
u32
type
;
...
...
@@ -661,6 +715,28 @@ static const struct rpm_regulator_data rpm_pmi8998_regulators[] = {
{}
};
static
const
struct
rpm_regulator_data
rpm_pms405_regulators
[]
=
{
{
"s1"
,
QCOM_SMD_RPM_SMPA
,
1
,
&
pms405_hfsmps3
,
"vdd_s1"
},
{
"s2"
,
QCOM_SMD_RPM_SMPA
,
2
,
&
pms405_hfsmps3
,
"vdd_s2"
},
{
"s3"
,
QCOM_SMD_RPM_SMPA
,
3
,
&
pms405_hfsmps3
,
"vdd_s3"
},
{
"s4"
,
QCOM_SMD_RPM_SMPA
,
4
,
&
pms405_hfsmps3
,
"vdd_s4"
},
{
"s5"
,
QCOM_SMD_RPM_SMPA
,
5
,
&
pms405_hfsmps3
,
"vdd_s5"
},
{
"l1"
,
QCOM_SMD_RPM_LDOA
,
1
,
&
pms405_nldo1200
,
"vdd_l1_l2"
},
{
"l2"
,
QCOM_SMD_RPM_LDOA
,
2
,
&
pms405_nldo1200
,
"vdd_l1_l2"
},
{
"l3"
,
QCOM_SMD_RPM_LDOA
,
3
,
&
pms405_nldo1200
,
"vdd_l3_l8"
},
{
"l4"
,
QCOM_SMD_RPM_LDOA
,
4
,
&
pms405_nldo300
,
"vdd_l4"
},
{
"l5"
,
QCOM_SMD_RPM_LDOA
,
5
,
&
pms405_pldo600
,
"vdd_l5_l6"
},
{
"l6"
,
QCOM_SMD_RPM_LDOA
,
6
,
&
pms405_pldo600
,
"vdd_l5_l6"
},
{
"l7"
,
QCOM_SMD_RPM_LDOA
,
7
,
&
pms405_pldo150
,
"vdd_l7"
},
{
"l8"
,
QCOM_SMD_RPM_LDOA
,
8
,
&
pms405_nldo1200
,
"vdd_l3_l8"
},
{
"l9"
,
QCOM_SMD_RPM_LDOA
,
9
,
&
pms405_nldo1200
,
"vdd_l9"
},
{
"l10"
,
QCOM_SMD_RPM_LDOA
,
10
,
&
pms405_pldo50
,
"vdd_l10_l11_l12_l13"
},
{
"l11"
,
QCOM_SMD_RPM_LDOA
,
11
,
&
pms405_pldo150
,
"vdd_l10_l11_l12_l13"
},
{
"l12"
,
QCOM_SMD_RPM_LDOA
,
12
,
&
pms405_pldo150
,
"vdd_l10_l11_l12_l13"
},
{
"l13"
,
QCOM_SMD_RPM_LDOA
,
13
,
&
pms405_pldo150
,
"vdd_l10_l11_l12_l13"
},
{}
};
static
const
struct
of_device_id
rpm_of_match
[]
=
{
{
.
compatible
=
"qcom,rpm-pm8841-regulators"
,
.
data
=
&
rpm_pm8841_regulators
},
{
.
compatible
=
"qcom,rpm-pm8916-regulators"
,
.
data
=
&
rpm_pm8916_regulators
},
...
...
@@ -669,6 +745,7 @@ static const struct of_device_id rpm_of_match[] = {
{
.
compatible
=
"qcom,rpm-pm8998-regulators"
,
.
data
=
&
rpm_pm8998_regulators
},
{
.
compatible
=
"qcom,rpm-pma8084-regulators"
,
.
data
=
&
rpm_pma8084_regulators
},
{
.
compatible
=
"qcom,rpm-pmi8998-regulators"
,
.
data
=
&
rpm_pmi8998_regulators
},
{
.
compatible
=
"qcom,rpm-pms405-regulators"
,
.
data
=
&
rpm_pms405_regulators
},
{}
};
MODULE_DEVICE_TABLE
(
of
,
rpm_of_match
);
...
...
drivers/regulator/s5m8767.c
View file @
4fd1f509
...
...
@@ -447,15 +447,15 @@ static void s5m8767_regulator_config_ext_control(struct s5m8767_info *s5m8767,
}
if
(
mode
!=
S5M8767_ENCTRL_USE_GPIO
)
{
dev_warn
(
s5m8767
->
dev
,
"ext-control for %
s
: mismatched op_mode (%x), ignoring
\n
"
,
rdata
->
reg_node
->
name
,
mode
);
"ext-control for %
pOFn
: mismatched op_mode (%x), ignoring
\n
"
,
rdata
->
reg_node
,
mode
);
return
;
}
if
(
!
rdata
->
ext_control_gpiod
)
{
dev_warn
(
s5m8767
->
dev
,
"ext-control for %
s
: GPIO not valid, ignoring
\n
"
,
rdata
->
reg_node
->
name
);
"ext-control for %
pOFn
: GPIO not valid, ignoring
\n
"
,
rdata
->
reg_node
);
return
;
}
...
...
@@ -566,17 +566,18 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
if
(
i
==
ARRAY_SIZE
(
regulators
))
{
dev_warn
(
iodev
->
dev
,
"don't know how to configure regulator %
s
\n
"
,
reg_np
->
name
);
"don't know how to configure regulator %
pOFn
\n
"
,
reg_np
);
continue
;
}
rdata
->
ext_control_gpiod
=
devm_gpiod_get_from_of_node
(
&
pdev
->
dev
,
reg_np
,
"s5m8767,pmic-ext-control-gpios"
,
0
,
GPIOD_OUT_HIGH
,
"s5m8767"
);
rdata
->
ext_control_gpiod
=
devm_gpiod_get_from_of_node
(
&
pdev
->
dev
,
reg_np
,
"s5m8767,pmic-ext-control-gpios"
,
0
,
GPIOD_OUT_HIGH
|
GPIOD_FLAGS_BIT_NONEXCLUSIVE
,
"s5m8767"
);
if
(
IS_ERR
(
rdata
->
ext_control_gpiod
))
return
PTR_ERR
(
rdata
->
ext_control_gpiod
);
...
...
drivers/regulator/stpmic1_regulator.c
0 → 100644
View file @
4fd1f509
This diff is collapsed.
Click to expand it.
drivers/regulator/tps65090-regulator.c
View file @
4fd1f509
...
...
@@ -374,6 +374,7 @@ static struct tps65090_platform_data *tps65090_parse_dt_reg_data(
gflags
=
GPIOD_OUT_HIGH
;
else
gflags
=
GPIOD_OUT_LOW
;
gflags
|=
GPIOD_FLAGS_BIT_NONEXCLUSIVE
;
rpdata
->
gpiod
=
devm_gpiod_get_from_of_node
(
&
pdev
->
dev
,
tps65090_matches
[
idx
].
of_node
,
...
...
include/linux/gpio/consumer.h
View file @
4fd1f509
...
...
@@ -30,6 +30,7 @@ struct gpio_descs {
#define GPIOD_FLAGS_BIT_DIR_OUT BIT(1)
#define GPIOD_FLAGS_BIT_DIR_VAL BIT(2)
#define GPIOD_FLAGS_BIT_OPEN_DRAIN BIT(3)
#define GPIOD_FLAGS_BIT_NONEXCLUSIVE BIT(4)
/**
* Optional flags that can be passed to one of gpiod_* to configure direction
...
...
include/linux/mfd/rohm-bd718x7.h
View file @
4fd1f509
This diff is collapsed.
Click to expand it.
include/linux/regulator/driver.h
View file @
4fd1f509
...
...
@@ -271,9 +271,16 @@ enum regulator_type {
* @ramp_delay: Time to settle down after voltage change (unit: uV/us)
* @min_dropout_uV: The minimum dropout voltage this regulator can handle
* @linear_ranges: A constant table of possible voltage ranges.
* @n_linear_ranges: Number of entries in the @linear_ranges table.
* @linear_range_selectors: A constant table of voltage range selectors.
* If pickable ranges are used each range must
* have corresponding selector here.
* @n_linear_ranges: Number of entries in the @linear_ranges (and in
* linear_range_selectors if used) table(s).
* @volt_table: Voltage mapping table (if table based mapping)
*
* @vsel_range_reg: Register for range selector when using pickable ranges
* and regulator_regmap_X_voltage_X_pickable functions.
* @vsel_range_mask: Mask for register bitfield used for range selector
* @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
* @vsel_mask: Mask for register bitfield used for selector
* @csel_reg: Register for TPS65218 LS3 current regulator
...
...
@@ -338,10 +345,14 @@ struct regulator_desc {
int
min_dropout_uV
;
const
struct
regulator_linear_range
*
linear_ranges
;
const
unsigned
int
*
linear_range_selectors
;
int
n_linear_ranges
;
const
unsigned
int
*
volt_table
;
unsigned
int
vsel_range_reg
;
unsigned
int
vsel_range_mask
;
unsigned
int
vsel_reg
;
unsigned
int
vsel_mask
;
unsigned
int
csel_reg
;
...
...
@@ -498,18 +509,25 @@ int regulator_mode_to_status(unsigned int);
int
regulator_list_voltage_linear
(
struct
regulator_dev
*
rdev
,
unsigned
int
selector
);
int
regulator_list_voltage_pickable_linear_range
(
struct
regulator_dev
*
rdev
,
unsigned
int
selector
);
int
regulator_list_voltage_linear_range
(
struct
regulator_dev
*
rdev
,
unsigned
int
selector
);
int
regulator_list_voltage_table
(
struct
regulator_dev
*
rdev
,
unsigned
int
selector
);
int
regulator_map_voltage_linear
(
struct
regulator_dev
*
rdev
,
int
min_uV
,
int
max_uV
);
int
regulator_map_voltage_pickable_linear_range
(
struct
regulator_dev
*
rdev
,
int
min_uV
,
int
max_uV
);
int
regulator_map_voltage_linear_range
(
struct
regulator_dev
*
rdev
,
int
min_uV
,
int
max_uV
);
int
regulator_map_voltage_iterate
(
struct
regulator_dev
*
rdev
,
int
min_uV
,
int
max_uV
);
int
regulator_map_voltage_ascend
(
struct
regulator_dev
*
rdev
,
int
min_uV
,
int
max_uV
);
int
regulator_get_voltage_sel_pickable_regmap
(
struct
regulator_dev
*
rdev
);
int
regulator_set_voltage_sel_pickable_regmap
(
struct
regulator_dev
*
rdev
,
unsigned
int
sel
);
int
regulator_get_voltage_sel_regmap
(
struct
regulator_dev
*
rdev
);
int
regulator_set_voltage_sel_regmap
(
struct
regulator_dev
*
rdev
,
unsigned
sel
);
int
regulator_is_enabled_regmap
(
struct
regulator_dev
*
rdev
);
...
...
include/linux/regulator/fixed.h
View file @
4fd1f509
...
...
@@ -24,8 +24,6 @@ struct regulator_init_data;
* @supply_name: Name of the regulator supply
* @input_supply: Name of the input regulator supply
* @microvolts: Output voltage of regulator
* @gpio: GPIO to use for enable control
* set to -EINVAL if not used
* @startup_delay: Start-up time in microseconds
* @gpio_is_open_drain: Gpio pin is open drain or normal type.
* If it is open drain type then HIGH will be set
...
...
@@ -49,7 +47,6 @@ struct fixed_voltage_config {
const
char
*
supply_name
;
const
char
*
input_supply
;
int
microvolts
;
int
gpio
;
unsigned
startup_delay
;
unsigned
gpio_is_open_drain
:
1
;
unsigned
enable_high
:
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment