summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-06 13:23:50 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-06 13:23:50 -0500
commitbc914532a08892b30954030a0ba68f8534c67f76 (patch)
tree5e98212add9bbdc31860877ef9ff6860479b7a00
parent54727e6e950aacd14ec9cd4260e9fe498322828c (diff)
parent271bb1773b1eeff6153f1bba16ff0cff23f064b6 (diff)
Merge tag 'mfd-for-linus-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones: "New Device Support: - Add support for 88pm860; 88pm80x - Add support for 24c08 EEPROM; at24 - Add support for Broxton Whiskey Cove; intel* - Add support for RTS522A; rts5227 - Add support for I2C devices; intel_quark_i2c_gpio New Functionality: - Add microphone support; arizona - Add general purpose switch support; arizona - Add fuel-gauge support; da9150-core - Add shutdown support; sec-core - Add charger support; tps65217 - Add flexible serial communication unit support; atmel-flexcom - Add power button support; axp20x - Add led-flash support; rt5033 Core Frameworks: - Supply a generic macro for defining Regmap IRQs - Rework ACPI child device matching Fix-ups: - Use Regmap to access registers; tps6105x - Use DEFINE_RES_IRQ_NAMED() macro; da9150 - Re-arrange device registration order; intel_quark_i2c_gpio - Allow OF matching; cros_ec_i2c, atmel-hlcdc, hi6421-pmic, max8997, sm501 - Handle deferred probe; twl6040 - Improve accuracy of headphone detect; arizona - Unnecessary MODULE_ALIAS() removal; bcm590xx, rt5033 - Remove unused code; htc-i2cpld, arizona, pcf50633-irq, sec-core - Simplify code; kempld, rts5209, da903x, lm3533, da9052, arizona - Remove #iffery; arizona - DT binding adaptions; many Bug Fixes: - Fix possible NULL pointer dereference; wm831x, tps6105x - Fix 64bit bug; intel_soc_pmic_bxtwc - Fix signedness issue; arizona" * tag 'mfd-for-linus-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (73 commits) bindings: mfd: s2mps11: Add documentation for s2mps15 PMIC mfd: sec-core: Remove unused s2mpu02-rtc and s2mpu02-clk children extcon: arizona: Add extcon specific device tree binding document MAINTAINERS: Add binding docs for Cirrus Logic/Wolfson Arizona devices mfd: arizona: Remove bindings covered in new subsystem specific docs mfd: rt5033: Add RT5033 Flash led sub device mfd: lpss: Add Intel Broxton PCI IDs mfd: lpss: Add Broxton ACPI IDs mfd: arizona: Signedness bug in arizona_runtime_suspend() mfd: axp20x: Add a cell for the power button part of the, axp288 PMICs mfd: dt-bindings: Document pulled down WRSTBI pin on S2MPS1X mfd: sec-core: Disable buck voltage reset on watchdog falling edge mfd: sec-core: Dump PMIC revision to find out the HW mfd: arizona: Use correct type ID for device tree config mfd: arizona: Remove use of codec build config #ifdefs mfd: arizona: Simplify adding subdevices mfd: arizona: Downgrade type mismatch messages to dev_warn mfd: arizona: Factor out checking of jack detection state mfd: arizona: Factor out DCVDD isolation control mfd: Make TPS6105X select REGMAP_I2C ...
-rw-r--r--Documentation/acpi/enumeration.txt11
-rw-r--r--Documentation/devicetree/bindings/extcon/extcon-arizona.txt15
-rw-r--r--Documentation/devicetree/bindings/mfd/arizona.txt15
-rw-r--r--Documentation/devicetree/bindings/mfd/atmel-flexcom.txt63
-rw-r--r--Documentation/devicetree/bindings/mfd/cros-ec.txt4
-rw-r--r--Documentation/devicetree/bindings/mfd/da9150.txt33
-rw-r--r--Documentation/devicetree/bindings/mfd/s2mps11.txt24
-rw-r--r--Documentation/devicetree/bindings/power/da9150-fg.txt23
-rw-r--r--MAINTAINERS4
-rw-r--r--drivers/mfd/88pm80x.c2
-rw-r--r--drivers/mfd/Kconfig21
-rw-r--r--drivers/mfd/Makefile2
-rw-r--r--drivers/mfd/arizona-core.c300
-rw-r--r--drivers/mfd/arizona-i2c.c33
-rw-r--r--drivers/mfd/arizona-irq.c2
-rw-r--r--drivers/mfd/arizona-spi.c23
-rw-r--r--drivers/mfd/atmel-flexcom.c104
-rw-r--r--drivers/mfd/atmel-hlcdc.c1
-rw-r--r--drivers/mfd/axp20x.c20
-rw-r--r--drivers/mfd/bcm590xx.c1
-rw-r--r--drivers/mfd/cros_ec_i2c.c7
-rw-r--r--drivers/mfd/da903x.c6
-rw-r--r--drivers/mfd/da9052-core.c6
-rw-r--r--drivers/mfd/da9052-i2c.c6
-rw-r--r--drivers/mfd/da9052-spi.c6
-rw-r--r--drivers/mfd/da9062-core.c4
-rw-r--r--drivers/mfd/da9150-core.c191
-rw-r--r--drivers/mfd/hi6421-pmic-core.c1
-rw-r--r--drivers/mfd/htc-i2cpld.c3
-rw-r--r--drivers/mfd/intel-lpss-acpi.c16
-rw-r--r--drivers/mfd/intel-lpss-pci.c45
-rw-r--r--drivers/mfd/intel-lpss.c12
-rw-r--r--drivers/mfd/intel_quark_i2c_gpio.c33
-rw-r--r--drivers/mfd/intel_soc_pmic_bxtwc.c477
-rw-r--r--drivers/mfd/kempld-core.c14
-rw-r--r--drivers/mfd/lm3533-core.c13
-rw-r--r--drivers/mfd/lpc_ich.c42
-rw-r--r--drivers/mfd/max8997.c1
-rw-r--r--drivers/mfd/mfd-core.c52
-rw-r--r--drivers/mfd/pcf50633-irq.c4
-rw-r--r--drivers/mfd/qcom_rpm.c2
-rw-r--r--drivers/mfd/rt5033.c4
-rw-r--r--drivers/mfd/rts5209.c6
-rw-r--r--drivers/mfd/rts5227.c83
-rw-r--r--drivers/mfd/rts5229.c6
-rw-r--r--drivers/mfd/rts5249.c6
-rw-r--r--drivers/mfd/rtsx_pcr.c11
-rw-r--r--drivers/mfd/rtsx_pcr.h3
-rw-r--r--drivers/mfd/sec-core.c73
-rw-r--r--drivers/mfd/sm501.c1
-rw-r--r--drivers/mfd/stmpe.c1
-rw-r--r--drivers/mfd/tps6105x.c72
-rw-r--r--drivers/mfd/tps65217.c4
-rw-r--r--drivers/mfd/twl6040.c2
-rw-r--r--drivers/mfd/wm5110-tables.c188
-rw-r--r--drivers/mfd/wm831x-core.c4
-rw-r--r--drivers/mfd/wm8998-tables.c10
-rw-r--r--drivers/misc/eeprom/at24.c22
-rw-r--r--drivers/platform/x86/Kconfig1
-rw-r--r--drivers/power/Kconfig10
-rw-r--r--drivers/power/Makefile1
-rw-r--r--drivers/power/da9150-fg.c579
-rw-r--r--include/dt-bindings/mfd/atmel-flexcom.h26
-rw-r--r--include/linux/mfd/88pm80x.h1
-rw-r--r--include/linux/mfd/arizona/registers.h70
-rw-r--r--include/linux/mfd/core.h10
-rw-r--r--include/linux/mfd/da9052/reg.h3
-rw-r--r--include/linux/mfd/da9150/core.h19
-rw-r--r--include/linux/mfd/intel_bxtwc.h69
-rw-r--r--include/linux/mfd/intel_soc_pmic.h2
-rw-r--r--include/linux/mfd/rtsx_pci.h6
-rw-r--r--include/linux/mfd/samsung/core.h4
-rw-r--r--include/linux/mfd/samsung/s2mps11.h1
-rw-r--r--include/linux/mfd/samsung/s2mps13.h1
74 files changed, 2531 insertions, 410 deletions
diff --git a/Documentation/acpi/enumeration.txt b/Documentation/acpi/enumeration.txt
index b731b292e812..a91ec5af52df 100644
--- a/Documentation/acpi/enumeration.txt
+++ b/Documentation/acpi/enumeration.txt
@@ -347,13 +347,18 @@ For the first case, the MFD drivers do not need to do anything. The
347resulting child platform device will have its ACPI_COMPANION() set to point 347resulting child platform device will have its ACPI_COMPANION() set to point
348to the parent device. 348to the parent device.
349 349
350If the ACPI namespace has a device that we can match using an ACPI id, 350If the ACPI namespace has a device that we can match using an ACPI id or ACPI
351the id should be set like: 351adr, the cell should be set like:
352
353 static struct mfd_cell_acpi_match my_subdevice_cell_acpi_match = {
354 .pnpid = "XYZ0001",
355 .adr = 0,
356 };
352 357
353 static struct mfd_cell my_subdevice_cell = { 358 static struct mfd_cell my_subdevice_cell = {
354 .name = "my_subdevice", 359 .name = "my_subdevice",
355 /* set the resources relative to the parent */ 360 /* set the resources relative to the parent */
356 .acpi_pnpid = "XYZ0001", 361 .acpi_match = &my_subdevice_cell_acpi_match,
357 }; 362 };
358 363
359The ACPI id "XYZ0001" is then used to lookup an ACPI device directly under 364The ACPI id "XYZ0001" is then used to lookup an ACPI device directly under
diff --git a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
new file mode 100644
index 000000000000..e1705fae63a8
--- /dev/null
+++ b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
@@ -0,0 +1,15 @@
1Cirrus Logic Arizona class audio SoCs
2
3These devices are audio SoCs with extensive digital capabilities and a range
4of analogue I/O.
5
6This document lists Extcon specific bindings, see the primary binding document:
7 ../mfd/arizona.txt
8
9Optional properties:
10
11 - wlf,hpdet-channel : Headphone detection channel.
12 ARIZONA_ACCDET_MODE_HPL or 1 - Headphone detect mode is set to HPDETL
13 ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR
14 If this node is not mentioned or if the value is unknown, then
15 headphone detection mode is set to HPDETL.
diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt
index a8fee60dc20d..18be0cbfb456 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -44,7 +44,6 @@ Required properties:
44Optional properties: 44Optional properties:
45 45
46 - wlf,reset : GPIO specifier for the GPIO controlling /RESET 46 - wlf,reset : GPIO specifier for the GPIO controlling /RESET
47 - wlf,ldoena : GPIO specifier for the GPIO controlling LDOENA
48 47
49 - wlf,gpio-defaults : A list of GPIO configuration register values. Defines 48 - wlf,gpio-defaults : A list of GPIO configuration register values. Defines
50 for the appropriate values can found in <dt-bindings/mfd/arizona.txt>. If 49 for the appropriate values can found in <dt-bindings/mfd/arizona.txt>. If
@@ -67,21 +66,13 @@ Optional properties:
67 present, the number of values should be less than or equal to the 66 present, the number of values should be less than or equal to the
68 number of inputs, unspecified inputs will use the chip default. 67 number of inputs, unspecified inputs will use the chip default.
69 68
70 - wlf,hpdet-channel : Headphone detection channel.
71 ARIZONA_ACCDET_MODE_HPL or 1 - Headphone detect mode is set to HPDETL
72 ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR
73 If this node is not mentioned or if the value is unknown, then
74 headphone detection mode is set to HPDETL.
75
76 - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if 69 - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if
77 they are being externally supplied. As covered in 70 they are being externally supplied. As covered in
78 Documentation/devicetree/bindings/regulator/regulator.txt 71 Documentation/devicetree/bindings/regulator/regulator.txt
79 72
80Optional subnodes: 73Also see child specific device properties:
81 - ldo1 : Initial data for the LDO1 regulator, as covered in 74 Regulator - ../regulator/arizona-regulator.txt
82 Documentation/devicetree/bindings/regulator/regulator.txt 75 Extcon - ../extcon/extcon-arizona.txt
83 - micvdd : Initial data for the MICVDD regulator, as covered in
84 Documentation/devicetree/bindings/regulator/regulator.txt
85 76
86Example: 77Example:
87 78
diff --git a/Documentation/devicetree/bindings/mfd/atmel-flexcom.txt b/Documentation/devicetree/bindings/mfd/atmel-flexcom.txt
new file mode 100644
index 000000000000..692300117c64
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/atmel-flexcom.txt
@@ -0,0 +1,63 @@
1* Device tree bindings for Atmel Flexcom (Flexible Serial Communication Unit)
2
3The Atmel Flexcom is just a wrapper which embeds a SPI controller, an I2C
4controller and an USART. Only one function can be used at a time and is chosen
5at boot time according to the device tree.
6
7Required properties:
8- compatible: Should be "atmel,sama5d2-flexcom"
9- reg: Should be the offset/length value for Flexcom dedicated
10 I/O registers (without USART, TWI or SPI registers).
11- clocks: Should be the Flexcom peripheral clock from PMC.
12- #address-cells: Should be <1>
13- #size-cells: Should be <1>
14- ranges: Should be one range for the full I/O register region
15 (including USART, TWI and SPI registers).
16- atmel,flexcom-mode: Should be one of the following values:
17 - <1> for USART
18 - <2> for SPI
19 - <3> for I2C
20
21Required child:
22A single available child device of type matching the "atmel,flexcom-mode"
23property.
24
25The phandle provided by the clocks property of the child is the same as one for
26the Flexcom parent.
27
28For other properties, please refer to the documentations of the respective
29device:
30- ../serial/atmel-usart.txt
31- ../spi/spi_atmel.txt
32- ../i2c/i2c-at91.txt
33
34Example:
35
36flexcom@f8034000 {
37 compatible = "atmel,sama5d2-flexcom";
38 reg = <0xf8034000 0x200>;
39 clocks = <&flx0_clk>;
40 #address-cells = <1>;
41 #size-cells = <1>;
42 ranges = <0x0 0xf8034000 0x800>;
43 atmel,flexcom-mode = <2>;
44
45 spi@400 {
46 compatible = "atmel,at91rm9200-spi";
47 reg = <0x400 0x200>;
48 interrupts = <19 IRQ_TYPE_LEVEL_HIGH 7>;
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_flx0_default>;
51 #address-cells = <1>;
52 #size-cells = <0>;
53 clocks = <&flx0_clk>;
54 clock-names = "spi_clk";
55 atmel,fifo-size = <32>;
56
57 mtd_dataflash@0 {
58 compatible = "atmel,at25f512b";
59 reg = <0>;
60 spi-max-frequency = <20000000>;
61 };
62 };
63};
diff --git a/Documentation/devicetree/bindings/mfd/cros-ec.txt b/Documentation/devicetree/bindings/mfd/cros-ec.txt
index 1777916e9e28..136e0c2da44d 100644
--- a/Documentation/devicetree/bindings/mfd/cros-ec.txt
+++ b/Documentation/devicetree/bindings/mfd/cros-ec.txt
@@ -34,6 +34,10 @@ Required properties (LPC):
34- compatible: "google,cros-ec-lpc" 34- compatible: "google,cros-ec-lpc"
35- reg: List of (IO address, size) pairs defining the interface uses 35- reg: List of (IO address, size) pairs defining the interface uses
36 36
37Optional properties (all):
38- google,has-vbc-nvram: Some implementations of the EC include a small
39 nvram space used to store verified boot context data. This boolean flag
40 is used to specify whether this nvram is present or not.
37 41
38Example for I2C: 42Example for I2C:
39 43
diff --git a/Documentation/devicetree/bindings/mfd/da9150.txt b/Documentation/devicetree/bindings/mfd/da9150.txt
index d0588eaa0d71..fd4dca7f4aba 100644
--- a/Documentation/devicetree/bindings/mfd/da9150.txt
+++ b/Documentation/devicetree/bindings/mfd/da9150.txt
@@ -6,6 +6,7 @@ Device Description
6------ ----------- 6------ -----------
7da9150-gpadc : General Purpose ADC 7da9150-gpadc : General Purpose ADC
8da9150-charger : Battery Charger 8da9150-charger : Battery Charger
9da9150-fg : Battery Fuel-Gauge
9 10
10====== 11======
11 12
@@ -16,13 +17,13 @@ Required properties:
16 the IRQs from da9150 are delivered to. 17 the IRQs from da9150 are delivered to.
17- interrupts: IRQ line info for da9150 chip. 18- interrupts: IRQ line info for da9150 chip.
18- interrupt-controller: da9150 has internal IRQs (own IRQ domain). 19- interrupt-controller: da9150 has internal IRQs (own IRQ domain).
19 (See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt for 20 (See ../interrupt-controller/interrupts.txt for
20 further information relating to interrupt properties) 21 further information relating to interrupt properties)
21 22
22Sub-devices: 23Sub-devices:
23- da9150-gpadc: See Documentation/devicetree/bindings/iio/adc/da9150-gpadc.txt 24- da9150-gpadc: See ../iio/adc/da9150-gpadc.txt
24- da9150-charger: See Documentation/devicetree/bindings/power/da9150-charger.txt 25- da9150-charger: See ../power/da9150-charger.txt
25 26- da9150-fg: See ../power/da9150-fg.txt
26 27
27Example: 28Example:
28 29
@@ -34,10 +35,28 @@ Example:
34 interrupt-controller; 35 interrupt-controller;
35 36
36 gpadc: da9150-gpadc { 37 gpadc: da9150-gpadc {
37 ... 38 compatible = "dlg,da9150-gpadc";
39 #io-channel-cells = <1>;
40 };
41
42 charger {
43 compatible = "dlg,da9150-charger";
44
45 io-channels = <&gpadc 0>,
46 <&gpadc 2>,
47 <&gpadc 8>,
48 <&gpadc 5>;
49 io-channel-names = "CHAN_IBUS",
50 "CHAN_VBUS",
51 "CHAN_TJUNC",
52 "CHAN_VBAT";
38 }; 53 };
39 54
40 da9150-charger { 55 fuel-gauge {
41 ... 56 compatible = "dlg,da9150-fuel-gauge";
57
58 dlg,update-interval = <10000>;
59 dlg,warn-soc-level = /bits/ 8 <15>;
60 dlg,crit-soc-level = /bits/ 8 <5>
42 }; 61 };
43 }; 62 };
diff --git a/Documentation/devicetree/bindings/mfd/s2mps11.txt b/Documentation/devicetree/bindings/mfd/s2mps11.txt
index 57a045016fca..a42adda944bf 100644
--- a/Documentation/devicetree/bindings/mfd/s2mps11.txt
+++ b/Documentation/devicetree/bindings/mfd/s2mps11.txt
@@ -1,5 +1,5 @@
1 1
2* Samsung S2MPS11, S2MPS13, S2MPS14 and S2MPU02 Voltage and Current Regulator 2* Samsung S2MPS11/13/14/15 and S2MPU02 Voltage and Current Regulator
3 3
4The Samsung S2MPS11 is a multi-function device which includes voltage and 4The Samsung S2MPS11 is a multi-function device which includes voltage and
5current regulators, RTC, charger controller and other sub-blocks. It is 5current regulators, RTC, charger controller and other sub-blocks. It is
@@ -7,17 +7,24 @@ interfaced to the host controller using an I2C interface. Each sub-block is
7addressed by the host system using different I2C slave addresses. 7addressed by the host system using different I2C slave addresses.
8 8
9Required properties: 9Required properties:
10- compatible: Should be "samsung,s2mps11-pmic" or "samsung,s2mps13-pmic" 10- compatible: Should be one of the following
11 or "samsung,s2mps14-pmic" or "samsung,s2mpu02-pmic". 11 - "samsung,s2mps11-pmic"
12 - "samsung,s2mps13-pmic"
13 - "samsung,s2mps14-pmic"
14 - "samsung,s2mps15-pmic"
15 - "samsung,s2mpu02-pmic".
12- reg: Specifies the I2C slave address of the pmic block. It should be 0x66. 16- reg: Specifies the I2C slave address of the pmic block. It should be 0x66.
13 17
14Optional properties: 18Optional properties:
15- interrupt-parent: Specifies the phandle of the interrupt controller to which 19- interrupt-parent: Specifies the phandle of the interrupt controller to which
16 the interrupts from s2mps11 are delivered to. 20 the interrupts from s2mps11 are delivered to.
17- interrupts: Interrupt specifiers for interrupt sources. 21- interrupts: Interrupt specifiers for interrupt sources.
22- samsung,s2mps11-wrstbi-ground: Indicates that WRSTBI pin of PMIC is pulled
23 down. When the system is suspended it will always go down thus triggerring
24 unwanted buck warm reset (setting buck voltages to default values).
18 25
19Optional nodes: 26Optional nodes:
20- clocks: s2mps11, s2mps13 and s5m8767 provide three(AP/CP/BT) buffered 32.768 27- clocks: s2mps11, s2mps13, s2mps15 and s5m8767 provide three(AP/CP/BT) buffered 32.768
21 KHz outputs, so to register these as clocks with common clock framework 28 KHz outputs, so to register these as clocks with common clock framework
22 instantiate a sub-node named "clocks". It uses the common clock binding 29 instantiate a sub-node named "clocks". It uses the common clock binding
23 documented in : 30 documented in :
@@ -30,12 +37,13 @@ Optional nodes:
30 the clock which they consume. 37 the clock which they consume.
31 Clock ID Devices 38 Clock ID Devices
32 ---------------------------------------------------------- 39 ----------------------------------------------------------
33 32KhzAP 0 S2MPS11, S2MPS13, S2MPS14, S5M8767 40 32KhzAP 0 S2MPS11, S2MPS13, S2MPS14, S2MPS15, S5M8767
34 32KhzCP 1 S2MPS11, S2MPS13, S5M8767 41 32KhzCP 1 S2MPS11, S2MPS13, S2MPS15, S5M8767
35 32KhzBT 2 S2MPS11, S2MPS13, S2MPS14, S5M8767 42 32KhzBT 2 S2MPS11, S2MPS13, S2MPS14, S2MPS15, S5M8767
36 43
37 - compatible: Should be one of: "samsung,s2mps11-clk", "samsung,s2mps13-clk", 44 - compatible: Should be one of: "samsung,s2mps11-clk", "samsung,s2mps13-clk",
38 "samsung,s2mps14-clk", "samsung,s5m8767-clk" 45 "samsung,s2mps14-clk", "samsung,s5m8767-clk"
46 The s2msp15 uses the same compatible as s2mps13, as both provides similar clocks.
39 47
40- regulators: The regulators of s2mps11 that have to be instantiated should be 48- regulators: The regulators of s2mps11 that have to be instantiated should be
41included in a sub-node named 'regulators'. Regulator nodes included in this 49included in a sub-node named 'regulators'. Regulator nodes included in this
@@ -83,6 +91,7 @@ as per the datasheet of s2mps11.
83 - S2MPS11: 1 to 38 91 - S2MPS11: 1 to 38
84 - S2MPS13: 1 to 40 92 - S2MPS13: 1 to 40
85 - S2MPS14: 1 to 25 93 - S2MPS14: 1 to 25
94 - S2MPS15: 1 to 27
86 - S2MPU02: 1 to 28 95 - S2MPU02: 1 to 28
87 - Example: LDO1, LDO2, LDO28 96 - Example: LDO1, LDO2, LDO28
88 - BUCKn 97 - BUCKn
@@ -90,6 +99,7 @@ as per the datasheet of s2mps11.
90 - S2MPS11: 1 to 10 99 - S2MPS11: 1 to 10
91 - S2MPS13: 1 to 10 100 - S2MPS13: 1 to 10
92 - S2MPS14: 1 to 5 101 - S2MPS14: 1 to 5
102 - S2MPS15: 1 to 10
93 - S2MPU02: 1 to 7 103 - S2MPU02: 1 to 7
94 - Example: BUCK1, BUCK2, BUCK9 104 - Example: BUCK1, BUCK2, BUCK9
95 105
diff --git a/Documentation/devicetree/bindings/power/da9150-fg.txt b/Documentation/devicetree/bindings/power/da9150-fg.txt
new file mode 100644
index 000000000000..00236fe3ea31
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/da9150-fg.txt
@@ -0,0 +1,23 @@
1Dialog Semiconductor DA9150 Fuel-Gauge Power Supply bindings
2
3Required properties:
4- compatible: "dlg,da9150-fuel-gauge" for DA9150 Fuel-Gauge Power Supply
5
6Optional properties:
7- dlg,update-interval: Interval time (milliseconds) between battery level checks.
8- dlg,warn-soc-level: Battery discharge level (%) where warning event raised.
9 [1 - 100]
10- dlg,crit-soc-level: Battery discharge level (%) where critical event raised.
11 This value should be lower than the warning level.
12 [1 - 100]
13
14
15Example:
16
17 fuel-gauge {
18 compatible = "dlg,da9150-fuel-gauge";
19
20 dlg,update-interval = <10000>;
21 dlg,warn-soc-level = /bits/ 8 <15>;
22 dlg,crit-soc-level = /bits/ 8 <5>;
23 };
diff --git a/MAINTAINERS b/MAINTAINERS
index 15c38961d6ff..653ee9a7a3b8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7162,7 +7162,6 @@ F: drivers/media/i2c/mt9v032.c
7162F: include/media/mt9v032.h 7162F: include/media/mt9v032.h
7163 7163
7164MULTIFUNCTION DEVICES (MFD) 7164MULTIFUNCTION DEVICES (MFD)
7165M: Samuel Ortiz <sameo@linux.intel.com>
7166M: Lee Jones <lee.jones@linaro.org> 7165M: Lee Jones <lee.jones@linaro.org>
7167T: git git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git 7166T: git git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git
7168S: Supported 7167S: Supported
@@ -11567,6 +11566,9 @@ T: git https://github.com/CirrusLogic/linux-drivers.git
11567W: https://github.com/CirrusLogic/linux-drivers/wiki 11566W: https://github.com/CirrusLogic/linux-drivers/wiki
11568S: Supported 11567S: Supported
11569F: Documentation/hwmon/wm83?? 11568F: Documentation/hwmon/wm83??
11569F: Documentation/devicetree/bindings/extcon/extcon-arizona.txt
11570F: Documentation/devicetree/bindings/regulator/arizona-regulator.txt
11571F: Documentation/devicetree/bindings/mfd/arizona.txt
11570F: arch/arm/mach-s3c64xx/mach-crag6410* 11572F: arch/arm/mach-s3c64xx/mach-crag6410*
11571F: drivers/clk/clk-wm83*.c 11573F: drivers/clk/clk-wm83*.c
11572F: drivers/extcon/extcon-arizona.c 11574F: drivers/extcon/extcon-arizona.c
diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c
index 5e72f65ef94c..63445ea6b0bf 100644
--- a/drivers/mfd/88pm80x.c
+++ b/drivers/mfd/88pm80x.c
@@ -33,6 +33,8 @@ static struct pm80x_chip_mapping chip_mapping[] = {
33 {0x3, CHIP_PM800}, 33 {0x3, CHIP_PM800},
34 /* 88PM805 chip id number */ 34 /* 88PM805 chip id number */
35 {0x0, CHIP_PM805}, 35 {0x0, CHIP_PM805},
36 /* 88PM860 chip id number */
37 {0x4, CHIP_PM860},
36}; 38};
37 39
38/* 40/*
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 99d63675f073..4d92df6ef9fe 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -60,6 +60,17 @@ config MFD_AAT2870_CORE
60 additional drivers must be enabled in order to use the 60 additional drivers must be enabled in order to use the
61 functionality of the device. 61 functionality of the device.
62 62
63config MFD_ATMEL_FLEXCOM
64 tristate "Atmel Flexcom (Flexible Serial Communication Unit)"
65 select MFD_CORE
66 depends on OF
67 help
68 Select this to get support for Atmel Flexcom. This is a wrapper
69 which embeds a SPI controller, a I2C controller and a USART. Only
70 one function can be used at a time. The choice is done at boot time
71 by the probe function of this MFD driver according to a device tree
72 property.
73
63config MFD_ATMEL_HLCDC 74config MFD_ATMEL_HLCDC
64 tristate "Atmel HLCDC (High-end LCD Controller)" 75 tristate "Atmel HLCDC (High-end LCD Controller)"
65 select MFD_CORE 76 select MFD_CORE
@@ -725,9 +736,10 @@ config MFD_RTSX_PCI
725 select MFD_CORE 736 select MFD_CORE
726 help 737 help
727 This supports for Realtek PCI-Express card reader including rts5209, 738 This supports for Realtek PCI-Express card reader including rts5209,
728 rts5229, rtl8411, etc. Realtek card reader supports access to many 739 rts5227, rts522A, rts5229, rts5249, rts524A, rts525A, rtl8411, etc.
729 types of memory cards, such as Memory Stick, Memory Stick Pro, 740 Realtek card reader supports access to many types of memory cards,
730 Secure Digital and MultiMediaCard. 741 such as Memory Stick, Memory Stick Pro, Secure Digital and
742 MultiMediaCard.
731 743
732config MFD_RT5033 744config MFD_RT5033
733 tristate "Richtek RT5033 Power Management IC" 745 tristate "Richtek RT5033 Power Management IC"
@@ -1059,6 +1071,7 @@ config MFD_PALMAS
1059config TPS6105X 1071config TPS6105X
1060 tristate "TI TPS61050/61052 Boost Converters" 1072 tristate "TI TPS61050/61052 Boost Converters"
1061 depends on I2C 1073 depends on I2C
1074 select REGMAP_I2C
1062 select REGULATOR 1075 select REGULATOR
1063 select MFD_CORE 1076 select MFD_CORE
1064 select REGULATOR_FIXED_VOLTAGE 1077 select REGULATOR_FIXED_VOLTAGE
@@ -1471,7 +1484,7 @@ config MFD_WM8994
1471 1484
1472config MFD_STW481X 1485config MFD_STW481X
1473 tristate "Support for ST Microelectronics STw481x" 1486 tristate "Support for ST Microelectronics STw481x"
1474 depends on I2C && ARCH_NOMADIK 1487 depends on I2C && (ARCH_NOMADIK || COMPILE_TEST)
1475 select REGMAP_I2C 1488 select REGMAP_I2C
1476 select MFD_CORE 1489 select MFD_CORE
1477 help 1490 help
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index a59e3fcc8626..a8b76b81b467 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -164,6 +164,7 @@ obj-$(CONFIG_MFD_SPMI_PMIC) += qcom-spmi-pmic.o
164obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o 164obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o
165obj-$(CONFIG_MFD_TPS65090) += tps65090.o 165obj-$(CONFIG_MFD_TPS65090) += tps65090.o
166obj-$(CONFIG_MFD_AAT2870_CORE) += aat2870-core.o 166obj-$(CONFIG_MFD_AAT2870_CORE) += aat2870-core.o
167obj-$(CONFIG_MFD_ATMEL_FLEXCOM) += atmel-flexcom.o
167obj-$(CONFIG_MFD_ATMEL_HLCDC) += atmel-hlcdc.o 168obj-$(CONFIG_MFD_ATMEL_HLCDC) += atmel-hlcdc.o
168obj-$(CONFIG_MFD_INTEL_LPSS) += intel-lpss.o 169obj-$(CONFIG_MFD_INTEL_LPSS) += intel-lpss.o
169obj-$(CONFIG_MFD_INTEL_LPSS_PCI) += intel-lpss-pci.o 170obj-$(CONFIG_MFD_INTEL_LPSS_PCI) += intel-lpss-pci.o
@@ -190,5 +191,6 @@ obj-$(CONFIG_MFD_RT5033) += rt5033.o
190obj-$(CONFIG_MFD_SKY81452) += sky81452.o 191obj-$(CONFIG_MFD_SKY81452) += sky81452.o
191 192
192intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o 193intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o
194intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC) += intel_soc_pmic_bxtwc.o
193obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o 195obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o
194obj-$(CONFIG_MFD_MT6397) += mt6397-core.o 196obj-$(CONFIG_MFD_MT6397) += mt6397-core.o
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index 44cfdbb295db..d474732cc65c 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -24,6 +24,7 @@
24#include <linux/regulator/consumer.h> 24#include <linux/regulator/consumer.h>
25#include <linux/regulator/machine.h> 25#include <linux/regulator/machine.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/platform_device.h>
27 28
28#include <linux/mfd/arizona/core.h> 29#include <linux/mfd/arizona/core.h>
29#include <linux/mfd/arizona/registers.h> 30#include <linux/mfd/arizona/registers.h>
@@ -69,8 +70,6 @@ EXPORT_SYMBOL_GPL(arizona_clk32k_enable);
69 70
70int arizona_clk32k_disable(struct arizona *arizona) 71int arizona_clk32k_disable(struct arizona *arizona)
71{ 72{
72 int ret = 0;
73
74 mutex_lock(&arizona->clk_lock); 73 mutex_lock(&arizona->clk_lock);
75 74
76 BUG_ON(arizona->clk32k_ref <= 0); 75 BUG_ON(arizona->clk32k_ref <= 0);
@@ -90,7 +89,7 @@ int arizona_clk32k_disable(struct arizona *arizona)
90 89
91 mutex_unlock(&arizona->clk_lock); 90 mutex_unlock(&arizona->clk_lock);
92 91
93 return ret; 92 return 0;
94} 93}
95EXPORT_SYMBOL_GPL(arizona_clk32k_disable); 94EXPORT_SYMBOL_GPL(arizona_clk32k_disable);
96 95
@@ -462,6 +461,50 @@ static int wm5102_clear_write_sequencer(struct arizona *arizona)
462} 461}
463 462
464#ifdef CONFIG_PM 463#ifdef CONFIG_PM
464static int arizona_isolate_dcvdd(struct arizona *arizona)
465{
466 int ret;
467
468 ret = regmap_update_bits(arizona->regmap,
469 ARIZONA_ISOLATION_CONTROL,
470 ARIZONA_ISOLATE_DCVDD1,
471 ARIZONA_ISOLATE_DCVDD1);
472 if (ret != 0)
473 dev_err(arizona->dev, "Failed to isolate DCVDD: %d\n", ret);
474
475 return ret;
476}
477
478static int arizona_connect_dcvdd(struct arizona *arizona)
479{
480 int ret;
481
482 ret = regmap_update_bits(arizona->regmap,
483 ARIZONA_ISOLATION_CONTROL,
484 ARIZONA_ISOLATE_DCVDD1, 0);
485 if (ret != 0)
486 dev_err(arizona->dev, "Failed to connect DCVDD: %d\n", ret);
487
488 return ret;
489}
490
491static int arizona_is_jack_det_active(struct arizona *arizona)
492{
493 unsigned int val;
494 int ret;
495
496 ret = regmap_read(arizona->regmap, ARIZONA_JACK_DETECT_ANALOGUE, &val);
497 if (ret) {
498 dev_err(arizona->dev,
499 "Failed to check jack det status: %d\n", ret);
500 return ret;
501 } else if (val & ARIZONA_JD1_ENA) {
502 return 1;
503 } else {
504 return 0;
505 }
506}
507
465static int arizona_runtime_resume(struct device *dev) 508static int arizona_runtime_resume(struct device *dev)
466{ 509{
467 struct arizona *arizona = dev_get_drvdata(dev); 510 struct arizona *arizona = dev_get_drvdata(dev);
@@ -501,14 +544,9 @@ static int arizona_runtime_resume(struct device *dev)
501 switch (arizona->type) { 544 switch (arizona->type) {
502 case WM5102: 545 case WM5102:
503 if (arizona->external_dcvdd) { 546 if (arizona->external_dcvdd) {
504 ret = regmap_update_bits(arizona->regmap, 547 ret = arizona_connect_dcvdd(arizona);
505 ARIZONA_ISOLATION_CONTROL, 548 if (ret != 0)
506 ARIZONA_ISOLATE_DCVDD1, 0);
507 if (ret != 0) {
508 dev_err(arizona->dev,
509 "Failed to connect DCVDD: %d\n", ret);
510 goto err; 549 goto err;
511 }
512 } 550 }
513 551
514 ret = wm5102_patch(arizona); 552 ret = wm5102_patch(arizona);
@@ -533,14 +571,9 @@ static int arizona_runtime_resume(struct device *dev)
533 goto err; 571 goto err;
534 572
535 if (arizona->external_dcvdd) { 573 if (arizona->external_dcvdd) {
536 ret = regmap_update_bits(arizona->regmap, 574 ret = arizona_connect_dcvdd(arizona);
537 ARIZONA_ISOLATION_CONTROL, 575 if (ret != 0)
538 ARIZONA_ISOLATE_DCVDD1, 0);
539 if (ret) {
540 dev_err(arizona->dev,
541 "Failed to connect DCVDD: %d\n", ret);
542 goto err; 576 goto err;
543 }
544 } else { 577 } else {
545 /* 578 /*
546 * As this is only called for the internal regulator 579 * As this is only called for the internal regulator
@@ -571,14 +604,9 @@ static int arizona_runtime_resume(struct device *dev)
571 goto err; 604 goto err;
572 605
573 if (arizona->external_dcvdd) { 606 if (arizona->external_dcvdd) {
574 ret = regmap_update_bits(arizona->regmap, 607 ret = arizona_connect_dcvdd(arizona);
575 ARIZONA_ISOLATION_CONTROL, 608 if (ret != 0)
576 ARIZONA_ISOLATE_DCVDD1, 0);
577 if (ret != 0) {
578 dev_err(arizona->dev,
579 "Failed to connect DCVDD: %d\n", ret);
580 goto err; 609 goto err;
581 }
582 } 610 }
583 break; 611 break;
584 } 612 }
@@ -600,49 +628,50 @@ err:
600static int arizona_runtime_suspend(struct device *dev) 628static int arizona_runtime_suspend(struct device *dev)
601{ 629{
602 struct arizona *arizona = dev_get_drvdata(dev); 630 struct arizona *arizona = dev_get_drvdata(dev);
603 unsigned int val; 631 int jd_active = 0;
604 int ret; 632 int ret;
605 633
606 dev_dbg(arizona->dev, "Entering AoD mode\n"); 634 dev_dbg(arizona->dev, "Entering AoD mode\n");
607 635
608 ret = regmap_read(arizona->regmap, ARIZONA_JACK_DETECT_ANALOGUE, &val);
609 if (ret) {
610 dev_err(dev, "Failed to check jack det status: %d\n", ret);
611 return ret;
612 }
613
614 if (arizona->external_dcvdd) {
615 ret = regmap_update_bits(arizona->regmap,
616 ARIZONA_ISOLATION_CONTROL,
617 ARIZONA_ISOLATE_DCVDD1,
618 ARIZONA_ISOLATE_DCVDD1);
619 if (ret != 0) {
620 dev_err(arizona->dev, "Failed to isolate DCVDD: %d\n",
621 ret);
622 return ret;
623 }
624 }
625
626 switch (arizona->type) { 636 switch (arizona->type) {
627 case WM5110: 637 case WM5110:
628 case WM8280: 638 case WM8280:
629 if (arizona->external_dcvdd) 639 jd_active = arizona_is_jack_det_active(arizona);
630 break; 640 if (jd_active < 0)
641 return jd_active;
631 642
632 /* 643 if (arizona->external_dcvdd) {
633 * As this is only called for the internal regulator 644 ret = arizona_isolate_dcvdd(arizona);
634 * (where we know voltage ranges available) it is ok 645 if (ret != 0)
635 * to request an exact range. 646 return ret;
636 */ 647 } else {
637 ret = regulator_set_voltage(arizona->dcvdd, 1175000, 1175000); 648 /*
638 if (ret < 0) { 649 * As this is only called for the internal regulator
639 dev_err(arizona->dev, 650 * (where we know voltage ranges available) it is ok
640 "Failed to set suspend voltage: %d\n", ret); 651 * to request an exact range.
641 return ret; 652 */
653 ret = regulator_set_voltage(arizona->dcvdd,
654 1175000, 1175000);
655 if (ret < 0) {
656 dev_err(arizona->dev,
657 "Failed to set suspend voltage: %d\n",
658 ret);
659 return ret;
660 }
642 } 661 }
643 break; 662 break;
644 case WM5102: 663 case WM5102:
645 if (!(val & ARIZONA_JD1_ENA)) { 664 jd_active = arizona_is_jack_det_active(arizona);
665 if (jd_active < 0)
666 return jd_active;
667
668 if (arizona->external_dcvdd) {
669 ret = arizona_isolate_dcvdd(arizona);
670 if (ret != 0)
671 return ret;
672 }
673
674 if (!jd_active) {
646 ret = regmap_write(arizona->regmap, 675 ret = regmap_write(arizona->regmap,
647 ARIZONA_WRITE_SEQUENCER_CTRL_3, 0x0); 676 ARIZONA_WRITE_SEQUENCER_CTRL_3, 0x0);
648 if (ret) { 677 if (ret) {
@@ -654,6 +683,15 @@ static int arizona_runtime_suspend(struct device *dev)
654 } 683 }
655 break; 684 break;
656 default: 685 default:
686 jd_active = arizona_is_jack_det_active(arizona);
687 if (jd_active < 0)
688 return jd_active;
689
690 if (arizona->external_dcvdd) {
691 ret = arizona_isolate_dcvdd(arizona);
692 if (ret != 0)
693 return ret;
694 }
657 break; 695 break;
658 } 696 }
659 697
@@ -662,7 +700,7 @@ static int arizona_runtime_suspend(struct device *dev)
662 regulator_disable(arizona->dcvdd); 700 regulator_disable(arizona->dcvdd);
663 701
664 /* Allow us to completely power down if no jack detection */ 702 /* Allow us to completely power down if no jack detection */
665 if (!(val & ARIZONA_JD1_ENA)) { 703 if (!jd_active) {
666 dev_dbg(arizona->dev, "Fully powering off\n"); 704 dev_dbg(arizona->dev, "Fully powering off\n");
667 705
668 arizona->has_fully_powered_off = true; 706 arizona->has_fully_powered_off = true;
@@ -928,7 +966,8 @@ int arizona_dev_init(struct arizona *arizona)
928 const char *type_name; 966 const char *type_name;
929 unsigned int reg, val, mask; 967 unsigned int reg, val, mask;
930 int (*apply_patch)(struct arizona *) = NULL; 968 int (*apply_patch)(struct arizona *) = NULL;
931 int ret, i; 969 const struct mfd_cell *subdevs = NULL;
970 int n_subdevs, ret, i;
932 971
933 dev_set_drvdata(arizona->dev, arizona); 972 dev_set_drvdata(arizona->dev, arizona);
934 mutex_init(&arizona->clk_lock); 973 mutex_init(&arizona->clk_lock);
@@ -1089,74 +1128,95 @@ int arizona_dev_init(struct arizona *arizona)
1089 arizona->rev &= ARIZONA_DEVICE_REVISION_MASK; 1128 arizona->rev &= ARIZONA_DEVICE_REVISION_MASK;
1090 1129
1091 switch (reg) { 1130 switch (reg) {
1092#ifdef CONFIG_MFD_WM5102
1093 case 0x5102: 1131 case 0x5102:
1094 type_name = "WM5102"; 1132 if (IS_ENABLED(CONFIG_MFD_WM5102)) {
1095 if (arizona->type != WM5102) { 1133 type_name = "WM5102";
1096 dev_err(arizona->dev, "WM5102 registered as %d\n", 1134 if (arizona->type != WM5102) {
1097 arizona->type); 1135 dev_warn(arizona->dev,
1098 arizona->type = WM5102; 1136 "WM5102 registered as %d\n",
1137 arizona->type);
1138 arizona->type = WM5102;
1139 }
1140
1141 apply_patch = wm5102_patch;
1142 arizona->rev &= 0x7;
1143 subdevs = wm5102_devs;
1144 n_subdevs = ARRAY_SIZE(wm5102_devs);
1099 } 1145 }
1100 apply_patch = wm5102_patch;
1101 arizona->rev &= 0x7;
1102 break; 1146 break;
1103#endif
1104#ifdef CONFIG_MFD_WM5110
1105 case 0x5110: 1147 case 0x5110:
1106 switch (arizona->type) { 1148 if (IS_ENABLED(CONFIG_MFD_WM5110)) {
1107 case WM5110: 1149 switch (arizona->type) {
1108 type_name = "WM5110"; 1150 case WM5110:
1109 break; 1151 type_name = "WM5110";
1110 case WM8280: 1152 break;
1111 type_name = "WM8280"; 1153 case WM8280:
1112 break; 1154 type_name = "WM8280";
1113 default: 1155 break;
1114 type_name = "WM5110"; 1156 default:
1115 dev_err(arizona->dev, "WM5110 registered as %d\n", 1157 type_name = "WM5110";
1116 arizona->type); 1158 dev_warn(arizona->dev,
1117 arizona->type = WM5110; 1159 "WM5110 registered as %d\n",
1118 break; 1160 arizona->type);
1161 arizona->type = WM5110;
1162 break;
1163 }
1164
1165 apply_patch = wm5110_patch;
1166 subdevs = wm5110_devs;
1167 n_subdevs = ARRAY_SIZE(wm5110_devs);
1119 } 1168 }
1120 apply_patch = wm5110_patch;
1121 break; 1169 break;
1122#endif
1123#ifdef CONFIG_MFD_WM8997
1124 case 0x8997: 1170 case 0x8997:
1125 type_name = "WM8997"; 1171 if (IS_ENABLED(CONFIG_MFD_WM8997)) {
1126 if (arizona->type != WM8997) { 1172 type_name = "WM8997";
1127 dev_err(arizona->dev, "WM8997 registered as %d\n", 1173 if (arizona->type != WM8997) {
1128 arizona->type); 1174 dev_warn(arizona->dev,
1129 arizona->type = WM8997; 1175 "WM8997 registered as %d\n",
1176 arizona->type);
1177 arizona->type = WM8997;
1178 }
1179
1180 apply_patch = wm8997_patch;
1181 subdevs = wm8997_devs;
1182 n_subdevs = ARRAY_SIZE(wm8997_devs);
1130 } 1183 }
1131 apply_patch = wm8997_patch;
1132 break; 1184 break;
1133#endif
1134#ifdef CONFIG_MFD_WM8998
1135 case 0x6349: 1185 case 0x6349:
1136 switch (arizona->type) { 1186 if (IS_ENABLED(CONFIG_MFD_WM8998)) {
1137 case WM8998: 1187 switch (arizona->type) {
1138 type_name = "WM8998"; 1188 case WM8998:
1139 break; 1189 type_name = "WM8998";
1140 1190 break;
1141 case WM1814: 1191
1142 type_name = "WM1814"; 1192 case WM1814:
1143 break; 1193 type_name = "WM1814";
1194 break;
1195
1196 default:
1197 type_name = "WM8998";
1198 dev_warn(arizona->dev,
1199 "WM8998 registered as %d\n",
1200 arizona->type);
1201 arizona->type = WM8998;
1202 }
1144 1203
1145 default: 1204 apply_patch = wm8998_patch;
1146 type_name = "WM8998"; 1205 subdevs = wm8998_devs;
1147 dev_err(arizona->dev, "WM8998 registered as %d\n", 1206 n_subdevs = ARRAY_SIZE(wm8998_devs);
1148 arizona->type);
1149 arizona->type = WM8998;
1150 } 1207 }
1151
1152 apply_patch = wm8998_patch;
1153 break; 1208 break;
1154#endif
1155 default: 1209 default:
1156 dev_err(arizona->dev, "Unknown device ID %x\n", reg); 1210 dev_err(arizona->dev, "Unknown device ID %x\n", reg);
1157 goto err_reset; 1211 goto err_reset;
1158 } 1212 }
1159 1213
1214 if (!subdevs) {
1215 dev_err(arizona->dev,
1216 "No kernel support for device ID %x\n", reg);
1217 goto err_reset;
1218 }
1219
1160 dev_info(dev, "%s revision %c\n", type_name, arizona->rev + 'A'); 1220 dev_info(dev, "%s revision %c\n", type_name, arizona->rev + 'A');
1161 1221
1162 if (apply_patch) { 1222 if (apply_patch) {
@@ -1342,28 +1402,10 @@ int arizona_dev_init(struct arizona *arizona)
1342 arizona_request_irq(arizona, ARIZONA_IRQ_UNDERCLOCKED, "Underclocked", 1402 arizona_request_irq(arizona, ARIZONA_IRQ_UNDERCLOCKED, "Underclocked",
1343 arizona_underclocked, arizona); 1403 arizona_underclocked, arizona);
1344 1404
1345 switch (arizona->type) { 1405 ret = mfd_add_devices(arizona->dev, PLATFORM_DEVID_NONE,
1346 case WM5102: 1406 subdevs, n_subdevs, NULL, 0, NULL);
1347 ret = mfd_add_devices(arizona->dev, -1, wm5102_devs,
1348 ARRAY_SIZE(wm5102_devs), NULL, 0, NULL);
1349 break;
1350 case WM5110:
1351 case WM8280:
1352 ret = mfd_add_devices(arizona->dev, -1, wm5110_devs,
1353 ARRAY_SIZE(wm5110_devs), NULL, 0, NULL);
1354 break;
1355 case WM8997:
1356 ret = mfd_add_devices(arizona->dev, -1, wm8997_devs,
1357 ARRAY_SIZE(wm8997_devs), NULL, 0, NULL);
1358 break;
1359 case WM8998:
1360 case WM1814:
1361 ret = mfd_add_devices(arizona->dev, -1, wm8998_devs,
1362 ARRAY_SIZE(wm8998_devs), NULL, 0, NULL);
1363 break;
1364 }
1365 1407
1366 if (ret != 0) { 1408 if (ret) {
1367 dev_err(arizona->dev, "Failed to add subdevices: %d\n", ret); 1409 dev_err(arizona->dev, "Failed to add subdevices: %d\n", ret);
1368 goto err_irq; 1410 goto err_irq;
1369 } 1411 }
diff --git a/drivers/mfd/arizona-i2c.c b/drivers/mfd/arizona-i2c.c
index cea1b409fa27..4e3afd1861fc 100644
--- a/drivers/mfd/arizona-i2c.c
+++ b/drivers/mfd/arizona-i2c.c
@@ -27,7 +27,7 @@ static int arizona_i2c_probe(struct i2c_client *i2c,
27 const struct i2c_device_id *id) 27 const struct i2c_device_id *id)
28{ 28{
29 struct arizona *arizona; 29 struct arizona *arizona;
30 const struct regmap_config *regmap_config; 30 const struct regmap_config *regmap_config = NULL;
31 unsigned long type; 31 unsigned long type;
32 int ret; 32 int ret;
33 33
@@ -37,31 +37,32 @@ static int arizona_i2c_probe(struct i2c_client *i2c,
37 type = id->driver_data; 37 type = id->driver_data;
38 38
39 switch (type) { 39 switch (type) {
40#ifdef CONFIG_MFD_WM5102
41 case WM5102: 40 case WM5102:
42 regmap_config = &wm5102_i2c_regmap; 41 if (IS_ENABLED(CONFIG_MFD_WM5102))
42 regmap_config = &wm5102_i2c_regmap;
43 break; 43 break;
44#endif
45#ifdef CONFIG_MFD_WM5110
46 case WM5110: 44 case WM5110:
47 case WM8280: 45 case WM8280:
48 regmap_config = &wm5110_i2c_regmap; 46 if (IS_ENABLED(CONFIG_MFD_WM5110))
47 regmap_config = &wm5110_i2c_regmap;
49 break; 48 break;
50#endif
51#ifdef CONFIG_MFD_WM8997
52 case WM8997: 49 case WM8997:
53 regmap_config = &wm8997_i2c_regmap; 50 if (IS_ENABLED(CONFIG_MFD_WM8997))
51 regmap_config = &wm8997_i2c_regmap;
54 break; 52 break;
55#endif
56#ifdef CONFIG_MFD_WM8998
57 case WM8998: 53 case WM8998:
58 case WM1814: 54 case WM1814:
59 regmap_config = &wm8998_i2c_regmap; 55 if (IS_ENABLED(CONFIG_MFD_WM8998))
56 regmap_config = &wm8998_i2c_regmap;
60 break; 57 break;
61#endif
62 default: 58 default:
63 dev_err(&i2c->dev, "Unknown device type %ld\n", 59 dev_err(&i2c->dev, "Unknown device type %ld\n", type);
64 id->driver_data); 60 return -EINVAL;
61 }
62
63 if (!regmap_config) {
64 dev_err(&i2c->dev,
65 "No kernel support for device type %ld\n", type);
65 return -EINVAL; 66 return -EINVAL;
66 } 67 }
67 68
@@ -77,7 +78,7 @@ static int arizona_i2c_probe(struct i2c_client *i2c,
77 return ret; 78 return ret;
78 } 79 }
79 80
80 arizona->type = id->driver_data; 81 arizona->type = type;
81 arizona->dev = &i2c->dev; 82 arizona->dev = &i2c->dev;
82 arizona->irq = i2c->irq; 83 arizona->irq = i2c->irq;
83 84
diff --git a/drivers/mfd/arizona-irq.c b/drivers/mfd/arizona-irq.c
index 2cac4f463f1e..3d425e93ce84 100644
--- a/drivers/mfd/arizona-irq.c
+++ b/drivers/mfd/arizona-irq.c
@@ -169,7 +169,7 @@ static struct irq_chip arizona_irq_chip = {
169static int arizona_irq_map(struct irq_domain *h, unsigned int virq, 169static int arizona_irq_map(struct irq_domain *h, unsigned int virq,
170 irq_hw_number_t hw) 170 irq_hw_number_t hw)
171{ 171{
172 struct regmap_irq_chip_data *data = h->host_data; 172 struct arizona *data = h->host_data;
173 173
174 irq_set_chip_data(virq, data); 174 irq_set_chip_data(virq, data);
175 irq_set_chip_and_handler(virq, &arizona_irq_chip, handle_simple_irq); 175 irq_set_chip_and_handler(virq, &arizona_irq_chip, handle_simple_irq);
diff --git a/drivers/mfd/arizona-spi.c b/drivers/mfd/arizona-spi.c
index 03d62f7b4720..befbc89bfd34 100644
--- a/drivers/mfd/arizona-spi.c
+++ b/drivers/mfd/arizona-spi.c
@@ -27,7 +27,7 @@ static int arizona_spi_probe(struct spi_device *spi)
27{ 27{
28 const struct spi_device_id *id = spi_get_device_id(spi); 28 const struct spi_device_id *id = spi_get_device_id(spi);
29 struct arizona *arizona; 29 struct arizona *arizona;
30 const struct regmap_config *regmap_config; 30 const struct regmap_config *regmap_config = NULL;
31 unsigned long type; 31 unsigned long type;
32 int ret; 32 int ret;
33 33
@@ -37,20 +37,23 @@ static int arizona_spi_probe(struct spi_device *spi)
37 type = id->driver_data; 37 type = id->driver_data;
38 38
39 switch (type) { 39 switch (type) {
40#ifdef CONFIG_MFD_WM5102
41 case WM5102: 40 case WM5102:
42 regmap_config = &wm5102_spi_regmap; 41 if (IS_ENABLED(CONFIG_MFD_WM5102))
42 regmap_config = &wm5102_spi_regmap;
43 break; 43 break;
44#endif
45#ifdef CONFIG_MFD_WM5110
46 case WM5110: 44 case WM5110:
47 case WM8280: 45 case WM8280:
48 regmap_config = &wm5110_spi_regmap; 46 if (IS_ENABLED(CONFIG_MFD_WM5110))
47 regmap_config = &wm5110_spi_regmap;
49 break; 48 break;
50#endif
51 default: 49 default:
52 dev_err(&spi->dev, "Unknown device type %ld\n", 50 dev_err(&spi->dev, "Unknown device type %ld\n", type);
53 id->driver_data); 51 return -EINVAL;
52 }
53
54 if (!regmap_config) {
55 dev_err(&spi->dev,
56 "No kernel support for device type %ld\n", type);
54 return -EINVAL; 57 return -EINVAL;
55 } 58 }
56 59
@@ -66,7 +69,7 @@ static int arizona_spi_probe(struct spi_device *spi)
66 return ret; 69 return ret;
67 } 70 }
68 71
69 arizona->type = id->driver_data; 72 arizona->type = type;
70 arizona->dev = &spi->dev; 73 arizona->dev = &spi->dev;
71 arizona->irq = spi->irq; 74 arizona->irq = spi->irq;
72 75
diff --git a/drivers/mfd/atmel-flexcom.c b/drivers/mfd/atmel-flexcom.c
new file mode 100644
index 000000000000..e8e67be6b493
--- /dev/null
+++ b/drivers/mfd/atmel-flexcom.c
@@ -0,0 +1,104 @@
1/*
2 * Driver for Atmel Flexcom
3 *
4 * Copyright (C) 2015 Atmel Corporation
5 *
6 * Author: Cyrille Pitchen <cyrille.pitchen@atmel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <linux/module.h>
22#include <linux/types.h>
23#include <linux/kernel.h>
24#include <linux/platform_device.h>
25#include <linux/of.h>
26#include <linux/of_platform.h>
27#include <linux/err.h>
28#include <linux/io.h>
29#include <linux/clk.h>
30#include <dt-bindings/mfd/atmel-flexcom.h>
31
32/* I/O register offsets */
33#define FLEX_MR 0x0 /* Mode Register */
34#define FLEX_VERSION 0xfc /* Version Register */
35
36/* Mode Register bit fields */
37#define FLEX_MR_OPMODE_OFFSET (0) /* Operating Mode */
38#define FLEX_MR_OPMODE_MASK (0x3 << FLEX_MR_OPMODE_OFFSET)
39#define FLEX_MR_OPMODE(opmode) (((opmode) << FLEX_MR_OPMODE_OFFSET) & \
40 FLEX_MR_OPMODE_MASK)
41
42
43static int atmel_flexcom_probe(struct platform_device *pdev)
44{
45 struct device_node *np = pdev->dev.of_node;
46 struct clk *clk;
47 struct resource *res;
48 void __iomem *base;
49 u32 opmode;
50 int err;
51
52 err = of_property_read_u32(np, "atmel,flexcom-mode", &opmode);
53 if (err)
54 return err;
55
56 if (opmode < ATMEL_FLEXCOM_MODE_USART ||
57 opmode > ATMEL_FLEXCOM_MODE_TWI)
58 return -EINVAL;
59
60 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
61 base = devm_ioremap_resource(&pdev->dev, res);
62 if (IS_ERR(base))
63 return PTR_ERR(base);
64
65 clk = devm_clk_get(&pdev->dev, NULL);
66 if (IS_ERR(clk))
67 return PTR_ERR(clk);
68
69 err = clk_prepare_enable(clk);
70 if (err)
71 return err;
72
73 /*
74 * Set the Operating Mode in the Mode Register: only the selected device
75 * is clocked. Hence, registers of the other serial devices remain
76 * inaccessible and are read as zero. Also the external I/O lines of the
77 * Flexcom are muxed to reach the selected device.
78 */
79 writel(FLEX_MR_OPMODE(opmode), base + FLEX_MR);
80
81 clk_disable_unprepare(clk);
82
83 return of_platform_populate(np, NULL, NULL, &pdev->dev);
84}
85
86static const struct of_device_id atmel_flexcom_of_match[] = {
87 { .compatible = "atmel,sama5d2-flexcom" },
88 { /* sentinel */ }
89};
90MODULE_DEVICE_TABLE(of, atmel_flexcom_of_match);
91
92static struct platform_driver atmel_flexcom_driver = {
93 .probe = atmel_flexcom_probe,
94 .driver = {
95 .name = "atmel_flexcom",
96 .of_match_table = atmel_flexcom_of_match,
97 },
98};
99
100module_platform_driver(atmel_flexcom_driver);
101
102MODULE_AUTHOR("Cyrille Pitchen <cyrille.pitchen@atmel.com>");
103MODULE_DESCRIPTION("Atmel Flexcom MFD driver");
104MODULE_LICENSE("GPL v2");
diff --git a/drivers/mfd/atmel-hlcdc.c b/drivers/mfd/atmel-hlcdc.c
index 3fff6b5d0426..06c205868573 100644
--- a/drivers/mfd/atmel-hlcdc.c
+++ b/drivers/mfd/atmel-hlcdc.c
@@ -148,6 +148,7 @@ static const struct of_device_id atmel_hlcdc_match[] = {
148 { .compatible = "atmel,sama5d4-hlcdc" }, 148 { .compatible = "atmel,sama5d4-hlcdc" },
149 { /* sentinel */ }, 149 { /* sentinel */ },
150}; 150};
151MODULE_DEVICE_TABLE(of, atmel_hlcdc_match);
151 152
152static struct platform_driver atmel_hlcdc_driver = { 153static struct platform_driver atmel_hlcdc_driver = {
153 .probe = atmel_hlcdc_probe, 154 .probe = atmel_hlcdc_probe,
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 3f576b76c322..9842199e2e6c 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -161,6 +161,21 @@ static struct resource axp22x_pek_resources[] = {
161 }, 161 },
162}; 162};
163 163
164static struct resource axp288_power_button_resources[] = {
165 {
166 .name = "PEK_DBR",
167 .start = AXP288_IRQ_POKN,
168 .end = AXP288_IRQ_POKN,
169 .flags = IORESOURCE_IRQ,
170 },
171 {
172 .name = "PEK_DBF",
173 .start = AXP288_IRQ_POKP,
174 .end = AXP288_IRQ_POKP,
175 .flags = IORESOURCE_IRQ,
176 },
177};
178
164static struct resource axp288_fuel_gauge_resources[] = { 179static struct resource axp288_fuel_gauge_resources[] = {
165 { 180 {
166 .start = AXP288_IRQ_QWBTU, 181 .start = AXP288_IRQ_QWBTU,
@@ -572,6 +587,11 @@ static struct mfd_cell axp288_cells[] = {
572 .resources = axp288_fuel_gauge_resources, 587 .resources = axp288_fuel_gauge_resources,
573 }, 588 },
574 { 589 {
590 .name = "axp20x-pek",
591 .num_resources = ARRAY_SIZE(axp288_power_button_resources),
592 .resources = axp288_power_button_resources,
593 },
594 {
575 .name = "axp288_pmic_acpi", 595 .name = "axp288_pmic_acpi",
576 }, 596 },
577}; 597};
diff --git a/drivers/mfd/bcm590xx.c b/drivers/mfd/bcm590xx.c
index da2af5b4f855..320aaefee718 100644
--- a/drivers/mfd/bcm590xx.c
+++ b/drivers/mfd/bcm590xx.c
@@ -128,4 +128,3 @@ module_i2c_driver(bcm590xx_i2c_driver);
128MODULE_AUTHOR("Matt Porter <mporter@linaro.org>"); 128MODULE_AUTHOR("Matt Porter <mporter@linaro.org>");
129MODULE_DESCRIPTION("BCM590xx multi-function driver"); 129MODULE_DESCRIPTION("BCM590xx multi-function driver");
130MODULE_LICENSE("GPL v2"); 130MODULE_LICENSE("GPL v2");
131MODULE_ALIAS("i2c:bcm590xx");
diff --git a/drivers/mfd/cros_ec_i2c.c b/drivers/mfd/cros_ec_i2c.c
index d06e4b46db80..56a466469664 100644
--- a/drivers/mfd/cros_ec_i2c.c
+++ b/drivers/mfd/cros_ec_i2c.c
@@ -344,6 +344,12 @@ static int cros_ec_i2c_resume(struct device *dev)
344static SIMPLE_DEV_PM_OPS(cros_ec_i2c_pm_ops, cros_ec_i2c_suspend, 344static SIMPLE_DEV_PM_OPS(cros_ec_i2c_pm_ops, cros_ec_i2c_suspend,
345 cros_ec_i2c_resume); 345 cros_ec_i2c_resume);
346 346
347static const struct of_device_id cros_ec_i2c_of_match[] = {
348 { .compatible = "google,cros-ec-i2c", },
349 { /* sentinel */ },
350};
351MODULE_DEVICE_TABLE(of, cros_ec_i2c_of_match);
352
347static const struct i2c_device_id cros_ec_i2c_id[] = { 353static const struct i2c_device_id cros_ec_i2c_id[] = {
348 { "cros-ec-i2c", 0 }, 354 { "cros-ec-i2c", 0 },
349 { } 355 { }
@@ -353,6 +359,7 @@ MODULE_DEVICE_TABLE(i2c, cros_ec_i2c_id);
353static struct i2c_driver cros_ec_driver = { 359static struct i2c_driver cros_ec_driver = {
354 .driver = { 360 .driver = {
355 .name = "cros-ec-i2c", 361 .name = "cros-ec-i2c",
362 .of_match_table = of_match_ptr(cros_ec_i2c_of_match),
356 .pm = &cros_ec_i2c_pm_ops, 363 .pm = &cros_ec_i2c_pm_ops,
357 }, 364 },
358 .probe = cros_ec_i2c_probe, 365 .probe = cros_ec_i2c_probe,
diff --git a/drivers/mfd/da903x.c b/drivers/mfd/da903x.c
index ef7fe2ae2fa4..37e4426ef061 100644
--- a/drivers/mfd/da903x.c
+++ b/drivers/mfd/da903x.c
@@ -532,11 +532,7 @@ static int da903x_probe(struct i2c_client *client,
532 return ret; 532 return ret;
533 } 533 }
534 534
535 ret = da903x_add_subdevs(chip, pdata); 535 return da903x_add_subdevs(chip, pdata);
536 if (ret)
537 return ret;
538
539 return 0;
540} 536}
541 537
542static int da903x_remove(struct i2c_client *client) 538static int da903x_remove(struct i2c_client *client)
diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index 46e3840c7a37..c0bf68a3e614 100644
--- a/drivers/mfd/da9052-core.c
+++ b/drivers/mfd/da9052-core.c
@@ -51,6 +51,9 @@ static bool da9052_reg_readable(struct device *dev, unsigned int reg)
51 case DA9052_GPIO_2_3_REG: 51 case DA9052_GPIO_2_3_REG:
52 case DA9052_GPIO_4_5_REG: 52 case DA9052_GPIO_4_5_REG:
53 case DA9052_GPIO_6_7_REG: 53 case DA9052_GPIO_6_7_REG:
54 case DA9052_GPIO_8_9_REG:
55 case DA9052_GPIO_10_11_REG:
56 case DA9052_GPIO_12_13_REG:
54 case DA9052_GPIO_14_15_REG: 57 case DA9052_GPIO_14_15_REG:
55 case DA9052_ID_0_1_REG: 58 case DA9052_ID_0_1_REG:
56 case DA9052_ID_2_3_REG: 59 case DA9052_ID_2_3_REG:
@@ -178,6 +181,9 @@ static bool da9052_reg_writeable(struct device *dev, unsigned int reg)
178 case DA9052_GPIO_2_3_REG: 181 case DA9052_GPIO_2_3_REG:
179 case DA9052_GPIO_4_5_REG: 182 case DA9052_GPIO_4_5_REG:
180 case DA9052_GPIO_6_7_REG: 183 case DA9052_GPIO_6_7_REG:
184 case DA9052_GPIO_8_9_REG:
185 case DA9052_GPIO_10_11_REG:
186 case DA9052_GPIO_12_13_REG:
181 case DA9052_GPIO_14_15_REG: 187 case DA9052_GPIO_14_15_REG:
182 case DA9052_ID_0_1_REG: 188 case DA9052_ID_0_1_REG:
183 case DA9052_ID_2_3_REG: 189 case DA9052_ID_2_3_REG:
diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c
index 02887001e800..2697ffb08009 100644
--- a/drivers/mfd/da9052-i2c.c
+++ b/drivers/mfd/da9052-i2c.c
@@ -174,11 +174,7 @@ static int da9052_i2c_probe(struct i2c_client *client,
174 return ret; 174 return ret;
175 } 175 }
176 176
177 ret = da9052_device_init(da9052, id->driver_data); 177 return da9052_device_init(da9052, id->driver_data);
178 if (ret != 0)
179 return ret;
180
181 return 0;
182} 178}
183 179
184static int da9052_i2c_remove(struct i2c_client *client) 180static int da9052_i2c_remove(struct i2c_client *client)
diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c
index 71b89dd4e8de..b9ea1b27db64 100644
--- a/drivers/mfd/da9052-spi.c
+++ b/drivers/mfd/da9052-spi.c
@@ -56,11 +56,7 @@ static int da9052_spi_probe(struct spi_device *spi)
56 return ret; 56 return ret;
57 } 57 }
58 58
59 ret = da9052_device_init(da9052, id->driver_data); 59 return da9052_device_init(da9052, id->driver_data);
60 if (ret != 0)
61 return ret;
62
63 return 0;
64} 60}
65 61
66static int da9052_spi_remove(struct spi_device *spi) 62static int da9052_spi_remove(struct spi_device *spi)
diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
index f80d9471f2e7..a9ad024ec6b0 100644
--- a/drivers/mfd/da9062-core.c
+++ b/drivers/mfd/da9062-core.c
@@ -198,7 +198,7 @@ static int da9062_clear_fault_log(struct da9062 *chip)
198 return ret; 198 return ret;
199} 199}
200 200
201int get_device_type(struct da9062 *chip) 201static int da9062_get_device_type(struct da9062 *chip)
202{ 202{
203 int device_id, variant_id, variant_mrc; 203 int device_id, variant_id, variant_mrc;
204 int ret; 204 int ret;
@@ -466,7 +466,7 @@ static int da9062_i2c_probe(struct i2c_client *i2c,
466 if (ret < 0) 466 if (ret < 0)
467 dev_warn(chip->dev, "Cannot clear fault log\n"); 467 dev_warn(chip->dev, "Cannot clear fault log\n");
468 468
469 ret = get_device_type(chip); 469 ret = da9062_get_device_type(chip);
470 if (ret) 470 if (ret)
471 return ret; 471 return ret;
472 472
diff --git a/drivers/mfd/da9150-core.c b/drivers/mfd/da9150-core.c
index 94b9bbd1a69b..195fdcfa1a0d 100644
--- a/drivers/mfd/da9150-core.c
+++ b/drivers/mfd/da9150-core.c
@@ -23,6 +23,77 @@
23#include <linux/mfd/da9150/core.h> 23#include <linux/mfd/da9150/core.h>
24#include <linux/mfd/da9150/registers.h> 24#include <linux/mfd/da9150/registers.h>
25 25
26/* Raw device access, used for QIF */
27static int da9150_i2c_read_device(struct i2c_client *client, u8 addr, int count,
28 u8 *buf)
29{
30 struct i2c_msg xfer;
31 int ret;
32
33 /*
34 * Read is split into two transfers as device expects STOP/START rather
35 * than repeated start to carry out this kind of access.
36 */
37
38 /* Write address */
39 xfer.addr = client->addr;
40 xfer.flags = 0;
41 xfer.len = 1;
42 xfer.buf = &addr;
43
44 ret = i2c_transfer(client->adapter, &xfer, 1);
45 if (ret != 1) {
46 if (ret < 0)
47 return ret;
48 else
49 return -EIO;
50 }
51
52 /* Read data */
53 xfer.addr = client->addr;
54 xfer.flags = I2C_M_RD;
55 xfer.len = count;
56 xfer.buf = buf;
57
58 ret = i2c_transfer(client->adapter, &xfer, 1);
59 if (ret == 1)
60 return 0;
61 else if (ret < 0)
62 return ret;
63 else
64 return -EIO;
65}
66
67static int da9150_i2c_write_device(struct i2c_client *client, u8 addr,
68 int count, const u8 *buf)
69{
70 struct i2c_msg xfer;
71 u8 *reg_data;
72 int ret;
73
74 reg_data = kzalloc(1 + count, GFP_KERNEL);
75 if (!reg_data)
76 return -ENOMEM;
77
78 reg_data[0] = addr;
79 memcpy(&reg_data[1], buf, count);
80
81 /* Write address & data */
82 xfer.addr = client->addr;
83 xfer.flags = 0;
84 xfer.len = 1 + count;
85 xfer.buf = reg_data;
86
87 ret = i2c_transfer(client->adapter, &xfer, 1);
88 kfree(reg_data);
89 if (ret == 1)
90 return 0;
91 else if (ret < 0)
92 return ret;
93 else
94 return -EIO;
95}
96
26static bool da9150_volatile_reg(struct device *dev, unsigned int reg) 97static bool da9150_volatile_reg(struct device *dev, unsigned int reg)
27{ 98{
28 switch (reg) { 99 switch (reg) {
@@ -107,6 +178,28 @@ static const struct regmap_config da9150_regmap_config = {
107 .volatile_reg = da9150_volatile_reg, 178 .volatile_reg = da9150_volatile_reg,
108}; 179};
109 180
181void da9150_read_qif(struct da9150 *da9150, u8 addr, int count, u8 *buf)
182{
183 int ret;
184
185 ret = da9150_i2c_read_device(da9150->core_qif, addr, count, buf);
186 if (ret < 0)
187 dev_err(da9150->dev, "Failed to read from QIF 0x%x: %d\n",
188 addr, ret);
189}
190EXPORT_SYMBOL_GPL(da9150_read_qif);
191
192void da9150_write_qif(struct da9150 *da9150, u8 addr, int count, const u8 *buf)
193{
194 int ret;
195
196 ret = da9150_i2c_write_device(da9150->core_qif, addr, count, buf);
197 if (ret < 0)
198 dev_err(da9150->dev, "Failed to write to QIF 0x%x: %d\n",
199 addr, ret);
200}
201EXPORT_SYMBOL_GPL(da9150_write_qif);
202
110u8 da9150_reg_read(struct da9150 *da9150, u16 reg) 203u8 da9150_reg_read(struct da9150 *da9150, u16 reg)
111{ 204{
112 int val, ret; 205 int val, ret;
@@ -262,54 +355,45 @@ static const struct regmap_irq_chip da9150_regmap_irq_chip = {
262}; 355};
263 356
264static struct resource da9150_gpadc_resources[] = { 357static struct resource da9150_gpadc_resources[] = {
265 { 358 DEFINE_RES_IRQ_NAMED(DA9150_IRQ_GPADC, "GPADC"),
266 .name = "GPADC",
267 .start = DA9150_IRQ_GPADC,
268 .end = DA9150_IRQ_GPADC,
269 .flags = IORESOURCE_IRQ,
270 },
271}; 359};
272 360
273static struct resource da9150_charger_resources[] = { 361static struct resource da9150_charger_resources[] = {
274 { 362 DEFINE_RES_IRQ_NAMED(DA9150_IRQ_CHG, "CHG_STATUS"),
275 .name = "CHG_STATUS", 363 DEFINE_RES_IRQ_NAMED(DA9150_IRQ_TJUNC, "CHG_TJUNC"),
276 .start = DA9150_IRQ_CHG, 364 DEFINE_RES_IRQ_NAMED(DA9150_IRQ_VFAULT, "CHG_VFAULT"),
277 .end = DA9150_IRQ_CHG, 365 DEFINE_RES_IRQ_NAMED(DA9150_IRQ_VBUS, "CHG_VBUS"),
278 .flags = IORESOURCE_IRQ, 366};
279 }, 367
280 { 368static struct resource da9150_fg_resources[] = {
281 .name = "CHG_TJUNC", 369 DEFINE_RES_IRQ_NAMED(DA9150_IRQ_FG, "FG"),
282 .start = DA9150_IRQ_TJUNC, 370};
283 .end = DA9150_IRQ_TJUNC, 371
284 .flags = IORESOURCE_IRQ, 372enum da9150_dev_idx {
285 }, 373 DA9150_GPADC_IDX = 0,
286 { 374 DA9150_CHARGER_IDX,
287 .name = "CHG_VFAULT", 375 DA9150_FG_IDX,
288 .start = DA9150_IRQ_VFAULT,
289 .end = DA9150_IRQ_VFAULT,
290 .flags = IORESOURCE_IRQ,
291 },
292 {
293 .name = "CHG_VBUS",
294 .start = DA9150_IRQ_VBUS,
295 .end = DA9150_IRQ_VBUS,
296 .flags = IORESOURCE_IRQ,
297 },
298}; 376};
299 377
300static struct mfd_cell da9150_devs[] = { 378static struct mfd_cell da9150_devs[] = {
301 { 379 [DA9150_GPADC_IDX] = {
302 .name = "da9150-gpadc", 380 .name = "da9150-gpadc",
303 .of_compatible = "dlg,da9150-gpadc", 381 .of_compatible = "dlg,da9150-gpadc",
304 .resources = da9150_gpadc_resources, 382 .resources = da9150_gpadc_resources,
305 .num_resources = ARRAY_SIZE(da9150_gpadc_resources), 383 .num_resources = ARRAY_SIZE(da9150_gpadc_resources),
306 }, 384 },
307 { 385 [DA9150_CHARGER_IDX] = {
308 .name = "da9150-charger", 386 .name = "da9150-charger",
309 .of_compatible = "dlg,da9150-charger", 387 .of_compatible = "dlg,da9150-charger",
310 .resources = da9150_charger_resources, 388 .resources = da9150_charger_resources,
311 .num_resources = ARRAY_SIZE(da9150_charger_resources), 389 .num_resources = ARRAY_SIZE(da9150_charger_resources),
312 }, 390 },
391 [DA9150_FG_IDX] = {
392 .name = "da9150-fuel-gauge",
393 .of_compatible = "dlg,da9150-fuel-gauge",
394 .resources = da9150_fg_resources,
395 .num_resources = ARRAY_SIZE(da9150_fg_resources),
396 },
313}; 397};
314 398
315static int da9150_probe(struct i2c_client *client, 399static int da9150_probe(struct i2c_client *client,
@@ -317,6 +401,7 @@ static int da9150_probe(struct i2c_client *client,
317{ 401{
318 struct da9150 *da9150; 402 struct da9150 *da9150;
319 struct da9150_pdata *pdata = dev_get_platdata(&client->dev); 403 struct da9150_pdata *pdata = dev_get_platdata(&client->dev);
404 int qif_addr;
320 int ret; 405 int ret;
321 406
322 da9150 = devm_kzalloc(&client->dev, sizeof(*da9150), GFP_KERNEL); 407 da9150 = devm_kzalloc(&client->dev, sizeof(*da9150), GFP_KERNEL);
@@ -335,16 +420,41 @@ static int da9150_probe(struct i2c_client *client,
335 return ret; 420 return ret;
336 } 421 }
337 422
338 da9150->irq_base = pdata ? pdata->irq_base : -1; 423 /* Setup secondary I2C interface for QIF access */
424 qif_addr = da9150_reg_read(da9150, DA9150_CORE2WIRE_CTRL_A);
425 qif_addr = (qif_addr & DA9150_CORE_BASE_ADDR_MASK) >> 1;
426 qif_addr |= DA9150_QIF_I2C_ADDR_LSB;
427 da9150->core_qif = i2c_new_dummy(client->adapter, qif_addr);
428 if (!da9150->core_qif) {
429 dev_err(da9150->dev, "Failed to attach QIF client\n");
430 return -ENODEV;
431 }
432
433 i2c_set_clientdata(da9150->core_qif, da9150);
434
435 if (pdata) {
436 da9150->irq_base = pdata->irq_base;
437
438 da9150_devs[DA9150_FG_IDX].platform_data = pdata->fg_pdata;
439 da9150_devs[DA9150_FG_IDX].pdata_size =
440 sizeof(struct da9150_fg_pdata);
441 } else {
442 da9150->irq_base = -1;
443 }
339 444
340 ret = regmap_add_irq_chip(da9150->regmap, da9150->irq, 445 ret = regmap_add_irq_chip(da9150->regmap, da9150->irq,
341 IRQF_TRIGGER_LOW | IRQF_ONESHOT, 446 IRQF_TRIGGER_LOW | IRQF_ONESHOT,
342 da9150->irq_base, &da9150_regmap_irq_chip, 447 da9150->irq_base, &da9150_regmap_irq_chip,
343 &da9150->regmap_irq_data); 448 &da9150->regmap_irq_data);
344 if (ret) 449 if (ret) {
345 return ret; 450 dev_err(da9150->dev, "Failed to add regmap irq chip: %d\n",
451 ret);
452 goto regmap_irq_fail;
453 }
454
346 455
347 da9150->irq_base = regmap_irq_chip_get_base(da9150->regmap_irq_data); 456 da9150->irq_base = regmap_irq_chip_get_base(da9150->regmap_irq_data);
457
348 enable_irq_wake(da9150->irq); 458 enable_irq_wake(da9150->irq);
349 459
350 ret = mfd_add_devices(da9150->dev, -1, da9150_devs, 460 ret = mfd_add_devices(da9150->dev, -1, da9150_devs,
@@ -352,11 +462,17 @@ static int da9150_probe(struct i2c_client *client,
352 da9150->irq_base, NULL); 462 da9150->irq_base, NULL);
353 if (ret) { 463 if (ret) {
354 dev_err(da9150->dev, "Failed to add child devices: %d\n", ret); 464 dev_err(da9150->dev, "Failed to add child devices: %d\n", ret);
355 regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data); 465 goto mfd_fail;
356 return ret;
357 } 466 }
358 467
359 return 0; 468 return 0;
469
470mfd_fail:
471 regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data);
472regmap_irq_fail:
473 i2c_unregister_device(da9150->core_qif);
474
475 return ret;
360} 476}
361 477
362static int da9150_remove(struct i2c_client *client) 478static int da9150_remove(struct i2c_client *client)
@@ -365,6 +481,7 @@ static int da9150_remove(struct i2c_client *client)
365 481
366 regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data); 482 regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data);
367 mfd_remove_devices(da9150->dev); 483 mfd_remove_devices(da9150->dev);
484 i2c_unregister_device(da9150->core_qif);
368 485
369 return 0; 486 return 0;
370} 487}
diff --git a/drivers/mfd/hi6421-pmic-core.c b/drivers/mfd/hi6421-pmic-core.c
index 95b2ff8f223a..f9ded45a992d 100644
--- a/drivers/mfd/hi6421-pmic-core.c
+++ b/drivers/mfd/hi6421-pmic-core.c
@@ -97,6 +97,7 @@ static const struct of_device_id of_hi6421_pmic_match_tbl[] = {
97 { .compatible = "hisilicon,hi6421-pmic", }, 97 { .compatible = "hisilicon,hi6421-pmic", },
98 { }, 98 { },
99}; 99};
100MODULE_DEVICE_TABLE(of, of_hi6421_pmic_match_tbl);
100 101
101static struct platform_driver hi6421_pmic_driver = { 102static struct platform_driver hi6421_pmic_driver = {
102 .driver = { 103 .driver = {
diff --git a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c
index 1bd5b042c8b3..0c6ff727b2ec 100644
--- a/drivers/mfd/htc-i2cpld.c
+++ b/drivers/mfd/htc-i2cpld.c
@@ -318,7 +318,6 @@ static int htcpld_setup_chip_irq(
318 struct htcpld_data *htcpld; 318 struct htcpld_data *htcpld;
319 struct htcpld_chip *chip; 319 struct htcpld_chip *chip;
320 unsigned int irq, irq_end; 320 unsigned int irq, irq_end;
321 int ret = 0;
322 321
323 /* Get the platform and driver data */ 322 /* Get the platform and driver data */
324 htcpld = platform_get_drvdata(pdev); 323 htcpld = platform_get_drvdata(pdev);
@@ -333,7 +332,7 @@ static int htcpld_setup_chip_irq(
333 irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE); 332 irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
334 } 333 }
335 334
336 return ret; 335 return 0;
337} 336}
338 337
339static int htcpld_register_chip_i2c( 338static int htcpld_register_chip_i2c(
diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
index 0d92d73bfa0e..b6fd9041f82f 100644
--- a/drivers/mfd/intel-lpss-acpi.c
+++ b/drivers/mfd/intel-lpss-acpi.c
@@ -25,10 +25,26 @@ static const struct intel_lpss_platform_info spt_info = {
25 .clk_rate = 120000000, 25 .clk_rate = 120000000,
26}; 26};
27 27
28static const struct intel_lpss_platform_info bxt_info = {
29 .clk_rate = 100000000,
30};
31
32static const struct intel_lpss_platform_info bxt_i2c_info = {
33 .clk_rate = 133000000,
34};
35
28static const struct acpi_device_id intel_lpss_acpi_ids[] = { 36static const struct acpi_device_id intel_lpss_acpi_ids[] = {
29 /* SPT */ 37 /* SPT */
30 { "INT3446", (kernel_ulong_t)&spt_info }, 38 { "INT3446", (kernel_ulong_t)&spt_info },
31 { "INT3447", (kernel_ulong_t)&spt_info }, 39 { "INT3447", (kernel_ulong_t)&spt_info },
40 /* BXT */
41 { "80860AAC", (kernel_ulong_t)&bxt_i2c_info },
42 { "80860ABC", (kernel_ulong_t)&bxt_info },
43 { "80860AC2", (kernel_ulong_t)&bxt_info },
44 /* APL */
45 { "80865AAC", (kernel_ulong_t)&bxt_i2c_info },
46 { "80865ABC", (kernel_ulong_t)&bxt_info },
47 { "80865AC2", (kernel_ulong_t)&bxt_info },
32 { } 48 { }
33}; 49};
34MODULE_DEVICE_TABLE(acpi, intel_lpss_acpi_ids); 50MODULE_DEVICE_TABLE(acpi, intel_lpss_acpi_ids);
diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c
index 9236dffeb4d6..5bfdfccbb9a1 100644
--- a/drivers/mfd/intel-lpss-pci.c
+++ b/drivers/mfd/intel-lpss-pci.c
@@ -70,7 +70,52 @@ static const struct intel_lpss_platform_info spt_uart_info = {
70 .clk_con_id = "baudclk", 70 .clk_con_id = "baudclk",
71}; 71};
72 72
73static const struct intel_lpss_platform_info bxt_info = {
74 .clk_rate = 100000000,
75};
76
77static const struct intel_lpss_platform_info bxt_uart_info = {
78 .clk_rate = 100000000,
79 .clk_con_id = "baudclk",
80};
81
82static const struct intel_lpss_platform_info bxt_i2c_info = {
83 .clk_rate = 133000000,
84};
85
73static const struct pci_device_id intel_lpss_pci_ids[] = { 86static const struct pci_device_id intel_lpss_pci_ids[] = {
87 /* BXT */
88 { PCI_VDEVICE(INTEL, 0x0aac), (kernel_ulong_t)&bxt_i2c_info },
89 { PCI_VDEVICE(INTEL, 0x0aae), (kernel_ulong_t)&bxt_i2c_info },
90 { PCI_VDEVICE(INTEL, 0x0ab0), (kernel_ulong_t)&bxt_i2c_info },
91 { PCI_VDEVICE(INTEL, 0x0ab2), (kernel_ulong_t)&bxt_i2c_info },
92 { PCI_VDEVICE(INTEL, 0x0ab4), (kernel_ulong_t)&bxt_i2c_info },
93 { PCI_VDEVICE(INTEL, 0x0ab6), (kernel_ulong_t)&bxt_i2c_info },
94 { PCI_VDEVICE(INTEL, 0x0ab8), (kernel_ulong_t)&bxt_i2c_info },
95 { PCI_VDEVICE(INTEL, 0x0aba), (kernel_ulong_t)&bxt_i2c_info },
96 { PCI_VDEVICE(INTEL, 0x0abc), (kernel_ulong_t)&bxt_uart_info },
97 { PCI_VDEVICE(INTEL, 0x0abe), (kernel_ulong_t)&bxt_uart_info },
98 { PCI_VDEVICE(INTEL, 0x0ac0), (kernel_ulong_t)&bxt_uart_info },
99 { PCI_VDEVICE(INTEL, 0x0ac2), (kernel_ulong_t)&bxt_info },
100 { PCI_VDEVICE(INTEL, 0x0ac4), (kernel_ulong_t)&bxt_info },
101 { PCI_VDEVICE(INTEL, 0x0ac6), (kernel_ulong_t)&bxt_info },
102 { PCI_VDEVICE(INTEL, 0x0aee), (kernel_ulong_t)&bxt_uart_info },
103 /* APL */
104 { PCI_VDEVICE(INTEL, 0x5aac), (kernel_ulong_t)&bxt_i2c_info },
105 { PCI_VDEVICE(INTEL, 0x5aae), (kernel_ulong_t)&bxt_i2c_info },
106 { PCI_VDEVICE(INTEL, 0x5ab0), (kernel_ulong_t)&bxt_i2c_info },
107 { PCI_VDEVICE(INTEL, 0x5ab2), (kernel_ulong_t)&bxt_i2c_info },
108 { PCI_VDEVICE(INTEL, 0x5ab4), (kernel_ulong_t)&bxt_i2c_info },
109 { PCI_VDEVICE(INTEL, 0x5ab6), (kernel_ulong_t)&bxt_i2c_info },
110 { PCI_VDEVICE(INTEL, 0x5ab8), (kernel_ulong_t)&bxt_i2c_info },
111 { PCI_VDEVICE(INTEL, 0x5aba), (kernel_ulong_t)&bxt_i2c_info },
112 { PCI_VDEVICE(INTEL, 0x5abc), (kernel_ulong_t)&bxt_uart_info },
113 { PCI_VDEVICE(INTEL, 0x5abe), (kernel_ulong_t)&bxt_uart_info },
114 { PCI_VDEVICE(INTEL, 0x5ac0), (kernel_ulong_t)&bxt_uart_info },
115 { PCI_VDEVICE(INTEL, 0x5ac2), (kernel_ulong_t)&bxt_info },
116 { PCI_VDEVICE(INTEL, 0x5ac4), (kernel_ulong_t)&bxt_info },
117 { PCI_VDEVICE(INTEL, 0x5ac6), (kernel_ulong_t)&bxt_info },
118 { PCI_VDEVICE(INTEL, 0x5aee), (kernel_ulong_t)&bxt_uart_info },
74 /* SPT-LP */ 119 /* SPT-LP */
75 { PCI_VDEVICE(INTEL, 0x9d27), (kernel_ulong_t)&spt_uart_info }, 120 { PCI_VDEVICE(INTEL, 0x9d27), (kernel_ulong_t)&spt_uart_info },
76 { PCI_VDEVICE(INTEL, 0x9d28), (kernel_ulong_t)&spt_uart_info }, 121 { PCI_VDEVICE(INTEL, 0x9d28), (kernel_ulong_t)&spt_uart_info },
diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index fdf4d5c1add2..001a7d7708ce 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -26,6 +26,8 @@
26#include <linux/pm_runtime.h> 26#include <linux/pm_runtime.h>
27#include <linux/seq_file.h> 27#include <linux/seq_file.h>
28 28
29#include <asm-generic/io-64-nonatomic-lo-hi.h>
30
29#include "intel-lpss.h" 31#include "intel-lpss.h"
30 32
31#define LPSS_DEV_OFFSET 0x000 33#define LPSS_DEV_OFFSET 0x000
@@ -52,8 +54,7 @@
52#define LPSS_PRIV_SSP_REG 0x20 54#define LPSS_PRIV_SSP_REG 0x20
53#define LPSS_PRIV_SSP_REG_DIS_DMA_FIN BIT(0) 55#define LPSS_PRIV_SSP_REG_DIS_DMA_FIN BIT(0)
54 56
55#define LPSS_PRIV_REMAP_ADDR_LO 0x40 57#define LPSS_PRIV_REMAP_ADDR 0x40
56#define LPSS_PRIV_REMAP_ADDR_HI 0x44
57 58
58#define LPSS_PRIV_CAPS 0xfc 59#define LPSS_PRIV_CAPS 0xfc
59#define LPSS_PRIV_CAPS_NO_IDMA BIT(8) 60#define LPSS_PRIV_CAPS_NO_IDMA BIT(8)
@@ -250,12 +251,7 @@ static void intel_lpss_set_remap_addr(const struct intel_lpss *lpss)
250{ 251{
251 resource_size_t addr = lpss->info->mem->start; 252 resource_size_t addr = lpss->info->mem->start;
252 253
253 writel(addr, lpss->priv + LPSS_PRIV_REMAP_ADDR_LO); 254 lo_hi_writeq(addr, lpss->priv + LPSS_PRIV_REMAP_ADDR);
254#if BITS_PER_LONG > 32
255 writel(addr >> 32, lpss->priv + LPSS_PRIV_REMAP_ADDR_HI);
256#else
257 writel(0, lpss->priv + LPSS_PRIV_REMAP_ADDR_HI);
258#endif
259} 255}
260 256
261static void intel_lpss_deassert_reset(const struct intel_lpss *lpss) 257static void intel_lpss_deassert_reset(const struct intel_lpss *lpss)
diff --git a/drivers/mfd/intel_quark_i2c_gpio.c b/drivers/mfd/intel_quark_i2c_gpio.c
index 1ce16037d043..042137465300 100644
--- a/drivers/mfd/intel_quark_i2c_gpio.c
+++ b/drivers/mfd/intel_quark_i2c_gpio.c
@@ -31,6 +31,10 @@
31#define MFD_I2C_BAR 0 31#define MFD_I2C_BAR 0
32#define MFD_GPIO_BAR 1 32#define MFD_GPIO_BAR 1
33 33
34/* ACPI _ADR value to match the child node */
35#define MFD_ACPI_MATCH_GPIO 0ULL
36#define MFD_ACPI_MATCH_I2C 1ULL
37
34/* The base GPIO number under GPIOLIB framework */ 38/* The base GPIO number under GPIOLIB framework */
35#define INTEL_QUARK_MFD_GPIO_BASE 8 39#define INTEL_QUARK_MFD_GPIO_BASE 8
36 40
@@ -82,27 +86,37 @@ static struct resource intel_quark_i2c_res[] = {
82 }, 86 },
83}; 87};
84 88
89static struct mfd_cell_acpi_match intel_quark_acpi_match_i2c = {
90 .adr = MFD_ACPI_MATCH_I2C,
91};
92
85static struct resource intel_quark_gpio_res[] = { 93static struct resource intel_quark_gpio_res[] = {
86 [INTEL_QUARK_IORES_MEM] = { 94 [INTEL_QUARK_IORES_MEM] = {
87 .flags = IORESOURCE_MEM, 95 .flags = IORESOURCE_MEM,
88 }, 96 },
89}; 97};
90 98
99static struct mfd_cell_acpi_match intel_quark_acpi_match_gpio = {
100 .adr = MFD_ACPI_MATCH_GPIO,
101};
102
91static struct mfd_cell intel_quark_mfd_cells[] = { 103static struct mfd_cell intel_quark_mfd_cells[] = {
92 { 104 {
93 .id = MFD_I2C_BAR,
94 .name = "i2c_designware",
95 .num_resources = ARRAY_SIZE(intel_quark_i2c_res),
96 .resources = intel_quark_i2c_res,
97 .ignore_resource_conflicts = true,
98 },
99 {
100 .id = MFD_GPIO_BAR, 105 .id = MFD_GPIO_BAR,
101 .name = "gpio-dwapb", 106 .name = "gpio-dwapb",
107 .acpi_match = &intel_quark_acpi_match_gpio,
102 .num_resources = ARRAY_SIZE(intel_quark_gpio_res), 108 .num_resources = ARRAY_SIZE(intel_quark_gpio_res),
103 .resources = intel_quark_gpio_res, 109 .resources = intel_quark_gpio_res,
104 .ignore_resource_conflicts = true, 110 .ignore_resource_conflicts = true,
105 }, 111 },
112 {
113 .id = MFD_I2C_BAR,
114 .name = "i2c_designware",
115 .acpi_match = &intel_quark_acpi_match_i2c,
116 .num_resources = ARRAY_SIZE(intel_quark_i2c_res),
117 .resources = intel_quark_i2c_res,
118 .ignore_resource_conflicts = true,
119 },
106}; 120};
107 121
108static const struct pci_device_id intel_quark_mfd_ids[] = { 122static const struct pci_device_id intel_quark_mfd_ids[] = {
@@ -248,12 +262,11 @@ static int intel_quark_mfd_probe(struct pci_dev *pdev,
248 262
249 dev_set_drvdata(&pdev->dev, quark_mfd); 263 dev_set_drvdata(&pdev->dev, quark_mfd);
250 264
251 ret = intel_quark_i2c_setup(pdev, &intel_quark_mfd_cells[MFD_I2C_BAR]); 265 ret = intel_quark_i2c_setup(pdev, &intel_quark_mfd_cells[1]);
252 if (ret) 266 if (ret)
253 return ret; 267 return ret;
254 268
255 ret = intel_quark_gpio_setup(pdev, 269 ret = intel_quark_gpio_setup(pdev, &intel_quark_mfd_cells[0]);
256 &intel_quark_mfd_cells[MFD_GPIO_BAR]);
257 if (ret) 270 if (ret)
258 return ret; 271 return ret;
259 272
diff --git a/drivers/mfd/intel_soc_pmic_bxtwc.c b/drivers/mfd/intel_soc_pmic_bxtwc.c
new file mode 100644
index 000000000000..b9428767e615
--- /dev/null
+++ b/drivers/mfd/intel_soc_pmic_bxtwc.c
@@ -0,0 +1,477 @@
1/*
2 * MFD core driver for Intel Broxton Whiskey Cove PMIC
3 *
4 * Copyright (C) 2015 Intel Corporation. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#include <linux/module.h>
17#include <linux/acpi.h>
18#include <linux/err.h>
19#include <linux/delay.h>
20#include <linux/interrupt.h>
21#include <linux/kernel.h>
22#include <linux/mfd/core.h>
23#include <linux/mfd/intel_bxtwc.h>
24#include <asm/intel_pmc_ipc.h>
25
26/* PMIC device registers */
27#define REG_ADDR_MASK 0xFF00
28#define REG_ADDR_SHIFT 8
29#define REG_OFFSET_MASK 0xFF
30
31/* Interrupt Status Registers */
32#define BXTWC_IRQLVL1 0x4E02
33#define BXTWC_PWRBTNIRQ 0x4E03
34
35#define BXTWC_THRM0IRQ 0x4E04
36#define BXTWC_THRM1IRQ 0x4E05
37#define BXTWC_THRM2IRQ 0x4E06
38#define BXTWC_BCUIRQ 0x4E07
39#define BXTWC_ADCIRQ 0x4E08
40#define BXTWC_CHGR0IRQ 0x4E09
41#define BXTWC_CHGR1IRQ 0x4E0A
42#define BXTWC_GPIOIRQ0 0x4E0B
43#define BXTWC_GPIOIRQ1 0x4E0C
44#define BXTWC_CRITIRQ 0x4E0D
45
46/* Interrupt MASK Registers */
47#define BXTWC_MIRQLVL1 0x4E0E
48#define BXTWC_MPWRTNIRQ 0x4E0F
49
50#define BXTWC_MTHRM0IRQ 0x4E12
51#define BXTWC_MTHRM1IRQ 0x4E13
52#define BXTWC_MTHRM2IRQ 0x4E14
53#define BXTWC_MBCUIRQ 0x4E15
54#define BXTWC_MADCIRQ 0x4E16
55#define BXTWC_MCHGR0IRQ 0x4E17
56#define BXTWC_MCHGR1IRQ 0x4E18
57#define BXTWC_MGPIO0IRQ 0x4E19
58#define BXTWC_MGPIO1IRQ 0x4E1A
59#define BXTWC_MCRITIRQ 0x4E1B
60
61/* Whiskey Cove PMIC share same ACPI ID between different platforms */
62#define BROXTON_PMIC_WC_HRV 4
63
64/* Manage in two IRQ chips since mask registers are not consecutive */
65enum bxtwc_irqs {
66 /* Level 1 */
67 BXTWC_PWRBTN_LVL1_IRQ = 0,
68 BXTWC_TMU_LVL1_IRQ,
69 BXTWC_THRM_LVL1_IRQ,
70 BXTWC_BCU_LVL1_IRQ,
71 BXTWC_ADC_LVL1_IRQ,
72 BXTWC_CHGR_LVL1_IRQ,
73 BXTWC_GPIO_LVL1_IRQ,
74 BXTWC_CRIT_LVL1_IRQ,
75
76 /* Level 2 */
77 BXTWC_PWRBTN_IRQ,
78};
79
80enum bxtwc_irqs_level2 {
81 /* Level 2 */
82 BXTWC_THRM0_IRQ = 0,
83 BXTWC_THRM1_IRQ,
84 BXTWC_THRM2_IRQ,
85 BXTWC_BCU_IRQ,
86 BXTWC_ADC_IRQ,
87 BXTWC_CHGR0_IRQ,
88 BXTWC_CHGR1_IRQ,
89 BXTWC_GPIO0_IRQ,
90 BXTWC_GPIO1_IRQ,
91 BXTWC_CRIT_IRQ,
92};
93
94static const struct regmap_irq bxtwc_regmap_irqs[] = {
95 REGMAP_IRQ_REG(BXTWC_PWRBTN_LVL1_IRQ, 0, BIT(0)),
96 REGMAP_IRQ_REG(BXTWC_TMU_LVL1_IRQ, 0, BIT(1)),
97 REGMAP_IRQ_REG(BXTWC_THRM_LVL1_IRQ, 0, BIT(2)),
98 REGMAP_IRQ_REG(BXTWC_BCU_LVL1_IRQ, 0, BIT(3)),
99 REGMAP_IRQ_REG(BXTWC_ADC_LVL1_IRQ, 0, BIT(4)),
100 REGMAP_IRQ_REG(BXTWC_CHGR_LVL1_IRQ, 0, BIT(5)),
101 REGMAP_IRQ_REG(BXTWC_GPIO_LVL1_IRQ, 0, BIT(6)),
102 REGMAP_IRQ_REG(BXTWC_CRIT_LVL1_IRQ, 0, BIT(7)),
103 REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 1, 0x03),
104};
105
106static const struct regmap_irq bxtwc_regmap_irqs_level2[] = {
107 REGMAP_IRQ_REG(BXTWC_THRM0_IRQ, 0, 0xff),
108 REGMAP_IRQ_REG(BXTWC_THRM1_IRQ, 1, 0xbf),
109 REGMAP_IRQ_REG(BXTWC_THRM2_IRQ, 2, 0xff),
110 REGMAP_IRQ_REG(BXTWC_BCU_IRQ, 3, 0x1f),
111 REGMAP_IRQ_REG(BXTWC_ADC_IRQ, 4, 0xff),
112 REGMAP_IRQ_REG(BXTWC_CHGR0_IRQ, 5, 0x1f),
113 REGMAP_IRQ_REG(BXTWC_CHGR1_IRQ, 6, 0x1f),
114 REGMAP_IRQ_REG(BXTWC_GPIO0_IRQ, 7, 0xff),
115 REGMAP_IRQ_REG(BXTWC_GPIO1_IRQ, 8, 0x3f),
116 REGMAP_IRQ_REG(BXTWC_CRIT_IRQ, 9, 0x03),
117};
118
119static struct regmap_irq_chip bxtwc_regmap_irq_chip = {
120 .name = "bxtwc_irq_chip",
121 .status_base = BXTWC_IRQLVL1,
122 .mask_base = BXTWC_MIRQLVL1,
123 .irqs = bxtwc_regmap_irqs,
124 .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs),
125 .num_regs = 2,
126};
127
128static struct regmap_irq_chip bxtwc_regmap_irq_chip_level2 = {
129 .name = "bxtwc_irq_chip_level2",
130 .status_base = BXTWC_THRM0IRQ,
131 .mask_base = BXTWC_MTHRM0IRQ,
132 .irqs = bxtwc_regmap_irqs_level2,
133 .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs_level2),
134 .num_regs = 10,
135};
136
137static struct resource gpio_resources[] = {
138 DEFINE_RES_IRQ_NAMED(BXTWC_GPIO0_IRQ, "GPIO0"),
139 DEFINE_RES_IRQ_NAMED(BXTWC_GPIO1_IRQ, "GPIO1"),
140};
141
142static struct resource adc_resources[] = {
143 DEFINE_RES_IRQ_NAMED(BXTWC_ADC_IRQ, "ADC"),
144};
145
146static struct resource charger_resources[] = {
147 DEFINE_RES_IRQ_NAMED(BXTWC_CHGR0_IRQ, "CHARGER"),
148 DEFINE_RES_IRQ_NAMED(BXTWC_CHGR1_IRQ, "CHARGER1"),
149};
150
151static struct resource thermal_resources[] = {
152 DEFINE_RES_IRQ(BXTWC_THRM0_IRQ),
153 DEFINE_RES_IRQ(BXTWC_THRM1_IRQ),
154 DEFINE_RES_IRQ(BXTWC_THRM2_IRQ),
155};
156
157static struct resource bcu_resources[] = {
158 DEFINE_RES_IRQ_NAMED(BXTWC_BCU_IRQ, "BCU"),
159};
160
161static struct mfd_cell bxt_wc_dev[] = {
162 {
163 .name = "bxt_wcove_gpadc",
164 .num_resources = ARRAY_SIZE(adc_resources),
165 .resources = adc_resources,
166 },
167 {
168 .name = "bxt_wcove_thermal",
169 .num_resources = ARRAY_SIZE(thermal_resources),
170 .resources = thermal_resources,
171 },
172 {
173 .name = "bxt_wcove_ext_charger",
174 .num_resources = ARRAY_SIZE(charger_resources),
175 .resources = charger_resources,
176 },
177 {
178 .name = "bxt_wcove_bcu",
179 .num_resources = ARRAY_SIZE(bcu_resources),
180 .resources = bcu_resources,
181 },
182 {
183 .name = "bxt_wcove_gpio",
184 .num_resources = ARRAY_SIZE(gpio_resources),
185 .resources = gpio_resources,
186 },
187 {
188 .name = "bxt_wcove_region",
189 },
190};
191
192static int regmap_ipc_byte_reg_read(void *context, unsigned int reg,
193 unsigned int *val)
194{
195 int ret;
196 int i2c_addr;
197 u8 ipc_in[2];
198 u8 ipc_out[4];
199 struct intel_soc_pmic *pmic = context;
200
201 if (reg & REG_ADDR_MASK)
202 i2c_addr = (reg & REG_ADDR_MASK) >> REG_ADDR_SHIFT;
203 else {
204 i2c_addr = BXTWC_DEVICE1_ADDR;
205 if (!i2c_addr) {
206 dev_err(pmic->dev, "I2C address not set\n");
207 return -EINVAL;
208 }
209 }
210 reg &= REG_OFFSET_MASK;
211
212 ipc_in[0] = reg;
213 ipc_in[1] = i2c_addr;
214 ret = intel_pmc_ipc_command(PMC_IPC_PMIC_ACCESS,
215 PMC_IPC_PMIC_ACCESS_READ,
216 ipc_in, sizeof(ipc_in), (u32 *)ipc_out, 1);
217 if (ret) {
218 dev_err(pmic->dev, "Failed to read from PMIC\n");
219 return ret;
220 }
221 *val = ipc_out[0];
222
223 return 0;
224}
225
226static int regmap_ipc_byte_reg_write(void *context, unsigned int reg,
227 unsigned int val)
228{
229 int ret;
230 int i2c_addr;
231 u8 ipc_in[3];
232 struct intel_soc_pmic *pmic = context;
233
234 if (reg & REG_ADDR_MASK)
235 i2c_addr = (reg & REG_ADDR_MASK) >> REG_ADDR_SHIFT;
236 else {
237 i2c_addr = BXTWC_DEVICE1_ADDR;
238 if (!i2c_addr) {
239 dev_err(pmic->dev, "I2C address not set\n");
240 return -EINVAL;
241 }
242 }
243 reg &= REG_OFFSET_MASK;
244
245 ipc_in[0] = reg;
246 ipc_in[1] = i2c_addr;
247 ipc_in[2] = val;
248 ret = intel_pmc_ipc_command(PMC_IPC_PMIC_ACCESS,
249 PMC_IPC_PMIC_ACCESS_WRITE,
250 ipc_in, sizeof(ipc_in), NULL, 0);
251 if (ret) {
252 dev_err(pmic->dev, "Failed to write to PMIC\n");
253 return ret;
254 }
255
256 return 0;
257}
258
259/* sysfs interfaces to r/w PMIC registers, required by initial script */
260static unsigned long bxtwc_reg_addr;
261static ssize_t bxtwc_reg_show(struct device *dev,
262 struct device_attribute *attr, char *buf)
263{
264 return sprintf(buf, "0x%lx\n", bxtwc_reg_addr);
265}
266
267static ssize_t bxtwc_reg_store(struct device *dev,
268 struct device_attribute *attr, const char *buf, size_t count)
269{
270 if (kstrtoul(buf, 0, &bxtwc_reg_addr)) {
271 dev_err(dev, "Invalid register address\n");
272 return -EINVAL;
273 }
274 return (ssize_t)count;
275}
276
277static ssize_t bxtwc_val_show(struct device *dev,
278 struct device_attribute *attr, char *buf)
279{
280 int ret;
281 unsigned int val;
282 struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
283
284 ret = regmap_read(pmic->regmap, bxtwc_reg_addr, &val);
285 if (ret < 0) {
286 dev_err(dev, "Failed to read 0x%lx\n", bxtwc_reg_addr);
287 return -EIO;
288 }
289
290 return sprintf(buf, "0x%02x\n", val);
291}
292
293static ssize_t bxtwc_val_store(struct device *dev,
294 struct device_attribute *attr, const char *buf, size_t count)
295{
296 int ret;
297 unsigned int val;
298 struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
299
300 ret = kstrtouint(buf, 0, &val);
301 if (ret)
302 return ret;
303
304 ret = regmap_write(pmic->regmap, bxtwc_reg_addr, val);
305 if (ret) {
306 dev_err(dev, "Failed to write value 0x%02x to address 0x%lx",
307 val, bxtwc_reg_addr);
308 return -EIO;
309 }
310 return count;
311}
312
313static DEVICE_ATTR(addr, S_IWUSR | S_IRUSR, bxtwc_reg_show, bxtwc_reg_store);
314static DEVICE_ATTR(val, S_IWUSR | S_IRUSR, bxtwc_val_show, bxtwc_val_store);
315static struct attribute *bxtwc_attrs[] = {
316 &dev_attr_addr.attr,
317 &dev_attr_val.attr,
318 NULL
319};
320
321static const struct attribute_group bxtwc_group = {
322 .attrs = bxtwc_attrs,
323};
324
325static const struct regmap_config bxtwc_regmap_config = {
326 .reg_bits = 16,
327 .val_bits = 8,
328 .reg_write = regmap_ipc_byte_reg_write,
329 .reg_read = regmap_ipc_byte_reg_read,
330};
331
332static int bxtwc_probe(struct platform_device *pdev)
333{
334 int ret;
335 acpi_handle handle;
336 acpi_status status;
337 unsigned long long hrv;
338 struct intel_soc_pmic *pmic;
339
340 handle = ACPI_HANDLE(&pdev->dev);
341 status = acpi_evaluate_integer(handle, "_HRV", NULL, &hrv);
342 if (ACPI_FAILURE(status)) {
343 dev_err(&pdev->dev, "Failed to get PMIC hardware revision\n");
344 return -ENODEV;
345 }
346 if (hrv != BROXTON_PMIC_WC_HRV) {
347 dev_err(&pdev->dev, "Invalid PMIC hardware revision: %llu\n",
348 hrv);
349 return -ENODEV;
350 }
351
352 pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL);
353 if (!pmic)
354 return -ENOMEM;
355
356 ret = platform_get_irq(pdev, 0);
357 if (ret < 0) {
358 dev_err(&pdev->dev, "Invalid IRQ\n");
359 return ret;
360 }
361 pmic->irq = ret;
362
363 dev_set_drvdata(&pdev->dev, pmic);
364 pmic->dev = &pdev->dev;
365
366 pmic->regmap = devm_regmap_init(&pdev->dev, NULL, pmic,
367 &bxtwc_regmap_config);
368 if (IS_ERR(pmic->regmap)) {
369 ret = PTR_ERR(pmic->regmap);
370 dev_err(&pdev->dev, "Failed to initialise regmap: %d\n", ret);
371 return ret;
372 }
373
374 ret = regmap_add_irq_chip(pmic->regmap, pmic->irq,
375 IRQF_ONESHOT | IRQF_SHARED,
376 0, &bxtwc_regmap_irq_chip,
377 &pmic->irq_chip_data);
378 if (ret) {
379 dev_err(&pdev->dev, "Failed to add IRQ chip\n");
380 return ret;
381 }
382
383 ret = regmap_add_irq_chip(pmic->regmap, pmic->irq,
384 IRQF_ONESHOT | IRQF_SHARED,
385 0, &bxtwc_regmap_irq_chip_level2,
386 &pmic->irq_chip_data_level2);
387 if (ret) {
388 dev_err(&pdev->dev, "Failed to add secondary IRQ chip\n");
389 goto err_irq_chip_level2;
390 }
391
392 ret = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, bxt_wc_dev,
393 ARRAY_SIZE(bxt_wc_dev), NULL, 0,
394 NULL);
395 if (ret) {
396 dev_err(&pdev->dev, "Failed to add devices\n");
397 goto err_mfd;
398 }
399
400 ret = sysfs_create_group(&pdev->dev.kobj, &bxtwc_group);
401 if (ret) {
402 dev_err(&pdev->dev, "Failed to create sysfs group %d\n", ret);
403 goto err_sysfs;
404 }
405
406 return 0;
407
408err_sysfs:
409 mfd_remove_devices(&pdev->dev);
410err_mfd:
411 regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data_level2);
412err_irq_chip_level2:
413 regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data);
414
415 return ret;
416}
417
418static int bxtwc_remove(struct platform_device *pdev)
419{
420 struct intel_soc_pmic *pmic = dev_get_drvdata(&pdev->dev);
421
422 sysfs_remove_group(&pdev->dev.kobj, &bxtwc_group);
423 mfd_remove_devices(&pdev->dev);
424 regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data);
425 regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data_level2);
426
427 return 0;
428}
429
430static void bxtwc_shutdown(struct platform_device *pdev)
431{
432 struct intel_soc_pmic *pmic = dev_get_drvdata(&pdev->dev);
433
434 disable_irq(pmic->irq);
435}
436
437#ifdef CONFIG_PM_SLEEP
438static int bxtwc_suspend(struct device *dev)
439{
440 struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
441
442 disable_irq(pmic->irq);
443
444 return 0;
445}
446
447static int bxtwc_resume(struct device *dev)
448{
449 struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
450
451 enable_irq(pmic->irq);
452 return 0;
453}
454#endif
455static SIMPLE_DEV_PM_OPS(bxtwc_pm_ops, bxtwc_suspend, bxtwc_resume);
456
457static const struct acpi_device_id bxtwc_acpi_ids[] = {
458 { "INT34D3", },
459 { }
460};
461MODULE_DEVICE_TABLE(acpi, pmic_acpi_ids);
462
463static struct platform_driver bxtwc_driver = {
464 .probe = bxtwc_probe,
465 .remove = bxtwc_remove,
466 .shutdown = bxtwc_shutdown,
467 .driver = {
468 .name = "BXTWC PMIC",
469 .pm = &bxtwc_pm_ops,
470 .acpi_match_table = ACPI_PTR(bxtwc_acpi_ids),
471 },
472};
473
474module_platform_driver(bxtwc_driver);
475
476MODULE_LICENSE("GPL v2");
477MODULE_AUTHOR("Qipeng Zha<qipeng.zha@intel.com>");
diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c
index 463f4eae20c1..05b924542ee2 100644
--- a/drivers/mfd/kempld-core.c
+++ b/drivers/mfd/kempld-core.c
@@ -448,7 +448,6 @@ static int kempld_probe(struct platform_device *pdev)
448 struct device *dev = &pdev->dev; 448 struct device *dev = &pdev->dev;
449 struct kempld_device_data *pld; 449 struct kempld_device_data *pld;
450 struct resource *ioport; 450 struct resource *ioport;
451 int ret;
452 451
453 pld = devm_kzalloc(dev, sizeof(*pld), GFP_KERNEL); 452 pld = devm_kzalloc(dev, sizeof(*pld), GFP_KERNEL);
454 if (!pld) 453 if (!pld)
@@ -471,11 +470,7 @@ static int kempld_probe(struct platform_device *pdev)
471 mutex_init(&pld->lock); 470 mutex_init(&pld->lock);
472 platform_set_drvdata(pdev, pld); 471 platform_set_drvdata(pdev, pld);
473 472
474 ret = kempld_detect_device(pld); 473 return kempld_detect_device(pld);
475 if (ret)
476 return ret;
477
478 return 0;
479} 474}
480 475
481static int kempld_remove(struct platform_device *pdev) 476static int kempld_remove(struct platform_device *pdev)
@@ -756,7 +751,6 @@ MODULE_DEVICE_TABLE(dmi, kempld_dmi_table);
756static int __init kempld_init(void) 751static int __init kempld_init(void)
757{ 752{
758 const struct dmi_system_id *id; 753 const struct dmi_system_id *id;
759 int ret;
760 754
761 if (force_device_id[0]) { 755 if (force_device_id[0]) {
762 for (id = kempld_dmi_table; 756 for (id = kempld_dmi_table;
@@ -771,11 +765,7 @@ static int __init kempld_init(void)
771 return -ENODEV; 765 return -ENODEV;
772 } 766 }
773 767
774 ret = platform_driver_register(&kempld_driver); 768 return platform_driver_register(&kempld_driver);
775 if (ret)
776 return ret;
777
778 return 0;
779} 769}
780 770
781static void __exit kempld_exit(void) 771static void __exit kempld_exit(void)
diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c
index 643f3750e830..5abcbb2e8849 100644
--- a/drivers/mfd/lm3533-core.c
+++ b/drivers/mfd/lm3533-core.c
@@ -472,11 +472,7 @@ static int lm3533_device_setup(struct lm3533 *lm3533,
472 if (ret) 472 if (ret)
473 return ret; 473 return ret;
474 474
475 ret = lm3533_set_boost_ovp(lm3533, pdata->boost_ovp); 475 return lm3533_set_boost_ovp(lm3533, pdata->boost_ovp);
476 if (ret)
477 return ret;
478
479 return 0;
480} 476}
481 477
482static int lm3533_device_init(struct lm3533 *lm3533) 478static int lm3533_device_init(struct lm3533 *lm3533)
@@ -596,7 +592,6 @@ static int lm3533_i2c_probe(struct i2c_client *i2c,
596 const struct i2c_device_id *id) 592 const struct i2c_device_id *id)
597{ 593{
598 struct lm3533 *lm3533; 594 struct lm3533 *lm3533;
599 int ret;
600 595
601 dev_dbg(&i2c->dev, "%s\n", __func__); 596 dev_dbg(&i2c->dev, "%s\n", __func__);
602 597
@@ -613,11 +608,7 @@ static int lm3533_i2c_probe(struct i2c_client *i2c,
613 lm3533->dev = &i2c->dev; 608 lm3533->dev = &i2c->dev;
614 lm3533->irq = i2c->irq; 609 lm3533->irq = i2c->irq;
615 610
616 ret = lm3533_device_init(lm3533); 611 return lm3533_device_init(lm3533);
617 if (ret)
618 return ret;
619
620 return 0;
621} 612}
622 613
623static int lm3533_i2c_remove(struct i2c_client *i2c) 614static int lm3533_i2c_remove(struct i2c_client *i2c)
diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c
index c5a9a08b5dfb..b514f3cf140d 100644
--- a/drivers/mfd/lpc_ich.c
+++ b/drivers/mfd/lpc_ich.c
@@ -132,24 +132,18 @@ static struct resource gpio_ich_res[] = {
132 }, 132 },
133}; 133};
134 134
135enum lpc_cells { 135static struct mfd_cell lpc_ich_wdt_cell = {
136 LPC_WDT = 0, 136 .name = "iTCO_wdt",
137 LPC_GPIO, 137 .num_resources = ARRAY_SIZE(wdt_ich_res),
138 .resources = wdt_ich_res,
139 .ignore_resource_conflicts = true,
138}; 140};
139 141
140static struct mfd_cell lpc_ich_cells[] = { 142static struct mfd_cell lpc_ich_gpio_cell = {
141 [LPC_WDT] = { 143 .name = "gpio_ich",
142 .name = "iTCO_wdt", 144 .num_resources = ARRAY_SIZE(gpio_ich_res),
143 .num_resources = ARRAY_SIZE(wdt_ich_res), 145 .resources = gpio_ich_res,
144 .resources = wdt_ich_res, 146 .ignore_resource_conflicts = true,
145 .ignore_resource_conflicts = true,
146 },
147 [LPC_GPIO] = {
148 .name = "gpio_ich",
149 .num_resources = ARRAY_SIZE(gpio_ich_res),
150 .resources = gpio_ich_res,
151 .ignore_resource_conflicts = true,
152 },
153}; 147};
154 148
155/* chipset related info */ 149/* chipset related info */
@@ -841,7 +835,7 @@ static int lpc_ich_finalize_wdt_cell(struct pci_dev *dev)
841 struct itco_wdt_platform_data *pdata; 835 struct itco_wdt_platform_data *pdata;
842 struct lpc_ich_priv *priv = pci_get_drvdata(dev); 836 struct lpc_ich_priv *priv = pci_get_drvdata(dev);
843 struct lpc_ich_info *info; 837 struct lpc_ich_info *info;
844 struct mfd_cell *cell = &lpc_ich_cells[LPC_WDT]; 838 struct mfd_cell *cell = &lpc_ich_wdt_cell;
845 839
846 pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL); 840 pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL);
847 if (!pdata) 841 if (!pdata)
@@ -860,7 +854,7 @@ static int lpc_ich_finalize_wdt_cell(struct pci_dev *dev)
860static void lpc_ich_finalize_gpio_cell(struct pci_dev *dev) 854static void lpc_ich_finalize_gpio_cell(struct pci_dev *dev)
861{ 855{
862 struct lpc_ich_priv *priv = pci_get_drvdata(dev); 856 struct lpc_ich_priv *priv = pci_get_drvdata(dev);
863 struct mfd_cell *cell = &lpc_ich_cells[LPC_GPIO]; 857 struct mfd_cell *cell = &lpc_ich_gpio_cell;
864 858
865 cell->platform_data = &lpc_chipset_info[priv->chipset]; 859 cell->platform_data = &lpc_chipset_info[priv->chipset];
866 cell->pdata_size = sizeof(struct lpc_ich_info); 860 cell->pdata_size = sizeof(struct lpc_ich_info);
@@ -904,7 +898,7 @@ static int lpc_ich_init_gpio(struct pci_dev *dev)
904 base_addr = base_addr_cfg & 0x0000ff80; 898 base_addr = base_addr_cfg & 0x0000ff80;
905 if (!base_addr) { 899 if (!base_addr) {
906 dev_notice(&dev->dev, "I/O space for ACPI uninitialized\n"); 900 dev_notice(&dev->dev, "I/O space for ACPI uninitialized\n");
907 lpc_ich_cells[LPC_GPIO].num_resources--; 901 lpc_ich_gpio_cell.num_resources--;
908 goto gpe0_done; 902 goto gpe0_done;
909 } 903 }
910 904
@@ -918,7 +912,7 @@ static int lpc_ich_init_gpio(struct pci_dev *dev)
918 * the platform_device subsystem doesn't see this resource 912 * the platform_device subsystem doesn't see this resource
919 * or it will register an invalid region. 913 * or it will register an invalid region.
920 */ 914 */
921 lpc_ich_cells[LPC_GPIO].num_resources--; 915 lpc_ich_gpio_cell.num_resources--;
922 acpi_conflict = true; 916 acpi_conflict = true;
923 } else { 917 } else {
924 lpc_ich_enable_acpi_space(dev); 918 lpc_ich_enable_acpi_space(dev);
@@ -958,12 +952,12 @@ gpe0_done:
958 952
959 lpc_ich_finalize_gpio_cell(dev); 953 lpc_ich_finalize_gpio_cell(dev);
960 ret = mfd_add_devices(&dev->dev, PLATFORM_DEVID_AUTO, 954 ret = mfd_add_devices(&dev->dev, PLATFORM_DEVID_AUTO,
961 &lpc_ich_cells[LPC_GPIO], 1, NULL, 0, NULL); 955 &lpc_ich_gpio_cell, 1, NULL, 0, NULL);
962 956
963gpio_done: 957gpio_done:
964 if (acpi_conflict) 958 if (acpi_conflict)
965 pr_warn("Resource conflict(s) found affecting %s\n", 959 pr_warn("Resource conflict(s) found affecting %s\n",
966 lpc_ich_cells[LPC_GPIO].name); 960 lpc_ich_gpio_cell.name);
967 return ret; 961 return ret;
968} 962}
969 963
@@ -1007,7 +1001,7 @@ static int lpc_ich_init_wdt(struct pci_dev *dev)
1007 */ 1001 */
1008 if (lpc_chipset_info[priv->chipset].iTCO_version == 1) { 1002 if (lpc_chipset_info[priv->chipset].iTCO_version == 1) {
1009 /* Don't register iomem for TCO ver 1 */ 1003 /* Don't register iomem for TCO ver 1 */
1010 lpc_ich_cells[LPC_WDT].num_resources--; 1004 lpc_ich_wdt_cell.num_resources--;
1011 } else if (lpc_chipset_info[priv->chipset].iTCO_version == 2) { 1005 } else if (lpc_chipset_info[priv->chipset].iTCO_version == 2) {
1012 pci_read_config_dword(dev, RCBABASE, &base_addr_cfg); 1006 pci_read_config_dword(dev, RCBABASE, &base_addr_cfg);
1013 base_addr = base_addr_cfg & 0xffffc000; 1007 base_addr = base_addr_cfg & 0xffffc000;
@@ -1035,7 +1029,7 @@ static int lpc_ich_init_wdt(struct pci_dev *dev)
1035 goto wdt_done; 1029 goto wdt_done;
1036 1030
1037 ret = mfd_add_devices(&dev->dev, PLATFORM_DEVID_AUTO, 1031 ret = mfd_add_devices(&dev->dev, PLATFORM_DEVID_AUTO,
1038 &lpc_ich_cells[LPC_WDT], 1, NULL, 0, NULL); 1032 &lpc_ich_wdt_cell, 1, NULL, 0, NULL);
1039 1033
1040wdt_done: 1034wdt_done:
1041 return ret; 1035 return ret;
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c
index d3cfa9cf5c8f..156ed6f92aa3 100644
--- a/drivers/mfd/max8997.c
+++ b/drivers/mfd/max8997.c
@@ -55,6 +55,7 @@ static const struct of_device_id max8997_pmic_dt_match[] = {
55 { .compatible = "maxim,max8997-pmic", .data = (void *)TYPE_MAX8997 }, 55 { .compatible = "maxim,max8997-pmic", .data = (void *)TYPE_MAX8997 },
56 {}, 56 {},
57}; 57};
58MODULE_DEVICE_TABLE(of, max8997_pmic_dt_match);
58#endif 59#endif
59 60
60int max8997_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest) 61int max8997_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest)
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index c17635d3e504..60b60dc63ddd 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -82,29 +82,49 @@ static int mfd_platform_add_cell(struct platform_device *pdev,
82static void mfd_acpi_add_device(const struct mfd_cell *cell, 82static void mfd_acpi_add_device(const struct mfd_cell *cell,
83 struct platform_device *pdev) 83 struct platform_device *pdev)
84{ 84{
85 struct acpi_device *parent_adev; 85 const struct mfd_cell_acpi_match *match = cell->acpi_match;
86 struct acpi_device *parent, *child;
86 struct acpi_device *adev; 87 struct acpi_device *adev;
87 88
88 parent_adev = ACPI_COMPANION(pdev->dev.parent); 89 parent = ACPI_COMPANION(pdev->dev.parent);
89 if (!parent_adev) 90 if (!parent)
90 return; 91 return;
91 92
92 /* 93 /*
93 * MFD child device gets its ACPI handle either from the ACPI 94 * MFD child device gets its ACPI handle either from the ACPI device
94 * device directly under the parent that matches the acpi_pnpid or 95 * directly under the parent that matches the either _HID or _CID, or
95 * it will use the parent handle if is no acpi_pnpid is given. 96 * _ADR or it will use the parent handle if is no ID is given.
97 *
98 * Note that use of _ADR is a grey area in the ACPI specification,
99 * though Intel Galileo Gen2 is using it to distinguish the children
100 * devices.
96 */ 101 */
97 adev = parent_adev; 102 adev = parent;
98 if (cell->acpi_pnpid) { 103 if (match) {
99 struct acpi_device_id ids[2] = {}; 104 if (match->pnpid) {
100 struct acpi_device *child_adev; 105 struct acpi_device_id ids[2] = {};
101 106
102 strlcpy(ids[0].id, cell->acpi_pnpid, sizeof(ids[0].id)); 107 strlcpy(ids[0].id, match->pnpid, sizeof(ids[0].id));
103 list_for_each_entry(child_adev, &parent_adev->children, node) 108 list_for_each_entry(child, &parent->children, node) {
104 if (acpi_match_device_ids(child_adev, ids)) { 109 if (acpi_match_device_ids(child, ids)) {
105 adev = child_adev; 110 adev = child;
106 break; 111 break;
112 }
113 }
114 } else {
115 unsigned long long adr;
116 acpi_status status;
117
118 list_for_each_entry(child, &parent->children, node) {
119 status = acpi_evaluate_integer(child->handle,
120 "_ADR", NULL,
121 &adr);
122 if (ACPI_SUCCESS(status) && match->adr == adr) {
123 adev = child;
124 break;
125 }
107 } 126 }
127 }
108 } 128 }
109 129
110 ACPI_COMPANION_SET(&pdev->dev, adev); 130 ACPI_COMPANION_SET(&pdev->dev, adev);
diff --git a/drivers/mfd/pcf50633-irq.c b/drivers/mfd/pcf50633-irq.c
index 498286cbb530..71d43edf110c 100644
--- a/drivers/mfd/pcf50633-irq.c
+++ b/drivers/mfd/pcf50633-irq.c
@@ -55,7 +55,7 @@ EXPORT_SYMBOL_GPL(pcf50633_free_irq);
55static int __pcf50633_irq_mask_set(struct pcf50633 *pcf, int irq, u8 mask) 55static int __pcf50633_irq_mask_set(struct pcf50633 *pcf, int irq, u8 mask)
56{ 56{
57 u8 reg, bit; 57 u8 reg, bit;
58 int ret = 0, idx; 58 int idx;
59 59
60 idx = irq >> 3; 60 idx = irq >> 3;
61 reg = PCF50633_REG_INT1M + idx; 61 reg = PCF50633_REG_INT1M + idx;
@@ -72,7 +72,7 @@ static int __pcf50633_irq_mask_set(struct pcf50633 *pcf, int irq, u8 mask)
72 72
73 mutex_unlock(&pcf->lock); 73 mutex_unlock(&pcf->lock);
74 74
75 return ret; 75 return 0;
76} 76}
77 77
78int pcf50633_irq_mask(struct pcf50633 *pcf, int irq) 78int pcf50633_irq_mask(struct pcf50633 *pcf, int irq)
diff --git a/drivers/mfd/qcom_rpm.c b/drivers/mfd/qcom_rpm.c
index 6afc9fabd94c..207a3bd68559 100644
--- a/drivers/mfd/qcom_rpm.c
+++ b/drivers/mfd/qcom_rpm.c
@@ -550,7 +550,7 @@ static int qcom_rpm_probe(struct platform_device *pdev)
550 ret = devm_request_irq(&pdev->dev, 550 ret = devm_request_irq(&pdev->dev,
551 irq_ack, 551 irq_ack,
552 qcom_rpm_ack_interrupt, 552 qcom_rpm_ack_interrupt,
553 IRQF_TRIGGER_RISING | IRQF_NO_SUSPEND, 553 IRQF_TRIGGER_RISING,
554 "qcom_rpm_ack", 554 "qcom_rpm_ack",
555 rpm); 555 rpm);
556 if (ret) { 556 if (ret) {
diff --git a/drivers/mfd/rt5033.c b/drivers/mfd/rt5033.c
index d60f91619c4a..2b95485f0057 100644
--- a/drivers/mfd/rt5033.c
+++ b/drivers/mfd/rt5033.c
@@ -47,6 +47,9 @@ static const struct mfd_cell rt5033_devs[] = {
47 }, { 47 }, {
48 .name = "rt5033-battery", 48 .name = "rt5033-battery",
49 .of_compatible = "richtek,rt5033-battery", 49 .of_compatible = "richtek,rt5033-battery",
50 }, {
51 .name = "rt5033-led",
52 .of_compatible = "richtek,rt5033-led",
50 }, 53 },
51}; 54};
52 55
@@ -137,7 +140,6 @@ static struct i2c_driver rt5033_driver = {
137}; 140};
138module_i2c_driver(rt5033_driver); 141module_i2c_driver(rt5033_driver);
139 142
140MODULE_ALIAS("i2c:rt5033");
141MODULE_DESCRIPTION("Richtek RT5033 multi-function core driver"); 143MODULE_DESCRIPTION("Richtek RT5033 multi-function core driver");
142MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>"); 144MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>");
143MODULE_LICENSE("GPL"); 145MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/rts5209.c b/drivers/mfd/rts5209.c
index 373e253c33df..b95beecf767f 100644
--- a/drivers/mfd/rts5209.c
+++ b/drivers/mfd/rts5209.c
@@ -138,11 +138,7 @@ static int rts5209_card_power_on(struct rtsx_pcr *pcr, int card)
138 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL, pwr_mask, pwr_on); 138 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL, pwr_mask, pwr_on);
139 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, 139 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL,
140 LDO3318_PWR_MASK, 0x00); 140 LDO3318_PWR_MASK, 0x00);
141 err = rtsx_pci_send_cmd(pcr, 100); 141 return rtsx_pci_send_cmd(pcr, 100);
142 if (err < 0)
143 return err;
144
145 return 0;
146} 142}
147 143
148static int rts5209_card_power_off(struct rtsx_pcr *pcr, int card) 144static int rts5209_card_power_off(struct rtsx_pcr *pcr, int card)
diff --git a/drivers/mfd/rts5227.c b/drivers/mfd/rts5227.c
index ce012d78ce2a..ff296a4bf3d2 100644
--- a/drivers/mfd/rts5227.c
+++ b/drivers/mfd/rts5227.c
@@ -26,6 +26,14 @@
26 26
27#include "rtsx_pcr.h" 27#include "rtsx_pcr.h"
28 28
29static u8 rts5227_get_ic_version(struct rtsx_pcr *pcr)
30{
31 u8 val;
32
33 rtsx_pci_read_register(pcr, DUMMY_REG_RESET_0, &val);
34 return val & 0x0F;
35}
36
29static void rts5227_fill_driving(struct rtsx_pcr *pcr, u8 voltage) 37static void rts5227_fill_driving(struct rtsx_pcr *pcr, u8 voltage)
30{ 38{
31 u8 driving_3v3[4][3] = { 39 u8 driving_3v3[4][3] = {
@@ -88,7 +96,7 @@ static void rts5227_force_power_down(struct rtsx_pcr *pcr, u8 pm_state)
88 rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0); 96 rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0);
89 97
90 if (pm_state == HOST_ENTER_S3) 98 if (pm_state == HOST_ENTER_S3)
91 rtsx_pci_write_register(pcr, PM_CTRL3, 0x10, 0x10); 99 rtsx_pci_write_register(pcr, pcr->reg_pm_ctrl3, 0x10, 0x10);
92 100
93 rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03); 101 rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03);
94} 102}
@@ -121,7 +129,7 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr)
121 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB8, 0xB8); 129 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB8, 0xB8);
122 else 130 else
123 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB8, 0x88); 131 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB8, 0x88);
124 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PM_CTRL3, 0x10, 0x00); 132 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, pcr->reg_pm_ctrl3, 0x10, 0x00);
125 133
126 return rtsx_pci_send_cmd(pcr, 100); 134 return rtsx_pci_send_cmd(pcr, 100);
127} 135}
@@ -179,11 +187,7 @@ static int rts5227_card_power_on(struct rtsx_pcr *pcr, int card)
179 SD_POWER_MASK, SD_POWER_ON); 187 SD_POWER_MASK, SD_POWER_ON);
180 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, 188 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL,
181 LDO3318_PWR_MASK, 0x06); 189 LDO3318_PWR_MASK, 0x06);
182 err = rtsx_pci_send_cmd(pcr, 100); 190 return rtsx_pci_send_cmd(pcr, 100);
183 if (err < 0)
184 return err;
185
186 return 0;
187} 191}
188 192
189static int rts5227_card_power_off(struct rtsx_pcr *pcr, int card) 193static int rts5227_card_power_off(struct rtsx_pcr *pcr, int card)
@@ -298,8 +302,73 @@ void rts5227_init_params(struct rtsx_pcr *pcr)
298 pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 15); 302 pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 15);
299 pcr->rx_initial_phase = SET_CLOCK_PHASE(30, 7, 7); 303 pcr->rx_initial_phase = SET_CLOCK_PHASE(30, 7, 7);
300 304
305 pcr->ic_version = rts5227_get_ic_version(pcr);
301 pcr->sd_pull_ctl_enable_tbl = rts5227_sd_pull_ctl_enable_tbl; 306 pcr->sd_pull_ctl_enable_tbl = rts5227_sd_pull_ctl_enable_tbl;
302 pcr->sd_pull_ctl_disable_tbl = rts5227_sd_pull_ctl_disable_tbl; 307 pcr->sd_pull_ctl_disable_tbl = rts5227_sd_pull_ctl_disable_tbl;
303 pcr->ms_pull_ctl_enable_tbl = rts5227_ms_pull_ctl_enable_tbl; 308 pcr->ms_pull_ctl_enable_tbl = rts5227_ms_pull_ctl_enable_tbl;
304 pcr->ms_pull_ctl_disable_tbl = rts5227_ms_pull_ctl_disable_tbl; 309 pcr->ms_pull_ctl_disable_tbl = rts5227_ms_pull_ctl_disable_tbl;
310
311 pcr->reg_pm_ctrl3 = PM_CTRL3;
312}
313
314static int rts522a_optimize_phy(struct rtsx_pcr *pcr)
315{
316 int err;
317
318 err = rtsx_pci_write_register(pcr, RTS522A_PM_CTRL3, D3_DELINK_MODE_EN,
319 0x00);
320 if (err < 0)
321 return err;
322
323 if (is_version(pcr, 0x522A, IC_VER_A)) {
324 err = rtsx_pci_write_phy_register(pcr, PHY_RCR2,
325 PHY_RCR2_INIT_27S);
326 if (err)
327 return err;
328
329 rtsx_pci_write_phy_register(pcr, PHY_RCR1, PHY_RCR1_INIT_27S);
330 rtsx_pci_write_phy_register(pcr, PHY_FLD0, PHY_FLD0_INIT_27S);
331 rtsx_pci_write_phy_register(pcr, PHY_FLD3, PHY_FLD3_INIT_27S);
332 rtsx_pci_write_phy_register(pcr, PHY_FLD4, PHY_FLD4_INIT_27S);
333 }
334
335 return 0;
336}
337
338static int rts522a_extra_init_hw(struct rtsx_pcr *pcr)
339{
340 rts5227_extra_init_hw(pcr);
341
342 rtsx_pci_write_register(pcr, FUNC_FORCE_CTL, FUNC_FORCE_UPME_XMT_DBG,
343 FUNC_FORCE_UPME_XMT_DBG);
344 rtsx_pci_write_register(pcr, PCLK_CTL, 0x04, 0x04);
345 rtsx_pci_write_register(pcr, PM_EVENT_DEBUG, PME_DEBUG_0, PME_DEBUG_0);
346 rtsx_pci_write_register(pcr, PM_CLK_FORCE_CTL, 0xFF, 0x11);
347
348 return 0;
349}
350
351/* rts522a operations mainly derived from rts5227, except phy/hw init setting.
352 */
353static const struct pcr_ops rts522a_pcr_ops = {
354 .fetch_vendor_settings = rts5227_fetch_vendor_settings,
355 .extra_init_hw = rts522a_extra_init_hw,
356 .optimize_phy = rts522a_optimize_phy,
357 .turn_on_led = rts5227_turn_on_led,
358 .turn_off_led = rts5227_turn_off_led,
359 .enable_auto_blink = rts5227_enable_auto_blink,
360 .disable_auto_blink = rts5227_disable_auto_blink,
361 .card_power_on = rts5227_card_power_on,
362 .card_power_off = rts5227_card_power_off,
363 .switch_output_voltage = rts5227_switch_output_voltage,
364 .cd_deglitch = NULL,
365 .conv_clk_and_div_n = NULL,
366 .force_power_down = rts5227_force_power_down,
367};
368
369void rts522a_init_params(struct rtsx_pcr *pcr)
370{
371 rts5227_init_params(pcr);
372
373 pcr->reg_pm_ctrl3 = RTS522A_PM_CTRL3;
305} 374}
diff --git a/drivers/mfd/rts5229.c b/drivers/mfd/rts5229.c
index ace45384ec8b..9ed9dc84eac8 100644
--- a/drivers/mfd/rts5229.c
+++ b/drivers/mfd/rts5229.c
@@ -129,11 +129,7 @@ static int rts5229_card_power_on(struct rtsx_pcr *pcr, int card)
129 SD_POWER_MASK, SD_POWER_ON); 129 SD_POWER_MASK, SD_POWER_ON);
130 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, 130 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL,
131 LDO3318_PWR_MASK, 0x06); 131 LDO3318_PWR_MASK, 0x06);
132 err = rtsx_pci_send_cmd(pcr, 100); 132 return rtsx_pci_send_cmd(pcr, 100);
133 if (err < 0)
134 return err;
135
136 return 0;
137} 133}
138 134
139static int rts5229_card_power_off(struct rtsx_pcr *pcr, int card) 135static int rts5229_card_power_off(struct rtsx_pcr *pcr, int card)
diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index eb2d5866f719..40f8bb14fc59 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -234,11 +234,7 @@ static int rtsx_base_card_power_on(struct rtsx_pcr *pcr, int card)
234 SD_POWER_MASK, SD_VCC_POWER_ON); 234 SD_POWER_MASK, SD_VCC_POWER_ON);
235 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, 235 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL,
236 LDO3318_PWR_MASK, 0x06); 236 LDO3318_PWR_MASK, 0x06);
237 err = rtsx_pci_send_cmd(pcr, 100); 237 return rtsx_pci_send_cmd(pcr, 100);
238 if (err < 0)
239 return err;
240
241 return 0;
242} 238}
243 239
244static int rtsx_base_card_power_off(struct rtsx_pcr *pcr, int card) 240static int rtsx_base_card_power_off(struct rtsx_pcr *pcr, int card)
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index a66540a49079..f3820d08c9a3 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -55,6 +55,7 @@ static const struct pci_device_id rtsx_pci_ids[] = {
55 { PCI_DEVICE(0x10EC, 0x5229), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 55 { PCI_DEVICE(0x10EC, 0x5229), PCI_CLASS_OTHERS << 16, 0xFF0000 },
56 { PCI_DEVICE(0x10EC, 0x5289), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 56 { PCI_DEVICE(0x10EC, 0x5289), PCI_CLASS_OTHERS << 16, 0xFF0000 },
57 { PCI_DEVICE(0x10EC, 0x5227), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 57 { PCI_DEVICE(0x10EC, 0x5227), PCI_CLASS_OTHERS << 16, 0xFF0000 },
58 { PCI_DEVICE(0x10EC, 0x522A), PCI_CLASS_OTHERS << 16, 0xFF0000 },
58 { PCI_DEVICE(0x10EC, 0x5249), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 59 { PCI_DEVICE(0x10EC, 0x5249), PCI_CLASS_OTHERS << 16, 0xFF0000 },
59 { PCI_DEVICE(0x10EC, 0x5287), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 60 { PCI_DEVICE(0x10EC, 0x5287), PCI_CLASS_OTHERS << 16, 0xFF0000 },
60 { PCI_DEVICE(0x10EC, 0x5286), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 61 { PCI_DEVICE(0x10EC, 0x5286), PCI_CLASS_OTHERS << 16, 0xFF0000 },
@@ -571,11 +572,7 @@ static int rtsx_pci_set_pull_ctl(struct rtsx_pcr *pcr, const u32 *tbl)
571 tbl++; 572 tbl++;
572 } 573 }
573 574
574 err = rtsx_pci_send_cmd(pcr, 100); 575 return rtsx_pci_send_cmd(pcr, 100);
575 if (err < 0)
576 return err;
577
578 return 0;
579} 576}
580 577
581int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card) 578int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card)
@@ -1102,6 +1099,10 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr)
1102 rts5227_init_params(pcr); 1099 rts5227_init_params(pcr);
1103 break; 1100 break;
1104 1101
1102 case 0x522A:
1103 rts522a_init_params(pcr);
1104 break;
1105
1105 case 0x5249: 1106 case 0x5249:
1106 rts5249_init_params(pcr); 1107 rts5249_init_params(pcr);
1107 break; 1108 break;
diff --git a/drivers/mfd/rtsx_pcr.h b/drivers/mfd/rtsx_pcr.h
index ce48842570d7..931d1ae3ce32 100644
--- a/drivers/mfd/rtsx_pcr.h
+++ b/drivers/mfd/rtsx_pcr.h
@@ -27,6 +27,8 @@
27#define MIN_DIV_N_PCR 80 27#define MIN_DIV_N_PCR 80
28#define MAX_DIV_N_PCR 208 28#define MAX_DIV_N_PCR 208
29 29
30#define RTS522A_PM_CTRL3 0xFF7E
31
30#define RTS524A_PME_FORCE_CTL 0xFF78 32#define RTS524A_PME_FORCE_CTL 0xFF78
31#define RTS524A_PM_CTRL3 0xFF7E 33#define RTS524A_PM_CTRL3 0xFF7E
32 34
@@ -38,6 +40,7 @@ void rts5229_init_params(struct rtsx_pcr *pcr);
38void rtl8411_init_params(struct rtsx_pcr *pcr); 40void rtl8411_init_params(struct rtsx_pcr *pcr);
39void rtl8402_init_params(struct rtsx_pcr *pcr); 41void rtl8402_init_params(struct rtsx_pcr *pcr);
40void rts5227_init_params(struct rtsx_pcr *pcr); 42void rts5227_init_params(struct rtsx_pcr *pcr);
43void rts522a_init_params(struct rtsx_pcr *pcr);
41void rts5249_init_params(struct rtsx_pcr *pcr); 44void rts5249_init_params(struct rtsx_pcr *pcr);
42void rts524a_init_params(struct rtsx_pcr *pcr); 45void rts524a_init_params(struct rtsx_pcr *pcr);
43void rts525a_init_params(struct rtsx_pcr *pcr); 46void rts525a_init_params(struct rtsx_pcr *pcr);
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index d206a3e8fe87..989076d6cb83 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -103,12 +103,9 @@ static const struct mfd_cell s2mpa01_devs[] = {
103}; 103};
104 104
105static const struct mfd_cell s2mpu02_devs[] = { 105static const struct mfd_cell s2mpu02_devs[] = {
106 { .name = "s2mpu02-pmic", },
107 { .name = "s2mpu02-rtc", },
108 { 106 {
109 .name = "s2mpu02-clk", 107 .name = "s2mpu02-pmic",
110 .of_compatible = "samsung,s2mpu02-clk", 108 },
111 }
112}; 109};
113 110
114#ifdef CONFIG_OF 111#ifdef CONFIG_OF
@@ -253,6 +250,38 @@ static const struct regmap_config s5m8767_regmap_config = {
253 .cache_type = REGCACHE_FLAT, 250 .cache_type = REGCACHE_FLAT,
254}; 251};
255 252
253static void sec_pmic_dump_rev(struct sec_pmic_dev *sec_pmic)
254{
255 unsigned int val;
256
257 /* For each device type, the REG_ID is always the first register */
258 if (!regmap_read(sec_pmic->regmap_pmic, S2MPS11_REG_ID, &val))
259 dev_dbg(sec_pmic->dev, "Revision: 0x%x\n", val);
260}
261
262static void sec_pmic_configure(struct sec_pmic_dev *sec_pmic)
263{
264 int err;
265
266 if (sec_pmic->device_type != S2MPS13X)
267 return;
268
269 if (sec_pmic->pdata->disable_wrstbi) {
270 /*
271 * If WRSTBI pin is pulled down this feature must be disabled
272 * because each Suspend to RAM will trigger buck voltage reset
273 * to default values.
274 */
275 err = regmap_update_bits(sec_pmic->regmap_pmic,
276 S2MPS13_REG_WRSTBI,
277 S2MPS13_REG_WRSTBI_MASK, 0x0);
278 if (err)
279 dev_warn(sec_pmic->dev,
280 "Cannot initialize WRSTBI config: %d\n",
281 err);
282 }
283}
284
256#ifdef CONFIG_OF 285#ifdef CONFIG_OF
257/* 286/*
258 * Only the common platform data elements for s5m8767 are parsed here from the 287 * Only the common platform data elements for s5m8767 are parsed here from the
@@ -278,6 +307,10 @@ static struct sec_platform_data *sec_pmic_i2c_parse_dt_pdata(
278 * not parsed here. 307 * not parsed here.
279 */ 308 */
280 309
310 pd->manual_poweroff = of_property_read_bool(dev->of_node,
311 "samsung,s2mps11-acokb-ground");
312 pd->disable_wrstbi = of_property_read_bool(dev->of_node,
313 "samsung,s2mps11-wrstbi-ground");
281 return pd; 314 return pd;
282} 315}
283#else 316#else
@@ -423,6 +456,8 @@ static int sec_pmic_probe(struct i2c_client *i2c,
423 goto err_mfd; 456 goto err_mfd;
424 457
425 device_init_wakeup(sec_pmic->dev, sec_pmic->wakeup); 458 device_init_wakeup(sec_pmic->dev, sec_pmic->wakeup);
459 sec_pmic_configure(sec_pmic);
460 sec_pmic_dump_rev(sec_pmic);
426 461
427 return ret; 462 return ret;
428 463
@@ -440,6 +475,33 @@ static int sec_pmic_remove(struct i2c_client *i2c)
440 return 0; 475 return 0;
441} 476}
442 477
478static void sec_pmic_shutdown(struct i2c_client *i2c)
479{
480 struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c);
481 unsigned int reg, mask;
482
483 if (!sec_pmic->pdata->manual_poweroff)
484 return;
485
486 switch (sec_pmic->device_type) {
487 case S2MPS11X:
488 reg = S2MPS11_REG_CTRL1;
489 mask = S2MPS11_CTRL1_PWRHOLD_MASK;
490 break;
491 default:
492 /*
493 * Currently only one board with S2MPS11 needs this, so just
494 * ignore the rest.
495 */
496 dev_warn(sec_pmic->dev,
497 "Unsupported device %lu for manual power off\n",
498 sec_pmic->device_type);
499 return;
500 }
501
502 regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, 0);
503}
504
443#ifdef CONFIG_PM_SLEEP 505#ifdef CONFIG_PM_SLEEP
444static int sec_pmic_suspend(struct device *dev) 506static int sec_pmic_suspend(struct device *dev)
445{ 507{
@@ -491,6 +553,7 @@ static struct i2c_driver sec_pmic_driver = {
491 }, 553 },
492 .probe = sec_pmic_probe, 554 .probe = sec_pmic_probe,
493 .remove = sec_pmic_remove, 555 .remove = sec_pmic_remove,
556 .shutdown = sec_pmic_shutdown,
494 .id_table = sec_pmic_id, 557 .id_table = sec_pmic_id,
495}; 558};
496 559
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index 91077efc8050..c646784c5a7d 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1719,6 +1719,7 @@ static const struct of_device_id of_sm501_match_tbl[] = {
1719 { .compatible = "smi,sm501", }, 1719 { .compatible = "smi,sm501", },
1720 { /* end */ } 1720 { /* end */ }
1721}; 1721};
1722MODULE_DEVICE_TABLE(of, of_sm501_match_tbl);
1722 1723
1723static struct platform_driver sm501_plat_driver = { 1724static struct platform_driver sm501_plat_driver = {
1724 .driver = { 1725 .driver = {
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
index e971af86ce1e..8222e374e4b1 100644
--- a/drivers/mfd/stmpe.c
+++ b/drivers/mfd/stmpe.c
@@ -795,6 +795,7 @@ static int stmpe24xx_get_altfunc(struct stmpe *stmpe, enum stmpe_block block)
795 return 2; 795 return 2;
796 796
797 case STMPE_BLOCK_KEYPAD: 797 case STMPE_BLOCK_KEYPAD:
798 case STMPE_BLOCK_PWM:
798 return 1; 799 return 1;
799 800
800 case STMPE_BLOCK_GPIO: 801 case STMPE_BLOCK_GPIO:
diff --git a/drivers/mfd/tps6105x.c b/drivers/mfd/tps6105x.c
index 4a174cdb50b6..51c54951c220 100644
--- a/drivers/mfd/tps6105x.c
+++ b/drivers/mfd/tps6105x.c
@@ -64,27 +64,47 @@ static int tps6105x_startup(struct tps6105x *tps6105x)
64} 64}
65 65
66/* 66/*
67 * MFD cells - we have one cell which is selected operation 67 * MFD cells - we always have a GPIO cell and we have one cell
68 * mode, and we always have a GPIO cell. 68 * which is selected operation mode.
69 */ 69 */
70static struct mfd_cell tps6105x_cells[] = { 70static struct mfd_cell tps6105x_gpio_cell = {
71 { 71 .name = "tps6105x-gpio",
72 /* name will be runtime assigned */ 72};
73 .id = -1, 73
74 }, 74static struct mfd_cell tps6105x_leds_cell = {
75 { 75 .name = "tps6105x-leds",
76 .name = "tps6105x-gpio", 76};
77 .id = -1, 77
78 }, 78static struct mfd_cell tps6105x_flash_cell = {
79 .name = "tps6105x-flash",
79}; 80};
80 81
82static struct mfd_cell tps6105x_regulator_cell = {
83 .name = "tps6105x-regulator",
84};
85
86static int tps6105x_add_device(struct tps6105x *tps6105x,
87 struct mfd_cell *cell)
88{
89 cell->platform_data = tps6105x;
90 cell->pdata_size = sizeof(*tps6105x);
91
92 return mfd_add_devices(&tps6105x->client->dev,
93 PLATFORM_DEVID_AUTO, cell, 1, NULL, 0, NULL);
94}
95
81static int tps6105x_probe(struct i2c_client *client, 96static int tps6105x_probe(struct i2c_client *client,
82 const struct i2c_device_id *id) 97 const struct i2c_device_id *id)
83{ 98{
84 struct tps6105x *tps6105x; 99 struct tps6105x *tps6105x;
85 struct tps6105x_platform_data *pdata; 100 struct tps6105x_platform_data *pdata;
86 int ret; 101 int ret;
87 int i; 102
103 pdata = dev_get_platdata(&client->dev);
104 if (!pdata) {
105 dev_err(&client->dev, "missing platform data\n");
106 return -ENODEV;
107 }
88 108
89 tps6105x = devm_kmalloc(&client->dev, sizeof(*tps6105x), GFP_KERNEL); 109 tps6105x = devm_kmalloc(&client->dev, sizeof(*tps6105x), GFP_KERNEL);
90 if (!tps6105x) 110 if (!tps6105x)
@@ -96,7 +116,6 @@ static int tps6105x_probe(struct i2c_client *client,
96 116
97 i2c_set_clientdata(client, tps6105x); 117 i2c_set_clientdata(client, tps6105x);
98 tps6105x->client = client; 118 tps6105x->client = client;
99 pdata = dev_get_platdata(&client->dev);
100 tps6105x->pdata = pdata; 119 tps6105x->pdata = pdata;
101 120
102 ret = tps6105x_startup(tps6105x); 121 ret = tps6105x_startup(tps6105x);
@@ -105,38 +124,33 @@ static int tps6105x_probe(struct i2c_client *client,
105 return ret; 124 return ret;
106 } 125 }
107 126
108 /* Remove warning texts when you implement new cell drivers */ 127 ret = tps6105x_add_device(tps6105x, &tps6105x_gpio_cell);
128 if (ret)
129 return ret;
130
109 switch (pdata->mode) { 131 switch (pdata->mode) {
110 case TPS6105X_MODE_SHUTDOWN: 132 case TPS6105X_MODE_SHUTDOWN:
111 dev_info(&client->dev, 133 dev_info(&client->dev,
112 "present, not used for anything, only GPIO\n"); 134 "present, not used for anything, only GPIO\n");
113 break; 135 break;
114 case TPS6105X_MODE_TORCH: 136 case TPS6105X_MODE_TORCH:
115 tps6105x_cells[0].name = "tps6105x-leds"; 137 ret = tps6105x_add_device(tps6105x, &tps6105x_leds_cell);
116 dev_warn(&client->dev,
117 "torch mode is unsupported\n");
118 break; 138 break;
119 case TPS6105X_MODE_TORCH_FLASH: 139 case TPS6105X_MODE_TORCH_FLASH:
120 tps6105x_cells[0].name = "tps6105x-flash"; 140 ret = tps6105x_add_device(tps6105x, &tps6105x_flash_cell);
121 dev_warn(&client->dev,
122 "flash mode is unsupported\n");
123 break; 141 break;
124 case TPS6105X_MODE_VOLTAGE: 142 case TPS6105X_MODE_VOLTAGE:
125 tps6105x_cells[0].name ="tps6105x-regulator"; 143 ret = tps6105x_add_device(tps6105x, &tps6105x_regulator_cell);
126 break; 144 break;
127 default: 145 default:
146 dev_warn(&client->dev, "invalid mode: %d\n", pdata->mode);
128 break; 147 break;
129 } 148 }
130 149
131 /* Set up and register the platform devices. */ 150 if (ret)
132 for (i = 0; i < ARRAY_SIZE(tps6105x_cells); i++) { 151 mfd_remove_devices(&client->dev);
133 /* One state holder for all drivers, this is simple */
134 tps6105x_cells[i].platform_data = tps6105x;
135 tps6105x_cells[i].pdata_size = sizeof(*tps6105x);
136 }
137 152
138 return mfd_add_devices(&client->dev, 0, tps6105x_cells, 153 return ret;
139 ARRAY_SIZE(tps6105x_cells), NULL, 0, NULL);
140} 154}
141 155
142static int tps6105x_remove(struct i2c_client *client) 156static int tps6105x_remove(struct i2c_client *client)
diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c
index 55add0453ae9..d32b54426b70 100644
--- a/drivers/mfd/tps65217.c
+++ b/drivers/mfd/tps65217.c
@@ -39,6 +39,10 @@ static const struct mfd_cell tps65217s[] = {
39 .name = "tps65217-bl", 39 .name = "tps65217-bl",
40 .of_compatible = "ti,tps65217-bl", 40 .of_compatible = "ti,tps65217-bl",
41 }, 41 },
42 {
43 .name = "tps65217-charger",
44 .of_compatible = "ti,tps65217-charger",
45 },
42}; 46};
43 47
44/** 48/**
diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index a151ee2eed2a..08a693cd38cc 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -647,6 +647,8 @@ static int twl6040_probe(struct i2c_client *client,
647 647
648 twl6040->clk32k = devm_clk_get(&client->dev, "clk32k"); 648 twl6040->clk32k = devm_clk_get(&client->dev, "clk32k");
649 if (IS_ERR(twl6040->clk32k)) { 649 if (IS_ERR(twl6040->clk32k)) {
650 if (PTR_ERR(twl6040->clk32k) == -EPROBE_DEFER)
651 return -EPROBE_DEFER;
650 dev_info(&client->dev, "clk32k is not handled\n"); 652 dev_info(&client->dev, "clk32k is not handled\n");
651 twl6040->clk32k = NULL; 653 twl6040->clk32k = NULL;
652 } 654 }
diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index 28f2ae30507a..2bb2d0467a92 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -250,7 +250,7 @@ static const struct reg_sequence wm5110_revd_patch[] = {
250}; 250};
251 251
252/* Add extra headphone write sequence locations */ 252/* Add extra headphone write sequence locations */
253static const struct reg_default wm5110_reve_patch[] = { 253static const struct reg_sequence wm5110_reve_patch[] = {
254 { 0x80, 0x3 }, 254 { 0x80, 0x3 },
255 { 0x80, 0x3 }, 255 { 0x80, 0x3 },
256 { 0x4b, 0x138 }, 256 { 0x4b, 0x138 },
@@ -1633,6 +1633,185 @@ static const struct reg_default wm5110_reg_default[] = {
1633 { 0x00000EF8, 0x0000 }, /* R3832 - ISRC 3 CTRL 3 */ 1633 { 0x00000EF8, 0x0000 }, /* R3832 - ISRC 3 CTRL 3 */
1634 { 0x00000F00, 0x0000 }, /* R3840 - Clock Control */ 1634 { 0x00000F00, 0x0000 }, /* R3840 - Clock Control */
1635 { 0x00000F01, 0x0000 }, /* R3841 - ANC_SRC */ 1635 { 0x00000F01, 0x0000 }, /* R3841 - ANC_SRC */
1636 { 0x00000F08, 0x001c }, /* R3848 - ANC Coefficient */
1637 { 0x00000F09, 0x0000 }, /* R3849 - ANC Coefficient */
1638 { 0x00000F0A, 0x0000 }, /* R3850 - ANC Coefficient */
1639 { 0x00000F0B, 0x0000 }, /* R3851 - ANC Coefficient */
1640 { 0x00000F0C, 0x0000 }, /* R3852 - ANC Coefficient */
1641 { 0x00000F0D, 0x0000 }, /* R3853 - ANC Coefficient */
1642 { 0x00000F0E, 0x0000 }, /* R3854 - ANC Coefficient */
1643 { 0x00000F0F, 0x0000 }, /* R3855 - ANC Coefficient */
1644 { 0x00000F10, 0x0000 }, /* R3856 - ANC Coefficient */
1645 { 0x00000F11, 0x0000 }, /* R3857 - ANC Coefficient */
1646 { 0x00000F12, 0x0000 }, /* R3858 - ANC Coefficient */
1647 { 0x00000F15, 0x0000 }, /* R3861 - FCL Filter Control */
1648 { 0x00000F17, 0x0004 }, /* R3863 - FCL ADC Reformatter Control */
1649 { 0x00000F18, 0x0004 }, /* R3864 - ANC Coefficient */
1650 { 0x00000F19, 0x0002 }, /* R3865 - ANC Coefficient */
1651 { 0x00000F1A, 0x0000 }, /* R3866 - ANC Coefficient */
1652 { 0x00000F1B, 0x0010 }, /* R3867 - ANC Coefficient */
1653 { 0x00000F1C, 0x0000 }, /* R3868 - ANC Coefficient */
1654 { 0x00000F1D, 0x0000 }, /* R3869 - ANC Coefficient */
1655 { 0x00000F1E, 0x0000 }, /* R3870 - ANC Coefficient */
1656 { 0x00000F1F, 0x0000 }, /* R3871 - ANC Coefficient */
1657 { 0x00000F20, 0x0000 }, /* R3872 - ANC Coefficient */
1658 { 0x00000F21, 0x0000 }, /* R3873 - ANC Coefficient */
1659 { 0x00000F22, 0x0000 }, /* R3874 - ANC Coefficient */
1660 { 0x00000F23, 0x0000 }, /* R3875 - ANC Coefficient */
1661 { 0x00000F24, 0x0000 }, /* R3876 - ANC Coefficient */
1662 { 0x00000F25, 0x0000 }, /* R3877 - ANC Coefficient */
1663 { 0x00000F26, 0x0000 }, /* R3878 - ANC Coefficient */
1664 { 0x00000F27, 0x0000 }, /* R3879 - ANC Coefficient */
1665 { 0x00000F28, 0x0000 }, /* R3880 - ANC Coefficient */
1666 { 0x00000F29, 0x0000 }, /* R3881 - ANC Coefficient */
1667 { 0x00000F2A, 0x0000 }, /* R3882 - ANC Coefficient */
1668 { 0x00000F2B, 0x0000 }, /* R3883 - ANC Coefficient */
1669 { 0x00000F2C, 0x0000 }, /* R3884 - ANC Coefficient */
1670 { 0x00000F2D, 0x0000 }, /* R3885 - ANC Coefficient */
1671 { 0x00000F2E, 0x0000 }, /* R3886 - ANC Coefficient */
1672 { 0x00000F2F, 0x0000 }, /* R3887 - ANC Coefficient */
1673 { 0x00000F30, 0x0000 }, /* R3888 - ANC Coefficient */
1674 { 0x00000F31, 0x0000 }, /* R3889 - ANC Coefficient */
1675 { 0x00000F32, 0x0000 }, /* R3890 - ANC Coefficient */
1676 { 0x00000F33, 0x0000 }, /* R3891 - ANC Coefficient */
1677 { 0x00000F34, 0x0000 }, /* R3892 - ANC Coefficient */
1678 { 0x00000F35, 0x0000 }, /* R3893 - ANC Coefficient */
1679 { 0x00000F36, 0x0000 }, /* R3894 - ANC Coefficient */
1680 { 0x00000F37, 0x0000 }, /* R3895 - ANC Coefficient */
1681 { 0x00000F38, 0x0000 }, /* R3896 - ANC Coefficient */
1682 { 0x00000F39, 0x0000 }, /* R3897 - ANC Coefficient */
1683 { 0x00000F3A, 0x0000 }, /* R3898 - ANC Coefficient */
1684 { 0x00000F3B, 0x0000 }, /* R3899 - ANC Coefficient */
1685 { 0x00000F3C, 0x0000 }, /* R3900 - ANC Coefficient */
1686 { 0x00000F3D, 0x0000 }, /* R3901 - ANC Coefficient */
1687 { 0x00000F3E, 0x0000 }, /* R3902 - ANC Coefficient */
1688 { 0x00000F3F, 0x0000 }, /* R3903 - ANC Coefficient */
1689 { 0x00000F40, 0x0000 }, /* R3904 - ANC Coefficient */
1690 { 0x00000F41, 0x0000 }, /* R3905 - ANC Coefficient */
1691 { 0x00000F42, 0x0000 }, /* R3906 - ANC Coefficient */
1692 { 0x00000F43, 0x0000 }, /* R3907 - ANC Coefficient */
1693 { 0x00000F44, 0x0000 }, /* R3908 - ANC Coefficient */
1694 { 0x00000F45, 0x0000 }, /* R3909 - ANC Coefficient */
1695 { 0x00000F46, 0x0000 }, /* R3910 - ANC Coefficient */
1696 { 0x00000F47, 0x0000 }, /* R3911 - ANC Coefficient */
1697 { 0x00000F48, 0x0000 }, /* R3912 - ANC Coefficient */
1698 { 0x00000F49, 0x0000 }, /* R3913 - ANC Coefficient */
1699 { 0x00000F4A, 0x0000 }, /* R3914 - ANC Coefficient */
1700 { 0x00000F4B, 0x0000 }, /* R3915 - ANC Coefficient */
1701 { 0x00000F4C, 0x0000 }, /* R3916 - ANC Coefficient */
1702 { 0x00000F4D, 0x0000 }, /* R3917 - ANC Coefficient */
1703 { 0x00000F4E, 0x0000 }, /* R3918 - ANC Coefficient */
1704 { 0x00000F4F, 0x0000 }, /* R3919 - ANC Coefficient */
1705 { 0x00000F50, 0x0000 }, /* R3920 - ANC Coefficient */
1706 { 0x00000F51, 0x0000 }, /* R3921 - ANC Coefficient */
1707 { 0x00000F52, 0x0000 }, /* R3922 - ANC Coefficient */
1708 { 0x00000F53, 0x0000 }, /* R3923 - ANC Coefficient */
1709 { 0x00000F54, 0x0000 }, /* R3924 - ANC Coefficient */
1710 { 0x00000F55, 0x0000 }, /* R3925 - ANC Coefficient */
1711 { 0x00000F56, 0x0000 }, /* R3926 - ANC Coefficient */
1712 { 0x00000F57, 0x0000 }, /* R3927 - ANC Coefficient */
1713 { 0x00000F58, 0x0000 }, /* R3928 - ANC Coefficient */
1714 { 0x00000F59, 0x0000 }, /* R3929 - ANC Coefficient */
1715 { 0x00000F5A, 0x0000 }, /* R3930 - ANC Coefficient */
1716 { 0x00000F5B, 0x0000 }, /* R3931 - ANC Coefficient */
1717 { 0x00000F5C, 0x0000 }, /* R3932 - ANC Coefficient */
1718 { 0x00000F5D, 0x0000 }, /* R3933 - ANC Coefficient */
1719 { 0x00000F5E, 0x0000 }, /* R3934 - ANC Coefficient */
1720 { 0x00000F5F, 0x0000 }, /* R3935 - ANC Coefficient */
1721 { 0x00000F60, 0x0000 }, /* R3936 - ANC Coefficient */
1722 { 0x00000F61, 0x0000 }, /* R3937 - ANC Coefficient */
1723 { 0x00000F62, 0x0000 }, /* R3938 - ANC Coefficient */
1724 { 0x00000F63, 0x0000 }, /* R3939 - ANC Coefficient */
1725 { 0x00000F64, 0x0000 }, /* R3940 - ANC Coefficient */
1726 { 0x00000F65, 0x0000 }, /* R3941 - ANC Coefficient */
1727 { 0x00000F66, 0x0000 }, /* R3942 - ANC Coefficient */
1728 { 0x00000F67, 0x0000 }, /* R3943 - ANC Coefficient */
1729 { 0x00000F68, 0x0000 }, /* R3944 - ANC Coefficient */
1730 { 0x00000F69, 0x0000 }, /* R3945 - ANC Coefficient */
1731 { 0x00000F70, 0x0000 }, /* R3952 - FCR Filter Control */
1732 { 0x00000F72, 0x0004 }, /* R3954 - FCR ADC Reformatter Control */
1733 { 0x00000F73, 0x0004 }, /* R3955 - ANC Coefficient */
1734 { 0x00000F74, 0x0002 }, /* R3956 - ANC Coefficient */
1735 { 0x00000F75, 0x0000 }, /* R3957 - ANC Coefficient */
1736 { 0x00000F76, 0x0010 }, /* R3958 - ANC Coefficient */
1737 { 0x00000F77, 0x0000 }, /* R3959 - ANC Coefficient */
1738 { 0x00000F78, 0x0000 }, /* R3960 - ANC Coefficient */
1739 { 0x00000F79, 0x0000 }, /* R3961 - ANC Coefficient */
1740 { 0x00000F7A, 0x0000 }, /* R3962 - ANC Coefficient */
1741 { 0x00000F7B, 0x0000 }, /* R3963 - ANC Coefficient */
1742 { 0x00000F7C, 0x0000 }, /* R3964 - ANC Coefficient */
1743 { 0x00000F7D, 0x0000 }, /* R3965 - ANC Coefficient */
1744 { 0x00000F7E, 0x0000 }, /* R3966 - ANC Coefficient */
1745 { 0x00000F7F, 0x0000 }, /* R3967 - ANC Coefficient */
1746 { 0x00000F80, 0x0000 }, /* R3968 - ANC Coefficient */
1747 { 0x00000F81, 0x0000 }, /* R3969 - ANC Coefficient */
1748 { 0x00000F82, 0x0000 }, /* R3970 - ANC Coefficient */
1749 { 0x00000F83, 0x0000 }, /* R3971 - ANC Coefficient */
1750 { 0x00000F84, 0x0000 }, /* R3972 - ANC Coefficient */
1751 { 0x00000F85, 0x0000 }, /* R3973 - ANC Coefficient */
1752 { 0x00000F86, 0x0000 }, /* R3974 - ANC Coefficient */
1753 { 0x00000F87, 0x0000 }, /* R3975 - ANC Coefficient */
1754 { 0x00000F88, 0x0000 }, /* R3976 - ANC Coefficient */
1755 { 0x00000F89, 0x0000 }, /* R3977 - ANC Coefficient */
1756 { 0x00000F8A, 0x0000 }, /* R3978 - ANC Coefficient */
1757 { 0x00000F8B, 0x0000 }, /* R3979 - ANC Coefficient */
1758 { 0x00000F8C, 0x0000 }, /* R3980 - ANC Coefficient */
1759 { 0x00000F8D, 0x0000 }, /* R3981 - ANC Coefficient */
1760 { 0x00000F8E, 0x0000 }, /* R3982 - ANC Coefficient */
1761 { 0x00000F8F, 0x0000 }, /* R3983 - ANC Coefficient */
1762 { 0x00000F90, 0x0000 }, /* R3984 - ANC Coefficient */
1763 { 0x00000F91, 0x0000 }, /* R3985 - ANC Coefficient */
1764 { 0x00000F92, 0x0000 }, /* R3986 - ANC Coefficient */
1765 { 0x00000F93, 0x0000 }, /* R3987 - ANC Coefficient */
1766 { 0x00000F94, 0x0000 }, /* R3988 - ANC Coefficient */
1767 { 0x00000F95, 0x0000 }, /* R3989 - ANC Coefficient */
1768 { 0x00000F96, 0x0000 }, /* R3990 - ANC Coefficient */
1769 { 0x00000F97, 0x0000 }, /* R3991 - ANC Coefficient */
1770 { 0x00000F98, 0x0000 }, /* R3992 - ANC Coefficient */
1771 { 0x00000F99, 0x0000 }, /* R3993 - ANC Coefficient */
1772 { 0x00000F9A, 0x0000 }, /* R3994 - ANC Coefficient */
1773 { 0x00000F9B, 0x0000 }, /* R3995 - ANC Coefficient */
1774 { 0x00000F9C, 0x0000 }, /* R3996 - ANC Coefficient */
1775 { 0x00000F9D, 0x0000 }, /* R3997 - ANC Coefficient */
1776 { 0x00000F9E, 0x0000 }, /* R3998 - ANC Coefficient */
1777 { 0x00000F9F, 0x0000 }, /* R3999 - ANC Coefficient */
1778 { 0x00000FA0, 0x0000 }, /* R4000 - ANC Coefficient */
1779 { 0x00000FA1, 0x0000 }, /* R4001 - ANC Coefficient */
1780 { 0x00000FA2, 0x0000 }, /* R4002 - ANC Coefficient */
1781 { 0x00000FA3, 0x0000 }, /* R4003 - ANC Coefficient */
1782 { 0x00000FA4, 0x0000 }, /* R4004 - ANC Coefficient */
1783 { 0x00000FA5, 0x0000 }, /* R4005 - ANC Coefficient */
1784 { 0x00000FA6, 0x0000 }, /* R4006 - ANC Coefficient */
1785 { 0x00000FA7, 0x0000 }, /* R4007 - ANC Coefficient */
1786 { 0x00000FA8, 0x0000 }, /* R4008 - ANC Coefficient */
1787 { 0x00000FA9, 0x0000 }, /* R4009 - ANC Coefficient */
1788 { 0x00000FAA, 0x0000 }, /* R4010 - ANC Coefficient */
1789 { 0x00000FAB, 0x0000 }, /* R4011 - ANC Coefficient */
1790 { 0x00000FAC, 0x0000 }, /* R4012 - ANC Coefficient */
1791 { 0x00000FAD, 0x0000 }, /* R4013 - ANC Coefficient */
1792 { 0x00000FAE, 0x0000 }, /* R4014 - ANC Coefficient */
1793 { 0x00000FAF, 0x0000 }, /* R4015 - ANC Coefficient */
1794 { 0x00000FB0, 0x0000 }, /* R4016 - ANC Coefficient */
1795 { 0x00000FB1, 0x0000 }, /* R4017 - ANC Coefficient */
1796 { 0x00000FB2, 0x0000 }, /* R4018 - ANC Coefficient */
1797 { 0x00000FB3, 0x0000 }, /* R4019 - ANC Coefficient */
1798 { 0x00000FB4, 0x0000 }, /* R4020 - ANC Coefficient */
1799 { 0x00000FB5, 0x0000 }, /* R4021 - ANC Coefficient */
1800 { 0x00000FB6, 0x0000 }, /* R4022 - ANC Coefficient */
1801 { 0x00000FB7, 0x0000 }, /* R4023 - ANC Coefficient */
1802 { 0x00000FB8, 0x0000 }, /* R4024 - ANC Coefficient */
1803 { 0x00000FB9, 0x0000 }, /* R4025 - ANC Coefficient */
1804 { 0x00000FBA, 0x0000 }, /* R4026 - ANC Coefficient */
1805 { 0x00000FBB, 0x0000 }, /* R4027 - ANC Coefficient */
1806 { 0x00000FBC, 0x0000 }, /* R4028 - ANC Coefficient */
1807 { 0x00000FBD, 0x0000 }, /* R4029 - ANC Coefficient */
1808 { 0x00000FBE, 0x0000 }, /* R4030 - ANC Coefficient */
1809 { 0x00000FBF, 0x0000 }, /* R4031 - ANC Coefficient */
1810 { 0x00000FC0, 0x0000 }, /* R4032 - ANC Coefficient */
1811 { 0x00000FC1, 0x0000 }, /* R4033 - ANC Coefficient */
1812 { 0x00000FC2, 0x0000 }, /* R4034 - ANC Coefficient */
1813 { 0x00000FC3, 0x0000 }, /* R4035 - ANC Coefficient */
1814 { 0x00000FC4, 0x0000 }, /* R4036 - ANC Coefficient */
1636 { 0x00001100, 0x0010 }, /* R4352 - DSP1 Control 1 */ 1815 { 0x00001100, 0x0010 }, /* R4352 - DSP1 Control 1 */
1637 { 0x00001200, 0x0010 }, /* R4608 - DSP2 Control 1 */ 1816 { 0x00001200, 0x0010 }, /* R4608 - DSP2 Control 1 */
1638 { 0x00001300, 0x0010 }, /* R4864 - DSP3 Control 1 */ 1817 { 0x00001300, 0x0010 }, /* R4864 - DSP3 Control 1 */
@@ -2710,6 +2889,13 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg)
2710 case ARIZONA_CLOCK_CONTROL: 2889 case ARIZONA_CLOCK_CONTROL:
2711 case ARIZONA_ANC_SRC: 2890 case ARIZONA_ANC_SRC:
2712 case ARIZONA_DSP_STATUS: 2891 case ARIZONA_DSP_STATUS:
2892 case ARIZONA_ANC_COEFF_START ... ARIZONA_ANC_COEFF_END:
2893 case ARIZONA_FCL_FILTER_CONTROL:
2894 case ARIZONA_FCL_ADC_REFORMATTER_CONTROL:
2895 case ARIZONA_FCL_COEFF_START ... ARIZONA_FCL_COEFF_END:
2896 case ARIZONA_FCR_FILTER_CONTROL:
2897 case ARIZONA_FCR_ADC_REFORMATTER_CONTROL:
2898 case ARIZONA_FCR_COEFF_START ... ARIZONA_FCR_COEFF_END:
2713 case ARIZONA_DSP1_CONTROL_1: 2899 case ARIZONA_DSP1_CONTROL_1:
2714 case ARIZONA_DSP1_CLOCKING_1: 2900 case ARIZONA_DSP1_CLOCKING_1:
2715 case ARIZONA_DSP1_STATUS_1: 2901 case ARIZONA_DSP1_STATUS_1:
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index 28366a90e1ad..3e0e99ec5836 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -1626,7 +1626,9 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1626 mutex_init(&wm831x->io_lock); 1626 mutex_init(&wm831x->io_lock);
1627 mutex_init(&wm831x->key_lock); 1627 mutex_init(&wm831x->key_lock);
1628 dev_set_drvdata(wm831x->dev, wm831x); 1628 dev_set_drvdata(wm831x->dev, wm831x);
1629 wm831x->soft_shutdown = pdata->soft_shutdown; 1629
1630 if (pdata)
1631 wm831x->soft_shutdown = pdata->soft_shutdown;
1630 1632
1631 ret = wm831x_reg_read(wm831x, WM831X_PARENT_ID); 1633 ret = wm831x_reg_read(wm831x, WM831X_PARENT_ID);
1632 if (ret < 0) { 1634 if (ret < 0) {
diff --git a/drivers/mfd/wm8998-tables.c b/drivers/mfd/wm8998-tables.c
index e6de3cd8a9aa..4c2dce77cdfc 100644
--- a/drivers/mfd/wm8998-tables.c
+++ b/drivers/mfd/wm8998-tables.c
@@ -21,7 +21,7 @@
21#define WM8998_NUM_AOD_ISR 2 21#define WM8998_NUM_AOD_ISR 2
22#define WM8998_NUM_ISR 5 22#define WM8998_NUM_ISR 5
23 23
24static const struct reg_default wm8998_rev_a_patch[] = { 24static const struct reg_sequence wm8998_rev_a_patch[] = {
25 { 0x0212, 0x0000 }, 25 { 0x0212, 0x0000 },
26 { 0x0211, 0x0014 }, 26 { 0x0211, 0x0014 },
27 { 0x04E4, 0x0E0D }, 27 { 0x04E4, 0x0E0D },
@@ -199,8 +199,6 @@ static const struct reg_default wm8998_reg_default[] = {
199 { 0x00000069, 0x01FF }, /* R105 - Always On Triggers Sequence Select 4 */ 199 { 0x00000069, 0x01FF }, /* R105 - Always On Triggers Sequence Select 4 */
200 { 0x0000006A, 0x01FF }, /* R106 - Always On Triggers Sequence Select 5 */ 200 { 0x0000006A, 0x01FF }, /* R106 - Always On Triggers Sequence Select 5 */
201 { 0x0000006B, 0x01FF }, /* R107 - Always On Triggers Sequence Select 6 */ 201 { 0x0000006B, 0x01FF }, /* R107 - Always On Triggers Sequence Select 6 */
202 { 0x0000006E, 0x01FF }, /* R110 - Trigger Sequence Select 32 */
203 { 0x0000006F, 0x01FF }, /* R111 - Trigger Sequence Select 33 */
204 { 0x00000090, 0x0000 }, /* R144 - Haptics Control 1 */ 202 { 0x00000090, 0x0000 }, /* R144 - Haptics Control 1 */
205 { 0x00000091, 0x7FFF }, /* R145 - Haptics Control 2 */ 203 { 0x00000091, 0x7FFF }, /* R145 - Haptics Control 2 */
206 { 0x00000092, 0x0000 }, /* R146 - Haptics phase 1 intensity */ 204 { 0x00000092, 0x0000 }, /* R146 - Haptics phase 1 intensity */
@@ -270,16 +268,13 @@ static const struct reg_default wm8998_reg_default[] = {
270 { 0x0000021A, 0x01A6 }, /* R538 - Mic Bias Ctrl 3 */ 268 { 0x0000021A, 0x01A6 }, /* R538 - Mic Bias Ctrl 3 */
271 { 0x00000293, 0x0080 }, /* R659 - Accessory Detect Mode 1 */ 269 { 0x00000293, 0x0080 }, /* R659 - Accessory Detect Mode 1 */
272 { 0x0000029B, 0x0000 }, /* R667 - Headphone Detect 1 */ 270 { 0x0000029B, 0x0000 }, /* R667 - Headphone Detect 1 */
273 { 0x0000029C, 0x0000 }, /* R668 - Headphone Detect 2 */
274 { 0x000002A2, 0x0000 }, /* R674 - Micd Clamp control */ 271 { 0x000002A2, 0x0000 }, /* R674 - Micd Clamp control */
275 { 0x000002A3, 0x1102 }, /* R675 - Mic Detect 1 */ 272 { 0x000002A3, 0x1102 }, /* R675 - Mic Detect 1 */
276 { 0x000002A4, 0x009F }, /* R676 - Mic Detect 2 */ 273 { 0x000002A4, 0x009F }, /* R676 - Mic Detect 2 */
277 { 0x000002A5, 0x0000 }, /* R677 - Mic Detect 3 */
278 { 0x000002A6, 0x3737 }, /* R678 - Mic Detect Level 1 */ 274 { 0x000002A6, 0x3737 }, /* R678 - Mic Detect Level 1 */
279 { 0x000002A7, 0x2C37 }, /* R679 - Mic Detect Level 2 */ 275 { 0x000002A7, 0x2C37 }, /* R679 - Mic Detect Level 2 */
280 { 0x000002A8, 0x1422 }, /* R680 - Mic Detect Level 3 */ 276 { 0x000002A8, 0x1422 }, /* R680 - Mic Detect Level 3 */
281 { 0x000002A9, 0x030A }, /* R681 - Mic Detect Level 4 */ 277 { 0x000002A9, 0x030A }, /* R681 - Mic Detect Level 4 */
282 { 0x000002AB, 0x0000 }, /* R683 - Mic Detect 4 */
283 { 0x000002CB, 0x0000 }, /* R715 - Isolation control */ 278 { 0x000002CB, 0x0000 }, /* R715 - Isolation control */
284 { 0x000002D3, 0x0000 }, /* R723 - Jack detect analogue */ 279 { 0x000002D3, 0x0000 }, /* R723 - Jack detect analogue */
285 { 0x00000300, 0x0000 }, /* R768 - Input Enables */ 280 { 0x00000300, 0x0000 }, /* R768 - Input Enables */
@@ -707,13 +702,11 @@ static const struct reg_default wm8998_reg_default[] = {
707 { 0x00000D1A, 0xFFFF }, /* R3354 - IRQ2 Status 3 Mask */ 702 { 0x00000D1A, 0xFFFF }, /* R3354 - IRQ2 Status 3 Mask */
708 { 0x00000D1B, 0xFFFF }, /* R3355 - IRQ2 Status 4 Mask */ 703 { 0x00000D1B, 0xFFFF }, /* R3355 - IRQ2 Status 4 Mask */
709 { 0x00000D1C, 0xFEFF }, /* R3356 - IRQ2 Status 5 Mask */ 704 { 0x00000D1C, 0xFEFF }, /* R3356 - IRQ2 Status 5 Mask */
710 { 0x00000D1D, 0xFFFF }, /* R3357 - IRQ2 Status 6 Mask */
711 { 0x00000D1F, 0x0000 }, /* R3359 - IRQ2 Control */ 705 { 0x00000D1F, 0x0000 }, /* R3359 - IRQ2 Control */
712 { 0x00000D53, 0xFFFF }, /* R3411 - AOD IRQ Mask IRQ1 */ 706 { 0x00000D53, 0xFFFF }, /* R3411 - AOD IRQ Mask IRQ1 */
713 { 0x00000D54, 0xFFFF }, /* R3412 - AOD IRQ Mask IRQ2 */ 707 { 0x00000D54, 0xFFFF }, /* R3412 - AOD IRQ Mask IRQ2 */
714 { 0x00000D56, 0x0000 }, /* R3414 - Jack detect debounce */ 708 { 0x00000D56, 0x0000 }, /* R3414 - Jack detect debounce */
715 { 0x00000E00, 0x0000 }, /* R3584 - FX_Ctrl1 */ 709 { 0x00000E00, 0x0000 }, /* R3584 - FX_Ctrl1 */
716 { 0x00000E01, 0x0000 }, /* R3585 - FX_Ctrl2 */
717 { 0x00000E10, 0x6318 }, /* R3600 - EQ1_1 */ 710 { 0x00000E10, 0x6318 }, /* R3600 - EQ1_1 */
718 { 0x00000E11, 0x6300 }, /* R3601 - EQ1_2 */ 711 { 0x00000E11, 0x6300 }, /* R3601 - EQ1_2 */
719 { 0x00000E12, 0x0FC8 }, /* R3602 - EQ1_3 */ 712 { 0x00000E12, 0x0FC8 }, /* R3602 - EQ1_3 */
@@ -833,7 +826,6 @@ static bool wm8998_readable_register(struct device *dev, unsigned int reg)
833 switch (reg) { 826 switch (reg) {
834 case ARIZONA_SOFTWARE_RESET: 827 case ARIZONA_SOFTWARE_RESET:
835 case ARIZONA_DEVICE_REVISION: 828 case ARIZONA_DEVICE_REVISION:
836 case ARIZONA_CTRL_IF_SPI_CFG_1:
837 case ARIZONA_CTRL_IF_I2C1_CFG_1: 829 case ARIZONA_CTRL_IF_I2C1_CFG_1:
838 case ARIZONA_CTRL_IF_I2C1_CFG_2: 830 case ARIZONA_CTRL_IF_I2C1_CFG_2:
839 case ARIZONA_WRITE_SEQUENCER_CTRL_0: 831 case ARIZONA_WRITE_SEQUENCER_CTRL_0:
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index c6cb7f8f325e..5d7c0900fa1b 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -21,6 +21,7 @@
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22#include <linux/jiffies.h> 22#include <linux/jiffies.h>
23#include <linux/of.h> 23#include <linux/of.h>
24#include <linux/acpi.h>
24#include <linux/i2c.h> 25#include <linux/i2c.h>
25#include <linux/platform_data/at24.h> 26#include <linux/platform_data/at24.h>
26 27
@@ -131,6 +132,12 @@ static const struct i2c_device_id at24_ids[] = {
131}; 132};
132MODULE_DEVICE_TABLE(i2c, at24_ids); 133MODULE_DEVICE_TABLE(i2c, at24_ids);
133 134
135static const struct acpi_device_id at24_acpi_ids[] = {
136 { "INT3499", AT24_DEVICE_MAGIC(8192 / 8, 0) },
137 { }
138};
139MODULE_DEVICE_TABLE(acpi, at24_acpi_ids);
140
134/*-------------------------------------------------------------------------*/ 141/*-------------------------------------------------------------------------*/
135 142
136/* 143/*
@@ -467,21 +474,29 @@ static void at24_get_ofdata(struct i2c_client *client,
467static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) 474static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
468{ 475{
469 struct at24_platform_data chip; 476 struct at24_platform_data chip;
477 kernel_ulong_t magic = 0;
470 bool writable; 478 bool writable;
471 int use_smbus = 0; 479 int use_smbus = 0;
472 int use_smbus_write = 0; 480 int use_smbus_write = 0;
473 struct at24_data *at24; 481 struct at24_data *at24;
474 int err; 482 int err;
475 unsigned i, num_addresses; 483 unsigned i, num_addresses;
476 kernel_ulong_t magic;
477 484
478 if (client->dev.platform_data) { 485 if (client->dev.platform_data) {
479 chip = *(struct at24_platform_data *)client->dev.platform_data; 486 chip = *(struct at24_platform_data *)client->dev.platform_data;
480 } else { 487 } else {
481 if (!id->driver_data) 488 if (id) {
489 magic = id->driver_data;
490 } else {
491 const struct acpi_device_id *aid;
492
493 aid = acpi_match_device(at24_acpi_ids, &client->dev);
494 if (aid)
495 magic = aid->driver_data;
496 }
497 if (!magic)
482 return -ENODEV; 498 return -ENODEV;
483 499
484 magic = id->driver_data;
485 chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); 500 chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN));
486 magic >>= AT24_SIZE_BYTELEN; 501 magic >>= AT24_SIZE_BYTELEN;
487 chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); 502 chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS);
@@ -661,6 +676,7 @@ static int at24_remove(struct i2c_client *client)
661static struct i2c_driver at24_driver = { 676static struct i2c_driver at24_driver = {
662 .driver = { 677 .driver = {
663 .name = "at24", 678 .name = "at24",
679 .acpi_match_table = ACPI_PTR(at24_acpi_ids),
664 }, 680 },
665 .probe = at24_probe, 681 .probe = at24_probe,
666 .remove = at24_remove, 682 .remove = at24_remove,
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 7b492d9b3ec4..02bbc70c332d 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -932,6 +932,7 @@ config PVPANIC
932 932
933config INTEL_PMC_IPC 933config INTEL_PMC_IPC
934 tristate "Intel PMC IPC Driver" 934 tristate "Intel PMC IPC Driver"
935 depends on ACPI
935 ---help--- 936 ---help---
936 This driver provides support for PMC control on some Intel platforms. 937 This driver provides support for PMC control on some Intel platforms.
937 The PMC is an ARC processor which defines IPC commands for communication 938 The PMC is an ARC processor which defines IPC commands for communication
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 02b3b313809a..237d7aa73e8c 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -203,6 +203,16 @@ config CHARGER_DA9150
203 This driver can also be built as a module. If so, the module will be 203 This driver can also be built as a module. If so, the module will be
204 called da9150-charger. 204 called da9150-charger.
205 205
206config BATTERY_DA9150
207 tristate "Dialog Semiconductor DA9150 Fuel Gauge support"
208 depends on MFD_DA9150
209 help
210 Say Y here to enable support for the Fuel-Gauge unit of the DA9150
211 Integrated Charger & Fuel-Gauge IC
212
213 This driver can also be built as a module. If so, the module will be
214 called da9150-fg.
215
206config AXP288_CHARGER 216config AXP288_CHARGER
207 tristate "X-Powers AXP288 Charger" 217 tristate "X-Powers AXP288 Charger"
208 depends on MFD_AXP20X && EXTCON_AXP288 218 depends on MFD_AXP20X && EXTCON_AXP288
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index b0e1bf190e3d..b656638f8b39 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -34,6 +34,7 @@ obj-$(CONFIG_BATTERY_BQ27XXX) += bq27xxx_battery.o
34obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o 34obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o
35obj-$(CONFIG_BATTERY_DA9052) += da9052-battery.o 35obj-$(CONFIG_BATTERY_DA9052) += da9052-battery.o
36obj-$(CONFIG_CHARGER_DA9150) += da9150-charger.o 36obj-$(CONFIG_CHARGER_DA9150) += da9150-charger.o
37obj-$(CONFIG_BATTERY_DA9150) += da9150-fg.o
37obj-$(CONFIG_BATTERY_MAX17040) += max17040_battery.o 38obj-$(CONFIG_BATTERY_MAX17040) += max17040_battery.o
38obj-$(CONFIG_BATTERY_MAX17042) += max17042_battery.o 39obj-$(CONFIG_BATTERY_MAX17042) += max17042_battery.o
39obj-$(CONFIG_BATTERY_Z2) += z2_battery.o 40obj-$(CONFIG_BATTERY_Z2) += z2_battery.o
diff --git a/drivers/power/da9150-fg.c b/drivers/power/da9150-fg.c
new file mode 100644
index 000000000000..8b8ce978656a
--- /dev/null
+++ b/drivers/power/da9150-fg.c
@@ -0,0 +1,579 @@
1/*
2 * DA9150 Fuel-Gauge Driver
3 *
4 * Copyright (c) 2015 Dialog Semiconductor
5 *
6 * Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/module.h>
16#include <linux/platform_device.h>
17#include <linux/of.h>
18#include <linux/of_platform.h>
19#include <linux/slab.h>
20#include <linux/interrupt.h>
21#include <linux/delay.h>
22#include <linux/power_supply.h>
23#include <linux/list.h>
24#include <asm/div64.h>
25#include <linux/mfd/da9150/core.h>
26#include <linux/mfd/da9150/registers.h>
27
28/* Core2Wire */
29#define DA9150_QIF_READ (0x0 << 7)
30#define DA9150_QIF_WRITE (0x1 << 7)
31#define DA9150_QIF_CODE_MASK 0x7F
32
33#define DA9150_QIF_BYTE_SIZE 8
34#define DA9150_QIF_BYTE_MASK 0xFF
35#define DA9150_QIF_SHORT_SIZE 2
36#define DA9150_QIF_LONG_SIZE 4
37
38/* QIF Codes */
39#define DA9150_QIF_UAVG 6
40#define DA9150_QIF_UAVG_SIZE DA9150_QIF_LONG_SIZE
41#define DA9150_QIF_IAVG 8
42#define DA9150_QIF_IAVG_SIZE DA9150_QIF_LONG_SIZE
43#define DA9150_QIF_NTCAVG 12
44#define DA9150_QIF_NTCAVG_SIZE DA9150_QIF_LONG_SIZE
45#define DA9150_QIF_SHUNT_VAL 36
46#define DA9150_QIF_SHUNT_VAL_SIZE DA9150_QIF_SHORT_SIZE
47#define DA9150_QIF_SD_GAIN 38
48#define DA9150_QIF_SD_GAIN_SIZE DA9150_QIF_LONG_SIZE
49#define DA9150_QIF_FCC_MAH 40
50#define DA9150_QIF_FCC_MAH_SIZE DA9150_QIF_SHORT_SIZE
51#define DA9150_QIF_SOC_PCT 43
52#define DA9150_QIF_SOC_PCT_SIZE DA9150_QIF_SHORT_SIZE
53#define DA9150_QIF_CHARGE_LIMIT 44
54#define DA9150_QIF_CHARGE_LIMIT_SIZE DA9150_QIF_SHORT_SIZE
55#define DA9150_QIF_DISCHARGE_LIMIT 45
56#define DA9150_QIF_DISCHARGE_LIMIT_SIZE DA9150_QIF_SHORT_SIZE
57#define DA9150_QIF_FW_MAIN_VER 118
58#define DA9150_QIF_FW_MAIN_VER_SIZE DA9150_QIF_SHORT_SIZE
59#define DA9150_QIF_E_FG_STATUS 126
60#define DA9150_QIF_E_FG_STATUS_SIZE DA9150_QIF_SHORT_SIZE
61#define DA9150_QIF_SYNC 127
62#define DA9150_QIF_SYNC_SIZE DA9150_QIF_SHORT_SIZE
63#define DA9150_QIF_MAX_CODES 128
64
65/* QIF Sync Timeout */
66#define DA9150_QIF_SYNC_TIMEOUT 1000
67#define DA9150_QIF_SYNC_RETRIES 10
68
69/* QIF E_FG_STATUS */
70#define DA9150_FG_IRQ_LOW_SOC_MASK (1 << 0)
71#define DA9150_FG_IRQ_HIGH_SOC_MASK (1 << 1)
72#define DA9150_FG_IRQ_SOC_MASK \
73 (DA9150_FG_IRQ_LOW_SOC_MASK | DA9150_FG_IRQ_HIGH_SOC_MASK)
74
75/* Private data */
76struct da9150_fg {
77 struct da9150 *da9150;
78 struct device *dev;
79
80 struct mutex io_lock;
81
82 struct power_supply *battery;
83 struct delayed_work work;
84 u32 interval;
85
86 int warn_soc;
87 int crit_soc;
88 int soc;
89};
90
91/* Battery Properties */
92static u32 da9150_fg_read_attr(struct da9150_fg *fg, u8 code, u8 size)
93
94{
95 u8 buf[size];
96 u8 read_addr;
97 u32 res = 0;
98 int i;
99
100 /* Set QIF code (READ mode) */
101 read_addr = (code & DA9150_QIF_CODE_MASK) | DA9150_QIF_READ;
102
103 da9150_read_qif(fg->da9150, read_addr, size, buf);
104 for (i = 0; i < size; ++i)
105 res |= (buf[i] << (i * DA9150_QIF_BYTE_SIZE));
106
107 return res;
108}
109
110static void da9150_fg_write_attr(struct da9150_fg *fg, u8 code, u8 size,
111 u32 val)
112
113{
114 u8 buf[size];
115 u8 write_addr;
116 int i;
117
118 /* Set QIF code (WRITE mode) */
119 write_addr = (code & DA9150_QIF_CODE_MASK) | DA9150_QIF_WRITE;
120
121 for (i = 0; i < size; ++i) {
122 buf[i] = (val >> (i * DA9150_QIF_BYTE_SIZE)) &
123 DA9150_QIF_BYTE_MASK;
124 }
125 da9150_write_qif(fg->da9150, write_addr, size, buf);
126}
127
128/* Trigger QIF Sync to update QIF readable data */
129static void da9150_fg_read_sync_start(struct da9150_fg *fg)
130{
131 int i = 0;
132 u32 res = 0;
133
134 mutex_lock(&fg->io_lock);
135
136 /* Check if QIF sync already requested, and write to sync if not */
137 res = da9150_fg_read_attr(fg, DA9150_QIF_SYNC,
138 DA9150_QIF_SYNC_SIZE);
139 if (res > 0)
140 da9150_fg_write_attr(fg, DA9150_QIF_SYNC,
141 DA9150_QIF_SYNC_SIZE, 0);
142
143 /* Wait for sync to complete */
144 res = 0;
145 while ((res == 0) && (i++ < DA9150_QIF_SYNC_RETRIES)) {
146 usleep_range(DA9150_QIF_SYNC_TIMEOUT,
147 DA9150_QIF_SYNC_TIMEOUT * 2);
148 res = da9150_fg_read_attr(fg, DA9150_QIF_SYNC,
149 DA9150_QIF_SYNC_SIZE);
150 }
151
152 /* Check if sync completed */
153 if (res == 0)
154 dev_err(fg->dev, "Failed to perform QIF read sync!\n");
155}
156
157/*
158 * Should always be called after QIF sync read has been performed, and all
159 * attributes required have been accessed.
160 */
161static inline void da9150_fg_read_sync_end(struct da9150_fg *fg)
162{
163 mutex_unlock(&fg->io_lock);
164}
165
166/* Sync read of single QIF attribute */
167static u32 da9150_fg_read_attr_sync(struct da9150_fg *fg, u8 code, u8 size)
168{
169 u32 val;
170
171 da9150_fg_read_sync_start(fg);
172 val = da9150_fg_read_attr(fg, code, size);
173 da9150_fg_read_sync_end(fg);
174
175 return val;
176}
177
178/* Wait for QIF Sync, write QIF data and wait for ack */
179static void da9150_fg_write_attr_sync(struct da9150_fg *fg, u8 code, u8 size,
180 u32 val)
181{
182 int i = 0;
183 u32 res = 0, sync_val;
184
185 mutex_lock(&fg->io_lock);
186
187 /* Check if QIF sync already requested */
188 res = da9150_fg_read_attr(fg, DA9150_QIF_SYNC,
189 DA9150_QIF_SYNC_SIZE);
190
191 /* Wait for an existing sync to complete */
192 while ((res == 0) && (i++ < DA9150_QIF_SYNC_RETRIES)) {
193 usleep_range(DA9150_QIF_SYNC_TIMEOUT,
194 DA9150_QIF_SYNC_TIMEOUT * 2);
195 res = da9150_fg_read_attr(fg, DA9150_QIF_SYNC,
196 DA9150_QIF_SYNC_SIZE);
197 }
198
199 if (res == 0) {
200 dev_err(fg->dev, "Timeout waiting for existing QIF sync!\n");
201 mutex_unlock(&fg->io_lock);
202 return;
203 }
204
205 /* Write value for QIF code */
206 da9150_fg_write_attr(fg, code, size, val);
207
208 /* Wait for write acknowledgment */
209 i = 0;
210 sync_val = res;
211 while ((res == sync_val) && (i++ < DA9150_QIF_SYNC_RETRIES)) {
212 usleep_range(DA9150_QIF_SYNC_TIMEOUT,
213 DA9150_QIF_SYNC_TIMEOUT * 2);
214 res = da9150_fg_read_attr(fg, DA9150_QIF_SYNC,
215 DA9150_QIF_SYNC_SIZE);
216 }
217
218 mutex_unlock(&fg->io_lock);
219
220 /* Check write was actually successful */
221 if (res != (sync_val + 1))
222 dev_err(fg->dev, "Error performing QIF sync write for code %d\n",
223 code);
224}
225
226/* Power Supply attributes */
227static int da9150_fg_capacity(struct da9150_fg *fg,
228 union power_supply_propval *val)
229{
230 val->intval = da9150_fg_read_attr_sync(fg, DA9150_QIF_SOC_PCT,
231 DA9150_QIF_SOC_PCT_SIZE);
232
233 if (val->intval > 100)
234 val->intval = 100;
235
236 return 0;
237}
238
239static int da9150_fg_current_avg(struct da9150_fg *fg,
240 union power_supply_propval *val)
241{
242 u32 iavg, sd_gain, shunt_val;
243 u64 div, res;
244
245 da9150_fg_read_sync_start(fg);
246 iavg = da9150_fg_read_attr(fg, DA9150_QIF_IAVG,
247 DA9150_QIF_IAVG_SIZE);
248 shunt_val = da9150_fg_read_attr(fg, DA9150_QIF_SHUNT_VAL,
249 DA9150_QIF_SHUNT_VAL_SIZE);
250 sd_gain = da9150_fg_read_attr(fg, DA9150_QIF_SD_GAIN,
251 DA9150_QIF_SD_GAIN_SIZE);
252 da9150_fg_read_sync_end(fg);
253
254 div = (u64) (sd_gain * shunt_val * 65536ULL);
255 do_div(div, 1000000);
256 res = (u64) (iavg * 1000000ULL);
257 do_div(res, div);
258
259 val->intval = (int) res;
260
261 return 0;
262}
263
264static int da9150_fg_voltage_avg(struct da9150_fg *fg,
265 union power_supply_propval *val)
266{
267 u64 res;
268
269 val->intval = da9150_fg_read_attr_sync(fg, DA9150_QIF_UAVG,
270 DA9150_QIF_UAVG_SIZE);
271
272 res = (u64) (val->intval * 186ULL);
273 do_div(res, 10000);
274 val->intval = (int) res;
275
276 return 0;
277}
278
279static int da9150_fg_charge_full(struct da9150_fg *fg,
280 union power_supply_propval *val)
281{
282 val->intval = da9150_fg_read_attr_sync(fg, DA9150_QIF_FCC_MAH,
283 DA9150_QIF_FCC_MAH_SIZE);
284
285 val->intval = val->intval * 1000;
286
287 return 0;
288}
289
290/*
291 * Temperature reading from device is only valid if battery/system provides
292 * valid NTC to associated pin of DA9150 chip.
293 */
294static int da9150_fg_temp(struct da9150_fg *fg,
295 union power_supply_propval *val)
296{
297 val->intval = da9150_fg_read_attr_sync(fg, DA9150_QIF_NTCAVG,
298 DA9150_QIF_NTCAVG_SIZE);
299
300 val->intval = (val->intval * 10) / 1048576;
301
302 return 0;
303}
304
305static enum power_supply_property da9150_fg_props[] = {
306 POWER_SUPPLY_PROP_CAPACITY,
307 POWER_SUPPLY_PROP_CURRENT_AVG,
308 POWER_SUPPLY_PROP_VOLTAGE_AVG,
309 POWER_SUPPLY_PROP_CHARGE_FULL,
310 POWER_SUPPLY_PROP_TEMP,
311};
312
313static int da9150_fg_get_prop(struct power_supply *psy,
314 enum power_supply_property psp,
315 union power_supply_propval *val)
316{
317 struct da9150_fg *fg = dev_get_drvdata(psy->dev.parent);
318 int ret;
319
320 switch (psp) {
321 case POWER_SUPPLY_PROP_CAPACITY:
322 ret = da9150_fg_capacity(fg, val);
323 break;
324 case POWER_SUPPLY_PROP_CURRENT_AVG:
325 ret = da9150_fg_current_avg(fg, val);
326 break;
327 case POWER_SUPPLY_PROP_VOLTAGE_AVG:
328 ret = da9150_fg_voltage_avg(fg, val);
329 break;
330 case POWER_SUPPLY_PROP_CHARGE_FULL:
331 ret = da9150_fg_charge_full(fg, val);
332 break;
333 case POWER_SUPPLY_PROP_TEMP:
334 ret = da9150_fg_temp(fg, val);
335 break;
336 default:
337 ret = -EINVAL;
338 break;
339 }
340
341 return ret;
342}
343
344/* Repeated SOC check */
345static bool da9150_fg_soc_changed(struct da9150_fg *fg)
346{
347 union power_supply_propval val;
348
349 da9150_fg_capacity(fg, &val);
350 if (val.intval != fg->soc) {
351 fg->soc = val.intval;
352 return true;
353 }
354
355 return false;
356}
357
358static void da9150_fg_work(struct work_struct *work)
359{
360 struct da9150_fg *fg = container_of(work, struct da9150_fg, work.work);
361
362 /* Report if SOC has changed */
363 if (da9150_fg_soc_changed(fg))
364 power_supply_changed(fg->battery);
365
366 schedule_delayed_work(&fg->work, msecs_to_jiffies(fg->interval));
367}
368
369/* SOC level event configuration */
370static void da9150_fg_soc_event_config(struct da9150_fg *fg)
371{
372 int soc;
373
374 soc = da9150_fg_read_attr_sync(fg, DA9150_QIF_SOC_PCT,
375 DA9150_QIF_SOC_PCT_SIZE);
376
377 if (soc > fg->warn_soc) {
378 /* If SOC > warn level, set discharge warn level event */
379 da9150_fg_write_attr_sync(fg, DA9150_QIF_DISCHARGE_LIMIT,
380 DA9150_QIF_DISCHARGE_LIMIT_SIZE,
381 fg->warn_soc + 1);
382 } else if ((soc <= fg->warn_soc) && (soc > fg->crit_soc)) {
383 /*
384 * If SOC <= warn level, set discharge crit level event,
385 * and set charge warn level event.
386 */
387 da9150_fg_write_attr_sync(fg, DA9150_QIF_DISCHARGE_LIMIT,
388 DA9150_QIF_DISCHARGE_LIMIT_SIZE,
389 fg->crit_soc + 1);
390
391 da9150_fg_write_attr_sync(fg, DA9150_QIF_CHARGE_LIMIT,
392 DA9150_QIF_CHARGE_LIMIT_SIZE,
393 fg->warn_soc);
394 } else if (soc <= fg->crit_soc) {
395 /* If SOC <= crit level, set charge crit level event */
396 da9150_fg_write_attr_sync(fg, DA9150_QIF_CHARGE_LIMIT,
397 DA9150_QIF_CHARGE_LIMIT_SIZE,
398 fg->crit_soc);
399 }
400}
401
402static irqreturn_t da9150_fg_irq(int irq, void *data)
403{
404 struct da9150_fg *fg = data;
405 u32 e_fg_status;
406
407 /* Read FG IRQ status info */
408 e_fg_status = da9150_fg_read_attr(fg, DA9150_QIF_E_FG_STATUS,
409 DA9150_QIF_E_FG_STATUS_SIZE);
410
411 /* Handle warning/critical threhold events */
412 if (e_fg_status & DA9150_FG_IRQ_SOC_MASK)
413 da9150_fg_soc_event_config(fg);
414
415 /* Clear any FG IRQs */
416 da9150_fg_write_attr(fg, DA9150_QIF_E_FG_STATUS,
417 DA9150_QIF_E_FG_STATUS_SIZE, e_fg_status);
418
419 return IRQ_HANDLED;
420}
421
422static struct da9150_fg_pdata *da9150_fg_dt_pdata(struct device *dev)
423{
424 struct device_node *fg_node = dev->of_node;
425 struct da9150_fg_pdata *pdata;
426
427 pdata = devm_kzalloc(dev, sizeof(struct da9150_fg_pdata), GFP_KERNEL);
428 if (!pdata)
429 return NULL;
430
431 of_property_read_u32(fg_node, "dlg,update-interval",
432 &pdata->update_interval);
433 of_property_read_u8(fg_node, "dlg,warn-soc-level",
434 &pdata->warn_soc_lvl);
435 of_property_read_u8(fg_node, "dlg,crit-soc-level",
436 &pdata->crit_soc_lvl);
437
438 return pdata;
439}
440
441static const struct power_supply_desc fg_desc = {
442 .name = "da9150-fg",
443 .type = POWER_SUPPLY_TYPE_BATTERY,
444 .properties = da9150_fg_props,
445 .num_properties = ARRAY_SIZE(da9150_fg_props),
446 .get_property = da9150_fg_get_prop,
447};
448
449static int da9150_fg_probe(struct platform_device *pdev)
450{
451 struct device *dev = &pdev->dev;
452 struct da9150 *da9150 = dev_get_drvdata(dev->parent);
453 struct da9150_fg_pdata *fg_pdata = dev_get_platdata(dev);
454 struct da9150_fg *fg;
455 int ver, irq, ret = 0;
456
457 fg = devm_kzalloc(dev, sizeof(*fg), GFP_KERNEL);
458 if (fg == NULL)
459 return -ENOMEM;
460
461 platform_set_drvdata(pdev, fg);
462 fg->da9150 = da9150;
463 fg->dev = dev;
464
465 mutex_init(&fg->io_lock);
466
467 /* Enable QIF */
468 da9150_set_bits(da9150, DA9150_CORE2WIRE_CTRL_A, DA9150_FG_QIF_EN_MASK,
469 DA9150_FG_QIF_EN_MASK);
470
471 fg->battery = devm_power_supply_register(dev, &fg_desc, NULL);
472 if (IS_ERR(fg->battery)) {
473 ret = PTR_ERR(fg->battery);
474 return ret;
475 }
476
477 ver = da9150_fg_read_attr(fg, DA9150_QIF_FW_MAIN_VER,
478 DA9150_QIF_FW_MAIN_VER_SIZE);
479 dev_info(dev, "Version: 0x%x\n", ver);
480
481 /* Handle DT data if provided */
482 if (dev->of_node) {
483 fg_pdata = da9150_fg_dt_pdata(dev);
484 dev->platform_data = fg_pdata;
485 }
486
487 /* Handle any pdata provided */
488 if (fg_pdata) {
489 fg->interval = fg_pdata->update_interval;
490
491 if (fg_pdata->warn_soc_lvl > 100)
492 dev_warn(dev, "Invalid SOC warning level provided, Ignoring");
493 else
494 fg->warn_soc = fg_pdata->warn_soc_lvl;
495
496 if ((fg_pdata->crit_soc_lvl > 100) ||
497 (fg_pdata->crit_soc_lvl >= fg_pdata->warn_soc_lvl))
498 dev_warn(dev, "Invalid SOC critical level provided, Ignoring");
499 else
500 fg->crit_soc = fg_pdata->crit_soc_lvl;
501
502
503 }
504
505 /* Configure initial SOC level events */
506 da9150_fg_soc_event_config(fg);
507
508 /*
509 * If an interval period has been provided then setup repeating
510 * work for reporting data updates.
511 */
512 if (fg->interval) {
513 INIT_DELAYED_WORK(&fg->work, da9150_fg_work);
514 schedule_delayed_work(&fg->work,
515 msecs_to_jiffies(fg->interval));
516 }
517
518 /* Register IRQ */
519 irq = platform_get_irq_byname(pdev, "FG");
520 if (irq < 0) {
521 dev_err(dev, "Failed to get IRQ FG: %d\n", irq);
522 ret = irq;
523 goto irq_fail;
524 }
525
526 ret = devm_request_threaded_irq(dev, irq, NULL, da9150_fg_irq,
527 IRQF_ONESHOT, "FG", fg);
528 if (ret) {
529 dev_err(dev, "Failed to request IRQ %d: %d\n", irq, ret);
530 goto irq_fail;
531 }
532
533 return 0;
534
535irq_fail:
536 if (fg->interval)
537 cancel_delayed_work(&fg->work);
538
539 return ret;
540}
541
542static int da9150_fg_remove(struct platform_device *pdev)
543{
544 struct da9150_fg *fg = platform_get_drvdata(pdev);
545
546 if (fg->interval)
547 cancel_delayed_work(&fg->work);
548
549 return 0;
550}
551
552static int da9150_fg_resume(struct platform_device *pdev)
553{
554 struct da9150_fg *fg = platform_get_drvdata(pdev);
555
556 /*
557 * Trigger SOC check to happen now so as to indicate any value change
558 * since last check before suspend.
559 */
560 if (fg->interval)
561 flush_delayed_work(&fg->work);
562
563 return 0;
564}
565
566static struct platform_driver da9150_fg_driver = {
567 .driver = {
568 .name = "da9150-fuel-gauge",
569 },
570 .probe = da9150_fg_probe,
571 .remove = da9150_fg_remove,
572 .resume = da9150_fg_resume,
573};
574
575module_platform_driver(da9150_fg_driver);
576
577MODULE_DESCRIPTION("Fuel-Gauge Driver for DA9150");
578MODULE_AUTHOR("Adam Thomson <Adam.Thomson.Opensource@diasemi.com>");
579MODULE_LICENSE("GPL");
diff --git a/include/dt-bindings/mfd/atmel-flexcom.h b/include/dt-bindings/mfd/atmel-flexcom.h
new file mode 100644
index 000000000000..a266fe4ee945
--- /dev/null
+++ b/include/dt-bindings/mfd/atmel-flexcom.h
@@ -0,0 +1,26 @@
1/*
2 * This header provides macros for Atmel Flexcom DT bindings.
3 *
4 * Copyright (C) 2015 Cyrille Pitchen <cyrille.pitchen@atmel.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef __DT_BINDINGS_ATMEL_FLEXCOM_H__
20#define __DT_BINDINGS_ATMEL_FLEXCOM_H__
21
22#define ATMEL_FLEXCOM_MODE_USART 1
23#define ATMEL_FLEXCOM_MODE_SPI 2
24#define ATMEL_FLEXCOM_MODE_TWI 3
25
26#endif /* __DT_BINDINGS_ATMEL_FLEXCOM_H__ */
diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h
index 8fcad63fab55..d409ceb2231e 100644
--- a/include/linux/mfd/88pm80x.h
+++ b/include/linux/mfd/88pm80x.h
@@ -21,6 +21,7 @@ enum {
21 CHIP_INVALID = 0, 21 CHIP_INVALID = 0,
22 CHIP_PM800, 22 CHIP_PM800,
23 CHIP_PM805, 23 CHIP_PM805,
24 CHIP_PM860,
24 CHIP_MAX, 25 CHIP_MAX,
25}; 26};
26 27
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index c7c11c900196..cd7e78eae006 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -1065,6 +1065,16 @@
1065#define ARIZONA_CLOCK_CONTROL 0xF00 1065#define ARIZONA_CLOCK_CONTROL 0xF00
1066#define ARIZONA_ANC_SRC 0xF01 1066#define ARIZONA_ANC_SRC 0xF01
1067#define ARIZONA_DSP_STATUS 0xF02 1067#define ARIZONA_DSP_STATUS 0xF02
1068#define ARIZONA_ANC_COEFF_START 0xF08
1069#define ARIZONA_ANC_COEFF_END 0xF12
1070#define ARIZONA_FCL_FILTER_CONTROL 0xF15
1071#define ARIZONA_FCL_ADC_REFORMATTER_CONTROL 0xF17
1072#define ARIZONA_FCL_COEFF_START 0xF18
1073#define ARIZONA_FCL_COEFF_END 0xF69
1074#define ARIZONA_FCR_FILTER_CONTROL 0xF70
1075#define ARIZONA_FCR_ADC_REFORMATTER_CONTROL 0xF72
1076#define ARIZONA_FCR_COEFF_START 0xF73
1077#define ARIZONA_FCR_COEFF_END 0xFC4
1068#define ARIZONA_DSP1_CONTROL_1 0x1100 1078#define ARIZONA_DSP1_CONTROL_1 0x1100
1069#define ARIZONA_DSP1_CLOCKING_1 0x1101 1079#define ARIZONA_DSP1_CLOCKING_1 0x1101
1070#define ARIZONA_DSP1_STATUS_1 0x1104 1080#define ARIZONA_DSP1_STATUS_1 0x1104
@@ -8051,6 +8061,66 @@
8051#define ARIZONA_ISRC3_NOTCH_ENA_WIDTH 1 /* ISRC3_NOTCH_ENA */ 8061#define ARIZONA_ISRC3_NOTCH_ENA_WIDTH 1 /* ISRC3_NOTCH_ENA */
8052 8062
8053/* 8063/*
8064 * R3840 (0xF00) - Clock Control
8065 */
8066#define ARIZONA_EXT_NG_SEL_CLR 0x0080 /* EXT_NG_SEL_CLR */
8067#define ARIZONA_EXT_NG_SEL_CLR_MASK 0x0080 /* EXT_NG_SEL_CLR */
8068#define ARIZONA_EXT_NG_SEL_CLR_SHIFT 7 /* EXT_NG_SEL_CLR */
8069#define ARIZONA_EXT_NG_SEL_CLR_WIDTH 1 /* EXT_NG_SEL_CLR */
8070#define ARIZONA_EXT_NG_SEL_SET 0x0040 /* EXT_NG_SEL_SET */
8071#define ARIZONA_EXT_NG_SEL_SET_MASK 0x0040 /* EXT_NG_SEL_SET */
8072#define ARIZONA_EXT_NG_SEL_SET_SHIFT 6 /* EXT_NG_SEL_SET */
8073#define ARIZONA_EXT_NG_SEL_SET_WIDTH 1 /* EXT_NG_SEL_SET */
8074#define ARIZONA_CLK_R_ENA_CLR 0x0020 /* CLK_R_ENA_CLR */
8075#define ARIZONA_CLK_R_ENA_CLR_MASK 0x0020 /* CLK_R_ENA_CLR */
8076#define ARIZONA_CLK_R_ENA_CLR_SHIFT 5 /* CLK_R_ENA_CLR */
8077#define ARIZONA_CLK_R_ENA_CLR_WIDTH 1 /* CLK_R_ENA_CLR */
8078#define ARIZONA_CLK_R_ENA_SET 0x0010 /* CLK_R_ENA_SET */
8079#define ARIZONA_CLK_R_ENA_SET_MASK 0x0010 /* CLK_R_ENA_SET */
8080#define ARIZONA_CLK_R_ENA_SET_SHIFT 4 /* CLK_R_ENA_SET */
8081#define ARIZONA_CLK_R_ENA_SET_WIDTH 1 /* CLK_R_ENA_SET */
8082#define ARIZONA_CLK_NG_ENA_CLR 0x0008 /* CLK_NG_ENA_CLR */
8083#define ARIZONA_CLK_NG_ENA_CLR_MASK 0x0008 /* CLK_NG_ENA_CLR */
8084#define ARIZONA_CLK_NG_ENA_CLR_SHIFT 3 /* CLK_NG_ENA_CLR */
8085#define ARIZONA_CLK_NG_ENA_CLR_WIDTH 1 /* CLK_NG_ENA_CLR */
8086#define ARIZONA_CLK_NG_ENA_SET 0x0004 /* CLK_NG_ENA_SET */
8087#define ARIZONA_CLK_NG_ENA_SET_MASK 0x0004 /* CLK_NG_ENA_SET */
8088#define ARIZONA_CLK_NG_ENA_SET_SHIFT 2 /* CLK_NG_ENA_SET */
8089#define ARIZONA_CLK_NG_ENA_SET_WIDTH 1 /* CLK_NG_ENA_SET */
8090#define ARIZONA_CLK_L_ENA_CLR 0x0002 /* CLK_L_ENA_CLR */
8091#define ARIZONA_CLK_L_ENA_CLR_MASK 0x0002 /* CLK_L_ENA_CLR */
8092#define ARIZONA_CLK_L_ENA_CLR_SHIFT 1 /* CLK_L_ENA_CLR */
8093#define ARIZONA_CLK_L_ENA_CLR_WIDTH 1 /* CLK_L_ENA_CLR */
8094#define ARIZONA_CLK_L_ENA_SET 0x0001 /* CLK_L_ENA_SET */
8095#define ARIZONA_CLK_L_ENA_SET_MASK 0x0001 /* CLK_L_ENA_SET */
8096#define ARIZONA_CLK_L_ENA_SET_SHIFT 0 /* CLK_L_ENA_SET */
8097#define ARIZONA_CLK_L_ENA_SET_WIDTH 1 /* CLK_L_ENA_SET */
8098
8099/*
8100 * R3841 (0xF01) - ANC SRC
8101 */
8102#define ARIZONA_IN_RXANCR_SEL_MASK 0x0070 /* IN_RXANCR_SEL - [4:6] */
8103#define ARIZONA_IN_RXANCR_SEL_SHIFT 4 /* IN_RXANCR_SEL - [4:6] */
8104#define ARIZONA_IN_RXANCR_SEL_WIDTH 3 /* IN_RXANCR_SEL - [4:6] */
8105#define ARIZONA_IN_RXANCL_SEL_MASK 0x0007 /* IN_RXANCL_SEL - [0:2] */
8106#define ARIZONA_IN_RXANCL_SEL_SHIFT 0 /* IN_RXANCL_SEL - [0:2] */
8107#define ARIZONA_IN_RXANCL_SEL_WIDTH 3 /* IN_RXANCL_SEL - [0:2] */
8108
8109/*
8110 * R3863 (0xF17) - FCL ADC Reformatter Control
8111 */
8112#define ARIZONA_FCL_MIC_MODE_SEL 0x000C /* FCL_MIC_MODE_SEL - [2:3] */
8113#define ARIZONA_FCL_MIC_MODE_SEL_SHIFT 2 /* FCL_MIC_MODE_SEL - [2:3] */
8114#define ARIZONA_FCL_MIC_MODE_SEL_WIDTH 2 /* FCL_MIC_MODE_SEL - [2:3] */
8115
8116/*
8117 * R3954 (0xF72) - FCR ADC Reformatter Control
8118 */
8119#define ARIZONA_FCR_MIC_MODE_SEL 0x000C /* FCR_MIC_MODE_SEL - [2:3] */
8120#define ARIZONA_FCR_MIC_MODE_SEL_SHIFT 2 /* FCR_MIC_MODE_SEL - [2:3] */
8121#define ARIZONA_FCR_MIC_MODE_SEL_WIDTH 2 /* FCR_MIC_MODE_SEL - [2:3] */
8122
8123/*
8054 * R4352 (0x1100) - DSP1 Control 1 8124 * R4352 (0x1100) - DSP1 Control 1
8055 */ 8125 */
8056#define ARIZONA_DSP1_RATE_MASK 0x7800 /* DSP1_RATE - [14:11] */ 8126#define ARIZONA_DSP1_RATE_MASK 0x7800 /* DSP1_RATE - [14:11] */
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index a76bc100bf97..27dac3ff18b9 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -18,6 +18,12 @@
18 18
19struct irq_domain; 19struct irq_domain;
20 20
21/* Matches ACPI PNP id, either _HID or _CID, or ACPI _ADR */
22struct mfd_cell_acpi_match {
23 const char *pnpid;
24 const unsigned long long adr;
25};
26
21/* 27/*
22 * This struct describes the MFD part ("cell"). 28 * This struct describes the MFD part ("cell").
23 * After registration the copy of this structure will become the platform data 29 * After registration the copy of this structure will become the platform data
@@ -44,8 +50,8 @@ struct mfd_cell {
44 */ 50 */
45 const char *of_compatible; 51 const char *of_compatible;
46 52
47 /* Matches ACPI PNP id, either _HID or _CID */ 53 /* Matches ACPI */
48 const char *acpi_pnpid; 54 const struct mfd_cell_acpi_match *acpi_match;
49 55
50 /* 56 /*
51 * These resources can be specified relative to the parent device. 57 * These resources can be specified relative to the parent device.
diff --git a/include/linux/mfd/da9052/reg.h b/include/linux/mfd/da9052/reg.h
index c4dd3a8add21..5010f978725c 100644
--- a/include/linux/mfd/da9052/reg.h
+++ b/include/linux/mfd/da9052/reg.h
@@ -65,6 +65,9 @@
65#define DA9052_GPIO_2_3_REG 22 65#define DA9052_GPIO_2_3_REG 22
66#define DA9052_GPIO_4_5_REG 23 66#define DA9052_GPIO_4_5_REG 23
67#define DA9052_GPIO_6_7_REG 24 67#define DA9052_GPIO_6_7_REG 24
68#define DA9052_GPIO_8_9_REG 25
69#define DA9052_GPIO_10_11_REG 26
70#define DA9052_GPIO_12_13_REG 27
68#define DA9052_GPIO_14_15_REG 28 71#define DA9052_GPIO_14_15_REG 28
69 72
70/* POWER SEQUENCER CONTROL REGISTERS */ 73/* POWER SEQUENCER CONTROL REGISTERS */
diff --git a/include/linux/mfd/da9150/core.h b/include/linux/mfd/da9150/core.h
index 76e668933a77..1bf50caeb9fa 100644
--- a/include/linux/mfd/da9150/core.h
+++ b/include/linux/mfd/da9150/core.h
@@ -15,6 +15,7 @@
15#define __DA9150_CORE_H 15#define __DA9150_CORE_H
16 16
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/i2c.h>
18#include <linux/interrupt.h> 19#include <linux/interrupt.h>
19#include <linux/regmap.h> 20#include <linux/regmap.h>
20 21
@@ -46,23 +47,39 @@
46#define DA9150_IRQ_GPADC 19 47#define DA9150_IRQ_GPADC 19
47#define DA9150_IRQ_WKUP 20 48#define DA9150_IRQ_WKUP 20
48 49
50/* I2C sub-device address */
51#define DA9150_QIF_I2C_ADDR_LSB 0x5
52
53struct da9150_fg_pdata {
54 u32 update_interval; /* msecs */
55 u8 warn_soc_lvl; /* % value */
56 u8 crit_soc_lvl; /* % value */
57};
58
49struct da9150_pdata { 59struct da9150_pdata {
50 int irq_base; 60 int irq_base;
61 struct da9150_fg_pdata *fg_pdata;
51}; 62};
52 63
53struct da9150 { 64struct da9150 {
54 struct device *dev; 65 struct device *dev;
55 struct regmap *regmap; 66 struct regmap *regmap;
67 struct i2c_client *core_qif;
68
56 struct regmap_irq_chip_data *regmap_irq_data; 69 struct regmap_irq_chip_data *regmap_irq_data;
57 int irq; 70 int irq;
58 int irq_base; 71 int irq_base;
59}; 72};
60 73
61/* Device I/O */ 74/* Device I/O - Query Interface for FG and standard register access */
75void da9150_read_qif(struct da9150 *da9150, u8 addr, int count, u8 *buf);
76void da9150_write_qif(struct da9150 *da9150, u8 addr, int count, const u8 *buf);
77
62u8 da9150_reg_read(struct da9150 *da9150, u16 reg); 78u8 da9150_reg_read(struct da9150 *da9150, u16 reg);
63void da9150_reg_write(struct da9150 *da9150, u16 reg, u8 val); 79void da9150_reg_write(struct da9150 *da9150, u16 reg, u8 val);
64void da9150_set_bits(struct da9150 *da9150, u16 reg, u8 mask, u8 val); 80void da9150_set_bits(struct da9150 *da9150, u16 reg, u8 mask, u8 val);
65 81
66void da9150_bulk_read(struct da9150 *da9150, u16 reg, int count, u8 *buf); 82void da9150_bulk_read(struct da9150 *da9150, u16 reg, int count, u8 *buf);
67void da9150_bulk_write(struct da9150 *da9150, u16 reg, int count, const u8 *buf); 83void da9150_bulk_write(struct da9150 *da9150, u16 reg, int count, const u8 *buf);
84
68#endif /* __DA9150_CORE_H */ 85#endif /* __DA9150_CORE_H */
diff --git a/include/linux/mfd/intel_bxtwc.h b/include/linux/mfd/intel_bxtwc.h
new file mode 100644
index 000000000000..1a0ee9d6efe9
--- /dev/null
+++ b/include/linux/mfd/intel_bxtwc.h
@@ -0,0 +1,69 @@
1/*
2 * intel_bxtwc.h - Header file for Intel Broxton Whiskey Cove PMIC
3 *
4 * Copyright (C) 2015 Intel Corporation. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#include <linux/mfd/intel_soc_pmic.h>
17
18#ifndef __INTEL_BXTWC_H__
19#define __INTEL_BXTWC_H__
20
21/* BXT WC devices */
22#define BXTWC_DEVICE1_ADDR 0x4E
23#define BXTWC_DEVICE2_ADDR 0x4F
24#define BXTWC_DEVICE3_ADDR 0x5E
25
26/* device1 Registers */
27#define BXTWC_CHIPID 0x4E00
28#define BXTWC_CHIPVER 0x4E01
29
30#define BXTWC_SCHGRIRQ0_ADDR 0x5E1A
31#define BXTWC_CHGRCTRL0_ADDR 0x5E16
32#define BXTWC_CHGRCTRL1_ADDR 0x5E17
33#define BXTWC_CHGRCTRL2_ADDR 0x5E18
34#define BXTWC_CHGRSTATUS_ADDR 0x5E19
35#define BXTWC_THRMBATZONE_ADDR 0x4F22
36
37#define BXTWC_USBPATH_ADDR 0x5E19
38#define BXTWC_USBPHYCTRL_ADDR 0x5E07
39#define BXTWC_USBIDCTRL_ADDR 0x5E05
40#define BXTWC_USBIDEN_MASK 0x01
41#define BXTWC_USBIDSTAT_ADDR 0x00FF
42#define BXTWC_USBSRCDETSTATUS_ADDR 0x5E29
43
44#define BXTWC_DBGUSBBC1_ADDR 0x5FE0
45#define BXTWC_DBGUSBBC2_ADDR 0x5FE1
46#define BXTWC_DBGUSBBCSTAT_ADDR 0x5FE2
47
48#define BXTWC_WAKESRC_ADDR 0x4E22
49#define BXTWC_WAKESRC2_ADDR 0x4EE5
50#define BXTWC_CHRTTADDR_ADDR 0x5E22
51#define BXTWC_CHRTTDATA_ADDR 0x5E23
52
53#define BXTWC_STHRMIRQ0_ADDR 0x4F19
54#define WC_MTHRMIRQ1_ADDR 0x4E12
55#define WC_STHRMIRQ1_ADDR 0x4F1A
56#define WC_STHRMIRQ2_ADDR 0x4F1B
57
58#define BXTWC_THRMZN0H_ADDR 0x4F44
59#define BXTWC_THRMZN0L_ADDR 0x4F45
60#define BXTWC_THRMZN1H_ADDR 0x4F46
61#define BXTWC_THRMZN1L_ADDR 0x4F47
62#define BXTWC_THRMZN2H_ADDR 0x4F48
63#define BXTWC_THRMZN2L_ADDR 0x4F49
64#define BXTWC_THRMZN3H_ADDR 0x4F4A
65#define BXTWC_THRMZN3L_ADDR 0x4F4B
66#define BXTWC_THRMZN4H_ADDR 0x4F4C
67#define BXTWC_THRMZN4L_ADDR 0x4F4D
68
69#endif
diff --git a/include/linux/mfd/intel_soc_pmic.h b/include/linux/mfd/intel_soc_pmic.h
index abcbfcf32d10..cf619dbeace2 100644
--- a/include/linux/mfd/intel_soc_pmic.h
+++ b/include/linux/mfd/intel_soc_pmic.h
@@ -25,6 +25,8 @@ struct intel_soc_pmic {
25 int irq; 25 int irq;
26 struct regmap *regmap; 26 struct regmap *regmap;
27 struct regmap_irq_chip_data *irq_chip_data; 27 struct regmap_irq_chip_data *irq_chip_data;
28 struct regmap_irq_chip_data *irq_chip_data_level2;
29 struct device *dev;
28}; 30};
29 31
30#endif /* __INTEL_SOC_PMIC_H__ */ 32#endif /* __INTEL_SOC_PMIC_H__ */
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index ff843e7ca23d..7eb7cbac0a9a 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -589,6 +589,7 @@
589#define FORCE_ASPM_NO_ASPM 0x00 589#define FORCE_ASPM_NO_ASPM 0x00
590#define PM_CLK_FORCE_CTL 0xFE58 590#define PM_CLK_FORCE_CTL 0xFE58
591#define FUNC_FORCE_CTL 0xFE59 591#define FUNC_FORCE_CTL 0xFE59
592#define FUNC_FORCE_UPME_XMT_DBG 0x02
592#define PERST_GLITCH_WIDTH 0xFE5C 593#define PERST_GLITCH_WIDTH 0xFE5C
593#define CHANGE_LINK_STATE 0xFE5B 594#define CHANGE_LINK_STATE 0xFE5B
594#define RESET_LOAD_REG 0xFE5E 595#define RESET_LOAD_REG 0xFE5E
@@ -712,6 +713,7 @@
712#define PHY_RCR1 0x02 713#define PHY_RCR1 0x02
713#define PHY_RCR1_ADP_TIME_4 0x0400 714#define PHY_RCR1_ADP_TIME_4 0x0400
714#define PHY_RCR1_VCO_COARSE 0x001F 715#define PHY_RCR1_VCO_COARSE 0x001F
716#define PHY_RCR1_INIT_27S 0x0A1F
715#define PHY_SSCCR2 0x02 717#define PHY_SSCCR2 0x02
716#define PHY_SSCCR2_PLL_NCODE 0x0A00 718#define PHY_SSCCR2_PLL_NCODE 0x0A00
717#define PHY_SSCCR2_TIME0 0x001C 719#define PHY_SSCCR2_TIME0 0x001C
@@ -724,6 +726,7 @@
724#define PHY_RCR2_FREQSEL_12 0x0040 726#define PHY_RCR2_FREQSEL_12 0x0040
725#define PHY_RCR2_CDR_SC_12P 0x0010 727#define PHY_RCR2_CDR_SC_12P 0x0010
726#define PHY_RCR2_CALIB_LATE 0x0002 728#define PHY_RCR2_CALIB_LATE 0x0002
729#define PHY_RCR2_INIT_27S 0xC152
727#define PHY_SSCCR3 0x03 730#define PHY_SSCCR3 0x03
728#define PHY_SSCCR3_STEP_IN 0x2740 731#define PHY_SSCCR3_STEP_IN 0x2740
729#define PHY_SSCCR3_CHECK_DELAY 0x0008 732#define PHY_SSCCR3_CHECK_DELAY 0x0008
@@ -800,12 +803,14 @@
800#define PHY_ANA1A_RXT_BIST 0x0500 803#define PHY_ANA1A_RXT_BIST 0x0500
801#define PHY_ANA1A_TXR_BIST 0x0040 804#define PHY_ANA1A_TXR_BIST 0x0040
802#define PHY_ANA1A_REV 0x0006 805#define PHY_ANA1A_REV 0x0006
806#define PHY_FLD0_INIT_27S 0x2546
803#define PHY_FLD1 0x1B 807#define PHY_FLD1 0x1B
804#define PHY_FLD2 0x1C 808#define PHY_FLD2 0x1C
805#define PHY_FLD3 0x1D 809#define PHY_FLD3 0x1D
806#define PHY_FLD3_TIMER_4 0x0800 810#define PHY_FLD3_TIMER_4 0x0800
807#define PHY_FLD3_TIMER_6 0x0020 811#define PHY_FLD3_TIMER_6 0x0020
808#define PHY_FLD3_RXDELINK 0x0004 812#define PHY_FLD3_RXDELINK 0x0004
813#define PHY_FLD3_INIT_27S 0x0004
809#define PHY_ANA1D 0x1D 814#define PHY_ANA1D 0x1D
810#define PHY_ANA1D_DEBUG_ADDR 0x0004 815#define PHY_ANA1D_DEBUG_ADDR 0x0004
811#define _PHY_FLD0 0x1D 816#define _PHY_FLD0 0x1D
@@ -824,6 +829,7 @@
824#define PHY_FLD4_BER_COUNT 0x00E0 829#define PHY_FLD4_BER_COUNT 0x00E0
825#define PHY_FLD4_BER_TIMER 0x000A 830#define PHY_FLD4_BER_TIMER 0x000A
826#define PHY_FLD4_BER_CHK_EN 0x0001 831#define PHY_FLD4_BER_CHK_EN 0x0001
832#define PHY_FLD4_INIT_27S 0x5C7F
827#define PHY_DIG1E 0x1E 833#define PHY_DIG1E 0x1E
828#define PHY_DIG1E_REV 0x4000 834#define PHY_DIG1E_REV 0x4000
829#define PHY_DIG1E_D0_X_D1 0x1000 835#define PHY_DIG1E_D0_X_D1 0x1000
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 75115384f3fc..a06098639399 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -132,6 +132,10 @@ struct sec_platform_data {
132 int buck2_init; 132 int buck2_init;
133 int buck3_init; 133 int buck3_init;
134 int buck4_init; 134 int buck4_init;
135 /* Whether or not manually set PWRHOLD to low during shutdown. */
136 bool manual_poweroff;
137 /* Disable the WRSTBI (buck voltage warm reset) when probing? */
138 bool disable_wrstbi;
135}; 139};
136 140
137/** 141/**
diff --git a/include/linux/mfd/samsung/s2mps11.h b/include/linux/mfd/samsung/s2mps11.h
index 7981a9d77d3f..b288965e8101 100644
--- a/include/linux/mfd/samsung/s2mps11.h
+++ b/include/linux/mfd/samsung/s2mps11.h
@@ -179,6 +179,7 @@ enum s2mps11_regulators {
179#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1) 179#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)
180#define S2MPS11_RAMP_DELAY 25000 /* uV/us */ 180#define S2MPS11_RAMP_DELAY 25000 /* uV/us */
181 181
182#define S2MPS11_CTRL1_PWRHOLD_MASK BIT(4)
182 183
183#define S2MPS11_BUCK2_RAMP_SHIFT 6 184#define S2MPS11_BUCK2_RAMP_SHIFT 6
184#define S2MPS11_BUCK34_RAMP_SHIFT 4 185#define S2MPS11_BUCK34_RAMP_SHIFT 4
diff --git a/include/linux/mfd/samsung/s2mps13.h b/include/linux/mfd/samsung/s2mps13.h
index b1fd675fa36f..239e977ba45d 100644
--- a/include/linux/mfd/samsung/s2mps13.h
+++ b/include/linux/mfd/samsung/s2mps13.h
@@ -184,5 +184,6 @@ enum s2mps13_regulators {
184 * Let's assume that default value will be set. 184 * Let's assume that default value will be set.
185 */ 185 */
186#define S2MPS13_BUCK_RAMP_DELAY 12500 186#define S2MPS13_BUCK_RAMP_DELAY 12500
187#define S2MPS13_REG_WRSTBI_MASK BIT(5)
187 188
188#endif /* __LINUX_MFD_S2MPS13_H */ 189#endif /* __LINUX_MFD_S2MPS13_H */