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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'mfd-next-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
"New Drivers:
- Add support for Ampere Computing SMpro
- Add support for TI TPS65219 PMIC

New Functionality:
- Add support for multiple devices of the same type; rk808

Fix-ups:
- Convert a bunch of I2C class drivers over to .probe_new()
- Remove superfluous includes; mc13xxx-*, palmas, timberdale
- Use correct includes for GPIO handling; madera-core
- Convert to GPIOD; twl6040
- Remove unused platform data handling; twl6040
- Device Tree changes; many
- Remove unused drivers; dm355evm_msp, davinci_voicecodec, htc-i2cpld
- Add support for modules; palmas
- Enable COMPILE_TEST support; intel_soc_pmic*
- Trivial: spelling / whitespace fixes; mc13xxx-spi
- Replace old PM helpers with new ones; many
- Convert deprecated mask_invert usage to unmask_base; many
- Use devm_*() calls; qcom_rpm
- MAINTAINER fix-ups
- Make use of improved / replaced APIs; palmas, fsl-imx25-tsadc,
stm32-lptimer, qcom_rpm, rohm-*

Bug Fixes:
- Add bounds / error checking; mt6360-core
- No sleeping inside critical sections; axp20x
- Fix missing dependencies; ROHM_BD957XMUF
- Repair error paths; qcom-pm8008"

* tag 'mfd-next-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (161 commits)
dt-bindings: mfd: da9062: Correct file name for watchdog
mfd: pm8008: Fix return value check in pm8008_probe()
mfd: rohm: Use dev_err_probe()
mfd: Drop obsolete dependencies on COMPILE_TEST
dt-bindings: mfd: da9062: Move IRQ to optional properties
mfd: qcom_rpm: Use devm_of_platform_populate() to simplify code
mfd: qcom_rpm: Fix an error handling path in qcom_rpm_probe()
mfd: stm32-lptimer: Use devm_platform_get_and_ioremap_resource()
mfd: rohm-bd9576: Convert to i2c's .probe_new()
mfd: fsl-imx25-tsadc: Use devm_platform_get_and_ioremap_resource()
dt-bindings: Fix maintainer email for a few ROHM ICs
mfd: palmas: Use device_get_match_data() to simplify the code
Input: Add tps65219 interrupt driven powerbutton
mfd: tps65219: Add driver for TI TPS65219 PMIC
mfd: bd957x: Fix Kconfig dependency on REGMAP_IRQ
mfd: wcd934x: Convert irq chip to config regs
mfd: tps65090: Replace irqchip mask_invert with unmask_base
mfd: sun4i-gpadc: Replace irqchip mask_invert with unmask_base
mfd: stpmic1: Fix swapped mask/unmask in irq chip
mfd: sprd-sc27xx-spi: Replace irqchip mask_invert with unmask_base
...

