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

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
...

+2529 -408
+8 -3
Documentation/acpi/enumeration.txt
··· 347 347 resulting child platform device will have its ACPI_COMPANION() set to point 348 348 to the parent device. 349 349 350 - If the ACPI namespace has a device that we can match using an ACPI id, 351 - the id should be set like: 350 + If the ACPI namespace has a device that we can match using an ACPI id or ACPI 351 + adr, 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 358 static struct mfd_cell my_subdevice_cell = { 354 359 .name = "my_subdevice", 355 360 /* set the resources relative to the parent */ 356 - .acpi_pnpid = "XYZ0001", 361 + .acpi_match = &my_subdevice_cell_acpi_match, 357 362 }; 358 363 359 364 The ACPI id "XYZ0001" is then used to lookup an ACPI device directly under
+15
Documentation/devicetree/bindings/extcon/extcon-arizona.txt
··· 1 + Cirrus Logic Arizona class audio SoCs 2 + 3 + These devices are audio SoCs with extensive digital capabilities and a range 4 + of analogue I/O. 5 + 6 + This document lists Extcon specific bindings, see the primary binding document: 7 + ../mfd/arizona.txt 8 + 9 + Optional 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.
+3 -12
Documentation/devicetree/bindings/mfd/arizona.txt
··· 44 44 Optional properties: 45 45 46 46 - wlf,reset : GPIO specifier for the GPIO controlling /RESET 47 - - wlf,ldoena : GPIO specifier for the GPIO controlling LDOENA 48 47 49 48 - wlf,gpio-defaults : A list of GPIO configuration register values. Defines 50 49 for the appropriate values can found in <dt-bindings/mfd/arizona.txt>. If ··· 66 67 present, the number of values should be less than or equal to the 67 68 number of inputs, unspecified inputs will use the chip default. 68 69 69 - - wlf,hpdet-channel : Headphone detection channel. 70 - ARIZONA_ACCDET_MODE_HPL or 1 - Headphone detect mode is set to HPDETL 71 - ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR 72 - If this node is not mentioned or if the value is unknown, then 73 - headphone detection mode is set to HPDETL. 74 - 75 70 - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if 76 71 they are being externally supplied. As covered in 77 72 Documentation/devicetree/bindings/regulator/regulator.txt 78 73 79 - Optional subnodes: 80 - - ldo1 : Initial data for the LDO1 regulator, as covered in 81 - Documentation/devicetree/bindings/regulator/regulator.txt 82 - - micvdd : Initial data for the MICVDD regulator, as covered in 83 - Documentation/devicetree/bindings/regulator/regulator.txt 74 + Also see child specific device properties: 75 + Regulator - ../regulator/arizona-regulator.txt 76 + Extcon - ../extcon/extcon-arizona.txt 84 77 85 78 Example: 86 79
+63
Documentation/devicetree/bindings/mfd/atmel-flexcom.txt
··· 1 + * Device tree bindings for Atmel Flexcom (Flexible Serial Communication Unit) 2 + 3 + The Atmel Flexcom is just a wrapper which embeds a SPI controller, an I2C 4 + controller and an USART. Only one function can be used at a time and is chosen 5 + at boot time according to the device tree. 6 + 7 + Required 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 + 21 + Required child: 22 + A single available child device of type matching the "atmel,flexcom-mode" 23 + property. 24 + 25 + The phandle provided by the clocks property of the child is the same as one for 26 + the Flexcom parent. 27 + 28 + For other properties, please refer to the documentations of the respective 29 + device: 30 + - ../serial/atmel-usart.txt 31 + - ../spi/spi_atmel.txt 32 + - ../i2c/i2c-at91.txt 33 + 34 + Example: 35 + 36 + flexcom@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 + };
+4
Documentation/devicetree/bindings/mfd/cros-ec.txt
··· 34 34 - compatible: "google,cros-ec-lpc" 35 35 - reg: List of (IO address, size) pairs defining the interface uses 36 36 37 + Optional 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 38 42 Example for I2C: 39 43
+26 -7
Documentation/devicetree/bindings/mfd/da9150.txt
··· 6 6 ------ ----------- 7 7 da9150-gpadc : General Purpose ADC 8 8 da9150-charger : Battery Charger 9 + da9150-fg : Battery Fuel-Gauge 9 10 10 11 ====== 11 12 ··· 17 16 the IRQs from da9150 are delivered to. 18 17 - interrupts: IRQ line info for da9150 chip. 19 18 - interrupt-controller: da9150 has internal IRQs (own IRQ domain). 20 - (See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt for 19 + (See ../interrupt-controller/interrupts.txt for 21 20 further information relating to interrupt properties) 22 21 23 22 Sub-devices: 24 - - da9150-gpadc: See Documentation/devicetree/bindings/iio/adc/da9150-gpadc.txt 25 - - da9150-charger: See Documentation/devicetree/bindings/power/da9150-charger.txt 26 - 23 + - da9150-gpadc: See ../iio/adc/da9150-gpadc.txt 24 + - da9150-charger: See ../power/da9150-charger.txt 25 + - da9150-fg: See ../power/da9150-fg.txt 27 26 28 27 Example: 29 28 ··· 35 34 interrupt-controller; 36 35 37 36 gpadc: da9150-gpadc { 38 - ... 37 + compatible = "dlg,da9150-gpadc"; 38 + #io-channel-cells = <1>; 39 39 }; 40 40 41 - da9150-charger { 42 - ... 41 + charger { 42 + compatible = "dlg,da9150-charger"; 43 + 44 + io-channels = <&gpadc 0>, 45 + <&gpadc 2>, 46 + <&gpadc 8>, 47 + <&gpadc 5>; 48 + io-channel-names = "CHAN_IBUS", 49 + "CHAN_VBUS", 50 + "CHAN_TJUNC", 51 + "CHAN_VBAT"; 52 + }; 53 + 54 + fuel-gauge { 55 + compatible = "dlg,da9150-fuel-gauge"; 56 + 57 + dlg,update-interval = <10000>; 58 + dlg,warn-soc-level = /bits/ 8 <15>; 59 + dlg,crit-soc-level = /bits/ 8 <5> 43 60 }; 44 61 };
+17 -7
Documentation/devicetree/bindings/mfd/s2mps11.txt
··· 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 4 4 The Samsung S2MPS11 is a multi-function device which includes voltage and 5 5 current regulators, RTC, charger controller and other sub-blocks. It is ··· 7 7 addressed by the host system using different I2C slave addresses. 8 8 9 9 Required properties: 10 - - compatible: Should be "samsung,s2mps11-pmic" or "samsung,s2mps13-pmic" 11 - or "samsung,s2mps14-pmic" or "samsung,s2mpu02-pmic". 10 + - compatible: Should be one of the following 11 + - "samsung,s2mps11-pmic" 12 + - "samsung,s2mps13-pmic" 13 + - "samsung,s2mps14-pmic" 14 + - "samsung,s2mps15-pmic" 15 + - "samsung,s2mpu02-pmic". 12 16 - reg: Specifies the I2C slave address of the pmic block. It should be 0x66. 13 17 14 18 Optional properties: 15 19 - interrupt-parent: Specifies the phandle of the interrupt controller to which 16 20 the interrupts from s2mps11 are delivered to. 17 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 19 26 Optional 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 28 KHz outputs, so to register these as clocks with common clock framework 22 29 instantiate a sub-node named "clocks". It uses the common clock binding 23 30 documented in : ··· 37 30 the clock which they consume. 38 31 Clock ID Devices 39 32 ---------------------------------------------------------- 40 - 32KhzAP 0 S2MPS11, S2MPS13, S2MPS14, S5M8767 41 - 32KhzCP 1 S2MPS11, S2MPS13, S5M8767 42 - 32KhzBT 2 S2MPS11, S2MPS13, S2MPS14, S5M8767 33 + 32KhzAP 0 S2MPS11, S2MPS13, S2MPS14, S2MPS15, S5M8767 34 + 32KhzCP 1 S2MPS11, S2MPS13, S2MPS15, S5M8767 35 + 32KhzBT 2 S2MPS11, S2MPS13, S2MPS14, S2MPS15, S5M8767 43 36 44 37 - compatible: Should be one of: "samsung,s2mps11-clk", "samsung,s2mps13-clk", 45 38 "samsung,s2mps14-clk", "samsung,s5m8767-clk" 39 + The s2msp15 uses the same compatible as s2mps13, as both provides similar clocks. 46 40 47 41 - regulators: The regulators of s2mps11 that have to be instantiated should be 48 42 included in a sub-node named 'regulators'. Regulator nodes included in this ··· 91 83 - S2MPS11: 1 to 38 92 84 - S2MPS13: 1 to 40 93 85 - S2MPS14: 1 to 25 86 + - S2MPS15: 1 to 27 94 87 - S2MPU02: 1 to 28 95 88 - Example: LDO1, LDO2, LDO28 96 89 - BUCKn ··· 99 90 - S2MPS11: 1 to 10 100 91 - S2MPS13: 1 to 10 101 92 - S2MPS14: 1 to 5 93 + - S2MPS15: 1 to 10 102 94 - S2MPU02: 1 to 7 103 95 - Example: BUCK1, BUCK2, BUCK9 104 96
+23
Documentation/devicetree/bindings/power/da9150-fg.txt
··· 1 + Dialog Semiconductor DA9150 Fuel-Gauge Power Supply bindings 2 + 3 + Required properties: 4 + - compatible: "dlg,da9150-fuel-gauge" for DA9150 Fuel-Gauge Power Supply 5 + 6 + Optional 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 + 15 + Example: 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 + };
+3 -1
MAINTAINERS
··· 7162 7162 F: include/media/mt9v032.h 7163 7163 7164 7164 MULTIFUNCTION DEVICES (MFD) 7165 - M: Samuel Ortiz <sameo@linux.intel.com> 7166 7165 M: Lee Jones <lee.jones@linaro.org> 7167 7166 T: git git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git 7168 7167 S: Supported ··· 11566 11567 W: https://github.com/CirrusLogic/linux-drivers/wiki 11567 11568 S: Supported 11568 11569 F: Documentation/hwmon/wm83?? 11570 + F: Documentation/devicetree/bindings/extcon/extcon-arizona.txt 11571 + F: Documentation/devicetree/bindings/regulator/arizona-regulator.txt 11572 + F: Documentation/devicetree/bindings/mfd/arizona.txt 11569 11573 F: arch/arm/mach-s3c64xx/mach-crag6410* 11570 11574 F: drivers/clk/clk-wm83*.c 11571 11575 F: drivers/extcon/extcon-arizona.c
+2
drivers/mfd/88pm80x.c
··· 33 33 {0x3, CHIP_PM800}, 34 34 /* 88PM805 chip id number */ 35 35 {0x0, CHIP_PM805}, 36 + /* 88PM860 chip id number */ 37 + {0x4, CHIP_PM860}, 36 38 }; 37 39 38 40 /*
+17 -4
drivers/mfd/Kconfig
··· 60 60 additional drivers must be enabled in order to use the 61 61 functionality of the device. 62 62 63 + config 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 + 63 74 config MFD_ATMEL_HLCDC 64 75 tristate "Atmel HLCDC (High-end LCD Controller)" 65 76 select MFD_CORE ··· 736 725 select MFD_CORE 737 726 help 738 727 This supports for Realtek PCI-Express card reader including rts5209, 739 - rts5229, rtl8411, etc. Realtek card reader supports access to many 740 - types of memory cards, such as Memory Stick, Memory Stick Pro, 741 - Secure Digital and MultiMediaCard. 728 + rts5227, rts522A, rts5229, rts5249, rts524A, rts525A, rtl8411, etc. 729 + Realtek card reader supports access to many types of memory cards, 730 + such as Memory Stick, Memory Stick Pro, Secure Digital and 731 + MultiMediaCard. 742 732 743 733 config MFD_RT5033 744 734 tristate "Richtek RT5033 Power Management IC" ··· 1071 1059 config TPS6105X 1072 1060 tristate "TI TPS61050/61052 Boost Converters" 1073 1061 depends on I2C 1062 + select REGMAP_I2C 1074 1063 select REGULATOR 1075 1064 select MFD_CORE 1076 1065 select REGULATOR_FIXED_VOLTAGE ··· 1484 1471 1485 1472 config MFD_STW481X 1486 1473 tristate "Support for ST Microelectronics STw481x" 1487 - depends on I2C && ARCH_NOMADIK 1474 + depends on I2C && (ARCH_NOMADIK || COMPILE_TEST) 1488 1475 select REGMAP_I2C 1489 1476 select MFD_CORE 1490 1477 help
+2
drivers/mfd/Makefile
··· 164 164 obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o 165 165 obj-$(CONFIG_MFD_TPS65090) += tps65090.o 166 166 obj-$(CONFIG_MFD_AAT2870_CORE) += aat2870-core.o 167 + obj-$(CONFIG_MFD_ATMEL_FLEXCOM) += atmel-flexcom.o 167 168 obj-$(CONFIG_MFD_ATMEL_HLCDC) += atmel-hlcdc.o 168 169 obj-$(CONFIG_MFD_INTEL_LPSS) += intel-lpss.o 169 170 obj-$(CONFIG_MFD_INTEL_LPSS_PCI) += intel-lpss-pci.o ··· 191 190 obj-$(CONFIG_MFD_SKY81452) += sky81452.o 192 191 193 192 intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o 193 + intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC) += intel_soc_pmic_bxtwc.o 194 194 obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o 195 195 obj-$(CONFIG_MFD_MT6397) += mt6397-core.o
+170 -128
drivers/mfd/arizona-core.c
··· 24 24 #include <linux/regulator/consumer.h> 25 25 #include <linux/regulator/machine.h> 26 26 #include <linux/slab.h> 27 + #include <linux/platform_device.h> 27 28 28 29 #include <linux/mfd/arizona/core.h> 29 30 #include <linux/mfd/arizona/registers.h> ··· 70 69 71 70 int arizona_clk32k_disable(struct arizona *arizona) 72 71 { 73 - int ret = 0; 74 - 75 72 mutex_lock(&arizona->clk_lock); 76 73 77 74 BUG_ON(arizona->clk32k_ref <= 0); ··· 89 90 90 91 mutex_unlock(&arizona->clk_lock); 91 92 92 - return ret; 93 + return 0; 93 94 } 94 95 EXPORT_SYMBOL_GPL(arizona_clk32k_disable); 95 96 ··· 461 462 } 462 463 463 464 #ifdef CONFIG_PM 465 + static int arizona_isolate_dcvdd(struct arizona *arizona) 466 + { 467 + int ret; 468 + 469 + ret = regmap_update_bits(arizona->regmap, 470 + ARIZONA_ISOLATION_CONTROL, 471 + ARIZONA_ISOLATE_DCVDD1, 472 + ARIZONA_ISOLATE_DCVDD1); 473 + if (ret != 0) 474 + dev_err(arizona->dev, "Failed to isolate DCVDD: %d\n", ret); 475 + 476 + return ret; 477 + } 478 + 479 + static int arizona_connect_dcvdd(struct arizona *arizona) 480 + { 481 + int ret; 482 + 483 + ret = regmap_update_bits(arizona->regmap, 484 + ARIZONA_ISOLATION_CONTROL, 485 + ARIZONA_ISOLATE_DCVDD1, 0); 486 + if (ret != 0) 487 + dev_err(arizona->dev, "Failed to connect DCVDD: %d\n", ret); 488 + 489 + return ret; 490 + } 491 + 492 + static int arizona_is_jack_det_active(struct arizona *arizona) 493 + { 494 + unsigned int val; 495 + int ret; 496 + 497 + ret = regmap_read(arizona->regmap, ARIZONA_JACK_DETECT_ANALOGUE, &val); 498 + if (ret) { 499 + dev_err(arizona->dev, 500 + "Failed to check jack det status: %d\n", ret); 501 + return ret; 502 + } else if (val & ARIZONA_JD1_ENA) { 503 + return 1; 504 + } else { 505 + return 0; 506 + } 507 + } 508 + 464 509 static int arizona_runtime_resume(struct device *dev) 465 510 { 466 511 struct arizona *arizona = dev_get_drvdata(dev); ··· 544 501 switch (arizona->type) { 545 502 case WM5102: 546 503 if (arizona->external_dcvdd) { 547 - ret = regmap_update_bits(arizona->regmap, 548 - ARIZONA_ISOLATION_CONTROL, 549 - ARIZONA_ISOLATE_DCVDD1, 0); 550 - if (ret != 0) { 551 - dev_err(arizona->dev, 552 - "Failed to connect DCVDD: %d\n", ret); 504 + ret = arizona_connect_dcvdd(arizona); 505 + if (ret != 0) 553 506 goto err; 554 - } 555 507 } 556 508 557 509 ret = wm5102_patch(arizona); ··· 571 533 goto err; 572 534 573 535 if (arizona->external_dcvdd) { 574 - ret = regmap_update_bits(arizona->regmap, 575 - ARIZONA_ISOLATION_CONTROL, 576 - ARIZONA_ISOLATE_DCVDD1, 0); 577 - if (ret) { 578 - dev_err(arizona->dev, 579 - "Failed to connect DCVDD: %d\n", ret); 536 + ret = arizona_connect_dcvdd(arizona); 537 + if (ret != 0) 580 538 goto err; 581 - } 582 539 } else { 583 540 /* 584 541 * As this is only called for the internal regulator ··· 604 571 goto err; 605 572 606 573 if (arizona->external_dcvdd) { 607 - ret = regmap_update_bits(arizona->regmap, 608 - ARIZONA_ISOLATION_CONTROL, 609 - ARIZONA_ISOLATE_DCVDD1, 0); 610 - if (ret != 0) { 611 - dev_err(arizona->dev, 612 - "Failed to connect DCVDD: %d\n", ret); 574 + ret = arizona_connect_dcvdd(arizona); 575 + if (ret != 0) 613 576 goto err; 614 - } 615 577 } 616 578 break; 617 579 } ··· 628 600 static int arizona_runtime_suspend(struct device *dev) 629 601 { 630 602 struct arizona *arizona = dev_get_drvdata(dev); 631 - unsigned int val; 603 + int jd_active = 0; 632 604 int ret; 633 605 634 606 dev_dbg(arizona->dev, "Entering AoD mode\n"); 635 607 636 - ret = regmap_read(arizona->regmap, ARIZONA_JACK_DETECT_ANALOGUE, &val); 637 - if (ret) { 638 - dev_err(dev, "Failed to check jack det status: %d\n", ret); 639 - return ret; 640 - } 641 - 642 - if (arizona->external_dcvdd) { 643 - ret = regmap_update_bits(arizona->regmap, 644 - ARIZONA_ISOLATION_CONTROL, 645 - ARIZONA_ISOLATE_DCVDD1, 646 - ARIZONA_ISOLATE_DCVDD1); 647 - if (ret != 0) { 648 - dev_err(arizona->dev, "Failed to isolate DCVDD: %d\n", 649 - ret); 650 - return ret; 651 - } 652 - } 653 - 654 608 switch (arizona->type) { 655 609 case WM5110: 656 610 case WM8280: 657 - if (arizona->external_dcvdd) 658 - break; 611 + jd_active = arizona_is_jack_det_active(arizona); 612 + if (jd_active < 0) 613 + return jd_active; 659 614 660 - /* 661 - * As this is only called for the internal regulator 662 - * (where we know voltage ranges available) it is ok 663 - * to request an exact range. 664 - */ 665 - ret = regulator_set_voltage(arizona->dcvdd, 1175000, 1175000); 666 - if (ret < 0) { 667 - dev_err(arizona->dev, 668 - "Failed to set suspend voltage: %d\n", ret); 669 - return ret; 615 + if (arizona->external_dcvdd) { 616 + ret = arizona_isolate_dcvdd(arizona); 617 + if (ret != 0) 618 + return ret; 619 + } else { 620 + /* 621 + * As this is only called for the internal regulator 622 + * (where we know voltage ranges available) it is ok 623 + * to request an exact range. 624 + */ 625 + ret = regulator_set_voltage(arizona->dcvdd, 626 + 1175000, 1175000); 627 + if (ret < 0) { 628 + dev_err(arizona->dev, 629 + "Failed to set suspend voltage: %d\n", 630 + ret); 631 + return ret; 632 + } 670 633 } 671 634 break; 672 635 case WM5102: 673 - if (!(val & ARIZONA_JD1_ENA)) { 636 + jd_active = arizona_is_jack_det_active(arizona); 637 + if (jd_active < 0) 638 + return jd_active; 639 + 640 + if (arizona->external_dcvdd) { 641 + ret = arizona_isolate_dcvdd(arizona); 642 + if (ret != 0) 643 + return ret; 644 + } 645 + 646 + if (!jd_active) { 674 647 ret = regmap_write(arizona->regmap, 675 648 ARIZONA_WRITE_SEQUENCER_CTRL_3, 0x0); 676 649 if (ret) { ··· 683 654 } 684 655 break; 685 656 default: 657 + jd_active = arizona_is_jack_det_active(arizona); 658 + if (jd_active < 0) 659 + return jd_active; 660 + 661 + if (arizona->external_dcvdd) { 662 + ret = arizona_isolate_dcvdd(arizona); 663 + if (ret != 0) 664 + return ret; 665 + } 686 666 break; 687 667 } 688 668 ··· 700 662 regulator_disable(arizona->dcvdd); 701 663 702 664 /* Allow us to completely power down if no jack detection */ 703 - if (!(val & ARIZONA_JD1_ENA)) { 665 + if (!jd_active) { 704 666 dev_dbg(arizona->dev, "Fully powering off\n"); 705 667 706 668 arizona->has_fully_powered_off = true; ··· 966 928 const char *type_name; 967 929 unsigned int reg, val, mask; 968 930 int (*apply_patch)(struct arizona *) = NULL; 969 - int ret, i; 931 + const struct mfd_cell *subdevs = NULL; 932 + int n_subdevs, ret, i; 970 933 971 934 dev_set_drvdata(arizona->dev, arizona); 972 935 mutex_init(&arizona->clk_lock); ··· 1128 1089 arizona->rev &= ARIZONA_DEVICE_REVISION_MASK; 1129 1090 1130 1091 switch (reg) { 1131 - #ifdef CONFIG_MFD_WM5102 1132 1092 case 0x5102: 1133 - type_name = "WM5102"; 1134 - if (arizona->type != WM5102) { 1135 - dev_err(arizona->dev, "WM5102 registered as %d\n", 1136 - arizona->type); 1137 - arizona->type = WM5102; 1093 + if (IS_ENABLED(CONFIG_MFD_WM5102)) { 1094 + type_name = "WM5102"; 1095 + if (arizona->type != WM5102) { 1096 + dev_warn(arizona->dev, 1097 + "WM5102 registered as %d\n", 1098 + arizona->type); 1099 + arizona->type = WM5102; 1100 + } 1101 + 1102 + apply_patch = wm5102_patch; 1103 + arizona->rev &= 0x7; 1104 + subdevs = wm5102_devs; 1105 + n_subdevs = ARRAY_SIZE(wm5102_devs); 1138 1106 } 1139 - apply_patch = wm5102_patch; 1140 - arizona->rev &= 0x7; 1141 1107 break; 1142 - #endif 1143 - #ifdef CONFIG_MFD_WM5110 1144 1108 case 0x5110: 1145 - switch (arizona->type) { 1146 - case WM5110: 1147 - type_name = "WM5110"; 1148 - break; 1149 - case WM8280: 1150 - type_name = "WM8280"; 1151 - break; 1152 - default: 1153 - type_name = "WM5110"; 1154 - dev_err(arizona->dev, "WM5110 registered as %d\n", 1155 - arizona->type); 1156 - arizona->type = WM5110; 1157 - break; 1109 + if (IS_ENABLED(CONFIG_MFD_WM5110)) { 1110 + switch (arizona->type) { 1111 + case WM5110: 1112 + type_name = "WM5110"; 1113 + break; 1114 + case WM8280: 1115 + type_name = "WM8280"; 1116 + break; 1117 + default: 1118 + type_name = "WM5110"; 1119 + dev_warn(arizona->dev, 1120 + "WM5110 registered as %d\n", 1121 + arizona->type); 1122 + arizona->type = WM5110; 1123 + break; 1124 + } 1125 + 1126 + apply_patch = wm5110_patch; 1127 + subdevs = wm5110_devs; 1128 + n_subdevs = ARRAY_SIZE(wm5110_devs); 1158 1129 } 1159 - apply_patch = wm5110_patch; 1160 1130 break; 1161 - #endif 1162 - #ifdef CONFIG_MFD_WM8997 1163 1131 case 0x8997: 1164 - type_name = "WM8997"; 1165 - if (arizona->type != WM8997) { 1166 - dev_err(arizona->dev, "WM8997 registered as %d\n", 1167 - arizona->type); 1168 - arizona->type = WM8997; 1132 + if (IS_ENABLED(CONFIG_MFD_WM8997)) { 1133 + type_name = "WM8997"; 1134 + if (arizona->type != WM8997) { 1135 + dev_warn(arizona->dev, 1136 + "WM8997 registered as %d\n", 1137 + arizona->type); 1138 + arizona->type = WM8997; 1139 + } 1140 + 1141 + apply_patch = wm8997_patch; 1142 + subdevs = wm8997_devs; 1143 + n_subdevs = ARRAY_SIZE(wm8997_devs); 1169 1144 } 1170 - apply_patch = wm8997_patch; 1171 1145 break; 1172 - #endif 1173 - #ifdef CONFIG_MFD_WM8998 1174 1146 case 0x6349: 1175 - switch (arizona->type) { 1176 - case WM8998: 1177 - type_name = "WM8998"; 1178 - break; 1147 + if (IS_ENABLED(CONFIG_MFD_WM8998)) { 1148 + switch (arizona->type) { 1149 + case WM8998: 1150 + type_name = "WM8998"; 1151 + break; 1179 1152 1180 - case WM1814: 1181 - type_name = "WM1814"; 1182 - break; 1153 + case WM1814: 1154 + type_name = "WM1814"; 1155 + break; 1183 1156 1184 - default: 1185 - type_name = "WM8998"; 1186 - dev_err(arizona->dev, "WM8998 registered as %d\n", 1187 - arizona->type); 1188 - arizona->type = WM8998; 1157 + default: 1158 + type_name = "WM8998"; 1159 + dev_warn(arizona->dev, 1160 + "WM8998 registered as %d\n", 1161 + arizona->type); 1162 + arizona->type = WM8998; 1163 + } 1164 + 1165 + apply_patch = wm8998_patch; 1166 + subdevs = wm8998_devs; 1167 + n_subdevs = ARRAY_SIZE(wm8998_devs); 1189 1168 } 1190 - 1191 - apply_patch = wm8998_patch; 1192 1169 break; 1193 - #endif 1194 1170 default: 1195 1171 dev_err(arizona->dev, "Unknown device ID %x\n", reg); 1172 + goto err_reset; 1173 + } 1174 + 1175 + if (!subdevs) { 1176 + dev_err(arizona->dev, 1177 + "No kernel support for device ID %x\n", reg); 1196 1178 goto err_reset; 1197 1179 } 1198 1180 ··· 1402 1342 arizona_request_irq(arizona, ARIZONA_IRQ_UNDERCLOCKED, "Underclocked", 1403 1343 arizona_underclocked, arizona); 1404 1344 1405 - switch (arizona->type) { 1406 - case WM5102: 1407 - ret = mfd_add_devices(arizona->dev, -1, wm5102_devs, 1408 - ARRAY_SIZE(wm5102_devs), NULL, 0, NULL); 1409 - break; 1410 - case WM5110: 1411 - case WM8280: 1412 - ret = mfd_add_devices(arizona->dev, -1, wm5110_devs, 1413 - ARRAY_SIZE(wm5110_devs), NULL, 0, NULL); 1414 - break; 1415 - case WM8997: 1416 - ret = mfd_add_devices(arizona->dev, -1, wm8997_devs, 1417 - ARRAY_SIZE(wm8997_devs), NULL, 0, NULL); 1418 - break; 1419 - case WM8998: 1420 - case WM1814: 1421 - ret = mfd_add_devices(arizona->dev, -1, wm8998_devs, 1422 - ARRAY_SIZE(wm8998_devs), NULL, 0, NULL); 1423 - break; 1424 - } 1345 + ret = mfd_add_devices(arizona->dev, PLATFORM_DEVID_NONE, 1346 + subdevs, n_subdevs, NULL, 0, NULL); 1425 1347 1426 - if (ret != 0) { 1348 + if (ret) { 1427 1349 dev_err(arizona->dev, "Failed to add subdevices: %d\n", ret); 1428 1350 goto err_irq; 1429 1351 }
+17 -16
drivers/mfd/arizona-i2c.c
··· 27 27 const struct i2c_device_id *id) 28 28 { 29 29 struct arizona *arizona; 30 - const struct regmap_config *regmap_config; 30 + const struct regmap_config *regmap_config = NULL; 31 31 unsigned long type; 32 32 int ret; 33 33 ··· 37 37 type = id->driver_data; 38 38 39 39 switch (type) { 40 - #ifdef CONFIG_MFD_WM5102 41 40 case WM5102: 42 - regmap_config = &wm5102_i2c_regmap; 41 + if (IS_ENABLED(CONFIG_MFD_WM5102)) 42 + regmap_config = &wm5102_i2c_regmap; 43 43 break; 44 - #endif 45 - #ifdef CONFIG_MFD_WM5110 46 44 case WM5110: 47 45 case WM8280: 48 - regmap_config = &wm5110_i2c_regmap; 46 + if (IS_ENABLED(CONFIG_MFD_WM5110)) 47 + regmap_config = &wm5110_i2c_regmap; 49 48 break; 50 - #endif 51 - #ifdef CONFIG_MFD_WM8997 52 49 case WM8997: 53 - regmap_config = &wm8997_i2c_regmap; 50 + if (IS_ENABLED(CONFIG_MFD_WM8997)) 51 + regmap_config = &wm8997_i2c_regmap; 54 52 break; 55 - #endif 56 - #ifdef CONFIG_MFD_WM8998 57 53 case WM8998: 58 54 case WM1814: 59 - regmap_config = &wm8998_i2c_regmap; 55 + if (IS_ENABLED(CONFIG_MFD_WM8998)) 56 + regmap_config = &wm8998_i2c_regmap; 60 57 break; 61 - #endif 62 58 default: 63 - dev_err(&i2c->dev, "Unknown device type %ld\n", 64 - id->driver_data); 59 + dev_err(&i2c->dev, "Unknown device type %ld\n", type); 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 66 return -EINVAL; 66 67 } 67 68 ··· 78 77 return ret; 79 78 } 80 79 81 - arizona->type = id->driver_data; 80 + arizona->type = type; 82 81 arizona->dev = &i2c->dev; 83 82 arizona->irq = i2c->irq; 84 83
+1 -1
drivers/mfd/arizona-irq.c
··· 169 169 static int arizona_irq_map(struct irq_domain *h, unsigned int virq, 170 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 174 irq_set_chip_data(virq, data); 175 175 irq_set_chip_and_handler(virq, &arizona_irq_chip, handle_simple_irq);
+13 -10
drivers/mfd/arizona-spi.c
··· 27 27 { 28 28 const struct spi_device_id *id = spi_get_device_id(spi); 29 29 struct arizona *arizona; 30 - const struct regmap_config *regmap_config; 30 + const struct regmap_config *regmap_config = NULL; 31 31 unsigned long type; 32 32 int ret; 33 33 ··· 37 37 type = id->driver_data; 38 38 39 39 switch (type) { 40 - #ifdef CONFIG_MFD_WM5102 41 40 case WM5102: 42 - regmap_config = &wm5102_spi_regmap; 41 + if (IS_ENABLED(CONFIG_MFD_WM5102)) 42 + regmap_config = &wm5102_spi_regmap; 43 43 break; 44 - #endif 45 - #ifdef CONFIG_MFD_WM5110 46 44 case WM5110: 47 45 case WM8280: 48 - regmap_config = &wm5110_spi_regmap; 46 + if (IS_ENABLED(CONFIG_MFD_WM5110)) 47 + regmap_config = &wm5110_spi_regmap; 49 48 break; 50 - #endif 51 49 default: 52 - dev_err(&spi->dev, "Unknown device type %ld\n", 53 - id->driver_data); 50 + dev_err(&spi->dev, "Unknown device type %ld\n", type); 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 57 return -EINVAL; 55 58 } 56 59 ··· 69 66 return ret; 70 67 } 71 68 72 - arizona->type = id->driver_data; 69 + arizona->type = type; 73 70 arizona->dev = &spi->dev; 74 71 arizona->irq = spi->irq; 75 72
+104
drivers/mfd/atmel-flexcom.c
··· 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 + 43 + static 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 + 86 + static const struct of_device_id atmel_flexcom_of_match[] = { 87 + { .compatible = "atmel,sama5d2-flexcom" }, 88 + { /* sentinel */ } 89 + }; 90 + MODULE_DEVICE_TABLE(of, atmel_flexcom_of_match); 91 + 92 + static 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 + 100 + module_platform_driver(atmel_flexcom_driver); 101 + 102 + MODULE_AUTHOR("Cyrille Pitchen <cyrille.pitchen@atmel.com>"); 103 + MODULE_DESCRIPTION("Atmel Flexcom MFD driver"); 104 + MODULE_LICENSE("GPL v2");
+1
drivers/mfd/atmel-hlcdc.c
··· 148 148 { .compatible = "atmel,sama5d4-hlcdc" }, 149 149 { /* sentinel */ }, 150 150 }; 151 + MODULE_DEVICE_TABLE(of, atmel_hlcdc_match); 151 152 152 153 static struct platform_driver atmel_hlcdc_driver = { 153 154 .probe = atmel_hlcdc_probe,
+20
drivers/mfd/axp20x.c
··· 161 161 }, 162 162 }; 163 163 164 + static 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 + 164 179 static struct resource axp288_fuel_gauge_resources[] = { 165 180 { 166 181 .start = AXP288_IRQ_QWBTU, ··· 585 570 .name = "axp288_fuel_gauge", 586 571 .num_resources = ARRAY_SIZE(axp288_fuel_gauge_resources), 587 572 .resources = axp288_fuel_gauge_resources, 573 + }, 574 + { 575 + .name = "axp20x-pek", 576 + .num_resources = ARRAY_SIZE(axp288_power_button_resources), 577 + .resources = axp288_power_button_resources, 588 578 }, 589 579 { 590 580 .name = "axp288_pmic_acpi",
-1
drivers/mfd/bcm590xx.c
··· 128 128 MODULE_AUTHOR("Matt Porter <mporter@linaro.org>"); 129 129 MODULE_DESCRIPTION("BCM590xx multi-function driver"); 130 130 MODULE_LICENSE("GPL v2"); 131 - MODULE_ALIAS("i2c:bcm590xx");
+7
drivers/mfd/cros_ec_i2c.c
··· 344 344 static SIMPLE_DEV_PM_OPS(cros_ec_i2c_pm_ops, cros_ec_i2c_suspend, 345 345 cros_ec_i2c_resume); 346 346 347 + static const struct of_device_id cros_ec_i2c_of_match[] = { 348 + { .compatible = "google,cros-ec-i2c", }, 349 + { /* sentinel */ }, 350 + }; 351 + MODULE_DEVICE_TABLE(of, cros_ec_i2c_of_match); 352 + 347 353 static const struct i2c_device_id cros_ec_i2c_id[] = { 348 354 { "cros-ec-i2c", 0 }, 349 355 { } ··· 359 353 static struct i2c_driver cros_ec_driver = { 360 354 .driver = { 361 355 .name = "cros-ec-i2c", 356 + .of_match_table = of_match_ptr(cros_ec_i2c_of_match), 362 357 .pm = &cros_ec_i2c_pm_ops, 363 358 }, 364 359 .probe = cros_ec_i2c_probe,
+1 -5
drivers/mfd/da903x.c
··· 532 532 return ret; 533 533 } 534 534 535 - ret = da903x_add_subdevs(chip, pdata); 536 - if (ret) 537 - return ret; 538 - 539 - return 0; 535 + return da903x_add_subdevs(chip, pdata); 540 536 } 541 537 542 538 static int da903x_remove(struct i2c_client *client)
+6
drivers/mfd/da9052-core.c
··· 51 51 case DA9052_GPIO_2_3_REG: 52 52 case DA9052_GPIO_4_5_REG: 53 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 57 case DA9052_GPIO_14_15_REG: 55 58 case DA9052_ID_0_1_REG: 56 59 case DA9052_ID_2_3_REG: ··· 181 178 case DA9052_GPIO_2_3_REG: 182 179 case DA9052_GPIO_4_5_REG: 183 180 case DA9052_GPIO_6_7_REG: 181 + case DA9052_GPIO_8_9_REG: 182 + case DA9052_GPIO_10_11_REG: 183 + case DA9052_GPIO_12_13_REG: 184 184 case DA9052_GPIO_14_15_REG: 185 185 case DA9052_ID_0_1_REG: 186 186 case DA9052_ID_2_3_REG:
+1 -5
drivers/mfd/da9052-i2c.c
··· 174 174 return ret; 175 175 } 176 176 177 - ret = da9052_device_init(da9052, id->driver_data); 178 - if (ret != 0) 179 - return ret; 180 - 181 - return 0; 177 + return da9052_device_init(da9052, id->driver_data); 182 178 } 183 179 184 180 static int da9052_i2c_remove(struct i2c_client *client)
+1 -5
drivers/mfd/da9052-spi.c
··· 56 56 return ret; 57 57 } 58 58 59 - ret = da9052_device_init(da9052, id->driver_data); 60 - if (ret != 0) 61 - return ret; 62 - 63 - return 0; 59 + return da9052_device_init(da9052, id->driver_data); 64 60 } 65 61 66 62 static int da9052_spi_remove(struct spi_device *spi)
+2 -2
drivers/mfd/da9062-core.c
··· 198 198 return ret; 199 199 } 200 200 201 - int get_device_type(struct da9062 *chip) 201 + static int da9062_get_device_type(struct da9062 *chip) 202 202 { 203 203 int device_id, variant_id, variant_mrc; 204 204 int ret; ··· 466 466 if (ret < 0) 467 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 470 if (ret) 471 471 return ret; 472 472
+154 -37
drivers/mfd/da9150-core.c
··· 23 23 #include <linux/mfd/da9150/core.h> 24 24 #include <linux/mfd/da9150/registers.h> 25 25 26 + /* Raw device access, used for QIF */ 27 + static 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 + 67 + static 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 + 26 97 static bool da9150_volatile_reg(struct device *dev, unsigned int reg) 27 98 { 28 99 switch (reg) { ··· 177 106 178 107 .volatile_reg = da9150_volatile_reg, 179 108 }; 109 + 110 + void da9150_read_qif(struct da9150 *da9150, u8 addr, int count, u8 *buf) 111 + { 112 + int ret; 113 + 114 + ret = da9150_i2c_read_device(da9150->core_qif, addr, count, buf); 115 + if (ret < 0) 116 + dev_err(da9150->dev, "Failed to read from QIF 0x%x: %d\n", 117 + addr, ret); 118 + } 119 + EXPORT_SYMBOL_GPL(da9150_read_qif); 120 + 121 + void da9150_write_qif(struct da9150 *da9150, u8 addr, int count, const u8 *buf) 122 + { 123 + int ret; 124 + 125 + ret = da9150_i2c_write_device(da9150->core_qif, addr, count, buf); 126 + if (ret < 0) 127 + dev_err(da9150->dev, "Failed to write to QIF 0x%x: %d\n", 128 + addr, ret); 129 + } 130 + EXPORT_SYMBOL_GPL(da9150_write_qif); 180 131 181 132 u8 da9150_reg_read(struct da9150 *da9150, u16 reg) 182 133 { ··· 355 262 }; 356 263 357 264 static struct resource da9150_gpadc_resources[] = { 358 - { 359 - .name = "GPADC", 360 - .start = DA9150_IRQ_GPADC, 361 - .end = DA9150_IRQ_GPADC, 362 - .flags = IORESOURCE_IRQ, 363 - }, 265 + DEFINE_RES_IRQ_NAMED(DA9150_IRQ_GPADC, "GPADC"), 364 266 }; 365 267 366 268 static struct resource da9150_charger_resources[] = { 367 - { 368 - .name = "CHG_STATUS", 369 - .start = DA9150_IRQ_CHG, 370 - .end = DA9150_IRQ_CHG, 371 - .flags = IORESOURCE_IRQ, 372 - }, 373 - { 374 - .name = "CHG_TJUNC", 375 - .start = DA9150_IRQ_TJUNC, 376 - .end = DA9150_IRQ_TJUNC, 377 - .flags = IORESOURCE_IRQ, 378 - }, 379 - { 380 - .name = "CHG_VFAULT", 381 - .start = DA9150_IRQ_VFAULT, 382 - .end = DA9150_IRQ_VFAULT, 383 - .flags = IORESOURCE_IRQ, 384 - }, 385 - { 386 - .name = "CHG_VBUS", 387 - .start = DA9150_IRQ_VBUS, 388 - .end = DA9150_IRQ_VBUS, 389 - .flags = IORESOURCE_IRQ, 390 - }, 269 + DEFINE_RES_IRQ_NAMED(DA9150_IRQ_CHG, "CHG_STATUS"), 270 + DEFINE_RES_IRQ_NAMED(DA9150_IRQ_TJUNC, "CHG_TJUNC"), 271 + DEFINE_RES_IRQ_NAMED(DA9150_IRQ_VFAULT, "CHG_VFAULT"), 272 + DEFINE_RES_IRQ_NAMED(DA9150_IRQ_VBUS, "CHG_VBUS"), 273 + }; 274 + 275 + static struct resource da9150_fg_resources[] = { 276 + DEFINE_RES_IRQ_NAMED(DA9150_IRQ_FG, "FG"), 277 + }; 278 + 279 + enum da9150_dev_idx { 280 + DA9150_GPADC_IDX = 0, 281 + DA9150_CHARGER_IDX, 282 + DA9150_FG_IDX, 391 283 }; 392 284 393 285 static struct mfd_cell da9150_devs[] = { 394 - { 286 + [DA9150_GPADC_IDX] = { 395 287 .name = "da9150-gpadc", 396 288 .of_compatible = "dlg,da9150-gpadc", 397 289 .resources = da9150_gpadc_resources, 398 290 .num_resources = ARRAY_SIZE(da9150_gpadc_resources), 399 291 }, 400 - { 292 + [DA9150_CHARGER_IDX] = { 401 293 .name = "da9150-charger", 402 294 .of_compatible = "dlg,da9150-charger", 403 295 .resources = da9150_charger_resources, 404 296 .num_resources = ARRAY_SIZE(da9150_charger_resources), 297 + }, 298 + [DA9150_FG_IDX] = { 299 + .name = "da9150-fuel-gauge", 300 + .of_compatible = "dlg,da9150-fuel-gauge", 301 + .resources = da9150_fg_resources, 302 + .num_resources = ARRAY_SIZE(da9150_fg_resources), 405 303 }, 406 304 }; 407 305 ··· 401 317 { 402 318 struct da9150 *da9150; 403 319 struct da9150_pdata *pdata = dev_get_platdata(&client->dev); 320 + int qif_addr; 404 321 int ret; 405 322 406 323 da9150 = devm_kzalloc(&client->dev, sizeof(*da9150), GFP_KERNEL); ··· 420 335 return ret; 421 336 } 422 337 423 - da9150->irq_base = pdata ? pdata->irq_base : -1; 338 + /* Setup secondary I2C interface for QIF access */ 339 + qif_addr = da9150_reg_read(da9150, DA9150_CORE2WIRE_CTRL_A); 340 + qif_addr = (qif_addr & DA9150_CORE_BASE_ADDR_MASK) >> 1; 341 + qif_addr |= DA9150_QIF_I2C_ADDR_LSB; 342 + da9150->core_qif = i2c_new_dummy(client->adapter, qif_addr); 343 + if (!da9150->core_qif) { 344 + dev_err(da9150->dev, "Failed to attach QIF client\n"); 345 + return -ENODEV; 346 + } 347 + 348 + i2c_set_clientdata(da9150->core_qif, da9150); 349 + 350 + if (pdata) { 351 + da9150->irq_base = pdata->irq_base; 352 + 353 + da9150_devs[DA9150_FG_IDX].platform_data = pdata->fg_pdata; 354 + da9150_devs[DA9150_FG_IDX].pdata_size = 355 + sizeof(struct da9150_fg_pdata); 356 + } else { 357 + da9150->irq_base = -1; 358 + } 424 359 425 360 ret = regmap_add_irq_chip(da9150->regmap, da9150->irq, 426 361 IRQF_TRIGGER_LOW | IRQF_ONESHOT, 427 362 da9150->irq_base, &da9150_regmap_irq_chip, 428 363 &da9150->regmap_irq_data); 429 - if (ret) 430 - return ret; 364 + if (ret) { 365 + dev_err(da9150->dev, "Failed to add regmap irq chip: %d\n", 366 + ret); 367 + goto regmap_irq_fail; 368 + } 369 + 431 370 432 371 da9150->irq_base = regmap_irq_chip_get_base(da9150->regmap_irq_data); 372 + 433 373 enable_irq_wake(da9150->irq); 434 374 435 375 ret = mfd_add_devices(da9150->dev, -1, da9150_devs, ··· 462 352 da9150->irq_base, NULL); 463 353 if (ret) { 464 354 dev_err(da9150->dev, "Failed to add child devices: %d\n", ret); 465 - regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data); 466 - return ret; 355 + goto mfd_fail; 467 356 } 468 357 469 358 return 0; 359 + 360 + mfd_fail: 361 + regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data); 362 + regmap_irq_fail: 363 + i2c_unregister_device(da9150->core_qif); 364 + 365 + return ret; 470 366 } 471 367 472 368 static int da9150_remove(struct i2c_client *client) ··· 481 365 482 366 regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data); 483 367 mfd_remove_devices(da9150->dev); 368 + i2c_unregister_device(da9150->core_qif); 484 369 485 370 return 0; 486 371 }
+1
drivers/mfd/hi6421-pmic-core.c
··· 97 97 { .compatible = "hisilicon,hi6421-pmic", }, 98 98 { }, 99 99 }; 100 + MODULE_DEVICE_TABLE(of, of_hi6421_pmic_match_tbl); 100 101 101 102 static struct platform_driver hi6421_pmic_driver = { 102 103 .driver = {
+1 -2
drivers/mfd/htc-i2cpld.c
··· 318 318 struct htcpld_data *htcpld; 319 319 struct htcpld_chip *chip; 320 320 unsigned int irq, irq_end; 321 - int ret = 0; 322 321 323 322 /* Get the platform and driver data */ 324 323 htcpld = platform_get_drvdata(pdev); ··· 332 333 irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE); 333 334 } 334 335 335 - return ret; 336 + return 0; 336 337 } 337 338 338 339 static int htcpld_register_chip_i2c(
+16
drivers/mfd/intel-lpss-acpi.c
··· 25 25 .clk_rate = 120000000, 26 26 }; 27 27 28 + static const struct intel_lpss_platform_info bxt_info = { 29 + .clk_rate = 100000000, 30 + }; 31 + 32 + static const struct intel_lpss_platform_info bxt_i2c_info = { 33 + .clk_rate = 133000000, 34 + }; 35 + 28 36 static const struct acpi_device_id intel_lpss_acpi_ids[] = { 29 37 /* SPT */ 30 38 { "INT3446", (kernel_ulong_t)&spt_info }, 31 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 }; 34 50 MODULE_DEVICE_TABLE(acpi, intel_lpss_acpi_ids);
+45
drivers/mfd/intel-lpss-pci.c
··· 70 70 .clk_con_id = "baudclk", 71 71 }; 72 72 73 + static const struct intel_lpss_platform_info bxt_info = { 74 + .clk_rate = 100000000, 75 + }; 76 + 77 + static const struct intel_lpss_platform_info bxt_uart_info = { 78 + .clk_rate = 100000000, 79 + .clk_con_id = "baudclk", 80 + }; 81 + 82 + static const struct intel_lpss_platform_info bxt_i2c_info = { 83 + .clk_rate = 133000000, 84 + }; 85 + 73 86 static 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 119 /* SPT-LP */ 75 120 { PCI_VDEVICE(INTEL, 0x9d27), (kernel_ulong_t)&spt_uart_info }, 76 121 { PCI_VDEVICE(INTEL, 0x9d28), (kernel_ulong_t)&spt_uart_info },
+4 -8
drivers/mfd/intel-lpss.c
··· 26 26 #include <linux/pm_runtime.h> 27 27 #include <linux/seq_file.h> 28 28 29 + #include <asm-generic/io-64-nonatomic-lo-hi.h> 30 + 29 31 #include "intel-lpss.h" 30 32 31 33 #define LPSS_DEV_OFFSET 0x000 ··· 54 52 #define LPSS_PRIV_SSP_REG 0x20 55 53 #define LPSS_PRIV_SSP_REG_DIS_DMA_FIN BIT(0) 56 54 57 - #define LPSS_PRIV_REMAP_ADDR_LO 0x40 58 - #define LPSS_PRIV_REMAP_ADDR_HI 0x44 55 + #define LPSS_PRIV_REMAP_ADDR 0x40 59 56 60 57 #define LPSS_PRIV_CAPS 0xfc 61 58 #define LPSS_PRIV_CAPS_NO_IDMA BIT(8) ··· 251 250 { 252 251 resource_size_t addr = lpss->info->mem->start; 253 252 254 - writel(addr, lpss->priv + LPSS_PRIV_REMAP_ADDR_LO); 255 - #if BITS_PER_LONG > 32 256 - writel(addr >> 32, lpss->priv + LPSS_PRIV_REMAP_ADDR_HI); 257 - #else 258 - writel(0, lpss->priv + LPSS_PRIV_REMAP_ADDR_HI); 259 - #endif 253 + lo_hi_writeq(addr, lpss->priv + LPSS_PRIV_REMAP_ADDR); 260 254 } 261 255 262 256 static void intel_lpss_deassert_reset(const struct intel_lpss *lpss)
+23 -10
drivers/mfd/intel_quark_i2c_gpio.c
··· 31 31 #define MFD_I2C_BAR 0 32 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 38 /* The base GPIO number under GPIOLIB framework */ 35 39 #define INTEL_QUARK_MFD_GPIO_BASE 8 36 40 ··· 86 82 }, 87 83 }; 88 84 85 + static struct mfd_cell_acpi_match intel_quark_acpi_match_i2c = { 86 + .adr = MFD_ACPI_MATCH_I2C, 87 + }; 88 + 89 89 static struct resource intel_quark_gpio_res[] = { 90 90 [INTEL_QUARK_IORES_MEM] = { 91 91 .flags = IORESOURCE_MEM, 92 92 }, 93 93 }; 94 94 95 + static struct mfd_cell_acpi_match intel_quark_acpi_match_gpio = { 96 + .adr = MFD_ACPI_MATCH_GPIO, 97 + }; 98 + 95 99 static struct mfd_cell intel_quark_mfd_cells[] = { 96 - { 97 - .id = MFD_I2C_BAR, 98 - .name = "i2c_designware", 99 - .num_resources = ARRAY_SIZE(intel_quark_i2c_res), 100 - .resources = intel_quark_i2c_res, 101 - .ignore_resource_conflicts = true, 102 - }, 103 100 { 104 101 .id = MFD_GPIO_BAR, 105 102 .name = "gpio-dwapb", 103 + .acpi_match = &intel_quark_acpi_match_gpio, 106 104 .num_resources = ARRAY_SIZE(intel_quark_gpio_res), 107 105 .resources = intel_quark_gpio_res, 106 + .ignore_resource_conflicts = true, 107 + }, 108 + { 109 + .id = MFD_I2C_BAR, 110 + .name = "i2c_designware", 111 + .acpi_match = &intel_quark_acpi_match_i2c, 112 + .num_resources = ARRAY_SIZE(intel_quark_i2c_res), 113 + .resources = intel_quark_i2c_res, 108 114 .ignore_resource_conflicts = true, 109 115 }, 110 116 }; ··· 262 248 263 249 dev_set_drvdata(&pdev->dev, quark_mfd); 264 250 265 - ret = intel_quark_i2c_setup(pdev, &intel_quark_mfd_cells[MFD_I2C_BAR]); 251 + ret = intel_quark_i2c_setup(pdev, &intel_quark_mfd_cells[1]); 266 252 if (ret) 267 253 return ret; 268 254 269 - ret = intel_quark_gpio_setup(pdev, 270 - &intel_quark_mfd_cells[MFD_GPIO_BAR]); 255 + ret = intel_quark_gpio_setup(pdev, &intel_quark_mfd_cells[0]); 271 256 if (ret) 272 257 return ret; 273 258
+477
drivers/mfd/intel_soc_pmic_bxtwc.c
··· 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 */ 65 + enum 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 + 80 + enum 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 + 94 + static 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 + 106 + static 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 + 119 + static 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 + 128 + static 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 + 137 + static struct resource gpio_resources[] = { 138 + DEFINE_RES_IRQ_NAMED(BXTWC_GPIO0_IRQ, "GPIO0"), 139 + DEFINE_RES_IRQ_NAMED(BXTWC_GPIO1_IRQ, "GPIO1"), 140 + }; 141 + 142 + static struct resource adc_resources[] = { 143 + DEFINE_RES_IRQ_NAMED(BXTWC_ADC_IRQ, "ADC"), 144 + }; 145 + 146 + static struct resource charger_resources[] = { 147 + DEFINE_RES_IRQ_NAMED(BXTWC_CHGR0_IRQ, "CHARGER"), 148 + DEFINE_RES_IRQ_NAMED(BXTWC_CHGR1_IRQ, "CHARGER1"), 149 + }; 150 + 151 + static 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 + 157 + static struct resource bcu_resources[] = { 158 + DEFINE_RES_IRQ_NAMED(BXTWC_BCU_IRQ, "BCU"), 159 + }; 160 + 161 + static 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 + 192 + static 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 + 226 + static 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 */ 260 + static unsigned long bxtwc_reg_addr; 261 + static 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 + 267 + static 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 + 277 + static 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 + 293 + static 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 + 313 + static DEVICE_ATTR(addr, S_IWUSR | S_IRUSR, bxtwc_reg_show, bxtwc_reg_store); 314 + static DEVICE_ATTR(val, S_IWUSR | S_IRUSR, bxtwc_val_show, bxtwc_val_store); 315 + static struct attribute *bxtwc_attrs[] = { 316 + &dev_attr_addr.attr, 317 + &dev_attr_val.attr, 318 + NULL 319 + }; 320 + 321 + static const struct attribute_group bxtwc_group = { 322 + .attrs = bxtwc_attrs, 323 + }; 324 + 325 + static 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 + 332 + static 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 + 408 + err_sysfs: 409 + mfd_remove_devices(&pdev->dev); 410 + err_mfd: 411 + regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data_level2); 412 + err_irq_chip_level2: 413 + regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data); 414 + 415 + return ret; 416 + } 417 + 418 + static 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 + 430 + static 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 438 + static 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 + 447 + static 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 455 + static SIMPLE_DEV_PM_OPS(bxtwc_pm_ops, bxtwc_suspend, bxtwc_resume); 456 + 457 + static const struct acpi_device_id bxtwc_acpi_ids[] = { 458 + { "INT34D3", }, 459 + { } 460 + }; 461 + MODULE_DEVICE_TABLE(acpi, pmic_acpi_ids); 462 + 463 + static 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 + 474 + module_platform_driver(bxtwc_driver); 475 + 476 + MODULE_LICENSE("GPL v2"); 477 + MODULE_AUTHOR("Qipeng Zha<qipeng.zha@intel.com>");
+2 -12
drivers/mfd/kempld-core.c
··· 448 448 struct device *dev = &pdev->dev; 449 449 struct kempld_device_data *pld; 450 450 struct resource *ioport; 451 - int ret; 452 451 453 452 pld = devm_kzalloc(dev, sizeof(*pld), GFP_KERNEL); 454 453 if (!pld) ··· 470 471 mutex_init(&pld->lock); 471 472 platform_set_drvdata(pdev, pld); 472 473 473 - ret = kempld_detect_device(pld); 474 - if (ret) 475 - return ret; 476 - 477 - return 0; 474 + return kempld_detect_device(pld); 478 475 } 479 476 480 477 static int kempld_remove(struct platform_device *pdev) ··· 751 756 static int __init kempld_init(void) 752 757 { 753 758 const struct dmi_system_id *id; 754 - int ret; 755 759 756 760 if (force_device_id[0]) { 757 761 for (id = kempld_dmi_table; ··· 765 771 return -ENODEV; 766 772 } 767 773 768 - ret = platform_driver_register(&kempld_driver); 769 - if (ret) 770 - return ret; 771 - 772 - return 0; 774 + return platform_driver_register(&kempld_driver); 773 775 } 774 776 775 777 static void __exit kempld_exit(void)
+2 -11
drivers/mfd/lm3533-core.c
··· 472 472 if (ret) 473 473 return ret; 474 474 475 - ret = lm3533_set_boost_ovp(lm3533, pdata->boost_ovp); 476 - if (ret) 477 - return ret; 478 - 479 - return 0; 475 + return lm3533_set_boost_ovp(lm3533, pdata->boost_ovp); 480 476 } 481 477 482 478 static int lm3533_device_init(struct lm3533 *lm3533) ··· 592 596 const struct i2c_device_id *id) 593 597 { 594 598 struct lm3533 *lm3533; 595 - int ret; 596 599 597 600 dev_dbg(&i2c->dev, "%s\n", __func__); 598 601 ··· 608 613 lm3533->dev = &i2c->dev; 609 614 lm3533->irq = i2c->irq; 610 615 611 - ret = lm3533_device_init(lm3533); 612 - if (ret) 613 - return ret; 614 - 615 - return 0; 616 + return lm3533_device_init(lm3533); 616 617 } 617 618 618 619 static int lm3533_i2c_remove(struct i2c_client *i2c)
+18 -24
drivers/mfd/lpc_ich.c
··· 132 132 }, 133 133 }; 134 134 135 - enum lpc_cells { 136 - LPC_WDT = 0, 137 - LPC_GPIO, 135 + static struct mfd_cell lpc_ich_wdt_cell = { 136 + .name = "iTCO_wdt", 137 + .num_resources = ARRAY_SIZE(wdt_ich_res), 138 + .resources = wdt_ich_res, 139 + .ignore_resource_conflicts = true, 138 140 }; 139 141 140 - static struct mfd_cell lpc_ich_cells[] = { 141 - [LPC_WDT] = { 142 - .name = "iTCO_wdt", 143 - .num_resources = ARRAY_SIZE(wdt_ich_res), 144 - .resources = wdt_ich_res, 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 - }, 142 + static struct mfd_cell lpc_ich_gpio_cell = { 143 + .name = "gpio_ich", 144 + .num_resources = ARRAY_SIZE(gpio_ich_res), 145 + .resources = gpio_ich_res, 146 + .ignore_resource_conflicts = true, 153 147 }; 154 148 155 149 /* chipset related info */ ··· 835 841 struct itco_wdt_platform_data *pdata; 836 842 struct lpc_ich_priv *priv = pci_get_drvdata(dev); 837 843 struct lpc_ich_info *info; 838 - struct mfd_cell *cell = &lpc_ich_cells[LPC_WDT]; 844 + struct mfd_cell *cell = &lpc_ich_wdt_cell; 839 845 840 846 pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL); 841 847 if (!pdata) ··· 854 860 static void lpc_ich_finalize_gpio_cell(struct pci_dev *dev) 855 861 { 856 862 struct lpc_ich_priv *priv = pci_get_drvdata(dev); 857 - struct mfd_cell *cell = &lpc_ich_cells[LPC_GPIO]; 863 + struct mfd_cell *cell = &lpc_ich_gpio_cell; 858 864 859 865 cell->platform_data = &lpc_chipset_info[priv->chipset]; 860 866 cell->pdata_size = sizeof(struct lpc_ich_info); ··· 898 904 base_addr = base_addr_cfg & 0x0000ff80; 899 905 if (!base_addr) { 900 906 dev_notice(&dev->dev, "I/O space for ACPI uninitialized\n"); 901 - lpc_ich_cells[LPC_GPIO].num_resources--; 907 + lpc_ich_gpio_cell.num_resources--; 902 908 goto gpe0_done; 903 909 } 904 910 ··· 912 918 * the platform_device subsystem doesn't see this resource 913 919 * or it will register an invalid region. 914 920 */ 915 - lpc_ich_cells[LPC_GPIO].num_resources--; 921 + lpc_ich_gpio_cell.num_resources--; 916 922 acpi_conflict = true; 917 923 } else { 918 924 lpc_ich_enable_acpi_space(dev); ··· 952 958 953 959 lpc_ich_finalize_gpio_cell(dev); 954 960 ret = mfd_add_devices(&dev->dev, PLATFORM_DEVID_AUTO, 955 - &lpc_ich_cells[LPC_GPIO], 1, NULL, 0, NULL); 961 + &lpc_ich_gpio_cell, 1, NULL, 0, NULL); 956 962 957 963 gpio_done: 958 964 if (acpi_conflict) 959 965 pr_warn("Resource conflict(s) found affecting %s\n", 960 - lpc_ich_cells[LPC_GPIO].name); 966 + lpc_ich_gpio_cell.name); 961 967 return ret; 962 968 } 963 969 ··· 1001 1007 */ 1002 1008 if (lpc_chipset_info[priv->chipset].iTCO_version == 1) { 1003 1009 /* Don't register iomem for TCO ver 1 */ 1004 - lpc_ich_cells[LPC_WDT].num_resources--; 1010 + lpc_ich_wdt_cell.num_resources--; 1005 1011 } else if (lpc_chipset_info[priv->chipset].iTCO_version == 2) { 1006 1012 pci_read_config_dword(dev, RCBABASE, &base_addr_cfg); 1007 1013 base_addr = base_addr_cfg & 0xffffc000; ··· 1029 1035 goto wdt_done; 1030 1036 1031 1037 ret = mfd_add_devices(&dev->dev, PLATFORM_DEVID_AUTO, 1032 - &lpc_ich_cells[LPC_WDT], 1, NULL, 0, NULL); 1038 + &lpc_ich_wdt_cell, 1, NULL, 0, NULL); 1033 1039 1034 1040 wdt_done: 1035 1041 return ret;
+1
drivers/mfd/max8997.c
··· 55 55 { .compatible = "maxim,max8997-pmic", .data = (void *)TYPE_MAX8997 }, 56 56 {}, 57 57 }; 58 + MODULE_DEVICE_TABLE(of, max8997_pmic_dt_match); 58 59 #endif 59 60 60 61 int max8997_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest)
+35 -15
drivers/mfd/mfd-core.c
··· 82 82 static void mfd_acpi_add_device(const struct mfd_cell *cell, 83 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 87 struct acpi_device *adev; 87 88 88 - parent_adev = ACPI_COMPANION(pdev->dev.parent); 89 - if (!parent_adev) 89 + parent = ACPI_COMPANION(pdev->dev.parent); 90 + if (!parent) 90 91 return; 91 92 92 93 /* 93 - * MFD child device gets its ACPI handle either from the ACPI 94 - * device directly under the parent that matches the acpi_pnpid or 95 - * it will use the parent handle if is no acpi_pnpid is given. 94 + * MFD child device gets its ACPI handle either from the ACPI device 95 + * directly under the parent that matches the either _HID or _CID, or 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; 98 - if (cell->acpi_pnpid) { 99 - struct acpi_device_id ids[2] = {}; 100 - struct acpi_device *child_adev; 102 + adev = parent; 103 + if (match) { 104 + if (match->pnpid) { 105 + struct acpi_device_id ids[2] = {}; 101 106 102 - strlcpy(ids[0].id, cell->acpi_pnpid, sizeof(ids[0].id)); 103 - list_for_each_entry(child_adev, &parent_adev->children, node) 104 - if (acpi_match_device_ids(child_adev, ids)) { 105 - adev = child_adev; 106 - break; 107 + strlcpy(ids[0].id, match->pnpid, sizeof(ids[0].id)); 108 + list_for_each_entry(child, &parent->children, node) { 109 + if (acpi_match_device_ids(child, ids)) { 110 + adev = child; 111 + break; 112 + } 107 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 + } 126 + } 127 + } 108 128 } 109 129 110 130 ACPI_COMPANION_SET(&pdev->dev, adev);
+2 -2
drivers/mfd/pcf50633-irq.c
··· 55 55 static int __pcf50633_irq_mask_set(struct pcf50633 *pcf, int irq, u8 mask) 56 56 { 57 57 u8 reg, bit; 58 - int ret = 0, idx; 58 + int idx; 59 59 60 60 idx = irq >> 3; 61 61 reg = PCF50633_REG_INT1M + idx; ··· 72 72 73 73 mutex_unlock(&pcf->lock); 74 74 75 - return ret; 75 + return 0; 76 76 } 77 77 78 78 int pcf50633_irq_mask(struct pcf50633 *pcf, int irq)
+1 -1
drivers/mfd/qcom_rpm.c
··· 550 550 ret = devm_request_irq(&pdev->dev, 551 551 irq_ack, 552 552 qcom_rpm_ack_interrupt, 553 - IRQF_TRIGGER_RISING | IRQF_NO_SUSPEND, 553 + IRQF_TRIGGER_RISING, 554 554 "qcom_rpm_ack", 555 555 rpm); 556 556 if (ret) {
+3 -1
drivers/mfd/rt5033.c
··· 47 47 }, { 48 48 .name = "rt5033-battery", 49 49 .of_compatible = "richtek,rt5033-battery", 50 + }, { 51 + .name = "rt5033-led", 52 + .of_compatible = "richtek,rt5033-led", 50 53 }, 51 54 }; 52 55 ··· 140 137 }; 141 138 module_i2c_driver(rt5033_driver); 142 139 143 - MODULE_ALIAS("i2c:rt5033"); 144 140 MODULE_DESCRIPTION("Richtek RT5033 multi-function core driver"); 145 141 MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>"); 146 142 MODULE_LICENSE("GPL");
+1 -5
drivers/mfd/rts5209.c
··· 138 138 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL, pwr_mask, pwr_on); 139 139 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, 140 140 LDO3318_PWR_MASK, 0x00); 141 - err = rtsx_pci_send_cmd(pcr, 100); 142 - if (err < 0) 143 - return err; 144 - 145 - return 0; 141 + return rtsx_pci_send_cmd(pcr, 100); 146 142 } 147 143 148 144 static int rts5209_card_power_off(struct rtsx_pcr *pcr, int card)
+76 -7
drivers/mfd/rts5227.c
··· 26 26 27 27 #include "rtsx_pcr.h" 28 28 29 + static 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 + 29 37 static void rts5227_fill_driving(struct rtsx_pcr *pcr, u8 voltage) 30 38 { 31 39 u8 driving_3v3[4][3] = { ··· 96 88 rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0); 97 89 98 90 if (pm_state == HOST_ENTER_S3) 99 - rtsx_pci_write_register(pcr, PM_CTRL3, 0x10, 0x10); 91 + rtsx_pci_write_register(pcr, pcr->reg_pm_ctrl3, 0x10, 0x10); 100 92 101 93 rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03); 102 94 } ··· 129 121 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB8, 0xB8); 130 122 else 131 123 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB8, 0x88); 132 - rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PM_CTRL3, 0x10, 0x00); 124 + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, pcr->reg_pm_ctrl3, 0x10, 0x00); 133 125 134 126 return rtsx_pci_send_cmd(pcr, 100); 135 127 } ··· 187 179 SD_POWER_MASK, SD_POWER_ON); 188 180 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, 189 181 LDO3318_PWR_MASK, 0x06); 190 - err = rtsx_pci_send_cmd(pcr, 100); 191 - if (err < 0) 192 - return err; 193 - 194 - return 0; 182 + return rtsx_pci_send_cmd(pcr, 100); 195 183 } 196 184 197 185 static int rts5227_card_power_off(struct rtsx_pcr *pcr, int card) ··· 302 298 pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 15); 303 299 pcr->rx_initial_phase = SET_CLOCK_PHASE(30, 7, 7); 304 300 301 + pcr->ic_version = rts5227_get_ic_version(pcr); 305 302 pcr->sd_pull_ctl_enable_tbl = rts5227_sd_pull_ctl_enable_tbl; 306 303 pcr->sd_pull_ctl_disable_tbl = rts5227_sd_pull_ctl_disable_tbl; 307 304 pcr->ms_pull_ctl_enable_tbl = rts5227_ms_pull_ctl_enable_tbl; 308 305 pcr->ms_pull_ctl_disable_tbl = rts5227_ms_pull_ctl_disable_tbl; 306 + 307 + pcr->reg_pm_ctrl3 = PM_CTRL3; 308 + } 309 + 310 + static int rts522a_optimize_phy(struct rtsx_pcr *pcr) 311 + { 312 + int err; 313 + 314 + err = rtsx_pci_write_register(pcr, RTS522A_PM_CTRL3, D3_DELINK_MODE_EN, 315 + 0x00); 316 + if (err < 0) 317 + return err; 318 + 319 + if (is_version(pcr, 0x522A, IC_VER_A)) { 320 + err = rtsx_pci_write_phy_register(pcr, PHY_RCR2, 321 + PHY_RCR2_INIT_27S); 322 + if (err) 323 + return err; 324 + 325 + rtsx_pci_write_phy_register(pcr, PHY_RCR1, PHY_RCR1_INIT_27S); 326 + rtsx_pci_write_phy_register(pcr, PHY_FLD0, PHY_FLD0_INIT_27S); 327 + rtsx_pci_write_phy_register(pcr, PHY_FLD3, PHY_FLD3_INIT_27S); 328 + rtsx_pci_write_phy_register(pcr, PHY_FLD4, PHY_FLD4_INIT_27S); 329 + } 330 + 331 + return 0; 332 + } 333 + 334 + static int rts522a_extra_init_hw(struct rtsx_pcr *pcr) 335 + { 336 + rts5227_extra_init_hw(pcr); 337 + 338 + rtsx_pci_write_register(pcr, FUNC_FORCE_CTL, FUNC_FORCE_UPME_XMT_DBG, 339 + FUNC_FORCE_UPME_XMT_DBG); 340 + rtsx_pci_write_register(pcr, PCLK_CTL, 0x04, 0x04); 341 + rtsx_pci_write_register(pcr, PM_EVENT_DEBUG, PME_DEBUG_0, PME_DEBUG_0); 342 + rtsx_pci_write_register(pcr, PM_CLK_FORCE_CTL, 0xFF, 0x11); 343 + 344 + return 0; 345 + } 346 + 347 + /* rts522a operations mainly derived from rts5227, except phy/hw init setting. 348 + */ 349 + static const struct pcr_ops rts522a_pcr_ops = { 350 + .fetch_vendor_settings = rts5227_fetch_vendor_settings, 351 + .extra_init_hw = rts522a_extra_init_hw, 352 + .optimize_phy = rts522a_optimize_phy, 353 + .turn_on_led = rts5227_turn_on_led, 354 + .turn_off_led = rts5227_turn_off_led, 355 + .enable_auto_blink = rts5227_enable_auto_blink, 356 + .disable_auto_blink = rts5227_disable_auto_blink, 357 + .card_power_on = rts5227_card_power_on, 358 + .card_power_off = rts5227_card_power_off, 359 + .switch_output_voltage = rts5227_switch_output_voltage, 360 + .cd_deglitch = NULL, 361 + .conv_clk_and_div_n = NULL, 362 + .force_power_down = rts5227_force_power_down, 363 + }; 364 + 365 + void rts522a_init_params(struct rtsx_pcr *pcr) 366 + { 367 + rts5227_init_params(pcr); 368 + 369 + pcr->reg_pm_ctrl3 = RTS522A_PM_CTRL3; 309 370 }
+1 -5
drivers/mfd/rts5229.c
··· 129 129 SD_POWER_MASK, SD_POWER_ON); 130 130 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, 131 131 LDO3318_PWR_MASK, 0x06); 132 - err = rtsx_pci_send_cmd(pcr, 100); 133 - if (err < 0) 134 - return err; 135 - 136 - return 0; 132 + return rtsx_pci_send_cmd(pcr, 100); 137 133 } 138 134 139 135 static int rts5229_card_power_off(struct rtsx_pcr *pcr, int card)
+1 -5
drivers/mfd/rts5249.c
··· 234 234 SD_POWER_MASK, SD_VCC_POWER_ON); 235 235 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PWR_GATE_CTRL, 236 236 LDO3318_PWR_MASK, 0x06); 237 - err = rtsx_pci_send_cmd(pcr, 100); 238 - if (err < 0) 239 - return err; 240 - 241 - return 0; 237 + return rtsx_pci_send_cmd(pcr, 100); 242 238 } 243 239 244 240 static int rtsx_base_card_power_off(struct rtsx_pcr *pcr, int card)
+6 -5
drivers/mfd/rtsx_pcr.c
··· 55 55 { PCI_DEVICE(0x10EC, 0x5229), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 56 56 { PCI_DEVICE(0x10EC, 0x5289), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 57 57 { PCI_DEVICE(0x10EC, 0x5227), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 58 + { PCI_DEVICE(0x10EC, 0x522A), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 58 59 { PCI_DEVICE(0x10EC, 0x5249), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 59 60 { PCI_DEVICE(0x10EC, 0x5287), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 60 61 { PCI_DEVICE(0x10EC, 0x5286), PCI_CLASS_OTHERS << 16, 0xFF0000 }, ··· 572 571 tbl++; 573 572 } 574 573 575 - err = rtsx_pci_send_cmd(pcr, 100); 576 - if (err < 0) 577 - return err; 578 - 579 - return 0; 574 + return rtsx_pci_send_cmd(pcr, 100); 580 575 } 581 576 582 577 int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card) ··· 1097 1100 1098 1101 case 0x5227: 1099 1102 rts5227_init_params(pcr); 1103 + break; 1104 + 1105 + case 0x522A: 1106 + rts522a_init_params(pcr); 1100 1107 break; 1101 1108 1102 1109 case 0x5249:
+3
drivers/mfd/rtsx_pcr.h
··· 27 27 #define MIN_DIV_N_PCR 80 28 28 #define MAX_DIV_N_PCR 208 29 29 30 + #define RTS522A_PM_CTRL3 0xFF7E 31 + 30 32 #define RTS524A_PME_FORCE_CTL 0xFF78 31 33 #define RTS524A_PM_CTRL3 0xFF7E 32 34 ··· 40 38 void rtl8411_init_params(struct rtsx_pcr *pcr); 41 39 void rtl8402_init_params(struct rtsx_pcr *pcr); 42 40 void rts5227_init_params(struct rtsx_pcr *pcr); 41 + void rts522a_init_params(struct rtsx_pcr *pcr); 43 42 void rts5249_init_params(struct rtsx_pcr *pcr); 44 43 void rts524a_init_params(struct rtsx_pcr *pcr); 45 44 void rts525a_init_params(struct rtsx_pcr *pcr);
+68 -5
drivers/mfd/sec-core.c
··· 103 103 }; 104 104 105 105 static const struct mfd_cell s2mpu02_devs[] = { 106 - { .name = "s2mpu02-pmic", }, 107 - { .name = "s2mpu02-rtc", }, 108 106 { 109 - .name = "s2mpu02-clk", 110 - .of_compatible = "samsung,s2mpu02-clk", 111 - } 107 + .name = "s2mpu02-pmic", 108 + }, 112 109 }; 113 110 114 111 #ifdef CONFIG_OF ··· 250 253 .cache_type = REGCACHE_FLAT, 251 254 }; 252 255 256 + static void sec_pmic_dump_rev(struct sec_pmic_dev *sec_pmic) 257 + { 258 + unsigned int val; 259 + 260 + /* For each device type, the REG_ID is always the first register */ 261 + if (!regmap_read(sec_pmic->regmap_pmic, S2MPS11_REG_ID, &val)) 262 + dev_dbg(sec_pmic->dev, "Revision: 0x%x\n", val); 263 + } 264 + 265 + static void sec_pmic_configure(struct sec_pmic_dev *sec_pmic) 266 + { 267 + int err; 268 + 269 + if (sec_pmic->device_type != S2MPS13X) 270 + return; 271 + 272 + if (sec_pmic->pdata->disable_wrstbi) { 273 + /* 274 + * If WRSTBI pin is pulled down this feature must be disabled 275 + * because each Suspend to RAM will trigger buck voltage reset 276 + * to default values. 277 + */ 278 + err = regmap_update_bits(sec_pmic->regmap_pmic, 279 + S2MPS13_REG_WRSTBI, 280 + S2MPS13_REG_WRSTBI_MASK, 0x0); 281 + if (err) 282 + dev_warn(sec_pmic->dev, 283 + "Cannot initialize WRSTBI config: %d\n", 284 + err); 285 + } 286 + } 287 + 253 288 #ifdef CONFIG_OF 254 289 /* 255 290 * Only the common platform data elements for s5m8767 are parsed here from the ··· 307 278 * not parsed here. 308 279 */ 309 280 281 + pd->manual_poweroff = of_property_read_bool(dev->of_node, 282 + "samsung,s2mps11-acokb-ground"); 283 + pd->disable_wrstbi = of_property_read_bool(dev->of_node, 284 + "samsung,s2mps11-wrstbi-ground"); 310 285 return pd; 311 286 } 312 287 #else ··· 456 423 goto err_mfd; 457 424 458 425 device_init_wakeup(sec_pmic->dev, sec_pmic->wakeup); 426 + sec_pmic_configure(sec_pmic); 427 + sec_pmic_dump_rev(sec_pmic); 459 428 460 429 return ret; 461 430 ··· 473 438 mfd_remove_devices(sec_pmic->dev); 474 439 sec_irq_exit(sec_pmic); 475 440 return 0; 441 + } 442 + 443 + static void sec_pmic_shutdown(struct i2c_client *i2c) 444 + { 445 + struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c); 446 + unsigned int reg, mask; 447 + 448 + if (!sec_pmic->pdata->manual_poweroff) 449 + return; 450 + 451 + switch (sec_pmic->device_type) { 452 + case S2MPS11X: 453 + reg = S2MPS11_REG_CTRL1; 454 + mask = S2MPS11_CTRL1_PWRHOLD_MASK; 455 + break; 456 + default: 457 + /* 458 + * Currently only one board with S2MPS11 needs this, so just 459 + * ignore the rest. 460 + */ 461 + dev_warn(sec_pmic->dev, 462 + "Unsupported device %lu for manual power off\n", 463 + sec_pmic->device_type); 464 + return; 465 + } 466 + 467 + regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, 0); 476 468 } 477 469 478 470 #ifdef CONFIG_PM_SLEEP ··· 553 491 }, 554 492 .probe = sec_pmic_probe, 555 493 .remove = sec_pmic_remove, 494 + .shutdown = sec_pmic_shutdown, 556 495 .id_table = sec_pmic_id, 557 496 }; 558 497
+1
drivers/mfd/sm501.c
··· 1719 1719 { .compatible = "smi,sm501", }, 1720 1720 { /* end */ } 1721 1721 }; 1722 + MODULE_DEVICE_TABLE(of, of_sm501_match_tbl); 1722 1723 1723 1724 static struct platform_driver sm501_plat_driver = { 1724 1725 .driver = {
+1
drivers/mfd/stmpe.c
··· 795 795 return 2; 796 796 797 797 case STMPE_BLOCK_KEYPAD: 798 + case STMPE_BLOCK_PWM: 798 799 return 1; 799 800 800 801 case STMPE_BLOCK_GPIO:
+43 -29
drivers/mfd/tps6105x.c
··· 64 64 } 65 65 66 66 /* 67 - * MFD cells - we have one cell which is selected operation 68 - * mode, and we always have a GPIO cell. 67 + * MFD cells - we always have a GPIO cell and we have one cell 68 + * which is selected operation mode. 69 69 */ 70 - static struct mfd_cell tps6105x_cells[] = { 71 - { 72 - /* name will be runtime assigned */ 73 - .id = -1, 74 - }, 75 - { 76 - .name = "tps6105x-gpio", 77 - .id = -1, 78 - }, 70 + static struct mfd_cell tps6105x_gpio_cell = { 71 + .name = "tps6105x-gpio", 79 72 }; 73 + 74 + static struct mfd_cell tps6105x_leds_cell = { 75 + .name = "tps6105x-leds", 76 + }; 77 + 78 + static struct mfd_cell tps6105x_flash_cell = { 79 + .name = "tps6105x-flash", 80 + }; 81 + 82 + static struct mfd_cell tps6105x_regulator_cell = { 83 + .name = "tps6105x-regulator", 84 + }; 85 + 86 + static 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 + } 80 95 81 96 static int tps6105x_probe(struct i2c_client *client, 82 97 const struct i2c_device_id *id) ··· 99 84 struct tps6105x *tps6105x; 100 85 struct tps6105x_platform_data *pdata; 101 86 int ret; 102 - int i; 87 + 88 + pdata = dev_get_platdata(&client->dev); 89 + if (!pdata) { 90 + dev_err(&client->dev, "missing platform data\n"); 91 + return -ENODEV; 92 + } 103 93 104 94 tps6105x = devm_kmalloc(&client->dev, sizeof(*tps6105x), GFP_KERNEL); 105 95 if (!tps6105x) ··· 116 96 117 97 i2c_set_clientdata(client, tps6105x); 118 98 tps6105x->client = client; 119 - pdata = dev_get_platdata(&client->dev); 120 99 tps6105x->pdata = pdata; 121 100 122 101 ret = tps6105x_startup(tps6105x); ··· 124 105 return ret; 125 106 } 126 107 127 - /* Remove warning texts when you implement new cell drivers */ 108 + ret = tps6105x_add_device(tps6105x, &tps6105x_gpio_cell); 109 + if (ret) 110 + return ret; 111 + 128 112 switch (pdata->mode) { 129 113 case TPS6105X_MODE_SHUTDOWN: 130 114 dev_info(&client->dev, 131 115 "present, not used for anything, only GPIO\n"); 132 116 break; 133 117 case TPS6105X_MODE_TORCH: 134 - tps6105x_cells[0].name = "tps6105x-leds"; 135 - dev_warn(&client->dev, 136 - "torch mode is unsupported\n"); 118 + ret = tps6105x_add_device(tps6105x, &tps6105x_leds_cell); 137 119 break; 138 120 case TPS6105X_MODE_TORCH_FLASH: 139 - tps6105x_cells[0].name = "tps6105x-flash"; 140 - dev_warn(&client->dev, 141 - "flash mode is unsupported\n"); 121 + ret = tps6105x_add_device(tps6105x, &tps6105x_flash_cell); 142 122 break; 143 123 case TPS6105X_MODE_VOLTAGE: 144 - tps6105x_cells[0].name ="tps6105x-regulator"; 124 + ret = tps6105x_add_device(tps6105x, &tps6105x_regulator_cell); 145 125 break; 146 126 default: 127 + dev_warn(&client->dev, "invalid mode: %d\n", pdata->mode); 147 128 break; 148 129 } 149 130 150 - /* Set up and register the platform devices. */ 151 - for (i = 0; i < ARRAY_SIZE(tps6105x_cells); i++) { 152 - /* One state holder for all drivers, this is simple */ 153 - tps6105x_cells[i].platform_data = tps6105x; 154 - tps6105x_cells[i].pdata_size = sizeof(*tps6105x); 155 - } 131 + if (ret) 132 + mfd_remove_devices(&client->dev); 156 133 157 - return mfd_add_devices(&client->dev, 0, tps6105x_cells, 158 - ARRAY_SIZE(tps6105x_cells), NULL, 0, NULL); 134 + return ret; 159 135 } 160 136 161 137 static int tps6105x_remove(struct i2c_client *client)
+4
drivers/mfd/tps65217.c
··· 39 39 .name = "tps65217-bl", 40 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 /**
+2
drivers/mfd/twl6040.c
··· 647 647 648 648 twl6040->clk32k = devm_clk_get(&client->dev, "clk32k"); 649 649 if (IS_ERR(twl6040->clk32k)) { 650 + if (PTR_ERR(twl6040->clk32k) == -EPROBE_DEFER) 651 + return -EPROBE_DEFER; 650 652 dev_info(&client->dev, "clk32k is not handled\n"); 651 653 twl6040->clk32k = NULL; 652 654 }
+187 -1
drivers/mfd/wm5110-tables.c
··· 250 250 }; 251 251 252 252 /* Add extra headphone write sequence locations */ 253 - static const struct reg_default wm5110_reve_patch[] = { 253 + static const struct reg_sequence wm5110_reve_patch[] = { 254 254 { 0x80, 0x3 }, 255 255 { 0x80, 0x3 }, 256 256 { 0x4b, 0x138 }, ··· 1633 1633 { 0x00000EF8, 0x0000 }, /* R3832 - ISRC 3 CTRL 3 */ 1634 1634 { 0x00000F00, 0x0000 }, /* R3840 - Clock Control */ 1635 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 1815 { 0x00001100, 0x0010 }, /* R4352 - DSP1 Control 1 */ 1637 1816 { 0x00001200, 0x0010 }, /* R4608 - DSP2 Control 1 */ 1638 1817 { 0x00001300, 0x0010 }, /* R4864 - DSP3 Control 1 */ ··· 2889 2710 case ARIZONA_CLOCK_CONTROL: 2890 2711 case ARIZONA_ANC_SRC: 2891 2712 case ARIZONA_DSP_STATUS: 2713 + case ARIZONA_ANC_COEFF_START ... ARIZONA_ANC_COEFF_END: 2714 + case ARIZONA_FCL_FILTER_CONTROL: 2715 + case ARIZONA_FCL_ADC_REFORMATTER_CONTROL: 2716 + case ARIZONA_FCL_COEFF_START ... ARIZONA_FCL_COEFF_END: 2717 + case ARIZONA_FCR_FILTER_CONTROL: 2718 + case ARIZONA_FCR_ADC_REFORMATTER_CONTROL: 2719 + case ARIZONA_FCR_COEFF_START ... ARIZONA_FCR_COEFF_END: 2892 2720 case ARIZONA_DSP1_CONTROL_1: 2893 2721 case ARIZONA_DSP1_CLOCKING_1: 2894 2722 case ARIZONA_DSP1_STATUS_1:
+3 -1
drivers/mfd/wm831x-core.c
··· 1626 1626 mutex_init(&wm831x->io_lock); 1627 1627 mutex_init(&wm831x->key_lock); 1628 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 1633 ret = wm831x_reg_read(wm831x, WM831X_PARENT_ID); 1632 1634 if (ret < 0) {
+1 -9
drivers/mfd/wm8998-tables.c
··· 21 21 #define WM8998_NUM_AOD_ISR 2 22 22 #define WM8998_NUM_ISR 5 23 23 24 - static const struct reg_default wm8998_rev_a_patch[] = { 24 + static const struct reg_sequence wm8998_rev_a_patch[] = { 25 25 { 0x0212, 0x0000 }, 26 26 { 0x0211, 0x0014 }, 27 27 { 0x04E4, 0x0E0D }, ··· 199 199 { 0x00000069, 0x01FF }, /* R105 - Always On Triggers Sequence Select 4 */ 200 200 { 0x0000006A, 0x01FF }, /* R106 - Always On Triggers Sequence Select 5 */ 201 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 202 { 0x00000090, 0x0000 }, /* R144 - Haptics Control 1 */ 205 203 { 0x00000091, 0x7FFF }, /* R145 - Haptics Control 2 */ 206 204 { 0x00000092, 0x0000 }, /* R146 - Haptics phase 1 intensity */ ··· 268 270 { 0x0000021A, 0x01A6 }, /* R538 - Mic Bias Ctrl 3 */ 269 271 { 0x00000293, 0x0080 }, /* R659 - Accessory Detect Mode 1 */ 270 272 { 0x0000029B, 0x0000 }, /* R667 - Headphone Detect 1 */ 271 - { 0x0000029C, 0x0000 }, /* R668 - Headphone Detect 2 */ 272 273 { 0x000002A2, 0x0000 }, /* R674 - Micd Clamp control */ 273 274 { 0x000002A3, 0x1102 }, /* R675 - Mic Detect 1 */ 274 275 { 0x000002A4, 0x009F }, /* R676 - Mic Detect 2 */ 275 - { 0x000002A5, 0x0000 }, /* R677 - Mic Detect 3 */ 276 276 { 0x000002A6, 0x3737 }, /* R678 - Mic Detect Level 1 */ 277 277 { 0x000002A7, 0x2C37 }, /* R679 - Mic Detect Level 2 */ 278 278 { 0x000002A8, 0x1422 }, /* R680 - Mic Detect Level 3 */ 279 279 { 0x000002A9, 0x030A }, /* R681 - Mic Detect Level 4 */ 280 - { 0x000002AB, 0x0000 }, /* R683 - Mic Detect 4 */ 281 280 { 0x000002CB, 0x0000 }, /* R715 - Isolation control */ 282 281 { 0x000002D3, 0x0000 }, /* R723 - Jack detect analogue */ 283 282 { 0x00000300, 0x0000 }, /* R768 - Input Enables */ ··· 702 707 { 0x00000D1A, 0xFFFF }, /* R3354 - IRQ2 Status 3 Mask */ 703 708 { 0x00000D1B, 0xFFFF }, /* R3355 - IRQ2 Status 4 Mask */ 704 709 { 0x00000D1C, 0xFEFF }, /* R3356 - IRQ2 Status 5 Mask */ 705 - { 0x00000D1D, 0xFFFF }, /* R3357 - IRQ2 Status 6 Mask */ 706 710 { 0x00000D1F, 0x0000 }, /* R3359 - IRQ2 Control */ 707 711 { 0x00000D53, 0xFFFF }, /* R3411 - AOD IRQ Mask IRQ1 */ 708 712 { 0x00000D54, 0xFFFF }, /* R3412 - AOD IRQ Mask IRQ2 */ 709 713 { 0x00000D56, 0x0000 }, /* R3414 - Jack detect debounce */ 710 714 { 0x00000E00, 0x0000 }, /* R3584 - FX_Ctrl1 */ 711 - { 0x00000E01, 0x0000 }, /* R3585 - FX_Ctrl2 */ 712 715 { 0x00000E10, 0x6318 }, /* R3600 - EQ1_1 */ 713 716 { 0x00000E11, 0x6300 }, /* R3601 - EQ1_2 */ 714 717 { 0x00000E12, 0x0FC8 }, /* R3602 - EQ1_3 */ ··· 826 833 switch (reg) { 827 834 case ARIZONA_SOFTWARE_RESET: 828 835 case ARIZONA_DEVICE_REVISION: 829 - case ARIZONA_CTRL_IF_SPI_CFG_1: 830 836 case ARIZONA_CTRL_IF_I2C1_CFG_1: 831 837 case ARIZONA_CTRL_IF_I2C1_CFG_2: 832 838 case ARIZONA_WRITE_SEQUENCER_CTRL_0:
+19 -3
drivers/misc/eeprom/at24.c
··· 21 21 #include <linux/bitops.h> 22 22 #include <linux/jiffies.h> 23 23 #include <linux/of.h> 24 + #include <linux/acpi.h> 24 25 #include <linux/i2c.h> 25 26 #include <linux/platform_data/at24.h> 26 27 ··· 131 130 { /* END OF LIST */ } 132 131 }; 133 132 MODULE_DEVICE_TABLE(i2c, at24_ids); 133 + 134 + static const struct acpi_device_id at24_acpi_ids[] = { 135 + { "INT3499", AT24_DEVICE_MAGIC(8192 / 8, 0) }, 136 + { } 137 + }; 138 + MODULE_DEVICE_TABLE(acpi, at24_acpi_ids); 134 139 135 140 /*-------------------------------------------------------------------------*/ 136 141 ··· 474 467 static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) 475 468 { 476 469 struct at24_platform_data chip; 470 + kernel_ulong_t magic = 0; 477 471 bool writable; 478 472 int use_smbus = 0; 479 473 int use_smbus_write = 0; 480 474 struct at24_data *at24; 481 475 int err; 482 476 unsigned i, num_addresses; 483 - kernel_ulong_t magic; 484 477 485 478 if (client->dev.platform_data) { 486 479 chip = *(struct at24_platform_data *)client->dev.platform_data; 487 480 } else { 488 - if (!id->driver_data) 481 + if (id) { 482 + magic = id->driver_data; 483 + } else { 484 + const struct acpi_device_id *aid; 485 + 486 + aid = acpi_match_device(at24_acpi_ids, &client->dev); 487 + if (aid) 488 + magic = aid->driver_data; 489 + } 490 + if (!magic) 489 491 return -ENODEV; 490 492 491 - magic = id->driver_data; 492 493 chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); 493 494 magic >>= AT24_SIZE_BYTELEN; 494 495 chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); ··· 676 661 static struct i2c_driver at24_driver = { 677 662 .driver = { 678 663 .name = "at24", 664 + .acpi_match_table = ACPI_PTR(at24_acpi_ids), 679 665 }, 680 666 .probe = at24_probe, 681 667 .remove = at24_remove,
+1
drivers/platform/x86/Kconfig
··· 932 932 933 933 config INTEL_PMC_IPC 934 934 tristate "Intel PMC IPC Driver" 935 + depends on ACPI 935 936 ---help--- 936 937 This driver provides support for PMC control on some Intel platforms. 937 938 The PMC is an ARC processor which defines IPC commands for communication
+10
drivers/power/Kconfig
··· 203 203 This driver can also be built as a module. If so, the module will be 204 204 called da9150-charger. 205 205 206 + config 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 + 206 216 config AXP288_CHARGER 207 217 tristate "X-Powers AXP288 Charger" 208 218 depends on MFD_AXP20X && EXTCON_AXP288
+1
drivers/power/Makefile
··· 34 34 obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o 35 35 obj-$(CONFIG_BATTERY_DA9052) += da9052-battery.o 36 36 obj-$(CONFIG_CHARGER_DA9150) += da9150-charger.o 37 + obj-$(CONFIG_BATTERY_DA9150) += da9150-fg.o 37 38 obj-$(CONFIG_BATTERY_MAX17040) += max17040_battery.o 38 39 obj-$(CONFIG_BATTERY_MAX17042) += max17042_battery.o 39 40 obj-$(CONFIG_BATTERY_Z2) += z2_battery.o
+579
drivers/power/da9150-fg.c
··· 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 */ 76 + struct 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 */ 92 + static 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 + 110 + static 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 */ 129 + static 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 + */ 161 + static 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 */ 167 + static 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 */ 179 + static 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 */ 227 + static 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 + 239 + static 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 + 264 + static 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 + 279 + static 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 + */ 294 + static 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 + 305 + static 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 + 313 + static 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 */ 345 + static 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 + 358 + static 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 */ 370 + static 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 + 402 + static 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 + 422 + static 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 + 441 + static 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 + 449 + static 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 + 535 + irq_fail: 536 + if (fg->interval) 537 + cancel_delayed_work(&fg->work); 538 + 539 + return ret; 540 + } 541 + 542 + static 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 + 552 + static 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 + 566 + static 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 + 575 + module_platform_driver(da9150_fg_driver); 576 + 577 + MODULE_DESCRIPTION("Fuel-Gauge Driver for DA9150"); 578 + MODULE_AUTHOR("Adam Thomson <Adam.Thomson.Opensource@diasemi.com>"); 579 + MODULE_LICENSE("GPL");
+26
include/dt-bindings/mfd/atmel-flexcom.h
··· 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__ */
+1
include/linux/mfd/88pm80x.h
··· 21 21 CHIP_INVALID = 0, 22 22 CHIP_PM800, 23 23 CHIP_PM805, 24 + CHIP_PM860, 24 25 CHIP_MAX, 25 26 }; 26 27
+70
include/linux/mfd/arizona/registers.h
··· 1065 1065 #define ARIZONA_CLOCK_CONTROL 0xF00 1066 1066 #define ARIZONA_ANC_SRC 0xF01 1067 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 1078 #define ARIZONA_DSP1_CONTROL_1 0x1100 1069 1079 #define ARIZONA_DSP1_CLOCKING_1 0x1101 1070 1080 #define ARIZONA_DSP1_STATUS_1 0x1104 ··· 8059 8049 #define ARIZONA_ISRC3_NOTCH_ENA_MASK 0x0001 /* ISRC3_NOTCH_ENA */ 8060 8050 #define ARIZONA_ISRC3_NOTCH_ENA_SHIFT 0 /* ISRC3_NOTCH_ENA */ 8061 8051 #define ARIZONA_ISRC3_NOTCH_ENA_WIDTH 1 /* ISRC3_NOTCH_ENA */ 8052 + 8053 + /* 8054 + * R3840 (0xF00) - Clock Control 8055 + */ 8056 + #define ARIZONA_EXT_NG_SEL_CLR 0x0080 /* EXT_NG_SEL_CLR */ 8057 + #define ARIZONA_EXT_NG_SEL_CLR_MASK 0x0080 /* EXT_NG_SEL_CLR */ 8058 + #define ARIZONA_EXT_NG_SEL_CLR_SHIFT 7 /* EXT_NG_SEL_CLR */ 8059 + #define ARIZONA_EXT_NG_SEL_CLR_WIDTH 1 /* EXT_NG_SEL_CLR */ 8060 + #define ARIZONA_EXT_NG_SEL_SET 0x0040 /* EXT_NG_SEL_SET */ 8061 + #define ARIZONA_EXT_NG_SEL_SET_MASK 0x0040 /* EXT_NG_SEL_SET */ 8062 + #define ARIZONA_EXT_NG_SEL_SET_SHIFT 6 /* EXT_NG_SEL_SET */ 8063 + #define ARIZONA_EXT_NG_SEL_SET_WIDTH 1 /* EXT_NG_SEL_SET */ 8064 + #define ARIZONA_CLK_R_ENA_CLR 0x0020 /* CLK_R_ENA_CLR */ 8065 + #define ARIZONA_CLK_R_ENA_CLR_MASK 0x0020 /* CLK_R_ENA_CLR */ 8066 + #define ARIZONA_CLK_R_ENA_CLR_SHIFT 5 /* CLK_R_ENA_CLR */ 8067 + #define ARIZONA_CLK_R_ENA_CLR_WIDTH 1 /* CLK_R_ENA_CLR */ 8068 + #define ARIZONA_CLK_R_ENA_SET 0x0010 /* CLK_R_ENA_SET */ 8069 + #define ARIZONA_CLK_R_ENA_SET_MASK 0x0010 /* CLK_R_ENA_SET */ 8070 + #define ARIZONA_CLK_R_ENA_SET_SHIFT 4 /* CLK_R_ENA_SET */ 8071 + #define ARIZONA_CLK_R_ENA_SET_WIDTH 1 /* CLK_R_ENA_SET */ 8072 + #define ARIZONA_CLK_NG_ENA_CLR 0x0008 /* CLK_NG_ENA_CLR */ 8073 + #define ARIZONA_CLK_NG_ENA_CLR_MASK 0x0008 /* CLK_NG_ENA_CLR */ 8074 + #define ARIZONA_CLK_NG_ENA_CLR_SHIFT 3 /* CLK_NG_ENA_CLR */ 8075 + #define ARIZONA_CLK_NG_ENA_CLR_WIDTH 1 /* CLK_NG_ENA_CLR */ 8076 + #define ARIZONA_CLK_NG_ENA_SET 0x0004 /* CLK_NG_ENA_SET */ 8077 + #define ARIZONA_CLK_NG_ENA_SET_MASK 0x0004 /* CLK_NG_ENA_SET */ 8078 + #define ARIZONA_CLK_NG_ENA_SET_SHIFT 2 /* CLK_NG_ENA_SET */ 8079 + #define ARIZONA_CLK_NG_ENA_SET_WIDTH 1 /* CLK_NG_ENA_SET */ 8080 + #define ARIZONA_CLK_L_ENA_CLR 0x0002 /* CLK_L_ENA_CLR */ 8081 + #define ARIZONA_CLK_L_ENA_CLR_MASK 0x0002 /* CLK_L_ENA_CLR */ 8082 + #define ARIZONA_CLK_L_ENA_CLR_SHIFT 1 /* CLK_L_ENA_CLR */ 8083 + #define ARIZONA_CLK_L_ENA_CLR_WIDTH 1 /* CLK_L_ENA_CLR */ 8084 + #define ARIZONA_CLK_L_ENA_SET 0x0001 /* CLK_L_ENA_SET */ 8085 + #define ARIZONA_CLK_L_ENA_SET_MASK 0x0001 /* CLK_L_ENA_SET */ 8086 + #define ARIZONA_CLK_L_ENA_SET_SHIFT 0 /* CLK_L_ENA_SET */ 8087 + #define ARIZONA_CLK_L_ENA_SET_WIDTH 1 /* CLK_L_ENA_SET */ 8088 + 8089 + /* 8090 + * R3841 (0xF01) - ANC SRC 8091 + */ 8092 + #define ARIZONA_IN_RXANCR_SEL_MASK 0x0070 /* IN_RXANCR_SEL - [4:6] */ 8093 + #define ARIZONA_IN_RXANCR_SEL_SHIFT 4 /* IN_RXANCR_SEL - [4:6] */ 8094 + #define ARIZONA_IN_RXANCR_SEL_WIDTH 3 /* IN_RXANCR_SEL - [4:6] */ 8095 + #define ARIZONA_IN_RXANCL_SEL_MASK 0x0007 /* IN_RXANCL_SEL - [0:2] */ 8096 + #define ARIZONA_IN_RXANCL_SEL_SHIFT 0 /* IN_RXANCL_SEL - [0:2] */ 8097 + #define ARIZONA_IN_RXANCL_SEL_WIDTH 3 /* IN_RXANCL_SEL - [0:2] */ 8098 + 8099 + /* 8100 + * R3863 (0xF17) - FCL ADC Reformatter Control 8101 + */ 8102 + #define ARIZONA_FCL_MIC_MODE_SEL 0x000C /* FCL_MIC_MODE_SEL - [2:3] */ 8103 + #define ARIZONA_FCL_MIC_MODE_SEL_SHIFT 2 /* FCL_MIC_MODE_SEL - [2:3] */ 8104 + #define ARIZONA_FCL_MIC_MODE_SEL_WIDTH 2 /* FCL_MIC_MODE_SEL - [2:3] */ 8105 + 8106 + /* 8107 + * R3954 (0xF72) - FCR ADC Reformatter Control 8108 + */ 8109 + #define ARIZONA_FCR_MIC_MODE_SEL 0x000C /* FCR_MIC_MODE_SEL - [2:3] */ 8110 + #define ARIZONA_FCR_MIC_MODE_SEL_SHIFT 2 /* FCR_MIC_MODE_SEL - [2:3] */ 8111 + #define ARIZONA_FCR_MIC_MODE_SEL_WIDTH 2 /* FCR_MIC_MODE_SEL - [2:3] */ 8062 8112 8063 8113 /* 8064 8114 * R4352 (0x1100) - DSP1 Control 1
+8 -2
include/linux/mfd/core.h
··· 18 18 19 19 struct irq_domain; 20 20 21 + /* Matches ACPI PNP id, either _HID or _CID, or ACPI _ADR */ 22 + struct mfd_cell_acpi_match { 23 + const char *pnpid; 24 + const unsigned long long adr; 25 + }; 26 + 21 27 /* 22 28 * This struct describes the MFD part ("cell"). 23 29 * After registration the copy of this structure will become the platform data ··· 50 44 */ 51 45 const char *of_compatible; 52 46 53 - /* Matches ACPI PNP id, either _HID or _CID */ 54 - const char *acpi_pnpid; 47 + /* Matches ACPI */ 48 + const struct mfd_cell_acpi_match *acpi_match; 55 49 56 50 /* 57 51 * These resources can be specified relative to the parent device.
+3
include/linux/mfd/da9052/reg.h
··· 65 65 #define DA9052_GPIO_2_3_REG 22 66 66 #define DA9052_GPIO_4_5_REG 23 67 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 71 #define DA9052_GPIO_14_15_REG 28 69 72 70 73 /* POWER SEQUENCER CONTROL REGISTERS */
+18 -1
include/linux/mfd/da9150/core.h
··· 15 15 #define __DA9150_CORE_H 16 16 17 17 #include <linux/device.h> 18 + #include <linux/i2c.h> 18 19 #include <linux/interrupt.h> 19 20 #include <linux/regmap.h> 20 21 ··· 47 46 #define DA9150_IRQ_GPADC 19 48 47 #define DA9150_IRQ_WKUP 20 49 48 49 + /* I2C sub-device address */ 50 + #define DA9150_QIF_I2C_ADDR_LSB 0x5 51 + 52 + struct da9150_fg_pdata { 53 + u32 update_interval; /* msecs */ 54 + u8 warn_soc_lvl; /* % value */ 55 + u8 crit_soc_lvl; /* % value */ 56 + }; 57 + 50 58 struct da9150_pdata { 51 59 int irq_base; 60 + struct da9150_fg_pdata *fg_pdata; 52 61 }; 53 62 54 63 struct da9150 { 55 64 struct device *dev; 56 65 struct regmap *regmap; 66 + struct i2c_client *core_qif; 67 + 57 68 struct regmap_irq_chip_data *regmap_irq_data; 58 69 int irq; 59 70 int irq_base; 60 71 }; 61 72 62 - /* Device I/O */ 73 + /* Device I/O - Query Interface for FG and standard register access */ 74 + void da9150_read_qif(struct da9150 *da9150, u8 addr, int count, u8 *buf); 75 + void da9150_write_qif(struct da9150 *da9150, u8 addr, int count, const u8 *buf); 76 + 63 77 u8 da9150_reg_read(struct da9150 *da9150, u16 reg); 64 78 void da9150_reg_write(struct da9150 *da9150, u16 reg, u8 val); 65 79 void da9150_set_bits(struct da9150 *da9150, u16 reg, u8 mask, u8 val); 66 80 67 81 void da9150_bulk_read(struct da9150 *da9150, u16 reg, int count, u8 *buf); 68 82 void da9150_bulk_write(struct da9150 *da9150, u16 reg, int count, const u8 *buf); 83 + 69 84 #endif /* __DA9150_CORE_H */
+69
include/linux/mfd/intel_bxtwc.h
··· 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
+2
include/linux/mfd/intel_soc_pmic.h
··· 25 25 int irq; 26 26 struct regmap *regmap; 27 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 32 #endif /* __INTEL_SOC_PMIC_H__ */
+6
include/linux/mfd/rtsx_pci.h
··· 589 589 #define FORCE_ASPM_NO_ASPM 0x00 590 590 #define PM_CLK_FORCE_CTL 0xFE58 591 591 #define FUNC_FORCE_CTL 0xFE59 592 + #define FUNC_FORCE_UPME_XMT_DBG 0x02 592 593 #define PERST_GLITCH_WIDTH 0xFE5C 593 594 #define CHANGE_LINK_STATE 0xFE5B 594 595 #define RESET_LOAD_REG 0xFE5E ··· 713 712 #define PHY_RCR1 0x02 714 713 #define PHY_RCR1_ADP_TIME_4 0x0400 715 714 #define PHY_RCR1_VCO_COARSE 0x001F 715 + #define PHY_RCR1_INIT_27S 0x0A1F 716 716 #define PHY_SSCCR2 0x02 717 717 #define PHY_SSCCR2_PLL_NCODE 0x0A00 718 718 #define PHY_SSCCR2_TIME0 0x001C ··· 726 724 #define PHY_RCR2_FREQSEL_12 0x0040 727 725 #define PHY_RCR2_CDR_SC_12P 0x0010 728 726 #define PHY_RCR2_CALIB_LATE 0x0002 727 + #define PHY_RCR2_INIT_27S 0xC152 729 728 #define PHY_SSCCR3 0x03 730 729 #define PHY_SSCCR3_STEP_IN 0x2740 731 730 #define PHY_SSCCR3_CHECK_DELAY 0x0008 ··· 803 800 #define PHY_ANA1A_RXT_BIST 0x0500 804 801 #define PHY_ANA1A_TXR_BIST 0x0040 805 802 #define PHY_ANA1A_REV 0x0006 803 + #define PHY_FLD0_INIT_27S 0x2546 806 804 #define PHY_FLD1 0x1B 807 805 #define PHY_FLD2 0x1C 808 806 #define PHY_FLD3 0x1D 809 807 #define PHY_FLD3_TIMER_4 0x0800 810 808 #define PHY_FLD3_TIMER_6 0x0020 811 809 #define PHY_FLD3_RXDELINK 0x0004 810 + #define PHY_FLD3_INIT_27S 0x0004 812 811 #define PHY_ANA1D 0x1D 813 812 #define PHY_ANA1D_DEBUG_ADDR 0x0004 814 813 #define _PHY_FLD0 0x1D ··· 829 824 #define PHY_FLD4_BER_COUNT 0x00E0 830 825 #define PHY_FLD4_BER_TIMER 0x000A 831 826 #define PHY_FLD4_BER_CHK_EN 0x0001 827 + #define PHY_FLD4_INIT_27S 0x5C7F 832 828 #define PHY_DIG1E 0x1E 833 829 #define PHY_DIG1E_REV 0x4000 834 830 #define PHY_DIG1E_D0_X_D1 0x1000
+4
include/linux/mfd/samsung/core.h
··· 132 132 int buck2_init; 133 133 int buck3_init; 134 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 /**
+1
include/linux/mfd/samsung/s2mps11.h
··· 179 179 #define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1) 180 180 #define S2MPS11_RAMP_DELAY 25000 /* uV/us */ 181 181 182 + #define S2MPS11_CTRL1_PWRHOLD_MASK BIT(4) 182 183 183 184 #define S2MPS11_BUCK2_RAMP_SHIFT 6 184 185 #define S2MPS11_BUCK34_RAMP_SHIFT 4
+1
include/linux/mfd/samsung/s2mps13.h
··· 184 184 * Let's assume that default value will be set. 185 185 */ 186 186 #define S2MPS13_BUCK_RAMP_DELAY 12500 187 + #define S2MPS13_REG_WRSTBI_MASK BIT(5) 187 188 188 189 #endif /* __LINUX_MFD_S2MPS13_H */