+1506 -2366
+1 -1
Documentation/devicetree/bindings/leds/rohm,bd71828-leds.yaml
··· 7 7 title: ROHM BD71828 Power Management Integrated Circuit LED driver 8 8 9 9 maintainers: 10 - - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> 10 + - Matti Vaittinen <mazziesaccount@gmail.com> 11 11 12 12 description: | 13 13 This module is part of the ROHM BD71828 MFD device. For more details
+42
Documentation/devicetree/bindings/mfd/ampere,smpro.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/mfd/ampere,smpro.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Ampere Altra SMPro firmware driver 8 + 9 + maintainers: 10 + - Quan Nguyen <quan@os.amperecomputing.com> 11 + 12 + description: | 13 + Ampere Altra SMPro firmware may contain different blocks like hardware 14 + monitoring, error monitoring and other miscellaneous features. 15 + 16 + properties: 17 + compatible: 18 + enum: 19 + - ampere,smpro 20 + 21 + reg: 22 + description: 23 + I2C device address. 24 + maxItems: 1 25 + 26 + required: 27 + - compatible 28 + - reg 29 + 30 + additionalProperties: false 31 + 32 + examples: 33 + - | 34 + i2c { 35 + #address-cells = <1>; 36 + #size-cells = <0>; 37 + 38 + smpro@4f { 39 + compatible = "ampere,smpro"; 40 + reg = <0x4f>; 41 + }; 42 + };
+8
Documentation/devicetree/bindings/mfd/brcm,twd.yaml
··· 36 36 const: 1 37 37 38 38 patternProperties: 39 + '^timer@[a-f0-9]+$': 40 + $ref: /schemas/timer/brcm,bcmbca-timer.yaml 41 + 39 42 '^watchdog@[a-f0-9]+$': 40 43 $ref: /schemas/watchdog/brcm,bcm7038-wdt.yaml 41 44 ··· 56 53 57 54 #address-cells = <1>; 58 55 #size-cells = <1>; 56 + 57 + timer@0 { 58 + compatible = "brcm,bcm63138-timer"; 59 + reg = <0x0 0x28>; 60 + }; 59 61 60 62 watchdog@28 { 61 63 compatible = "brcm,bcm7038-wdt";
+7 -6
Documentation/devicetree/bindings/mfd/da9062.txt
··· 33 33 "dlg,da9061" for DA9061 34 34 - reg : Specifies the I2C slave address (this defaults to 0x58 but it can be 35 35 modified to match the chip's OTP settings). 36 - - interrupts : IRQ line information. 37 - - interrupt-controller 38 - 39 - See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt for 40 - further information on IRQ bindings. 41 36 42 37 Optional properties: 43 38 ··· 42 47 43 48 See Documentation/devicetree/bindings/gpio/gpio.txt for further information on 44 49 GPIO bindings. 50 + 51 + - interrupts : IRQ line information. 52 + - interrupt-controller 53 + 54 + See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt for 55 + further information on IRQ bindings. 45 56 46 57 Sub-nodes: 47 58 ··· 86 85 87 86 - onkey : See ../input/da9062-onkey.txt 88 87 89 - - watchdog: See ../watchdog/da9062-watchdog.txt 88 + - watchdog: See ../watchdog/da9062-wdt.txt 90 89 91 90 - thermal : See ../thermal/da9062-thermal.txt 92 91
+2 -2
Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml
··· 12 12 description: | 13 13 The Ocelot ethernet switch family contains chips that have an internal CPU 14 14 (VSC7513, VSC7514) and chips that don't (VSC7511, VSC7512). All switches have 15 - the option to be controlled externally, which is the purpose of this driver. 15 + the option to be controlled externally via external interfaces like SPI or 16 + PCIe. 16 17 17 18 The switch family is a multi-port networking switch that supports many 18 19 interfaces. Additionally, the device can perform pin control, MDIO buses, and ··· 62 61 - reg 63 62 - '#address-cells' 64 63 - '#size-cells' 65 - - spi-max-frequency 66 64 67 65 additionalProperties: false 68 66
+1
Documentation/devicetree/bindings/mfd/mt6397.txt
··· 21 21 compatible: 22 22 "mediatek,mt6323" for PMIC MT6323 23 23 "mediatek,mt6331" for PMIC MT6331 and MT6332 24 + "mediatek,mt6357" for PMIC MT6357 24 25 "mediatek,mt6358" for PMIC MT6358 and MT6366 25 26 "mediatek,mt6359" for PMIC MT6359 26 27 "mediatek,mt6397" for PMIC MT6397
+23 -11
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
··· 99 99 type: object 100 100 $ref: /schemas/regulator/qcom,spmi-regulator.yaml# 101 101 102 + pwm: 103 + type: object 104 + $ref: /schemas/leds/leds-qcom-lpg.yaml# 105 + 102 106 patternProperties: 103 107 "^adc@[0-9a-f]+$": 104 108 type: object 105 - $ref: /schemas/iio/adc/qcom,spmi-vadc.yaml# 109 + oneOf: 110 + - $ref: /schemas/iio/adc/qcom,spmi-iadc.yaml# 111 + - $ref: /schemas/iio/adc/qcom,spmi-vadc.yaml# 106 112 107 113 "^adc-tm@[0-9a-f]+$": 108 114 type: object ··· 118 112 type: object 119 113 additionalProperties: true # FIXME qcom,pm8916-wcd-analog-codec binding not converted yet 120 114 121 - "extcon@[0-9a-f]+$": 115 + "^charger@[0-9a-f]+$": 122 116 type: object 123 - $ref: /schemas/extcon/qcom,pm8941-misc.yaml# 117 + oneOf: 118 + - $ref: /schemas/power/supply/qcom,pm8941-charger.yaml# 119 + - $ref: /schemas/power/supply/qcom,pm8941-coincell.yaml# 124 120 125 - "gpio(s)?@[0-9a-f]+$": 121 + "gpio@[0-9a-f]+$": 126 122 type: object 127 123 $ref: /schemas/pinctrl/qcom,pmic-gpio.yaml# 128 124 129 125 "pon@[0-9a-f]+$": 130 126 type: object 131 127 $ref: /schemas/power/reset/qcom,pon.yaml# 132 - 133 - "pwm@[0-9a-f]+$": 134 - type: object 135 - $ref: /schemas/leds/leds-qcom-lpg.yaml# 136 128 137 129 "^rtc@[0-9a-f]+$": 138 130 type: object ··· 140 136 type: object 141 137 $ref: /schemas/thermal/qcom,spmi-temp-alarm.yaml# 142 138 139 + "^usb-detect@[0-9a-f]+$": 140 + type: object 141 + $ref: /schemas/extcon/qcom,pm8941-misc.yaml# 142 + 143 + "^usb-vbus-regulator@[0-9a-f]+$": 144 + type: object 145 + $ref: /schemas/regulator/qcom,usb-vbus-regulator.yaml# 146 + 143 147 "^vibrator@[0-9a-f]+$": 144 148 type: object 145 - additionalProperties: true # FIXME qcom,pm8916-vib binding not converted yet 149 + $ref: /schemas/input/qcom,pm8xxx-vib.yaml# 146 150 147 151 "^mpps@[0-9a-f]+$": 148 152 type: object ··· 212 200 #address-cells = <1>; 213 201 #size-cells = <0>; 214 202 215 - pmi8998_gpio: gpios@c000 { 203 + pmi8998_gpio: gpio@c000 { 216 204 compatible = "qcom,pmi8998-gpio", "qcom,spmi-gpio"; 217 205 reg = <0xc000>; 218 206 gpio-controller; ··· 297 285 }; 298 286 }; 299 287 300 - pm6150_gpio: gpios@c000 { 288 + pm6150_gpio: gpio@c000 { 301 289 compatible = "qcom,pm6150-gpio", "qcom,spmi-gpio"; 302 290 reg = <0xc000>; 303 291 gpio-controller;
+2
Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml
··· 17 17 compatible: 18 18 items: 19 19 - enum: 20 + - qcom,msm8976-tcsr 20 21 - qcom,msm8998-tcsr 21 22 - qcom,qcs404-tcsr 22 23 - qcom,sc7180-tcsr 23 24 - qcom,sc7280-tcsr 25 + - qcom,sc8280xp-tcsr 24 26 - qcom,sdm630-tcsr 25 27 - qcom,sdm845-tcsr 26 28 - qcom,sm8150-tcsr
+28 -5
Documentation/devicetree/bindings/mfd/qcom-pm8xxx.yaml
··· 15 15 16 16 properties: 17 17 compatible: 18 - enum: 19 - - qcom,pm8018 20 - - qcom,pm8058 21 - - qcom,pm8821 22 - - qcom,pm8921 18 + oneOf: 19 + - enum: 20 + - qcom,pm8058 21 + - qcom,pm8821 22 + - qcom,pm8921 23 + - items: 24 + - enum: 25 + - qcom,pm8018 26 + - const: qcom,pm8921 23 27 24 28 reg: 25 29 maxItems: 1 ··· 60 56 - interrupt-controller 61 57 62 58 additionalProperties: false 59 + 60 + examples: 61 + - | 62 + #include <dt-bindings/interrupt-controller/irq.h> 63 + ssbi { 64 + #address-cells = <1>; 65 + #size-cells = <0>; 66 + pmic@0 { 67 + compatible = "qcom,pm8921"; 68 + reg = <0>; 69 + #address-cells = <1>; 70 + #size-cells = <0>; 71 + interrupt-controller; 72 + #interrupt-cells = <2>; 73 + 74 + interrupt-parent = <&tlmm>; 75 + interrupts = <32 IRQ_TYPE_EDGE_RISING>; 76 + }; 77 + }; 63 78 ...
+1 -1
Documentation/devicetree/bindings/mfd/rohm,bd71815-pmic.yaml
··· 7 7 title: ROHM BD71815 Power Management Integrated Circuit 8 8 9 9 maintainers: 10 - - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> 10 + - Matti Vaittinen <mazziesaccount@gmail.com> 11 11 12 12 description: | 13 13 BD71815AGW is a single-chip power management ICs for battery-powered
+1 -1
Documentation/devicetree/bindings/mfd/rohm,bd71828-pmic.yaml
··· 7 7 title: ROHM BD71828 Power Management Integrated Circuit 8 8 9 9 maintainers: 10 - - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> 10 + - Matti Vaittinen <mazziesaccount@gmail.com> 11 11 12 12 description: | 13 13 BD71828GW is a single-chip power management IC for battery-powered portable
+1 -1
Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.yaml
··· 7 7 title: ROHM BD71837 Power Management Integrated Circuit 8 8 9 9 maintainers: 10 - - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> 10 + - Matti Vaittinen <mazziesaccount@gmail.com> 11 11 12 12 description: | 13 13 BD71837MWV is programmable Power Management ICs for powering single-core,
+1 -1
Documentation/devicetree/bindings/mfd/rohm,bd71847-pmic.yaml
··· 7 7 title: ROHM BD71847 and BD71850 Power Management Integrated Circuit 8 8 9 9 maintainers: 10 - - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> 10 + - Matti Vaittinen <mazziesaccount@gmail.com> 11 11 12 12 description: | 13 13 BD71847AMWV and BD71850MWV are programmable Power Management ICs for powering
+1 -1
Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml
··· 7 7 title: ROHM BD9576MUF and BD9573MUF Power Management Integrated Circuit 8 8 9 9 maintainers: 10 - - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> 10 + - Matti Vaittinen <mazziesaccount@gmail.com> 11 11 12 12 description: | 13 13 BD9576MUF and BD9573MUF are power management ICs primarily intended for
+1
Documentation/devicetree/bindings/mfd/syscon.yaml
··· 53 53 - microchip,lan966x-cpu-syscon 54 54 - microchip,sparx5-cpu-syscon 55 55 - mstar,msc313-pmsleep 56 + - nuvoton,wpcm450-shm 56 57 - rockchip,px30-qos 57 58 - rockchip,rk3036-qos 58 59 - rockchip,rk3066-qos
+3
Documentation/devicetree/bindings/mfd/ti,am3359-tscadc.yaml
··· 52 52 type: object 53 53 description: Magnetic reader 54 54 55 + power-domains: 56 + maxItems: 1 57 + 55 58 required: 56 59 - compatible 57 60 - reg
+2
Documentation/devicetree/bindings/mfd/ti,j721e-system-controller.yaml
··· 26 26 compatible: 27 27 items: 28 28 - enum: 29 + - ti,j7200-system-controller 29 30 - ti,j721e-system-controller 31 + - ti,j721s2-system-controller 30 32 - const: syscon 31 33 - const: simple-mfd 32 34
+1 -1
Documentation/devicetree/bindings/power/supply/rohm,bd99954.yaml
··· 7 7 title: ROHM BD99954 Battery charger 8 8 9 9 maintainers: 10 - - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> 10 + - Matti Vaittinen <mazziesaccount@gmail.com> 11 11 - Markus Laine <markus.laine@fi.rohmeurope.com> 12 12 - Mikko Mutanen <mikko.mutanen@fi.rohmeurope.com> 13 13
+1 -1
Documentation/devicetree/bindings/regulator/rohm,bd71815-regulator.yaml
··· 7 7 title: ROHM BD71815 Power Management Integrated Circuit regulators 8 8 9 9 maintainers: 10 - - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> 10 + - Matti Vaittinen <mazziesaccount@gmail.com> 11 11 12 12 description: | 13 13 This module is part of the ROHM BD718215 MFD device. For more details
+1 -1
Documentation/devicetree/bindings/regulator/rohm,bd71828-regulator.yaml
··· 7 7 title: ROHM BD71828 Power Management Integrated Circuit regulators 8 8 9 9 maintainers: 10 - - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> 10 + - Matti Vaittinen <mazziesaccount@gmail.com> 11 11 12 12 description: | 13 13 This module is part of the ROHM BD71828 MFD device. For more details
+1 -1
Documentation/devicetree/bindings/regulator/rohm,bd71837-regulator.yaml
··· 7 7 title: ROHM BD71837 Power Management Integrated Circuit regulators 8 8 9 9 maintainers: 10 - - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> 10 + - Matti Vaittinen <mazziesaccount@gmail.com> 11 11 12 12 description: | 13 13 List of regulators provided by this controller. BD71837 regulators node
+1 -1
Documentation/devicetree/bindings/regulator/rohm,bd71847-regulator.yaml
··· 7 7 title: ROHM BD71847 and BD71850 Power Management Integrated Circuit regulators 8 8 9 9 maintainers: 10 - - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> 10 + - Matti Vaittinen <mazziesaccount@gmail.com> 11 11 12 12 description: | 13 13 List of regulators provided by this controller. BD71847 regulators node
+1 -1
Documentation/devicetree/bindings/regulator/rohm,bd9576-regulator.yaml
··· 7 7 title: ROHM BD9576 and BD9573 Power Management Integrated Circuit regulators 8 8 9 9 maintainers: 10 - - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> 10 + - Matti Vaittinen <mazziesaccount@gmail.com> 11 11 12 12 description: | 13 13 This module is part of the ROHM BD9576 MFD device. For more details
+40
Documentation/devicetree/bindings/timer/brcm,bcmbca-timer.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/timer/brcm,bcmbca-timer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Broadcom Broadband SoC timer 8 + 9 + maintainers: 10 + - Rafał Miłecki <rafal@milecki.pl> 11 + 12 + properties: 13 + compatible: 14 + oneOf: 15 + - const: brcm,bcm6345-timer 16 + description: > 17 + An old block with 3 timers. 18 + 19 + It can be found in BCM6345, BCM6838 and BCM63268. 20 + - const: brcm,bcm63138-timer 21 + description: > 22 + Updated block with 4 timers and control regs at the beginning. 23 + 24 + It can be found in newer SoCs, e.g. BCM63138, BCM63148, BCM63381, 25 + BCM68360, BCM6848, BCM6858, BCM4908. 26 + 27 + reg: 28 + maxItems: 1 29 + 30 + additionalProperties: false 31 + 32 + required: 33 + - reg 34 + 35 + examples: 36 + - | 37 + timer@fffe0200 { 38 + compatible = "brcm,bcm6345-timer"; 39 + reg = <0xfffe0200 0x1c>; 40 + };
+1
MAINTAINERS
··· 15336 15336 F: drivers/mfd/palmas.c 15337 15337 F: drivers/mfd/tps65217.c 15338 15338 F: drivers/mfd/tps65218.c 15339 + F: drivers/mfd/tps65219.c 15339 15340 F: drivers/mfd/tps65910.c 15340 15341 F: drivers/mfd/twl-core.[ch] 15341 15342 F: drivers/mfd/twl4030*.c
+10 -11
drivers/input/misc/Kconfig
··· 468 468 To compile this driver as a module, choose M here. The module will 469 469 be called tps65218-pwrbutton. 470 470 471 + config INPUT_TPS65219_PWRBUTTON 472 + tristate "TPS65219 Power button driver" 473 + depends on MFD_TPS65219 474 + help 475 + Say Y here if you want to enable power button reporting for 476 + TPS65219 Power Management IC devices. 477 + 478 + To compile this driver as a module, choose M here. The module will 479 + be called tps65219-pwrbutton. 480 + 471 481 config INPUT_AXP20X_PEK 472 482 tristate "X-Powers AXP20X power button driver" 473 483 depends on MFD_AXP20X ··· 671 661 672 662 To compile this driver as a module, choose M here: the module 673 663 will be called da9063_onkey. 674 - 675 - config INPUT_DM355EVM 676 - tristate "TI DaVinci DM355 EVM Keypad and IR Remote" 677 - depends on MFD_DM355EVM_MSP 678 - select INPUT_SPARSEKMAP 679 - help 680 - Supports the pushbuttons and IR remote used with 681 - the DM355 EVM board. 682 - 683 - To compile this driver as a module, choose M here: the 684 - module will be called dm355evm_keys. 685 664 686 665 config INPUT_WM831X_ON 687 666 tristate "WM831X ON pin"
+1 -1
drivers/input/misc/Makefile
··· 31 31 obj-$(CONFIG_INPUT_DA9052_ONKEY) += da9052_onkey.o 32 32 obj-$(CONFIG_INPUT_DA9055_ONKEY) += da9055_onkey.o 33 33 obj-$(CONFIG_INPUT_DA9063_ONKEY) += da9063_onkey.o 34 - obj-$(CONFIG_INPUT_DM355EVM) += dm355evm_keys.o 35 34 obj-$(CONFIG_INPUT_E3X0_BUTTON) += e3x0-button.o 36 35 obj-$(CONFIG_INPUT_DRV260X_HAPTICS) += drv260x.o 37 36 obj-$(CONFIG_INPUT_DRV2665_HAPTICS) += drv2665.o ··· 79 80 obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o 80 81 obj-$(CONFIG_INPUT_STPMIC1_ONKEY) += stpmic1_onkey.o 81 82 obj-$(CONFIG_INPUT_TPS65218_PWRBUTTON) += tps65218-pwrbutton.o 83 + obj-$(CONFIG_INPUT_TPS65219_PWRBUTTON) += tps65219-pwrbutton.o 82 84 obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON) += twl4030-pwrbutton.o 83 85 obj-$(CONFIG_INPUT_TWL4030_VIBRA) += twl4030-vibra.o 84 86 obj-$(CONFIG_INPUT_TWL6040_VIBRA) += twl6040-vibra.o
-238
drivers/input/misc/dm355evm_keys.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * dm355evm_keys.c - support buttons and IR remote on DM355 EVM board 4 - * 5 - * Copyright (c) 2008 by David Brownell 6 - */ 7 - #include <linux/kernel.h> 8 - #include <linux/slab.h> 9 - #include <linux/input.h> 10 - #include <linux/input/sparse-keymap.h> 11 - #include <linux/platform_device.h> 12 - #include <linux/interrupt.h> 13 - 14 - #include <linux/mfd/dm355evm_msp.h> 15 - #include <linux/module.h> 16 - 17 - 18 - /* 19 - * The MSP430 firmware on the DM355 EVM monitors on-board pushbuttons 20 - * and an IR receptor used for the remote control. When any key is 21 - * pressed, or its autorepeat kicks in, an event is sent. This driver 22 - * read those events from the small (32 event) queue and reports them. 23 - * 24 - * Note that physically there can only be one of these devices. 25 - * 26 - * This driver was tested with firmware revision A4. 27 - */ 28 - struct dm355evm_keys { 29 - struct input_dev *input; 30 - struct device *dev; 31 - }; 32 - 33 - /* These initial keycodes can be remapped */ 34 - static const struct key_entry dm355evm_keys[] = { 35 - /* 36 - * Pushbuttons on the EVM board ... note that the labels for these 37 - * are SW10/SW11/etc on the PC board. The left/right orientation 38 - * comes only from the firmware's documentation, and presumes the 39 - * power connector is immediately in front of you and the IR sensor 40 - * is to the right. (That is, rotate the board counter-clockwise 41 - * by 90 degrees from the SW10/etc and "DM355 EVM" labels.) 42 - */ 43 - { KE_KEY, 0x00d8, { KEY_OK } }, /* SW12 */ 44 - { KE_KEY, 0x00b8, { KEY_UP } }, /* SW13 */ 45 - { KE_KEY, 0x00e8, { KEY_DOWN } }, /* SW11 */ 46 - { KE_KEY, 0x0078, { KEY_LEFT } }, /* SW14 */ 47 - { KE_KEY, 0x00f0, { KEY_RIGHT } }, /* SW10 */ 48 - 49 - /* 50 - * IR buttons ... codes assigned to match the universal remote 51 - * provided with the EVM (Philips PM4S) using DVD code 0020. 52 - * 53 - * These event codes match firmware documentation, but other 54 - * remote controls could easily send more RC5-encoded events. 55 - * The PM4S manual was used in several cases to help select 56 - * a keycode reflecting the intended usage. 57 - * 58 - * RC5 codes are 14 bits, with two start bits (0x3 prefix) 59 - * and a toggle bit (masked out below). 60 - */ 61 - { KE_KEY, 0x300c, { KEY_POWER } }, /* NOTE: docs omit this */ 62 - { KE_KEY, 0x3000, { KEY_NUMERIC_0 } }, 63 - { KE_KEY, 0x3001, { KEY_NUMERIC_1 } }, 64 - { KE_KEY, 0x3002, { KEY_NUMERIC_2 } }, 65 - { KE_KEY, 0x3003, { KEY_NUMERIC_3 } }, 66 - { KE_KEY, 0x3004, { KEY_NUMERIC_4 } }, 67 - { KE_KEY, 0x3005, { KEY_NUMERIC_5 } }, 68 - { KE_KEY, 0x3006, { KEY_NUMERIC_6 } }, 69 - { KE_KEY, 0x3007, { KEY_NUMERIC_7 } }, 70 - { KE_KEY, 0x3008, { KEY_NUMERIC_8 } }, 71 - { KE_KEY, 0x3009, { KEY_NUMERIC_9 } }, 72 - { KE_KEY, 0x3022, { KEY_ENTER } }, 73 - { KE_KEY, 0x30ec, { KEY_MODE } }, /* "tv/vcr/..." */ 74 - { KE_KEY, 0x300f, { KEY_SELECT } }, /* "info" */ 75 - { KE_KEY, 0x3020, { KEY_CHANNELUP } }, /* "up" */ 76 - { KE_KEY, 0x302e, { KEY_MENU } }, /* "in/out" */ 77 - { KE_KEY, 0x3011, { KEY_VOLUMEDOWN } }, /* "left" */ 78 - { KE_KEY, 0x300d, { KEY_MUTE } }, /* "ok" */ 79 - { KE_KEY, 0x3010, { KEY_VOLUMEUP } }, /* "right" */ 80 - { KE_KEY, 0x301e, { KEY_SUBTITLE } }, /* "cc" */ 81 - { KE_KEY, 0x3021, { KEY_CHANNELDOWN } },/* "down" */ 82 - { KE_KEY, 0x3022, { KEY_PREVIOUS } }, 83 - { KE_KEY, 0x3026, { KEY_SLEEP } }, 84 - { KE_KEY, 0x3172, { KEY_REWIND } }, /* NOTE: docs wrongly say 0x30ca */ 85 - { KE_KEY, 0x3175, { KEY_PLAY } }, 86 - { KE_KEY, 0x3174, { KEY_FASTFORWARD } }, 87 - { KE_KEY, 0x3177, { KEY_RECORD } }, 88 - { KE_KEY, 0x3176, { KEY_STOP } }, 89 - { KE_KEY, 0x3169, { KEY_PAUSE } }, 90 - }; 91 - 92 - /* 93 - * Because we communicate with the MSP430 using I2C, and all I2C calls 94 - * in Linux sleep, we use a threaded IRQ handler. The IRQ itself is 95 - * active low, but we go through the GPIO controller so we can trigger 96 - * on falling edges and not worry about enabling/disabling the IRQ in 97 - * the keypress handling path. 98 - */ 99 - static irqreturn_t dm355evm_keys_irq(int irq, void *_keys) 100 - { 101 - static u16 last_event; 102 - struct dm355evm_keys *keys = _keys; 103 - const struct key_entry *ke; 104 - unsigned int keycode; 105 - int status; 106 - u16 event; 107 - 108 - /* For simplicity we ignore INPUT_COUNT and just read 109 - * events until we get the "queue empty" indicator. 110 - * Reading INPUT_LOW decrements the count. 111 - */ 112 - for (;;) { 113 - status = dm355evm_msp_read(DM355EVM_MSP_INPUT_HIGH); 114 - if (status < 0) { 115 - dev_dbg(keys->dev, "input high err %d\n", 116 - status); 117 - break; 118 - } 119 - event = status << 8; 120 - 121 - status = dm355evm_msp_read(DM355EVM_MSP_INPUT_LOW); 122 - if (status < 0) { 123 - dev_dbg(keys->dev, "input low err %d\n", 124 - status); 125 - break; 126 - } 127 - event |= status; 128 - if (event == 0xdead) 129 - break; 130 - 131 - /* Press and release a button: two events, same code. 132 - * Press and hold (autorepeat), then release: N events 133 - * (N > 2), same code. For RC5 buttons the toggle bits 134 - * distinguish (for example) "1-autorepeat" from "1 1"; 135 - * but PCB buttons don't support that bit. 136 - * 137 - * So we must synthesize release events. We do that by 138 - * mapping events to a press/release event pair; then 139 - * to avoid adding extra events, skip the second event 140 - * of each pair. 141 - */ 142 - if (event == last_event) { 143 - last_event = 0; 144 - continue; 145 - } 146 - last_event = event; 147 - 148 - /* ignore the RC5 toggle bit */ 149 - event &= ~0x0800; 150 - 151 - /* find the key, or report it as unknown */ 152 - ke = sparse_keymap_entry_from_scancode(keys->input, event); 153 - keycode = ke ? ke->keycode : KEY_UNKNOWN; 154 - dev_dbg(keys->dev, 155 - "input event 0x%04x--> keycode %d\n", 156 - event, keycode); 157 - 158 - /* report press + release */ 159 - input_report_key(keys->input, keycode, 1); 160 - input_sync(keys->input); 161 - input_report_key(keys->input, keycode, 0); 162 - input_sync(keys->input); 163 - } 164 - 165 - return IRQ_HANDLED; 166 - } 167 - 168 - /*----------------------------------------------------------------------*/ 169 - 170 - static int dm355evm_keys_probe(struct platform_device *pdev) 171 - { 172 - struct dm355evm_keys *keys; 173 - struct input_dev *input; 174 - int irq; 175 - int error; 176 - 177 - keys = devm_kzalloc(&pdev->dev, sizeof (*keys), GFP_KERNEL); 178 - if (!keys) 179 - return -ENOMEM; 180 - 181 - input = devm_input_allocate_device(&pdev->dev); 182 - if (!input) 183 - return -ENOMEM; 184 - 185 - keys->dev = &pdev->dev; 186 - keys->input = input; 187 - 188 - input->name = "DM355 EVM Controls"; 189 - input->phys = "dm355evm/input0"; 190 - 191 - input->id.bustype = BUS_I2C; 192 - input->id.product = 0x0355; 193 - input->id.version = dm355evm_msp_read(DM355EVM_MSP_FIRMREV); 194 - 195 - error = sparse_keymap_setup(input, dm355evm_keys, NULL); 196 - if (error) 197 - return error; 198 - 199 - /* REVISIT: flush the event queue? */ 200 - 201 - /* set up "threaded IRQ handler" */ 202 - irq = platform_get_irq(pdev, 0); 203 - if (irq < 0) 204 - return irq; 205 - 206 - error = devm_request_threaded_irq(&pdev->dev, irq, 207 - NULL, dm355evm_keys_irq, 208 - IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 209 - dev_name(&pdev->dev), keys); 210 - if (error) 211 - return error; 212 - 213 - /* register */ 214 - error = input_register_device(input); 215 - if (error) 216 - return error; 217 - 218 - return 0; 219 - } 220 - 221 - /* REVISIT: add suspend/resume when DaVinci supports it. The IRQ should 222 - * be able to wake up the system. When device_may_wakeup(&pdev->dev), call 223 - * enable_irq_wake() on suspend, and disable_irq_wake() on resume. 224 - */ 225 - 226 - /* 227 - * I2C is used to talk to the MSP430, but this platform device is 228 - * exposed by an MFD driver that manages I2C communications. 229 - */ 230 - static struct platform_driver dm355evm_keys_driver = { 231 - .probe = dm355evm_keys_probe, 232 - .driver = { 233 - .name = "dm355evm_keys", 234 - }, 235 - }; 236 - module_platform_driver(dm355evm_keys_driver); 237 - 238 - MODULE_LICENSE("GPL");
+148
drivers/input/misc/tps65219-pwrbutton.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // 3 + // Driver for TPS65219 Push Button 4 + // 5 + // Copyright (C) 2022 BayLibre Incorporated - https://www.baylibre.com/ 6 + 7 + #include <linux/init.h> 8 + #include <linux/input.h> 9 + #include <linux/interrupt.h> 10 + #include <linux/kernel.h> 11 + #include <linux/mfd/tps65219.h> 12 + #include <linux/module.h> 13 + #include <linux/of.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/regmap.h> 16 + #include <linux/slab.h> 17 + 18 + struct tps65219_pwrbutton { 19 + struct device *dev; 20 + struct input_dev *idev; 21 + char phys[32]; 22 + }; 23 + 24 + static irqreturn_t tps65219_pb_push_irq(int irq, void *_pwr) 25 + { 26 + struct tps65219_pwrbutton *pwr = _pwr; 27 + 28 + input_report_key(pwr->idev, KEY_POWER, 1); 29 + pm_wakeup_event(pwr->dev, 0); 30 + input_sync(pwr->idev); 31 + 32 + return IRQ_HANDLED; 33 + } 34 + 35 + static irqreturn_t tps65219_pb_release_irq(int irq, void *_pwr) 36 + { 37 + struct tps65219_pwrbutton *pwr = _pwr; 38 + 39 + input_report_key(pwr->idev, KEY_POWER, 0); 40 + input_sync(pwr->idev); 41 + 42 + return IRQ_HANDLED; 43 + } 44 + 45 + static int tps65219_pb_probe(struct platform_device *pdev) 46 + { 47 + struct tps65219 *tps = dev_get_drvdata(pdev->dev.parent); 48 + struct device *dev = &pdev->dev; 49 + struct tps65219_pwrbutton *pwr; 50 + struct input_dev *idev; 51 + int error; 52 + int push_irq; 53 + int release_irq; 54 + 55 + pwr = devm_kzalloc(dev, sizeof(*pwr), GFP_KERNEL); 56 + if (!pwr) 57 + return -ENOMEM; 58 + 59 + idev = devm_input_allocate_device(dev); 60 + if (!idev) 61 + return -ENOMEM; 62 + 63 + idev->name = pdev->name; 64 + snprintf(pwr->phys, sizeof(pwr->phys), "%s/input0", 65 + pdev->name); 66 + idev->phys = pwr->phys; 67 + idev->id.bustype = BUS_I2C; 68 + 69 + input_set_capability(idev, EV_KEY, KEY_POWER); 70 + 71 + pwr->dev = dev; 72 + pwr->idev = idev; 73 + device_init_wakeup(dev, true); 74 + 75 + push_irq = platform_get_irq(pdev, 0); 76 + if (push_irq < 0) 77 + return -EINVAL; 78 + 79 + release_irq = platform_get_irq(pdev, 1); 80 + if (release_irq < 0) 81 + return -EINVAL; 82 + 83 + error = devm_request_threaded_irq(dev, push_irq, NULL, 84 + tps65219_pb_push_irq, 85 + IRQF_ONESHOT, 86 + dev->init_name, pwr); 87 + if (error) { 88 + dev_err(dev, "failed to request push IRQ #%d: %d\n", push_irq, 89 + error); 90 + return error; 91 + } 92 + 93 + error = devm_request_threaded_irq(dev, release_irq, NULL, 94 + tps65219_pb_release_irq, 95 + IRQF_ONESHOT, 96 + dev->init_name, pwr); 97 + if (error) { 98 + dev_err(dev, "failed to request release IRQ #%d: %d\n", 99 + release_irq, error); 100 + return error; 101 + } 102 + 103 + error = input_register_device(idev); 104 + if (error) { 105 + dev_err(dev, "Can't register power button: %d\n", error); 106 + return error; 107 + } 108 + 109 + /* Enable interrupts for the pushbutton */ 110 + regmap_clear_bits(tps->regmap, TPS65219_REG_MASK_CONFIG, 111 + TPS65219_REG_MASK_INT_FOR_PB_MASK); 112 + 113 + /* Set PB/EN/VSENSE pin to be a pushbutton */ 114 + regmap_update_bits(tps->regmap, TPS65219_REG_MFP_2_CONFIG, 115 + TPS65219_MFP_2_EN_PB_VSENSE_MASK, TPS65219_MFP_2_PB); 116 + 117 + return 0; 118 + } 119 + 120 + static int tps65219_pb_remove(struct platform_device *pdev) 121 + { 122 + struct tps65219 *tps = dev_get_drvdata(pdev->dev.parent); 123 + 124 + /* Disable interrupt for the pushbutton */ 125 + return regmap_update_bits(tps->regmap, TPS65219_REG_MASK_CONFIG, 126 + TPS65219_REG_MASK_INT_FOR_PB_MASK, 127 + TPS65219_REG_MASK_INT_FOR_PB_MASK); 128 + } 129 + 130 + static const struct platform_device_id tps65219_pwrbtn_id_table[] = { 131 + { "tps65219-pwrbutton", }, 132 + { /* sentinel */ } 133 + }; 134 + MODULE_DEVICE_TABLE(platform, tps65219_pwrbtn_id_table); 135 + 136 + static struct platform_driver tps65219_pb_driver = { 137 + .probe = tps65219_pb_probe, 138 + .remove = tps65219_pb_remove, 139 + .driver = { 140 + .name = "tps65219_pwrbutton", 141 + }, 142 + .id_table = tps65219_pwrbtn_id_table, 143 + }; 144 + module_platform_driver(tps65219_pb_driver); 145 + 146 + MODULE_DESCRIPTION("TPS65219 Power Button"); 147 + MODULE_LICENSE("GPL"); 148 + MODULE_AUTHOR("Markus Schneider-Pargmann <msp@baylibre.com");
+4 -6
drivers/mfd/88pm800.c
··· 398 398 399 399 .num_regs = 4, 400 400 .status_base = PM800_INT_STATUS1, 401 - .mask_base = PM800_INT_ENA_1, 401 + .unmask_base = PM800_INT_ENA_1, 402 402 .ack_base = PM800_INT_STATUS1, 403 - .mask_invert = 1, 404 403 }; 405 404 406 405 static int pm800_pages_init(struct pm80x_chip *chip) ··· 527 528 return ret; 528 529 } 529 530 530 - static int pm800_probe(struct i2c_client *client, 531 - const struct i2c_device_id *id) 531 + static int pm800_probe(struct i2c_client *client) 532 532 { 533 533 int ret = 0; 534 534 struct pm80x_chip *chip; ··· 595 597 static struct i2c_driver pm800_driver = { 596 598 .driver = { 597 599 .name = "88PM800", 598 - .pm = &pm80x_pm_ops, 600 + .pm = pm_sleep_ptr(&pm80x_pm_ops), 599 601 }, 600 - .probe = pm800_probe, 602 + .probe_new = pm800_probe, 601 603 .remove = pm800_remove, 602 604 .id_table = pm80x_id_table, 603 605 };
+3 -4
drivers/mfd/88pm805.c
··· 209 209 return ret; 210 210 } 211 211 212 - static int pm805_probe(struct i2c_client *client, 213 - const struct i2c_device_id *id) 212 + static int pm805_probe(struct i2c_client *client) 214 213 { 215 214 int ret = 0; 216 215 struct pm80x_chip *chip; ··· 251 252 static struct i2c_driver pm805_driver = { 252 253 .driver = { 253 254 .name = "88PM805", 254 - .pm = &pm80x_pm_ops, 255 + .pm = pm_sleep_ptr(&pm80x_pm_ops), 255 256 }, 256 - .probe = pm805_probe, 257 + .probe_new = pm805_probe, 257 258 .remove = pm805_remove, 258 259 .id_table = pm80x_id_table, 259 260 };
+1 -4
drivers/mfd/88pm80x.c
··· 129 129 } 130 130 EXPORT_SYMBOL_GPL(pm80x_deinit); 131 131 132 - #ifdef CONFIG_PM_SLEEP 133 132 static int pm80x_suspend(struct device *dev) 134 133 { 135 134 struct i2c_client *client = to_i2c_client(dev); ··· 152 153 153 154 return 0; 154 155 } 155 - #endif 156 156 157 - SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume); 158 - EXPORT_SYMBOL_GPL(pm80x_pm_ops); 157 + EXPORT_GPL_SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume); 159 158 160 159 MODULE_DESCRIPTION("I2C Driver for Marvell 88PM80x"); 161 160 MODULE_AUTHOR("Qiao Zhou <zhouqiao@marvell.com>");
+2 -4
drivers/mfd/88pm860x-core.c
··· 1212 1212 } 1213 1213 } 1214 1214 1215 - #ifdef CONFIG_PM_SLEEP 1216 1215 static int pm860x_suspend(struct device *dev) 1217 1216 { 1218 1217 struct i2c_client *client = to_i2c_client(dev); ··· 1231 1232 disable_irq_wake(chip->core_irq); 1232 1233 return 0; 1233 1234 } 1234 - #endif 1235 1235 1236 - static SIMPLE_DEV_PM_OPS(pm860x_pm_ops, pm860x_suspend, pm860x_resume); 1236 + static DEFINE_SIMPLE_DEV_PM_OPS(pm860x_pm_ops, pm860x_suspend, pm860x_resume); 1237 1237 1238 1238 static const struct i2c_device_id pm860x_id_table[] = { 1239 1239 { "88PM860x", 0 }, ··· 1249 1251 static struct i2c_driver pm860x_driver = { 1250 1252 .driver = { 1251 1253 .name = "88PM860x", 1252 - .pm = &pm860x_pm_ops, 1254 + .pm = pm_sleep_ptr(&pm860x_pm_ops), 1253 1255 .of_match_table = pm860x_dt_ids, 1254 1256 }, 1255 1257 .probe_new = pm860x_probe,
+37 -32
drivers/mfd/Kconfig
··· 77 77 help 78 78 Support for the AS3711 PMIC from AMS 79 79 80 + config MFD_SMPRO 81 + tristate "Ampere Computing SMpro core driver" 82 + depends on I2C 83 + select MFD_CORE 84 + select REGMAP_I2C 85 + help 86 + Say yes here to enable SMpro driver support for Ampere's Altra 87 + processor family. 88 + 89 + Ampere's Altra SMpro exposes an I2C regmap interface that can 90 + be accessed by child devices. 91 + 80 92 config MFD_AS3722 81 93 tristate "ams AS3722 Power Management IC" 82 94 select MFD_CORE ··· 559 547 HTC Magician devices, respectively. Actual functionality is 560 548 handled by the leds-pasic3 and ds1wm drivers. 561 549 562 - config HTC_I2CPLD 563 - bool "HTC I2C PLD chip support" 564 - depends on I2C=y && GPIOLIB 565 - help 566 - If you say yes here you get support for the supposed CPLD 567 - found on omap850 HTC devices like the HTC Wizard and HTC Herald. 568 - This device provides input and output GPIOs through an I2C 569 - interface to one or more sub-chips. 570 - 571 550 config MFD_INTEL_QUARK_I2C_GPIO 572 551 tristate "Intel Quark MFD I2C GPIO" 573 552 depends on PCI ··· 594 591 bool "Support for Crystal Cove PMIC" 595 592 depends on HAS_IOMEM && I2C=y && GPIOLIB && COMMON_CLK 596 593 depends on (X86 && ACPI) || COMPILE_TEST 597 - depends on I2C_DESIGNWARE_PLATFORM=y 594 + depends on I2C_DESIGNWARE_PLATFORM=y || COMPILE_TEST 598 595 select MFD_CORE 599 596 select REGMAP_I2C 600 597 select REGMAP_IRQ ··· 797 794 config MFD_MAX77620 798 795 bool "Maxim Semiconductor MAX77620 and MAX20024 PMIC Support" 799 796 depends on I2C=y 800 - depends on OF || COMPILE_TEST 797 + depends on OF 801 798 select MFD_CORE 802 799 select REGMAP_I2C 803 800 select REGMAP_IRQ ··· 812 809 config MFD_MAX77650 813 810 tristate "Maxim MAX77650/77651 PMIC Support" 814 811 depends on I2C 815 - depends on OF || COMPILE_TEST 812 + depends on OF 816 813 select MFD_CORE 817 814 select REGMAP_I2C 818 815 select REGMAP_IRQ ··· 827 824 config MFD_MAX77686 828 825 tristate "Maxim Semiconductor MAX77686/802 PMIC Support" 829 826 depends on I2C 830 - depends on OF || COMPILE_TEST 827 + depends on OF 831 828 select MFD_CORE 832 829 select REGMAP_I2C 833 830 select REGMAP_IRQ ··· 856 853 config MFD_MAX77714 857 854 tristate "Maxim Semiconductor MAX77714 PMIC Support" 858 855 depends on I2C 859 - depends on OF || COMPILE_TEST 856 + depends on OF 860 857 select MFD_CORE 861 858 select REGMAP_I2C 862 859 help ··· 1013 1010 config MFD_CPCAP 1014 1011 tristate "Support for Motorola CPCAP" 1015 1012 depends on SPI 1016 - depends on OF || COMPILE_TEST 1013 + depends on OF 1017 1014 select MFD_CORE 1018 1015 select REGMAP_SPI 1019 1016 select REGMAP_IRQ ··· 1038 1035 1039 1036 config MFD_NTXEC 1040 1037 tristate "Netronix embedded controller (EC)" 1041 - depends on OF || COMPILE_TEST 1038 + depends on OF 1042 1039 depends on I2C 1043 1040 select REGMAP_I2C 1044 1041 select MFD_CORE ··· 1234 1231 config MFD_SEC_CORE 1235 1232 tristate "Samsung Electronics PMIC Series Support" 1236 1233 depends on I2C=y 1237 - depends on OF || COMPILE_TEST 1234 + depends on OF 1238 1235 select MFD_CORE 1239 1236 select REGMAP_I2C 1240 1237 select REGMAP_IRQ ··· 1435 1432 Select this option to enable accessing system control registers 1436 1433 via regmap. 1437 1434 1438 - config MFD_DAVINCI_VOICECODEC 1439 - tristate 1440 - select MFD_CORE 1441 - select REGMAP_MMIO 1442 - 1443 1435 config MFD_TI_AM335X_TSCADC 1444 1436 tristate "TI ADC / Touch Screen chip support" 1445 1437 select MFD_CORE ··· 1445 1447 of Touch Screen /ADC chips. 1446 1448 To compile this driver as a module, choose M here: the 1447 1449 module will be called ti_am335x_tscadc. 1448 - 1449 - config MFD_DM355EVM_MSP 1450 - bool "TI DaVinci DM355 EVM microcontroller" 1451 - depends on I2C=y && MACH_DAVINCI_DM355_EVM 1452 - help 1453 - This driver supports the MSP430 microcontroller used on these 1454 - boards. MSP430 firmware manages resets and power sequencing, 1455 - inputs from buttons and the IR remote, LEDs, an RTC, and more. 1456 1450 1457 1451 config MFD_LP3943 1458 1452 tristate "TI/National Semiconductor LP3943 MFD Driver" ··· 1489 1499 OMAP USB Host drivers. 1490 1500 1491 1501 config MFD_PALMAS 1492 - bool "TI Palmas series chips" 1502 + tristate "TI Palmas series chips" 1493 1503 select MFD_CORE 1494 1504 select REGMAP_I2C 1495 1505 select REGMAP_IRQ ··· 1624 1634 1625 1635 This driver can also be built as a module. If so, the module 1626 1636 will be called tps65218. 1637 + 1638 + config MFD_TPS65219 1639 + tristate "TI TPS65219 Power Management IC" 1640 + depends on I2C && OF 1641 + select MFD_CORE 1642 + select REGMAP_I2C 1643 + select REGMAP_IRQ 1644 + help 1645 + If you say yes here you get support for the TPS65219 series of Power 1646 + Management ICs. These include voltage regulators, GPIOs and 1647 + push/power button that is often used in portable devices. 1648 + 1649 + This driver can also be built as a module. If so, the module 1650 + will be called tps65219. 1627 1651 1628 1652 config MFD_TPS6586X 1629 1653 bool "TI TPS6586x Power Management chips" ··· 2031 2027 depends on I2C=y 2032 2028 depends on OF 2033 2029 select REGMAP_I2C 2030 + select REGMAP_IRQ 2034 2031 select MFD_CORE 2035 2032 help 2036 2033 Select this option to get support for the ROHM BD9576MUF and ··· 2082 2077 config MFD_STMFX 2083 2078 tristate "Support for STMicroelectronics Multi-Function eXpander (STMFX)" 2084 2079 depends on I2C 2085 - depends on OF || COMPILE_TEST 2080 + depends on OF 2086 2081 select MFD_CORE 2087 2082 select REGMAP_I2C 2088 2083 help
+2 -4
drivers/mfd/Makefile
··· 19 19 obj-$(CONFIG_MFD_GATEWORKS_GSC) += gateworks-gsc.o 20 20 21 21 obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o 22 - obj-$(CONFIG_HTC_I2CPLD) += htc-i2cpld.o 23 22 24 23 obj-$(CONFIG_MFD_TI_LP873X) += lp873x.o 25 24 obj-$(CONFIG_MFD_TI_LP87565) += lp87565.o 26 - 27 - obj-$(CONFIG_MFD_DAVINCI_VOICECODEC) += davinci_voicecodec.o 28 - obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o 29 25 obj-$(CONFIG_MFD_TI_AM335X_TSCADC) += ti_am335x_tscadc.o 30 26 31 27 obj-$(CONFIG_MFD_STA2X11) += sta2x11-mfd.o ··· 97 101 obj-$(CONFIG_MFD_TPS65086) += tps65086.o 98 102 obj-$(CONFIG_MFD_TPS65217) += tps65217.o 99 103 obj-$(CONFIG_MFD_TPS65218) += tps65218.o 104 + obj-$(CONFIG_MFD_TPS65219) += tps65219.o 100 105 obj-$(CONFIG_MFD_TPS65910) += tps65910.o 101 106 obj-$(CONFIG_MFD_TPS65912) += tps65912-core.o 102 107 obj-$(CONFIG_MFD_TPS65912_I2C) += tps65912-i2c.o ··· 268 271 269 272 obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o 270 273 obj-$(CONFIG_MFD_SIMPLE_MFD_I2C) += simple-mfd-i2c.o 274 + obj-$(CONFIG_MFD_SMPRO) += smpro-core.o 271 275 obj-$(CONFIG_MFD_INTEL_M10_BMC) += intel-m10-bmc.o 272 276 273 277 obj-$(CONFIG_MFD_ATC260X) += atc260x-core.o
+5 -8
drivers/mfd/aat2870-core.c
··· 332 332 } 333 333 #endif /* CONFIG_DEBUG_FS */ 334 334 335 - static int aat2870_i2c_probe(struct i2c_client *client, 336 - const struct i2c_device_id *id) 335 + static int aat2870_i2c_probe(struct i2c_client *client) 337 336 { 338 337 struct aat2870_platform_data *pdata = dev_get_platdata(&client->dev); 339 338 struct aat2870_data *aat2870; ··· 408 409 return ret; 409 410 } 410 411 411 - #ifdef CONFIG_PM_SLEEP 412 412 static int aat2870_i2c_suspend(struct device *dev) 413 413 { 414 414 struct i2c_client *client = to_i2c_client(dev); ··· 436 438 437 439 return 0; 438 440 } 439 - #endif /* CONFIG_PM_SLEEP */ 440 441 441 - static SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend, 442 - aat2870_i2c_resume); 442 + static DEFINE_SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend, 443 + aat2870_i2c_resume); 443 444 444 445 static const struct i2c_device_id aat2870_i2c_id_table[] = { 445 446 { "aat2870", 0 }, ··· 448 451 static struct i2c_driver aat2870_i2c_driver = { 449 452 .driver = { 450 453 .name = "aat2870", 451 - .pm = &aat2870_pm_ops, 454 + .pm = pm_sleep_ptr(&aat2870_pm_ops), 452 455 .suppress_bind_attrs = true, 453 456 }, 454 - .probe = aat2870_i2c_probe, 457 + .probe_new = aat2870_i2c_probe, 455 458 .id_table = aat2870_i2c_id_table, 456 459 }; 457 460
+2 -3
drivers/mfd/act8945a.c
··· 28 28 .val_bits = 8, 29 29 }; 30 30 31 - static int act8945a_i2c_probe(struct i2c_client *i2c, 32 - const struct i2c_device_id *id) 31 + static int act8945a_i2c_probe(struct i2c_client *i2c) 33 32 { 34 33 int ret; 35 34 struct regmap *regmap; ··· 70 71 .name = "act8945a", 71 72 .of_match_table = of_match_ptr(act8945a_of_match), 72 73 }, 73 - .probe = act8945a_i2c_probe, 74 + .probe_new = act8945a_i2c_probe, 74 75 .id_table = act8945a_i2c_id, 75 76 }; 76 77
+5 -7
drivers/mfd/adp5520.c
··· 204 204 return device_for_each_child(chip->dev, NULL, __remove_subdev); 205 205 } 206 206 207 - static int adp5520_probe(struct i2c_client *client, 208 - const struct i2c_device_id *id) 207 + static int adp5520_probe(struct i2c_client *client) 209 208 { 209 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 210 210 struct adp5520_platform_data *pdata = dev_get_platdata(&client->dev); 211 211 struct platform_device *pdev; 212 212 struct adp5520_chip *chip; ··· 305 305 return ret; 306 306 } 307 307 308 - #ifdef CONFIG_PM_SLEEP 309 308 static int adp5520_suspend(struct device *dev) 310 309 { 311 310 struct i2c_client *client = to_i2c_client(dev); ··· 325 326 adp5520_write(chip->dev, ADP5520_MODE_STATUS, chip->mode); 326 327 return 0; 327 328 } 328 - #endif 329 329 330 - static SIMPLE_DEV_PM_OPS(adp5520_pm, adp5520_suspend, adp5520_resume); 330 + static DEFINE_SIMPLE_DEV_PM_OPS(adp5520_pm, adp5520_suspend, adp5520_resume); 331 331 332 332 static const struct i2c_device_id adp5520_id[] = { 333 333 { "pmic-adp5520", ID_ADP5520 }, ··· 337 339 static struct i2c_driver adp5520_driver = { 338 340 .driver = { 339 341 .name = "adp5520", 340 - .pm = &adp5520_pm, 342 + .pm = pm_sleep_ptr(&adp5520_pm), 341 343 .suppress_bind_attrs = true, 342 344 }, 343 - .probe = adp5520_probe, 345 + .probe_new = adp5520_probe, 344 346 .id_table = adp5520_id, 345 347 }; 346 348 builtin_i2c_driver(adp5520_driver);
+7 -12
drivers/mfd/arizona-core.c
··· 480 480 return 0; 481 481 } 482 482 483 - #ifdef CONFIG_PM 484 483 static int arizona_isolate_dcvdd(struct arizona *arizona) 485 484 { 486 485 int ret; ··· 741 742 742 743 return 0; 743 744 } 744 - #endif 745 745 746 - #ifdef CONFIG_PM_SLEEP 747 746 static int arizona_suspend(struct device *dev) 748 747 { 749 748 struct arizona *arizona = dev_get_drvdata(dev); ··· 781 784 782 785 return 0; 783 786 } 784 - #endif 785 787 786 - const struct dev_pm_ops arizona_pm_ops = { 787 - SET_RUNTIME_PM_OPS(arizona_runtime_suspend, 788 - arizona_runtime_resume, 789 - NULL) 790 - SET_SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume) 791 - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(arizona_suspend_noirq, 792 - arizona_resume_noirq) 788 + EXPORT_GPL_DEV_PM_OPS(arizona_pm_ops) = { 789 + RUNTIME_PM_OPS(arizona_runtime_suspend, 790 + arizona_runtime_resume, 791 + NULL) 792 + SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume) 793 + NOIRQ_SYSTEM_SLEEP_PM_OPS(arizona_suspend_noirq, 794 + arizona_resume_noirq) 793 795 }; 794 - EXPORT_SYMBOL_GPL(arizona_pm_ops); 795 796 796 797 #ifdef CONFIG_OF 797 798 static int arizona_of_get_core_pdata(struct arizona *arizona)
+4 -4
drivers/mfd/arizona-i2c.c
··· 20 20 21 21 #include "arizona.h" 22 22 23 - static int arizona_i2c_probe(struct i2c_client *i2c, 24 - const struct i2c_device_id *id) 23 + static int arizona_i2c_probe(struct i2c_client *i2c) 25 24 { 25 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 26 26 const void *match_data; 27 27 struct arizona *arizona; 28 28 const struct regmap_config *regmap_config = NULL; ··· 117 117 static struct i2c_driver arizona_i2c_driver = { 118 118 .driver = { 119 119 .name = "arizona", 120 - .pm = &arizona_pm_ops, 120 + .pm = pm_ptr(&arizona_pm_ops), 121 121 .of_match_table = of_match_ptr(arizona_i2c_of_match), 122 122 }, 123 - .probe = arizona_i2c_probe, 123 + .probe_new = arizona_i2c_probe, 124 124 .remove = arizona_i2c_remove, 125 125 .id_table = arizona_i2c_id, 126 126 };
+1 -1
drivers/mfd/arizona-spi.c
··· 282 282 static struct spi_driver arizona_spi_driver = { 283 283 .driver = { 284 284 .name = "arizona", 285 - .pm = &arizona_pm_ops, 285 + .pm = pm_ptr(&arizona_pm_ops), 286 286 .of_match_table = of_match_ptr(arizona_spi_of_match), 287 287 .acpi_match_table = ACPI_PTR(arizona_acpi_match), 288 288 },
+2 -3
drivers/mfd/as3711.c
··· 116 116 }; 117 117 #endif 118 118 119 - static int as3711_i2c_probe(struct i2c_client *client, 120 - const struct i2c_device_id *id) 119 + static int as3711_i2c_probe(struct i2c_client *client) 121 120 { 122 121 struct as3711 *as3711; 123 122 struct as3711_platform_data *pdata; ··· 201 202 .name = "as3711", 202 203 .of_match_table = of_match_ptr(as3711_of_match), 203 204 }, 204 - .probe = as3711_i2c_probe, 205 + .probe_new = as3711_i2c_probe, 205 206 .id_table = as3711_i2c_id, 206 207 }; 207 208
+2 -3
drivers/mfd/as3722.c
··· 333 333 return 0; 334 334 } 335 335 336 - static int as3722_i2c_probe(struct i2c_client *i2c, 337 - const struct i2c_device_id *id) 336 + static int as3722_i2c_probe(struct i2c_client *i2c) 338 337 { 339 338 struct as3722 *as3722; 340 339 unsigned long irq_flags; ··· 445 446 .of_match_table = as3722_of_match, 446 447 .pm = &as3722_pm_ops, 447 448 }, 448 - .probe = as3722_i2c_probe, 449 + .probe_new = as3722_i2c_probe, 449 450 .id_table = as3722_i2c_id, 450 451 }; 451 452
+2 -4
drivers/mfd/atc260x-core.c
··· 100 100 .num_irqs = ARRAY_SIZE(atc2603c_regmap_irqs), 101 101 .num_regs = 1, 102 102 .status_base = ATC2603C_INTS_PD, 103 - .mask_base = ATC2603C_INTS_MSK, 104 - .mask_invert = true, 103 + .unmask_base = ATC2603C_INTS_MSK, 105 104 }; 106 105 107 106 static const struct regmap_irq_chip atc2609a_regmap_irq_chip = { ··· 109 110 .num_irqs = ARRAY_SIZE(atc2609a_regmap_irqs), 110 111 .num_regs = 1, 111 112 .status_base = ATC2609A_INTS_PD, 112 - .mask_base = ATC2609A_INTS_MSK, 113 - .mask_invert = true, 113 + .unmask_base = ATC2609A_INTS_MSK, 114 114 }; 115 115 116 116 static const struct resource atc2603c_onkey_resources[] = {
+2 -3
drivers/mfd/atc260x-i2c.c
··· 12 12 #include <linux/of.h> 13 13 #include <linux/regmap.h> 14 14 15 - static int atc260x_i2c_probe(struct i2c_client *client, 16 - const struct i2c_device_id *id) 15 + static int atc260x_i2c_probe(struct i2c_client *client) 17 16 { 18 17 struct atc260x *atc260x; 19 18 struct regmap_config regmap_cfg; ··· 53 54 .name = "atc260x", 54 55 .of_match_table = of_match_ptr(atc260x_i2c_of_match), 55 56 }, 56 - .probe = atc260x_i2c_probe, 57 + .probe_new = atc260x_i2c_probe, 57 58 }; 58 59 module_i2c_driver(atc260x_i2c_driver); 59 60
+2 -3
drivers/mfd/axp20x-i2c.c
··· 22 22 #include <linux/regmap.h> 23 23 #include <linux/slab.h> 24 24 25 - static int axp20x_i2c_probe(struct i2c_client *i2c, 26 - const struct i2c_device_id *id) 25 + static int axp20x_i2c_probe(struct i2c_client *i2c) 27 26 { 28 27 struct axp20x_dev *axp20x; 29 28 int ret; ··· 99 100 .of_match_table = of_match_ptr(axp20x_i2c_of_match), 100 101 .acpi_match_table = ACPI_PTR(axp20x_i2c_acpi_match), 101 102 }, 102 - .probe = axp20x_i2c_probe, 103 + .probe_new = axp20x_i2c_probe, 103 104 .remove = axp20x_i2c_remove, 104 105 .id_table = axp20x_i2c_id, 105 106 };
+8 -15
drivers/mfd/axp20x.c
··· 506 506 .name = "axp152_irq_chip", 507 507 .status_base = AXP152_IRQ1_STATE, 508 508 .ack_base = AXP152_IRQ1_STATE, 509 - .mask_base = AXP152_IRQ1_EN, 510 - .mask_invert = true, 509 + .unmask_base = AXP152_IRQ1_EN, 511 510 .init_ack_masked = true, 512 511 .irqs = axp152_regmap_irqs, 513 512 .num_irqs = ARRAY_SIZE(axp152_regmap_irqs), ··· 517 518 .name = "axp20x_irq_chip", 518 519 .status_base = AXP20X_IRQ1_STATE, 519 520 .ack_base = AXP20X_IRQ1_STATE, 520 - .mask_base = AXP20X_IRQ1_EN, 521 - .mask_invert = true, 521 + .unmask_base = AXP20X_IRQ1_EN, 522 522 .init_ack_masked = true, 523 523 .irqs = axp20x_regmap_irqs, 524 524 .num_irqs = ARRAY_SIZE(axp20x_regmap_irqs), ··· 529 531 .name = "axp22x_irq_chip", 530 532 .status_base = AXP20X_IRQ1_STATE, 531 533 .ack_base = AXP20X_IRQ1_STATE, 532 - .mask_base = AXP20X_IRQ1_EN, 533 - .mask_invert = true, 534 + .unmask_base = AXP20X_IRQ1_EN, 534 535 .init_ack_masked = true, 535 536 .irqs = axp22x_regmap_irqs, 536 537 .num_irqs = ARRAY_SIZE(axp22x_regmap_irqs), ··· 540 543 .name = "axp288_irq_chip", 541 544 .status_base = AXP20X_IRQ1_STATE, 542 545 .ack_base = AXP20X_IRQ1_STATE, 543 - .mask_base = AXP20X_IRQ1_EN, 544 - .mask_invert = true, 546 + .unmask_base = AXP20X_IRQ1_EN, 545 547 .init_ack_masked = true, 546 548 .irqs = axp288_regmap_irqs, 547 549 .num_irqs = ARRAY_SIZE(axp288_regmap_irqs), ··· 552 556 .name = "axp803", 553 557 .status_base = AXP20X_IRQ1_STATE, 554 558 .ack_base = AXP20X_IRQ1_STATE, 555 - .mask_base = AXP20X_IRQ1_EN, 556 - .mask_invert = true, 559 + .unmask_base = AXP20X_IRQ1_EN, 557 560 .init_ack_masked = true, 558 561 .irqs = axp803_regmap_irqs, 559 562 .num_irqs = ARRAY_SIZE(axp803_regmap_irqs), ··· 563 568 .name = "axp806", 564 569 .status_base = AXP20X_IRQ1_STATE, 565 570 .ack_base = AXP20X_IRQ1_STATE, 566 - .mask_base = AXP20X_IRQ1_EN, 567 - .mask_invert = true, 571 + .unmask_base = AXP20X_IRQ1_EN, 568 572 .init_ack_masked = true, 569 573 .irqs = axp806_regmap_irqs, 570 574 .num_irqs = ARRAY_SIZE(axp806_regmap_irqs), ··· 574 580 .name = "axp809", 575 581 .status_base = AXP20X_IRQ1_STATE, 576 582 .ack_base = AXP20X_IRQ1_STATE, 577 - .mask_base = AXP20X_IRQ1_EN, 578 - .mask_invert = true, 583 + .unmask_base = AXP20X_IRQ1_EN, 579 584 .init_ack_masked = true, 580 585 .irqs = axp809_regmap_irqs, 581 586 .num_irqs = ARRAY_SIZE(axp809_regmap_irqs), ··· 835 842 AXP20X_OFF); 836 843 837 844 /* Give capacitors etc. time to drain to avoid kernel panic msg. */ 838 - msleep(500); 845 + mdelay(500); 839 846 } 840 847 841 848 int axp20x_match_device(struct axp20x_dev *axp20x)
+2 -3
drivers/mfd/bcm590xx.c
··· 38 38 .cache_type = REGCACHE_RBTREE, 39 39 }; 40 40 41 - static int bcm590xx_i2c_probe(struct i2c_client *i2c_pri, 42 - const struct i2c_device_id *id) 41 + static int bcm590xx_i2c_probe(struct i2c_client *i2c_pri) 43 42 { 44 43 struct bcm590xx *bcm590xx; 45 44 int ret; ··· 108 109 .name = "bcm590xx", 109 110 .of_match_table = bcm590xx_of_match, 110 111 }, 111 - .probe = bcm590xx_i2c_probe, 112 + .probe_new = bcm590xx_i2c_probe, 112 113 .id_table = bcm590xx_i2c_id, 113 114 }; 114 115 module_i2c_driver(bcm590xx_i2c_driver);
+2 -3
drivers/mfd/bd9571mwv.c
··· 204 204 return 0; 205 205 } 206 206 207 - static int bd9571mwv_probe(struct i2c_client *client, 208 - const struct i2c_device_id *ids) 207 + static int bd9571mwv_probe(struct i2c_client *client) 209 208 { 210 209 const struct regmap_config *regmap_config; 211 210 const struct regmap_irq_chip *irq_chip; ··· 278 279 .name = "bd9571mwv", 279 280 .of_match_table = bd9571mwv_of_match_table, 280 281 }, 281 - .probe = bd9571mwv_probe, 282 + .probe_new = bd9571mwv_probe, 282 283 .id_table = bd9571mwv_id_table, 283 284 }; 284 285 module_i2c_driver(bd9571mwv_driver);
+3 -3
drivers/mfd/da903x.c
··· 488 488 return ret; 489 489 } 490 490 491 - static int da903x_probe(struct i2c_client *client, 492 - const struct i2c_device_id *id) 491 + static int da903x_probe(struct i2c_client *client) 493 492 { 493 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 494 494 struct da903x_platform_data *pdata = dev_get_platdata(&client->dev); 495 495 struct da903x_chip *chip; 496 496 unsigned int tmp; ··· 543 543 .driver = { 544 544 .name = "da903x", 545 545 }, 546 - .probe = da903x_probe, 546 + .probe_new = da903x_probe, 547 547 .remove = da903x_remove, 548 548 .id_table = da903x_id_table, 549 549 };
+3 -3
drivers/mfd/da9052-i2c.c
··· 126 126 }; 127 127 #endif 128 128 129 - static int da9052_i2c_probe(struct i2c_client *client, 130 - const struct i2c_device_id *id) 129 + static int da9052_i2c_probe(struct i2c_client *client) 131 130 { 131 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 132 132 struct da9052 *da9052; 133 133 int ret; 134 134 ··· 176 176 } 177 177 178 178 static struct i2c_driver da9052_i2c_driver = { 179 - .probe = da9052_i2c_probe, 179 + .probe_new = da9052_i2c_probe, 180 180 .remove = da9052_i2c_remove, 181 181 .id_table = da9052_i2c_id, 182 182 .driver = {
+2 -3
drivers/mfd/da9055-i2c.c
··· 15 15 16 16 #include <linux/mfd/da9055/core.h> 17 17 18 - static int da9055_i2c_probe(struct i2c_client *i2c, 19 - const struct i2c_device_id *id) 18 + static int da9055_i2c_probe(struct i2c_client *i2c) 20 19 { 21 20 struct da9055 *da9055; 22 21 int ret; ··· 66 67 }; 67 68 68 69 static struct i2c_driver da9055_i2c_driver = { 69 - .probe = da9055_i2c_probe, 70 + .probe_new = da9055_i2c_probe, 70 71 .remove = da9055_i2c_remove, 71 72 .id_table = da9055_i2c_id, 72 73 .driver = {
+3 -3
drivers/mfd/da9062-core.c
··· 621 621 }; 622 622 MODULE_DEVICE_TABLE(of, da9062_dt_ids); 623 623 624 - static int da9062_i2c_probe(struct i2c_client *i2c, 625 - const struct i2c_device_id *id) 624 + static int da9062_i2c_probe(struct i2c_client *i2c) 626 625 { 626 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 627 627 struct da9062 *chip; 628 628 unsigned int irq_base; 629 629 const struct mfd_cell *cell; ··· 744 744 .name = "da9062", 745 745 .of_match_table = da9062_dt_ids, 746 746 }, 747 - .probe = da9062_i2c_probe, 747 + .probe_new = da9062_i2c_probe, 748 748 .remove = da9062_i2c_remove, 749 749 .id_table = da9062_i2c_id, 750 750 };
+3 -3
drivers/mfd/da9063-i2c.c
··· 351 351 { } 352 352 }; 353 353 MODULE_DEVICE_TABLE(of, da9063_dt_ids); 354 - static int da9063_i2c_probe(struct i2c_client *i2c, 355 - const struct i2c_device_id *id) 354 + static int da9063_i2c_probe(struct i2c_client *i2c) 356 355 { 356 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 357 357 struct da9063 *da9063; 358 358 int ret; 359 359 ··· 469 469 .name = "da9063", 470 470 .of_match_table = da9063_dt_ids, 471 471 }, 472 - .probe = da9063_i2c_probe, 472 + .probe_new = da9063_i2c_probe, 473 473 .id_table = da9063_i2c_id, 474 474 }; 475 475
+2 -3
drivers/mfd/da9150-core.c
··· 392 392 }, 393 393 }; 394 394 395 - static int da9150_probe(struct i2c_client *client, 396 - const struct i2c_device_id *id) 395 + static int da9150_probe(struct i2c_client *client) 397 396 { 398 397 struct da9150 *da9150; 399 398 struct da9150_pdata *pdata = dev_get_platdata(&client->dev); ··· 510 511 .name = "da9150", 511 512 .of_match_table = da9150_of_match, 512 513 }, 513 - .probe = da9150_probe, 514 + .probe_new = da9150_probe, 514 515 .remove = da9150_remove, 515 516 .shutdown = da9150_shutdown, 516 517 .id_table = da9150_i2c_id,
-136
drivers/mfd/davinci_voicecodec.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * DaVinci Voice Codec Core Interface for TI platforms 4 - * 5 - * Copyright (C) 2010 Texas Instruments, Inc 6 - * 7 - * Author: Miguel Aguilar <miguel.aguilar@ridgerun.com> 8 - */ 9 - 10 - #include <linux/init.h> 11 - #include <linux/module.h> 12 - #include <linux/device.h> 13 - #include <linux/slab.h> 14 - #include <linux/delay.h> 15 - #include <linux/io.h> 16 - #include <linux/clk.h> 17 - #include <linux/regmap.h> 18 - 19 - #include <sound/pcm.h> 20 - 21 - #include <linux/mfd/davinci_voicecodec.h> 22 - 23 - static const struct regmap_config davinci_vc_regmap = { 24 - .reg_bits = 32, 25 - .val_bits = 32, 26 - }; 27 - 28 - static int __init davinci_vc_probe(struct platform_device *pdev) 29 - { 30 - struct davinci_vc *davinci_vc; 31 - struct resource *res; 32 - struct mfd_cell *cell = NULL; 33 - dma_addr_t fifo_base; 34 - int ret; 35 - 36 - davinci_vc = devm_kzalloc(&pdev->dev, 37 - sizeof(struct davinci_vc), GFP_KERNEL); 38 - if (!davinci_vc) 39 - return -ENOMEM; 40 - 41 - davinci_vc->clk = devm_clk_get(&pdev->dev, NULL); 42 - if (IS_ERR(davinci_vc->clk)) { 43 - dev_dbg(&pdev->dev, 44 - "could not get the clock for voice codec\n"); 45 - return -ENODEV; 46 - } 47 - clk_enable(davinci_vc->clk); 48 - 49 - davinci_vc->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); 50 - if (IS_ERR(davinci_vc->base)) { 51 - ret = PTR_ERR(davinci_vc->base); 52 - goto fail; 53 - } 54 - fifo_base = (dma_addr_t)res->start; 55 - 56 - davinci_vc->regmap = devm_regmap_init_mmio(&pdev->dev, 57 - davinci_vc->base, 58 - &davinci_vc_regmap); 59 - if (IS_ERR(davinci_vc->regmap)) { 60 - ret = PTR_ERR(davinci_vc->regmap); 61 - goto fail; 62 - } 63 - 64 - res = platform_get_resource(pdev, IORESOURCE_DMA, 0); 65 - if (!res) { 66 - dev_err(&pdev->dev, "no DMA resource\n"); 67 - ret = -ENXIO; 68 - goto fail; 69 - } 70 - 71 - davinci_vc->davinci_vcif.dma_tx_channel = res->start; 72 - davinci_vc->davinci_vcif.dma_tx_addr = fifo_base + DAVINCI_VC_WFIFO; 73 - 74 - res = platform_get_resource(pdev, IORESOURCE_DMA, 1); 75 - if (!res) { 76 - dev_err(&pdev->dev, "no DMA resource\n"); 77 - ret = -ENXIO; 78 - goto fail; 79 - } 80 - 81 - davinci_vc->davinci_vcif.dma_rx_channel = res->start; 82 - davinci_vc->davinci_vcif.dma_rx_addr = fifo_base + DAVINCI_VC_RFIFO; 83 - 84 - davinci_vc->dev = &pdev->dev; 85 - davinci_vc->pdev = pdev; 86 - 87 - /* Voice codec interface client */ 88 - cell = &davinci_vc->cells[DAVINCI_VC_VCIF_CELL]; 89 - cell->name = "davinci-vcif"; 90 - cell->platform_data = davinci_vc; 91 - cell->pdata_size = sizeof(*davinci_vc); 92 - 93 - /* Voice codec CQ93VC client */ 94 - cell = &davinci_vc->cells[DAVINCI_VC_CQ93VC_CELL]; 95 - cell->name = "cq93vc-codec"; 96 - cell->platform_data = davinci_vc; 97 - cell->pdata_size = sizeof(*davinci_vc); 98 - 99 - ret = mfd_add_devices(&pdev->dev, pdev->id, davinci_vc->cells, 100 - DAVINCI_VC_CELLS, NULL, 0, NULL); 101 - if (ret != 0) { 102 - dev_err(&pdev->dev, "fail to register client devices\n"); 103 - goto fail; 104 - } 105 - 106 - return 0; 107 - 108 - fail: 109 - clk_disable(davinci_vc->clk); 110 - 111 - return ret; 112 - } 113 - 114 - static int davinci_vc_remove(struct platform_device *pdev) 115 - { 116 - struct davinci_vc *davinci_vc = platform_get_drvdata(pdev); 117 - 118 - mfd_remove_devices(&pdev->dev); 119 - 120 - clk_disable(davinci_vc->clk); 121 - 122 - return 0; 123 - } 124 - 125 - static struct platform_driver davinci_vc_driver = { 126 - .driver = { 127 - .name = "davinci_voicecodec", 128 - }, 129 - .remove = davinci_vc_remove, 130 - }; 131 - 132 - module_platform_driver_probe(davinci_vc_driver, davinci_vc_probe); 133 - 134 - MODULE_AUTHOR("Miguel Aguilar"); 135 - MODULE_DESCRIPTION("Texas Instruments DaVinci Voice Codec Core Interface"); 136 - MODULE_LICENSE("GPL");
-454
drivers/mfd/dm355evm_msp.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * dm355evm_msp.c - driver for MSP430 firmware on DM355EVM board 4 - * 5 - * Copyright (C) 2008 David Brownell 6 - */ 7 - 8 - #include <linux/init.h> 9 - #include <linux/mutex.h> 10 - #include <linux/platform_device.h> 11 - #include <linux/clk.h> 12 - #include <linux/module.h> 13 - #include <linux/err.h> 14 - #include <linux/gpio.h> 15 - #include <linux/gpio/machine.h> 16 - #include <linux/leds.h> 17 - #include <linux/i2c.h> 18 - #include <linux/mfd/dm355evm_msp.h> 19 - 20 - 21 - /* 22 - * The DM355 is a DaVinci chip with video support but no C64+ DSP. Its 23 - * EVM board has an MSP430 programmed with firmware for various board 24 - * support functions. This driver exposes some of them directly, and 25 - * supports other drivers (e.g. RTC, input) for more complex access. 26 - * 27 - * Because this firmware is entirely board-specific, this file embeds 28 - * knowledge that would be passed as platform_data in a generic driver. 29 - * 30 - * This driver was tested with firmware revision A4. 31 - */ 32 - 33 - #if IS_ENABLED(CONFIG_INPUT_DM355EVM) 34 - #define msp_has_keyboard() true 35 - #else 36 - #define msp_has_keyboard() false 37 - #endif 38 - 39 - #if IS_ENABLED(CONFIG_LEDS_GPIO) 40 - #define msp_has_leds() true 41 - #else 42 - #define msp_has_leds() false 43 - #endif 44 - 45 - #if IS_ENABLED(CONFIG_RTC_DRV_DM355EVM) 46 - #define msp_has_rtc() true 47 - #else 48 - #define msp_has_rtc() false 49 - #endif 50 - 51 - #if IS_ENABLED(CONFIG_VIDEO_TVP514X) 52 - #define msp_has_tvp() true 53 - #else 54 - #define msp_has_tvp() false 55 - #endif 56 - 57 - 58 - /*----------------------------------------------------------------------*/ 59 - 60 - /* REVISIT for paranoia's sake, retry reads/writes on error */ 61 - 62 - static struct i2c_client *msp430; 63 - 64 - /** 65 - * dm355evm_msp_write - Writes a register in dm355evm_msp 66 - * @value: the value to be written 67 - * @reg: register address 68 - * 69 - * Returns result of operation - 0 is success, else negative errno 70 - */ 71 - int dm355evm_msp_write(u8 value, u8 reg) 72 - { 73 - return i2c_smbus_write_byte_data(msp430, reg, value); 74 - } 75 - EXPORT_SYMBOL(dm355evm_msp_write); 76 - 77 - /** 78 - * dm355evm_msp_read - Reads a register from dm355evm_msp 79 - * @reg: register address 80 - * 81 - * Returns result of operation - value, or negative errno 82 - */ 83 - int dm355evm_msp_read(u8 reg) 84 - { 85 - return i2c_smbus_read_byte_data(msp430, reg); 86 - } 87 - EXPORT_SYMBOL(dm355evm_msp_read); 88 - 89 - /*----------------------------------------------------------------------*/ 90 - 91 - /* 92 - * Many of the msp430 pins are just used as fixed-direction GPIOs. 93 - * We could export a few more of them this way, if we wanted. 94 - */ 95 - #define MSP_GPIO(bit, reg) ((DM355EVM_MSP_ ## reg) << 3 | (bit)) 96 - 97 - static const u8 msp_gpios[] = { 98 - /* eight leds */ 99 - MSP_GPIO(0, LED), MSP_GPIO(1, LED), 100 - MSP_GPIO(2, LED), MSP_GPIO(3, LED), 101 - MSP_GPIO(4, LED), MSP_GPIO(5, LED), 102 - MSP_GPIO(6, LED), MSP_GPIO(7, LED), 103 - /* SW6 and the NTSC/nPAL jumper */ 104 - MSP_GPIO(0, SWITCH1), MSP_GPIO(1, SWITCH1), 105 - MSP_GPIO(2, SWITCH1), MSP_GPIO(3, SWITCH1), 106 - MSP_GPIO(4, SWITCH1), 107 - /* switches on MMC/SD sockets */ 108 - /* 109 - * Note: EVMDM355_ECP_VA4.pdf suggests that Bit 2 and 4 should be 110 - * checked for card detection. However on the EVM bit 1 and 3 gives 111 - * this status, for 0 and 1 instance respectively. The pdf also 112 - * suggests that Bit 1 and 3 should be checked for write protection. 113 - * However on the EVM bit 2 and 4 gives this status,for 0 and 1 114 - * instance respectively. 115 - */ 116 - MSP_GPIO(2, SDMMC), MSP_GPIO(1, SDMMC), /* mmc0 WP, nCD */ 117 - MSP_GPIO(4, SDMMC), MSP_GPIO(3, SDMMC), /* mmc1 WP, nCD */ 118 - }; 119 - 120 - static struct gpio_led evm_leds[] = { 121 - { .name = "dm355evm::ds14", 122 - .default_trigger = "heartbeat", }, 123 - { .name = "dm355evm::ds15", 124 - .default_trigger = "mmc0", }, 125 - { .name = "dm355evm::ds16", 126 - /* could also be a CE-ATA drive */ 127 - .default_trigger = "mmc1", }, 128 - { .name = "dm355evm::ds17", 129 - .default_trigger = "nand-disk", }, 130 - { .name = "dm355evm::ds18", }, 131 - { .name = "dm355evm::ds19", }, 132 - { .name = "dm355evm::ds20", }, 133 - { .name = "dm355evm::ds21", }, 134 - }; 135 - 136 - static struct gpio_led_platform_data evm_led_data = { 137 - .num_leds = ARRAY_SIZE(evm_leds), 138 - .leds = evm_leds, 139 - }; 140 - 141 - static struct gpiod_lookup_table evm_leds_gpio_table = { 142 - .dev_id = "leds-gpio", 143 - .table = { 144 - /* 145 - * These GPIOs are on the dm355evm_msp 146 - * GPIO chip at index 0..7 147 - */ 148 - GPIO_LOOKUP_IDX("dm355evm_msp", 0, NULL, 149 - 0, GPIO_ACTIVE_LOW), 150 - GPIO_LOOKUP_IDX("dm355evm_msp", 1, NULL, 151 - 1, GPIO_ACTIVE_LOW), 152 - GPIO_LOOKUP_IDX("dm355evm_msp", 2, NULL, 153 - 2, GPIO_ACTIVE_LOW), 154 - GPIO_LOOKUP_IDX("dm355evm_msp", 3, NULL, 155 - 3, GPIO_ACTIVE_LOW), 156 - GPIO_LOOKUP_IDX("dm355evm_msp", 4, NULL, 157 - 4, GPIO_ACTIVE_LOW), 158 - GPIO_LOOKUP_IDX("dm355evm_msp", 5, NULL, 159 - 5, GPIO_ACTIVE_LOW), 160 - GPIO_LOOKUP_IDX("dm355evm_msp", 6, NULL, 161 - 6, GPIO_ACTIVE_LOW), 162 - GPIO_LOOKUP_IDX("dm355evm_msp", 7, NULL, 163 - 7, GPIO_ACTIVE_LOW), 164 - { }, 165 - }, 166 - }; 167 - 168 - #define MSP_GPIO_REG(offset) (msp_gpios[(offset)] >> 3) 169 - #define MSP_GPIO_MASK(offset) BIT(msp_gpios[(offset)] & 0x07) 170 - 171 - static int msp_gpio_in(struct gpio_chip *chip, unsigned offset) 172 - { 173 - switch (MSP_GPIO_REG(offset)) { 174 - case DM355EVM_MSP_SWITCH1: 175 - case DM355EVM_MSP_SWITCH2: 176 - case DM355EVM_MSP_SDMMC: 177 - return 0; 178 - default: 179 - return -EINVAL; 180 - } 181 - } 182 - 183 - static u8 msp_led_cache; 184 - 185 - static int msp_gpio_get(struct gpio_chip *chip, unsigned offset) 186 - { 187 - int reg, status; 188 - 189 - reg = MSP_GPIO_REG(offset); 190 - status = dm355evm_msp_read(reg); 191 - if (status < 0) 192 - return status; 193 - if (reg == DM355EVM_MSP_LED) 194 - msp_led_cache = status; 195 - return !!(status & MSP_GPIO_MASK(offset)); 196 - } 197 - 198 - static int msp_gpio_out(struct gpio_chip *chip, unsigned offset, int value) 199 - { 200 - int mask, bits; 201 - 202 - /* NOTE: there are some other signals that could be 203 - * packaged as output GPIOs, but they aren't as useful 204 - * as the LEDs ... so for now we don't. 205 - */ 206 - if (MSP_GPIO_REG(offset) != DM355EVM_MSP_LED) 207 - return -EINVAL; 208 - 209 - mask = MSP_GPIO_MASK(offset); 210 - bits = msp_led_cache; 211 - 212 - bits &= ~mask; 213 - if (value) 214 - bits |= mask; 215 - msp_led_cache = bits; 216 - 217 - return dm355evm_msp_write(bits, DM355EVM_MSP_LED); 218 - } 219 - 220 - static void msp_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 221 - { 222 - msp_gpio_out(chip, offset, value); 223 - } 224 - 225 - static struct gpio_chip dm355evm_msp_gpio = { 226 - .label = "dm355evm_msp", 227 - .owner = THIS_MODULE, 228 - .direction_input = msp_gpio_in, 229 - .get = msp_gpio_get, 230 - .direction_output = msp_gpio_out, 231 - .set = msp_gpio_set, 232 - .base = -EINVAL, /* dynamic assignment */ 233 - .ngpio = ARRAY_SIZE(msp_gpios), 234 - .can_sleep = true, 235 - }; 236 - 237 - /*----------------------------------------------------------------------*/ 238 - 239 - static struct device *add_child(struct i2c_client *client, const char *name, 240 - void *pdata, unsigned pdata_len, 241 - bool can_wakeup, int irq) 242 - { 243 - struct platform_device *pdev; 244 - int status; 245 - 246 - pdev = platform_device_alloc(name, -1); 247 - if (!pdev) 248 - return ERR_PTR(-ENOMEM); 249 - 250 - device_init_wakeup(&pdev->dev, can_wakeup); 251 - pdev->dev.parent = &client->dev; 252 - 253 - if (pdata) { 254 - status = platform_device_add_data(pdev, pdata, pdata_len); 255 - if (status < 0) { 256 - dev_dbg(&pdev->dev, "can't add platform_data\n"); 257 - goto put_device; 258 - } 259 - } 260 - 261 - if (irq) { 262 - struct resource r = { 263 - .start = irq, 264 - .flags = IORESOURCE_IRQ, 265 - }; 266 - 267 - status = platform_device_add_resources(pdev, &r, 1); 268 - if (status < 0) { 269 - dev_dbg(&pdev->dev, "can't add irq\n"); 270 - goto put_device; 271 - } 272 - } 273 - 274 - status = platform_device_add(pdev); 275 - if (status) 276 - goto put_device; 277 - 278 - return &pdev->dev; 279 - 280 - put_device: 281 - platform_device_put(pdev); 282 - dev_err(&client->dev, "failed to add device %s\n", name); 283 - return ERR_PTR(status); 284 - } 285 - 286 - static int add_children(struct i2c_client *client) 287 - { 288 - static const struct { 289 - int offset; 290 - char *label; 291 - } config_inputs[] = { 292 - /* 8 == right after the LEDs */ 293 - { 8 + 0, "sw6_1", }, 294 - { 8 + 1, "sw6_2", }, 295 - { 8 + 2, "sw6_3", }, 296 - { 8 + 3, "sw6_4", }, 297 - { 8 + 4, "NTSC/nPAL", }, 298 - }; 299 - 300 - struct device *child; 301 - int status; 302 - int i; 303 - 304 - /* GPIO-ish stuff */ 305 - dm355evm_msp_gpio.parent = &client->dev; 306 - status = gpiochip_add_data(&dm355evm_msp_gpio, NULL); 307 - if (status < 0) 308 - return status; 309 - 310 - /* LED output */ 311 - if (msp_has_leds()) { 312 - gpiod_add_lookup_table(&evm_leds_gpio_table); 313 - /* NOTE: these are the only fully programmable LEDs 314 - * on the board, since GPIO-61/ds22 (and many signals 315 - * going to DC7) must be used for AEMIF address lines 316 - * unless the top 1 GB of NAND is unused... 317 - */ 318 - child = add_child(client, "leds-gpio", 319 - &evm_led_data, sizeof(evm_led_data), 320 - false, 0); 321 - if (IS_ERR(child)) 322 - return PTR_ERR(child); 323 - } 324 - 325 - /* configuration inputs */ 326 - for (i = 0; i < ARRAY_SIZE(config_inputs); i++) { 327 - int gpio = dm355evm_msp_gpio.base + config_inputs[i].offset; 328 - 329 - gpio_request_one(gpio, GPIOF_IN, config_inputs[i].label); 330 - 331 - /* make it easy for userspace to see these */ 332 - gpio_export(gpio, false); 333 - } 334 - 335 - /* MMC/SD inputs -- right after the last config input */ 336 - if (dev_get_platdata(&client->dev)) { 337 - void (*mmcsd_setup)(unsigned) = dev_get_platdata(&client->dev); 338 - 339 - mmcsd_setup(dm355evm_msp_gpio.base + 8 + 5); 340 - } 341 - 342 - /* RTC is a 32 bit counter, no alarm */ 343 - if (msp_has_rtc()) { 344 - child = add_child(client, "rtc-dm355evm", 345 - NULL, 0, false, 0); 346 - if (IS_ERR(child)) 347 - return PTR_ERR(child); 348 - } 349 - 350 - /* input from buttons and IR remote (uses the IRQ) */ 351 - if (msp_has_keyboard()) { 352 - child = add_child(client, "dm355evm_keys", 353 - NULL, 0, true, client->irq); 354 - if (IS_ERR(child)) 355 - return PTR_ERR(child); 356 - } 357 - 358 - return 0; 359 - } 360 - 361 - /*----------------------------------------------------------------------*/ 362 - 363 - static void dm355evm_command(unsigned command) 364 - { 365 - int status; 366 - 367 - status = dm355evm_msp_write(command, DM355EVM_MSP_COMMAND); 368 - if (status < 0) 369 - dev_err(&msp430->dev, "command %d failure %d\n", 370 - command, status); 371 - } 372 - 373 - static void dm355evm_power_off(void) 374 - { 375 - dm355evm_command(MSP_COMMAND_POWEROFF); 376 - } 377 - 378 - static void dm355evm_msp_remove(struct i2c_client *client) 379 - { 380 - pm_power_off = NULL; 381 - msp430 = NULL; 382 - } 383 - 384 - static int 385 - dm355evm_msp_probe(struct i2c_client *client, const struct i2c_device_id *id) 386 - { 387 - int status; 388 - const char *video = msp_has_tvp() ? "TVP5146" : "imager"; 389 - 390 - if (msp430) 391 - return -EBUSY; 392 - msp430 = client; 393 - 394 - /* display revision status; doubles as sanity check */ 395 - status = dm355evm_msp_read(DM355EVM_MSP_FIRMREV); 396 - if (status < 0) 397 - goto fail; 398 - dev_info(&client->dev, "firmware v.%02X, %s as video-in\n", 399 - status, video); 400 - 401 - /* mux video input: either tvp5146 or some external imager */ 402 - status = dm355evm_msp_write(msp_has_tvp() ? 0 : MSP_VIDEO_IMAGER, 403 - DM355EVM_MSP_VIDEO_IN); 404 - if (status < 0) 405 - dev_warn(&client->dev, "error %d muxing %s as video-in\n", 406 - status, video); 407 - 408 - /* init LED cache, and turn off the LEDs */ 409 - msp_led_cache = 0xff; 410 - dm355evm_msp_write(msp_led_cache, DM355EVM_MSP_LED); 411 - 412 - /* export capabilities we support */ 413 - status = add_children(client); 414 - if (status < 0) 415 - goto fail; 416 - 417 - /* PM hookup */ 418 - pm_power_off = dm355evm_power_off; 419 - 420 - return 0; 421 - 422 - fail: 423 - /* FIXME remove children ... */ 424 - dm355evm_msp_remove(client); 425 - return status; 426 - } 427 - 428 - static const struct i2c_device_id dm355evm_msp_ids[] = { 429 - { "dm355evm_msp", 0 }, 430 - { /* end of list */ }, 431 - }; 432 - MODULE_DEVICE_TABLE(i2c, dm355evm_msp_ids); 433 - 434 - static struct i2c_driver dm355evm_msp_driver = { 435 - .driver.name = "dm355evm_msp", 436 - .id_table = dm355evm_msp_ids, 437 - .probe = dm355evm_msp_probe, 438 - .remove = dm355evm_msp_remove, 439 - }; 440 - 441 - static int __init dm355evm_msp_init(void) 442 - { 443 - return i2c_add_driver(&dm355evm_msp_driver); 444 - } 445 - subsys_initcall(dm355evm_msp_init); 446 - 447 - static void __exit dm355evm_msp_exit(void) 448 - { 449 - i2c_del_driver(&dm355evm_msp_driver); 450 - } 451 - module_exit(dm355evm_msp_exit); 452 - 453 - MODULE_DESCRIPTION("Interface to MSP430 firmware on DM355EVM"); 454 - MODULE_LICENSE("GPL");
+1 -3
drivers/mfd/fsl-imx25-tsadc.c
··· 137 137 { 138 138 struct device *dev = &pdev->dev; 139 139 struct mx25_tsadc *tsadc; 140 - struct resource *res; 141 140 int ret; 142 141 void __iomem *iomem; 143 142 ··· 144 145 if (!tsadc) 145 146 return -ENOMEM; 146 147 147 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 148 - iomem = devm_ioremap_resource(dev, res); 148 + iomem = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); 149 149 if (IS_ERR(iomem)) 150 150 return PTR_ERR(iomem); 151 151
+1 -2
drivers/mfd/gateworks-gsc.c
··· 189 189 .num_irqs = ARRAY_SIZE(gsc_irqs), 190 190 .num_regs = 1, 191 191 .status_base = GSC_IRQ_STATUS, 192 - .mask_base = GSC_IRQ_ENABLE, 193 - .mask_invert = true, 192 + .unmask_base = GSC_IRQ_ENABLE, 194 193 .ack_base = GSC_IRQ_STATUS, 195 194 .ack_invert = true, 196 195 };
-627
drivers/mfd/htc-i2cpld.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * htc-i2cpld.c 4 - * Chip driver for an unknown CPLD chip found on omap850 HTC devices like 5 - * the HTC Wizard and HTC Herald. 6 - * The cpld is located on the i2c bus and acts as an input/output GPIO 7 - * extender. 8 - * 9 - * Copyright (C) 2009 Cory Maccarrone <darkstar6262@gmail.com> 10 - * 11 - * Based on work done in the linwizard project 12 - * Copyright (C) 2008-2009 Angelo Arrifano <miknix@gmail.com> 13 - */ 14 - 15 - #include <linux/kernel.h> 16 - #include <linux/init.h> 17 - #include <linux/interrupt.h> 18 - #include <linux/platform_device.h> 19 - #include <linux/i2c.h> 20 - #include <linux/irq.h> 21 - #include <linux/spinlock.h> 22 - #include <linux/htcpld.h> 23 - #include <linux/gpio/driver.h> 24 - #include <linux/gpio/machine.h> 25 - #include <linux/gpio/consumer.h> 26 - #include <linux/slab.h> 27 - 28 - struct htcpld_chip { 29 - spinlock_t lock; 30 - 31 - /* chip info */ 32 - u8 reset; 33 - u8 addr; 34 - struct device *dev; 35 - struct i2c_client *client; 36 - 37 - /* Output details */ 38 - u8 cache_out; 39 - struct gpio_chip chip_out; 40 - 41 - /* Input details */ 42 - u8 cache_in; 43 - struct gpio_chip chip_in; 44 - 45 - u16 irqs_enabled; 46 - uint irq_start; 47 - int nirqs; 48 - 49 - unsigned int flow_type; 50 - /* 51 - * Work structure to allow for setting values outside of any 52 - * possible interrupt context 53 - */ 54 - struct work_struct set_val_work; 55 - }; 56 - 57 - struct htcpld_data { 58 - /* irq info */ 59 - u16 irqs_enabled; 60 - uint irq_start; 61 - int nirqs; 62 - uint chained_irq; 63 - struct gpio_desc *int_reset_gpio_hi; 64 - struct gpio_desc *int_reset_gpio_lo; 65 - 66 - /* htcpld info */ 67 - struct htcpld_chip *chip; 68 - unsigned int nchips; 69 - }; 70 - 71 - /* There does not appear to be a way to proactively mask interrupts 72 - * on the htcpld chip itself. So, we simply ignore interrupts that 73 - * aren't desired. */ 74 - static void htcpld_mask(struct irq_data *data) 75 - { 76 - struct htcpld_chip *chip = irq_data_get_irq_chip_data(data); 77 - chip->irqs_enabled &= ~(1 << (data->irq - chip->irq_start)); 78 - pr_debug("HTCPLD mask %d %04x\n", data->irq, chip->irqs_enabled); 79 - } 80 - static void htcpld_unmask(struct irq_data *data) 81 - { 82 - struct htcpld_chip *chip = irq_data_get_irq_chip_data(data); 83 - chip->irqs_enabled |= 1 << (data->irq - chip->irq_start); 84 - pr_debug("HTCPLD unmask %d %04x\n", data->irq, chip->irqs_enabled); 85 - } 86 - 87 - static int htcpld_set_type(struct irq_data *data, unsigned int flags) 88 - { 89 - struct htcpld_chip *chip = irq_data_get_irq_chip_data(data); 90 - 91 - if (flags & ~IRQ_TYPE_SENSE_MASK) 92 - return -EINVAL; 93 - 94 - /* We only allow edge triggering */ 95 - if (flags & (IRQ_TYPE_LEVEL_LOW|IRQ_TYPE_LEVEL_HIGH)) 96 - return -EINVAL; 97 - 98 - chip->flow_type = flags; 99 - return 0; 100 - } 101 - 102 - static struct irq_chip htcpld_muxed_chip = { 103 - .name = "htcpld", 104 - .irq_mask = htcpld_mask, 105 - .irq_unmask = htcpld_unmask, 106 - .irq_set_type = htcpld_set_type, 107 - }; 108 - 109 - /* To properly dispatch IRQ events, we need to read from the 110 - * chip. This is an I2C action that could possibly sleep 111 - * (which is bad in interrupt context) -- so we use a threaded 112 - * interrupt handler to get around that. 113 - */ 114 - static irqreturn_t htcpld_handler(int irq, void *dev) 115 - { 116 - struct htcpld_data *htcpld = dev; 117 - unsigned int i; 118 - unsigned long flags; 119 - int irqpin; 120 - 121 - if (!htcpld) { 122 - pr_debug("htcpld is null in ISR\n"); 123 - return IRQ_HANDLED; 124 - } 125 - 126 - /* 127 - * For each chip, do a read of the chip and trigger any interrupts 128 - * desired. The interrupts will be triggered from LSB to MSB (i.e. 129 - * bit 0 first, then bit 1, etc.) 130 - * 131 - * For chips that have no interrupt range specified, just skip 'em. 132 - */ 133 - for (i = 0; i < htcpld->nchips; i++) { 134 - struct htcpld_chip *chip = &htcpld->chip[i]; 135 - struct i2c_client *client; 136 - int val; 137 - unsigned long uval, old_val; 138 - 139 - if (!chip) { 140 - pr_debug("chip %d is null in ISR\n", i); 141 - continue; 142 - } 143 - 144 - if (chip->nirqs == 0) 145 - continue; 146 - 147 - client = chip->client; 148 - if (!client) { 149 - pr_debug("client %d is null in ISR\n", i); 150 - continue; 151 - } 152 - 153 - /* Scan the chip */ 154 - val = i2c_smbus_read_byte_data(client, chip->cache_out); 155 - if (val < 0) { 156 - /* Throw a warning and skip this chip */ 157 - dev_warn(chip->dev, "Unable to read from chip: %d\n", 158 - val); 159 - continue; 160 - } 161 - 162 - uval = (unsigned long)val; 163 - 164 - spin_lock_irqsave(&chip->lock, flags); 165 - 166 - /* Save away the old value so we can compare it */ 167 - old_val = chip->cache_in; 168 - 169 - /* Write the new value */ 170 - chip->cache_in = uval; 171 - 172 - spin_unlock_irqrestore(&chip->lock, flags); 173 - 174 - /* 175 - * For each bit in the data (starting at bit 0), trigger 176 - * associated interrupts. 177 - */ 178 - for (irqpin = 0; irqpin < chip->nirqs; irqpin++) { 179 - unsigned oldb, newb, type = chip->flow_type; 180 - 181 - irq = chip->irq_start + irqpin; 182 - 183 - /* Run the IRQ handler, but only if the bit value 184 - * changed, and the proper flags are set */ 185 - oldb = (old_val >> irqpin) & 1; 186 - newb = (uval >> irqpin) & 1; 187 - 188 - if ((!oldb && newb && (type & IRQ_TYPE_EDGE_RISING)) || 189 - (oldb && !newb && (type & IRQ_TYPE_EDGE_FALLING))) { 190 - pr_debug("fire IRQ %d\n", irqpin); 191 - generic_handle_irq(irq); 192 - } 193 - } 194 - } 195 - 196 - /* 197 - * In order to continue receiving interrupts, the int_reset_gpio must 198 - * be asserted. 199 - */ 200 - if (htcpld->int_reset_gpio_hi) 201 - gpiod_set_value(htcpld->int_reset_gpio_hi, 1); 202 - if (htcpld->int_reset_gpio_lo) 203 - gpiod_set_value(htcpld->int_reset_gpio_lo, 0); 204 - 205 - return IRQ_HANDLED; 206 - } 207 - 208 - /* 209 - * The GPIO set routines can be called from interrupt context, especially if, 210 - * for example they're attached to the led-gpio framework and a trigger is 211 - * enabled. As such, we declared work above in the htcpld_chip structure, 212 - * and that work is scheduled in the set routine. The kernel can then run 213 - * the I2C functions, which will sleep, in process context. 214 - */ 215 - static void htcpld_chip_set(struct gpio_chip *chip, unsigned offset, int val) 216 - { 217 - struct i2c_client *client; 218 - struct htcpld_chip *chip_data = gpiochip_get_data(chip); 219 - unsigned long flags; 220 - 221 - client = chip_data->client; 222 - if (!client) 223 - return; 224 - 225 - spin_lock_irqsave(&chip_data->lock, flags); 226 - if (val) 227 - chip_data->cache_out |= (1 << offset); 228 - else 229 - chip_data->cache_out &= ~(1 << offset); 230 - spin_unlock_irqrestore(&chip_data->lock, flags); 231 - 232 - schedule_work(&(chip_data->set_val_work)); 233 - } 234 - 235 - static void htcpld_chip_set_ni(struct work_struct *work) 236 - { 237 - struct htcpld_chip *chip_data; 238 - struct i2c_client *client; 239 - 240 - chip_data = container_of(work, struct htcpld_chip, set_val_work); 241 - client = chip_data->client; 242 - i2c_smbus_read_byte_data(client, chip_data->cache_out); 243 - } 244 - 245 - static int htcpld_chip_get(struct gpio_chip *chip, unsigned offset) 246 - { 247 - struct htcpld_chip *chip_data = gpiochip_get_data(chip); 248 - u8 cache; 249 - 250 - if (!strncmp(chip->label, "htcpld-out", 10)) { 251 - cache = chip_data->cache_out; 252 - } else if (!strncmp(chip->label, "htcpld-in", 9)) { 253 - cache = chip_data->cache_in; 254 - } else 255 - return -EINVAL; 256 - 257 - return (cache >> offset) & 1; 258 - } 259 - 260 - static int htcpld_direction_output(struct gpio_chip *chip, 261 - unsigned offset, int value) 262 - { 263 - htcpld_chip_set(chip, offset, value); 264 - return 0; 265 - } 266 - 267 - static int htcpld_direction_input(struct gpio_chip *chip, 268 - unsigned offset) 269 - { 270 - /* 271 - * No-op: this function can only be called on the input chip. 272 - * We do however make sure the offset is within range. 273 - */ 274 - return (offset < chip->ngpio) ? 0 : -EINVAL; 275 - } 276 - 277 - static int htcpld_chip_to_irq(struct gpio_chip *chip, unsigned offset) 278 - { 279 - struct htcpld_chip *chip_data = gpiochip_get_data(chip); 280 - 281 - if (offset < chip_data->nirqs) 282 - return chip_data->irq_start + offset; 283 - else 284 - return -EINVAL; 285 - } 286 - 287 - static void htcpld_chip_reset(struct i2c_client *client) 288 - { 289 - struct htcpld_chip *chip_data = i2c_get_clientdata(client); 290 - if (!chip_data) 291 - return; 292 - 293 - i2c_smbus_read_byte_data( 294 - client, (chip_data->cache_out = chip_data->reset)); 295 - } 296 - 297 - static int htcpld_setup_chip_irq( 298 - struct platform_device *pdev, 299 - int chip_index) 300 - { 301 - struct htcpld_data *htcpld; 302 - struct htcpld_chip *chip; 303 - unsigned int irq, irq_end; 304 - 305 - /* Get the platform and driver data */ 306 - htcpld = platform_get_drvdata(pdev); 307 - chip = &htcpld->chip[chip_index]; 308 - 309 - /* Setup irq handlers */ 310 - irq_end = chip->irq_start + chip->nirqs; 311 - for (irq = chip->irq_start; irq < irq_end; irq++) { 312 - irq_set_chip_and_handler(irq, &htcpld_muxed_chip, 313 - handle_simple_irq); 314 - irq_set_chip_data(irq, chip); 315 - irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE); 316 - } 317 - 318 - return 0; 319 - } 320 - 321 - static int htcpld_register_chip_i2c( 322 - struct platform_device *pdev, 323 - int chip_index) 324 - { 325 - struct htcpld_data *htcpld; 326 - struct device *dev = &pdev->dev; 327 - struct htcpld_core_platform_data *pdata; 328 - struct htcpld_chip *chip; 329 - struct htcpld_chip_platform_data *plat_chip_data; 330 - struct i2c_adapter *adapter; 331 - struct i2c_client *client; 332 - struct i2c_board_info info; 333 - 334 - /* Get the platform and driver data */ 335 - pdata = dev_get_platdata(dev); 336 - htcpld = platform_get_drvdata(pdev); 337 - chip = &htcpld->chip[chip_index]; 338 - plat_chip_data = &pdata->chip[chip_index]; 339 - 340 - adapter = i2c_get_adapter(pdata->i2c_adapter_id); 341 - if (!adapter) { 342 - /* Eek, no such I2C adapter! Bail out. */ 343 - dev_warn(dev, "Chip at i2c address 0x%x: Invalid i2c adapter %d\n", 344 - plat_chip_data->addr, pdata->i2c_adapter_id); 345 - return -ENODEV; 346 - } 347 - 348 - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA)) { 349 - dev_warn(dev, "i2c adapter %d non-functional\n", 350 - pdata->i2c_adapter_id); 351 - i2c_put_adapter(adapter); 352 - return -EINVAL; 353 - } 354 - 355 - memset(&info, 0, sizeof(struct i2c_board_info)); 356 - info.addr = plat_chip_data->addr; 357 - strscpy(info.type, "htcpld-chip", I2C_NAME_SIZE); 358 - info.platform_data = chip; 359 - 360 - /* Add the I2C device. This calls the probe() function. */ 361 - client = i2c_new_client_device(adapter, &info); 362 - if (IS_ERR(client)) { 363 - /* I2C device registration failed, contineu with the next */ 364 - dev_warn(dev, "Unable to add I2C device for 0x%x\n", 365 - plat_chip_data->addr); 366 - i2c_put_adapter(adapter); 367 - return PTR_ERR(client); 368 - } 369 - 370 - i2c_set_clientdata(client, chip); 371 - snprintf(client->name, I2C_NAME_SIZE, "Chip_0x%x", client->addr); 372 - chip->client = client; 373 - 374 - /* Reset the chip */ 375 - htcpld_chip_reset(client); 376 - chip->cache_in = i2c_smbus_read_byte_data(client, chip->cache_out); 377 - 378 - return 0; 379 - } 380 - 381 - static void htcpld_unregister_chip_i2c( 382 - struct platform_device *pdev, 383 - int chip_index) 384 - { 385 - struct htcpld_data *htcpld; 386 - struct htcpld_chip *chip; 387 - 388 - /* Get the platform and driver data */ 389 - htcpld = platform_get_drvdata(pdev); 390 - chip = &htcpld->chip[chip_index]; 391 - 392 - i2c_unregister_device(chip->client); 393 - } 394 - 395 - static int htcpld_register_chip_gpio( 396 - struct platform_device *pdev, 397 - int chip_index) 398 - { 399 - struct htcpld_data *htcpld; 400 - struct device *dev = &pdev->dev; 401 - struct htcpld_core_platform_data *pdata; 402 - struct htcpld_chip *chip; 403 - struct htcpld_chip_platform_data *plat_chip_data; 404 - struct gpio_chip *gpio_chip; 405 - int ret = 0; 406 - 407 - /* Get the platform and driver data */ 408 - pdata = dev_get_platdata(dev); 409 - htcpld = platform_get_drvdata(pdev); 410 - chip = &htcpld->chip[chip_index]; 411 - plat_chip_data = &pdata->chip[chip_index]; 412 - 413 - /* Setup the GPIO chips */ 414 - gpio_chip = &(chip->chip_out); 415 - gpio_chip->label = "htcpld-out"; 416 - gpio_chip->parent = dev; 417 - gpio_chip->owner = THIS_MODULE; 418 - gpio_chip->get = htcpld_chip_get; 419 - gpio_chip->set = htcpld_chip_set; 420 - gpio_chip->direction_input = NULL; 421 - gpio_chip->direction_output = htcpld_direction_output; 422 - gpio_chip->base = plat_chip_data->gpio_out_base; 423 - gpio_chip->ngpio = plat_chip_data->num_gpios; 424 - 425 - gpio_chip = &(chip->chip_in); 426 - gpio_chip->label = "htcpld-in"; 427 - gpio_chip->parent = dev; 428 - gpio_chip->owner = THIS_MODULE; 429 - gpio_chip->get = htcpld_chip_get; 430 - gpio_chip->set = NULL; 431 - gpio_chip->direction_input = htcpld_direction_input; 432 - gpio_chip->direction_output = NULL; 433 - gpio_chip->to_irq = htcpld_chip_to_irq; 434 - gpio_chip->base = plat_chip_data->gpio_in_base; 435 - gpio_chip->ngpio = plat_chip_data->num_gpios; 436 - 437 - /* Add the GPIO chips */ 438 - ret = gpiochip_add_data(&(chip->chip_out), chip); 439 - if (ret) { 440 - dev_warn(dev, "Unable to register output GPIOs for 0x%x: %d\n", 441 - plat_chip_data->addr, ret); 442 - return ret; 443 - } 444 - 445 - ret = gpiochip_add_data(&(chip->chip_in), chip); 446 - if (ret) { 447 - dev_warn(dev, "Unable to register input GPIOs for 0x%x: %d\n", 448 - plat_chip_data->addr, ret); 449 - gpiochip_remove(&(chip->chip_out)); 450 - return ret; 451 - } 452 - 453 - return 0; 454 - } 455 - 456 - static int htcpld_setup_chips(struct platform_device *pdev) 457 - { 458 - struct htcpld_data *htcpld; 459 - struct device *dev = &pdev->dev; 460 - struct htcpld_core_platform_data *pdata; 461 - int i; 462 - 463 - /* Get the platform and driver data */ 464 - pdata = dev_get_platdata(dev); 465 - htcpld = platform_get_drvdata(pdev); 466 - 467 - /* Setup each chip's output GPIOs */ 468 - htcpld->nchips = pdata->num_chip; 469 - htcpld->chip = devm_kcalloc(dev, 470 - htcpld->nchips, 471 - sizeof(struct htcpld_chip), 472 - GFP_KERNEL); 473 - if (!htcpld->chip) 474 - return -ENOMEM; 475 - 476 - /* Add the chips as best we can */ 477 - for (i = 0; i < htcpld->nchips; i++) { 478 - int ret; 479 - 480 - /* Setup the HTCPLD chips */ 481 - htcpld->chip[i].reset = pdata->chip[i].reset; 482 - htcpld->chip[i].cache_out = pdata->chip[i].reset; 483 - htcpld->chip[i].cache_in = 0; 484 - htcpld->chip[i].dev = dev; 485 - htcpld->chip[i].irq_start = pdata->chip[i].irq_base; 486 - htcpld->chip[i].nirqs = pdata->chip[i].num_irqs; 487 - 488 - INIT_WORK(&(htcpld->chip[i].set_val_work), &htcpld_chip_set_ni); 489 - spin_lock_init(&(htcpld->chip[i].lock)); 490 - 491 - /* Setup the interrupts for the chip */ 492 - if (htcpld->chained_irq) { 493 - ret = htcpld_setup_chip_irq(pdev, i); 494 - if (ret) 495 - continue; 496 - } 497 - 498 - /* Register the chip with I2C */ 499 - ret = htcpld_register_chip_i2c(pdev, i); 500 - if (ret) 501 - continue; 502 - 503 - 504 - /* Register the chips with the GPIO subsystem */ 505 - ret = htcpld_register_chip_gpio(pdev, i); 506 - if (ret) { 507 - /* Unregister the chip from i2c and continue */ 508 - htcpld_unregister_chip_i2c(pdev, i); 509 - continue; 510 - } 511 - 512 - dev_info(dev, "Registered chip at 0x%x\n", pdata->chip[i].addr); 513 - } 514 - 515 - return 0; 516 - } 517 - 518 - static int htcpld_core_probe(struct platform_device *pdev) 519 - { 520 - struct htcpld_data *htcpld; 521 - struct device *dev = &pdev->dev; 522 - struct htcpld_core_platform_data *pdata; 523 - struct resource *res; 524 - int ret = 0; 525 - 526 - if (!dev) 527 - return -ENODEV; 528 - 529 - pdata = dev_get_platdata(dev); 530 - if (!pdata) { 531 - dev_warn(dev, "Platform data not found for htcpld core!\n"); 532 - return -ENXIO; 533 - } 534 - 535 - htcpld = devm_kzalloc(dev, sizeof(struct htcpld_data), GFP_KERNEL); 536 - if (!htcpld) 537 - return -ENOMEM; 538 - 539 - /* Find chained irq */ 540 - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 541 - if (res) { 542 - int flags; 543 - htcpld->chained_irq = res->start; 544 - 545 - /* Setup the chained interrupt handler */ 546 - flags = IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | 547 - IRQF_ONESHOT; 548 - ret = request_threaded_irq(htcpld->chained_irq, 549 - NULL, htcpld_handler, 550 - flags, pdev->name, htcpld); 551 - if (ret) { 552 - dev_warn(dev, "Unable to setup chained irq handler: %d\n", ret); 553 - return ret; 554 - } else 555 - device_init_wakeup(dev, 0); 556 - } 557 - 558 - /* Set the driver data */ 559 - platform_set_drvdata(pdev, htcpld); 560 - 561 - /* Setup the htcpld chips */ 562 - ret = htcpld_setup_chips(pdev); 563 - if (ret) 564 - return ret; 565 - 566 - /* Request the GPIO(s) for the int reset and set them up */ 567 - htcpld->int_reset_gpio_hi = gpiochip_request_own_desc(&htcpld->chip[2].chip_out, 568 - 7, "htcpld-core", GPIO_ACTIVE_HIGH, 569 - GPIOD_OUT_HIGH); 570 - if (IS_ERR(htcpld->int_reset_gpio_hi)) { 571 - /* 572 - * If it failed, that sucks, but we can probably 573 - * continue on without it. 574 - */ 575 - htcpld->int_reset_gpio_hi = NULL; 576 - dev_warn(dev, "Unable to request int_reset_gpio_hi -- interrupts may not work\n"); 577 - } 578 - 579 - htcpld->int_reset_gpio_lo = gpiochip_request_own_desc(&htcpld->chip[2].chip_out, 580 - 0, "htcpld-core", GPIO_ACTIVE_HIGH, 581 - GPIOD_OUT_LOW); 582 - if (IS_ERR(htcpld->int_reset_gpio_lo)) { 583 - /* 584 - * If it failed, that sucks, but we can probably 585 - * continue on without it. 586 - */ 587 - htcpld->int_reset_gpio_lo = NULL; 588 - dev_warn(dev, "Unable to request int_reset_gpio_lo -- interrupts may not work\n"); 589 - } 590 - 591 - dev_info(dev, "Initialized successfully\n"); 592 - return 0; 593 - } 594 - 595 - /* The I2C Driver -- used internally */ 596 - static const struct i2c_device_id htcpld_chip_id[] = { 597 - { "htcpld-chip", 0 }, 598 - { } 599 - }; 600 - 601 - static struct i2c_driver htcpld_chip_driver = { 602 - .driver = { 603 - .name = "htcpld-chip", 604 - }, 605 - .id_table = htcpld_chip_id, 606 - }; 607 - 608 - /* The Core Driver */ 609 - static struct platform_driver htcpld_core_driver = { 610 - .driver = { 611 - .name = "i2c-htcpld", 612 - }, 613 - }; 614 - 615 - static int __init htcpld_core_init(void) 616 - { 617 - int ret; 618 - 619 - /* Register the I2C Chip driver */ 620 - ret = i2c_add_driver(&htcpld_chip_driver); 621 - if (ret) 622 - return ret; 623 - 624 - /* Probe for our chips */ 625 - return platform_driver_probe(&htcpld_core_driver, htcpld_core_probe); 626 - } 627 - device_initcall(htcpld_core_init);
+2 -3
drivers/mfd/khadas-mcu.c
··· 84 84 { .name = "khadas-mcu-user-mem", }, 85 85 }; 86 86 87 - static int khadas_mcu_probe(struct i2c_client *client, 88 - const struct i2c_device_id *id) 87 + static int khadas_mcu_probe(struct i2c_client *client) 89 88 { 90 89 struct device *dev = &client->dev; 91 90 struct khadas_mcu *ddata; ··· 134 135 .name = "khadas-mcu-core", 135 136 .of_match_table = of_match_ptr(khadas_mcu_of_match), 136 137 }, 137 - .probe = khadas_mcu_probe, 138 + .probe_new = khadas_mcu_probe, 138 139 }; 139 140 module_i2c_driver(khadas_mcu_driver); 140 141
+2 -3
drivers/mfd/lm3533-core.c
··· 584 584 .precious_reg = lm3533_precious_register, 585 585 }; 586 586 587 - static int lm3533_i2c_probe(struct i2c_client *i2c, 588 - const struct i2c_device_id *id) 587 + static int lm3533_i2c_probe(struct i2c_client *i2c) 589 588 { 590 589 struct lm3533 *lm3533; 591 590 ··· 626 627 .name = "lm3533", 627 628 }, 628 629 .id_table = lm3533_i2c_ids, 629 - .probe = lm3533_i2c_probe, 630 + .probe_new = lm3533_i2c_probe, 630 631 .remove = lm3533_i2c_remove, 631 632 }; 632 633
+2 -2
drivers/mfd/lp3943.c
··· 102 102 .max_register = LP3943_MAX_REGISTERS, 103 103 }; 104 104 105 - static int lp3943_probe(struct i2c_client *cl, const struct i2c_device_id *id) 105 + static int lp3943_probe(struct i2c_client *cl) 106 106 { 107 107 struct lp3943 *lp3943; 108 108 struct device *dev = &cl->dev; ··· 140 140 #endif 141 141 142 142 static struct i2c_driver lp3943_driver = { 143 - .probe = lp3943_probe, 143 + .probe_new = lp3943_probe, 144 144 .driver = { 145 145 .name = "lp3943", 146 146 .of_match_table = of_match_ptr(lp3943_of_match),
+2 -3
drivers/mfd/lp873x.c
··· 24 24 { .name = "lp873x-gpio", }, 25 25 }; 26 26 27 - static int lp873x_probe(struct i2c_client *client, 28 - const struct i2c_device_id *ids) 27 + static int lp873x_probe(struct i2c_client *client) 29 28 { 30 29 struct lp873x *lp873; 31 30 int ret; ··· 78 79 .name = "lp873x", 79 80 .of_match_table = of_lp873x_match_table, 80 81 }, 81 - .probe = lp873x_probe, 82 + .probe_new = lp873x_probe, 82 83 .id_table = lp873x_id_table, 83 84 }; 84 85 module_i2c_driver(lp873x_driver);
+2 -3
drivers/mfd/lp87565.c
··· 43 43 }; 44 44 MODULE_DEVICE_TABLE(of, of_lp87565_match_table); 45 45 46 - static int lp87565_probe(struct i2c_client *client, 47 - const struct i2c_device_id *ids) 46 + static int lp87565_probe(struct i2c_client *client) 48 47 { 49 48 struct lp87565 *lp87565; 50 49 const struct of_device_id *of_id; ··· 119 120 .name = "lp87565", 120 121 .of_match_table = of_lp87565_match_table, 121 122 }, 122 - .probe = lp87565_probe, 123 + .probe_new = lp87565_probe, 123 124 .shutdown = lp87565_shutdown, 124 125 .id_table = lp87565_id_table, 125 126 };
+2 -2
drivers/mfd/lp8788.c
··· 166 166 .max_register = MAX_LP8788_REGISTERS, 167 167 }; 168 168 169 - static int lp8788_probe(struct i2c_client *cl, const struct i2c_device_id *id) 169 + static int lp8788_probe(struct i2c_client *cl) 170 170 { 171 171 struct lp8788 *lp; 172 172 struct lp8788_platform_data *pdata = dev_get_platdata(&cl->dev); ··· 225 225 .driver = { 226 226 .name = "lp8788", 227 227 }, 228 - .probe = lp8788_probe, 228 + .probe_new = lp8788_probe, 229 229 .remove = lp8788_remove, 230 230 .id_table = lp8788_ids, 231 231 };
+1 -2
drivers/mfd/madera-core.c
··· 8 8 #include <linux/device.h> 9 9 #include <linux/delay.h> 10 10 #include <linux/err.h> 11 - #include <linux/gpio.h> 11 + #include <linux/gpio/consumer.h> 12 12 #include <linux/mfd/core.h> 13 13 #include <linux/module.h> 14 14 #include <linux/mutex.h> 15 15 #include <linux/notifier.h> 16 16 #include <linux/of.h> 17 - #include <linux/of_gpio.h> 18 17 #include <linux/platform_device.h> 19 18 #include <linux/pm_runtime.h> 20 19 #include <linux/regmap.h>
+3 -3
drivers/mfd/madera-i2c.c
··· 17 17 18 18 #include "madera.h" 19 19 20 - static int madera_i2c_probe(struct i2c_client *i2c, 21 - const struct i2c_device_id *id) 20 + static int madera_i2c_probe(struct i2c_client *i2c) 22 21 { 22 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 23 23 struct madera *madera; 24 24 const struct regmap_config *regmap_16bit_config = NULL; 25 25 const struct regmap_config *regmap_32bit_config = NULL; ··· 139 139 .pm = &madera_pm_ops, 140 140 .of_match_table = of_match_ptr(madera_of_match), 141 141 }, 142 - .probe = madera_i2c_probe, 142 + .probe_new = madera_i2c_probe, 143 143 .remove = madera_i2c_remove, 144 144 .id_table = madera_i2c_id, 145 145 };
+7 -12
drivers/mfd/max14577.c
··· 209 209 static const struct regmap_irq_chip max14577_irq_chip = { 210 210 .name = "max14577", 211 211 .status_base = MAX14577_REG_INT1, 212 - .mask_base = MAX14577_REG_INTMASK1, 213 - .mask_invert = true, 212 + .unmask_base = MAX14577_REG_INTMASK1, 214 213 .num_regs = 3, 215 214 .irqs = max14577_irqs, 216 215 .num_irqs = ARRAY_SIZE(max14577_irqs), ··· 238 239 static const struct regmap_irq_chip max77836_muic_irq_chip = { 239 240 .name = "max77836-muic", 240 241 .status_base = MAX14577_REG_INT1, 241 - .mask_base = MAX14577_REG_INTMASK1, 242 - .mask_invert = true, 242 + .unmask_base = MAX14577_REG_INTMASK1, 243 243 .num_regs = 3, 244 244 .irqs = max77836_muic_irqs, 245 245 .num_irqs = ARRAY_SIZE(max77836_muic_irqs), ··· 253 255 .name = "max77836-pmic", 254 256 .status_base = MAX77836_PMIC_REG_TOPSYS_INT, 255 257 .mask_base = MAX77836_PMIC_REG_TOPSYS_INT_MASK, 256 - .mask_invert = false, 257 258 .num_regs = 1, 258 259 .irqs = max77836_pmic_irqs, 259 260 .num_irqs = ARRAY_SIZE(max77836_pmic_irqs), ··· 355 358 i2c_unregister_device(max14577->i2c_pmic); 356 359 } 357 360 358 - static int max14577_i2c_probe(struct i2c_client *i2c, 359 - const struct i2c_device_id *id) 361 + static int max14577_i2c_probe(struct i2c_client *i2c) 360 362 { 363 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 361 364 struct max14577 *max14577; 362 365 struct max14577_platform_data *pdata = dev_get_platdata(&i2c->dev); 363 366 struct device_node *np = i2c->dev.of_node; ··· 477 480 }; 478 481 MODULE_DEVICE_TABLE(i2c, max14577_i2c_id); 479 482 480 - #ifdef CONFIG_PM_SLEEP 481 483 static int max14577_suspend(struct device *dev) 482 484 { 483 485 struct i2c_client *i2c = to_i2c_client(dev); ··· 509 513 510 514 return 0; 511 515 } 512 - #endif /* CONFIG_PM_SLEEP */ 513 516 514 - static SIMPLE_DEV_PM_OPS(max14577_pm, max14577_suspend, max14577_resume); 517 + static DEFINE_SIMPLE_DEV_PM_OPS(max14577_pm, max14577_suspend, max14577_resume); 515 518 516 519 static struct i2c_driver max14577_i2c_driver = { 517 520 .driver = { 518 521 .name = "max14577", 519 - .pm = &max14577_pm, 522 + .pm = pm_sleep_ptr(&max14577_pm), 520 523 .of_match_table = max14577_dt_match, 521 524 }, 522 - .probe = max14577_i2c_probe, 525 + .probe_new = max14577_i2c_probe, 523 526 .remove = max14577_i2c_remove, 524 527 .id_table = max14577_i2c_id, 525 528 };
+6 -9
drivers/mfd/max77620.c
··· 494 494 MAX77620_ONOFFCNFG1_SFT_RST); 495 495 } 496 496 497 - static int max77620_probe(struct i2c_client *client, 498 - const struct i2c_device_id *id) 497 + static int max77620_probe(struct i2c_client *client) 499 498 { 499 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 500 500 const struct regmap_config *rmap_config; 501 501 struct max77620_chip *chip; 502 502 const struct mfd_cell *mfd_cells; ··· 576 576 return 0; 577 577 } 578 578 579 - #ifdef CONFIG_PM_SLEEP 580 579 static int max77620_set_fps_period(struct max77620_chip *chip, 581 580 int fps_id, int time_period) 582 581 { ··· 682 683 683 684 return 0; 684 685 } 685 - #endif 686 686 687 687 static const struct i2c_device_id max77620_id[] = { 688 688 {"max77620", MAX77620}, ··· 690 692 {}, 691 693 }; 692 694 693 - static const struct dev_pm_ops max77620_pm_ops = { 694 - SET_SYSTEM_SLEEP_PM_OPS(max77620_i2c_suspend, max77620_i2c_resume) 695 - }; 695 + static DEFINE_SIMPLE_DEV_PM_OPS(max77620_pm_ops, 696 + max77620_i2c_suspend, max77620_i2c_resume); 696 697 697 698 static struct i2c_driver max77620_driver = { 698 699 .driver = { 699 700 .name = "max77620", 700 - .pm = &max77620_pm_ops, 701 + .pm = pm_sleep_ptr(&max77620_pm_ops), 701 702 }, 702 - .probe = max77620_probe, 703 + .probe_new = max77620_probe, 703 704 .id_table = max77620_id, 704 705 }; 705 706 builtin_i2c_driver(max77620_driver);
-1
drivers/mfd/max77650.c
··· 138 138 .status_base = MAX77650_REG_INT_GLBL, 139 139 .mask_base = MAX77650_REG_INTM_GLBL, 140 140 .type_in_mask = true, 141 - .type_invert = true, 142 141 .init_ack_masked = true, 143 142 .clear_on_unmask = true, 144 143 };
+2 -4
drivers/mfd/max77686.c
··· 226 226 return 0; 227 227 } 228 228 229 - #ifdef CONFIG_PM_SLEEP 230 229 static int max77686_suspend(struct device *dev) 231 230 { 232 231 struct i2c_client *i2c = to_i2c_client(dev); ··· 260 261 261 262 return 0; 262 263 } 263 - #endif /* CONFIG_PM_SLEEP */ 264 264 265 - static SIMPLE_DEV_PM_OPS(max77686_pm, max77686_suspend, max77686_resume); 265 + static DEFINE_SIMPLE_DEV_PM_OPS(max77686_pm, max77686_suspend, max77686_resume); 266 266 267 267 static struct i2c_driver max77686_i2c_driver = { 268 268 .driver = { 269 269 .name = "max77686", 270 - .pm = &max77686_pm, 270 + .pm = pm_sleep_ptr(&max77686_pm), 271 271 .of_match_table = max77686_pmic_dt_match, 272 272 }, 273 273 .probe_new = max77686_i2c_probe,
+4 -8
drivers/mfd/max77693.c
··· 66 66 .name = "max77693-led", 67 67 .status_base = MAX77693_LED_REG_FLASH_INT, 68 68 .mask_base = MAX77693_LED_REG_FLASH_INT_MASK, 69 - .mask_invert = false, 70 69 .num_regs = 1, 71 70 .irqs = max77693_led_irqs, 72 71 .num_irqs = ARRAY_SIZE(max77693_led_irqs), ··· 81 82 .name = "max77693-topsys", 82 83 .status_base = MAX77693_PMIC_REG_TOPSYS_INT, 83 84 .mask_base = MAX77693_PMIC_REG_TOPSYS_INT_MASK, 84 - .mask_invert = false, 85 85 .num_regs = 1, 86 86 .irqs = max77693_topsys_irqs, 87 87 .num_irqs = ARRAY_SIZE(max77693_topsys_irqs), ··· 98 100 .name = "max77693-charger", 99 101 .status_base = MAX77693_CHG_REG_CHG_INT, 100 102 .mask_base = MAX77693_CHG_REG_CHG_INT_MASK, 101 - .mask_invert = false, 102 103 .num_regs = 1, 103 104 .irqs = max77693_charger_irqs, 104 105 .num_irqs = ARRAY_SIZE(max77693_charger_irqs), ··· 133 136 static const struct regmap_irq_chip max77693_muic_irq_chip = { 134 137 .name = "max77693-muic", 135 138 .status_base = MAX77693_MUIC_REG_INT1, 136 - .mask_base = MAX77693_MUIC_REG_INTMASK1, 137 - .mask_invert = true, 139 + .unmask_base = MAX77693_MUIC_REG_INTMASK1, 138 140 .num_regs = 3, 139 141 .irqs = max77693_muic_irqs, 140 142 .num_irqs = ARRAY_SIZE(max77693_muic_irqs), ··· 145 149 .max_register = MAX77693_HAPTIC_REG_END, 146 150 }; 147 151 148 - static int max77693_i2c_probe(struct i2c_client *i2c, 149 - const struct i2c_device_id *id) 152 + static int max77693_i2c_probe(struct i2c_client *i2c) 150 153 { 154 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 151 155 struct max77693_dev *max77693; 152 156 unsigned int reg_data; 153 157 int ret = 0; ··· 356 360 .pm = &max77693_pm, 357 361 .of_match_table = of_match_ptr(max77693_dt_match), 358 362 }, 359 - .probe = max77693_i2c_probe, 363 + .probe_new = max77693_i2c_probe, 360 364 .remove = max77693_i2c_remove, 361 365 .id_table = max77693_i2c_id, 362 366 };
+3 -4
drivers/mfd/max77843.c
··· 59 59 .name = "max77843", 60 60 .status_base = MAX77843_SYS_REG_SYSINTSRC, 61 61 .mask_base = MAX77843_SYS_REG_SYSINTMASK, 62 - .mask_invert = false, 63 62 .num_regs = 1, 64 63 .irqs = max77843_irqs, 65 64 .num_irqs = ARRAY_SIZE(max77843_irqs), ··· 92 93 return ret; 93 94 } 94 95 95 - static int max77843_probe(struct i2c_client *i2c, 96 - const struct i2c_device_id *id) 96 + static int max77843_probe(struct i2c_client *i2c) 97 97 { 98 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 98 99 struct max77693_dev *max77843; 99 100 unsigned int reg_data; 100 101 int ret; ··· 207 208 .of_match_table = max77843_dt_match, 208 209 .suppress_bind_attrs = true, 209 210 }, 210 - .probe = max77843_probe, 211 + .probe_new = max77843_probe, 211 212 .id_table = max77843_id, 212 213 }; 213 214
+2 -3
drivers/mfd/max8907.c
··· 181 181 MAX8907_MASK_POWER_OFF, MAX8907_MASK_POWER_OFF); 182 182 } 183 183 184 - static int max8907_i2c_probe(struct i2c_client *i2c, 185 - const struct i2c_device_id *id) 184 + static int max8907_i2c_probe(struct i2c_client *i2c) 186 185 { 187 186 struct max8907 *max8907; 188 187 int ret; ··· 313 314 .name = "max8907", 314 315 .of_match_table = of_match_ptr(max8907_of_match), 315 316 }, 316 - .probe = max8907_i2c_probe, 317 + .probe_new = max8907_i2c_probe, 317 318 .remove = max8907_i2c_remove, 318 319 .id_table = max8907_i2c_id, 319 320 };
+5 -7
drivers/mfd/max8925-i2c.c
··· 144 144 return 0; 145 145 } 146 146 147 - static int max8925_probe(struct i2c_client *client, 148 - const struct i2c_device_id *id) 147 + static int max8925_probe(struct i2c_client *client) 149 148 { 150 149 struct max8925_platform_data *pdata = dev_get_platdata(&client->dev); 151 150 struct max8925_chip *chip; ··· 206 207 i2c_unregister_device(chip->rtc); 207 208 } 208 209 209 - #ifdef CONFIG_PM_SLEEP 210 210 static int max8925_suspend(struct device *dev) 211 211 { 212 212 struct i2c_client *client = to_i2c_client(dev); ··· 225 227 disable_irq_wake(chip->core_irq); 226 228 return 0; 227 229 } 228 - #endif 229 230 230 - static SIMPLE_DEV_PM_OPS(max8925_pm_ops, max8925_suspend, max8925_resume); 231 + static DEFINE_SIMPLE_DEV_PM_OPS(max8925_pm_ops, 232 + max8925_suspend, max8925_resume); 231 233 232 234 static const struct of_device_id max8925_dt_ids[] = { 233 235 { .compatible = "maxim,max8925", }, ··· 237 239 static struct i2c_driver max8925_driver = { 238 240 .driver = { 239 241 .name = "max8925", 240 - .pm = &max8925_pm_ops, 242 + .pm = pm_sleep_ptr(&max8925_pm_ops), 241 243 .of_match_table = max8925_dt_ids, 242 244 }, 243 - .probe = max8925_probe, 245 + .probe_new = max8925_probe, 244 246 .remove = max8925_remove, 245 247 .id_table = max8925_id_table, 246 248 };
+3 -3
drivers/mfd/max8997.c
··· 152 152 return id->driver_data; 153 153 } 154 154 155 - static int max8997_i2c_probe(struct i2c_client *i2c, 156 - const struct i2c_device_id *id) 155 + static int max8997_i2c_probe(struct i2c_client *i2c) 157 156 { 157 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 158 158 struct max8997_dev *max8997; 159 159 struct max8997_platform_data *pdata = dev_get_platdata(&i2c->dev); 160 160 int ret = 0; ··· 478 478 .suppress_bind_attrs = true, 479 479 .of_match_table = of_match_ptr(max8997_pmic_dt_match), 480 480 }, 481 - .probe = max8997_i2c_probe, 481 + .probe_new = max8997_i2c_probe, 482 482 .id_table = max8997_i2c_id, 483 483 }; 484 484
+3 -3
drivers/mfd/max8998.c
··· 162 162 return id->driver_data; 163 163 } 164 164 165 - static int max8998_i2c_probe(struct i2c_client *i2c, 166 - const struct i2c_device_id *id) 165 + static int max8998_i2c_probe(struct i2c_client *i2c) 167 166 { 167 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 168 168 struct max8998_platform_data *pdata = dev_get_platdata(&i2c->dev); 169 169 struct max8998_dev *max8998; 170 170 int ret = 0; ··· 348 348 .suppress_bind_attrs = true, 349 349 .of_match_table = of_match_ptr(max8998_dt_match), 350 350 }, 351 - .probe = max8998_i2c_probe, 351 + .probe_new = max8998_i2c_probe, 352 352 .id_table = max8998_i2c_id, 353 353 }; 354 354
+3 -4
drivers/mfd/mc13xxx-i2c.c
··· 11 11 #include <linux/mfd/mc13xxx.h> 12 12 #include <linux/of.h> 13 13 #include <linux/of_device.h> 14 - #include <linux/of_gpio.h> 15 14 #include <linux/i2c.h> 16 15 #include <linux/err.h> 17 16 ··· 51 52 .cache_type = REGCACHE_NONE, 52 53 }; 53 54 54 - static int mc13xxx_i2c_probe(struct i2c_client *client, 55 - const struct i2c_device_id *id) 55 + static int mc13xxx_i2c_probe(struct i2c_client *client) 56 56 { 57 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 57 58 struct mc13xxx *mc13xxx; 58 59 int ret; 59 60 ··· 95 96 .name = "mc13xxx", 96 97 .of_match_table = mc13xxx_dt_ids, 97 98 }, 98 - .probe = mc13xxx_i2c_probe, 99 + .probe_new = mc13xxx_i2c_probe, 99 100 .remove = mc13xxx_i2c_remove, 100 101 }; 101 102
+1 -2
drivers/mfd/mc13xxx-spi.c
··· 15 15 #include <linux/mfd/mc13xxx.h> 16 16 #include <linux/of.h> 17 17 #include <linux/of_device.h> 18 - #include <linux/of_gpio.h> 19 18 #include <linux/err.h> 20 19 #include <linux/spi/spi.h> 21 20 ··· 114 115 * result, the SS will negate before all of the data has been 115 116 * transferred to/from the peripheral." 116 117 * We workaround this by accessing the SPI controller with a 117 - * single transfert. 118 + * single transfer. 118 119 */ 119 120 120 121 static struct regmap_bus regmap_mc13xxx_bus = {
+1 -5
drivers/mfd/mcp-sa11x0.c
··· 255 255 return 0; 256 256 } 257 257 258 - #ifdef CONFIG_PM_SLEEP 259 258 static int mcp_sa11x0_suspend(struct device *dev) 260 259 { 261 260 struct mcp_sa11x0 *m = priv(dev_get_drvdata(dev)); ··· 276 277 277 278 return 0; 278 279 } 279 - #endif 280 280 281 281 static const struct dev_pm_ops mcp_sa11x0_pm_ops = { 282 - #ifdef CONFIG_PM_SLEEP 283 282 .suspend = mcp_sa11x0_suspend, 284 283 .freeze = mcp_sa11x0_suspend, 285 284 .poweroff = mcp_sa11x0_suspend, 286 285 .resume_noirq = mcp_sa11x0_resume, 287 286 .thaw_noirq = mcp_sa11x0_resume, 288 287 .restore_noirq = mcp_sa11x0_resume, 289 - #endif 290 288 }; 291 289 292 290 static struct platform_driver mcp_sa11x0_driver = { ··· 291 295 .remove = mcp_sa11x0_remove, 292 296 .driver = { 293 297 .name = DRIVER_NAME, 294 - .pm = &mcp_sa11x0_pm_ops, 298 + .pm = pm_sleep_ptr(&mcp_sa11x0_pm_ops), 295 299 }, 296 300 }; 297 301
+2 -3
drivers/mfd/menelaus.c
··· 1142 1142 1143 1143 static struct i2c_driver menelaus_i2c_driver; 1144 1144 1145 - static int menelaus_probe(struct i2c_client *client, 1146 - const struct i2c_device_id *id) 1145 + static int menelaus_probe(struct i2c_client *client) 1147 1146 { 1148 1147 struct menelaus_chip *menelaus; 1149 1148 int rev = 0; ··· 1240 1241 .driver = { 1241 1242 .name = DRIVER_NAME, 1242 1243 }, 1243 - .probe = menelaus_probe, 1244 + .probe_new = menelaus_probe, 1244 1245 .remove = menelaus_remove, 1245 1246 .id_table = menelaus_id, 1246 1247 };
+2 -2
drivers/mfd/menf21bmc.c
··· 49 49 } 50 50 51 51 static int 52 - menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids) 52 + menf21bmc_probe(struct i2c_client *client) 53 53 { 54 54 int rev_major, rev_minor, rev_main; 55 55 int ret; ··· 111 111 static struct i2c_driver menf21bmc_driver = { 112 112 .driver.name = "menf21bmc", 113 113 .id_table = menf21bmc_id_table, 114 - .probe = menf21bmc_probe, 114 + .probe_new = menf21bmc_probe, 115 115 }; 116 116 117 117 module_i2c_driver(menf21bmc_driver);
+3 -5
drivers/mfd/motorola-cpcap.c
··· 221 221 .val_format_endian = REGMAP_ENDIAN_LITTLE, 222 222 }; 223 223 224 - #ifdef CONFIG_PM_SLEEP 225 224 static int cpcap_suspend(struct device *dev) 226 225 { 227 226 struct spi_device *spi = to_spi_device(dev); ··· 238 239 239 240 return 0; 240 241 } 241 - #endif 242 242 243 - static SIMPLE_DEV_PM_OPS(cpcap_pm, cpcap_suspend, cpcap_resume); 243 + static DEFINE_SIMPLE_DEV_PM_OPS(cpcap_pm, cpcap_suspend, cpcap_resume); 244 244 245 245 static const struct mfd_cell cpcap_mfd_devices[] = { 246 246 { ··· 294 296 struct cpcap_ddata *cpcap; 295 297 int ret; 296 298 297 - match = of_match_device(of_match_ptr(cpcap_of_match), &spi->dev); 299 + match = of_match_device(cpcap_of_match, &spi->dev); 298 300 if (!match) 299 301 return -ENODEV; 300 302 ··· 344 346 .driver = { 345 347 .name = "cpcap-core", 346 348 .of_match_table = cpcap_of_match, 347 - .pm = &cpcap_pm, 349 + .pm = pm_sleep_ptr(&cpcap_pm), 348 350 }, 349 351 .probe = cpcap_probe, 350 352 .id_table = cpcap_spi_ids,
+12 -2
drivers/mfd/mt6360-core.c
··· 402 402 struct mt6360_ddata *ddata = context; 403 403 u8 bank = *(u8 *)reg; 404 404 u8 reg_addr = *(u8 *)(reg + 1); 405 - struct i2c_client *i2c = ddata->i2c[bank]; 405 + struct i2c_client *i2c; 406 406 bool crc_needed = false; 407 407 u8 *buf; 408 408 int buf_len = MT6360_ALLOC_READ_SIZE(val_size); 409 409 int read_size = val_size; 410 410 u8 crc; 411 411 int ret; 412 + 413 + if (bank >= MT6360_SLAVE_MAX) 414 + return -EINVAL; 415 + 416 + i2c = ddata->i2c[bank]; 412 417 413 418 if (bank == MT6360_SLAVE_PMIC || bank == MT6360_SLAVE_LDO) { 414 419 crc_needed = true; ··· 458 453 struct mt6360_ddata *ddata = context; 459 454 u8 bank = *(u8 *)val; 460 455 u8 reg_addr = *(u8 *)(val + 1); 461 - struct i2c_client *i2c = ddata->i2c[bank]; 456 + struct i2c_client *i2c; 462 457 bool crc_needed = false; 463 458 u8 *buf; 464 459 int buf_len = MT6360_ALLOC_WRITE_SIZE(val_size); 465 460 int write_size = val_size - MT6360_REGMAP_REG_BYTE_SIZE; 466 461 int ret; 462 + 463 + if (bank >= MT6360_SLAVE_MAX) 464 + return -EINVAL; 465 + 466 + i2c = ddata->i2c[bank]; 467 467 468 468 if (bank == MT6360_SLAVE_PMIC || bank == MT6360_SLAVE_LDO) { 469 469 crc_needed = true;
+1 -5
drivers/mfd/mt6397-irq.c
··· 54 54 mt6397->irq_masks_cur[reg] |= BIT(shift); 55 55 } 56 56 57 - #ifdef CONFIG_PM_SLEEP 58 57 static int mt6397_irq_set_wake(struct irq_data *irq_data, unsigned int on) 59 58 { 60 59 struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(irq_data); ··· 67 68 68 69 return 0; 69 70 } 70 - #else 71 - #define mt6397_irq_set_wake NULL 72 - #endif 73 71 74 72 static struct irq_chip mt6397_irq_chip = { 75 73 .name = "mt6397-irq", ··· 74 78 .irq_bus_sync_unlock = mt6397_irq_sync_unlock, 75 79 .irq_enable = mt6397_irq_enable, 76 80 .irq_disable = mt6397_irq_disable, 77 - .irq_set_wake = mt6397_irq_set_wake, 81 + .irq_set_wake = pm_sleep_ptr(mt6397_irq_set_wake), 78 82 }; 79 83 80 84 static void mt6397_irq_handle_reg(struct mt6397_chip *mt6397, int reg,
+3 -10
drivers/mfd/palmas.c
··· 502 502 }; 503 503 MODULE_DEVICE_TABLE(of, of_palmas_match_tbl); 504 504 505 - static int palmas_i2c_probe(struct i2c_client *i2c, 506 - const struct i2c_device_id *id) 505 + static int palmas_i2c_probe(struct i2c_client *i2c) 507 506 { 508 507 struct palmas *palmas; 509 508 struct palmas_platform_data *pdata; ··· 511 512 int ret = 0, i; 512 513 unsigned int reg, addr; 513 514 int slave; 514 - const struct of_device_id *match; 515 515 516 516 pdata = dev_get_platdata(&i2c->dev); 517 517 ··· 534 536 palmas->dev = &i2c->dev; 535 537 palmas->irq = i2c->irq; 536 538 537 - match = of_match_device(of_palmas_match_tbl, &i2c->dev); 538 - 539 - if (!match) 540 - return -ENODATA; 541 - 542 - driver_data = (struct palmas_driver_data *)match->data; 539 + driver_data = (struct palmas_driver_data *) device_get_match_data(&i2c->dev); 543 540 palmas->features = *driver_data->features; 544 541 545 542 for (i = 0; i < PALMAS_NUM_CLIENTS; i++) { ··· 725 732 .name = "palmas", 726 733 .of_match_table = of_palmas_match_tbl, 727 734 }, 728 - .probe = palmas_i2c_probe, 735 + .probe_new = palmas_i2c_probe, 729 736 .remove = palmas_i2c_remove, 730 737 .id_table = palmas_i2c_id, 731 738 };
+3 -24
drivers/mfd/pcf50633-core.c
··· 158 158 } 159 159 } 160 160 161 - #ifdef CONFIG_PM_SLEEP 162 - static int pcf50633_suspend(struct device *dev) 163 - { 164 - struct i2c_client *client = to_i2c_client(dev); 165 - struct pcf50633 *pcf = i2c_get_clientdata(client); 166 - 167 - return pcf50633_irq_suspend(pcf); 168 - } 169 - 170 - static int pcf50633_resume(struct device *dev) 171 - { 172 - struct i2c_client *client = to_i2c_client(dev); 173 - struct pcf50633 *pcf = i2c_get_clientdata(client); 174 - 175 - return pcf50633_irq_resume(pcf); 176 - } 177 - #endif 178 - 179 - static SIMPLE_DEV_PM_OPS(pcf50633_pm, pcf50633_suspend, pcf50633_resume); 180 - 181 161 static const struct regmap_config pcf50633_regmap_config = { 182 162 .reg_bits = 8, 183 163 .val_bits = 8, 184 164 }; 185 165 186 - static int pcf50633_probe(struct i2c_client *client, 187 - const struct i2c_device_id *ids) 166 + static int pcf50633_probe(struct i2c_client *client) 188 167 { 189 168 struct pcf50633 *pcf; 190 169 struct platform_device *pdev; ··· 279 300 static struct i2c_driver pcf50633_driver = { 280 301 .driver = { 281 302 .name = "pcf50633", 282 - .pm = &pcf50633_pm, 303 + .pm = pm_sleep_ptr(&pcf50633_pm), 283 304 }, 284 305 .id_table = pcf50633_id_table, 285 - .probe = pcf50633_probe, 306 + .probe_new = pcf50633_probe, 286 307 .remove = pcf50633_remove, 287 308 }; 288 309
+8 -5
drivers/mfd/pcf50633-irq.c
··· 7 7 * All rights reserved. 8 8 */ 9 9 10 + #include <linux/i2c.h> 10 11 #include <linux/interrupt.h> 11 12 #include <linux/kernel.h> 12 13 #include <linux/mutex.h> ··· 219 218 return IRQ_HANDLED; 220 219 } 221 220 222 - #ifdef CONFIG_PM 223 - 224 - int pcf50633_irq_suspend(struct pcf50633 *pcf) 221 + static int pcf50633_suspend(struct device *dev) 225 222 { 223 + struct i2c_client *client = to_i2c_client(dev); 224 + struct pcf50633 *pcf = i2c_get_clientdata(client); 226 225 int ret; 227 226 int i; 228 227 u8 res[5]; ··· 258 257 return ret; 259 258 } 260 259 261 - int pcf50633_irq_resume(struct pcf50633 *pcf) 260 + static int pcf50633_resume(struct device *dev) 262 261 { 262 + struct i2c_client *client = to_i2c_client(dev); 263 + struct pcf50633 *pcf = i2c_get_clientdata(client); 263 264 int ret; 264 265 265 266 /* Write the saved mask registers */ ··· 276 273 return ret; 277 274 } 278 275 279 - #endif 276 + EXPORT_GPL_SIMPLE_DEV_PM_OPS(pcf50633_pm, pcf50633_suspend, pcf50633_resume); 280 277 281 278 int pcf50633_irq_init(struct pcf50633 *pcf, int irq) 282 279 {
+2 -2
drivers/mfd/qcom-pm8008.c
··· 215 215 216 216 dev = &client->dev; 217 217 regmap = devm_regmap_init_i2c(client, &qcom_mfd_regmap_cfg); 218 - if (!regmap) 219 - return -ENODEV; 218 + if (IS_ERR(regmap)) 219 + return PTR_ERR(regmap); 220 220 221 221 i2c_set_clientdata(client, regmap); 222 222
-1
drivers/mfd/qcom-pm8xxx.c
··· 497 497 }; 498 498 499 499 static const struct of_device_id pm8xxx_id_table[] = { 500 - { .compatible = "qcom,pm8018", .data = &pm8xxx_data}, 501 500 { .compatible = "qcom,pm8058", .data = &pm8xxx_data}, 502 501 { .compatible = "qcom,pm8821", .data = &pm8821_data}, 503 502 { .compatible = "qcom,pm8921", .data = &pm8xxx_data},
+2 -14
drivers/mfd/qcom_rpm.c
··· 547 547 init_completion(&rpm->ack); 548 548 549 549 /* Enable message RAM clock */ 550 - rpm->ramclk = devm_clk_get(&pdev->dev, "ram"); 550 + rpm->ramclk = devm_clk_get_enabled(&pdev->dev, "ram"); 551 551 if (IS_ERR(rpm->ramclk)) { 552 552 ret = PTR_ERR(rpm->ramclk); 553 553 if (ret == -EPROBE_DEFER) ··· 558 558 */ 559 559 rpm->ramclk = NULL; 560 560 } 561 - clk_prepare_enable(rpm->ramclk); /* Accepts NULL */ 562 561 563 562 irq_ack = platform_get_irq_byname(pdev, "ack"); 564 563 if (irq_ack < 0) ··· 672 673 if (ret) 673 674 dev_warn(&pdev->dev, "failed to mark wakeup irq as wakeup\n"); 674 675 675 - return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); 676 - } 677 - 678 - static int qcom_rpm_remove(struct platform_device *pdev) 679 - { 680 - struct qcom_rpm *rpm = dev_get_drvdata(&pdev->dev); 681 - 682 - of_platform_depopulate(&pdev->dev); 683 - clk_disable_unprepare(rpm->ramclk); 684 - 685 - return 0; 676 + return devm_of_platform_populate(&pdev->dev); 686 677 } 687 678 688 679 static struct platform_driver qcom_rpm_driver = { 689 680 .probe = qcom_rpm_probe, 690 - .remove = qcom_rpm_remove, 691 681 .driver = { 692 682 .name = "qcom_rpm", 693 683 .of_match_table = qcom_rpm_of_match,
+2 -5
drivers/mfd/rc5t583-irq.c
··· 228 228 229 229 mutex_unlock(&rc5t583->irq_lock); 230 230 } 231 - #ifdef CONFIG_PM_SLEEP 231 + 232 232 static int rc5t583_irq_set_wake(struct irq_data *irq_data, unsigned int on) 233 233 { 234 234 struct rc5t583 *rc5t583 = irq_data_get_irq_chip_data(irq_data); 235 235 return irq_set_irq_wake(rc5t583->chip_irq, on); 236 236 } 237 - #else 238 - #define rc5t583_irq_set_wake NULL 239 - #endif 240 237 241 238 static irqreturn_t rc5t583_irq(int irq, void *data) 242 239 { ··· 314 317 .irq_bus_lock = rc5t583_irq_lock, 315 318 .irq_bus_sync_unlock = rc5t583_irq_sync_unlock, 316 319 .irq_set_type = rc5t583_irq_set_type, 317 - .irq_set_wake = rc5t583_irq_set_wake, 320 + .irq_set_wake = pm_sleep_ptr(rc5t583_irq_set_wake), 318 321 }; 319 322 320 323 int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base)
+2 -3
drivers/mfd/rc5t583.c
··· 233 233 .cache_type = REGCACHE_RBTREE, 234 234 }; 235 235 236 - static int rc5t583_i2c_probe(struct i2c_client *i2c, 237 - const struct i2c_device_id *id) 236 + static int rc5t583_i2c_probe(struct i2c_client *i2c) 238 237 { 239 238 struct rc5t583 *rc5t583; 240 239 struct rc5t583_platform_data *pdata = dev_get_platdata(&i2c->dev); ··· 288 289 .driver = { 289 290 .name = "rc5t583", 290 291 }, 291 - .probe = rc5t583_i2c_probe, 292 + .probe_new = rc5t583_i2c_probe, 292 293 .id_table = rc5t583_i2c_id, 293 294 }; 294 295
+2 -2
drivers/mfd/retu-mfd.c
··· 227 227 .val_bits = 16, 228 228 }; 229 229 230 - static int retu_probe(struct i2c_client *i2c, const struct i2c_device_id *id) 230 + static int retu_probe(struct i2c_client *i2c) 231 231 { 232 232 struct retu_data const *rdat; 233 233 struct retu_dev *rdev; ··· 318 318 .name = "retu-mfd", 319 319 .of_match_table = retu_of_match, 320 320 }, 321 - .probe = retu_probe, 321 + .probe_new = retu_probe, 322 322 .remove = retu_remove, 323 323 .id_table = retu_id, 324 324 };
+18 -13
drivers/mfd/rk808.c
··· 137 137 }; 138 138 139 139 static const struct mfd_cell rk805s[] = { 140 - { .name = "rk808-clkout", }, 141 - { .name = "rk808-regulator", }, 142 - { .name = "rk805-pinctrl", }, 140 + { .name = "rk808-clkout", .id = PLATFORM_DEVID_NONE, }, 141 + { .name = "rk808-regulator", .id = PLATFORM_DEVID_NONE, }, 142 + { .name = "rk805-pinctrl", .id = PLATFORM_DEVID_NONE, }, 143 143 { 144 144 .name = "rk808-rtc", 145 145 .num_resources = ARRAY_SIZE(rtc_resources), 146 146 .resources = &rtc_resources[0], 147 + .id = PLATFORM_DEVID_NONE, 147 148 }, 148 149 { .name = "rk805-pwrkey", 149 150 .num_resources = ARRAY_SIZE(rk805_key_resources), 150 151 .resources = &rk805_key_resources[0], 152 + .id = PLATFORM_DEVID_NONE, 151 153 }, 152 154 }; 153 155 154 156 static const struct mfd_cell rk808s[] = { 155 - { .name = "rk808-clkout", }, 156 - { .name = "rk808-regulator", }, 157 + { .name = "rk808-clkout", .id = PLATFORM_DEVID_NONE, }, 158 + { .name = "rk808-regulator", .id = PLATFORM_DEVID_NONE, }, 157 159 { 158 160 .name = "rk808-rtc", 159 161 .num_resources = ARRAY_SIZE(rtc_resources), 160 162 .resources = rtc_resources, 163 + .id = PLATFORM_DEVID_NONE, 161 164 }, 162 165 }; 163 166 164 167 static const struct mfd_cell rk817s[] = { 165 - { .name = "rk808-clkout",}, 166 - { .name = "rk808-regulator",}, 168 + { .name = "rk808-clkout", .id = PLATFORM_DEVID_NONE, }, 169 + { .name = "rk808-regulator", .id = PLATFORM_DEVID_NONE, }, 167 170 { 168 171 .name = "rk805-pwrkey", 169 172 .num_resources = ARRAY_SIZE(rk817_pwrkey_resources), 170 173 .resources = &rk817_pwrkey_resources[0], 174 + .id = PLATFORM_DEVID_NONE, 171 175 }, 172 176 { 173 177 .name = "rk808-rtc", 174 178 .num_resources = ARRAY_SIZE(rk817_rtc_resources), 175 179 .resources = &rk817_rtc_resources[0], 180 + .id = PLATFORM_DEVID_NONE, 176 181 }, 177 - { .name = "rk817-codec",}, 182 + { .name = "rk817-codec", .id = PLATFORM_DEVID_NONE, }, 178 183 { 179 184 .name = "rk817-charger", 180 185 .num_resources = ARRAY_SIZE(rk817_charger_resources), 181 186 .resources = &rk817_charger_resources[0], 187 + .id = PLATFORM_DEVID_NONE, 182 188 }, 183 189 }; 184 190 185 191 static const struct mfd_cell rk818s[] = { 186 - { .name = "rk808-clkout", }, 187 - { .name = "rk808-regulator", }, 192 + { .name = "rk808-regulator", .id = PLATFORM_DEVID_NONE, }, 188 193 { 189 194 .name = "rk808-rtc", 190 195 .num_resources = ARRAY_SIZE(rtc_resources), 191 196 .resources = rtc_resources, 197 + .id = PLATFORM_DEVID_NONE, 192 198 }, 193 199 }; 194 200 ··· 646 640 }; 647 641 MODULE_DEVICE_TABLE(of, rk808_of_match); 648 642 649 - static int rk808_probe(struct i2c_client *client, 650 - const struct i2c_device_id *id) 643 + static int rk808_probe(struct i2c_client *client) 651 644 { 652 645 struct device_node *np = client->dev.of_node; 653 646 struct rk808 *rk808; ··· 866 861 .of_match_table = rk808_of_match, 867 862 .pm = &rk8xx_pm_ops, 868 863 }, 869 - .probe = rk808_probe, 864 + .probe_new = rk808_probe, 870 865 .remove = rk808_remove, 871 866 .shutdown = rk8xx_shutdown, 872 867 };
+1 -2
drivers/mfd/rn5t618.c
··· 80 80 .num_irqs = ARRAY_SIZE(rc5t619_irqs), 81 81 .num_regs = 1, 82 82 .status_base = RN5T618_INTMON, 83 - .mask_base = RN5T618_INTEN, 84 - .mask_invert = true, 83 + .unmask_base = RN5T618_INTEN, 85 84 }; 86 85 87 86 static struct i2c_client *rn5t618_pm_power_off;
+12 -17
drivers/mfd/rohm-bd71828.c
··· 413 413 .irqs = &bd71828_irqs[0], 414 414 .num_irqs = ARRAY_SIZE(bd71828_irqs), 415 415 .status_base = BD71828_REG_INT_BUCK, 416 - .mask_base = BD71828_REG_INT_MASK_BUCK, 416 + .unmask_base = BD71828_REG_INT_MASK_BUCK, 417 417 .ack_base = BD71828_REG_INT_BUCK, 418 - .mask_invert = true, 419 418 .init_ack_masked = true, 420 419 .num_regs = 12, 421 420 .num_main_regs = 1, ··· 429 430 .irqs = &bd71815_irqs[0], 430 431 .num_irqs = ARRAY_SIZE(bd71815_irqs), 431 432 .status_base = BD71815_REG_INT_STAT_01, 432 - .mask_base = BD71815_REG_INT_EN_01, 433 + .unmask_base = BD71815_REG_INT_EN_01, 433 434 .ack_base = BD71815_REG_INT_STAT_01, 434 - .mask_invert = true, 435 435 .init_ack_masked = true, 436 436 .num_regs = 12, 437 437 .num_main_regs = 1, ··· 513 515 } 514 516 515 517 regmap = devm_regmap_init_i2c(i2c, regmap_config); 516 - if (IS_ERR(regmap)) { 517 - dev_err(&i2c->dev, "Failed to initialize Regmap\n"); 518 - return PTR_ERR(regmap); 519 - } 518 + if (IS_ERR(regmap)) 519 + return dev_err_probe(&i2c->dev, PTR_ERR(regmap), 520 + "Failed to initialize Regmap\n"); 520 521 521 522 ret = devm_regmap_add_irq_chip(&i2c->dev, regmap, i2c->irq, 522 523 IRQF_ONESHOT, 0, irqchip, &irq_data); 523 - if (ret) { 524 - dev_err(&i2c->dev, "Failed to add IRQ chip\n"); 525 - return ret; 526 - } 524 + if (ret) 525 + return dev_err_probe(&i2c->dev, ret, 526 + "Failed to add IRQ chip\n"); 527 527 528 528 dev_dbg(&i2c->dev, "Registered %d IRQs for chip\n", 529 529 irqchip->num_irqs); 530 530 531 531 if (button_irq) { 532 532 ret = regmap_irq_get_virq(irq_data, button_irq); 533 - if (ret < 0) { 534 - dev_err(&i2c->dev, "Failed to get the power-key IRQ\n"); 535 - return ret; 536 - } 533 + if (ret < 0) 534 + return dev_err_probe(&i2c->dev, ret, 535 + "Failed to get the power-key IRQ\n"); 537 536 538 537 button.irq = ret; 539 538 } ··· 542 547 ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO, mfd, cells, 543 548 NULL, 0, regmap_irq_get_domain(irq_data)); 544 549 if (ret) 545 - dev_err(&i2c->dev, "Failed to create subdevices\n"); 550 + dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n"); 546 551 547 552 return ret; 548 553 }
+10 -17
drivers/mfd/rohm-bd718x7.c
··· 70 70 .mask_base = BD718XX_REG_MIRQ, 71 71 .ack_base = BD718XX_REG_IRQ, 72 72 .init_ack_masked = true, 73 - .mask_invert = false, 74 73 }; 75 74 76 75 static const struct regmap_range pmic_status_range = { ··· 126 127 return 0; 127 128 } 128 129 129 - static int bd718xx_i2c_probe(struct i2c_client *i2c, 130 - const struct i2c_device_id *id) 130 + static int bd718xx_i2c_probe(struct i2c_client *i2c) 131 131 { 132 132 struct regmap *regmap; 133 133 struct regmap_irq_chip_data *irq_data; ··· 156 158 } 157 159 158 160 regmap = devm_regmap_init_i2c(i2c, &bd718xx_regmap_config); 159 - if (IS_ERR(regmap)) { 160 - dev_err(&i2c->dev, "regmap initialization failed\n"); 161 - return PTR_ERR(regmap); 162 - } 161 + if (IS_ERR(regmap)) 162 + return dev_err_probe(&i2c->dev, PTR_ERR(regmap), 163 + "regmap initialization failed\n"); 163 164 164 165 ret = devm_regmap_add_irq_chip(&i2c->dev, regmap, i2c->irq, 165 166 IRQF_ONESHOT, 0, &bd718xx_irq_chip, 166 167 &irq_data); 167 - if (ret) { 168 - dev_err(&i2c->dev, "Failed to add irq_chip\n"); 169 - return ret; 170 - } 168 + if (ret) 169 + return dev_err_probe(&i2c->dev, ret, "Failed to add irq_chip\n"); 171 170 172 171 ret = bd718xx_init_press_duration(regmap, &i2c->dev); 173 172 if (ret) ··· 172 177 173 178 ret = regmap_irq_get_virq(irq_data, BD718XX_INT_PWRBTN_S); 174 179 175 - if (ret < 0) { 176 - dev_err(&i2c->dev, "Failed to get the IRQ\n"); 177 - return ret; 178 - } 180 + if (ret < 0) 181 + return dev_err_probe(&i2c->dev, ret, "Failed to get the IRQ\n"); 179 182 180 183 button.irq = ret; 181 184 ··· 181 188 mfd, cells, NULL, 0, 182 189 regmap_irq_get_domain(irq_data)); 183 190 if (ret) 184 - dev_err(&i2c->dev, "Failed to create subdevices\n"); 191 + dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n"); 185 192 186 193 return ret; 187 194 } ··· 208 215 .name = "rohm-bd718x7", 209 216 .of_match_table = bd718xx_of_match, 210 217 }, 211 - .probe = bd718xx_i2c_probe, 218 + .probe_new = bd718xx_i2c_probe, 212 219 }; 213 220 214 221 static int __init bd718xx_i2c_init(void)
+10 -12
drivers/mfd/rohm-bd9576.c
··· 88 88 .irq_reg_stride = 1, 89 89 }; 90 90 91 - static int bd957x_i2c_probe(struct i2c_client *i2c, 92 - const struct i2c_device_id *id) 91 + static int bd957x_i2c_probe(struct i2c_client *i2c) 93 92 { 94 93 int ret; 95 94 struct regmap *regmap; ··· 121 122 } 122 123 123 124 regmap = devm_regmap_init_i2c(i2c, &bd957x_regmap); 124 - if (IS_ERR(regmap)) { 125 - dev_err(&i2c->dev, "Failed to initialize Regmap\n"); 126 - return PTR_ERR(regmap); 127 - } 125 + if (IS_ERR(regmap)) 126 + return dev_err_probe(&i2c->dev, PTR_ERR(regmap), 127 + "Failed to initialize Regmap\n"); 128 128 129 129 /* 130 130 * BD9576 behaves badly. It kepts IRQ line asserted for the whole ··· 144 146 ret = devm_regmap_add_irq_chip(&i2c->dev, regmap, i2c->irq, 145 147 IRQF_ONESHOT, 0, 146 148 &bd9576_irq_chip, &irq_data); 147 - if (ret) { 148 - dev_err(&i2c->dev, "Failed to add IRQ chip\n"); 149 - return ret; 150 - } 149 + if (ret) 150 + return dev_err_probe(&i2c->dev, ret, 151 + "Failed to add IRQ chip\n"); 152 + 151 153 domain = regmap_irq_get_domain(irq_data); 152 154 } else { 153 155 ret = regmap_update_bits(regmap, BD957X_REG_INT_MAIN_MASK, ··· 161 163 ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO, cells, 162 164 num_cells, NULL, 0, domain); 163 165 if (ret) 164 - dev_err(&i2c->dev, "Failed to create subdevices\n"); 166 + dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n"); 165 167 166 168 return ret; 167 169 } ··· 178 180 .name = "rohm-bd957x", 179 181 .of_match_table = bd957x_of_match, 180 182 }, 181 - .probe = &bd957x_i2c_probe, 183 + .probe_new = &bd957x_i2c_probe, 182 184 }; 183 185 module_i2c_driver(bd957x_drv); 184 186
+3 -3
drivers/mfd/rsmu_i2c.c
··· 106 106 .can_multi_write = true, 107 107 }; 108 108 109 - static int rsmu_i2c_probe(struct i2c_client *client, 110 - const struct i2c_device_id *id) 109 + static int rsmu_i2c_probe(struct i2c_client *client) 111 110 { 111 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 112 112 const struct regmap_config *cfg; 113 113 struct rsmu_ddata *rsmu; 114 114 int ret; ··· 180 180 .name = "rsmu-i2c", 181 181 .of_match_table = of_match_ptr(rsmu_i2c_of_match), 182 182 }, 183 - .probe = rsmu_i2c_probe, 183 + .probe_new = rsmu_i2c_probe, 184 184 .remove = rsmu_i2c_remove, 185 185 .id_table = rsmu_i2c_id, 186 186 };
+3 -5
drivers/mfd/rt5033.c
··· 29 29 static const struct regmap_irq_chip rt5033_irq_chip = { 30 30 .name = "rt5033", 31 31 .status_base = RT5033_REG_PMIC_IRQ_STAT, 32 - .mask_base = RT5033_REG_PMIC_IRQ_CTRL, 33 - .mask_invert = true, 32 + .unmask_base = RT5033_REG_PMIC_IRQ_CTRL, 34 33 .num_regs = 1, 35 34 .irqs = rt5033_irqs, 36 35 .num_irqs = ARRAY_SIZE(rt5033_irqs), ··· 55 56 .max_register = RT5033_REG_END, 56 57 }; 57 58 58 - static int rt5033_i2c_probe(struct i2c_client *i2c, 59 - const struct i2c_device_id *id) 59 + static int rt5033_i2c_probe(struct i2c_client *i2c) 60 60 { 61 61 struct rt5033_dev *rt5033; 62 62 unsigned int dev_id; ··· 122 124 .name = "rt5033", 123 125 .of_match_table = rt5033_dt_match, 124 126 }, 125 - .probe = rt5033_i2c_probe, 127 + .probe_new = rt5033_i2c_probe, 126 128 .id_table = rt5033_i2c_id, 127 129 }; 128 130 module_i2c_driver(rt5033_driver);
+1 -2
drivers/mfd/rt5120.c
··· 59 59 static const struct regmap_irq_chip rt5120_irq_chip = { 60 60 .name = "rt5120-pmic", 61 61 .status_base = RT5120_REG_INTSTAT, 62 - .mask_base = RT5120_REG_INTENABLE, 62 + .unmask_base = RT5120_REG_INTENABLE, 63 63 .ack_base = RT5120_REG_INTSTAT, 64 - .mask_invert = true, 65 64 .use_ack = true, 66 65 .num_regs = 1, 67 66 .irqs = rt5120_irqs,
+5 -7
drivers/mfd/sec-core.c
··· 305 305 return pd; 306 306 } 307 307 308 - static int sec_pmic_probe(struct i2c_client *i2c, 309 - const struct i2c_device_id *id) 308 + static int sec_pmic_probe(struct i2c_client *i2c) 310 309 { 311 310 const struct regmap_config *regmap; 312 311 struct sec_platform_data *pdata; ··· 454 455 regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, 0); 455 456 } 456 457 457 - #ifdef CONFIG_PM_SLEEP 458 458 static int sec_pmic_suspend(struct device *dev) 459 459 { 460 460 struct i2c_client *i2c = to_i2c_client(dev); ··· 486 488 487 489 return 0; 488 490 } 489 - #endif /* CONFIG_PM_SLEEP */ 490 491 491 - static SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, sec_pmic_suspend, sec_pmic_resume); 492 + static DEFINE_SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, 493 + sec_pmic_suspend, sec_pmic_resume); 492 494 493 495 static struct i2c_driver sec_pmic_driver = { 494 496 .driver = { 495 497 .name = "sec_pmic", 496 - .pm = &sec_pmic_pm_ops, 498 + .pm = pm_sleep_ptr(&sec_pmic_pm_ops), 497 499 .of_match_table = sec_dt_match, 498 500 }, 499 - .probe = sec_pmic_probe, 501 + .probe_new = sec_pmic_probe, 500 502 .shutdown = sec_pmic_shutdown, 501 503 }; 502 504 module_i2c_driver(sec_pmic_driver);
+3 -3
drivers/mfd/si476x-i2c.c
··· 683 683 } 684 684 EXPORT_SYMBOL_GPL(si476x_core_is_powered_up); 685 685 686 - static int si476x_core_probe(struct i2c_client *client, 687 - const struct i2c_device_id *id) 686 + static int si476x_core_probe(struct i2c_client *client) 688 687 { 688 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 689 689 int rval; 690 690 struct si476x_core *core; 691 691 struct si476x_platform_data *pdata; ··· 866 866 .driver = { 867 867 .name = "si476x-core", 868 868 }, 869 - .probe = si476x_core_probe, 869 + .probe_new = si476x_core_probe, 870 870 .remove = si476x_core_remove, 871 871 .id_table = si476x_id, 872 872 };
+2 -3
drivers/mfd/sky81452.c
··· 21 21 .val_bits = 8, 22 22 }; 23 23 24 - static int sky81452_probe(struct i2c_client *client, 25 - const struct i2c_device_id *id) 24 + static int sky81452_probe(struct i2c_client *client) 26 25 { 27 26 struct device *dev = &client->dev; 28 27 const struct sky81452_platform_data *pdata = dev_get_platdata(dev); ··· 77 78 .name = "sky81452", 78 79 .of_match_table = of_match_ptr(sky81452_of_match), 79 80 }, 80 - .probe = sky81452_probe, 81 + .probe_new = sky81452_probe, 81 82 .id_table = sky81452_ids, 82 83 }; 83 84
+2 -8
drivers/mfd/sm501.c
··· 1432 1432 1433 1433 } 1434 1434 1435 - #ifdef CONFIG_PM 1436 - 1437 1435 /* power management support */ 1438 1436 1439 1437 static void sm501_set_power(struct sm501_devdata *sm, int on) ··· 1507 1509 1508 1510 return 0; 1509 1511 } 1510 - #else 1511 - #define sm501_plat_suspend NULL 1512 - #define sm501_plat_resume NULL 1513 - #endif 1514 1512 1515 1513 /* Initialisation data for PCI devices */ 1516 1514 ··· 1708 1714 }, 1709 1715 .probe = sm501_plat_probe, 1710 1716 .remove = sm501_plat_remove, 1711 - .suspend = sm501_plat_suspend, 1712 - .resume = sm501_plat_resume, 1717 + .suspend = pm_sleep_ptr(sm501_plat_suspend), 1718 + .resume = pm_sleep_ptr(sm501_plat_resume), 1713 1719 }; 1714 1720 1715 1721 static int __init sm501_base_init(void)
+138
drivers/mfd/smpro-core.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Ampere Altra Family SMPro core driver 4 + * Copyright (c) 2022, Ampere Computing LLC 5 + */ 6 + 7 + #include <linux/i2c.h> 8 + #include <linux/kernel.h> 9 + #include <linux/mfd/core.h> 10 + #include <linux/module.h> 11 + #include <linux/of_platform.h> 12 + #include <linux/regmap.h> 13 + 14 + /* Identification Registers */ 15 + #define MANUFACTURER_ID_REG 0x02 16 + #define AMPERE_MANUFACTURER_ID 0xCD3A 17 + 18 + #define CORE_CE_ERR_DATA 0x82 19 + #define CORE_UE_ERR_DATA 0x85 20 + #define MEM_CE_ERR_DATA 0x92 21 + #define MEM_UE_ERR_DATA 0x95 22 + #define PCIE_CE_ERR_DATA 0xC2 23 + #define PCIE_UE_ERR_DATA 0xC5 24 + #define OTHER_CE_ERR_DATA 0xD2 25 + #define OTHER_UE_ERR_DATA 0xDA 26 + 27 + static int smpro_core_write(void *context, const void *data, size_t count) 28 + { 29 + struct device *dev = context; 30 + struct i2c_client *i2c = to_i2c_client(dev); 31 + int ret; 32 + 33 + ret = i2c_master_send(i2c, data, count); 34 + if (unlikely(ret != count)) 35 + return (ret < 0) ? ret : -EIO; 36 + 37 + return 0; 38 + } 39 + 40 + static int smpro_core_read(void *context, const void *reg, size_t reg_size, 41 + void *val, size_t val_size) 42 + { 43 + struct device *dev = context; 44 + struct i2c_client *i2c = to_i2c_client(dev); 45 + struct i2c_msg xfer[2]; 46 + unsigned char buf[2]; 47 + int ret; 48 + 49 + xfer[0].addr = i2c->addr; 50 + xfer[0].flags = 0; 51 + 52 + buf[0] = *(u8 *)reg; 53 + buf[1] = val_size; 54 + xfer[0].len = 2; 55 + xfer[0].buf = buf; 56 + 57 + xfer[1].addr = i2c->addr; 58 + xfer[1].flags = I2C_M_RD; 59 + xfer[1].len = val_size; 60 + xfer[1].buf = val; 61 + 62 + ret = i2c_transfer(i2c->adapter, xfer, 2); 63 + if (unlikely(ret != 2)) 64 + return (ret < 0) ? ret : -EIO; 65 + 66 + return 0; 67 + } 68 + 69 + static const struct regmap_bus smpro_regmap_bus = { 70 + .read = smpro_core_read, 71 + .write = smpro_core_write, 72 + .val_format_endian_default = REGMAP_ENDIAN_BIG, 73 + }; 74 + 75 + static bool smpro_core_readable_noinc_reg(struct device *dev, unsigned int reg) 76 + { 77 + return (reg == CORE_CE_ERR_DATA || reg == CORE_UE_ERR_DATA || 78 + reg == MEM_CE_ERR_DATA || reg == MEM_UE_ERR_DATA || 79 + reg == PCIE_CE_ERR_DATA || reg == PCIE_UE_ERR_DATA || 80 + reg == OTHER_CE_ERR_DATA || reg == OTHER_UE_ERR_DATA); 81 + } 82 + 83 + static const struct regmap_config smpro_regmap_config = { 84 + .reg_bits = 8, 85 + .val_bits = 16, 86 + .readable_noinc_reg = smpro_core_readable_noinc_reg, 87 + }; 88 + 89 + static const struct mfd_cell smpro_devs[] = { 90 + MFD_CELL_NAME("smpro-hwmon"), 91 + MFD_CELL_NAME("smpro-errmon"), 92 + MFD_CELL_NAME("smpro-misc"), 93 + }; 94 + 95 + static int smpro_core_probe(struct i2c_client *i2c) 96 + { 97 + const struct regmap_config *config; 98 + struct regmap *regmap; 99 + unsigned int val; 100 + int ret; 101 + 102 + config = device_get_match_data(&i2c->dev); 103 + if (!config) 104 + return -EINVAL; 105 + 106 + regmap = devm_regmap_init(&i2c->dev, &smpro_regmap_bus, &i2c->dev, config); 107 + if (IS_ERR(regmap)) 108 + return PTR_ERR(regmap); 109 + 110 + ret = regmap_read(regmap, MANUFACTURER_ID_REG, &val); 111 + if (ret) 112 + return ret; 113 + 114 + if (val != AMPERE_MANUFACTURER_ID) 115 + return -ENODEV; 116 + 117 + return devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO, 118 + smpro_devs, ARRAY_SIZE(smpro_devs), NULL, 0, NULL); 119 + } 120 + 121 + static const struct of_device_id smpro_core_of_match[] = { 122 + { .compatible = "ampere,smpro", .data = &smpro_regmap_config }, 123 + {} 124 + }; 125 + MODULE_DEVICE_TABLE(of, smpro_core_of_match); 126 + 127 + static struct i2c_driver smpro_core_driver = { 128 + .probe_new = smpro_core_probe, 129 + .driver = { 130 + .name = "smpro-core", 131 + .of_match_table = smpro_core_of_match, 132 + }, 133 + }; 134 + module_i2c_driver(smpro_core_driver); 135 + 136 + MODULE_AUTHOR("Quan Nguyen <quan@os.amperecomputing.com>"); 137 + MODULE_DESCRIPTION("SMPRO CORE - I2C driver"); 138 + MODULE_LICENSE("GPL");
+4 -6
drivers/mfd/sprd-sc27xx-spi.c
··· 181 181 ddata->irq_chip.name = dev_name(&spi->dev); 182 182 ddata->irq_chip.status_base = 183 183 pdata->irq_base + SPRD_PMIC_INT_MASK_STATUS; 184 - ddata->irq_chip.mask_base = pdata->irq_base + SPRD_PMIC_INT_EN; 184 + ddata->irq_chip.unmask_base = pdata->irq_base + SPRD_PMIC_INT_EN; 185 185 ddata->irq_chip.ack_base = 0; 186 186 ddata->irq_chip.num_regs = 1; 187 187 ddata->irq_chip.num_irqs = pdata->num_irqs; 188 - ddata->irq_chip.mask_invert = true; 189 188 190 189 ddata->irqs = devm_kcalloc(&spi->dev, 191 190 pdata->num_irqs, sizeof(struct regmap_irq), ··· 214 215 return 0; 215 216 } 216 217 217 - #ifdef CONFIG_PM_SLEEP 218 218 static int sprd_pmic_suspend(struct device *dev) 219 219 { 220 220 struct sprd_pmic *ddata = dev_get_drvdata(dev); ··· 233 235 234 236 return 0; 235 237 } 236 - #endif 237 238 238 - static SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, sprd_pmic_suspend, sprd_pmic_resume); 239 + static DEFINE_SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, 240 + sprd_pmic_suspend, sprd_pmic_resume); 239 241 240 242 static const struct of_device_id sprd_pmic_match[] = { 241 243 { .compatible = "sprd,sc2730", .data = &sc2730_data }, ··· 255 257 .driver = { 256 258 .name = "sc27xx-pmic", 257 259 .of_match_table = sprd_pmic_match, 258 - .pm = &sprd_pmic_pm_ops, 260 + .pm = pm_sleep_ptr(&sprd_pmic_pm_ops), 259 261 }, 260 262 .probe = sprd_pmic_probe, 261 263 .id_table = sprd_pmic_spi_ids,
+1 -3
drivers/mfd/stm32-lptimer.c
··· 52 52 { 53 53 struct device *dev = &pdev->dev; 54 54 struct stm32_lptimer *ddata; 55 - struct resource *res; 56 55 void __iomem *mmio; 57 56 int ret; 58 57 ··· 59 60 if (!ddata) 60 61 return -ENOMEM; 61 62 62 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 63 - mmio = devm_ioremap_resource(dev, res); 63 + mmio = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); 64 64 if (IS_ERR(mmio)) 65 65 return PTR_ERR(mmio); 66 66
+4 -7
drivers/mfd/stmfx.c
··· 410 410 } 411 411 } 412 412 413 - static int stmfx_probe(struct i2c_client *client, 414 - const struct i2c_device_id *id) 413 + static int stmfx_probe(struct i2c_client *client) 415 414 { 416 415 struct device *dev = &client->dev; 417 416 struct stmfx *stmfx; ··· 473 474 stmfx_chip_exit(client); 474 475 } 475 476 476 - #ifdef CONFIG_PM_SLEEP 477 477 static int stmfx_suspend(struct device *dev) 478 478 { 479 479 struct stmfx *stmfx = dev_get_drvdata(dev); ··· 538 540 539 541 return 0; 540 542 } 541 - #endif 542 543 543 - static SIMPLE_DEV_PM_OPS(stmfx_dev_pm_ops, stmfx_suspend, stmfx_resume); 544 + static DEFINE_SIMPLE_DEV_PM_OPS(stmfx_dev_pm_ops, stmfx_suspend, stmfx_resume); 544 545 545 546 static const struct of_device_id stmfx_of_match[] = { 546 547 { .compatible = "st,stmfx-0300", }, ··· 551 554 .driver = { 552 555 .name = "stmfx-core", 553 556 .of_match_table = stmfx_of_match, 554 - .pm = &stmfx_dev_pm_ops, 557 + .pm = pm_sleep_ptr(&stmfx_dev_pm_ops), 555 558 }, 556 - .probe = stmfx_probe, 559 + .probe_new = stmfx_probe, 557 560 .remove = stmfx_remove, 558 561 }; 559 562 module_i2c_driver(stmfx_driver);
+4 -5
drivers/mfd/stmpe-i2c.c
··· 67 67 MODULE_DEVICE_TABLE(of, stmpe_of_match); 68 68 69 69 static int 70 - stmpe_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) 70 + stmpe_i2c_probe(struct i2c_client *i2c) 71 71 { 72 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 72 73 enum stmpe_partnum partnum; 73 74 const struct of_device_id *of_id; 74 75 ··· 115 114 static struct i2c_driver stmpe_i2c_driver = { 116 115 .driver = { 117 116 .name = "stmpe-i2c", 118 - #ifdef CONFIG_PM 119 - .pm = &stmpe_dev_pm_ops, 120 - #endif 117 + .pm = pm_sleep_ptr(&stmpe_dev_pm_ops), 121 118 .of_match_table = stmpe_of_match, 122 119 }, 123 - .probe = stmpe_i2c_probe, 120 + .probe_new = stmpe_i2c_probe, 124 121 .remove = stmpe_i2c_remove, 125 122 .id_table = stmpe_i2c_id, 126 123 };
+1 -3
drivers/mfd/stmpe-spi.c
··· 135 135 .driver = { 136 136 .name = "stmpe-spi", 137 137 .of_match_table = of_match_ptr(stmpe_spi_of_match), 138 - #ifdef CONFIG_PM 139 - .pm = &stmpe_dev_pm_ops, 140 - #endif 138 + .pm = pm_sleep_ptr(&stmpe_dev_pm_ops), 141 139 }, 142 140 .probe = stmpe_spi_probe, 143 141 .remove = stmpe_spi_remove,
+2 -6
drivers/mfd/stmpe.c
··· 1495 1495 mfd_remove_devices(stmpe->dev); 1496 1496 } 1497 1497 1498 - #ifdef CONFIG_PM 1499 1498 static int stmpe_suspend(struct device *dev) 1500 1499 { 1501 1500 struct stmpe *stmpe = dev_get_drvdata(dev); ··· 1515 1516 return 0; 1516 1517 } 1517 1518 1518 - const struct dev_pm_ops stmpe_dev_pm_ops = { 1519 - .suspend = stmpe_suspend, 1520 - .resume = stmpe_resume, 1521 - }; 1522 - #endif 1519 + EXPORT_GPL_SIMPLE_DEV_PM_OPS(stmpe_dev_pm_ops, 1520 + stmpe_suspend, stmpe_resume);
+7 -9
drivers/mfd/stpmic1.c
··· 108 108 static const struct regmap_irq_chip stpmic1_regmap_irq_chip = { 109 109 .name = "pmic_irq", 110 110 .status_base = INT_PENDING_R1, 111 - .mask_base = INT_CLEAR_MASK_R1, 112 - .unmask_base = INT_SET_MASK_R1, 111 + .mask_base = INT_SET_MASK_R1, 112 + .unmask_base = INT_CLEAR_MASK_R1, 113 + .mask_unmask_non_inverted = true, 113 114 .ack_base = INT_CLEAR_R1, 114 115 .num_regs = STPMIC1_PMIC_NUM_IRQ_REGS, 115 116 .irqs = stpmic1_irqs, 116 117 .num_irqs = ARRAY_SIZE(stpmic1_irqs), 117 118 }; 118 119 119 - static int stpmic1_probe(struct i2c_client *i2c, 120 - const struct i2c_device_id *id) 120 + static int stpmic1_probe(struct i2c_client *i2c) 121 121 { 122 122 struct stpmic1 *ddata; 123 123 struct device *dev = &i2c->dev; ··· 162 162 return devm_of_platform_populate(dev); 163 163 } 164 164 165 - #ifdef CONFIG_PM_SLEEP 166 165 static int stpmic1_suspend(struct device *dev) 167 166 { 168 167 struct i2c_client *i2c = to_i2c_client(dev); ··· 186 187 187 188 return 0; 188 189 } 189 - #endif 190 190 191 - static SIMPLE_DEV_PM_OPS(stpmic1_pm, stpmic1_suspend, stpmic1_resume); 191 + static DEFINE_SIMPLE_DEV_PM_OPS(stpmic1_pm, stpmic1_suspend, stpmic1_resume); 192 192 193 193 static const struct of_device_id stpmic1_of_match[] = { 194 194 { .compatible = "st,stpmic1", }, ··· 199 201 .driver = { 200 202 .name = "stpmic1", 201 203 .of_match_table = of_match_ptr(stpmic1_of_match), 202 - .pm = &stpmic1_pm, 204 + .pm = pm_sleep_ptr(&stpmic1_pm), 203 205 }, 204 - .probe = stpmic1_probe, 206 + .probe_new = stpmic1_probe, 205 207 }; 206 208 207 209 module_i2c_driver(stpmic1_driver);
+2 -3
drivers/mfd/stw481x.c
··· 173 173 .val_bits = 8, 174 174 }; 175 175 176 - static int stw481x_probe(struct i2c_client *client, 177 - const struct i2c_device_id *id) 176 + static int stw481x_probe(struct i2c_client *client) 178 177 { 179 178 struct stw481x *stw481x; 180 179 int ret; ··· 239 240 .name = "stw481x", 240 241 .of_match_table = stw481x_match, 241 242 }, 242 - .probe = stw481x_probe, 243 + .probe_new = stw481x_probe, 243 244 .id_table = stw481x_id, 244 245 }; 245 246
+1 -2
drivers/mfd/sun4i-gpadc.c
··· 34 34 .name = "sun4i_gpadc_irq_chip", 35 35 .status_base = SUN4I_GPADC_INT_FIFOS, 36 36 .ack_base = SUN4I_GPADC_INT_FIFOS, 37 - .mask_base = SUN4I_GPADC_INT_FIFOC, 37 + .unmask_base = SUN4I_GPADC_INT_FIFOC, 38 38 .init_ack_masked = true, 39 - .mask_invert = true, 40 39 .irqs = sun4i_gpadc_regmap_irq, 41 40 .num_irqs = ARRAY_SIZE(sun4i_gpadc_regmap_irq), 42 41 .num_regs = 1,
+2 -7
drivers/mfd/t7l66xb.c
··· 257 257 258 258 /*--------------------------------------------------------------------------*/ 259 259 260 - #ifdef CONFIG_PM 261 260 static int t7l66xb_suspend(struct platform_device *dev, pm_message_t state) 262 261 { 263 262 struct t7l66xb *t7l66xb = platform_get_drvdata(dev); ··· 287 288 288 289 return 0; 289 290 } 290 - #else 291 - #define t7l66xb_suspend NULL 292 - #define t7l66xb_resume NULL 293 - #endif 294 291 295 292 /*--------------------------------------------------------------------------*/ 296 293 ··· 411 416 .driver = { 412 417 .name = "t7l66xb", 413 418 }, 414 - .suspend = t7l66xb_suspend, 415 - .resume = t7l66xb_resume, 419 + .suspend = pm_sleep_ptr(t7l66xb_suspend), 420 + .resume = pm_sleep_ptr(t7l66xb_resume), 416 421 .probe = t7l66xb_probe, 417 422 .remove = t7l66xb_remove, 418 423 };
+6 -7
drivers/mfd/tc3589x.c
··· 352 352 return pdata; 353 353 } 354 354 355 - static int tc3589x_probe(struct i2c_client *i2c, 356 - const struct i2c_device_id *id) 355 + static int tc3589x_probe(struct i2c_client *i2c) 357 356 { 357 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 358 358 struct device_node *np = i2c->dev.of_node; 359 359 struct tc3589x_platform_data *pdata = dev_get_platdata(&i2c->dev); 360 360 struct tc3589x *tc3589x; ··· 436 436 mfd_remove_devices(tc3589x->dev); 437 437 } 438 438 439 - #ifdef CONFIG_PM_SLEEP 440 439 static int tc3589x_suspend(struct device *dev) 441 440 { 442 441 struct tc3589x *tc3589x = dev_get_drvdata(dev); ··· 463 464 464 465 return ret; 465 466 } 466 - #endif 467 467 468 - static SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, tc3589x_suspend, tc3589x_resume); 468 + static DEFINE_SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, 469 + tc3589x_suspend, tc3589x_resume); 469 470 470 471 static const struct i2c_device_id tc3589x_id[] = { 471 472 { "tc35890", TC3589X_TC35890 }, ··· 482 483 static struct i2c_driver tc3589x_driver = { 483 484 .driver = { 484 485 .name = "tc3589x", 485 - .pm = &tc3589x_dev_pm_ops, 486 + .pm = pm_sleep_ptr(&tc3589x_dev_pm_ops), 486 487 .of_match_table = of_match_ptr(tc3589x_match), 487 488 }, 488 - .probe = tc3589x_probe, 489 + .probe_new = tc3589x_probe, 489 490 .remove = tc3589x_remove, 490 491 .id_table = tc3589x_id, 491 492 };
+2 -7
drivers/mfd/tc6387xb.c
··· 40 40 41 41 /*--------------------------------------------------------------------------*/ 42 42 43 - #ifdef CONFIG_PM 44 43 static int tc6387xb_suspend(struct platform_device *dev, pm_message_t state) 45 44 { 46 45 struct tc6387xb *tc6387xb = platform_get_drvdata(dev); ··· 66 67 67 68 return 0; 68 69 } 69 - #else 70 - #define tc6387xb_suspend NULL 71 - #define tc6387xb_resume NULL 72 - #endif 73 70 74 71 /*--------------------------------------------------------------------------*/ 75 72 ··· 215 220 }, 216 221 .probe = tc6387xb_probe, 217 222 .remove = tc6387xb_remove, 218 - .suspend = tc6387xb_suspend, 219 - .resume = tc6387xb_resume, 223 + .suspend = pm_sleep_ptr(tc6387xb_suspend), 224 + .resume = pm_sleep_ptr(tc6387xb_resume), 220 225 }; 221 226 222 227 module_platform_driver(tc6387xb_platform_driver);
+2 -7
drivers/mfd/tc6393xb.c
··· 813 813 return 0; 814 814 } 815 815 816 - #ifdef CONFIG_PM 817 816 static int tc6393xb_suspend(struct platform_device *dev, pm_message_t state) 818 817 { 819 818 struct tc6393xb_platform_data *tcpd = dev_get_platdata(&dev->dev); ··· 875 876 876 877 return 0; 877 878 } 878 - #else 879 - #define tc6393xb_suspend NULL 880 - #define tc6393xb_resume NULL 881 - #endif 882 879 883 880 static struct platform_driver tc6393xb_driver = { 884 881 .probe = tc6393xb_probe, 885 882 .remove = tc6393xb_remove, 886 - .suspend = tc6393xb_suspend, 887 - .resume = tc6393xb_resume, 883 + .suspend = pm_sleep_ptr(tc6393xb_suspend), 884 + .resume = pm_sleep_ptr(tc6393xb_resume), 888 885 889 886 .driver = { 890 887 .name = "tc6393xb",
+3 -2
drivers/mfd/ti-lmu.c
··· 133 133 TI_LMU_DATA(lm3695, LM3695_MAX_REG); 134 134 TI_LMU_DATA(lm36274, LM36274_MAX_REG); 135 135 136 - static int ti_lmu_probe(struct i2c_client *cl, const struct i2c_device_id *id) 136 + static int ti_lmu_probe(struct i2c_client *cl) 137 137 { 138 + const struct i2c_device_id *id = i2c_client_get_device_id(cl); 138 139 struct device *dev = &cl->dev; 139 140 const struct ti_lmu_data *data; 140 141 struct regmap_config regmap_cfg; ··· 217 216 MODULE_DEVICE_TABLE(i2c, ti_lmu_ids); 218 217 219 218 static struct i2c_driver ti_lmu_driver = { 220 - .probe = ti_lmu_probe, 219 + .probe_new = ti_lmu_probe, 221 220 .driver = { 222 221 .name = "ti-lmu", 223 222 .of_match_table = ti_lmu_of_match,
-1
drivers/mfd/timberdale.c
··· 11 11 #include <linux/kernel.h> 12 12 #include <linux/module.h> 13 13 #include <linux/pci.h> 14 - #include <linux/msi.h> 15 14 #include <linux/mfd/core.h> 16 15 #include <linux/slab.h> 17 16
+2 -3
drivers/mfd/tps6105x.c
··· 117 117 return pdata; 118 118 } 119 119 120 - static int tps6105x_probe(struct i2c_client *client, 121 - const struct i2c_device_id *id) 120 + static int tps6105x_probe(struct i2c_client *client) 122 121 { 123 122 struct tps6105x *tps6105x; 124 123 struct tps6105x_platform_data *pdata; ··· 209 210 .name = "tps6105x", 210 211 .of_match_table = tps6105x_of_match, 211 212 }, 212 - .probe = tps6105x_probe, 213 + .probe_new = tps6105x_probe, 213 214 .remove = tps6105x_remove, 214 215 .id_table = tps6105x_id, 215 216 };
+3 -3
drivers/mfd/tps65010.c
··· 519 519 the_tps = NULL; 520 520 } 521 521 522 - static int tps65010_probe(struct i2c_client *client, 523 - const struct i2c_device_id *id) 522 + static int tps65010_probe(struct i2c_client *client) 524 523 { 524 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 525 525 struct tps65010 *tps; 526 526 int status; 527 527 struct tps65010_board *board = dev_get_platdata(&client->dev); ··· 668 668 .driver = { 669 669 .name = "tps65010", 670 670 }, 671 - .probe = tps65010_probe, 671 + .probe_new = tps65010_probe, 672 672 .remove = tps65010_remove, 673 673 .id_table = tps65010_id, 674 674 };
+2 -3
drivers/mfd/tps6507x.c
··· 84 84 return 0; 85 85 } 86 86 87 - static int tps6507x_i2c_probe(struct i2c_client *i2c, 88 - const struct i2c_device_id *id) 87 + static int tps6507x_i2c_probe(struct i2c_client *i2c) 89 88 { 90 89 struct tps6507x_dev *tps6507x; 91 90 ··· 122 123 .name = "tps6507x", 123 124 .of_match_table = of_match_ptr(tps6507x_of_match), 124 125 }, 125 - .probe = tps6507x_i2c_probe, 126 + .probe_new = tps6507x_i2c_probe, 126 127 .id_table = tps6507x_i2c_id, 127 128 }; 128 129
+2 -3
drivers/mfd/tps65086.c
··· 61 61 }; 62 62 MODULE_DEVICE_TABLE(of, tps65086_of_match_table); 63 63 64 - static int tps65086_probe(struct i2c_client *client, 65 - const struct i2c_device_id *ids) 64 + static int tps65086_probe(struct i2c_client *client) 66 65 { 67 66 struct tps65086 *tps; 68 67 unsigned int version; ··· 129 130 .name = "tps65086", 130 131 .of_match_table = tps65086_of_match_table, 131 132 }, 132 - .probe = tps65086_probe, 133 + .probe_new = tps65086_probe, 133 134 .remove = tps65086_remove, 134 135 .id_table = tps65086_id_table, 135 136 };
+3 -5
drivers/mfd/tps65090.c
··· 127 127 .num_irqs = ARRAY_SIZE(tps65090_irqs), 128 128 .num_regs = NUM_INT_REG, 129 129 .status_base = TPS65090_REG_INTR_STS, 130 - .mask_base = TPS65090_REG_INTR_MASK, 131 - .mask_invert = true, 130 + .unmask_base = TPS65090_REG_INTR_MASK, 132 131 }; 133 132 134 133 static bool is_volatile_reg(struct device *dev, unsigned int reg) ··· 163 164 }; 164 165 #endif 165 166 166 - static int tps65090_i2c_probe(struct i2c_client *client, 167 - const struct i2c_device_id *id) 167 + static int tps65090_i2c_probe(struct i2c_client *client) 168 168 { 169 169 struct tps65090_platform_data *pdata = dev_get_platdata(&client->dev); 170 170 int irq_base = 0; ··· 236 238 .suppress_bind_attrs = true, 237 239 .of_match_table = of_match_ptr(tps65090_of_match), 238 240 }, 239 - .probe = tps65090_i2c_probe, 241 + .probe_new = tps65090_i2c_probe, 240 242 .id_table = tps65090_id_table, 241 243 }; 242 244
+2 -3
drivers/mfd/tps65218.c
··· 280 280 return 0; 281 281 } 282 282 283 - static int tps65218_probe(struct i2c_client *client, 284 - const struct i2c_device_id *ids) 283 + static int tps65218_probe(struct i2c_client *client) 285 284 { 286 285 struct tps65218 *tps; 287 286 int ret; ··· 347 348 .name = "tps65218", 348 349 .of_match_table = of_tps65218_match_table, 349 350 }, 350 - .probe = tps65218_probe, 351 + .probe_new = tps65218_probe, 351 352 .id_table = tps65218_id_table, 352 353 }; 353 354
+299
drivers/mfd/tps65219.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // 3 + // Driver for TPS65219 Integrated Power Management Integrated Chips (PMIC) 4 + // 5 + // Copyright (C) 2022 BayLibre Incorporated - https://www.baylibre.com/ 6 + 7 + #include <linux/i2c.h> 8 + #include <linux/reboot.h> 9 + #include <linux/regmap.h> 10 + 11 + #include <linux/mfd/core.h> 12 + #include <linux/mfd/tps65219.h> 13 + 14 + static int tps65219_warm_reset(struct tps65219 *tps) 15 + { 16 + return regmap_update_bits(tps->regmap, TPS65219_REG_MFP_CTRL, 17 + TPS65219_MFP_WARM_RESET_I2C_CTRL_MASK, 18 + TPS65219_MFP_WARM_RESET_I2C_CTRL_MASK); 19 + } 20 + 21 + static int tps65219_cold_reset(struct tps65219 *tps) 22 + { 23 + return regmap_update_bits(tps->regmap, TPS65219_REG_MFP_CTRL, 24 + TPS65219_MFP_COLD_RESET_I2C_CTRL_MASK, 25 + TPS65219_MFP_COLD_RESET_I2C_CTRL_MASK); 26 + } 27 + 28 + static int tps65219_restart(struct notifier_block *this, 29 + unsigned long reboot_mode, void *cmd) 30 + { 31 + struct tps65219 *tps; 32 + 33 + tps = container_of(this, struct tps65219, nb); 34 + 35 + if (reboot_mode == REBOOT_WARM) 36 + tps65219_warm_reset(tps); 37 + else 38 + tps65219_cold_reset(tps); 39 + 40 + return NOTIFY_DONE; 41 + } 42 + 43 + static struct notifier_block pmic_rst_restart_nb = { 44 + .notifier_call = tps65219_restart, 45 + .priority = 200, 46 + }; 47 + 48 + static const struct resource tps65219_pwrbutton_resources[] = { 49 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_PB_FALLING_EDGE_DETECT, "falling"), 50 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_PB_RISING_EDGE_DETECT, "rising"), 51 + }; 52 + 53 + static const struct resource tps65219_regulator_resources[] = { 54 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO3_SCG, "LDO3_SCG"), 55 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO3_OC, "LDO3_OC"), 56 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO3_UV, "LDO3_UV"), 57 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO4_SCG, "LDO4_SCG"), 58 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO4_OC, "LDO4_OC"), 59 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO4_UV, "LDO4_UV"), 60 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO1_SCG, "LDO1_SCG"), 61 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO1_OC, "LDO1_OC"), 62 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO1_UV, "LDO1_UV"), 63 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO2_SCG, "LDO2_SCG"), 64 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO2_OC, "LDO2_OC"), 65 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO2_UV, "LDO2_UV"), 66 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK3_SCG, "BUCK3_SCG"), 67 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK3_OC, "BUCK3_OC"), 68 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK3_NEG_OC, "BUCK3_NEG_OC"), 69 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK3_UV, "BUCK3_UV"), 70 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK1_SCG, "BUCK1_SCG"), 71 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK1_OC, "BUCK1_OC"), 72 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK1_NEG_OC, "BUCK1_NEG_OC"), 73 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK1_UV, "BUCK1_UV"), 74 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK2_SCG, "BUCK2_SCG"), 75 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK2_OC, "BUCK2_OC"), 76 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK2_NEG_OC, "BUCK2_NEG_OC"), 77 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK2_UV, "BUCK2_UV"), 78 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK1_RV, "BUCK1_RV"), 79 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK2_RV, "BUCK2_RV"), 80 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK3_RV, "BUCK3_RV"), 81 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO1_RV, "LDO1_RV"), 82 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO2_RV, "LDO2_RV"), 83 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO3_RV, "LDO3_RV"), 84 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO4_RV, "LDO4_RV"), 85 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK1_RV_SD, "BUCK1_RV_SD"), 86 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK2_RV_SD, "BUCK2_RV_SD"), 87 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_BUCK3_RV_SD, "BUCK3_RV_SD"), 88 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO1_RV_SD, "LDO1_RV_SD"), 89 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO2_RV_SD, "LDO2_RV_SD"), 90 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO3_RV_SD, "LDO3_RV_SD"), 91 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_LDO4_RV_SD, "LDO4_RV_SD"), 92 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_TIMEOUT, "TIMEOUT"), 93 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_SENSOR_3_WARM, "SENSOR_3_WARM"), 94 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_SENSOR_2_WARM, "SENSOR_2_WARM"), 95 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_SENSOR_1_WARM, "SENSOR_1_WARM"), 96 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_SENSOR_0_WARM, "SENSOR_0_WARM"), 97 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_SENSOR_3_HOT, "SENSOR_3_HOT"), 98 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_SENSOR_2_HOT, "SENSOR_2_HOT"), 99 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_SENSOR_1_HOT, "SENSOR_1_HOT"), 100 + DEFINE_RES_IRQ_NAMED(TPS65219_INT_SENSOR_0_HOT, "SENSOR_0_HOT"), 101 + }; 102 + 103 + static const struct mfd_cell tps65219_cells[] = { 104 + { 105 + .name = "tps65219-regulator", 106 + .resources = tps65219_regulator_resources, 107 + .num_resources = ARRAY_SIZE(tps65219_regulator_resources), 108 + }, 109 + { .name = "tps65219-gpios", }, 110 + }; 111 + 112 + static const struct mfd_cell tps65219_pwrbutton_cell = { 113 + .name = "tps65219-pwrbutton", 114 + .resources = tps65219_pwrbutton_resources, 115 + .num_resources = ARRAY_SIZE(tps65219_pwrbutton_resources), 116 + }; 117 + 118 + static const struct regmap_config tps65219_regmap_config = { 119 + .reg_bits = 8, 120 + .val_bits = 8, 121 + .max_register = TPS65219_REG_FACTORY_CONFIG_2, 122 + }; 123 + 124 + /* 125 + * Mapping of main IRQ register bits to sub-IRQ register offsets so that we can 126 + * access corect sub-IRQ registers based on bits that are set in main IRQ 127 + * register. 128 + */ 129 + /* Timeout Residual Voltage Shutdown */ 130 + static unsigned int bit0_offsets[] = { TPS65219_REG_INT_TO_RV_POS }; 131 + static unsigned int bit1_offsets[] = { TPS65219_REG_INT_RV_POS }; /* Residual Voltage */ 132 + static unsigned int bit2_offsets[] = { TPS65219_REG_INT_SYS_POS }; /* System */ 133 + static unsigned int bit3_offsets[] = { TPS65219_REG_INT_BUCK_1_2_POS }; /* Buck 1-2 */ 134 + static unsigned int bit4_offsets[] = { TPS65219_REG_INT_BUCK_3_POS }; /* Buck 3 */ 135 + static unsigned int bit5_offsets[] = { TPS65219_REG_INT_LDO_1_2_POS }; /* LDO 1-2 */ 136 + static unsigned int bit6_offsets[] = { TPS65219_REG_INT_LDO_3_4_POS }; /* LDO 3-4 */ 137 + static unsigned int bit7_offsets[] = { TPS65219_REG_INT_PB_POS }; /* Power Button */ 138 + 139 + static struct regmap_irq_sub_irq_map tps65219_sub_irq_offsets[] = { 140 + REGMAP_IRQ_MAIN_REG_OFFSET(bit0_offsets), 141 + REGMAP_IRQ_MAIN_REG_OFFSET(bit1_offsets), 142 + REGMAP_IRQ_MAIN_REG_OFFSET(bit2_offsets), 143 + REGMAP_IRQ_MAIN_REG_OFFSET(bit3_offsets), 144 + REGMAP_IRQ_MAIN_REG_OFFSET(bit4_offsets), 145 + REGMAP_IRQ_MAIN_REG_OFFSET(bit5_offsets), 146 + REGMAP_IRQ_MAIN_REG_OFFSET(bit6_offsets), 147 + REGMAP_IRQ_MAIN_REG_OFFSET(bit7_offsets), 148 + }; 149 + 150 + #define TPS65219_REGMAP_IRQ_REG(int_name, register_position) \ 151 + REGMAP_IRQ_REG(int_name, register_position, int_name##_MASK) 152 + 153 + static struct regmap_irq tps65219_irqs[] = { 154 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO3_SCG, TPS65219_REG_INT_LDO_3_4_POS), 155 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO3_OC, TPS65219_REG_INT_LDO_3_4_POS), 156 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO3_UV, TPS65219_REG_INT_LDO_3_4_POS), 157 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO4_SCG, TPS65219_REG_INT_LDO_3_4_POS), 158 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO4_OC, TPS65219_REG_INT_LDO_3_4_POS), 159 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO4_UV, TPS65219_REG_INT_LDO_3_4_POS), 160 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO1_SCG, TPS65219_REG_INT_LDO_1_2_POS), 161 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO1_OC, TPS65219_REG_INT_LDO_1_2_POS), 162 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO1_UV, TPS65219_REG_INT_LDO_1_2_POS), 163 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO2_SCG, TPS65219_REG_INT_LDO_1_2_POS), 164 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO2_OC, TPS65219_REG_INT_LDO_1_2_POS), 165 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO2_UV, TPS65219_REG_INT_LDO_1_2_POS), 166 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK3_SCG, TPS65219_REG_INT_BUCK_3_POS), 167 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK3_OC, TPS65219_REG_INT_BUCK_3_POS), 168 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK3_NEG_OC, TPS65219_REG_INT_BUCK_3_POS), 169 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK3_UV, TPS65219_REG_INT_BUCK_3_POS), 170 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK2_SCG, TPS65219_REG_INT_BUCK_1_2_POS), 171 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK2_OC, TPS65219_REG_INT_BUCK_1_2_POS), 172 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK2_NEG_OC, TPS65219_REG_INT_BUCK_1_2_POS), 173 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK2_UV, TPS65219_REG_INT_BUCK_1_2_POS), 174 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK1_SCG, TPS65219_REG_INT_BUCK_1_2_POS), 175 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK1_OC, TPS65219_REG_INT_BUCK_1_2_POS), 176 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK1_NEG_OC, TPS65219_REG_INT_BUCK_1_2_POS), 177 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK1_UV, TPS65219_REG_INT_BUCK_1_2_POS), 178 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_SENSOR_3_WARM, TPS65219_REG_INT_SYS_POS), 179 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_SENSOR_2_WARM, TPS65219_REG_INT_SYS_POS), 180 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_SENSOR_1_WARM, TPS65219_REG_INT_SYS_POS), 181 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_SENSOR_0_WARM, TPS65219_REG_INT_SYS_POS), 182 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_SENSOR_3_HOT, TPS65219_REG_INT_SYS_POS), 183 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_SENSOR_2_HOT, TPS65219_REG_INT_SYS_POS), 184 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_SENSOR_1_HOT, TPS65219_REG_INT_SYS_POS), 185 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_SENSOR_0_HOT, TPS65219_REG_INT_SYS_POS), 186 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK1_RV, TPS65219_REG_INT_RV_POS), 187 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK2_RV, TPS65219_REG_INT_RV_POS), 188 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK3_RV, TPS65219_REG_INT_RV_POS), 189 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO1_RV, TPS65219_REG_INT_RV_POS), 190 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO2_RV, TPS65219_REG_INT_RV_POS), 191 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO3_RV, TPS65219_REG_INT_RV_POS), 192 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO4_RV, TPS65219_REG_INT_RV_POS), 193 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK1_RV_SD, TPS65219_REG_INT_TO_RV_POS), 194 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK2_RV_SD, TPS65219_REG_INT_TO_RV_POS), 195 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_BUCK3_RV_SD, TPS65219_REG_INT_TO_RV_POS), 196 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO1_RV_SD, TPS65219_REG_INT_TO_RV_POS), 197 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO2_RV_SD, TPS65219_REG_INT_TO_RV_POS), 198 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO3_RV_SD, TPS65219_REG_INT_TO_RV_POS), 199 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_LDO4_RV_SD, TPS65219_REG_INT_TO_RV_POS), 200 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_TIMEOUT, TPS65219_REG_INT_TO_RV_POS), 201 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_PB_FALLING_EDGE_DETECT, TPS65219_REG_INT_PB_POS), 202 + TPS65219_REGMAP_IRQ_REG(TPS65219_INT_PB_RISING_EDGE_DETECT, TPS65219_REG_INT_PB_POS), 203 + }; 204 + 205 + static struct regmap_irq_chip tps65219_irq_chip = { 206 + .name = "tps65219_irq", 207 + .main_status = TPS65219_REG_INT_SOURCE, 208 + .num_main_regs = 1, 209 + .num_main_status_bits = 8, 210 + .irqs = tps65219_irqs, 211 + .num_irqs = ARRAY_SIZE(tps65219_irqs), 212 + .status_base = TPS65219_REG_INT_LDO_3_4, 213 + .ack_base = TPS65219_REG_INT_LDO_3_4, 214 + .clear_ack = 1, 215 + .num_regs = 8, 216 + .sub_reg_offsets = tps65219_sub_irq_offsets, 217 + }; 218 + 219 + static int tps65219_probe(struct i2c_client *client) 220 + { 221 + struct tps65219 *tps; 222 + unsigned int chipid; 223 + bool pwr_button; 224 + int ret; 225 + 226 + tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); 227 + if (!tps) 228 + return -ENOMEM; 229 + 230 + i2c_set_clientdata(client, tps); 231 + 232 + tps->dev = &client->dev; 233 + 234 + tps->regmap = devm_regmap_init_i2c(client, &tps65219_regmap_config); 235 + if (IS_ERR(tps->regmap)) { 236 + ret = PTR_ERR(tps->regmap); 237 + dev_err(tps->dev, "Failed to allocate register map: %d\n", ret); 238 + return ret; 239 + } 240 + 241 + ret = devm_regmap_add_irq_chip(&client->dev, tps->regmap, client->irq, 242 + IRQF_ONESHOT, 0, &tps65219_irq_chip, 243 + &tps->irq_data); 244 + if (ret) 245 + return ret; 246 + 247 + ret = regmap_read(tps->regmap, TPS65219_REG_TI_DEV_ID, &chipid); 248 + if (ret) { 249 + dev_err(tps->dev, "Failed to read device ID: %d\n", ret); 250 + return ret; 251 + } 252 + 253 + ret = devm_mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, 254 + tps65219_cells, ARRAY_SIZE(tps65219_cells), 255 + NULL, 0, regmap_irq_get_domain(tps->irq_data)); 256 + if (ret) { 257 + dev_err(tps->dev, "Failed to add child devices: %d\n", ret); 258 + return ret; 259 + } 260 + 261 + pwr_button = of_property_read_bool(tps->dev->of_node, "ti,power-button"); 262 + if (pwr_button) { 263 + ret = devm_mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, 264 + &tps65219_pwrbutton_cell, 1, NULL, 0, 265 + regmap_irq_get_domain(tps->irq_data)); 266 + if (ret) { 267 + dev_err(tps->dev, "Failed to add power-button: %d\n", ret); 268 + return ret; 269 + } 270 + } 271 + 272 + tps->nb = pmic_rst_restart_nb; 273 + ret = register_restart_handler(&tps->nb); 274 + if (ret) { 275 + dev_err(tps->dev, "cannot register restart handler, %d\n", ret); 276 + return ret; 277 + } 278 + 279 + return 0; 280 + } 281 + 282 + static const struct of_device_id of_tps65219_match_table[] = { 283 + { .compatible = "ti,tps65219", }, 284 + {} 285 + }; 286 + MODULE_DEVICE_TABLE(of, of_tps65219_match_table); 287 + 288 + static struct i2c_driver tps65219_driver = { 289 + .driver = { 290 + .name = "tps65219", 291 + .of_match_table = of_tps65219_match_table, 292 + }, 293 + .probe_new = tps65219_probe, 294 + }; 295 + module_i2c_driver(tps65219_driver); 296 + 297 + MODULE_AUTHOR("Jerome Neanne <jneanne@baylibre.com>"); 298 + MODULE_DESCRIPTION("TPS65219 power management IC driver"); 299 + MODULE_LICENSE("GPL");
+3 -8
drivers/mfd/tps6586x.c
··· 269 269 mutex_unlock(&tps6586x->irq_lock); 270 270 } 271 271 272 - #ifdef CONFIG_PM_SLEEP 273 272 static int tps6586x_irq_set_wake(struct irq_data *irq_data, unsigned int on) 274 273 { 275 274 struct tps6586x *tps6586x = irq_data_get_irq_chip_data(irq_data); 276 275 return irq_set_irq_wake(tps6586x->irq, on); 277 276 } 278 - #else 279 - #define tps6586x_irq_set_wake NULL 280 - #endif 281 277 282 278 static struct irq_chip tps6586x_irq_chip = { 283 279 .name = "tps6586x", ··· 281 285 .irq_bus_sync_unlock = tps6586x_irq_sync_unlock, 282 286 .irq_disable = tps6586x_irq_disable, 283 287 .irq_enable = tps6586x_irq_enable, 284 - .irq_set_wake = tps6586x_irq_set_wake, 288 + .irq_set_wake = pm_sleep_ptr(tps6586x_irq_set_wake), 285 289 }; 286 290 287 291 static int tps6586x_irq_map(struct irq_domain *h, unsigned int virq, ··· 495 499 dev_info(&client->dev, "Found %s, VERSIONCRC is %02x\n", name, version); 496 500 } 497 501 498 - static int tps6586x_i2c_probe(struct i2c_client *client, 499 - const struct i2c_device_id *id) 502 + static int tps6586x_i2c_probe(struct i2c_client *client) 500 503 { 501 504 struct tps6586x_platform_data *pdata = dev_get_platdata(&client->dev); 502 505 struct tps6586x *tps6586x; ··· 619 624 .of_match_table = of_match_ptr(tps6586x_of_match), 620 625 .pm = &tps6586x_pm_ops, 621 626 }, 622 - .probe = tps6586x_i2c_probe, 627 + .probe_new = tps6586x_i2c_probe, 623 628 .remove = tps6586x_i2c_remove, 624 629 .id_table = tps6586x_id_table, 625 630 };
+3 -3
drivers/mfd/tps65910.c
··· 441 441 DEVCTRL_DEV_OFF_MASK); 442 442 } 443 443 444 - static int tps65910_i2c_probe(struct i2c_client *i2c, 445 - const struct i2c_device_id *id) 444 + static int tps65910_i2c_probe(struct i2c_client *i2c) 446 445 { 446 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 447 447 struct tps65910 *tps65910; 448 448 struct tps65910_board *pmic_plat_data; 449 449 struct tps65910_board *of_pmic_plat_data = NULL; ··· 535 535 .name = "tps65910", 536 536 .of_match_table = of_match_ptr(tps65910_of_match), 537 537 }, 538 - .probe = tps65910_i2c_probe, 538 + .probe_new = tps65910_i2c_probe, 539 539 .id_table = tps65910_i2c_id, 540 540 }; 541 541
+2 -3
drivers/mfd/tps65912-i2c.c
··· 21 21 }; 22 22 MODULE_DEVICE_TABLE(of, tps65912_i2c_of_match_table); 23 23 24 - static int tps65912_i2c_probe(struct i2c_client *client, 25 - const struct i2c_device_id *ids) 24 + static int tps65912_i2c_probe(struct i2c_client *client) 26 25 { 27 26 struct tps65912 *tps; 28 27 ··· 60 61 .name = "tps65912", 61 62 .of_match_table = tps65912_i2c_of_match_table, 62 63 }, 63 - .probe = tps65912_i2c_probe, 64 + .probe_new = tps65912_i2c_probe, 64 65 .remove = tps65912_i2c_remove, 65 66 .id_table = tps65912_i2c_id_table, 66 67 };
+3 -2
drivers/mfd/twl-core.c
··· 754 754 755 755 /* NOTE: This driver only handles a single twl4030/tps659x0 chip */ 756 756 static int 757 - twl_probe(struct i2c_client *client, const struct i2c_device_id *id) 757 + twl_probe(struct i2c_client *client) 758 758 { 759 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 759 760 struct device_node *node = client->dev.of_node; 760 761 struct platform_device *pdev; 761 762 const struct regmap_config *twl_regmap_config; ··· 956 955 .driver.name = DRIVER_NAME, 957 956 .driver.pm = &twl_dev_pm_ops, 958 957 .id_table = twl_ids, 959 - .probe = twl_probe, 958 + .probe_new = twl_probe, 960 959 .remove = twl_remove, 961 960 }; 962 961 builtin_i2c_driver(twl_driver);
+15 -19
drivers/mfd/twl6040.c
··· 17 17 #include <linux/platform_device.h> 18 18 #include <linux/of.h> 19 19 #include <linux/of_irq.h> 20 - #include <linux/of_gpio.h> 21 20 #include <linux/of_platform.h> 22 - #include <linux/gpio.h> 21 + #include <linux/gpio/consumer.h> 23 22 #include <linux/delay.h> 24 23 #include <linux/i2c.h> 25 24 #include <linux/regmap.h> ··· 250 251 { 251 252 int time_left; 252 253 253 - gpio_set_value(twl6040->audpwron, 1); 254 + gpiod_set_value_cansleep(twl6040->audpwron, 1); 254 255 255 256 time_left = wait_for_completion_timeout(&twl6040->ready, 256 257 msecs_to_jiffies(144)); ··· 261 262 intid = twl6040_reg_read(twl6040, TWL6040_REG_INTID); 262 263 if (!(intid & TWL6040_READYINT)) { 263 264 dev_err(twl6040->dev, "automatic power-up failed\n"); 264 - gpio_set_value(twl6040->audpwron, 0); 265 + gpiod_set_value_cansleep(twl6040->audpwron, 0); 265 266 return -ETIMEDOUT; 266 267 } 267 268 } ··· 289 290 /* Allow writes to the chip */ 290 291 regcache_cache_only(twl6040->regmap, false); 291 292 292 - if (gpio_is_valid(twl6040->audpwron)) { 293 + if (twl6040->audpwron) { 293 294 /* use automatic power-up sequence */ 294 295 ret = twl6040_power_up_automatic(twl6040); 295 296 if (ret) { ··· 336 337 if (--twl6040->power_count) 337 338 goto out; 338 339 339 - if (gpio_is_valid(twl6040->audpwron)) { 340 + if (twl6040->audpwron) { 340 341 /* use AUDPWRON line */ 341 - gpio_set_value(twl6040->audpwron, 0); 342 + gpiod_set_value_cansleep(twl6040->audpwron, 0); 342 343 343 344 /* power-down sequence latency */ 344 345 usleep_range(500, 700); ··· 632 633 .mask_base = TWL6040_REG_INTMR, 633 634 }; 634 635 635 - static int twl6040_probe(struct i2c_client *client, 636 - const struct i2c_device_id *id) 636 + static int twl6040_probe(struct i2c_client *client) 637 637 { 638 638 struct device_node *node = client->dev.of_node; 639 639 struct twl6040 *twl6040; ··· 710 712 } 711 713 712 714 /* ERRATA: Automatic power-up is not possible in ES1.0 */ 713 - if (twl6040_get_revid(twl6040) > TWL6040_REV_ES1_0) 714 - twl6040->audpwron = of_get_named_gpio(node, 715 - "ti,audpwron-gpio", 0); 716 - else 717 - twl6040->audpwron = -EINVAL; 718 - 719 - if (gpio_is_valid(twl6040->audpwron)) { 720 - ret = devm_gpio_request_one(&client->dev, twl6040->audpwron, 721 - GPIOF_OUT_INIT_LOW, "audpwron"); 715 + if (twl6040_get_revid(twl6040) > TWL6040_REV_ES1_0) { 716 + twl6040->audpwron = devm_gpiod_get_optional(&client->dev, 717 + "ti,audpwron", 718 + GPIOD_OUT_LOW); 719 + ret = PTR_ERR_OR_ZERO(twl6040->audpwron); 722 720 if (ret) 723 721 goto gpio_err; 722 + 723 + gpiod_set_consumer_name(twl6040->audpwron, "audpwron"); 724 724 725 725 /* Clear any pending interrupt */ 726 726 twl6040_reg_read(twl6040, TWL6040_REG_INTID); ··· 829 833 .driver = { 830 834 .name = "twl6040", 831 835 }, 832 - .probe = twl6040_probe, 836 + .probe_new = twl6040_probe, 833 837 .remove = twl6040_remove, 834 838 .id_table = twl6040_i2c_id, 835 839 };
+3 -4
drivers/mfd/ucb1x00-core.c
··· 660 660 mutex_unlock(&ucb1x00_mutex); 661 661 } 662 662 663 - #ifdef CONFIG_PM_SLEEP 664 663 static int ucb1x00_suspend(struct device *dev) 665 664 { 666 665 struct ucb1x00_plat_data *pdata = dev_get_platdata(dev); ··· 727 728 mutex_unlock(&ucb1x00_mutex); 728 729 return 0; 729 730 } 730 - #endif 731 731 732 - static SIMPLE_DEV_PM_OPS(ucb1x00_pm_ops, ucb1x00_suspend, ucb1x00_resume); 732 + static DEFINE_SIMPLE_DEV_PM_OPS(ucb1x00_pm_ops, 733 + ucb1x00_suspend, ucb1x00_resume); 733 734 734 735 static struct mcp_driver ucb1x00_driver = { 735 736 .drv = { 736 737 .name = "ucb1x00", 737 738 .owner = THIS_MODULE, 738 - .pm = &ucb1x00_pm_ops, 739 + .pm = pm_sleep_ptr(&ucb1x00_pm_ops), 739 740 }, 740 741 .probe = ucb1x00_probe, 741 742 .remove = ucb1x00_remove,
+8 -3
drivers/mfd/wcd934x.c
··· 55 55 WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_SOUNDWIRE, 2, BIT(4)), 56 56 }; 57 57 58 + static const unsigned int wcd934x_config_regs[] = { 59 + WCD934X_INTR_LEVEL0, 60 + }; 61 + 58 62 static const struct regmap_irq_chip wcd934x_regmap_irq_chip = { 59 63 .name = "wcd934x_irq", 60 64 .status_base = WCD934X_INTR_PIN1_STATUS0, 61 65 .mask_base = WCD934X_INTR_PIN1_MASK0, 62 66 .ack_base = WCD934X_INTR_PIN1_CLEAR0, 63 - .type_base = WCD934X_INTR_LEVEL0, 64 - .num_type_reg = 4, 65 - .type_in_mask = false, 66 67 .num_regs = 4, 67 68 .irqs = wcd934x_irqs, 68 69 .num_irqs = ARRAY_SIZE(wcd934x_irqs), 70 + .config_base = wcd934x_config_regs, 71 + .num_config_bases = ARRAY_SIZE(wcd934x_config_regs), 72 + .num_config_regs = 4, 73 + .set_type_config = regmap_irq_set_type_config_simple, 69 74 }; 70 75 71 76 static bool wcd934x_is_volatile_register(struct device *dev, unsigned int reg)
+2 -3
drivers/mfd/wl1273-core.c
··· 156 156 return 0; 157 157 } 158 158 159 - static int wl1273_core_probe(struct i2c_client *client, 160 - const struct i2c_device_id *id) 159 + static int wl1273_core_probe(struct i2c_client *client) 161 160 { 162 161 struct wl1273_fm_platform_data *pdata = dev_get_platdata(&client->dev); 163 162 struct wl1273_core *core; ··· 232 233 .driver = { 233 234 .name = WL1273_FM_DRIVER_NAME, 234 235 }, 235 - .probe = wl1273_core_probe, 236 + .probe_new = wl1273_core_probe, 236 237 .id_table = wl1273_driver_id_table, 237 238 }; 238 239
+3 -3
drivers/mfd/wm831x-i2c.c
··· 21 21 #include <linux/mfd/wm831x/core.h> 22 22 #include <linux/mfd/wm831x/pdata.h> 23 23 24 - static int wm831x_i2c_probe(struct i2c_client *i2c, 25 - const struct i2c_device_id *id) 24 + static int wm831x_i2c_probe(struct i2c_client *i2c) 26 25 { 26 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 27 27 struct wm831x_pdata *pdata = dev_get_platdata(&i2c->dev); 28 28 const struct of_device_id *of_id; 29 29 struct wm831x *wm831x; ··· 102 102 .of_match_table = of_match_ptr(wm831x_of_match), 103 103 .suppress_bind_attrs = true, 104 104 }, 105 - .probe = wm831x_i2c_probe, 105 + .probe_new = wm831x_i2c_probe, 106 106 .id_table = wm831x_i2c_id, 107 107 }; 108 108
+2 -3
drivers/mfd/wm8350-i2c.c
··· 16 16 #include <linux/regmap.h> 17 17 #include <linux/slab.h> 18 18 19 - static int wm8350_i2c_probe(struct i2c_client *i2c, 20 - const struct i2c_device_id *id) 19 + static int wm8350_i2c_probe(struct i2c_client *i2c) 21 20 { 22 21 struct wm8350 *wm8350; 23 22 struct wm8350_platform_data *pdata = dev_get_platdata(&i2c->dev); ··· 52 53 .name = "wm8350", 53 54 .suppress_bind_attrs = true, 54 55 }, 55 - .probe = wm8350_i2c_probe, 56 + .probe_new = wm8350_i2c_probe, 56 57 .id_table = wm8350_i2c_id, 57 58 }; 58 59
+2 -3
drivers/mfd/wm8400-core.c
··· 118 118 EXPORT_SYMBOL_GPL(wm8400_reset_codec_reg_cache); 119 119 120 120 #if IS_ENABLED(CONFIG_I2C) 121 - static int wm8400_i2c_probe(struct i2c_client *i2c, 122 - const struct i2c_device_id *id) 121 + static int wm8400_i2c_probe(struct i2c_client *i2c) 123 122 { 124 123 struct wm8400 *wm8400; 125 124 ··· 145 146 .driver = { 146 147 .name = "WM8400", 147 148 }, 148 - .probe = wm8400_i2c_probe, 149 + .probe_new = wm8400_i2c_probe, 149 150 .id_table = wm8400_i2c_id, 150 151 }; 151 152 #endif
+5 -7
drivers/mfd/wm8994-core.c
··· 110 110 "SPKVDD2", 111 111 }; 112 112 113 - #ifdef CONFIG_PM 114 113 static int wm8994_suspend(struct device *dev) 115 114 { 116 115 struct wm8994 *wm8994 = dev_get_drvdata(dev); ··· 212 213 213 214 return ret; 214 215 } 215 - #endif 216 216 217 217 #ifdef CONFIG_REGULATOR 218 218 static int wm8994_ldo_in_use(struct wm8994_pdata *pdata, int ldo) ··· 621 623 }; 622 624 MODULE_DEVICE_TABLE(of, wm8994_of_match); 623 625 624 - static int wm8994_i2c_probe(struct i2c_client *i2c, 625 - const struct i2c_device_id *id) 626 + static int wm8994_i2c_probe(struct i2c_client *i2c) 626 627 { 628 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 627 629 const struct of_device_id *of_id; 628 630 struct wm8994 *wm8994; 629 631 int ret; ··· 672 674 MODULE_DEVICE_TABLE(i2c, wm8994_i2c_id); 673 675 674 676 static const struct dev_pm_ops wm8994_pm_ops = { 675 - SET_RUNTIME_PM_OPS(wm8994_suspend, wm8994_resume, NULL) 677 + RUNTIME_PM_OPS(wm8994_suspend, wm8994_resume, NULL) 676 678 }; 677 679 678 680 static struct i2c_driver wm8994_i2c_driver = { 679 681 .driver = { 680 682 .name = "wm8994", 681 - .pm = &wm8994_pm_ops, 683 + .pm = pm_ptr(&wm8994_pm_ops), 682 684 .of_match_table = wm8994_of_match, 683 685 }, 684 - .probe = wm8994_i2c_probe, 686 + .probe_new = wm8994_i2c_probe, 685 687 .remove = wm8994_i2c_remove, 686 688 .id_table = wm8994_i2c_id, 687 689 };
-6
drivers/rtc/Kconfig
··· 540 540 This driver can also be built as a module. If so, the module 541 541 will be called rtc-bq32k. 542 542 543 - config RTC_DRV_DM355EVM 544 - tristate "TI DaVinci DM355 EVM RTC" 545 - depends on MFD_DM355EVM_MSP 546 - help 547 - Supports the RTC firmware in the MSP430 on the DM355 EVM. 548 - 549 543 config RTC_DRV_TWL92330 550 544 bool "TI TWL92330/Menelaus" 551 545 depends on MENELAUS
-1
drivers/rtc/Makefile
··· 45 45 obj-$(CONFIG_RTC_DRV_DA9055) += rtc-da9055.o 46 46 obj-$(CONFIG_RTC_DRV_DA9063) += rtc-da9063.o 47 47 obj-$(CONFIG_RTC_DRV_DIGICOLOR) += rtc-digicolor.o 48 - obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o 49 48 obj-$(CONFIG_RTC_DRV_DS1216) += rtc-ds1216.o 50 49 obj-$(CONFIG_RTC_DRV_DS1286) += rtc-ds1286.o 51 50 obj-$(CONFIG_RTC_DRV_DS1302) += rtc-ds1302.o
-151
drivers/rtc/rtc-dm355evm.c
··· 1 - // SPDX-License-Identifier: GPL-2.0+ 2 - /* 3 - * rtc-dm355evm.c - access battery-backed counter in MSP430 firmware 4 - * 5 - * Copyright (c) 2008 by David Brownell 6 - */ 7 - #include <linux/kernel.h> 8 - #include <linux/init.h> 9 - #include <linux/rtc.h> 10 - #include <linux/platform_device.h> 11 - 12 - #include <linux/mfd/dm355evm_msp.h> 13 - #include <linux/module.h> 14 - 15 - 16 - /* 17 - * The MSP430 firmware on the DM355 EVM uses a watch crystal to feed 18 - * a 1 Hz counter. When a backup battery is supplied, that makes a 19 - * reasonable RTC for applications where alarms and non-NTP drift 20 - * compensation aren't important. 21 - * 22 - * The only real glitch is the inability to read or write all four 23 - * counter bytes atomically: the count may increment in the middle 24 - * of an operation, causing trouble when the LSB rolls over. 25 - * 26 - * This driver was tested with firmware revision A4. 27 - */ 28 - union evm_time { 29 - u8 bytes[4]; 30 - u32 value; 31 - }; 32 - 33 - static int dm355evm_rtc_read_time(struct device *dev, struct rtc_time *tm) 34 - { 35 - union evm_time time; 36 - int status; 37 - int tries = 0; 38 - 39 - do { 40 - /* 41 - * Read LSB(0) to MSB(3) bytes. Defend against the counter 42 - * rolling over by re-reading until the value is stable, 43 - * and assuming the four reads take at most a few seconds. 44 - */ 45 - status = dm355evm_msp_read(DM355EVM_MSP_RTC_0); 46 - if (status < 0) 47 - return status; 48 - if (tries && time.bytes[0] == status) 49 - break; 50 - time.bytes[0] = status; 51 - 52 - status = dm355evm_msp_read(DM355EVM_MSP_RTC_1); 53 - if (status < 0) 54 - return status; 55 - if (tries && time.bytes[1] == status) 56 - break; 57 - time.bytes[1] = status; 58 - 59 - status = dm355evm_msp_read(DM355EVM_MSP_RTC_2); 60 - if (status < 0) 61 - return status; 62 - if (tries && time.bytes[2] == status) 63 - break; 64 - time.bytes[2] = status; 65 - 66 - status = dm355evm_msp_read(DM355EVM_MSP_RTC_3); 67 - if (status < 0) 68 - return status; 69 - if (tries && time.bytes[3] == status) 70 - break; 71 - time.bytes[3] = status; 72 - 73 - } while (++tries < 5); 74 - 75 - dev_dbg(dev, "read timestamp %08x\n", time.value); 76 - 77 - rtc_time64_to_tm(le32_to_cpu(time.value), tm); 78 - return 0; 79 - } 80 - 81 - static int dm355evm_rtc_set_time(struct device *dev, struct rtc_time *tm) 82 - { 83 - union evm_time time; 84 - unsigned long value; 85 - int status; 86 - 87 - value = rtc_tm_to_time64(tm); 88 - time.value = cpu_to_le32(value); 89 - 90 - dev_dbg(dev, "write timestamp %08x\n", time.value); 91 - 92 - /* 93 - * REVISIT handle non-atomic writes ... maybe just retry until 94 - * byte[1] sticks (no rollover)? 95 - */ 96 - status = dm355evm_msp_write(time.bytes[0], DM355EVM_MSP_RTC_0); 97 - if (status < 0) 98 - return status; 99 - 100 - status = dm355evm_msp_write(time.bytes[1], DM355EVM_MSP_RTC_1); 101 - if (status < 0) 102 - return status; 103 - 104 - status = dm355evm_msp_write(time.bytes[2], DM355EVM_MSP_RTC_2); 105 - if (status < 0) 106 - return status; 107 - 108 - status = dm355evm_msp_write(time.bytes[3], DM355EVM_MSP_RTC_3); 109 - if (status < 0) 110 - return status; 111 - 112 - return 0; 113 - } 114 - 115 - static const struct rtc_class_ops dm355evm_rtc_ops = { 116 - .read_time = dm355evm_rtc_read_time, 117 - .set_time = dm355evm_rtc_set_time, 118 - }; 119 - 120 - /*----------------------------------------------------------------------*/ 121 - 122 - static int dm355evm_rtc_probe(struct platform_device *pdev) 123 - { 124 - struct rtc_device *rtc; 125 - 126 - rtc = devm_rtc_allocate_device(&pdev->dev); 127 - if (IS_ERR(rtc)) 128 - return PTR_ERR(rtc); 129 - 130 - platform_set_drvdata(pdev, rtc); 131 - 132 - rtc->ops = &dm355evm_rtc_ops; 133 - rtc->range_max = U32_MAX; 134 - 135 - return devm_rtc_register_device(rtc); 136 - } 137 - 138 - /* 139 - * I2C is used to talk to the MSP430, but this platform device is 140 - * exposed by an MFD driver that manages I2C communications. 141 - */ 142 - static struct platform_driver rtc_dm355evm_driver = { 143 - .probe = dm355evm_rtc_probe, 144 - .driver = { 145 - .name = "rtc-dm355evm", 146 - }, 147 - }; 148 - 149 - module_platform_driver(rtc_dm355evm_driver); 150 - 151 - MODULE_LICENSE("GPL");
-23
include/linux/htcpld.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __LINUX_HTCPLD_H 3 - #define __LINUX_HTCPLD_H 4 - 5 - struct htcpld_chip_platform_data { 6 - unsigned int addr; 7 - unsigned int reset; 8 - unsigned int num_gpios; 9 - unsigned int gpio_out_base; 10 - unsigned int gpio_in_base; 11 - unsigned int irq_base; 12 - unsigned int num_irqs; 13 - }; 14 - 15 - struct htcpld_core_platform_data { 16 - unsigned int i2c_adapter_id; 17 - 18 - struct htcpld_chip_platform_data *chip; 19 - unsigned int num_chip; 20 - }; 21 - 22 - #endif /* __LINUX_HTCPLD_H */ 23 -
-79
include/linux/mfd/dm355evm_msp.h
··· 1 - /* 2 - * dm355evm_msp.h - support MSP430 microcontroller on DM355EVM board 3 - */ 4 - #ifndef __LINUX_I2C_DM355EVM_MSP 5 - #define __LINUX_I2C_DM355EVM_MSP 6 - 7 - /* 8 - * Written against Spectrum's writeup for the A4 firmware revision, 9 - * and tweaked to match source and rev D2 schematics by removing CPLD 10 - * and NOR flash hooks (which were last appropriate in rev B boards). 11 - * 12 - * Note that the firmware supports a flavor of write posting ... to be 13 - * sure a write completes, issue another read or write. 14 - */ 15 - 16 - /* utilities to access "registers" emulated by msp430 firmware */ 17 - extern int dm355evm_msp_write(u8 value, u8 reg); 18 - extern int dm355evm_msp_read(u8 reg); 19 - 20 - 21 - /* command/control registers */ 22 - #define DM355EVM_MSP_COMMAND 0x00 23 - # define MSP_COMMAND_NULL 0 24 - # define MSP_COMMAND_RESET_COLD 1 25 - # define MSP_COMMAND_RESET_WARM 2 26 - # define MSP_COMMAND_RESET_WARM_I 3 27 - # define MSP_COMMAND_POWEROFF 4 28 - # define MSP_COMMAND_IR_REINIT 5 29 - #define DM355EVM_MSP_STATUS 0x01 30 - # define MSP_STATUS_BAD_OFFSET BIT(0) 31 - # define MSP_STATUS_BAD_COMMAND BIT(1) 32 - # define MSP_STATUS_POWER_ERROR BIT(2) 33 - # define MSP_STATUS_RXBUF_OVERRUN BIT(3) 34 - #define DM355EVM_MSP_RESET 0x02 /* 0 bits == in reset */ 35 - # define MSP_RESET_DC5 BIT(0) 36 - # define MSP_RESET_TVP5154 BIT(2) 37 - # define MSP_RESET_IMAGER BIT(3) 38 - # define MSP_RESET_ETHERNET BIT(4) 39 - # define MSP_RESET_SYS BIT(5) 40 - # define MSP_RESET_AIC33 BIT(7) 41 - 42 - /* GPIO registers ... bit patterns mostly match the source MSP ports */ 43 - #define DM355EVM_MSP_LED 0x03 /* active low (MSP P4) */ 44 - #define DM355EVM_MSP_SWITCH1 0x04 /* (MSP P5, masked) */ 45 - # define MSP_SWITCH1_SW6_1 BIT(0) 46 - # define MSP_SWITCH1_SW6_2 BIT(1) 47 - # define MSP_SWITCH1_SW6_3 BIT(2) 48 - # define MSP_SWITCH1_SW6_4 BIT(3) 49 - # define MSP_SWITCH1_J1 BIT(4) /* NTSC/PAL */ 50 - # define MSP_SWITCH1_MSP_INT BIT(5) /* active low */ 51 - #define DM355EVM_MSP_SWITCH2 0x05 /* (MSP P6, masked) */ 52 - # define MSP_SWITCH2_SW10 BIT(3) 53 - # define MSP_SWITCH2_SW11 BIT(4) 54 - # define MSP_SWITCH2_SW12 BIT(5) 55 - # define MSP_SWITCH2_SW13 BIT(6) 56 - # define MSP_SWITCH2_SW14 BIT(7) 57 - #define DM355EVM_MSP_SDMMC 0x06 /* (MSP P2, masked) */ 58 - # define MSP_SDMMC_0_WP BIT(1) 59 - # define MSP_SDMMC_0_CD BIT(2) /* active low */ 60 - # define MSP_SDMMC_1_WP BIT(3) 61 - # define MSP_SDMMC_1_CD BIT(4) /* active low */ 62 - #define DM355EVM_MSP_FIRMREV 0x07 /* not a GPIO (out of order) */ 63 - #define DM355EVM_MSP_VIDEO_IN 0x08 /* (MSP P3, masked) */ 64 - # define MSP_VIDEO_IMAGER BIT(7) /* low == tvp5146 */ 65 - 66 - /* power supply registers are currently omitted */ 67 - 68 - /* RTC registers */ 69 - #define DM355EVM_MSP_RTC_0 0x12 /* LSB */ 70 - #define DM355EVM_MSP_RTC_1 0x13 71 - #define DM355EVM_MSP_RTC_2 0x14 72 - #define DM355EVM_MSP_RTC_3 0x15 /* MSB */ 73 - 74 - /* input event queue registers; code == ((HIGH << 8) | LOW) */ 75 - #define DM355EVM_MSP_INPUT_COUNT 0x16 /* decrement by reading LOW */ 76 - #define DM355EVM_MSP_INPUT_HIGH 0x17 77 - #define DM355EVM_MSP_INPUT_LOW 0x18 78 - 79 - #endif /* __LINUX_I2C_DM355EVM_MSP */
-1
include/linux/mfd/palmas.h
··· 16 16 #include <linux/regmap.h> 17 17 #include <linux/regulator/driver.h> 18 18 #include <linux/extcon-provider.h> 19 - #include <linux/of_gpio.h> 20 19 #include <linux/usb/phy_companion.h> 21 20 22 21 #define PALMAS_NUM_CLIENTS 3
+2 -4
include/linux/mfd/pcf50633/core.h
··· 13 13 #include <linux/workqueue.h> 14 14 #include <linux/regulator/driver.h> 15 15 #include <linux/regulator/machine.h> 16 + #include <linux/pm.h> 16 17 #include <linux/power_supply.h> 17 18 #include <linux/mfd/pcf50633/backlight.h> 18 19 ··· 227 226 228 227 int pcf50633_irq_init(struct pcf50633 *pcf, int irq); 229 228 void pcf50633_irq_free(struct pcf50633 *pcf); 230 - #ifdef CONFIG_PM 231 - int pcf50633_irq_suspend(struct pcf50633 *pcf); 232 - int pcf50633_irq_resume(struct pcf50633 *pcf); 233 - #endif 229 + extern const struct dev_pm_ops pcf50633_pm; 234 230 235 231 #endif
-2
include/linux/mfd/stmfx.h
··· 113 113 struct irq_domain *irq_domain; 114 114 struct mutex lock; /* IRQ bus lock */ 115 115 u8 irq_src; 116 - #ifdef CONFIG_PM 117 116 u8 bkp_sysctrl; 118 117 u8 bkp_irqoutpin; 119 - #endif 120 118 }; 121 119 122 120 int stmfx_function_enable(struct stmfx *stmfx, u32 func);
+345
include/linux/mfd/tps65219.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Functions to access TPS65219 Power Management IC. 4 + * 5 + * Copyright (C) 2022 BayLibre Incorporated - https://www.baylibre.com/ 6 + */ 7 + 8 + #ifndef MFD_TPS65219_H 9 + #define MFD_TPS65219_H 10 + 11 + #include <linux/bitops.h> 12 + #include <linux/notifier.h> 13 + #include <linux/regulator/driver.h> 14 + 15 + struct regmap; 16 + struct regmap_irq_chip_data; 17 + 18 + #define TPS65219_1V35 1350000 19 + #define TPS65219_1V8 1800000 20 + 21 + /* TPS chip id list */ 22 + #define TPS65219 0xF0 23 + 24 + /* I2C ID for TPS65219 part */ 25 + #define TPS65219_I2C_ID 0x24 26 + 27 + /* All register addresses */ 28 + #define TPS65219_REG_TI_DEV_ID 0x00 29 + #define TPS65219_REG_NVM_ID 0x01 30 + #define TPS65219_REG_ENABLE_CTRL 0x02 31 + #define TPS65219_REG_BUCKS_CONFIG 0x03 32 + #define TPS65219_REG_LDO4_VOUT 0x04 33 + #define TPS65219_REG_LDO3_VOUT 0x05 34 + #define TPS65219_REG_LDO2_VOUT 0x06 35 + #define TPS65219_REG_LDO1_VOUT 0x07 36 + #define TPS65219_REG_BUCK3_VOUT 0x8 37 + #define TPS65219_REG_BUCK2_VOUT 0x9 38 + #define TPS65219_REG_BUCK1_VOUT 0xA 39 + #define TPS65219_REG_LDO4_SEQUENCE_SLOT 0xB 40 + #define TPS65219_REG_LDO3_SEQUENCE_SLOT 0xC 41 + #define TPS65219_REG_LDO2_SEQUENCE_SLOT 0xD 42 + #define TPS65219_REG_LDO1_SEQUENCE_SLOT 0xE 43 + #define TPS65219_REG_BUCK3_SEQUENCE_SLOT 0xF 44 + #define TPS65219_REG_BUCK2_SEQUENCE_SLOT 0x10 45 + #define TPS65219_REG_BUCK1_SEQUENCE_SLOT 0x11 46 + #define TPS65219_REG_nRST_SEQUENCE_SLOT 0x12 47 + #define TPS65219_REG_GPIO_SEQUENCE_SLOT 0x13 48 + #define TPS65219_REG_GPO2_SEQUENCE_SLOT 0x14 49 + #define TPS65219_REG_GPO1_SEQUENCE_SLOT 0x15 50 + #define TPS65219_REG_POWER_UP_SLOT_DURATION_1 0x16 51 + #define TPS65219_REG_POWER_UP_SLOT_DURATION_2 0x17 52 + #define TPS65219_REG_POWER_UP_SLOT_DURATION_3 0x18 53 + #define TPS65219_REG_POWER_UP_SLOT_DURATION_4 0x19 54 + #define TPS65219_REG_POWER_DOWN_SLOT_DURATION_1 0x1A 55 + #define TPS65219_REG_POWER_DOWN_SLOT_DURATION_2 0x1B 56 + #define TPS65219_REG_POWER_DOWN_SLOT_DURATION_3 0x1C 57 + #define TPS65219_REG_POWER_DOWN_SLOT_DURATION_4 0x1D 58 + #define TPS65219_REG_GENERAL_CONFIG 0x1E 59 + #define TPS65219_REG_MFP_1_CONFIG 0x1F 60 + #define TPS65219_REG_MFP_2_CONFIG 0x20 61 + #define TPS65219_REG_STBY_1_CONFIG 0x21 62 + #define TPS65219_REG_STBY_2_CONFIG 0x22 63 + #define TPS65219_REG_OC_DEGL_CONFIG 0x23 64 + /* 'sub irq' MASK registers */ 65 + #define TPS65219_REG_INT_MASK_UV 0x24 66 + #define TPS65219_REG_MASK_CONFIG 0x25 67 + 68 + #define TPS65219_REG_I2C_ADDRESS_REG 0x26 69 + #define TPS65219_REG_USER_GENERAL_NVM_STORAGE 0x27 70 + #define TPS65219_REG_MANUFACTURING_VER 0x28 71 + #define TPS65219_REG_MFP_CTRL 0x29 72 + #define TPS65219_REG_DISCHARGE_CONFIG 0x2A 73 + /* main irq registers */ 74 + #define TPS65219_REG_INT_SOURCE 0x2B 75 + /* 'sub irq' registers */ 76 + #define TPS65219_REG_INT_LDO_3_4 0x2C 77 + #define TPS65219_REG_INT_LDO_1_2 0x2D 78 + #define TPS65219_REG_INT_BUCK_3 0x2E 79 + #define TPS65219_REG_INT_BUCK_1_2 0x2F 80 + #define TPS65219_REG_INT_SYSTEM 0x30 81 + #define TPS65219_REG_INT_RV 0x31 82 + #define TPS65219_REG_INT_TIMEOUT_RV_SD 0x32 83 + #define TPS65219_REG_INT_PB 0x33 84 + 85 + #define TPS65219_REG_INT_LDO_3_4_POS 0 86 + #define TPS65219_REG_INT_LDO_1_2_POS 1 87 + #define TPS65219_REG_INT_BUCK_3_POS 2 88 + #define TPS65219_REG_INT_BUCK_1_2_POS 3 89 + #define TPS65219_REG_INT_SYS_POS 4 90 + #define TPS65219_REG_INT_RV_POS 5 91 + #define TPS65219_REG_INT_TO_RV_POS 6 92 + #define TPS65219_REG_INT_PB_POS 7 93 + 94 + #define TPS65219_REG_USER_NVM_CMD 0x34 95 + #define TPS65219_REG_POWER_UP_STATUS 0x35 96 + #define TPS65219_REG_SPARE_2 0x36 97 + #define TPS65219_REG_SPARE_3 0x37 98 + #define TPS65219_REG_FACTORY_CONFIG_2 0x41 99 + 100 + /* Register field definitions */ 101 + #define TPS65219_DEVID_REV_MASK GENMASK(7, 0) 102 + #define TPS65219_BUCKS_LDOS_VOUT_VSET_MASK GENMASK(5, 0) 103 + #define TPS65219_BUCKS_UV_THR_SEL_MASK BIT(6) 104 + #define TPS65219_BUCKS_BW_SEL_MASK BIT(7) 105 + #define LDO_BYP_SHIFT 6 106 + #define TPS65219_LDOS_BYP_CONFIG_MASK BIT(LDO_BYP_SHIFT) 107 + #define TPS65219_LDOS_LSW_CONFIG_MASK BIT(7) 108 + /* Regulators enable control */ 109 + #define TPS65219_ENABLE_BUCK1_EN_MASK BIT(0) 110 + #define TPS65219_ENABLE_BUCK2_EN_MASK BIT(1) 111 + #define TPS65219_ENABLE_BUCK3_EN_MASK BIT(2) 112 + #define TPS65219_ENABLE_LDO1_EN_MASK BIT(3) 113 + #define TPS65219_ENABLE_LDO2_EN_MASK BIT(4) 114 + #define TPS65219_ENABLE_LDO3_EN_MASK BIT(5) 115 + #define TPS65219_ENABLE_LDO4_EN_MASK BIT(6) 116 + /* power ON-OFF sequence slot */ 117 + #define TPS65219_BUCKS_LDOS_SEQUENCE_OFF_SLOT_MASK GENMASK(3, 0) 118 + #define TPS65219_BUCKS_LDOS_SEQUENCE_ON_SLOT_MASK GENMASK(7, 4) 119 + /* TODO: Not needed, same mapping as TPS65219_ENABLE_REGNAME_EN, factorize */ 120 + #define TPS65219_STBY1_BUCK1_STBY_EN_MASK BIT(0) 121 + #define TPS65219_STBY1_BUCK2_STBY_EN_MASK BIT(1) 122 + #define TPS65219_STBY1_BUCK3_STBY_EN_MASK BIT(2) 123 + #define TPS65219_STBY1_LDO1_STBY_EN_MASK BIT(3) 124 + #define TPS65219_STBY1_LDO2_STBY_EN_MASK BIT(4) 125 + #define TPS65219_STBY1_LDO3_STBY_EN_MASK BIT(5) 126 + #define TPS65219_STBY1_LDO4_STBY_EN_MASK BIT(6) 127 + /* STBY_2 config */ 128 + #define TPS65219_STBY2_GPO1_STBY_EN_MASK BIT(0) 129 + #define TPS65219_STBY2_GPO2_STBY_EN_MASK BIT(1) 130 + #define TPS65219_STBY2_GPIO_STBY_EN_MASK BIT(2) 131 + /* MFP Control */ 132 + #define TPS65219_MFP_I2C_OFF_REQ_MASK BIT(0) 133 + #define TPS65219_MFP_STBY_I2C_CTRL_MASK BIT(1) 134 + #define TPS65219_MFP_COLD_RESET_I2C_CTRL_MASK BIT(2) 135 + #define TPS65219_MFP_WARM_RESET_I2C_CTRL_MASK BIT(3) 136 + #define TPS65219_MFP_GPIO_STATUS_MASK BIT(4) 137 + /* MFP_1 Config */ 138 + #define TPS65219_MFP_1_VSEL_DDR_SEL_MASK BIT(0) 139 + #define TPS65219_MFP_1_VSEL_SD_POL_MASK BIT(1) 140 + #define TPS65219_MFP_1_VSEL_RAIL_MASK BIT(2) 141 + /* MFP_2 Config */ 142 + #define TPS65219_MFP_2_MODE_STBY_MASK GENMASK(1, 0) 143 + #define TPS65219_MFP_2_MODE_RESET_MASK BIT(2) 144 + #define TPS65219_MFP_2_EN_PB_VSENSE_DEGL_MASK BIT(3) 145 + #define TPS65219_MFP_2_EN_PB_VSENSE_MASK GENMASK(5, 4) 146 + #define TPS65219_MFP_2_WARM_COLD_RESET_MASK BIT(6) 147 + #define TPS65219_MFP_2_PU_ON_FSD_MASK BIT(7) 148 + #define TPS65219_MFP_2_EN 0 149 + #define TPS65219_MFP_2_PB BIT(4) 150 + #define TPS65219_MFP_2_VSENSE BIT(5) 151 + /* MASK_UV Config */ 152 + #define TPS65219_REG_MASK_UV_LDO1_UV_MASK BIT(0) 153 + #define TPS65219_REG_MASK_UV_LDO2_UV_MASK BIT(1) 154 + #define TPS65219_REG_MASK_UV_LDO3_UV_MASK BIT(2) 155 + #define TPS65219_REG_MASK_UV_LDO4_UV_MASK BIT(3) 156 + #define TPS65219_REG_MASK_UV_BUCK1_UV_MASK BIT(4) 157 + #define TPS65219_REG_MASK_UV_BUCK2_UV_MASK BIT(5) 158 + #define TPS65219_REG_MASK_UV_BUCK3_UV_MASK BIT(6) 159 + #define TPS65219_REG_MASK_UV_RETRY_MASK BIT(7) 160 + /* MASK Config */ 161 + // SENSOR_N_WARM_MASK already defined in Thermal 162 + #define TPS65219_REG_MASK_INT_FOR_RV_MASK BIT(4) 163 + #define TPS65219_REG_MASK_EFFECT_MASK GENMASK(2, 1) 164 + #define TPS65219_REG_MASK_INT_FOR_PB_MASK BIT(7) 165 + /* UnderVoltage - Short to GND - OverCurrent*/ 166 + /* LDO3-4 */ 167 + #define TPS65219_INT_LDO3_SCG_MASK BIT(0) 168 + #define TPS65219_INT_LDO3_OC_MASK BIT(1) 169 + #define TPS65219_INT_LDO3_UV_MASK BIT(2) 170 + #define TPS65219_INT_LDO4_SCG_MASK BIT(3) 171 + #define TPS65219_INT_LDO4_OC_MASK BIT(4) 172 + #define TPS65219_INT_LDO4_UV_MASK BIT(5) 173 + /* LDO1-2 */ 174 + #define TPS65219_INT_LDO1_SCG_MASK BIT(0) 175 + #define TPS65219_INT_LDO1_OC_MASK BIT(1) 176 + #define TPS65219_INT_LDO1_UV_MASK BIT(2) 177 + #define TPS65219_INT_LDO2_SCG_MASK BIT(3) 178 + #define TPS65219_INT_LDO2_OC_MASK BIT(4) 179 + #define TPS65219_INT_LDO2_UV_MASK BIT(5) 180 + /* BUCK3 */ 181 + #define TPS65219_INT_BUCK3_SCG_MASK BIT(0) 182 + #define TPS65219_INT_BUCK3_OC_MASK BIT(1) 183 + #define TPS65219_INT_BUCK3_NEG_OC_MASK BIT(2) 184 + #define TPS65219_INT_BUCK3_UV_MASK BIT(3) 185 + /* BUCK1-2 */ 186 + #define TPS65219_INT_BUCK1_SCG_MASK BIT(0) 187 + #define TPS65219_INT_BUCK1_OC_MASK BIT(1) 188 + #define TPS65219_INT_BUCK1_NEG_OC_MASK BIT(2) 189 + #define TPS65219_INT_BUCK1_UV_MASK BIT(3) 190 + #define TPS65219_INT_BUCK2_SCG_MASK BIT(4) 191 + #define TPS65219_INT_BUCK2_OC_MASK BIT(5) 192 + #define TPS65219_INT_BUCK2_NEG_OC_MASK BIT(6) 193 + #define TPS65219_INT_BUCK2_UV_MASK BIT(7) 194 + /* Thermal Sensor */ 195 + #define TPS65219_INT_SENSOR_3_WARM_MASK BIT(0) 196 + #define TPS65219_INT_SENSOR_2_WARM_MASK BIT(1) 197 + #define TPS65219_INT_SENSOR_1_WARM_MASK BIT(2) 198 + #define TPS65219_INT_SENSOR_0_WARM_MASK BIT(3) 199 + #define TPS65219_INT_SENSOR_3_HOT_MASK BIT(4) 200 + #define TPS65219_INT_SENSOR_2_HOT_MASK BIT(5) 201 + #define TPS65219_INT_SENSOR_1_HOT_MASK BIT(6) 202 + #define TPS65219_INT_SENSOR_0_HOT_MASK BIT(7) 203 + /* Residual Voltage */ 204 + #define TPS65219_INT_BUCK1_RV_MASK BIT(0) 205 + #define TPS65219_INT_BUCK2_RV_MASK BIT(1) 206 + #define TPS65219_INT_BUCK3_RV_MASK BIT(2) 207 + #define TPS65219_INT_LDO1_RV_MASK BIT(3) 208 + #define TPS65219_INT_LDO2_RV_MASK BIT(4) 209 + #define TPS65219_INT_LDO3_RV_MASK BIT(5) 210 + #define TPS65219_INT_LDO4_RV_MASK BIT(6) 211 + /* Residual Voltage ShutDown */ 212 + #define TPS65219_INT_BUCK1_RV_SD_MASK BIT(0) 213 + #define TPS65219_INT_BUCK2_RV_SD_MASK BIT(1) 214 + #define TPS65219_INT_BUCK3_RV_SD_MASK BIT(2) 215 + #define TPS65219_INT_LDO1_RV_SD_MASK BIT(3) 216 + #define TPS65219_INT_LDO2_RV_SD_MASK BIT(4) 217 + #define TPS65219_INT_LDO3_RV_SD_MASK BIT(5) 218 + #define TPS65219_INT_LDO4_RV_SD_MASK BIT(6) 219 + #define TPS65219_INT_TIMEOUT_MASK BIT(7) 220 + /* Power Button */ 221 + #define TPS65219_INT_PB_FALLING_EDGE_DETECT_MASK BIT(0) 222 + #define TPS65219_INT_PB_RISING_EDGE_DETECT_MASK BIT(1) 223 + #define TPS65219_INT_PB_REAL_TIME_STATUS_MASK BIT(2) 224 + 225 + #define TPS65219_PB_POS 7 226 + #define TPS65219_TO_RV_POS 6 227 + #define TPS65219_RV_POS 5 228 + #define TPS65219_SYS_POS 4 229 + #define TPS65219_BUCK_1_2_POS 3 230 + #define TPS65219_BUCK_3_POS 2 231 + #define TPS65219_LDO_1_2_POS 1 232 + #define TPS65219_LDO_3_4_POS 0 233 + 234 + /* IRQs */ 235 + enum { 236 + /* LDO3-4 register IRQs */ 237 + TPS65219_INT_LDO3_SCG, 238 + TPS65219_INT_LDO3_OC, 239 + TPS65219_INT_LDO3_UV, 240 + TPS65219_INT_LDO4_SCG, 241 + TPS65219_INT_LDO4_OC, 242 + TPS65219_INT_LDO4_UV, 243 + /* LDO1-2 */ 244 + TPS65219_INT_LDO1_SCG, 245 + TPS65219_INT_LDO1_OC, 246 + TPS65219_INT_LDO1_UV, 247 + TPS65219_INT_LDO2_SCG, 248 + TPS65219_INT_LDO2_OC, 249 + TPS65219_INT_LDO2_UV, 250 + /* BUCK3 */ 251 + TPS65219_INT_BUCK3_SCG, 252 + TPS65219_INT_BUCK3_OC, 253 + TPS65219_INT_BUCK3_NEG_OC, 254 + TPS65219_INT_BUCK3_UV, 255 + /* BUCK1-2 */ 256 + TPS65219_INT_BUCK1_SCG, 257 + TPS65219_INT_BUCK1_OC, 258 + TPS65219_INT_BUCK1_NEG_OC, 259 + TPS65219_INT_BUCK1_UV, 260 + TPS65219_INT_BUCK2_SCG, 261 + TPS65219_INT_BUCK2_OC, 262 + TPS65219_INT_BUCK2_NEG_OC, 263 + TPS65219_INT_BUCK2_UV, 264 + /* Thermal Sensor */ 265 + TPS65219_INT_SENSOR_3_WARM, 266 + TPS65219_INT_SENSOR_2_WARM, 267 + TPS65219_INT_SENSOR_1_WARM, 268 + TPS65219_INT_SENSOR_0_WARM, 269 + TPS65219_INT_SENSOR_3_HOT, 270 + TPS65219_INT_SENSOR_2_HOT, 271 + TPS65219_INT_SENSOR_1_HOT, 272 + TPS65219_INT_SENSOR_0_HOT, 273 + /* Residual Voltage */ 274 + TPS65219_INT_BUCK1_RV, 275 + TPS65219_INT_BUCK2_RV, 276 + TPS65219_INT_BUCK3_RV, 277 + TPS65219_INT_LDO1_RV, 278 + TPS65219_INT_LDO2_RV, 279 + TPS65219_INT_LDO3_RV, 280 + TPS65219_INT_LDO4_RV, 281 + /* Residual Voltage ShutDown */ 282 + TPS65219_INT_BUCK1_RV_SD, 283 + TPS65219_INT_BUCK2_RV_SD, 284 + TPS65219_INT_BUCK3_RV_SD, 285 + TPS65219_INT_LDO1_RV_SD, 286 + TPS65219_INT_LDO2_RV_SD, 287 + TPS65219_INT_LDO3_RV_SD, 288 + TPS65219_INT_LDO4_RV_SD, 289 + TPS65219_INT_TIMEOUT, 290 + /* Power Button */ 291 + TPS65219_INT_PB_FALLING_EDGE_DETECT, 292 + TPS65219_INT_PB_RISING_EDGE_DETECT, 293 + }; 294 + 295 + enum tps65219_regulator_id { 296 + /* DCDC's */ 297 + TPS65219_BUCK_1, 298 + TPS65219_BUCK_2, 299 + TPS65219_BUCK_3, 300 + /* LDOs */ 301 + TPS65219_LDO_1, 302 + TPS65219_LDO_2, 303 + TPS65219_LDO_3, 304 + TPS65219_LDO_4, 305 + }; 306 + 307 + /* Number of step-down converters available */ 308 + #define TPS65219_NUM_DCDC 3 309 + /* Number of LDO voltage regulators available */ 310 + #define TPS65219_NUM_LDO 4 311 + /* Number of total regulators available */ 312 + #define TPS65219_NUM_REGULATOR (TPS65219_NUM_DCDC + TPS65219_NUM_LDO) 313 + 314 + /* Define the TPS65219 IRQ numbers */ 315 + enum tps65219_irqs { 316 + /* INT source registers */ 317 + TPS65219_TO_RV_SD_SET_IRQ, 318 + TPS65219_RV_SET_IRQ, 319 + TPS65219_SYS_SET_IRQ, 320 + TPS65219_BUCK_1_2_SET_IRQ, 321 + TPS65219_BUCK_3_SET_IRQ, 322 + TPS65219_LDO_1_2_SET_IRQ, 323 + TPS65219_LDO_3_4_SET_IRQ, 324 + TPS65219_PB_SET_IRQ, 325 + }; 326 + 327 + /** 328 + * struct tps65219 - tps65219 sub-driver chip access routines 329 + * 330 + * Device data may be used to access the TPS65219 chip 331 + * 332 + * @dev: MFD device 333 + * @regmap: Regmap for accessing the device registers 334 + * @irq_data: Regmap irq data used for the irq chip 335 + * @nb: notifier block for the restart handler 336 + */ 337 + struct tps65219 { 338 + struct device *dev; 339 + struct regmap *regmap; 340 + 341 + struct regmap_irq_chip_data *irq_data; 342 + struct notifier_block nb; 343 + }; 344 + 345 + #endif /* MFD_TPS65219_H */
+2 -30
include/linux/mfd/twl6040.h
··· 174 174 175 175 #define TWL6040_GPO_MAX 3 176 176 177 - /* TODO: All platform data struct can be removed */ 178 - struct twl6040_codec_data { 179 - u16 hs_left_step; 180 - u16 hs_right_step; 181 - u16 hf_left_step; 182 - u16 hf_right_step; 183 - }; 184 - 185 - struct twl6040_vibra_data { 186 - unsigned int vibldrv_res; /* left driver resistance */ 187 - unsigned int vibrdrv_res; /* right driver resistance */ 188 - unsigned int viblmotor_res; /* left motor resistance */ 189 - unsigned int vibrmotor_res; /* right motor resistance */ 190 - int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */ 191 - int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */ 192 - }; 193 - 194 - struct twl6040_gpo_data { 195 - int gpio_base; 196 - }; 197 - 198 - struct twl6040_platform_data { 199 - int audpwron_gpio; /* audio power-on gpio */ 200 - 201 - struct twl6040_codec_data *codec; 202 - struct twl6040_vibra_data *vibra; 203 - struct twl6040_gpo_data *gpo; 204 - }; 205 - 177 + struct gpio_desc; 206 178 struct regmap; 207 179 struct regmap_irq_chips_data; 208 180 ··· 190 218 struct mfd_cell cells[TWL6040_CELLS]; 191 219 struct completion ready; 192 220 193 - int audpwron; 221 + struct gpio_desc *audpwron; 194 222 int power_count; 195 223 int rev; 196 224