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

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

Pull MFD updates from Lee Jones:
"New Drivers
- RK805 Power Management IC (PMIC)
- ROHM BD9571MWV-M MFD Power Management IC (PMIC)
- Texas Instruments TPS68470 Power Management IC (PMIC) & LEDs

New Device Support:
- Add support for HiSilicon Hi6421v530 to hi6421-pmic-core
- Add support for X-Powers AXP806 to axp20x
- Add support for X-Powers AXP813 to axp20x
- Add support for Intel Sunrise Point LPSS to intel-lpss-pci

New Functionality:
- Amend API to provide register layout; atmel-smc

Fix-ups:
- DT re-work; omap, nokia
- Header file location change {I2C => MFD}; dm355evm_msp, tps65010
- Fix chip ID formatting issue(s); rk808
- Optionally register touchscreen devices; da9052-core
- Documentation improvements; twl-core
- Constification; rtsx_pcr, ab8500-core, da9055-i2c, da9052-spi
- Drop unnecessary static declaration; max8925-i2c
- Kconfig changes (missing deps and remove module support)
- Slim down oversized licence statement; hi6421-pmic-core
- Use managed resources (devm_*); lp87565
- Supply proper error checking/handling; t7l66xb

Bug Fixes:
- Fix counter duplication issue; da9052-core
- Fix potential NULL deference issue; max8998
- Leave SPI-NOR write-protection bit alone; lpc_ich
- Ensure device is put into reset during suspend; intel-lpss
- Correct register offset variable size; omap-usb-tll"

* tag 'mfd-next-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (61 commits)
mfd: intel_soc_pmic: Differentiate between Bay and Cherry Trail CRC variants
mfd: intel_soc_pmic: Export separate mfd-cell configs for BYT and CHT
dt-bindings: mfd: Add bindings for ZII RAVE devices
mfd: omap-usb-tll: Fix register offsets
mfd: da9052: Constify spi_device_id
mfd: intel-lpss: Put I2C and SPI controllers into reset state on suspend
mfd: da9055: Constify i2c_device_id
mfd: intel-lpss: Add missing PCI ID for Intel Sunrise Point LPSS devices
mfd: t7l66xb: Handle return value of clk_prepare_enable
mfd: Add ROHM BD9571MWV-M PMIC DT bindings
mfd: intel_soc_pmic_chtwc: Turn Kconfig option into a bool
mfd: lp87565: Convert to use devm_mfd_add_devices()
mfd: Add support for TPS68470 device
mfd: lpc_ich: Do not touch SPI-NOR write protection bit on Haswell/Broadwell
mfd: syscon: atmel-smc: Add helper to retrieve register layout
mfd: axp20x: Use correct platform device ID for many PEK
dt-bindings: mfd: axp20x: Introduce bindings for AXP813
mfd: axp20x: Add support for AXP813 PMIC
dt-bindings: mfd: axp20x: Add AXP806 to supported list of chips
mfd: Add ROHM BD9571MWV-M MFD PMIC driver
...

+3317 -181
+57
Documentation/ABI/testing/sysfs-bus-iio-lptimer-stm32
··· 1 + What: /sys/bus/iio/devices/iio:deviceX/in_count0_preset 2 + KernelVersion: 4.13 3 + Contact: fabrice.gasnier@st.com 4 + Description: 5 + Reading returns the current preset value. Writing sets the 6 + preset value. Encoder counts continuously from 0 to preset 7 + value, depending on direction (up/down). 8 + 9 + What: /sys/bus/iio/devices/iio:deviceX/in_count_quadrature_mode_available 10 + KernelVersion: 4.13 11 + Contact: fabrice.gasnier@st.com 12 + Description: 13 + Reading returns the list possible quadrature modes. 14 + 15 + What: /sys/bus/iio/devices/iio:deviceX/in_count0_quadrature_mode 16 + KernelVersion: 4.13 17 + Contact: fabrice.gasnier@st.com 18 + Description: 19 + Configure the device counter quadrature modes: 20 + - non-quadrature: 21 + Encoder IN1 input servers as the count input (up 22 + direction). 23 + - quadrature: 24 + Encoder IN1 and IN2 inputs are mixed to get direction 25 + and count. 26 + 27 + What: /sys/bus/iio/devices/iio:deviceX/in_count_polarity_available 28 + KernelVersion: 4.13 29 + Contact: fabrice.gasnier@st.com 30 + Description: 31 + Reading returns the list possible active edges. 32 + 33 + What: /sys/bus/iio/devices/iio:deviceX/in_count0_polarity 34 + KernelVersion: 4.13 35 + Contact: fabrice.gasnier@st.com 36 + Description: 37 + Configure the device encoder/counter active edge: 38 + - rising-edge 39 + - falling-edge 40 + - both-edges 41 + 42 + In non-quadrature mode, device counts up on active edge. 43 + In quadrature mode, encoder counting scenarios are as follows: 44 + ---------------------------------------------------------------- 45 + | Active | Level on | IN1 signal | IN2 signal | 46 + | edge | opposite |------------------------------------------ 47 + | | signal | Rising | Falling | Rising | Falling | 48 + ---------------------------------------------------------------- 49 + | Rising | High -> | Down | - | Up | - | 50 + | edge | Low -> | Up | - | Down | - | 51 + ---------------------------------------------------------------- 52 + | Falling | High -> | - | Up | - | Down | 53 + | edge | Low -> | - | Down | - | Up | 54 + ---------------------------------------------------------------- 55 + | Both | High -> | Down | Up | Up | Down | 56 + | edges | Low -> | Up | Down | Down | Up | 57 + ----------------------------------------------------------------
+2 -2
Documentation/devicetree/bindings/i2c/i2c-cbus-gpio.txt
··· 20 20 #address-cells = <1>; 21 21 #size-cells = <0>; 22 22 23 - retu-mfd: retu@1 { 24 - compatible = "retu-mfd"; 23 + retu: retu@1 { 24 + compatible = "nokia,retu"; 25 25 reg = <0x1>; 26 26 }; 27 27 };
+27
Documentation/devicetree/bindings/iio/counter/stm32-lptimer-cnt.txt
··· 1 + STMicroelectronics STM32 Low-Power Timer quadrature encoder and counter 2 + 3 + STM32 Low-Power Timer provides several counter modes. It can be used as: 4 + - quadrature encoder to detect angular position and direction of rotary 5 + elements, from IN1 and IN2 input signals. 6 + - simple counter from IN1 input signal. 7 + 8 + Must be a sub-node of an STM32 Low-Power Timer device tree node. 9 + See ../mfd/stm32-lptimer.txt for details about the parent node. 10 + 11 + Required properties: 12 + - compatible: Must be "st,stm32-lptimer-counter". 13 + - pinctrl-names: Set to "default". 14 + - pinctrl-0: List of phandles pointing to pin configuration nodes, 15 + to set IN1/IN2 pins in mode of operation for Low-Power 16 + Timer input on external pin. 17 + 18 + Example: 19 + timer@40002400 { 20 + compatible = "st,stm32-lptimer"; 21 + ... 22 + counter { 23 + compatible = "st,stm32-lptimer-counter"; 24 + pinctrl-names = "default"; 25 + pinctrl-0 = <&lptim1_in_pins>; 26 + }; 27 + };
+23
Documentation/devicetree/bindings/iio/timer/stm32-lptimer-trigger.txt
··· 1 + STMicroelectronics STM32 Low-Power Timer Trigger 2 + 3 + STM32 Low-Power Timer provides trigger source (LPTIM output) that can be used 4 + by STM32 internal ADC and/or DAC. 5 + 6 + Must be a sub-node of an STM32 Low-Power Timer device tree node. 7 + See ../mfd/stm32-lptimer.txt for details about the parent node. 8 + 9 + Required properties: 10 + - compatible: Must be "st,stm32-lptimer-trigger". 11 + - reg: Identify trigger hardware block. Must be 0, 1 or 2 12 + respectively for lptimer1, lptimer2 or lptimer3 13 + trigger output. 14 + 15 + Example: 16 + timer@40002400 { 17 + compatible = "st,stm32-lptimer"; 18 + ... 19 + trigger@0 { 20 + compatible = "st,stm32-lptimer-trigger"; 21 + reg = <0>; 22 + }; 23 + };
+1
Documentation/devicetree/bindings/mfd/atmel-smc.txt
··· 8 8 - compatible: Should be one of the following 9 9 "atmel,at91sam9260-smc", "syscon" 10 10 "atmel,sama5d3-smc", "syscon" 11 + "atmel,sama5d2-smc", "syscon" 11 12 - reg: Contains offset/length value of the SMC memory 12 13 region. 13 14
+45 -5
Documentation/devicetree/bindings/mfd/axp20x.txt
··· 7 7 axp221 (X-Powers) 8 8 axp223 (X-Powers) 9 9 axp803 (X-Powers) 10 + axp806 (X-Powers) 10 11 axp809 (X-Powers) 12 + axp813 (X-Powers) 13 + 14 + The AXP813 is 2 chips packaged into 1. The 2 chips do not share anything 15 + other than the packaging. Pins are routed separately. As such they should 16 + be treated as separate entities. The other half is an AC100 RTC/codec 17 + combo chip. Please see ./ac100.txt for its bindings. 11 18 12 19 Required properties: 13 20 - compatible: should be one of: ··· 26 19 * "x-powers,axp803" 27 20 * "x-powers,axp806" 28 21 * "x-powers,axp809" 22 + * "x-powers,axp813" 29 23 - reg: The I2C slave address or RSB hardware address for the AXP chip 30 24 - interrupt-parent: The parent interrupt controller 31 25 - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin ··· 36 28 Optional properties: 37 29 - x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz 38 30 AXP152/20X: range: 750-1875, Default: 1.5 MHz 39 - AXP22X/80X: range: 1800-4050, Default: 3 MHz 31 + AXP22X/8XX: range: 1800-4050, Default: 3 MHz 40 32 41 - - x-powers,drive-vbus-en: axp221 / axp223 only boolean, set this when the 42 - N_VBUSEN pin is used as an output pin to control an external 43 - regulator to drive the OTG VBus, rather then as an input pin 44 - which signals whether the board is driving OTG VBus or not. 33 + - x-powers,drive-vbus-en: boolean, set this when the N_VBUSEN pin is 34 + used as an output pin to control an external 35 + regulator to drive the OTG VBus, rather then 36 + as an input pin which signals whether the 37 + board is driving OTG VBus or not. 38 + (axp221 / axp223 / axp813 only) 45 39 46 40 - x-powers,master-mode: Boolean (axp806 only). Set this when the PMIC is 47 41 wired for master mode. The default is slave mode. ··· 180 170 LDO_IO1 : LDO : ips-supply : GPIO 1 181 171 RTC_LDO : LDO : ips-supply : always on 182 172 SW : On/Off Switch : swin-supply 173 + 174 + AXP813 regulators, type, and corresponding input supply names: 175 + 176 + Regulator Type Supply Name Notes 177 + --------- ---- ----------- ----- 178 + DCDC1 : DC-DC buck : vin1-supply 179 + DCDC2 : DC-DC buck : vin2-supply : poly-phase capable 180 + DCDC3 : DC-DC buck : vin3-supply : poly-phase capable 181 + DCDC4 : DC-DC buck : vin4-supply 182 + DCDC5 : DC-DC buck : vin5-supply : poly-phase capable 183 + DCDC6 : DC-DC buck : vin6-supply : poly-phase capable 184 + DCDC7 : DC-DC buck : vin7-supply 185 + ALDO1 : LDO : aldoin-supply : shared supply 186 + ALDO2 : LDO : aldoin-supply : shared supply 187 + ALDO3 : LDO : aldoin-supply : shared supply 188 + DLDO1 : LDO : dldoin-supply : shared supply 189 + DLDO2 : LDO : dldoin-supply : shared supply 190 + DLDO3 : LDO : dldoin-supply : shared supply 191 + DLDO4 : LDO : dldoin-supply : shared supply 192 + ELDO1 : LDO : eldoin-supply : shared supply 193 + ELDO2 : LDO : eldoin-supply : shared supply 194 + ELDO3 : LDO : eldoin-supply : shared supply 195 + FLDO1 : LDO : fldoin-supply : shared supply 196 + FLDO2 : LDO : fldoin-supply : shared supply 197 + FLDO3 : LDO : fldoin-supply : shared supply 198 + LDO_IO0 : LDO : ips-supply : GPIO 0 199 + LDO_IO1 : LDO : ips-supply : GPIO 1 200 + RTC_LDO : LDO : ips-supply : always on 201 + SW : On/Off Switch : swin-supply 202 + DRIVEVBUS : Enable output : drivevbus-supply : external regulator 183 203 184 204 Example: 185 205
+49
Documentation/devicetree/bindings/mfd/bd9571mwv.txt
··· 1 + * ROHM BD9571MWV Power Management Integrated Circuit (PMIC) bindings 2 + 3 + Required properties: 4 + - compatible : Should be "rohm,bd9571mwv". 5 + - reg : I2C slave address. 6 + - interrupt-parent : Phandle to the parent interrupt controller. 7 + - interrupts : The interrupt line the device is connected to. 8 + - interrupt-controller : Marks the device node as an interrupt controller. 9 + - #interrupt-cells : The number of cells to describe an IRQ, should be 2. 10 + The first cell is the IRQ number. 11 + The second cell is the flags, encoded as trigger 12 + masks from ../interrupt-controller/interrupts.txt. 13 + - gpio-controller : Marks the device node as a GPIO Controller. 14 + - #gpio-cells : Should be two. The first cell is the pin number and 15 + the second cell is used to specify flags. 16 + See ../gpio/gpio.txt for more information. 17 + - regulators: : List of child nodes that specify the regulator 18 + initialization data. Child nodes must be named 19 + after their hardware counterparts: 20 + - vd09 21 + - vd18 22 + - vd25 23 + - vd33 24 + - dvfs 25 + Each child node is defined using the standard 26 + binding for regulators. 27 + 28 + Example: 29 + 30 + pmic: pmic@30 { 31 + compatible = "rohm,bd9571mwv"; 32 + reg = <0x30>; 33 + interrupt-parent = <&gpio2>; 34 + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; 35 + interrupt-controller; 36 + #interrupt-cells = <2>; 37 + gpio-controller; 38 + #gpio-cells = <2>; 39 + 40 + regulators { 41 + dvfs: dvfs { 42 + regulator-name = "dvfs"; 43 + regulator-min-microvolt = <750000>; 44 + regulator-max-microvolt = <1030000>; 45 + regulator-boot-on; 46 + regulator-always-on; 47 + }; 48 + }; 49 + };
+8
Documentation/devicetree/bindings/mfd/da9052-i2c.txt
··· 4 4 - compatible : Should be "dlg,da9052", "dlg,da9053-aa", 5 5 "dlg,da9053-ab", or "dlg,da9053-bb" 6 6 7 + Optional properties: 8 + - dlg,tsi-as-adc : Boolean, if set the X+, X-, Y+, Y- touchscreen 9 + input lines are used as general purpose analogue 10 + input. 11 + - tsiref-supply: Phandle to the regulator, which provides the reference 12 + voltage for the TSIREF pin. Must be provided when the 13 + touchscreen pins are used for ADC purposes. 14 + 7 15 Sub-nodes: 8 16 - regulators : Contain the regulator nodes. The DA9052/53 regulators are 9 17 bound using their names as listed below:
+25
Documentation/devicetree/bindings/mfd/retu.txt
··· 1 + * Device tree bindings for Nokia Retu and Tahvo multi-function device 2 + 3 + Retu and Tahvo are a multi-function devices found on Nokia Internet 4 + Tablets (770, N800 and N810). The Retu chip provides watchdog timer 5 + and power button control functionalities while Tahvo chip provides 6 + USB transceiver functionality. 7 + 8 + Required properties: 9 + - compatible: "nokia,retu" or "nokia,tahvo" 10 + - reg: Specifies the CBUS slave address of the ASIC chip 11 + - interrupts: The interrupt line the device is connected to 12 + - interrupt-parent: The parent interrupt controller 13 + 14 + Example: 15 + 16 + cbus0 { 17 + compatible = "i2c-cbus-gpio"; 18 + ... 19 + retu: retu@1 { 20 + compatible = "nokia,retu"; 21 + interrupt-parent = <&gpio4>; 22 + interrupts = <12 IRQ_TYPE_EDGE_RISING>; 23 + reg = <0x1>; 24 + }; 25 + };
+21 -1
Documentation/devicetree/bindings/mfd/rk808.txt
··· 1 1 RK8XX Power Management Integrated Circuit 2 2 3 3 The rk8xx family current members: 4 + rk805 4 5 rk808 5 6 rk818 6 7 7 8 Required properties: 8 - - compatible: "rockchip,rk808", "rockchip,rk818" 9 + - compatible: "rockchip,rk805" 10 + - compatible: "rockchip,rk808" 11 + - compatible: "rockchip,rk818" 9 12 - reg: I2C slave address 10 13 - interrupt-parent: The parent interrupt controller. 11 14 - interrupts: the interrupt outputs of the controller. ··· 20 17 default output clock name 21 18 - rockchip,system-power-controller: Telling whether or not this pmic is controlling 22 19 the system power. 20 + 21 + Optional RK805 properties: 22 + - vcc1-supply: The input supply for DCDC_REG1 23 + - vcc2-supply: The input supply for DCDC_REG2 24 + - vcc3-supply: The input supply for DCDC_REG3 25 + - vcc4-supply: The input supply for DCDC_REG4 26 + - vcc5-supply: The input supply for LDO_REG1 and LDO_REG2 27 + - vcc6-supply: The input supply for LDO_REG3 23 28 24 29 Optional RK808 properties: 25 30 - vcc1-supply: The input supply for DCDC_REG1 ··· 66 55 regulator-name { 67 56 /* standard regulator bindings here */ 68 57 }; 58 + 59 + Following regulators of the RK805 PMIC regulators are supported. Note that 60 + the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO 61 + number as described in RK805 datasheet. 62 + 63 + - DCDC_REGn 64 + - valid values for n are 1 to 4. 65 + - LDO_REGn 66 + - valid values for n are 1 to 3 69 67 70 68 Following regulators of the RK808 PMIC block are supported. Note that 71 69 the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO
+48
Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
··· 1 + STMicroelectronics STM32 Low-Power Timer 2 + 3 + The STM32 Low-Power Timer (LPTIM) is a 16-bit timer that provides several 4 + functions: 5 + - PWM output (with programmable prescaler, configurable polarity) 6 + - Quadrature encoder, counter 7 + - Trigger source for STM32 ADC/DAC (LPTIM_OUT) 8 + 9 + Required properties: 10 + - compatible: Must be "st,stm32-lptimer". 11 + - reg: Offset and length of the device's register set. 12 + - clocks: Phandle to the clock used by the LP Timer module. 13 + - clock-names: Must be "mux". 14 + - #address-cells: Should be '<1>'. 15 + - #size-cells: Should be '<0>'. 16 + 17 + Optional subnodes: 18 + - pwm: See ../pwm/pwm-stm32-lp.txt 19 + - counter: See ../iio/timer/stm32-lptimer-cnt.txt 20 + - trigger: See ../iio/timer/stm32-lptimer-trigger.txt 21 + 22 + Example: 23 + 24 + timer@40002400 { 25 + compatible = "st,stm32-lptimer"; 26 + reg = <0x40002400 0x400>; 27 + clocks = <&timer_clk>; 28 + clock-names = "mux"; 29 + #address-cells = <1>; 30 + #size-cells = <0>; 31 + 32 + pwm { 33 + compatible = "st,stm32-pwm-lp"; 34 + pinctrl-names = "default"; 35 + pinctrl-0 = <&lppwm1_pins>; 36 + }; 37 + 38 + trigger@0 { 39 + compatible = "st,stm32-lptimer-trigger"; 40 + reg = <0>; 41 + }; 42 + 43 + counter { 44 + compatible = "st,stm32-lptimer-counter"; 45 + pinctrl-names = "default"; 46 + pinctrl-0 = <&lptim1_in_pins>; 47 + }; 48 + };
+17
Documentation/devicetree/bindings/mfd/tps6105x.txt
··· 1 + * Device tree bindings for TI TPS61050/61052 Boost Converters 2 + 3 + The TP61050/TPS61052 is a high-power "white LED driver". The 4 + device provides LED, GPIO and regulator functionalities. 5 + 6 + Required properties: 7 + - compatible: "ti,tps61050" or "ti,tps61052" 8 + - reg: Specifies the I2C slave address 9 + 10 + Example: 11 + 12 + i2c0 { 13 + tps61052@33 { 14 + compatible = "ti,tps61052"; 15 + reg = <0x33>; 16 + }; 17 + };
+39
Documentation/devicetree/bindings/mfd/zii,rave-sp.txt
··· 1 + Zodiac Inflight Innovations RAVE Supervisory Processor 2 + 3 + RAVE Supervisory Processor communicates with SoC over UART. It is 4 + expected that its Device Tree node is specified as a child of a node 5 + corresponding to UART controller used for communication. 6 + 7 + Required parent device properties: 8 + 9 + - compatible: Should be one of: 10 + - "zii,rave-sp-niu" 11 + - "zii,rave-sp-mezz" 12 + - "zii,rave-sp-esb" 13 + - "zii,rave-sp-rdu1" 14 + - "zii,rave-sp-rdu2" 15 + 16 + - current-speed: Should be set to baud rate SP device is using 17 + 18 + RAVE SP consists of the following sub-devices: 19 + 20 + Device Description 21 + ------ ----------- 22 + rave-sp-wdt : Watchdog 23 + rave-sp-nvmem : Interface to onborad EEPROM 24 + rave-sp-backlight : Display backlight 25 + rave-sp-hwmon : Interface to onboard hardware sensors 26 + rave-sp-leds : Interface to onboard LEDs 27 + rave-sp-input : Interface to onboard power button 28 + 29 + Example of usage: 30 + 31 + rdu { 32 + compatible = "zii,rave-sp-rdu2"; 33 + current-speed = <1000000>; 34 + 35 + watchdog { 36 + compatible = "zii,rave-sp-watchdog"; 37 + }; 38 + }; 39 +
+63
Documentation/devicetree/bindings/pinctrl/pinctrl-rk805.txt
··· 1 + Pincontrol driver for RK805 Power management IC. 2 + 3 + RK805 has 2 pins which can be configured as GPIO output only. 4 + 5 + Please refer file <devicetree/bindings/pinctrl/pinctrl-bindings.txt> 6 + for details of the common pinctrl bindings used by client devices, 7 + including the meaning of the phrase "pin configuration node". 8 + 9 + Optional Pinmux properties: 10 + -------------------------- 11 + Following properties are required if default setting of pins are required 12 + at boot. 13 + - pinctrl-names: A pinctrl state named per <pinctrl-binding.txt>. 14 + - pinctrl[0...n]: Properties to contain the phandle for pinctrl states per 15 + <pinctrl-binding.txt>. 16 + 17 + The pin configurations are defined as child of the pinctrl states node. Each 18 + sub-node have following properties: 19 + 20 + Required properties: 21 + ------------------ 22 + - #gpio-cells: Should be two. The first cell is the pin number and the 23 + second is the GPIO flags. 24 + 25 + - gpio-controller: Marks the device node as a GPIO controller. 26 + 27 + - pins: List of pins. Valid values of pins properties are: gpio0, gpio1. 28 + 29 + First 2 properties must be added in the RK805 PMIC node, documented in 30 + Documentation/devicetree/bindings/mfd/rk808.txt 31 + 32 + Optional properties: 33 + ------------------- 34 + Following are optional properties defined as pinmux DT binding document 35 + <pinctrl-bindings.txt>. Absence of properties will leave the configuration 36 + on default. 37 + function, 38 + output-low, 39 + output-high. 40 + 41 + Valid values for function properties are: gpio. 42 + 43 + Theres is also not customised properties for any GPIO. 44 + 45 + Example: 46 + -------- 47 + rk805: rk805@18 { 48 + compatible = "rockchip,rk805"; 49 + ... 50 + gpio-controller; 51 + #gpio-cells = <2>; 52 + 53 + pinctrl-names = "default"; 54 + pinctrl-0 = <&pmic_int_l>, <&rk805_default>; 55 + 56 + rk805_default: pinmux { 57 + gpio01 { 58 + pins = "gpio0", "gpio1"; 59 + function = "gpio"; 60 + output-high; 61 + }; 62 + }; 63 + };
+24
Documentation/devicetree/bindings/pwm/pwm-stm32-lp.txt
··· 1 + STMicroelectronics STM32 Low-Power Timer PWM 2 + 3 + STM32 Low-Power Timer provides single channel PWM. 4 + 5 + Must be a sub-node of an STM32 Low-Power Timer device tree node. 6 + See ../mfd/stm32-lptimer.txt for details about the parent node. 7 + 8 + Required parameters: 9 + - compatible: Must be "st,stm32-pwm-lp". 10 + 11 + Optional properties: 12 + - pinctrl-names: Set to "default". 13 + - pinctrl-0: Phandle pointing to pin configuration node for PWM. 14 + 15 + Example: 16 + timer@40002400 { 17 + compatible = "st,stm32-lptimer"; 18 + ... 19 + pwm { 20 + compatible = "st,stm32-pwm-lp"; 21 + pinctrl-names = "default"; 22 + pinctrl-0 = <&lppwm1_pins>; 23 + }; 24 + };
+11
MAINTAINERS
··· 11432 11432 S: Odd Fixes 11433 11433 F: drivers/tty/serial/rp2.* 11434 11434 11435 + ROHM MULTIFUNCTION BD9571MWV-M PMIC DEVICE DRIVERS 11436 + M: Marek Vasut <marek.vasut+renesas@gmail.com> 11437 + L: linux-kernel@vger.kernel.org 11438 + L: linux-renesas-soc@vger.kernel.org 11439 + S: Supported 11440 + F: drivers/mfd/bd9571mwv.c 11441 + F: drivers/regulator/bd9571mwv-regulator.c 11442 + F: drivers/gpio/gpio-bd9571mwv.c 11443 + F: include/linux/mfd/bd9571mwv.h 11444 + F: Documentation/devicetree/bindings/mfd/bd9571mwv.txt 11445 + 11435 11446 ROSE NETWORK LAYER 11436 11447 M: Ralf Baechle <ralf@linux-mips.org> 11437 11448 L: linux-hams@vger.kernel.org
+2 -2
arch/arm/boot/dts/omap2420-n8x0-common.dtsi
··· 15 15 >; 16 16 #address-cells = <1>; 17 17 #size-cells = <0>; 18 - retu_mfd: retu@1 { 19 - compatible = "retu-mfd"; 18 + retu: retu@1 { 19 + compatible = "nokia,retu"; 20 20 interrupt-parent = <&gpio4>; 21 21 interrupts = <12 IRQ_TYPE_EDGE_RISING>; 22 22 reg = <0x1>;
+1 -1
arch/arm/boot/dts/ste-hrefprev60.dtsi
··· 30 30 31 31 i2c@80004000 { 32 32 tps61052@33 { 33 - compatible = "tps61052"; 33 + compatible = "ti,tps61052"; 34 34 reg = <0x33>; 35 35 }; 36 36
+1 -1
arch/arm/mach-omap1/board-h2-mmc.c
··· 14 14 #include <linux/gpio.h> 15 15 #include <linux/platform_device.h> 16 16 #include <linux/platform_data/gpio-omap.h> 17 - #include <linux/i2c/tps65010.h> 17 + #include <linux/mfd/tps65010.h> 18 18 19 19 #include "board-h2.h" 20 20 #include "mmc.h"
+1 -1
arch/arm/mach-omap1/board-h2.c
··· 28 28 #include <linux/mtd/partitions.h> 29 29 #include <linux/mtd/physmap.h> 30 30 #include <linux/input.h> 31 - #include <linux/i2c/tps65010.h> 31 + #include <linux/mfd/tps65010.h> 32 32 #include <linux/smc91x.h> 33 33 #include <linux/omapfb.h> 34 34 #include <linux/platform_data/gpio-omap.h>
+1 -1
arch/arm/mach-omap1/board-h3-mmc.c
··· 14 14 #include <linux/gpio.h> 15 15 #include <linux/platform_device.h> 16 16 17 - #include <linux/i2c/tps65010.h> 17 + #include <linux/mfd/tps65010.h> 18 18 19 19 #include "common.h" 20 20 #include "board-h3.h"
+1 -1
arch/arm/mach-omap1/board-h3.c
··· 28 28 #include <linux/mtd/physmap.h> 29 29 #include <linux/input.h> 30 30 #include <linux/spi/spi.h> 31 - #include <linux/i2c/tps65010.h> 31 + #include <linux/mfd/tps65010.h> 32 32 #include <linux/smc91x.h> 33 33 #include <linux/omapfb.h> 34 34 #include <linux/platform_data/gpio-omap.h>
+2 -2
arch/arm/mach-omap1/board-nokia770.c
··· 233 233 234 234 static struct i2c_board_info nokia770_i2c_board_info_2[] __initdata = { 235 235 { 236 - I2C_BOARD_INFO("retu-mfd", 0x01), 236 + I2C_BOARD_INFO("retu", 0x01), 237 237 }, 238 238 { 239 - I2C_BOARD_INFO("tahvo-mfd", 0x02), 239 + I2C_BOARD_INFO("tahvo", 0x02), 240 240 }, 241 241 }; 242 242
+1 -1
arch/arm/mach-omap1/board-osk.c
··· 38 38 #include <linux/mtd/mtd.h> 39 39 #include <linux/mtd/partitions.h> 40 40 #include <linux/mtd/physmap.h> 41 - #include <linux/i2c/tps65010.h> 41 + #include <linux/mfd/tps65010.h> 42 42 #include <linux/platform_data/gpio-omap.h> 43 43 #include <linux/platform_data/omap1_bl.h> 44 44
+1 -1
arch/arm/mach-omap2/common.h
··· 29 29 #include <linux/irq.h> 30 30 #include <linux/delay.h> 31 31 #include <linux/i2c.h> 32 - #include <linux/i2c/twl.h> 32 + #include <linux/mfd/twl.h> 33 33 #include <linux/i2c-omap.h> 34 34 #include <linux/reboot.h> 35 35 #include <linux/irqchip/irq-omap-intc.h>
+1 -1
arch/arm/mach-omap2/omap_twl.c
··· 16 16 #include <linux/err.h> 17 17 #include <linux/io.h> 18 18 #include <linux/kernel.h> 19 - #include <linux/i2c/twl.h> 19 + #include <linux/mfd/twl.h> 20 20 21 21 #include "soc.h" 22 22 #include "voltage.h"
+1 -1
arch/arm/mach-s3c24xx/mach-osiris-dvs.c
··· 17 17 #include <linux/cpufreq.h> 18 18 #include <linux/gpio.h> 19 19 20 - #include <linux/i2c/tps65010.h> 20 + #include <linux/mfd/tps65010.h> 21 21 22 22 #include <plat/cpu-freq.h> 23 23 #include <mach/gpio-samsung.h>
+1 -1
arch/arm/mach-s3c24xx/mach-osiris.c
··· 24 24 #include <linux/io.h> 25 25 #include <linux/platform_device.h> 26 26 27 - #include <linux/i2c/tps65010.h> 27 + #include <linux/mfd/tps65010.h> 28 28 29 29 #include <asm/mach-types.h> 30 30 #include <asm/mach/arch.h>
+1 -1
drivers/gpio/gpio-twl4030.c
··· 35 35 #include <linux/of.h> 36 36 #include <linux/irqdomain.h> 37 37 38 - #include <linux/i2c/twl.h> 38 + #include <linux/mfd/twl.h> 39 39 40 40 /* 41 41 * The GPIO "subchip" supports 18 GPIOs which can be configured as
+12 -2
drivers/iio/adc/stm32-adc.c
··· 25 25 #include <linux/dmaengine.h> 26 26 #include <linux/iio/iio.h> 27 27 #include <linux/iio/buffer.h> 28 + #include <linux/iio/timer/stm32-lptim-trigger.h> 28 29 #include <linux/iio/timer/stm32-timer-trigger.h> 29 30 #include <linux/iio/trigger.h> 30 31 #include <linux/iio/trigger_consumer.h> ··· 186 185 STM32_EXT13, 187 186 STM32_EXT14, 188 187 STM32_EXT15, 188 + STM32_EXT16, 189 + STM32_EXT17, 190 + STM32_EXT18, 191 + STM32_EXT19, 192 + STM32_EXT20, 189 193 }; 190 194 191 195 /** ··· 532 526 { TIM4_TRGO, STM32_EXT12 }, 533 527 { TIM6_TRGO, STM32_EXT13 }, 534 528 { TIM3_CH4, STM32_EXT15 }, 529 + { LPTIM1_OUT, STM32_EXT18 }, 530 + { LPTIM2_OUT, STM32_EXT19 }, 531 + { LPTIM3_OUT, STM32_EXT20 }, 535 532 {}, 536 533 }; 537 534 ··· 1091 1082 * Checking both stm32 timer trigger type and trig name 1092 1083 * should be safe against arbitrary trigger names. 1093 1084 */ 1094 - if (is_stm32_timer_trigger(trig) && 1085 + if ((is_stm32_timer_trigger(trig) || 1086 + is_stm32_lptim_trigger(trig)) && 1095 1087 !strcmp(adc->cfg->trigs[i].name, trig->name)) { 1096 1088 return adc->cfg->trigs[i].extsel; 1097 1089 } ··· 1774 1764 indio_dev->dev.parent = &pdev->dev; 1775 1765 indio_dev->dev.of_node = pdev->dev.of_node; 1776 1766 indio_dev->info = &stm32_adc_iio_info; 1777 - indio_dev->modes = INDIO_DIRECT_MODE; 1767 + indio_dev->modes = INDIO_DIRECT_MODE | INDIO_HARDWARE_TRIGGERED; 1778 1768 1779 1769 platform_set_drvdata(pdev, adc); 1780 1770
+1 -1
drivers/iio/adc/twl4030-madc.c
··· 35 35 #include <linux/delay.h> 36 36 #include <linux/platform_device.h> 37 37 #include <linux/slab.h> 38 - #include <linux/i2c/twl.h> 38 + #include <linux/mfd/twl.h> 39 39 #include <linux/module.h> 40 40 #include <linux/stddef.h> 41 41 #include <linux/mutex.h>
+1 -1
drivers/iio/adc/twl6030-gpadc.c
··· 33 33 #include <linux/module.h> 34 34 #include <linux/platform_device.h> 35 35 #include <linux/of_platform.h> 36 - #include <linux/i2c/twl.h> 36 + #include <linux/mfd/twl.h> 37 37 #include <linux/iio/iio.h> 38 38 #include <linux/iio/sysfs.h> 39 39
+9
drivers/iio/counter/Kconfig
··· 21 21 The base port addresses for the devices may be configured via the base 22 22 array module parameter. 23 23 24 + config STM32_LPTIMER_CNT 25 + tristate "STM32 LP Timer encoder counter driver" 26 + depends on MFD_STM32_LPTIMER || COMPILE_TEST 27 + help 28 + Select this option to enable STM32 Low-Power Timer quadrature encoder 29 + and counter driver. 30 + 31 + To compile this driver as a module, choose M here: the 32 + module will be called stm32-lptimer-cnt. 24 33 endmenu
+1
drivers/iio/counter/Makefile
··· 5 5 # When adding new entries keep the list in alphabetical order 6 6 7 7 obj-$(CONFIG_104_QUAD_8) += 104-quad-8.o 8 + obj-$(CONFIG_STM32_LPTIMER_CNT) += stm32-lptimer-cnt.o
+383
drivers/iio/counter/stm32-lptimer-cnt.c
··· 1 + /* 2 + * STM32 Low-Power Timer Encoder and Counter driver 3 + * 4 + * Copyright (C) STMicroelectronics 2017 5 + * 6 + * Author: Fabrice Gasnier <fabrice.gasnier@st.com> 7 + * 8 + * Inspired by 104-quad-8 and stm32-timer-trigger drivers. 9 + * 10 + * License terms: GNU General Public License (GPL), version 2 11 + */ 12 + 13 + #include <linux/bitfield.h> 14 + #include <linux/iio/iio.h> 15 + #include <linux/mfd/stm32-lptimer.h> 16 + #include <linux/module.h> 17 + #include <linux/platform_device.h> 18 + 19 + struct stm32_lptim_cnt { 20 + struct device *dev; 21 + struct regmap *regmap; 22 + struct clk *clk; 23 + u32 preset; 24 + u32 polarity; 25 + u32 quadrature_mode; 26 + }; 27 + 28 + static int stm32_lptim_is_enabled(struct stm32_lptim_cnt *priv) 29 + { 30 + u32 val; 31 + int ret; 32 + 33 + ret = regmap_read(priv->regmap, STM32_LPTIM_CR, &val); 34 + if (ret) 35 + return ret; 36 + 37 + return FIELD_GET(STM32_LPTIM_ENABLE, val); 38 + } 39 + 40 + static int stm32_lptim_set_enable_state(struct stm32_lptim_cnt *priv, 41 + int enable) 42 + { 43 + int ret; 44 + u32 val; 45 + 46 + val = FIELD_PREP(STM32_LPTIM_ENABLE, enable); 47 + ret = regmap_write(priv->regmap, STM32_LPTIM_CR, val); 48 + if (ret) 49 + return ret; 50 + 51 + if (!enable) { 52 + clk_disable(priv->clk); 53 + return 0; 54 + } 55 + 56 + /* LP timer must be enabled before writing CMP & ARR */ 57 + ret = regmap_write(priv->regmap, STM32_LPTIM_ARR, priv->preset); 58 + if (ret) 59 + return ret; 60 + 61 + ret = regmap_write(priv->regmap, STM32_LPTIM_CMP, 0); 62 + if (ret) 63 + return ret; 64 + 65 + /* ensure CMP & ARR registers are properly written */ 66 + ret = regmap_read_poll_timeout(priv->regmap, STM32_LPTIM_ISR, val, 67 + (val & STM32_LPTIM_CMPOK_ARROK), 68 + 100, 1000); 69 + if (ret) 70 + return ret; 71 + 72 + ret = regmap_write(priv->regmap, STM32_LPTIM_ICR, 73 + STM32_LPTIM_CMPOKCF_ARROKCF); 74 + if (ret) 75 + return ret; 76 + 77 + ret = clk_enable(priv->clk); 78 + if (ret) { 79 + regmap_write(priv->regmap, STM32_LPTIM_CR, 0); 80 + return ret; 81 + } 82 + 83 + /* Start LP timer in continuous mode */ 84 + return regmap_update_bits(priv->regmap, STM32_LPTIM_CR, 85 + STM32_LPTIM_CNTSTRT, STM32_LPTIM_CNTSTRT); 86 + } 87 + 88 + static int stm32_lptim_setup(struct stm32_lptim_cnt *priv, int enable) 89 + { 90 + u32 mask = STM32_LPTIM_ENC | STM32_LPTIM_COUNTMODE | 91 + STM32_LPTIM_CKPOL | STM32_LPTIM_PRESC; 92 + u32 val; 93 + 94 + /* Setup LP timer encoder/counter and polarity, without prescaler */ 95 + if (priv->quadrature_mode) 96 + val = enable ? STM32_LPTIM_ENC : 0; 97 + else 98 + val = enable ? STM32_LPTIM_COUNTMODE : 0; 99 + val |= FIELD_PREP(STM32_LPTIM_CKPOL, enable ? priv->polarity : 0); 100 + 101 + return regmap_update_bits(priv->regmap, STM32_LPTIM_CFGR, mask, val); 102 + } 103 + 104 + static int stm32_lptim_write_raw(struct iio_dev *indio_dev, 105 + struct iio_chan_spec const *chan, 106 + int val, int val2, long mask) 107 + { 108 + struct stm32_lptim_cnt *priv = iio_priv(indio_dev); 109 + int ret; 110 + 111 + switch (mask) { 112 + case IIO_CHAN_INFO_ENABLE: 113 + if (val < 0 || val > 1) 114 + return -EINVAL; 115 + 116 + /* Check nobody uses the timer, or already disabled/enabled */ 117 + ret = stm32_lptim_is_enabled(priv); 118 + if ((ret < 0) || (!ret && !val)) 119 + return ret; 120 + if (val && ret) 121 + return -EBUSY; 122 + 123 + ret = stm32_lptim_setup(priv, val); 124 + if (ret) 125 + return ret; 126 + return stm32_lptim_set_enable_state(priv, val); 127 + 128 + default: 129 + return -EINVAL; 130 + } 131 + } 132 + 133 + static int stm32_lptim_read_raw(struct iio_dev *indio_dev, 134 + struct iio_chan_spec const *chan, 135 + int *val, int *val2, long mask) 136 + { 137 + struct stm32_lptim_cnt *priv = iio_priv(indio_dev); 138 + u32 dat; 139 + int ret; 140 + 141 + switch (mask) { 142 + case IIO_CHAN_INFO_RAW: 143 + ret = regmap_read(priv->regmap, STM32_LPTIM_CNT, &dat); 144 + if (ret) 145 + return ret; 146 + *val = dat; 147 + return IIO_VAL_INT; 148 + 149 + case IIO_CHAN_INFO_ENABLE: 150 + ret = stm32_lptim_is_enabled(priv); 151 + if (ret < 0) 152 + return ret; 153 + *val = ret; 154 + return IIO_VAL_INT; 155 + 156 + case IIO_CHAN_INFO_SCALE: 157 + /* Non-quadrature mode: scale = 1 */ 158 + *val = 1; 159 + *val2 = 0; 160 + if (priv->quadrature_mode) { 161 + /* 162 + * Quadrature encoder mode: 163 + * - both edges, quarter cycle, scale is 0.25 164 + * - either rising/falling edge scale is 0.5 165 + */ 166 + if (priv->polarity > 1) 167 + *val2 = 2; 168 + else 169 + *val2 = 1; 170 + } 171 + return IIO_VAL_FRACTIONAL_LOG2; 172 + 173 + default: 174 + return -EINVAL; 175 + } 176 + } 177 + 178 + static const struct iio_info stm32_lptim_cnt_iio_info = { 179 + .read_raw = stm32_lptim_read_raw, 180 + .write_raw = stm32_lptim_write_raw, 181 + .driver_module = THIS_MODULE, 182 + }; 183 + 184 + static const char *const stm32_lptim_quadrature_modes[] = { 185 + "non-quadrature", 186 + "quadrature", 187 + }; 188 + 189 + static int stm32_lptim_get_quadrature_mode(struct iio_dev *indio_dev, 190 + const struct iio_chan_spec *chan) 191 + { 192 + struct stm32_lptim_cnt *priv = iio_priv(indio_dev); 193 + 194 + return priv->quadrature_mode; 195 + } 196 + 197 + static int stm32_lptim_set_quadrature_mode(struct iio_dev *indio_dev, 198 + const struct iio_chan_spec *chan, 199 + unsigned int type) 200 + { 201 + struct stm32_lptim_cnt *priv = iio_priv(indio_dev); 202 + 203 + if (stm32_lptim_is_enabled(priv)) 204 + return -EBUSY; 205 + 206 + priv->quadrature_mode = type; 207 + 208 + return 0; 209 + } 210 + 211 + static const struct iio_enum stm32_lptim_quadrature_mode_en = { 212 + .items = stm32_lptim_quadrature_modes, 213 + .num_items = ARRAY_SIZE(stm32_lptim_quadrature_modes), 214 + .get = stm32_lptim_get_quadrature_mode, 215 + .set = stm32_lptim_set_quadrature_mode, 216 + }; 217 + 218 + static const char * const stm32_lptim_cnt_polarity[] = { 219 + "rising-edge", "falling-edge", "both-edges", 220 + }; 221 + 222 + static int stm32_lptim_cnt_get_polarity(struct iio_dev *indio_dev, 223 + const struct iio_chan_spec *chan) 224 + { 225 + struct stm32_lptim_cnt *priv = iio_priv(indio_dev); 226 + 227 + return priv->polarity; 228 + } 229 + 230 + static int stm32_lptim_cnt_set_polarity(struct iio_dev *indio_dev, 231 + const struct iio_chan_spec *chan, 232 + unsigned int type) 233 + { 234 + struct stm32_lptim_cnt *priv = iio_priv(indio_dev); 235 + 236 + if (stm32_lptim_is_enabled(priv)) 237 + return -EBUSY; 238 + 239 + priv->polarity = type; 240 + 241 + return 0; 242 + } 243 + 244 + static const struct iio_enum stm32_lptim_cnt_polarity_en = { 245 + .items = stm32_lptim_cnt_polarity, 246 + .num_items = ARRAY_SIZE(stm32_lptim_cnt_polarity), 247 + .get = stm32_lptim_cnt_get_polarity, 248 + .set = stm32_lptim_cnt_set_polarity, 249 + }; 250 + 251 + static ssize_t stm32_lptim_cnt_get_preset(struct iio_dev *indio_dev, 252 + uintptr_t private, 253 + const struct iio_chan_spec *chan, 254 + char *buf) 255 + { 256 + struct stm32_lptim_cnt *priv = iio_priv(indio_dev); 257 + 258 + return snprintf(buf, PAGE_SIZE, "%u\n", priv->preset); 259 + } 260 + 261 + static ssize_t stm32_lptim_cnt_set_preset(struct iio_dev *indio_dev, 262 + uintptr_t private, 263 + const struct iio_chan_spec *chan, 264 + const char *buf, size_t len) 265 + { 266 + struct stm32_lptim_cnt *priv = iio_priv(indio_dev); 267 + int ret; 268 + 269 + if (stm32_lptim_is_enabled(priv)) 270 + return -EBUSY; 271 + 272 + ret = kstrtouint(buf, 0, &priv->preset); 273 + if (ret) 274 + return ret; 275 + 276 + if (priv->preset > STM32_LPTIM_MAX_ARR) 277 + return -EINVAL; 278 + 279 + return len; 280 + } 281 + 282 + /* LP timer with encoder */ 283 + static const struct iio_chan_spec_ext_info stm32_lptim_enc_ext_info[] = { 284 + { 285 + .name = "preset", 286 + .shared = IIO_SEPARATE, 287 + .read = stm32_lptim_cnt_get_preset, 288 + .write = stm32_lptim_cnt_set_preset, 289 + }, 290 + IIO_ENUM("polarity", IIO_SEPARATE, &stm32_lptim_cnt_polarity_en), 291 + IIO_ENUM_AVAILABLE("polarity", &stm32_lptim_cnt_polarity_en), 292 + IIO_ENUM("quadrature_mode", IIO_SEPARATE, 293 + &stm32_lptim_quadrature_mode_en), 294 + IIO_ENUM_AVAILABLE("quadrature_mode", &stm32_lptim_quadrature_mode_en), 295 + {} 296 + }; 297 + 298 + static const struct iio_chan_spec stm32_lptim_enc_channels = { 299 + .type = IIO_COUNT, 300 + .channel = 0, 301 + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | 302 + BIT(IIO_CHAN_INFO_ENABLE) | 303 + BIT(IIO_CHAN_INFO_SCALE), 304 + .ext_info = stm32_lptim_enc_ext_info, 305 + .indexed = 1, 306 + }; 307 + 308 + /* LP timer without encoder (counter only) */ 309 + static const struct iio_chan_spec_ext_info stm32_lptim_cnt_ext_info[] = { 310 + { 311 + .name = "preset", 312 + .shared = IIO_SEPARATE, 313 + .read = stm32_lptim_cnt_get_preset, 314 + .write = stm32_lptim_cnt_set_preset, 315 + }, 316 + IIO_ENUM("polarity", IIO_SEPARATE, &stm32_lptim_cnt_polarity_en), 317 + IIO_ENUM_AVAILABLE("polarity", &stm32_lptim_cnt_polarity_en), 318 + {} 319 + }; 320 + 321 + static const struct iio_chan_spec stm32_lptim_cnt_channels = { 322 + .type = IIO_COUNT, 323 + .channel = 0, 324 + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | 325 + BIT(IIO_CHAN_INFO_ENABLE) | 326 + BIT(IIO_CHAN_INFO_SCALE), 327 + .ext_info = stm32_lptim_cnt_ext_info, 328 + .indexed = 1, 329 + }; 330 + 331 + static int stm32_lptim_cnt_probe(struct platform_device *pdev) 332 + { 333 + struct stm32_lptimer *ddata = dev_get_drvdata(pdev->dev.parent); 334 + struct stm32_lptim_cnt *priv; 335 + struct iio_dev *indio_dev; 336 + 337 + if (IS_ERR_OR_NULL(ddata)) 338 + return -EINVAL; 339 + 340 + indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv)); 341 + if (!indio_dev) 342 + return -ENOMEM; 343 + 344 + priv = iio_priv(indio_dev); 345 + priv->dev = &pdev->dev; 346 + priv->regmap = ddata->regmap; 347 + priv->clk = ddata->clk; 348 + priv->preset = STM32_LPTIM_MAX_ARR; 349 + 350 + indio_dev->name = dev_name(&pdev->dev); 351 + indio_dev->dev.parent = &pdev->dev; 352 + indio_dev->dev.of_node = pdev->dev.of_node; 353 + indio_dev->info = &stm32_lptim_cnt_iio_info; 354 + if (ddata->has_encoder) 355 + indio_dev->channels = &stm32_lptim_enc_channels; 356 + else 357 + indio_dev->channels = &stm32_lptim_cnt_channels; 358 + indio_dev->num_channels = 1; 359 + 360 + platform_set_drvdata(pdev, priv); 361 + 362 + return devm_iio_device_register(&pdev->dev, indio_dev); 363 + } 364 + 365 + static const struct of_device_id stm32_lptim_cnt_of_match[] = { 366 + { .compatible = "st,stm32-lptimer-counter", }, 367 + {}, 368 + }; 369 + MODULE_DEVICE_TABLE(of, stm32_lptim_cnt_of_match); 370 + 371 + static struct platform_driver stm32_lptim_cnt_driver = { 372 + .probe = stm32_lptim_cnt_probe, 373 + .driver = { 374 + .name = "stm32-lptimer-counter", 375 + .of_match_table = stm32_lptim_cnt_of_match, 376 + }, 377 + }; 378 + module_platform_driver(stm32_lptim_cnt_driver); 379 + 380 + MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier@st.com>"); 381 + MODULE_ALIAS("platform:stm32-lptimer-counter"); 382 + MODULE_DESCRIPTION("STMicroelectronics STM32 LPTIM counter driver"); 383 + MODULE_LICENSE("GPL v2");
+11
drivers/iio/trigger/Kconfig
··· 24 24 To compile this driver as a module, choose M here: the 25 25 module will be called iio-trig-interrupt. 26 26 27 + config IIO_STM32_LPTIMER_TRIGGER 28 + tristate "STM32 Low-Power Timer Trigger" 29 + depends on MFD_STM32_LPTIMER || COMPILE_TEST 30 + help 31 + Select this option to enable STM32 Low-Power Timer Trigger. 32 + This can be used as trigger source for STM32 internal ADC 33 + and/or DAC. 34 + 35 + To compile this driver as a module, choose M here: the 36 + module will be called stm32-lptimer-trigger. 37 + 27 38 config IIO_STM32_TIMER_TRIGGER 28 39 tristate "STM32 Timer Trigger" 29 40 depends on (ARCH_STM32 && OF && MFD_STM32_TIMERS) || COMPILE_TEST
+1
drivers/iio/trigger/Makefile
··· 6 6 7 7 obj-$(CONFIG_IIO_HRTIMER_TRIGGER) += iio-trig-hrtimer.o 8 8 obj-$(CONFIG_IIO_INTERRUPT_TRIGGER) += iio-trig-interrupt.o 9 + obj-$(CONFIG_IIO_STM32_LPTIMER_TRIGGER) += stm32-lptimer-trigger.o 9 10 obj-$(CONFIG_IIO_STM32_TIMER_TRIGGER) += stm32-timer-trigger.o 10 11 obj-$(CONFIG_IIO_SYSFS_TRIGGER) += iio-trig-sysfs.o 11 12 obj-$(CONFIG_IIO_TIGHTLOOP_TRIGGER) += iio-trig-loop.o
+118
drivers/iio/trigger/stm32-lptimer-trigger.c
··· 1 + /* 2 + * STM32 Low-Power Timer Trigger driver 3 + * 4 + * Copyright (C) STMicroelectronics 2017 5 + * 6 + * Author: Fabrice Gasnier <fabrice.gasnier@st.com>. 7 + * 8 + * License terms: GNU General Public License (GPL), version 2 9 + * 10 + * Inspired by Benjamin Gaignard's stm32-timer-trigger driver 11 + */ 12 + 13 + #include <linux/iio/timer/stm32-lptim-trigger.h> 14 + #include <linux/mfd/stm32-lptimer.h> 15 + #include <linux/module.h> 16 + #include <linux/platform_device.h> 17 + 18 + /* List Low-Power Timer triggers */ 19 + static const char * const stm32_lptim_triggers[] = { 20 + LPTIM1_OUT, 21 + LPTIM2_OUT, 22 + LPTIM3_OUT, 23 + }; 24 + 25 + struct stm32_lptim_trigger { 26 + struct device *dev; 27 + const char *trg; 28 + }; 29 + 30 + static int stm32_lptim_validate_device(struct iio_trigger *trig, 31 + struct iio_dev *indio_dev) 32 + { 33 + if (indio_dev->modes & INDIO_HARDWARE_TRIGGERED) 34 + return 0; 35 + 36 + return -EINVAL; 37 + } 38 + 39 + static const struct iio_trigger_ops stm32_lptim_trigger_ops = { 40 + .owner = THIS_MODULE, 41 + .validate_device = stm32_lptim_validate_device, 42 + }; 43 + 44 + /** 45 + * is_stm32_lptim_trigger 46 + * @trig: trigger to be checked 47 + * 48 + * return true if the trigger is a valid STM32 IIO Low-Power Timer Trigger 49 + * either return false 50 + */ 51 + bool is_stm32_lptim_trigger(struct iio_trigger *trig) 52 + { 53 + return (trig->ops == &stm32_lptim_trigger_ops); 54 + } 55 + EXPORT_SYMBOL(is_stm32_lptim_trigger); 56 + 57 + static int stm32_lptim_setup_trig(struct stm32_lptim_trigger *priv) 58 + { 59 + struct iio_trigger *trig; 60 + 61 + trig = devm_iio_trigger_alloc(priv->dev, "%s", priv->trg); 62 + if (!trig) 63 + return -ENOMEM; 64 + 65 + trig->dev.parent = priv->dev->parent; 66 + trig->ops = &stm32_lptim_trigger_ops; 67 + iio_trigger_set_drvdata(trig, priv); 68 + 69 + return devm_iio_trigger_register(priv->dev, trig); 70 + } 71 + 72 + static int stm32_lptim_trigger_probe(struct platform_device *pdev) 73 + { 74 + struct stm32_lptim_trigger *priv; 75 + u32 index; 76 + int ret; 77 + 78 + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 79 + if (!priv) 80 + return -ENOMEM; 81 + 82 + if (of_property_read_u32(pdev->dev.of_node, "reg", &index)) 83 + return -EINVAL; 84 + 85 + if (index >= ARRAY_SIZE(stm32_lptim_triggers)) 86 + return -EINVAL; 87 + 88 + priv->dev = &pdev->dev; 89 + priv->trg = stm32_lptim_triggers[index]; 90 + 91 + ret = stm32_lptim_setup_trig(priv); 92 + if (ret) 93 + return ret; 94 + 95 + platform_set_drvdata(pdev, priv); 96 + 97 + return 0; 98 + } 99 + 100 + static const struct of_device_id stm32_lptim_trig_of_match[] = { 101 + { .compatible = "st,stm32-lptimer-trigger", }, 102 + {}, 103 + }; 104 + MODULE_DEVICE_TABLE(of, stm32_lptim_trig_of_match); 105 + 106 + static struct platform_driver stm32_lptim_trigger_driver = { 107 + .probe = stm32_lptim_trigger_probe, 108 + .driver = { 109 + .name = "stm32-lptimer-trigger", 110 + .of_match_table = stm32_lptim_trig_of_match, 111 + }, 112 + }; 113 + module_platform_driver(stm32_lptim_trigger_driver); 114 + 115 + MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier@st.com>"); 116 + MODULE_ALIAS("platform:stm32-lptimer-trigger"); 117 + MODULE_DESCRIPTION("STMicroelectronics STM32 LPTIM trigger driver"); 118 + MODULE_LICENSE("GPL v2");
+1 -1
drivers/input/keyboard/twl4030_keypad.c
··· 30 30 #include <linux/interrupt.h> 31 31 #include <linux/input.h> 32 32 #include <linux/platform_device.h> 33 - #include <linux/i2c/twl.h> 33 + #include <linux/mfd/twl.h> 34 34 #include <linux/slab.h> 35 35 #include <linux/of.h> 36 36
+1 -1
drivers/input/misc/dm355evm_keys.c
··· 15 15 #include <linux/platform_device.h> 16 16 #include <linux/interrupt.h> 17 17 18 - #include <linux/i2c/dm355evm_msp.h> 18 + #include <linux/mfd/dm355evm_msp.h> 19 19 #include <linux/module.h> 20 20 21 21
+1 -1
drivers/input/misc/twl4030-pwrbutton.c
··· 27 27 #include <linux/input.h> 28 28 #include <linux/interrupt.h> 29 29 #include <linux/platform_device.h> 30 - #include <linux/i2c/twl.h> 30 + #include <linux/mfd/twl.h> 31 31 32 32 #define PWR_PWRON_IRQ (1 << 0) 33 33
+1 -1
drivers/input/misc/twl4030-vibra.c
··· 28 28 #include <linux/platform_device.h> 29 29 #include <linux/of.h> 30 30 #include <linux/workqueue.h> 31 - #include <linux/i2c/twl.h> 31 + #include <linux/mfd/twl.h> 32 32 #include <linux/mfd/twl4030-audio.h> 33 33 #include <linux/input.h> 34 34 #include <linux/slab.h>
+9 -4
drivers/memory/atmel-ebi.c
··· 51 51 struct { 52 52 struct regmap *regmap; 53 53 struct clk *clk; 54 + const struct atmel_hsmc_reg_layout *layout; 54 55 } smc; 55 56 56 57 struct device *dev; ··· 85 84 static void sama5_ebi_get_config(struct atmel_ebi_dev *ebid, 86 85 struct atmel_ebi_dev_config *conf) 87 86 { 88 - atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, conf->cs, 89 - &conf->smcconf); 87 + atmel_hsmc_cs_conf_get(ebid->ebi->smc.regmap, ebid->ebi->smc.layout, 88 + conf->cs, &conf->smcconf); 90 89 } 91 90 92 91 static const struct atmel_smc_timing_xlate timings_xlate_table[] = { ··· 288 287 static void sama5_ebi_apply_config(struct atmel_ebi_dev *ebid, 289 288 struct atmel_ebi_dev_config *conf) 290 289 { 291 - atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, conf->cs, 292 - &conf->smcconf); 290 + atmel_hsmc_cs_conf_apply(ebid->ebi->smc.regmap, ebid->ebi->smc.layout, 291 + conf->cs, &conf->smcconf); 293 292 } 294 293 295 294 static int atmel_ebi_dev_setup(struct atmel_ebi *ebi, struct device_node *np, ··· 527 526 ebi->smc.regmap = syscon_node_to_regmap(smc_np); 528 527 if (IS_ERR(ebi->smc.regmap)) 529 528 return PTR_ERR(ebi->smc.regmap); 529 + 530 + ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np); 531 + if (IS_ERR(ebi->smc.layout)) 532 + return PTR_ERR(ebi->smc.layout); 530 533 531 534 ebi->smc.clk = of_clk_get(smc_np, 0); 532 535 if (IS_ERR(ebi->smc.clk)) {
+52 -5
drivers/mfd/Kconfig
··· 133 133 help 134 134 Support for the BCM590xx PMUs from Broadcom 135 135 136 + config MFD_BD9571MWV 137 + tristate "ROHM BD9571MWV PMIC" 138 + select MFD_CORE 139 + select REGMAP_I2C 140 + select REGMAP_IRQ 141 + depends on I2C 142 + help 143 + Support for the ROHM BD9571MWV PMIC, which contains single 144 + voltage regulator, voltage sampling units, GPIO block and 145 + watchdog block. 146 + 147 + This driver can also be built as a module. If so, the module 148 + will be called bd9571mwv. 149 + 136 150 config MFD_AC100 137 151 tristate "X-Powers AC100" 138 152 select MFD_CORE ··· 467 453 468 454 config INTEL_SOC_PMIC 469 455 bool "Support for Crystal Cove PMIC" 470 - depends on HAS_IOMEM && I2C=y && GPIOLIB && COMMON_CLK 456 + depends on ACPI && HAS_IOMEM && I2C=y && GPIOLIB && COMMON_CLK 471 457 depends on X86 || COMPILE_TEST 472 458 select MFD_CORE 473 459 select REGMAP_I2C 474 460 select REGMAP_IRQ 475 - select I2C_DESIGNWARE_PLATFORM if ACPI 461 + select I2C_DESIGNWARE_PLATFORM 476 462 help 477 463 Select this option to enable support for Crystal Cove PMIC 478 464 on some Intel SoC systems. The PMIC provides ADC, GPIO, ··· 495 481 on these systems. 496 482 497 483 config INTEL_SOC_PMIC_CHTWC 498 - tristate "Support for Intel Cherry Trail Whiskey Cove PMIC" 484 + bool "Support for Intel Cherry Trail Whiskey Cove PMIC" 499 485 depends on ACPI && HAS_IOMEM && I2C=y && COMMON_CLK 500 486 depends on X86 || COMPILE_TEST 501 487 select MFD_CORE ··· 965 951 different functionality of the device. 966 952 967 953 config MFD_RK808 968 - tristate "Rockchip RK808/RK818 Power Management Chip" 954 + tristate "Rockchip RK805/RK808/RK818 Power Management Chip" 969 955 depends on I2C && OF 970 956 select MFD_CORE 971 957 select REGMAP_I2C 972 958 select REGMAP_IRQ 973 959 help 974 - If you say yes here you get support for the RK808 and RK818 960 + If you say yes here you get support for the RK805, RK808 and RK818 975 961 Power Management chips. 976 962 This driver provides common support for accessing the device 977 963 through I2C interface. The device supports multiple sub-devices ··· 1308 1294 1309 1295 config MFD_TPS65086 1310 1296 tristate "TI TPS65086 Power Management Integrated Chips (PMICs)" 1297 + select MFD_CORE 1311 1298 select REGMAP 1312 1299 select REGMAP_IRQ 1313 1300 select REGMAP_I2C ··· 1351 1336 1352 1337 This driver can also be built as a module. If so, the module 1353 1338 will be called tps65217. 1339 + 1340 + config MFD_TPS68470 1341 + bool "TI TPS68470 Power Management / LED chips" 1342 + depends on ACPI && I2C=y 1343 + select MFD_CORE 1344 + select REGMAP_I2C 1345 + select I2C_DESIGNWARE_PLATFORM 1346 + help 1347 + If you say yes here you get support for the TPS68470 series of 1348 + Power Management / LED chips. 1349 + 1350 + These include voltage regulators, LEDs and other features 1351 + that are often used in portable devices. 1352 + 1353 + This option is a bool as it provides an ACPI operation 1354 + region, which must be available before any of the devices 1355 + using this are probed. This option also configures the 1356 + designware-i2c driver to be built-in, for the same reason. 1354 1357 1355 1358 config MFD_TI_LP873X 1356 1359 tristate "TI LP873X Power Management IC" ··· 1755 1722 Select this option to enable the STw481x chip driver used 1756 1723 in various ST Microelectronics and ST-Ericsson embedded 1757 1724 Nomadik series. 1725 + 1726 + config MFD_STM32_LPTIMER 1727 + tristate "Support for STM32 Low-Power Timer" 1728 + depends on (ARCH_STM32 && OF) || COMPILE_TEST 1729 + select MFD_CORE 1730 + select REGMAP 1731 + select REGMAP_MMIO 1732 + help 1733 + Select this option to enable STM32 Low-Power Timer driver 1734 + used for PWM, IIO Trigger, IIO Encoder and Counter. Shared 1735 + resources are also dealt with here. 1736 + 1737 + To compile this driver as a module, choose M here: the 1738 + module will be called stm32-lptimer. 1758 1739 1759 1740 config MFD_STM32_TIMERS 1760 1741 tristate "Support for STM32 Timers"
+3
drivers/mfd/Makefile
··· 10 10 obj-$(CONFIG_MFD_SM501) += sm501.o 11 11 obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o 12 12 obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o 13 + obj-$(CONFIG_MFD_BD9571MWV) += bd9571mwv.o 13 14 cros_ec_core-objs := cros_ec.o 14 15 cros_ec_core-$(CONFIG_ACPI) += cros_ec_acpi_gpe.o 15 16 obj-$(CONFIG_MFD_CROS_EC) += cros_ec_core.o ··· 84 83 obj-$(CONFIG_MFD_TPS65912) += tps65912-core.o 85 84 obj-$(CONFIG_MFD_TPS65912_I2C) += tps65912-i2c.o 86 85 obj-$(CONFIG_MFD_TPS65912_SPI) += tps65912-spi.o 86 + obj-$(CONFIG_MFD_TPS68470) += tps68470.o 87 87 obj-$(CONFIG_MFD_TPS80031) += tps80031.o 88 88 obj-$(CONFIG_MENELAUS) += menelaus.o 89 89 ··· 223 221 obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o 224 222 obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o 225 223 224 + obj-$(CONFIG_MFD_STM32_LPTIMER) += stm32-lptimer.o 226 225 obj-$(CONFIG_MFD_STM32_TIMERS) += stm32-timers.o 227 226 obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o
+3 -3
drivers/mfd/ab8500-core.c
··· 1059 1059 NULL, 1060 1060 }; 1061 1061 1062 - static struct attribute_group ab8500_attr_group = { 1062 + static const struct attribute_group ab8500_attr_group = { 1063 1063 .attrs = ab8500_sysfs_entries, 1064 1064 }; 1065 1065 1066 - static struct attribute_group ab8505_attr_group = { 1066 + static const struct attribute_group ab8505_attr_group = { 1067 1067 .attrs = ab8505_sysfs_entries, 1068 1068 }; 1069 1069 1070 - static struct attribute_group ab9540_attr_group = { 1070 + static const struct attribute_group ab9540_attr_group = { 1071 1071 .attrs = ab9540_sysfs_entries, 1072 1072 }; 1073 1073
+53 -14
drivers/mfd/atmel-smc.c
··· 258 258 * atmel_hsmc_cs_conf_apply - apply an SMC CS conf 259 259 * @regmap: the HSMC regmap 260 260 * @cs: the CS id 261 + * @layout: the layout of registers 261 262 * @conf the SMC CS conf to apply 262 263 * 263 264 * Applies an SMC CS configuration. 264 265 * Only valid on post-sama5 SoCs. 265 266 */ 266 - void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs, 267 - const struct atmel_smc_cs_conf *conf) 267 + void atmel_hsmc_cs_conf_apply(struct regmap *regmap, 268 + const struct atmel_hsmc_reg_layout *layout, 269 + int cs, const struct atmel_smc_cs_conf *conf) 268 270 { 269 - regmap_write(regmap, ATMEL_HSMC_SETUP(cs), conf->setup); 270 - regmap_write(regmap, ATMEL_HSMC_PULSE(cs), conf->pulse); 271 - regmap_write(regmap, ATMEL_HSMC_CYCLE(cs), conf->cycle); 272 - regmap_write(regmap, ATMEL_HSMC_TIMINGS(cs), conf->timings); 273 - regmap_write(regmap, ATMEL_HSMC_MODE(cs), conf->mode); 271 + regmap_write(regmap, ATMEL_HSMC_SETUP(layout, cs), conf->setup); 272 + regmap_write(regmap, ATMEL_HSMC_PULSE(layout, cs), conf->pulse); 273 + regmap_write(regmap, ATMEL_HSMC_CYCLE(layout, cs), conf->cycle); 274 + regmap_write(regmap, ATMEL_HSMC_TIMINGS(layout, cs), conf->timings); 275 + regmap_write(regmap, ATMEL_HSMC_MODE(layout, cs), conf->mode); 274 276 } 275 277 EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_apply); 276 278 ··· 299 297 * atmel_hsmc_cs_conf_get - retrieve the current SMC CS conf 300 298 * @regmap: the HSMC regmap 301 299 * @cs: the CS id 300 + * @layout: the layout of registers 302 301 * @conf: the SMC CS conf object to store the current conf 303 302 * 304 303 * Retrieve the SMC CS configuration. 305 304 * Only valid on post-sama5 SoCs. 306 305 */ 307 - void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs, 308 - struct atmel_smc_cs_conf *conf) 306 + void atmel_hsmc_cs_conf_get(struct regmap *regmap, 307 + const struct atmel_hsmc_reg_layout *layout, 308 + int cs, struct atmel_smc_cs_conf *conf) 309 309 { 310 - regmap_read(regmap, ATMEL_HSMC_SETUP(cs), &conf->setup); 311 - regmap_read(regmap, ATMEL_HSMC_PULSE(cs), &conf->pulse); 312 - regmap_read(regmap, ATMEL_HSMC_CYCLE(cs), &conf->cycle); 313 - regmap_read(regmap, ATMEL_HSMC_TIMINGS(cs), &conf->timings); 314 - regmap_read(regmap, ATMEL_HSMC_MODE(cs), &conf->mode); 310 + regmap_read(regmap, ATMEL_HSMC_SETUP(layout, cs), &conf->setup); 311 + regmap_read(regmap, ATMEL_HSMC_PULSE(layout, cs), &conf->pulse); 312 + regmap_read(regmap, ATMEL_HSMC_CYCLE(layout, cs), &conf->cycle); 313 + regmap_read(regmap, ATMEL_HSMC_TIMINGS(layout, cs), &conf->timings); 314 + regmap_read(regmap, ATMEL_HSMC_MODE(layout, cs), &conf->mode); 315 315 } 316 316 EXPORT_SYMBOL_GPL(atmel_hsmc_cs_conf_get); 317 + 318 + static const struct atmel_hsmc_reg_layout sama5d3_reg_layout = { 319 + .timing_regs_offset = 0x600, 320 + }; 321 + 322 + static const struct atmel_hsmc_reg_layout sama5d2_reg_layout = { 323 + .timing_regs_offset = 0x700, 324 + }; 325 + 326 + static const struct of_device_id atmel_smc_ids[] = { 327 + { .compatible = "atmel,at91sam9260-smc", .data = NULL }, 328 + { .compatible = "atmel,sama5d3-smc", .data = &sama5d3_reg_layout }, 329 + { .compatible = "atmel,sama5d2-smc", .data = &sama5d2_reg_layout }, 330 + { /* sentinel */ }, 331 + }; 332 + 333 + /** 334 + * atmel_hsmc_get_reg_layout - retrieve the layout of HSMC registers 335 + * @np: the HSMC regmap 336 + * 337 + * Retrieve the layout of HSMC registers. 338 + * 339 + * Returns NULL in case of SMC, a struct atmel_hsmc_reg_layout pointer 340 + * in HSMC case, otherwise ERR_PTR(-EINVAL). 341 + */ 342 + const struct atmel_hsmc_reg_layout * 343 + atmel_hsmc_get_reg_layout(struct device_node *np) 344 + { 345 + const struct of_device_id *match; 346 + 347 + match = of_match_node(atmel_smc_ids, np); 348 + 349 + return match ? match->data : ERR_PTR(-EINVAL); 350 + } 351 + EXPORT_SYMBOL_GPL(atmel_hsmc_get_reg_layout);
+1
drivers/mfd/axp20x-rsb.c
··· 64 64 { .compatible = "x-powers,axp803", .data = (void *)AXP803_ID }, 65 65 { .compatible = "x-powers,axp806", .data = (void *)AXP806_ID }, 66 66 { .compatible = "x-powers,axp809", .data = (void *)AXP809_ID }, 67 + { .compatible = "x-powers,axp813", .data = (void *)AXP813_ID }, 67 68 { }, 68 69 }; 69 70 MODULE_DEVICE_TABLE(of, axp20x_rsb_of_match);
+27 -5
drivers/mfd/axp20x.c
··· 44 44 "AXP803", 45 45 "AXP806", 46 46 "AXP809", 47 + "AXP813", 47 48 }; 48 49 49 50 static const struct regmap_range axp152_writeable_ranges[] = { ··· 677 676 678 677 static struct mfd_cell axp221_cells[] = { 679 678 { 680 - .name = "axp20x-pek", 679 + .name = "axp221-pek", 681 680 .num_resources = ARRAY_SIZE(axp22x_pek_resources), 682 681 .resources = axp22x_pek_resources, 683 682 }, { ··· 702 701 703 702 static struct mfd_cell axp223_cells[] = { 704 703 { 705 - .name = "axp20x-pek", 704 + .name = "axp221-pek", 706 705 .num_resources = ARRAY_SIZE(axp22x_pek_resources), 707 706 .resources = axp22x_pek_resources, 708 707 }, { ··· 835 834 .resources = axp288_fuel_gauge_resources, 836 835 }, 837 836 { 838 - .name = "axp20x-pek", 837 + .name = "axp221-pek", 839 838 .num_resources = ARRAY_SIZE(axp288_power_button_resources), 840 839 .resources = axp288_power_button_resources, 841 840 }, ··· 846 845 847 846 static struct mfd_cell axp803_cells[] = { 848 847 { 849 - .name = "axp20x-pek", 848 + .name = "axp221-pek", 850 849 .num_resources = ARRAY_SIZE(axp803_pek_resources), 851 850 .resources = axp803_pek_resources, 852 851 }, ··· 862 861 863 862 static struct mfd_cell axp809_cells[] = { 864 863 { 865 - .name = "axp20x-pek", 864 + .name = "axp221-pek", 866 865 .num_resources = ARRAY_SIZE(axp809_pek_resources), 867 866 .resources = axp809_pek_resources, 868 867 }, { 869 868 .id = 1, 870 869 .name = "axp20x-regulator", 871 870 }, 871 + }; 872 + 873 + static struct mfd_cell axp813_cells[] = { 874 + { 875 + .name = "axp221-pek", 876 + .num_resources = ARRAY_SIZE(axp803_pek_resources), 877 + .resources = axp803_pek_resources, 878 + } 872 879 }; 873 880 874 881 static struct axp20x_dev *axp20x_pm_power_off; ··· 964 955 axp20x->cells = axp809_cells; 965 956 axp20x->regmap_cfg = &axp22x_regmap_config; 966 957 axp20x->regmap_irq_chip = &axp809_regmap_irq_chip; 958 + break; 959 + case AXP813_ID: 960 + axp20x->nr_cells = ARRAY_SIZE(axp813_cells); 961 + axp20x->cells = axp813_cells; 962 + axp20x->regmap_cfg = &axp288_regmap_config; 963 + /* 964 + * The IRQ table given in the datasheet is incorrect. 965 + * In IRQ enable/status registers 1, there are separate 966 + * IRQs for ACIN and VBUS, instead of bits [7:5] being 967 + * the same as bits [4:2]. So it shares the same IRQs 968 + * as the AXP803, rather than the AXP288. 969 + */ 970 + axp20x->regmap_irq_chip = &axp803_regmap_irq_chip; 967 971 break; 968 972 default: 969 973 dev_err(dev, "unsupported AXP20X ID %lu\n", axp20x->variant);
+230
drivers/mfd/bd9571mwv.c
··· 1 + /* 2 + * ROHM BD9571MWV-M MFD driver 3 + * 4 + * Copyright (C) 2017 Marek Vasut <marek.vasut+renesas@gmail.com> 5 + * 6 + * This program is free software; you can redistribute it and/or 7 + * modify it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + * 10 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 11 + * kind, whether expressed or implied; without even the implied warranty 12 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License version 2 for more details. 14 + * 15 + * Based on the TPS65086 driver 16 + */ 17 + 18 + #include <linux/i2c.h> 19 + #include <linux/interrupt.h> 20 + #include <linux/mfd/core.h> 21 + #include <linux/module.h> 22 + 23 + #include <linux/mfd/bd9571mwv.h> 24 + 25 + static const struct mfd_cell bd9571mwv_cells[] = { 26 + { .name = "bd9571mwv-regulator", }, 27 + { .name = "bd9571mwv-gpio", }, 28 + }; 29 + 30 + static const struct regmap_range bd9571mwv_readable_yes_ranges[] = { 31 + regmap_reg_range(BD9571MWV_VENDOR_CODE, BD9571MWV_PRODUCT_REVISION), 32 + regmap_reg_range(BD9571MWV_AVS_SET_MONI, BD9571MWV_AVS_DVFS_VID(3)), 33 + regmap_reg_range(BD9571MWV_VD18_VID, BD9571MWV_VD33_VID), 34 + regmap_reg_range(BD9571MWV_DVFS_VINIT, BD9571MWV_DVFS_VINIT), 35 + regmap_reg_range(BD9571MWV_DVFS_SETVMAX, BD9571MWV_DVFS_MONIVDAC), 36 + regmap_reg_range(BD9571MWV_GPIO_IN, BD9571MWV_GPIO_IN), 37 + regmap_reg_range(BD9571MWV_GPIO_INT, BD9571MWV_GPIO_INTMASK), 38 + regmap_reg_range(BD9571MWV_INT_INTREQ, BD9571MWV_INT_INTMASK), 39 + }; 40 + 41 + static const struct regmap_access_table bd9571mwv_readable_table = { 42 + .yes_ranges = bd9571mwv_readable_yes_ranges, 43 + .n_yes_ranges = ARRAY_SIZE(bd9571mwv_readable_yes_ranges), 44 + }; 45 + 46 + static const struct regmap_range bd9571mwv_writable_yes_ranges[] = { 47 + regmap_reg_range(BD9571MWV_AVS_VD09_VID(0), BD9571MWV_AVS_VD09_VID(3)), 48 + regmap_reg_range(BD9571MWV_DVFS_SETVID, BD9571MWV_DVFS_SETVID), 49 + regmap_reg_range(BD9571MWV_GPIO_DIR, BD9571MWV_GPIO_OUT), 50 + regmap_reg_range(BD9571MWV_GPIO_INT_SET, BD9571MWV_GPIO_INTMASK), 51 + regmap_reg_range(BD9571MWV_INT_INTREQ, BD9571MWV_INT_INTMASK), 52 + }; 53 + 54 + static const struct regmap_access_table bd9571mwv_writable_table = { 55 + .yes_ranges = bd9571mwv_writable_yes_ranges, 56 + .n_yes_ranges = ARRAY_SIZE(bd9571mwv_writable_yes_ranges), 57 + }; 58 + 59 + static const struct regmap_range bd9571mwv_volatile_yes_ranges[] = { 60 + regmap_reg_range(BD9571MWV_GPIO_IN, BD9571MWV_GPIO_IN), 61 + regmap_reg_range(BD9571MWV_GPIO_INT, BD9571MWV_GPIO_INT), 62 + regmap_reg_range(BD9571MWV_INT_INTREQ, BD9571MWV_INT_INTREQ), 63 + }; 64 + 65 + static const struct regmap_access_table bd9571mwv_volatile_table = { 66 + .yes_ranges = bd9571mwv_volatile_yes_ranges, 67 + .n_yes_ranges = ARRAY_SIZE(bd9571mwv_volatile_yes_ranges), 68 + }; 69 + 70 + static const struct regmap_config bd9571mwv_regmap_config = { 71 + .reg_bits = 8, 72 + .val_bits = 8, 73 + .cache_type = REGCACHE_RBTREE, 74 + .rd_table = &bd9571mwv_readable_table, 75 + .wr_table = &bd9571mwv_writable_table, 76 + .volatile_table = &bd9571mwv_volatile_table, 77 + .max_register = 0xff, 78 + }; 79 + 80 + static const struct regmap_irq bd9571mwv_irqs[] = { 81 + REGMAP_IRQ_REG(BD9571MWV_IRQ_MD1, 0, 82 + BD9571MWV_INT_INTREQ_MD1_INT), 83 + REGMAP_IRQ_REG(BD9571MWV_IRQ_MD2_E1, 0, 84 + BD9571MWV_INT_INTREQ_MD2_E1_INT), 85 + REGMAP_IRQ_REG(BD9571MWV_IRQ_MD2_E2, 0, 86 + BD9571MWV_INT_INTREQ_MD2_E2_INT), 87 + REGMAP_IRQ_REG(BD9571MWV_IRQ_PROT_ERR, 0, 88 + BD9571MWV_INT_INTREQ_PROT_ERR_INT), 89 + REGMAP_IRQ_REG(BD9571MWV_IRQ_GP, 0, 90 + BD9571MWV_INT_INTREQ_GP_INT), 91 + REGMAP_IRQ_REG(BD9571MWV_IRQ_128H_OF, 0, 92 + BD9571MWV_INT_INTREQ_128H_OF_INT), 93 + REGMAP_IRQ_REG(BD9571MWV_IRQ_WDT_OF, 0, 94 + BD9571MWV_INT_INTREQ_WDT_OF_INT), 95 + REGMAP_IRQ_REG(BD9571MWV_IRQ_BKUP_TRG, 0, 96 + BD9571MWV_INT_INTREQ_BKUP_TRG_INT), 97 + }; 98 + 99 + static struct regmap_irq_chip bd9571mwv_irq_chip = { 100 + .name = "bd9571mwv", 101 + .status_base = BD9571MWV_INT_INTREQ, 102 + .mask_base = BD9571MWV_INT_INTMASK, 103 + .ack_base = BD9571MWV_INT_INTREQ, 104 + .init_ack_masked = true, 105 + .num_regs = 1, 106 + .irqs = bd9571mwv_irqs, 107 + .num_irqs = ARRAY_SIZE(bd9571mwv_irqs), 108 + }; 109 + 110 + static int bd9571mwv_identify(struct bd9571mwv *bd) 111 + { 112 + struct device *dev = bd->dev; 113 + unsigned int value; 114 + int ret; 115 + 116 + ret = regmap_read(bd->regmap, BD9571MWV_VENDOR_CODE, &value); 117 + if (ret) { 118 + dev_err(dev, "Failed to read vendor code register (ret=%i)\n", 119 + ret); 120 + return ret; 121 + } 122 + 123 + if (value != BD9571MWV_VENDOR_CODE_VAL) { 124 + dev_err(dev, "Invalid vendor code ID %02x (expected %02x)\n", 125 + value, BD9571MWV_VENDOR_CODE_VAL); 126 + return -EINVAL; 127 + } 128 + 129 + ret = regmap_read(bd->regmap, BD9571MWV_PRODUCT_CODE, &value); 130 + if (ret) { 131 + dev_err(dev, "Failed to read product code register (ret=%i)\n", 132 + ret); 133 + return ret; 134 + } 135 + 136 + if (value != BD9571MWV_PRODUCT_CODE_VAL) { 137 + dev_err(dev, "Invalid product code ID %02x (expected %02x)\n", 138 + value, BD9571MWV_PRODUCT_CODE_VAL); 139 + return -EINVAL; 140 + } 141 + 142 + ret = regmap_read(bd->regmap, BD9571MWV_PRODUCT_REVISION, &value); 143 + if (ret) { 144 + dev_err(dev, "Failed to read revision register (ret=%i)\n", 145 + ret); 146 + return ret; 147 + } 148 + 149 + dev_info(dev, "Device: BD9571MWV rev. %d\n", value & 0xff); 150 + 151 + return 0; 152 + } 153 + 154 + static int bd9571mwv_probe(struct i2c_client *client, 155 + const struct i2c_device_id *ids) 156 + { 157 + struct bd9571mwv *bd; 158 + int ret; 159 + 160 + bd = devm_kzalloc(&client->dev, sizeof(*bd), GFP_KERNEL); 161 + if (!bd) 162 + return -ENOMEM; 163 + 164 + i2c_set_clientdata(client, bd); 165 + bd->dev = &client->dev; 166 + bd->irq = client->irq; 167 + 168 + bd->regmap = devm_regmap_init_i2c(client, &bd9571mwv_regmap_config); 169 + if (IS_ERR(bd->regmap)) { 170 + dev_err(bd->dev, "Failed to initialize register map\n"); 171 + return PTR_ERR(bd->regmap); 172 + } 173 + 174 + ret = bd9571mwv_identify(bd); 175 + if (ret) 176 + return ret; 177 + 178 + ret = regmap_add_irq_chip(bd->regmap, bd->irq, IRQF_ONESHOT, 0, 179 + &bd9571mwv_irq_chip, &bd->irq_data); 180 + if (ret) { 181 + dev_err(bd->dev, "Failed to register IRQ chip\n"); 182 + return ret; 183 + } 184 + 185 + ret = mfd_add_devices(bd->dev, PLATFORM_DEVID_AUTO, bd9571mwv_cells, 186 + ARRAY_SIZE(bd9571mwv_cells), NULL, 0, 187 + regmap_irq_get_domain(bd->irq_data)); 188 + if (ret) { 189 + regmap_del_irq_chip(bd->irq, bd->irq_data); 190 + return ret; 191 + } 192 + 193 + return 0; 194 + } 195 + 196 + static int bd9571mwv_remove(struct i2c_client *client) 197 + { 198 + struct bd9571mwv *bd = i2c_get_clientdata(client); 199 + 200 + regmap_del_irq_chip(bd->irq, bd->irq_data); 201 + 202 + return 0; 203 + } 204 + 205 + static const struct of_device_id bd9571mwv_of_match_table[] = { 206 + { .compatible = "rohm,bd9571mwv", }, 207 + { /* sentinel */ } 208 + }; 209 + MODULE_DEVICE_TABLE(of, bd9571mwv_of_match_table); 210 + 211 + static const struct i2c_device_id bd9571mwv_id_table[] = { 212 + { "bd9571mwv", 0 }, 213 + { /* sentinel */ } 214 + }; 215 + MODULE_DEVICE_TABLE(i2c, bd9571mwv_id_table); 216 + 217 + static struct i2c_driver bd9571mwv_driver = { 218 + .driver = { 219 + .name = "bd9571mwv", 220 + .of_match_table = bd9571mwv_of_match_table, 221 + }, 222 + .probe = bd9571mwv_probe, 223 + .remove = bd9571mwv_remove, 224 + .id_table = bd9571mwv_id_table, 225 + }; 226 + module_i2c_driver(bd9571mwv_driver); 227 + 228 + MODULE_AUTHOR("Marek Vasut <marek.vasut+renesas@gmail.com>"); 229 + MODULE_DESCRIPTION("BD9571MWV PMIC Driver"); 230 + MODULE_LICENSE("GPL v2");
+2
drivers/mfd/da9052-core.c
··· 387 387 388 388 mutex_lock(&da9052->auxadc_lock); 389 389 390 + reinit_completion(&da9052->done); 391 + 390 392 /* Channel gets activated on enabling the Conversion bit */ 391 393 mux_sel = chan_mux[channel] | DA9052_ADC_MAN_MAN_CONV; 392 394
+1 -1
drivers/mfd/da9052-spi.c
··· 67 67 return 0; 68 68 } 69 69 70 - static struct spi_device_id da9052_spi_id[] = { 70 + static const struct spi_device_id da9052_spi_id[] = { 71 71 {"da9052", DA9052}, 72 72 {"da9053-aa", DA9053_AA}, 73 73 {"da9053-ba", DA9053_BA},
+1 -1
drivers/mfd/da9055-i2c.c
··· 62 62 * purposes separate). As a result there are specific DA9055 ids for PMIC 63 63 * and CODEC, which must be different to operate together. 64 64 */ 65 - static struct i2c_device_id da9055_i2c_id[] = { 65 + static const struct i2c_device_id da9055_i2c_id[] = { 66 66 {"da9055-pmic", 0}, 67 67 { } 68 68 };
+1 -1
drivers/mfd/dm355evm_msp.c
··· 18 18 #include <linux/gpio.h> 19 19 #include <linux/leds.h> 20 20 #include <linux/i2c.h> 21 - #include <linux/i2c/dm355evm_msp.h> 21 + #include <linux/mfd/dm355evm_msp.h> 22 22 23 23 24 24 /*
+57 -32
drivers/mfd/hi6421-pmic-core.c
··· 1 1 /* 2 - * Device driver for Hi6421 IC 2 + * Device driver for Hi6421 PMIC 3 3 * 4 4 * Copyright (c) <2011-2014> HiSilicon Technologies Co., Ltd. 5 5 * http://www.hisilicon.com 6 - * Copyright (c) <2013-2014> Linaro Ltd. 6 + * Copyright (c) <2013-2017> Linaro Ltd. 7 7 * http://www.linaro.org 8 8 * 9 9 * Author: Guodong Xu <guodong.xu@linaro.org> 10 10 * 11 11 * This program is free software; you can redistribute it and/or modify 12 - * it under the terms of the GNU General Public License as published by 13 - * the Free Software Foundation; either version 2 of the License, or 14 - * (at your option) any later version. 15 - * 16 - * This program is distributed in the hope it will be useful, but WITHOUT 17 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 19 - * more details. 20 - * 21 - * You should have received a copy of the GNU General Public License 22 - * along with this program. If not, see <http://www.gnu.org/licenses/>. 12 + * it under the terms of the GNU General Public License version 2 as 13 + * published by the Free Software Foundation. 23 14 */ 24 15 25 16 #include <linux/device.h> 26 17 #include <linux/err.h> 27 18 #include <linux/mfd/core.h> 19 + #include <linux/mfd/hi6421-pmic.h> 28 20 #include <linux/module.h> 29 - #include <linux/of.h> 21 + #include <linux/of_device.h> 30 22 #include <linux/platform_device.h> 31 23 #include <linux/regmap.h> 32 - #include <linux/mfd/hi6421-pmic.h> 33 24 34 25 static const struct mfd_cell hi6421_devs[] = { 35 26 { .name = "hi6421-regulator", }, 27 + }; 28 + 29 + static const struct mfd_cell hi6421v530_devs[] = { 30 + { .name = "hi6421v530-regulator", }, 36 31 }; 37 32 38 33 static const struct regmap_config hi6421_regmap_config = { ··· 37 42 .max_register = HI6421_REG_TO_BUS_ADDR(HI6421_REG_MAX), 38 43 }; 39 44 45 + static const struct of_device_id of_hi6421_pmic_match[] = { 46 + { 47 + .compatible = "hisilicon,hi6421-pmic", 48 + .data = (void *)HI6421 49 + }, 50 + { 51 + .compatible = "hisilicon,hi6421v530-pmic", 52 + .data = (void *)HI6421_V530 53 + }, 54 + { }, 55 + }; 56 + MODULE_DEVICE_TABLE(of, of_hi6421_pmic_match); 57 + 40 58 static int hi6421_pmic_probe(struct platform_device *pdev) 41 59 { 42 60 struct hi6421_pmic *pmic; 43 61 struct resource *res; 62 + const struct of_device_id *id; 63 + const struct mfd_cell *subdevs; 64 + enum hi6421_type type; 44 65 void __iomem *base; 45 - int ret; 66 + int n_subdevs, ret; 67 + 68 + id = of_match_device(of_hi6421_pmic_match, &pdev->dev); 69 + if (!id) 70 + return -EINVAL; 71 + type = (enum hi6421_type)id->data; 46 72 47 73 pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); 48 74 if (!pmic) ··· 77 61 pmic->regmap = devm_regmap_init_mmio_clk(&pdev->dev, NULL, base, 78 62 &hi6421_regmap_config); 79 63 if (IS_ERR(pmic->regmap)) { 80 - dev_err(&pdev->dev, 81 - "regmap init failed: %ld\n", PTR_ERR(pmic->regmap)); 64 + dev_err(&pdev->dev, "Failed to initialise Regmap: %ld\n", 65 + PTR_ERR(pmic->regmap)); 82 66 return PTR_ERR(pmic->regmap); 83 67 } 84 68 85 - /* set over-current protection debounce 8ms */ 86 - regmap_update_bits(pmic->regmap, HI6421_OCP_DEB_CTRL_REG, 69 + platform_set_drvdata(pdev, pmic); 70 + 71 + switch (type) { 72 + case HI6421: 73 + /* set over-current protection debounce 8ms */ 74 + regmap_update_bits(pmic->regmap, HI6421_OCP_DEB_CTRL_REG, 87 75 (HI6421_OCP_DEB_SEL_MASK 88 76 | HI6421_OCP_EN_DEBOUNCE_MASK 89 77 | HI6421_OCP_AUTO_STOP_MASK), 90 78 (HI6421_OCP_DEB_SEL_8MS 91 79 | HI6421_OCP_EN_DEBOUNCE_ENABLE)); 92 80 93 - platform_set_drvdata(pdev, pmic); 81 + subdevs = hi6421_devs; 82 + n_subdevs = ARRAY_SIZE(hi6421_devs); 83 + break; 84 + case HI6421_V530: 85 + subdevs = hi6421v530_devs; 86 + n_subdevs = ARRAY_SIZE(hi6421v530_devs); 87 + break; 88 + default: 89 + dev_err(&pdev->dev, "Unknown device type %d\n", 90 + (unsigned int)type); 91 + return -EINVAL; 92 + } 94 93 95 - ret = devm_mfd_add_devices(&pdev->dev, 0, hi6421_devs, 96 - ARRAY_SIZE(hi6421_devs), NULL, 0, NULL); 94 + ret = devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, 95 + subdevs, n_subdevs, NULL, 0, NULL); 97 96 if (ret) { 98 - dev_err(&pdev->dev, "add mfd devices failed: %d\n", ret); 97 + dev_err(&pdev->dev, "Failed to add child devices: %d\n", ret); 99 98 return ret; 100 99 } 101 100 102 101 return 0; 103 102 } 104 103 105 - static const struct of_device_id of_hi6421_pmic_match_tbl[] = { 106 - { .compatible = "hisilicon,hi6421-pmic", }, 107 - { }, 108 - }; 109 - MODULE_DEVICE_TABLE(of, of_hi6421_pmic_match_tbl); 110 - 111 104 static struct platform_driver hi6421_pmic_driver = { 112 105 .driver = { 113 - .name = "hi6421_pmic", 114 - .of_match_table = of_hi6421_pmic_match_tbl, 106 + .name = "hi6421_pmic", 107 + .of_match_table = of_hi6421_pmic_match, 115 108 }, 116 109 .probe = hi6421_pmic_probe, 117 110 };
+1
drivers/mfd/intel-lpss-pci.c
··· 221 221 { PCI_VDEVICE(INTEL, 0xa12a), (kernel_ulong_t)&spt_info }, 222 222 { PCI_VDEVICE(INTEL, 0xa160), (kernel_ulong_t)&spt_i2c_info }, 223 223 { PCI_VDEVICE(INTEL, 0xa161), (kernel_ulong_t)&spt_i2c_info }, 224 + { PCI_VDEVICE(INTEL, 0xa162), (kernel_ulong_t)&spt_i2c_info }, 224 225 { PCI_VDEVICE(INTEL, 0xa166), (kernel_ulong_t)&spt_uart_info }, 225 226 /* KBL-H */ 226 227 { PCI_VDEVICE(INTEL, 0xa2a7), (kernel_ulong_t)&spt_uart_info },
+8
drivers/mfd/intel-lpss.c
··· 502 502 for (i = 0; i < LPSS_PRIV_REG_COUNT; i++) 503 503 lpss->priv_ctx[i] = readl(lpss->priv + i * 4); 504 504 505 + /* 506 + * If the device type is not UART, then put the controller into 507 + * reset. UART cannot be put into reset since S3/S0ix fail when 508 + * no_console_suspend flag is enabled. 509 + */ 510 + if (lpss->type != LPSS_DEV_UART) 511 + writel(0, lpss->priv + LPSS_PRIV_RESETS); 512 + 505 513 return 0; 506 514 } 507 515 EXPORT_SYMBOL_GPL(intel_lpss_suspend);
+27 -5
drivers/mfd/intel_soc_pmic_core.c
··· 16 16 * Author: Zhu, Lejun <lejun.zhu@linux.intel.com> 17 17 */ 18 18 19 + #include <linux/acpi.h> 19 20 #include <linux/module.h> 20 21 #include <linux/mfd/core.h> 21 22 #include <linux/i2c.h> ··· 28 27 #include <linux/gpio/machine.h> 29 28 #include <linux/pwm.h> 30 29 #include "intel_soc_pmic_core.h" 30 + 31 + /* Crystal Cove PMIC shares same ACPI ID between different platforms */ 32 + #define BYT_CRC_HRV 2 33 + #define CHT_CRC_HRV 3 31 34 32 35 /* Lookup table for the Panel Enable/Disable line as GPIO signals */ 33 36 static struct gpiod_lookup_table panel_gpio_table = { ··· 53 48 const struct i2c_device_id *i2c_id) 54 49 { 55 50 struct device *dev = &i2c->dev; 56 - const struct acpi_device_id *id; 57 51 struct intel_soc_pmic_config *config; 58 52 struct intel_soc_pmic *pmic; 53 + unsigned long long hrv; 54 + acpi_status status; 59 55 int ret; 60 56 61 - id = acpi_match_device(dev->driver->acpi_match_table, dev); 62 - if (!id || !id->driver_data) 57 + /* 58 + * There are 2 different Crystal Cove PMICs a Bay Trail and Cherry 59 + * Trail version, use _HRV to differentiate between the 2. 60 + */ 61 + status = acpi_evaluate_integer(ACPI_HANDLE(dev), "_HRV", NULL, &hrv); 62 + if (ACPI_FAILURE(status)) { 63 + dev_err(dev, "Failed to get PMIC hardware revision\n"); 63 64 return -ENODEV; 65 + } 64 66 65 - config = (struct intel_soc_pmic_config *)id->driver_data; 67 + switch (hrv) { 68 + case BYT_CRC_HRV: 69 + config = &intel_soc_pmic_config_byt_crc; 70 + break; 71 + case CHT_CRC_HRV: 72 + config = &intel_soc_pmic_config_cht_crc; 73 + break; 74 + default: 75 + dev_warn(dev, "Unknown hardware rev %llu, assuming BYT\n", hrv); 76 + config = &intel_soc_pmic_config_byt_crc; 77 + } 66 78 67 79 pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL); 68 80 if (!pmic) ··· 179 157 180 158 #if defined(CONFIG_ACPI) 181 159 static const struct acpi_device_id intel_soc_pmic_acpi_match[] = { 182 - {"INT33FD", (kernel_ulong_t)&intel_soc_pmic_config_crc}, 160 + { "INT33FD" }, 183 161 { }, 184 162 }; 185 163 MODULE_DEVICE_TABLE(acpi, intel_soc_pmic_acpi_match);
+2 -1
drivers/mfd/intel_soc_pmic_core.h
··· 27 27 const struct regmap_irq_chip *irq_chip; 28 28 }; 29 29 30 - extern struct intel_soc_pmic_config intel_soc_pmic_config_crc; 30 + extern struct intel_soc_pmic_config intel_soc_pmic_config_byt_crc; 31 + extern struct intel_soc_pmic_config intel_soc_pmic_config_cht_crc; 31 32 32 33 #endif /* __INTEL_SOC_PMIC_CORE_H__ */
+23 -4
drivers/mfd/intel_soc_pmic_crc.c
··· 80 80 }, 81 81 }; 82 82 83 - static struct mfd_cell crystal_cove_dev[] = { 83 + static struct mfd_cell crystal_cove_byt_dev[] = { 84 84 { 85 85 .name = "crystal_cove_pwrsrc", 86 86 .num_resources = ARRAY_SIZE(pwrsrc_resources), ··· 108 108 }, 109 109 { 110 110 .name = "crystal_cove_pmic", 111 + }, 112 + { 113 + .name = "crystal_cove_pwm", 114 + }, 115 + }; 116 + 117 + static struct mfd_cell crystal_cove_cht_dev[] = { 118 + { 119 + .name = "crystal_cove_gpio", 120 + .num_resources = ARRAY_SIZE(gpio_resources), 121 + .resources = gpio_resources, 111 122 }, 112 123 { 113 124 .name = "crystal_cove_pwm", ··· 166 155 .mask_base = CRYSTAL_COVE_REG_MIRQLVL1, 167 156 }; 168 157 169 - struct intel_soc_pmic_config intel_soc_pmic_config_crc = { 158 + struct intel_soc_pmic_config intel_soc_pmic_config_byt_crc = { 170 159 .irq_flags = IRQF_TRIGGER_RISING, 171 - .cell_dev = crystal_cove_dev, 172 - .n_cell_devs = ARRAY_SIZE(crystal_cove_dev), 160 + .cell_dev = crystal_cove_byt_dev, 161 + .n_cell_devs = ARRAY_SIZE(crystal_cove_byt_dev), 162 + .regmap_config = &crystal_cove_regmap_config, 163 + .irq_chip = &crystal_cove_irq_chip, 164 + }; 165 + 166 + struct intel_soc_pmic_config intel_soc_pmic_config_cht_crc = { 167 + .irq_flags = IRQF_TRIGGER_RISING, 168 + .cell_dev = crystal_cove_cht_dev, 169 + .n_cell_devs = ARRAY_SIZE(crystal_cove_cht_dev), 173 170 .regmap_config = &crystal_cove_regmap_config, 174 171 .irq_chip = &crystal_cove_irq_chip, 175 172 };
+3 -4
drivers/mfd/lp87565.c
··· 73 73 74 74 i2c_set_clientdata(client, lp87565); 75 75 76 - ret = mfd_add_devices(lp87565->dev, PLATFORM_DEVID_AUTO, lp87565_cells, 77 - ARRAY_SIZE(lp87565_cells), NULL, 0, NULL); 78 - 79 - return ret; 76 + return devm_mfd_add_devices(lp87565->dev, PLATFORM_DEVID_AUTO, 77 + lp87565_cells, ARRAY_SIZE(lp87565_cells), 78 + NULL, 0, NULL); 80 79 } 81 80 82 81 static const struct i2c_device_id lp87565_id_table[] = {
-10
drivers/mfd/lpc_ich.c
··· 1119 1119 res->start = spi_base + SPIBASE_LPT; 1120 1120 res->end = res->start + SPIBASE_LPT_SZ - 1; 1121 1121 1122 - /* 1123 - * Try to make the flash chip writeable now by 1124 - * setting BCR_WPD. It it fails we tell the driver 1125 - * that it can only read the chip. 1126 - */ 1127 1122 pci_read_config_dword(dev, BCR, &bcr); 1128 - if (!(bcr & BCR_WPD)) { 1129 - bcr |= BCR_WPD; 1130 - pci_write_config_dword(dev, BCR, bcr); 1131 - pci_read_config_dword(dev, BCR, &bcr); 1132 - } 1133 1123 info->writeable = !!(bcr & BCR_WPD); 1134 1124 } 1135 1125 break;
+1 -1
drivers/mfd/max8925-i2c.c
··· 151 151 const struct i2c_device_id *id) 152 152 { 153 153 struct max8925_platform_data *pdata = dev_get_platdata(&client->dev); 154 - static struct max8925_chip *chip; 154 + struct max8925_chip *chip; 155 155 struct device_node *node = client->dev.of_node; 156 156 157 157 if (node && !pdata) {
+2 -4
drivers/mfd/max8998.c
··· 192 192 193 193 if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node) { 194 194 pdata = max8998_i2c_parse_dt_pdata(&i2c->dev); 195 - if (IS_ERR(pdata)) { 196 - ret = PTR_ERR(pdata); 197 - goto err; 198 - } 195 + if (IS_ERR(pdata)) 196 + return PTR_ERR(pdata); 199 197 } 200 198 201 199 i2c_set_clientdata(i2c, max8998);
+2 -2
drivers/mfd/omap-usb-tll.c
··· 131 131 return readl_relaxed(base + reg); 132 132 } 133 133 134 - static inline void usbtll_writeb(void __iomem *base, u8 reg, u8 val) 134 + static inline void usbtll_writeb(void __iomem *base, u32 reg, u8 val) 135 135 { 136 136 writeb_relaxed(val, base + reg); 137 137 } 138 138 139 - static inline u8 usbtll_readb(void __iomem *base, u8 reg) 139 + static inline u8 usbtll_readb(void __iomem *base, u32 reg) 140 140 { 141 141 return readb_relaxed(base + reg); 142 142 }
+10 -2
drivers/mfd/retu-mfd.c
··· 302 302 } 303 303 304 304 static const struct i2c_device_id retu_id[] = { 305 - { "retu-mfd", 0 }, 306 - { "tahvo-mfd", 0 }, 305 + { "retu", 0 }, 306 + { "tahvo", 0 }, 307 307 { } 308 308 }; 309 309 MODULE_DEVICE_TABLE(i2c, retu_id); 310 310 311 + static const struct of_device_id retu_of_match[] = { 312 + { .compatible = "nokia,retu" }, 313 + { .compatible = "nokia,tahvo" }, 314 + { } 315 + }; 316 + MODULE_DEVICE_TABLE(of, retu_of_match); 317 + 311 318 static struct i2c_driver retu_driver = { 312 319 .driver = { 313 320 .name = "retu-mfd", 321 + .of_match_table = retu_of_match, 314 322 }, 315 323 .probe = retu_probe, 316 324 .remove = retu_remove,
+141 -6
drivers/mfd/rk808.c
··· 70 70 .volatile_reg = rk808_is_volatile_reg, 71 71 }; 72 72 73 + static const struct regmap_config rk805_regmap_config = { 74 + .reg_bits = 8, 75 + .val_bits = 8, 76 + .max_register = RK805_OFF_SOURCE_REG, 77 + .cache_type = REGCACHE_RBTREE, 78 + .volatile_reg = rk808_is_volatile_reg, 79 + }; 80 + 73 81 static const struct regmap_config rk808_regmap_config = { 74 82 .reg_bits = 8, 75 83 .val_bits = 8, ··· 92 84 .end = RK808_IRQ_RTC_ALARM, 93 85 .flags = IORESOURCE_IRQ, 94 86 } 87 + }; 88 + 89 + static struct resource rk805_key_resources[] = { 90 + { 91 + .start = RK805_IRQ_PWRON_FALL, 92 + .end = RK805_IRQ_PWRON_FALL, 93 + .flags = IORESOURCE_IRQ, 94 + }, 95 + { 96 + .start = RK805_IRQ_PWRON_RISE, 97 + .end = RK805_IRQ_PWRON_RISE, 98 + .flags = IORESOURCE_IRQ, 99 + } 100 + }; 101 + 102 + static const struct mfd_cell rk805s[] = { 103 + { .name = "rk808-clkout", }, 104 + { .name = "rk808-regulator", }, 105 + { .name = "rk805-pinctrl", }, 106 + { 107 + .name = "rk808-rtc", 108 + .num_resources = ARRAY_SIZE(rtc_resources), 109 + .resources = &rtc_resources[0], 110 + }, 111 + { .name = "rk805-pwrkey", 112 + .num_resources = ARRAY_SIZE(rk805_key_resources), 113 + .resources = &rk805_key_resources[0], 114 + }, 95 115 }; 96 116 97 117 static const struct mfd_cell rk808s[] = { ··· 140 104 .num_resources = ARRAY_SIZE(rtc_resources), 141 105 .resources = rtc_resources, 142 106 }, 107 + }; 108 + 109 + static const struct rk808_reg_data rk805_pre_init_reg[] = { 110 + {RK805_BUCK1_CONFIG_REG, RK805_BUCK1_2_ILMAX_MASK, 111 + RK805_BUCK1_2_ILMAX_4000MA}, 112 + {RK805_BUCK2_CONFIG_REG, RK805_BUCK1_2_ILMAX_MASK, 113 + RK805_BUCK1_2_ILMAX_4000MA}, 114 + {RK805_BUCK3_CONFIG_REG, RK805_BUCK3_4_ILMAX_MASK, 115 + RK805_BUCK3_ILMAX_3000MA}, 116 + {RK805_BUCK4_CONFIG_REG, RK805_BUCK3_4_ILMAX_MASK, 117 + RK805_BUCK4_ILMAX_3500MA}, 118 + {RK805_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_400MA}, 119 + {RK805_GPIO_IO_POL_REG, SLP_SD_MSK, SLEEP_FUN}, 120 + {RK805_THERMAL_REG, TEMP_HOTDIE_MSK, TEMP115C}, 143 121 }; 144 122 145 123 static const struct rk808_reg_data rk808_pre_init_reg[] = { ··· 183 133 { RK818_H5V_EN_REG, BIT(0), RK818_H5V_EN }, 184 134 { RK808_VB_MON_REG, MASK_ALL, VB_LO_ACT | 185 135 VB_LO_SEL_3500MV }, 136 + }; 137 + 138 + static const struct regmap_irq rk805_irqs[] = { 139 + [RK805_IRQ_PWRON_RISE] = { 140 + .mask = RK805_IRQ_PWRON_RISE_MSK, 141 + .reg_offset = 0, 142 + }, 143 + [RK805_IRQ_VB_LOW] = { 144 + .mask = RK805_IRQ_VB_LOW_MSK, 145 + .reg_offset = 0, 146 + }, 147 + [RK805_IRQ_PWRON] = { 148 + .mask = RK805_IRQ_PWRON_MSK, 149 + .reg_offset = 0, 150 + }, 151 + [RK805_IRQ_PWRON_LP] = { 152 + .mask = RK805_IRQ_PWRON_LP_MSK, 153 + .reg_offset = 0, 154 + }, 155 + [RK805_IRQ_HOTDIE] = { 156 + .mask = RK805_IRQ_HOTDIE_MSK, 157 + .reg_offset = 0, 158 + }, 159 + [RK805_IRQ_RTC_ALARM] = { 160 + .mask = RK805_IRQ_RTC_ALARM_MSK, 161 + .reg_offset = 0, 162 + }, 163 + [RK805_IRQ_RTC_PERIOD] = { 164 + .mask = RK805_IRQ_RTC_PERIOD_MSK, 165 + .reg_offset = 0, 166 + }, 167 + [RK805_IRQ_PWRON_FALL] = { 168 + .mask = RK805_IRQ_PWRON_FALL_MSK, 169 + .reg_offset = 0, 170 + }, 186 171 }; 187 172 188 173 static const struct regmap_irq rk808_irqs[] = { ··· 332 247 }, 333 248 }; 334 249 250 + static struct regmap_irq_chip rk805_irq_chip = { 251 + .name = "rk805", 252 + .irqs = rk805_irqs, 253 + .num_irqs = ARRAY_SIZE(rk805_irqs), 254 + .num_regs = 1, 255 + .status_base = RK805_INT_STS_REG, 256 + .mask_base = RK805_INT_STS_MSK_REG, 257 + .ack_base = RK805_INT_STS_REG, 258 + .init_ack_masked = true, 259 + }; 260 + 335 261 static const struct regmap_irq_chip rk808_irq_chip = { 336 262 .name = "rk808", 337 263 .irqs = rk808_irqs, ··· 368 272 }; 369 273 370 274 static struct i2c_client *rk808_i2c_client; 275 + 276 + static void rk805_device_shutdown(void) 277 + { 278 + int ret; 279 + struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client); 280 + 281 + if (!rk808) { 282 + dev_warn(&rk808_i2c_client->dev, 283 + "have no rk805, so do nothing here\n"); 284 + return; 285 + } 286 + 287 + ret = regmap_update_bits(rk808->regmap, 288 + RK805_DEV_CTRL_REG, 289 + DEV_OFF, DEV_OFF); 290 + if (ret) 291 + dev_err(&rk808_i2c_client->dev, "power off error!\n"); 292 + } 293 + 371 294 static void rk808_device_shutdown(void) 372 295 { 373 296 int ret; ··· 424 309 } 425 310 426 311 static const struct of_device_id rk808_of_match[] = { 312 + { .compatible = "rockchip,rk805" }, 427 313 { .compatible = "rockchip,rk808" }, 428 314 { .compatible = "rockchip,rk818" }, 429 315 { }, ··· 441 325 void (*pm_pwroff_fn)(void); 442 326 int nr_pre_init_regs; 443 327 int nr_cells; 444 - int pm_off = 0; 328 + int pm_off = 0, msb, lsb; 445 329 int ret; 446 330 int i; 447 331 ··· 449 333 if (!rk808) 450 334 return -ENOMEM; 451 335 452 - rk808->variant = i2c_smbus_read_word_data(client, RK808_ID_MSB); 453 - if (rk808->variant < 0) { 454 - dev_err(&client->dev, "Failed to read the chip id at 0x%02x\n", 336 + /* Read chip variant */ 337 + msb = i2c_smbus_read_byte_data(client, RK808_ID_MSB); 338 + if (msb < 0) { 339 + dev_err(&client->dev, "failed to read the chip id at 0x%x\n", 455 340 RK808_ID_MSB); 456 - return rk808->variant; 341 + return msb; 457 342 } 458 343 459 - dev_dbg(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant); 344 + lsb = i2c_smbus_read_byte_data(client, RK808_ID_LSB); 345 + if (lsb < 0) { 346 + dev_err(&client->dev, "failed to read the chip id at 0x%x\n", 347 + RK808_ID_LSB); 348 + return lsb; 349 + } 350 + 351 + rk808->variant = ((msb << 8) | lsb) & RK8XX_ID_MSK; 352 + dev_info(&client->dev, "chip id: 0x%x\n", (unsigned int)rk808->variant); 460 353 461 354 switch (rk808->variant) { 355 + case RK805_ID: 356 + rk808->regmap_cfg = &rk805_regmap_config; 357 + rk808->regmap_irq_chip = &rk805_irq_chip; 358 + pre_init_reg = rk805_pre_init_reg; 359 + nr_pre_init_regs = ARRAY_SIZE(rk805_pre_init_reg); 360 + cells = rk805s; 361 + nr_cells = ARRAY_SIZE(rk805s); 362 + pm_pwroff_fn = rk805_device_shutdown; 363 + break; 462 364 case RK808_ID: 463 365 rk808->regmap_cfg = &rk808_regmap_config; 464 366 rk808->regmap_irq_chip = &rk808_irq_chip; ··· 569 435 } 570 436 571 437 static const struct i2c_device_id rk808_ids[] = { 438 + { "rk805" }, 572 439 { "rk808" }, 573 440 { "rk818" }, 574 441 { },
+2 -2
drivers/mfd/rtsx_pcr.c
··· 644 644 { 645 645 int err, clk; 646 646 u8 n, clk_divider, mcu_cnt, div; 647 - u8 depth[] = { 647 + static const u8 depth[] = { 648 648 [RTSX_SSC_DEPTH_4M] = SSC_DEPTH_4M, 649 649 [RTSX_SSC_DEPTH_2M] = SSC_DEPTH_2M, 650 650 [RTSX_SSC_DEPTH_1M] = SSC_DEPTH_1M, ··· 768 768 769 769 int rtsx_pci_card_exclusive_check(struct rtsx_pcr *pcr, int card) 770 770 { 771 - unsigned int cd_mask[] = { 771 + static const unsigned int cd_mask[] = { 772 772 [RTSX_SD_CARD] = SD_EXIST, 773 773 [RTSX_MS_CARD] = MS_EXIST 774 774 };
+107
drivers/mfd/stm32-lptimer.c
··· 1 + /* 2 + * STM32 Low-Power Timer parent driver. 3 + * 4 + * Copyright (C) STMicroelectronics 2017 5 + * 6 + * Author: Fabrice Gasnier <fabrice.gasnier@st.com> 7 + * 8 + * Inspired by Benjamin Gaignard's stm32-timers driver 9 + * 10 + * License terms: GNU General Public License (GPL), version 2 11 + */ 12 + 13 + #include <linux/mfd/stm32-lptimer.h> 14 + #include <linux/module.h> 15 + #include <linux/of_platform.h> 16 + 17 + #define STM32_LPTIM_MAX_REGISTER 0x3fc 18 + 19 + static const struct regmap_config stm32_lptimer_regmap_cfg = { 20 + .reg_bits = 32, 21 + .val_bits = 32, 22 + .reg_stride = sizeof(u32), 23 + .max_register = STM32_LPTIM_MAX_REGISTER, 24 + }; 25 + 26 + static int stm32_lptimer_detect_encoder(struct stm32_lptimer *ddata) 27 + { 28 + u32 val; 29 + int ret; 30 + 31 + /* 32 + * Quadrature encoder mode bit can only be written and read back when 33 + * Low-Power Timer supports it. 34 + */ 35 + ret = regmap_update_bits(ddata->regmap, STM32_LPTIM_CFGR, 36 + STM32_LPTIM_ENC, STM32_LPTIM_ENC); 37 + if (ret) 38 + return ret; 39 + 40 + ret = regmap_read(ddata->regmap, STM32_LPTIM_CFGR, &val); 41 + if (ret) 42 + return ret; 43 + 44 + ret = regmap_update_bits(ddata->regmap, STM32_LPTIM_CFGR, 45 + STM32_LPTIM_ENC, 0); 46 + if (ret) 47 + return ret; 48 + 49 + ddata->has_encoder = !!(val & STM32_LPTIM_ENC); 50 + 51 + return 0; 52 + } 53 + 54 + static int stm32_lptimer_probe(struct platform_device *pdev) 55 + { 56 + struct device *dev = &pdev->dev; 57 + struct stm32_lptimer *ddata; 58 + struct resource *res; 59 + void __iomem *mmio; 60 + int ret; 61 + 62 + ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); 63 + if (!ddata) 64 + return -ENOMEM; 65 + 66 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 67 + mmio = devm_ioremap_resource(dev, res); 68 + if (IS_ERR(mmio)) 69 + return PTR_ERR(mmio); 70 + 71 + ddata->regmap = devm_regmap_init_mmio_clk(dev, "mux", mmio, 72 + &stm32_lptimer_regmap_cfg); 73 + if (IS_ERR(ddata->regmap)) 74 + return PTR_ERR(ddata->regmap); 75 + 76 + ddata->clk = devm_clk_get(dev, NULL); 77 + if (IS_ERR(ddata->clk)) 78 + return PTR_ERR(ddata->clk); 79 + 80 + ret = stm32_lptimer_detect_encoder(ddata); 81 + if (ret) 82 + return ret; 83 + 84 + platform_set_drvdata(pdev, ddata); 85 + 86 + return devm_of_platform_populate(&pdev->dev); 87 + } 88 + 89 + static const struct of_device_id stm32_lptimer_of_match[] = { 90 + { .compatible = "st,stm32-lptimer", }, 91 + {}, 92 + }; 93 + MODULE_DEVICE_TABLE(of, stm32_lptimer_of_match); 94 + 95 + static struct platform_driver stm32_lptimer_driver = { 96 + .probe = stm32_lptimer_probe, 97 + .driver = { 98 + .name = "stm32-lptimer", 99 + .of_match_table = stm32_lptimer_of_match, 100 + }, 101 + }; 102 + module_platform_driver(stm32_lptimer_driver); 103 + 104 + MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier@st.com>"); 105 + MODULE_DESCRIPTION("STMicroelectronics STM32 Low-Power Timer"); 106 + MODULE_ALIAS("platform:stm32-lptimer"); 107 + MODULE_LICENSE("GPL v2");
+14 -3
drivers/mfd/t7l66xb.c
··· 86 86 struct t7l66xb *t7l66xb = platform_get_drvdata(dev); 87 87 unsigned long flags; 88 88 u8 dev_ctl; 89 + int ret; 89 90 90 - clk_prepare_enable(t7l66xb->clk32k); 91 + ret = clk_prepare_enable(t7l66xb->clk32k); 92 + if (ret) 93 + return ret; 91 94 92 95 raw_spin_lock_irqsave(&t7l66xb->lock, flags); 93 96 ··· 289 286 { 290 287 struct t7l66xb *t7l66xb = platform_get_drvdata(dev); 291 288 struct t7l66xb_platform_data *pdata = dev_get_platdata(&dev->dev); 289 + int ret; 292 290 293 - clk_prepare_enable(t7l66xb->clk48m); 291 + ret = clk_prepare_enable(t7l66xb->clk48m); 292 + if (ret) 293 + return ret; 294 + 294 295 if (pdata && pdata->resume) 295 296 pdata->resume(dev); 296 297 ··· 368 361 goto err_ioremap; 369 362 } 370 363 371 - clk_prepare_enable(t7l66xb->clk48m); 364 + ret = clk_prepare_enable(t7l66xb->clk48m); 365 + if (ret) 366 + goto err_clk_enable; 372 367 373 368 if (pdata->enable) 374 369 pdata->enable(dev); ··· 395 386 return 0; 396 387 397 388 t7l66xb_detach_irq(dev); 389 + clk_disable_unprepare(t7l66xb->clk48m); 390 + err_clk_enable: 398 391 iounmap(t7l66xb->scr); 399 392 err_ioremap: 400 393 release_resource(&t7l66xb->rscr);
+8
drivers/mfd/tps6105x.c
··· 173 173 }; 174 174 MODULE_DEVICE_TABLE(i2c, tps6105x_id); 175 175 176 + static const struct of_device_id tps6105x_of_match[] = { 177 + { .compatible = "ti,tps61050" }, 178 + { .compatible = "ti,tps61052" }, 179 + { }, 180 + }; 181 + MODULE_DEVICE_TABLE(of, tps6105x_of_match); 182 + 176 183 static struct i2c_driver tps6105x_driver = { 177 184 .driver = { 178 185 .name = "tps6105x", 186 + .of_match_table = tps6105x_of_match, 179 187 }, 180 188 .probe = tps6105x_probe, 181 189 .remove = tps6105x_remove,
+1 -1
drivers/mfd/tps65010.c
··· 32 32 #include <linux/mutex.h> 33 33 #include <linux/platform_device.h> 34 34 35 - #include <linux/i2c/tps65010.h> 35 + #include <linux/mfd/tps65010.h> 36 36 37 37 #include <linux/gpio/driver.h> 38 38
+106
drivers/mfd/tps68470.c
··· 1 + /* 2 + * TPS68470 chip Parent driver 3 + * 4 + * Copyright (C) 2017 Intel Corporation 5 + * 6 + * Authors: 7 + * Rajmohan Mani <rajmohan.mani@intel.com> 8 + * Tianshu Qiu <tian.shu.qiu@intel.com> 9 + * Jian Xu Zheng <jian.xu.zheng@intel.com> 10 + * Yuning Pu <yuning.pu@intel.com> 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License as 14 + * published by the Free Software Foundation version 2. 15 + * 16 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 17 + * kind, whether express or implied; without even the implied warranty 18 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 + * GNU General Public License for more details. 20 + */ 21 + 22 + #include <linux/acpi.h> 23 + #include <linux/delay.h> 24 + #include <linux/i2c.h> 25 + #include <linux/init.h> 26 + #include <linux/mfd/core.h> 27 + #include <linux/mfd/tps68470.h> 28 + #include <linux/regmap.h> 29 + 30 + static const struct mfd_cell tps68470s[] = { 31 + { .name = "tps68470-gpio" }, 32 + { .name = "tps68470_pmic_opregion" }, 33 + }; 34 + 35 + static const struct regmap_config tps68470_regmap_config = { 36 + .reg_bits = 8, 37 + .val_bits = 8, 38 + .max_register = TPS68470_REG_MAX, 39 + }; 40 + 41 + static int tps68470_chip_init(struct device *dev, struct regmap *regmap) 42 + { 43 + unsigned int version; 44 + int ret; 45 + 46 + /* Force software reset */ 47 + ret = regmap_write(regmap, TPS68470_REG_RESET, TPS68470_REG_RESET_MASK); 48 + if (ret) 49 + return ret; 50 + 51 + ret = regmap_read(regmap, TPS68470_REG_REVID, &version); 52 + if (ret) { 53 + dev_err(dev, "Failed to read revision register: %d\n", ret); 54 + return ret; 55 + } 56 + 57 + dev_info(dev, "TPS68470 REVID: 0x%x\n", version); 58 + 59 + return 0; 60 + } 61 + 62 + static int tps68470_probe(struct i2c_client *client) 63 + { 64 + struct device *dev = &client->dev; 65 + struct regmap *regmap; 66 + int ret; 67 + 68 + regmap = devm_regmap_init_i2c(client, &tps68470_regmap_config); 69 + if (IS_ERR(regmap)) { 70 + dev_err(dev, "devm_regmap_init_i2c Error %ld\n", 71 + PTR_ERR(regmap)); 72 + return PTR_ERR(regmap); 73 + } 74 + 75 + i2c_set_clientdata(client, regmap); 76 + 77 + ret = tps68470_chip_init(dev, regmap); 78 + if (ret < 0) { 79 + dev_err(dev, "TPS68470 Init Error %d\n", ret); 80 + return ret; 81 + } 82 + 83 + ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, tps68470s, 84 + ARRAY_SIZE(tps68470s), NULL, 0, NULL); 85 + if (ret < 0) { 86 + dev_err(dev, "devm_mfd_add_devices failed: %d\n", ret); 87 + return ret; 88 + } 89 + 90 + return 0; 91 + } 92 + 93 + static const struct acpi_device_id tps68470_acpi_ids[] = { 94 + {"INT3472"}, 95 + {}, 96 + }; 97 + MODULE_DEVICE_TABLE(acpi, tps68470_acpi_ids); 98 + 99 + static struct i2c_driver tps68470_driver = { 100 + .driver = { 101 + .name = "tps68470", 102 + .acpi_match_table = tps68470_acpi_ids, 103 + }, 104 + .probe_new = tps68470_probe, 105 + }; 106 + builtin_i2c_driver(tps68470_driver);
+5 -5
drivers/mfd/twl-core.c
··· 44 44 #include <linux/regulator/machine.h> 45 45 46 46 #include <linux/i2c.h> 47 - #include <linux/i2c/twl.h> 47 + #include <linux/mfd/twl.h> 48 48 49 49 /* Register descriptions for audio */ 50 50 #include <linux/mfd/twl4030-audio.h> ··· 173 173 static struct twl_mapping twl4030_map[] = { 174 174 /* 175 175 * NOTE: don't change this table without updating the 176 - * <linux/i2c/twl.h> defines for TWL4030_MODULE_* 176 + * <linux/mfd/twl.h> defines for TWL4030_MODULE_* 177 177 * so they continue to match the order in this table. 178 178 */ 179 179 ··· 344 344 static struct twl_mapping twl6030_map[] = { 345 345 /* 346 346 * NOTE: don't change this table without updating the 347 - * <linux/i2c/twl.h> defines for TWL4030_MODULE_* 347 + * <linux/mfd/twl.h> defines for TWL4030_MODULE_* 348 348 * so they continue to match the order in this table. 349 349 */ 350 350 ··· 448 448 * @reg: register address (just offset will do) 449 449 * @num_bytes: number of bytes to transfer 450 450 * 451 - * Returns the result of operation - 0 is success 451 + * Returns 0 on success or else a negative error code. 452 452 */ 453 453 int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes) 454 454 { ··· 476 476 * @reg: register address (just offset will do) 477 477 * @num_bytes: number of bytes to transfer 478 478 * 479 - * Returns result of operation - num_bytes is success else failure. 479 + * Returns 0 on success or else a negative error code. 480 480 */ 481 481 int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes) 482 482 {
+1 -1
drivers/mfd/twl4030-audio.c
··· 30 30 #include <linux/platform_device.h> 31 31 #include <linux/of.h> 32 32 #include <linux/of_platform.h> 33 - #include <linux/i2c/twl.h> 33 + #include <linux/mfd/twl.h> 34 34 #include <linux/mfd/core.h> 35 35 #include <linux/mfd/twl4030-audio.h> 36 36
+1 -1
drivers/mfd/twl4030-irq.c
··· 33 33 #include <linux/slab.h> 34 34 #include <linux/of.h> 35 35 #include <linux/irqdomain.h> 36 - #include <linux/i2c/twl.h> 36 + #include <linux/mfd/twl.h> 37 37 38 38 #include "twl-core.h" 39 39
+1 -1
drivers/mfd/twl4030-power.c
··· 25 25 26 26 #include <linux/module.h> 27 27 #include <linux/pm.h> 28 - #include <linux/i2c/twl.h> 28 + #include <linux/mfd/twl.h> 29 29 #include <linux/platform_device.h> 30 30 #include <linux/of.h> 31 31 #include <linux/of_device.h>
+1 -1
drivers/mfd/twl6030-irq.c
··· 35 35 #include <linux/interrupt.h> 36 36 #include <linux/irq.h> 37 37 #include <linux/kthread.h> 38 - #include <linux/i2c/twl.h> 38 + #include <linux/mfd/twl.h> 39 39 #include <linux/platform_device.h> 40 40 #include <linux/suspend.h> 41 41 #include <linux/of.h>
+7 -3
drivers/mtd/nand/atmel/nand-controller.c
··· 247 247 void __iomem *virt; 248 248 dma_addr_t dma; 249 249 } sram; 250 + const struct atmel_hsmc_reg_layout *hsmc_layout; 250 251 struct regmap *io; 251 252 struct atmel_nfc_op op; 252 253 struct completion complete; ··· 1443 1442 int csline, 1444 1443 const struct nand_data_interface *conf) 1445 1444 { 1446 - struct atmel_nand_controller *nc; 1445 + struct atmel_hsmc_nand_controller *nc; 1447 1446 struct atmel_smc_cs_conf smcconf; 1448 1447 struct atmel_nand_cs *cs; 1449 1448 int ret; 1450 1449 1451 - nc = to_nand_controller(nand->base.controller); 1450 + nc = to_hsmc_nand_controller(nand->base.controller); 1452 1451 1453 1452 ret = atmel_smc_nand_prepare_smcconf(nand, conf, &smcconf); 1454 1453 if (ret) ··· 1463 1462 if (cs->rb.type == ATMEL_NAND_NATIVE_RB) 1464 1463 cs->smcconf.timings |= ATMEL_HSMC_TIMINGS_RBNSEL(cs->rb.id); 1465 1464 1466 - atmel_hsmc_cs_conf_apply(nc->smc, cs->id, &cs->smcconf); 1465 + atmel_hsmc_cs_conf_apply(nc->base.smc, nc->hsmc_layout, cs->id, 1466 + &cs->smcconf); 1467 1467 1468 1468 return 0; 1469 1469 } ··· 2178 2176 dev_err(dev, "Missing or invalid atmel,smc property\n"); 2179 2177 return -EINVAL; 2180 2178 } 2179 + 2180 + nc->hsmc_layout = atmel_hsmc_get_reg_layout(np); 2181 2181 2182 2182 nc->irq = of_irq_get(np, 0); 2183 2183 of_node_put(np);
+1 -1
drivers/phy/ti/phy-twl4030-usb.c
··· 36 36 #include <linux/pm_runtime.h> 37 37 #include <linux/usb/musb.h> 38 38 #include <linux/usb/ulpi.h> 39 - #include <linux/i2c/twl.h> 39 + #include <linux/mfd/twl.h> 40 40 #include <linux/regulator/consumer.h> 41 41 #include <linux/err.h> 42 42 #include <linux/slab.h>
+9
drivers/pinctrl/Kconfig
··· 338 338 select GENERIC_PINMUX_FUNCTIONS 339 339 select REGMAP_MMIO 340 340 341 + config PINCTRL_RK805 342 + tristate "Pinctrl and GPIO driver for RK805 PMIC" 343 + depends on MFD_RK808 344 + select GPIOLIB 345 + select PINMUX 346 + select GENERIC_PINCONF 347 + help 348 + This selects the pinctrl driver for RK805. 349 + 341 350 source "drivers/pinctrl/aspeed/Kconfig" 342 351 source "drivers/pinctrl/bcm/Kconfig" 343 352 source "drivers/pinctrl/berlin/Kconfig"
+1
drivers/pinctrl/Makefile
··· 43 43 obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o 44 44 obj-$(CONFIG_PINCTRL_ZYNQ) += pinctrl-zynq.o 45 45 obj-$(CONFIG_PINCTRL_INGENIC) += pinctrl-ingenic.o 46 + obj-$(CONFIG_PINCTRL_RK805) += pinctrl-rk805.o 46 47 47 48 obj-$(CONFIG_ARCH_ASPEED) += aspeed/ 48 49 obj-y += bcm/
+493
drivers/pinctrl/pinctrl-rk805.c
··· 1 + /* 2 + * Pinctrl driver for Rockchip RK805 PMIC 3 + * 4 + * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd 5 + * 6 + * Author: Joseph Chen <chenjh@rock-chips.com> 7 + * 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of the GNU General Public License as published by the 10 + * Free Software Foundation; either version 2 of the License, or (at your 11 + * option) any later version. 12 + * 13 + * Based on the pinctrl-as3722 driver 14 + */ 15 + 16 + #include <linux/gpio/driver.h> 17 + #include <linux/kernel.h> 18 + #include <linux/module.h> 19 + #include <linux/mfd/rk808.h> 20 + #include <linux/of.h> 21 + #include <linux/of_device.h> 22 + #include <linux/platform_device.h> 23 + #include <linux/pinctrl/consumer.h> 24 + #include <linux/pinctrl/machine.h> 25 + #include <linux/pinctrl/pinctrl.h> 26 + #include <linux/pinctrl/pinconf-generic.h> 27 + #include <linux/pinctrl/pinconf.h> 28 + #include <linux/pinctrl/pinmux.h> 29 + #include <linux/pm.h> 30 + #include <linux/slab.h> 31 + 32 + #include "core.h" 33 + #include "pinconf.h" 34 + #include "pinctrl-utils.h" 35 + 36 + struct rk805_pin_function { 37 + const char *name; 38 + const char *const *groups; 39 + unsigned int ngroups; 40 + int mux_option; 41 + }; 42 + 43 + struct rk805_pin_group { 44 + const char *name; 45 + const unsigned int pins[1]; 46 + unsigned int npins; 47 + }; 48 + 49 + /* 50 + * @reg: gpio setting register; 51 + * @fun_mask: functions select mask value, when set is gpio; 52 + * @dir_mask: input or output mask value, when set is output, otherwise input; 53 + * @val_mask: gpio set value, when set is level high, otherwise low; 54 + * 55 + * Different PMIC has different pin features, belowing 3 mask members are not 56 + * all necessary for every PMIC. For example, RK805 has 2 pins that can be used 57 + * as output only GPIOs, so func_mask and dir_mask are not needed. RK816 has 1 58 + * pin that can be used as TS/GPIO, so fun_mask, dir_mask and val_mask are all 59 + * necessary. 60 + */ 61 + struct rk805_pin_config { 62 + u8 reg; 63 + u8 fun_msk; 64 + u8 dir_msk; 65 + u8 val_msk; 66 + }; 67 + 68 + struct rk805_pctrl_info { 69 + struct rk808 *rk808; 70 + struct device *dev; 71 + struct pinctrl_dev *pctl; 72 + struct gpio_chip gpio_chip; 73 + struct pinctrl_desc pinctrl_desc; 74 + const struct rk805_pin_function *functions; 75 + unsigned int num_functions; 76 + const struct rk805_pin_group *groups; 77 + int num_pin_groups; 78 + const struct pinctrl_pin_desc *pins; 79 + unsigned int num_pins; 80 + struct rk805_pin_config *pin_cfg; 81 + }; 82 + 83 + enum rk805_pinmux_option { 84 + RK805_PINMUX_GPIO, 85 + }; 86 + 87 + enum { 88 + RK805_GPIO0, 89 + RK805_GPIO1, 90 + }; 91 + 92 + static const char *const rk805_gpio_groups[] = { 93 + "gpio0", 94 + "gpio1", 95 + }; 96 + 97 + /* RK805: 2 output only GPIOs */ 98 + static const struct pinctrl_pin_desc rk805_pins_desc[] = { 99 + PINCTRL_PIN(RK805_GPIO0, "gpio0"), 100 + PINCTRL_PIN(RK805_GPIO1, "gpio1"), 101 + }; 102 + 103 + static const struct rk805_pin_function rk805_pin_functions[] = { 104 + { 105 + .name = "gpio", 106 + .groups = rk805_gpio_groups, 107 + .ngroups = ARRAY_SIZE(rk805_gpio_groups), 108 + .mux_option = RK805_PINMUX_GPIO, 109 + }, 110 + }; 111 + 112 + static const struct rk805_pin_group rk805_pin_groups[] = { 113 + { 114 + .name = "gpio0", 115 + .pins = { RK805_GPIO0 }, 116 + .npins = 1, 117 + }, 118 + { 119 + .name = "gpio1", 120 + .pins = { RK805_GPIO1 }, 121 + .npins = 1, 122 + }, 123 + }; 124 + 125 + #define RK805_GPIO0_VAL_MSK BIT(0) 126 + #define RK805_GPIO1_VAL_MSK BIT(1) 127 + 128 + static struct rk805_pin_config rk805_gpio_cfgs[] = { 129 + { 130 + .reg = RK805_OUT_REG, 131 + .val_msk = RK805_GPIO0_VAL_MSK, 132 + }, 133 + { 134 + .reg = RK805_OUT_REG, 135 + .val_msk = RK805_GPIO1_VAL_MSK, 136 + }, 137 + }; 138 + 139 + /* generic gpio chip */ 140 + static int rk805_gpio_get(struct gpio_chip *chip, unsigned int offset) 141 + { 142 + struct rk805_pctrl_info *pci = gpiochip_get_data(chip); 143 + int ret, val; 144 + 145 + ret = regmap_read(pci->rk808->regmap, pci->pin_cfg[offset].reg, &val); 146 + if (ret) { 147 + dev_err(pci->dev, "get gpio%d value failed\n", offset); 148 + return ret; 149 + } 150 + 151 + return !!(val & pci->pin_cfg[offset].val_msk); 152 + } 153 + 154 + static void rk805_gpio_set(struct gpio_chip *chip, 155 + unsigned int offset, 156 + int value) 157 + { 158 + struct rk805_pctrl_info *pci = gpiochip_get_data(chip); 159 + int ret; 160 + 161 + ret = regmap_update_bits(pci->rk808->regmap, 162 + pci->pin_cfg[offset].reg, 163 + pci->pin_cfg[offset].val_msk, 164 + value ? pci->pin_cfg[offset].val_msk : 0); 165 + if (ret) 166 + dev_err(pci->dev, "set gpio%d value %d failed\n", 167 + offset, value); 168 + } 169 + 170 + static int rk805_gpio_direction_input(struct gpio_chip *chip, 171 + unsigned int offset) 172 + { 173 + return pinctrl_gpio_direction_input(chip->base + offset); 174 + } 175 + 176 + static int rk805_gpio_direction_output(struct gpio_chip *chip, 177 + unsigned int offset, int value) 178 + { 179 + rk805_gpio_set(chip, offset, value); 180 + return pinctrl_gpio_direction_output(chip->base + offset); 181 + } 182 + 183 + static int rk805_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) 184 + { 185 + struct rk805_pctrl_info *pci = gpiochip_get_data(chip); 186 + unsigned int val; 187 + int ret; 188 + 189 + /* default output*/ 190 + if (!pci->pin_cfg[offset].dir_msk) 191 + return 0; 192 + 193 + ret = regmap_read(pci->rk808->regmap, 194 + pci->pin_cfg[offset].reg, 195 + &val); 196 + if (ret) { 197 + dev_err(pci->dev, "get gpio%d direction failed\n", offset); 198 + return ret; 199 + } 200 + 201 + return !(val & pci->pin_cfg[offset].dir_msk); 202 + } 203 + 204 + static struct gpio_chip rk805_gpio_chip = { 205 + .label = "rk805-gpio", 206 + .request = gpiochip_generic_request, 207 + .free = gpiochip_generic_free, 208 + .get_direction = rk805_gpio_get_direction, 209 + .get = rk805_gpio_get, 210 + .set = rk805_gpio_set, 211 + .direction_input = rk805_gpio_direction_input, 212 + .direction_output = rk805_gpio_direction_output, 213 + .can_sleep = true, 214 + .base = -1, 215 + .owner = THIS_MODULE, 216 + }; 217 + 218 + /* generic pinctrl */ 219 + static int rk805_pinctrl_get_groups_count(struct pinctrl_dev *pctldev) 220 + { 221 + struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); 222 + 223 + return pci->num_pin_groups; 224 + } 225 + 226 + static const char *rk805_pinctrl_get_group_name(struct pinctrl_dev *pctldev, 227 + unsigned int group) 228 + { 229 + struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); 230 + 231 + return pci->groups[group].name; 232 + } 233 + 234 + static int rk805_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, 235 + unsigned int group, 236 + const unsigned int **pins, 237 + unsigned int *num_pins) 238 + { 239 + struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); 240 + 241 + *pins = pci->groups[group].pins; 242 + *num_pins = pci->groups[group].npins; 243 + 244 + return 0; 245 + } 246 + 247 + static const struct pinctrl_ops rk805_pinctrl_ops = { 248 + .get_groups_count = rk805_pinctrl_get_groups_count, 249 + .get_group_name = rk805_pinctrl_get_group_name, 250 + .get_group_pins = rk805_pinctrl_get_group_pins, 251 + .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, 252 + .dt_free_map = pinctrl_utils_free_map, 253 + }; 254 + 255 + static int rk805_pinctrl_get_funcs_count(struct pinctrl_dev *pctldev) 256 + { 257 + struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); 258 + 259 + return pci->num_functions; 260 + } 261 + 262 + static const char *rk805_pinctrl_get_func_name(struct pinctrl_dev *pctldev, 263 + unsigned int function) 264 + { 265 + struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); 266 + 267 + return pci->functions[function].name; 268 + } 269 + 270 + static int rk805_pinctrl_get_func_groups(struct pinctrl_dev *pctldev, 271 + unsigned int function, 272 + const char *const **groups, 273 + unsigned int *const num_groups) 274 + { 275 + struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); 276 + 277 + *groups = pci->functions[function].groups; 278 + *num_groups = pci->functions[function].ngroups; 279 + 280 + return 0; 281 + } 282 + 283 + static int _rk805_pinctrl_set_mux(struct pinctrl_dev *pctldev, 284 + unsigned int offset, 285 + int mux) 286 + { 287 + struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); 288 + int ret; 289 + 290 + if (!pci->pin_cfg[offset].fun_msk) 291 + return 0; 292 + 293 + if (mux == RK805_PINMUX_GPIO) { 294 + ret = regmap_update_bits(pci->rk808->regmap, 295 + pci->pin_cfg[offset].reg, 296 + pci->pin_cfg[offset].fun_msk, 297 + pci->pin_cfg[offset].fun_msk); 298 + if (ret) { 299 + dev_err(pci->dev, "set gpio%d GPIO failed\n", offset); 300 + return ret; 301 + } 302 + } else { 303 + dev_err(pci->dev, "Couldn't find function mux %d\n", mux); 304 + return -EINVAL; 305 + } 306 + 307 + return 0; 308 + } 309 + 310 + static int rk805_pinctrl_set_mux(struct pinctrl_dev *pctldev, 311 + unsigned int function, 312 + unsigned int group) 313 + { 314 + struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); 315 + int mux = pci->functions[function].mux_option; 316 + int offset = group; 317 + 318 + return _rk805_pinctrl_set_mux(pctldev, offset, mux); 319 + } 320 + 321 + static int rk805_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, 322 + struct pinctrl_gpio_range *range, 323 + unsigned int offset, bool input) 324 + { 325 + struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); 326 + int ret; 327 + 328 + /* switch to gpio function */ 329 + ret = _rk805_pinctrl_set_mux(pctldev, offset, RK805_PINMUX_GPIO); 330 + if (ret) { 331 + dev_err(pci->dev, "set gpio%d mux failed\n", offset); 332 + return ret; 333 + } 334 + 335 + /* set direction */ 336 + if (!pci->pin_cfg[offset].dir_msk) 337 + return 0; 338 + 339 + ret = regmap_update_bits(pci->rk808->regmap, 340 + pci->pin_cfg[offset].reg, 341 + pci->pin_cfg[offset].dir_msk, 342 + input ? 0 : pci->pin_cfg[offset].dir_msk); 343 + if (ret) { 344 + dev_err(pci->dev, "set gpio%d direction failed\n", offset); 345 + return ret; 346 + } 347 + 348 + return ret; 349 + } 350 + 351 + static const struct pinmux_ops rk805_pinmux_ops = { 352 + .get_functions_count = rk805_pinctrl_get_funcs_count, 353 + .get_function_name = rk805_pinctrl_get_func_name, 354 + .get_function_groups = rk805_pinctrl_get_func_groups, 355 + .set_mux = rk805_pinctrl_set_mux, 356 + .gpio_set_direction = rk805_pmx_gpio_set_direction, 357 + }; 358 + 359 + static int rk805_pinconf_get(struct pinctrl_dev *pctldev, 360 + unsigned int pin, unsigned long *config) 361 + { 362 + struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); 363 + enum pin_config_param param = pinconf_to_config_param(*config); 364 + u32 arg = 0; 365 + 366 + switch (param) { 367 + case PIN_CONFIG_OUTPUT: 368 + arg = rk805_gpio_get(&pci->gpio_chip, pin); 369 + break; 370 + default: 371 + dev_err(pci->dev, "Properties not supported\n"); 372 + return -ENOTSUPP; 373 + } 374 + 375 + *config = pinconf_to_config_packed(param, (u16)arg); 376 + 377 + return 0; 378 + } 379 + 380 + static int rk805_pinconf_set(struct pinctrl_dev *pctldev, 381 + unsigned int pin, unsigned long *configs, 382 + unsigned int num_configs) 383 + { 384 + struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); 385 + enum pin_config_param param; 386 + u32 i, arg = 0; 387 + 388 + for (i = 0; i < num_configs; i++) { 389 + param = pinconf_to_config_param(configs[i]); 390 + arg = pinconf_to_config_argument(configs[i]); 391 + 392 + switch (param) { 393 + case PIN_CONFIG_OUTPUT: 394 + rk805_gpio_set(&pci->gpio_chip, pin, arg); 395 + rk805_pmx_gpio_set_direction(pctldev, NULL, pin, false); 396 + break; 397 + default: 398 + dev_err(pci->dev, "Properties not supported\n"); 399 + return -ENOTSUPP; 400 + } 401 + } 402 + 403 + return 0; 404 + } 405 + 406 + static const struct pinconf_ops rk805_pinconf_ops = { 407 + .pin_config_get = rk805_pinconf_get, 408 + .pin_config_set = rk805_pinconf_set, 409 + }; 410 + 411 + static struct pinctrl_desc rk805_pinctrl_desc = { 412 + .name = "rk805-pinctrl", 413 + .pctlops = &rk805_pinctrl_ops, 414 + .pmxops = &rk805_pinmux_ops, 415 + .confops = &rk805_pinconf_ops, 416 + .owner = THIS_MODULE, 417 + }; 418 + 419 + static int rk805_pinctrl_probe(struct platform_device *pdev) 420 + { 421 + struct rk805_pctrl_info *pci; 422 + int ret; 423 + 424 + pci = devm_kzalloc(&pdev->dev, sizeof(*pci), GFP_KERNEL); 425 + if (!pci) 426 + return -ENOMEM; 427 + 428 + pci->dev = &pdev->dev; 429 + pci->dev->of_node = pdev->dev.parent->of_node; 430 + pci->rk808 = dev_get_drvdata(pdev->dev.parent); 431 + 432 + pci->pinctrl_desc = rk805_pinctrl_desc; 433 + pci->gpio_chip = rk805_gpio_chip; 434 + pci->gpio_chip.parent = &pdev->dev; 435 + pci->gpio_chip.of_node = pdev->dev.parent->of_node; 436 + 437 + platform_set_drvdata(pdev, pci); 438 + 439 + switch (pci->rk808->variant) { 440 + case RK805_ID: 441 + pci->pins = rk805_pins_desc; 442 + pci->num_pins = ARRAY_SIZE(rk805_pins_desc); 443 + pci->functions = rk805_pin_functions; 444 + pci->num_functions = ARRAY_SIZE(rk805_pin_functions); 445 + pci->groups = rk805_pin_groups; 446 + pci->num_pin_groups = ARRAY_SIZE(rk805_pin_groups); 447 + pci->pinctrl_desc.pins = rk805_pins_desc; 448 + pci->pinctrl_desc.npins = ARRAY_SIZE(rk805_pins_desc); 449 + pci->pin_cfg = rk805_gpio_cfgs; 450 + pci->gpio_chip.ngpio = ARRAY_SIZE(rk805_gpio_cfgs); 451 + break; 452 + default: 453 + dev_err(&pdev->dev, "unsupported RK805 ID %lu\n", 454 + pci->rk808->variant); 455 + return -EINVAL; 456 + } 457 + 458 + /* Add gpio chip */ 459 + ret = devm_gpiochip_add_data(&pdev->dev, &pci->gpio_chip, pci); 460 + if (ret < 0) { 461 + dev_err(&pdev->dev, "Couldn't add gpiochip\n"); 462 + return ret; 463 + } 464 + 465 + /* Add pinctrl */ 466 + pci->pctl = devm_pinctrl_register(&pdev->dev, &pci->pinctrl_desc, pci); 467 + if (IS_ERR(pci->pctl)) { 468 + dev_err(&pdev->dev, "Couldn't add pinctrl\n"); 469 + return PTR_ERR(pci->pctl); 470 + } 471 + 472 + /* Add pin range */ 473 + ret = gpiochip_add_pin_range(&pci->gpio_chip, dev_name(&pdev->dev), 474 + 0, 0, pci->gpio_chip.ngpio); 475 + if (ret < 0) { 476 + dev_err(&pdev->dev, "Couldn't add gpiochip pin range\n"); 477 + return ret; 478 + } 479 + 480 + return 0; 481 + } 482 + 483 + static struct platform_driver rk805_pinctrl_driver = { 484 + .probe = rk805_pinctrl_probe, 485 + .driver = { 486 + .name = "rk805-pinctrl", 487 + }, 488 + }; 489 + module_platform_driver(rk805_pinctrl_driver); 490 + 491 + MODULE_DESCRIPTION("RK805 pin control and GPIO driver"); 492 + MODULE_AUTHOR("Joseph Chen <chenjh@rock-chips.com>"); 493 + MODULE_LICENSE("GPL v2");
+1 -1
drivers/power/supply/twl4030_charger.c
··· 18 18 #include <linux/err.h> 19 19 #include <linux/platform_device.h> 20 20 #include <linux/interrupt.h> 21 - #include <linux/i2c/twl.h> 21 + #include <linux/mfd/twl.h> 22 22 #include <linux/power_supply.h> 23 23 #include <linux/notifier.h> 24 24 #include <linux/usb/otg.h>
+10
drivers/pwm/Kconfig
··· 417 417 To compile this driver as a module, choose M here: the module 418 418 will be called pwm-stm32. 419 419 420 + config PWM_STM32_LP 421 + tristate "STMicroelectronics STM32 PWM LP" 422 + depends on MFD_STM32_LPTIMER || COMPILE_TEST 423 + help 424 + Generic PWM framework driver for STMicroelectronics STM32 SoCs 425 + with Low-Power Timer (LPTIM). 426 + 427 + To compile this driver as a module, choose M here: the module 428 + will be called pwm-stm32-lp. 429 + 420 430 config PWM_STMPE 421 431 bool "STMPE expander PWM export" 422 432 depends on MFD_STMPE
+1
drivers/pwm/Makefile
··· 40 40 obj-$(CONFIG_PWM_SPEAR) += pwm-spear.o 41 41 obj-$(CONFIG_PWM_STI) += pwm-sti.o 42 42 obj-$(CONFIG_PWM_STM32) += pwm-stm32.o 43 + obj-$(CONFIG_PWM_STM32_LP) += pwm-stm32-lp.o 43 44 obj-$(CONFIG_PWM_STMPE) += pwm-stmpe.o 44 45 obj-$(CONFIG_PWM_SUN4I) += pwm-sun4i.o 45 46 obj-$(CONFIG_PWM_TEGRA) += pwm-tegra.o
+246
drivers/pwm/pwm-stm32-lp.c
··· 1 + /* 2 + * STM32 Low-Power Timer PWM driver 3 + * 4 + * Copyright (C) STMicroelectronics 2017 5 + * 6 + * Author: Gerald Baeza <gerald.baeza@st.com> 7 + * 8 + * License terms: GNU General Public License (GPL), version 2 9 + * 10 + * Inspired by Gerald Baeza's pwm-stm32 driver 11 + */ 12 + 13 + #include <linux/bitfield.h> 14 + #include <linux/mfd/stm32-lptimer.h> 15 + #include <linux/module.h> 16 + #include <linux/of.h> 17 + #include <linux/platform_device.h> 18 + #include <linux/pwm.h> 19 + 20 + struct stm32_pwm_lp { 21 + struct pwm_chip chip; 22 + struct clk *clk; 23 + struct regmap *regmap; 24 + }; 25 + 26 + static inline struct stm32_pwm_lp *to_stm32_pwm_lp(struct pwm_chip *chip) 27 + { 28 + return container_of(chip, struct stm32_pwm_lp, chip); 29 + } 30 + 31 + /* STM32 Low-Power Timer is preceded by a configurable power-of-2 prescaler */ 32 + #define STM32_LPTIM_MAX_PRESCALER 128 33 + 34 + static int stm32_pwm_lp_apply(struct pwm_chip *chip, struct pwm_device *pwm, 35 + struct pwm_state *state) 36 + { 37 + struct stm32_pwm_lp *priv = to_stm32_pwm_lp(chip); 38 + unsigned long long prd, div, dty; 39 + struct pwm_state cstate; 40 + u32 val, mask, cfgr, presc = 0; 41 + bool reenable; 42 + int ret; 43 + 44 + pwm_get_state(pwm, &cstate); 45 + reenable = !cstate.enabled; 46 + 47 + if (!state->enabled) { 48 + if (cstate.enabled) { 49 + /* Disable LP timer */ 50 + ret = regmap_write(priv->regmap, STM32_LPTIM_CR, 0); 51 + if (ret) 52 + return ret; 53 + /* disable clock to PWM counter */ 54 + clk_disable(priv->clk); 55 + } 56 + return 0; 57 + } 58 + 59 + /* Calculate the period and prescaler value */ 60 + div = (unsigned long long)clk_get_rate(priv->clk) * state->period; 61 + do_div(div, NSEC_PER_SEC); 62 + prd = div; 63 + while (div > STM32_LPTIM_MAX_ARR) { 64 + presc++; 65 + if ((1 << presc) > STM32_LPTIM_MAX_PRESCALER) { 66 + dev_err(priv->chip.dev, "max prescaler exceeded\n"); 67 + return -EINVAL; 68 + } 69 + div = prd >> presc; 70 + } 71 + prd = div; 72 + 73 + /* Calculate the duty cycle */ 74 + dty = prd * state->duty_cycle; 75 + do_div(dty, state->period); 76 + 77 + if (!cstate.enabled) { 78 + /* enable clock to drive PWM counter */ 79 + ret = clk_enable(priv->clk); 80 + if (ret) 81 + return ret; 82 + } 83 + 84 + ret = regmap_read(priv->regmap, STM32_LPTIM_CFGR, &cfgr); 85 + if (ret) 86 + goto err; 87 + 88 + if ((FIELD_GET(STM32_LPTIM_PRESC, cfgr) != presc) || 89 + (FIELD_GET(STM32_LPTIM_WAVPOL, cfgr) != state->polarity)) { 90 + val = FIELD_PREP(STM32_LPTIM_PRESC, presc); 91 + val |= FIELD_PREP(STM32_LPTIM_WAVPOL, state->polarity); 92 + mask = STM32_LPTIM_PRESC | STM32_LPTIM_WAVPOL; 93 + 94 + /* Must disable LP timer to modify CFGR */ 95 + reenable = true; 96 + ret = regmap_write(priv->regmap, STM32_LPTIM_CR, 0); 97 + if (ret) 98 + goto err; 99 + 100 + ret = regmap_update_bits(priv->regmap, STM32_LPTIM_CFGR, mask, 101 + val); 102 + if (ret) 103 + goto err; 104 + } 105 + 106 + if (reenable) { 107 + /* Must (re)enable LP timer to modify CMP & ARR */ 108 + ret = regmap_write(priv->regmap, STM32_LPTIM_CR, 109 + STM32_LPTIM_ENABLE); 110 + if (ret) 111 + goto err; 112 + } 113 + 114 + ret = regmap_write(priv->regmap, STM32_LPTIM_ARR, prd - 1); 115 + if (ret) 116 + goto err; 117 + 118 + ret = regmap_write(priv->regmap, STM32_LPTIM_CMP, prd - (1 + dty)); 119 + if (ret) 120 + goto err; 121 + 122 + /* ensure CMP & ARR registers are properly written */ 123 + ret = regmap_read_poll_timeout(priv->regmap, STM32_LPTIM_ISR, val, 124 + (val & STM32_LPTIM_CMPOK_ARROK), 125 + 100, 1000); 126 + if (ret) { 127 + dev_err(priv->chip.dev, "ARR/CMP registers write issue\n"); 128 + goto err; 129 + } 130 + ret = regmap_write(priv->regmap, STM32_LPTIM_ICR, 131 + STM32_LPTIM_CMPOKCF_ARROKCF); 132 + if (ret) 133 + goto err; 134 + 135 + if (reenable) { 136 + /* Start LP timer in continuous mode */ 137 + ret = regmap_update_bits(priv->regmap, STM32_LPTIM_CR, 138 + STM32_LPTIM_CNTSTRT, 139 + STM32_LPTIM_CNTSTRT); 140 + if (ret) { 141 + regmap_write(priv->regmap, STM32_LPTIM_CR, 0); 142 + goto err; 143 + } 144 + } 145 + 146 + return 0; 147 + err: 148 + if (!cstate.enabled) 149 + clk_disable(priv->clk); 150 + 151 + return ret; 152 + } 153 + 154 + static void stm32_pwm_lp_get_state(struct pwm_chip *chip, 155 + struct pwm_device *pwm, 156 + struct pwm_state *state) 157 + { 158 + struct stm32_pwm_lp *priv = to_stm32_pwm_lp(chip); 159 + unsigned long rate = clk_get_rate(priv->clk); 160 + u32 val, presc, prd; 161 + u64 tmp; 162 + 163 + regmap_read(priv->regmap, STM32_LPTIM_CR, &val); 164 + state->enabled = !!FIELD_GET(STM32_LPTIM_ENABLE, val); 165 + /* Keep PWM counter clock refcount in sync with PWM initial state */ 166 + if (state->enabled) 167 + clk_enable(priv->clk); 168 + 169 + regmap_read(priv->regmap, STM32_LPTIM_CFGR, &val); 170 + presc = FIELD_GET(STM32_LPTIM_PRESC, val); 171 + state->polarity = FIELD_GET(STM32_LPTIM_WAVPOL, val); 172 + 173 + regmap_read(priv->regmap, STM32_LPTIM_ARR, &prd); 174 + tmp = prd + 1; 175 + tmp = (tmp << presc) * NSEC_PER_SEC; 176 + state->period = DIV_ROUND_CLOSEST_ULL(tmp, rate); 177 + 178 + regmap_read(priv->regmap, STM32_LPTIM_CMP, &val); 179 + tmp = prd - val; 180 + tmp = (tmp << presc) * NSEC_PER_SEC; 181 + state->duty_cycle = DIV_ROUND_CLOSEST_ULL(tmp, rate); 182 + } 183 + 184 + static const struct pwm_ops stm32_pwm_lp_ops = { 185 + .owner = THIS_MODULE, 186 + .apply = stm32_pwm_lp_apply, 187 + .get_state = stm32_pwm_lp_get_state, 188 + }; 189 + 190 + static int stm32_pwm_lp_probe(struct platform_device *pdev) 191 + { 192 + struct stm32_lptimer *ddata = dev_get_drvdata(pdev->dev.parent); 193 + struct stm32_pwm_lp *priv; 194 + int ret; 195 + 196 + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 197 + if (!priv) 198 + return -ENOMEM; 199 + 200 + priv->regmap = ddata->regmap; 201 + priv->clk = ddata->clk; 202 + priv->chip.base = -1; 203 + priv->chip.dev = &pdev->dev; 204 + priv->chip.ops = &stm32_pwm_lp_ops; 205 + priv->chip.npwm = 1; 206 + 207 + ret = pwmchip_add(&priv->chip); 208 + if (ret < 0) 209 + return ret; 210 + 211 + platform_set_drvdata(pdev, priv); 212 + 213 + return 0; 214 + } 215 + 216 + static int stm32_pwm_lp_remove(struct platform_device *pdev) 217 + { 218 + struct stm32_pwm_lp *priv = platform_get_drvdata(pdev); 219 + unsigned int i; 220 + 221 + for (i = 0; i < priv->chip.npwm; i++) 222 + if (pwm_is_enabled(&priv->chip.pwms[i])) 223 + pwm_disable(&priv->chip.pwms[i]); 224 + 225 + return pwmchip_remove(&priv->chip); 226 + } 227 + 228 + static const struct of_device_id stm32_pwm_lp_of_match[] = { 229 + { .compatible = "st,stm32-pwm-lp", }, 230 + {}, 231 + }; 232 + MODULE_DEVICE_TABLE(of, stm32_pwm_lp_of_match); 233 + 234 + static struct platform_driver stm32_pwm_lp_driver = { 235 + .probe = stm32_pwm_lp_probe, 236 + .remove = stm32_pwm_lp_remove, 237 + .driver = { 238 + .name = "stm32-pwm-lp", 239 + .of_match_table = of_match_ptr(stm32_pwm_lp_of_match), 240 + }, 241 + }; 242 + module_platform_driver(stm32_pwm_lp_driver); 243 + 244 + MODULE_ALIAS("platform:stm32-pwm-lp"); 245 + MODULE_DESCRIPTION("STMicroelectronics STM32 PWM LP driver"); 246 + MODULE_LICENSE("GPL v2");
+1 -1
drivers/pwm/pwm-twl-led.c
··· 24 24 #include <linux/of.h> 25 25 #include <linux/platform_device.h> 26 26 #include <linux/pwm.h> 27 - #include <linux/i2c/twl.h> 27 + #include <linux/mfd/twl.h> 28 28 #include <linux/slab.h> 29 29 30 30 /*
+1 -1
drivers/pwm/pwm-twl.c
··· 21 21 #include <linux/of.h> 22 22 #include <linux/platform_device.h> 23 23 #include <linux/pwm.h> 24 - #include <linux/i2c/twl.h> 24 + #include <linux/mfd/twl.h> 25 25 #include <linux/slab.h> 26 26 27 27 /*
+2 -2
drivers/regulator/Kconfig
··· 696 696 outputs which can be controlled by i2c communication. 697 697 698 698 config REGULATOR_RK808 699 - tristate "Rockchip RK808/RK818 Power regulators" 699 + tristate "Rockchip RK805/RK808/RK818 Power regulators" 700 700 depends on MFD_RK808 701 701 help 702 702 Select this option to enable the power regulator of ROCKCHIP 703 - PMIC RK808 and RK818. 703 + PMIC RK805,RK808 and RK818. 704 704 This driver supports the control of different power rails of device 705 705 through regulator interface. The device supports multiple DCDC/LDO 706 706 outputs which can be controlled by i2c communication.
+130
drivers/regulator/rk808-regulator.c
··· 65 65 /* max steps for increase voltage of Buck1/2, equal 100mv*/ 66 66 #define MAX_STEPS_ONE_TIME 8 67 67 68 + #define RK805_DESC(_id, _match, _supply, _min, _max, _step, _vreg, \ 69 + _vmask, _ereg, _emask, _etime) \ 70 + [_id] = { \ 71 + .name = (_match), \ 72 + .supply_name = (_supply), \ 73 + .of_match = of_match_ptr(_match), \ 74 + .regulators_node = of_match_ptr("regulators"), \ 75 + .type = REGULATOR_VOLTAGE, \ 76 + .id = (_id), \ 77 + .n_voltages = (((_max) - (_min)) / (_step) + 1), \ 78 + .owner = THIS_MODULE, \ 79 + .min_uV = (_min) * 1000, \ 80 + .uV_step = (_step) * 1000, \ 81 + .vsel_reg = (_vreg), \ 82 + .vsel_mask = (_vmask), \ 83 + .enable_reg = (_ereg), \ 84 + .enable_mask = (_emask), \ 85 + .enable_time = (_etime), \ 86 + .ops = &rk805_reg_ops, \ 87 + } 88 + 68 89 #define RK8XX_DESC(_id, _match, _supply, _min, _max, _step, _vreg, \ 69 90 _vmask, _ereg, _emask, _etime) \ 70 91 [_id] = { \ ··· 319 298 sel); 320 299 } 321 300 301 + static int rk805_set_suspend_enable(struct regulator_dev *rdev) 302 + { 303 + unsigned int reg; 304 + 305 + reg = rdev->desc->enable_reg + RK808_SLP_SET_OFF_REG_OFFSET; 306 + 307 + return regmap_update_bits(rdev->regmap, reg, 308 + rdev->desc->enable_mask, 309 + rdev->desc->enable_mask); 310 + } 311 + 312 + static int rk805_set_suspend_disable(struct regulator_dev *rdev) 313 + { 314 + unsigned int reg; 315 + 316 + reg = rdev->desc->enable_reg + RK808_SLP_SET_OFF_REG_OFFSET; 317 + 318 + return regmap_update_bits(rdev->regmap, reg, 319 + rdev->desc->enable_mask, 320 + 0); 321 + } 322 + 322 323 static int rk808_set_suspend_enable(struct regulator_dev *rdev) 323 324 { 324 325 unsigned int reg; ··· 362 319 rdev->desc->enable_mask, 363 320 rdev->desc->enable_mask); 364 321 } 322 + 323 + static struct regulator_ops rk805_reg_ops = { 324 + .list_voltage = regulator_list_voltage_linear, 325 + .map_voltage = regulator_map_voltage_linear, 326 + .get_voltage_sel = regulator_get_voltage_sel_regmap, 327 + .set_voltage_sel = regulator_set_voltage_sel_regmap, 328 + .enable = regulator_enable_regmap, 329 + .disable = regulator_disable_regmap, 330 + .is_enabled = regulator_is_enabled_regmap, 331 + .set_suspend_voltage = rk808_set_suspend_voltage, 332 + .set_suspend_enable = rk805_set_suspend_enable, 333 + .set_suspend_disable = rk805_set_suspend_disable, 334 + }; 335 + 336 + static struct regulator_ops rk805_switch_ops = { 337 + .enable = regulator_enable_regmap, 338 + .disable = regulator_disable_regmap, 339 + .is_enabled = regulator_is_enabled_regmap, 340 + .set_suspend_enable = rk805_set_suspend_enable, 341 + .set_suspend_disable = rk805_set_suspend_disable, 342 + }; 365 343 366 344 static struct regulator_ops rk808_buck1_2_ops = { 367 345 .list_voltage = regulator_list_voltage_linear, ··· 431 367 .is_enabled = regulator_is_enabled_regmap, 432 368 .set_suspend_enable = rk808_set_suspend_enable, 433 369 .set_suspend_disable = rk808_set_suspend_disable, 370 + }; 371 + 372 + static const struct regulator_desc rk805_reg[] = { 373 + { 374 + .name = "DCDC_REG1", 375 + .supply_name = "vcc1", 376 + .of_match = of_match_ptr("DCDC_REG1"), 377 + .regulators_node = of_match_ptr("regulators"), 378 + .id = RK805_ID_DCDC1, 379 + .ops = &rk805_reg_ops, 380 + .type = REGULATOR_VOLTAGE, 381 + .min_uV = 712500, 382 + .uV_step = 12500, 383 + .n_voltages = 64, 384 + .vsel_reg = RK805_BUCK1_ON_VSEL_REG, 385 + .vsel_mask = RK818_BUCK_VSEL_MASK, 386 + .enable_reg = RK805_DCDC_EN_REG, 387 + .enable_mask = BIT(0), 388 + .owner = THIS_MODULE, 389 + }, { 390 + .name = "DCDC_REG2", 391 + .supply_name = "vcc2", 392 + .of_match = of_match_ptr("DCDC_REG2"), 393 + .regulators_node = of_match_ptr("regulators"), 394 + .id = RK805_ID_DCDC2, 395 + .ops = &rk805_reg_ops, 396 + .type = REGULATOR_VOLTAGE, 397 + .min_uV = 712500, 398 + .uV_step = 12500, 399 + .n_voltages = 64, 400 + .vsel_reg = RK805_BUCK2_ON_VSEL_REG, 401 + .vsel_mask = RK818_BUCK_VSEL_MASK, 402 + .enable_reg = RK805_DCDC_EN_REG, 403 + .enable_mask = BIT(1), 404 + .owner = THIS_MODULE, 405 + }, { 406 + .name = "DCDC_REG3", 407 + .supply_name = "vcc3", 408 + .of_match = of_match_ptr("DCDC_REG3"), 409 + .regulators_node = of_match_ptr("regulators"), 410 + .id = RK805_ID_DCDC3, 411 + .ops = &rk805_switch_ops, 412 + .type = REGULATOR_VOLTAGE, 413 + .n_voltages = 1, 414 + .enable_reg = RK805_DCDC_EN_REG, 415 + .enable_mask = BIT(2), 416 + .owner = THIS_MODULE, 417 + }, 418 + 419 + RK805_DESC(RK805_ID_DCDC4, "DCDC_REG4", "vcc4", 800, 3400, 100, 420 + RK805_BUCK4_ON_VSEL_REG, RK818_BUCK4_VSEL_MASK, 421 + RK805_DCDC_EN_REG, BIT(3), 0), 422 + 423 + RK805_DESC(RK805_ID_LDO1, "LDO_REG1", "vcc5", 800, 3400, 100, 424 + RK805_LDO1_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK805_LDO_EN_REG, 425 + BIT(0), 400), 426 + RK805_DESC(RK805_ID_LDO2, "LDO_REG2", "vcc5", 800, 3400, 100, 427 + RK805_LDO2_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK805_LDO_EN_REG, 428 + BIT(1), 400), 429 + RK805_DESC(RK805_ID_LDO3, "LDO_REG3", "vcc6", 800, 3400, 100, 430 + RK805_LDO3_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK805_LDO_EN_REG, 431 + BIT(2), 400), 434 432 }; 435 433 436 434 static const struct regulator_desc rk808_reg[] = { ··· 751 625 platform_set_drvdata(pdev, pdata); 752 626 753 627 switch (rk808->variant) { 628 + case RK805_ID: 629 + regulators = rk805_reg; 630 + nregulators = RK805_NUM_REGULATORS; 631 + break; 754 632 case RK808_ID: 755 633 regulators = rk808_reg; 756 634 nregulators = RK808_NUM_REGULATORS;
+1 -1
drivers/regulator/twl-regulator.c
··· 20 20 #include <linux/regulator/driver.h> 21 21 #include <linux/regulator/machine.h> 22 22 #include <linux/regulator/of_regulator.h> 23 - #include <linux/i2c/twl.h> 23 + #include <linux/mfd/twl.h> 24 24 #include <linux/delay.h> 25 25 26 26 /*
+1 -1
drivers/regulator/twl6030-regulator.c
··· 21 21 #include <linux/regulator/driver.h> 22 22 #include <linux/regulator/machine.h> 23 23 #include <linux/regulator/of_regulator.h> 24 - #include <linux/i2c/twl.h> 24 + #include <linux/mfd/twl.h> 25 25 #include <linux/delay.h> 26 26 27 27 struct twlreg_info {
+1 -1
drivers/rtc/rtc-dm355evm.c
··· 13 13 #include <linux/rtc.h> 14 14 #include <linux/platform_device.h> 15 15 16 - #include <linux/i2c/dm355evm_msp.h> 16 + #include <linux/mfd/dm355evm_msp.h> 17 17 #include <linux/module.h> 18 18 19 19
+1 -1
drivers/rtc/rtc-twl.c
··· 31 31 #include <linux/interrupt.h> 32 32 #include <linux/of.h> 33 33 34 - #include <linux/i2c/twl.h> 34 + #include <linux/mfd/twl.h> 35 35 36 36 enum twl_class { 37 37 TWL_4030 = 0,
+1 -1
drivers/usb/host/ohci-omap.c
··· 53 53 #define DRIVER_DESC "OHCI OMAP driver" 54 54 55 55 #ifdef CONFIG_TPS65010 56 - #include <linux/i2c/tps65010.h> 56 + #include <linux/mfd/tps65010.h> 57 57 #else 58 58 59 59 #define LOW 0
+1 -1
drivers/usb/phy/phy-isp1301-omap.c
··· 96 96 97 97 #if IS_REACHABLE(CONFIG_TPS65010) 98 98 99 - #include <linux/i2c/tps65010.h> 99 + #include <linux/mfd/tps65010.h> 100 100 101 101 #else 102 102
+1 -1
drivers/usb/phy/phy-twl6030-usb.c
··· 28 28 #include <linux/usb/musb.h> 29 29 #include <linux/usb/phy_companion.h> 30 30 #include <linux/phy/omap_usb.h> 31 - #include <linux/i2c/twl.h> 31 + #include <linux/mfd/twl.h> 32 32 #include <linux/regulator/consumer.h> 33 33 #include <linux/err.h> 34 34 #include <linux/slab.h>
+1 -1
drivers/video/backlight/pandora_bl.c
··· 16 16 #include <linux/delay.h> 17 17 #include <linux/fb.h> 18 18 #include <linux/backlight.h> 19 - #include <linux/i2c/twl.h> 19 + #include <linux/mfd/twl.h> 20 20 #include <linux/err.h> 21 21 22 22 #define TWL_PWM0_ON 0x00
+1 -1
drivers/video/fbdev/omap/lcd_h3.c
··· 21 21 22 22 #include <linux/module.h> 23 23 #include <linux/platform_device.h> 24 - #include <linux/i2c/tps65010.h> 24 + #include <linux/mfd/tps65010.h> 25 25 #include <linux/gpio.h> 26 26 27 27 #include "omapfb.h"
+1 -1
drivers/watchdog/twl4030_wdt.c
··· 24 24 #include <linux/kernel.h> 25 25 #include <linux/watchdog.h> 26 26 #include <linux/platform_device.h> 27 - #include <linux/i2c/twl.h> 27 + #include <linux/mfd/twl.h> 28 28 29 29 #define TWL4030_WATCHDOG_CFG_REG_OFFS 0x3 30 30
include/linux/i2c/dm355evm_msp.h include/linux/mfd/dm355evm_msp.h
+1 -1
include/linux/i2c/tps65010.h include/linux/mfd/tps65010.h
··· 1 - /* linux/i2c/tps65010.h 1 + /* linux/mfd/tps65010.h 2 2 * 3 3 * Functions to access TPS65010 power management device. 4 4 *
include/linux/i2c/twl.h include/linux/mfd/twl.h
+27
include/linux/iio/timer/stm32-lptim-trigger.h
··· 1 + /* 2 + * Copyright (C) STMicroelectronics 2017 3 + * 4 + * Author: Fabrice Gasnier <fabrice.gasnier@st.com> 5 + * 6 + * License terms: GNU General Public License (GPL), version 2 7 + */ 8 + 9 + #ifndef _STM32_LPTIM_TRIGGER_H_ 10 + #define _STM32_LPTIM_TRIGGER_H_ 11 + 12 + #include <linux/iio/iio.h> 13 + #include <linux/iio/trigger.h> 14 + 15 + #define LPTIM1_OUT "lptim1_out" 16 + #define LPTIM2_OUT "lptim2_out" 17 + #define LPTIM3_OUT "lptim3_out" 18 + 19 + #if IS_ENABLED(CONFIG_IIO_STM32_LPTIMER_TRIGGER) 20 + bool is_stm32_lptim_trigger(struct iio_trigger *trig); 21 + #else 22 + static inline bool is_stm32_lptim_trigger(struct iio_trigger *trig) 23 + { 24 + return false; 25 + } 26 + #endif 27 + #endif
+29
include/linux/mfd/axp20x.h
··· 23 23 AXP803_ID, 24 24 AXP806_ID, 25 25 AXP809_ID, 26 + AXP813_ID, 26 27 NR_AXP20X_VARIANTS, 27 28 }; 28 29 ··· 386 385 AXP803_LDO_IO0, 387 386 AXP803_LDO_IO1, 388 387 AXP803_REG_ID_MAX, 388 + }; 389 + 390 + enum { 391 + AXP813_DCDC1 = 0, 392 + AXP813_DCDC2, 393 + AXP813_DCDC3, 394 + AXP813_DCDC4, 395 + AXP813_DCDC5, 396 + AXP813_DCDC6, 397 + AXP813_DCDC7, 398 + AXP813_ALDO1, 399 + AXP813_ALDO2, 400 + AXP813_ALDO3, 401 + AXP813_DLDO1, 402 + AXP813_DLDO2, 403 + AXP813_DLDO3, 404 + AXP813_DLDO4, 405 + AXP813_ELDO1, 406 + AXP813_ELDO2, 407 + AXP813_ELDO3, 408 + AXP813_FLDO1, 409 + AXP813_FLDO2, 410 + AXP813_FLDO3, 411 + AXP813_RTC_LDO, 412 + AXP813_LDO_IO0, 413 + AXP813_LDO_IO1, 414 + AXP813_SW, 415 + AXP813_REG_ID_MAX, 389 416 }; 390 417 391 418 /* IRQs */
+115
include/linux/mfd/bd9571mwv.h
··· 1 + /* 2 + * ROHM BD9571MWV-M driver 3 + * 4 + * Copyright (C) 2017 Marek Vasut <marek.vasut+renesas@gmail.com> 5 + * 6 + * This program is free software; you can redistribute it and/or 7 + * modify it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + * 10 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 11 + * kind, whether expressed or implied; without even the implied warranty 12 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License version 2 for more details. 14 + * 15 + * Based on the TPS65086 driver 16 + */ 17 + 18 + #ifndef __LINUX_MFD_BD9571MWV_H 19 + #define __LINUX_MFD_BD9571MWV_H 20 + 21 + #include <linux/device.h> 22 + #include <linux/regmap.h> 23 + 24 + /* List of registers for BD9571MWV */ 25 + #define BD9571MWV_VENDOR_CODE 0x00 26 + #define BD9571MWV_VENDOR_CODE_VAL 0xdb 27 + #define BD9571MWV_PRODUCT_CODE 0x01 28 + #define BD9571MWV_PRODUCT_CODE_VAL 0x60 29 + #define BD9571MWV_PRODUCT_REVISION 0x02 30 + 31 + #define BD9571MWV_I2C_FUSA_MODE 0x10 32 + #define BD9571MWV_I2C_MD2_E1_BIT_1 0x11 33 + #define BD9571MWV_I2C_MD2_E1_BIT_2 0x12 34 + 35 + #define BD9571MWV_BKUP_MODE_CNT 0x20 36 + #define BD9571MWV_BKUP_MODE_STATUS 0x21 37 + #define BD9571MWV_BKUP_RECOVERY_CNT 0x22 38 + #define BD9571MWV_BKUP_CTRL_TIM_CNT 0x23 39 + #define BD9571MWV_WAITBKUP_WDT_CNT 0x24 40 + #define BD9571MWV_128H_TIM_CNT 0x26 41 + #define BD9571MWV_QLLM_CNT 0x27 42 + 43 + #define BD9571MWV_AVS_SET_MONI 0x31 44 + #define BD9571MWV_AVS_SET_MONI_MASK 0x3 45 + #define BD9571MWV_AVS_VD09_VID(n) (0x32 + (n)) 46 + #define BD9571MWV_AVS_DVFS_VID(n) (0x36 + (n)) 47 + 48 + #define BD9571MWV_VD18_VID 0x42 49 + #define BD9571MWV_VD25_VID 0x43 50 + #define BD9571MWV_VD33_VID 0x44 51 + 52 + #define BD9571MWV_DVFS_VINIT 0x50 53 + #define BD9571MWV_DVFS_SETVMAX 0x52 54 + #define BD9571MWV_DVFS_BOOSTVID 0x53 55 + #define BD9571MWV_DVFS_SETVID 0x54 56 + #define BD9571MWV_DVFS_MONIVDAC 0x55 57 + #define BD9571MWV_DVFS_PGD_CNT 0x56 58 + 59 + #define BD9571MWV_GPIO_DIR 0x60 60 + #define BD9571MWV_GPIO_OUT 0x61 61 + #define BD9571MWV_GPIO_IN 0x62 62 + #define BD9571MWV_GPIO_DEB 0x63 63 + #define BD9571MWV_GPIO_INT_SET 0x64 64 + #define BD9571MWV_GPIO_INT 0x65 65 + #define BD9571MWV_GPIO_INTMASK 0x66 66 + 67 + #define BD9571MWV_REG_KEEP(n) (0x70 + (n)) 68 + 69 + #define BD9571MWV_PMIC_INTERNAL_STATUS 0x80 70 + #define BD9571MWV_PROT_ERROR_STATUS0 0x81 71 + #define BD9571MWV_PROT_ERROR_STATUS1 0x82 72 + #define BD9571MWV_PROT_ERROR_STATUS2 0x83 73 + #define BD9571MWV_PROT_ERROR_STATUS3 0x84 74 + #define BD9571MWV_PROT_ERROR_STATUS4 0x85 75 + 76 + #define BD9571MWV_INT_INTREQ 0x90 77 + #define BD9571MWV_INT_INTREQ_MD1_INT BIT(0) 78 + #define BD9571MWV_INT_INTREQ_MD2_E1_INT BIT(1) 79 + #define BD9571MWV_INT_INTREQ_MD2_E2_INT BIT(2) 80 + #define BD9571MWV_INT_INTREQ_PROT_ERR_INT BIT(3) 81 + #define BD9571MWV_INT_INTREQ_GP_INT BIT(4) 82 + #define BD9571MWV_INT_INTREQ_128H_OF_INT BIT(5) 83 + #define BD9571MWV_INT_INTREQ_WDT_OF_INT BIT(6) 84 + #define BD9571MWV_INT_INTREQ_BKUP_TRG_INT BIT(7) 85 + #define BD9571MWV_INT_INTMASK 0x91 86 + 87 + #define BD9571MWV_ACCESS_KEY 0xff 88 + 89 + /* Define the BD9571MWV IRQ numbers */ 90 + enum bd9571mwv_irqs { 91 + BD9571MWV_IRQ_MD1, 92 + BD9571MWV_IRQ_MD2_E1, 93 + BD9571MWV_IRQ_MD2_E2, 94 + BD9571MWV_IRQ_PROT_ERR, 95 + BD9571MWV_IRQ_GP, 96 + BD9571MWV_IRQ_128H_OF, 97 + BD9571MWV_IRQ_WDT_OF, 98 + BD9571MWV_IRQ_BKUP_TRG, 99 + }; 100 + 101 + /** 102 + * struct bd9571mwv - state holder for the bd9571mwv driver 103 + * 104 + * Device data may be used to access the BD9571MWV chip 105 + */ 106 + struct bd9571mwv { 107 + struct device *dev; 108 + struct regmap *regmap; 109 + 110 + /* IRQ Data */ 111 + int irq; 112 + struct regmap_irq_chip_data *irq_data; 113 + }; 114 + 115 + #endif /* __LINUX_MFD_BD9571MWV_H */
+5
include/linux/mfd/hi6421-pmic.h
··· 38 38 struct regmap *regmap; 39 39 }; 40 40 41 + enum hi6421_type { 42 + HI6421 = 0, 43 + HI6421_V530, 44 + }; 45 + 41 46 #endif /* __HI6421_PMIC_H */
+121
include/linux/mfd/rk808.h
··· 206 206 #define RK818_USB_ILMIN_2000MA 0x7 207 207 #define RK818_USB_CHG_SD_VSEL_MASK 0x70 208 208 209 + /* RK805 */ 210 + enum rk805_reg { 211 + RK805_ID_DCDC1, 212 + RK805_ID_DCDC2, 213 + RK805_ID_DCDC3, 214 + RK805_ID_DCDC4, 215 + RK805_ID_LDO1, 216 + RK805_ID_LDO2, 217 + RK805_ID_LDO3, 218 + }; 219 + 220 + /* CONFIG REGISTER */ 221 + #define RK805_VB_MON_REG 0x21 222 + #define RK805_THERMAL_REG 0x22 223 + 224 + /* POWER CHANNELS ENABLE REGISTER */ 225 + #define RK805_DCDC_EN_REG 0x23 226 + #define RK805_SLP_DCDC_EN_REG 0x25 227 + #define RK805_SLP_LDO_EN_REG 0x26 228 + #define RK805_LDO_EN_REG 0x27 229 + 230 + /* BUCK AND LDO CONFIG REGISTER */ 231 + #define RK805_BUCK_LDO_SLP_LP_EN_REG 0x2A 232 + #define RK805_BUCK1_CONFIG_REG 0x2E 233 + #define RK805_BUCK1_ON_VSEL_REG 0x2F 234 + #define RK805_BUCK1_SLP_VSEL_REG 0x30 235 + #define RK805_BUCK2_CONFIG_REG 0x32 236 + #define RK805_BUCK2_ON_VSEL_REG 0x33 237 + #define RK805_BUCK2_SLP_VSEL_REG 0x34 238 + #define RK805_BUCK3_CONFIG_REG 0x36 239 + #define RK805_BUCK4_CONFIG_REG 0x37 240 + #define RK805_BUCK4_ON_VSEL_REG 0x38 241 + #define RK805_BUCK4_SLP_VSEL_REG 0x39 242 + #define RK805_LDO1_ON_VSEL_REG 0x3B 243 + #define RK805_LDO1_SLP_VSEL_REG 0x3C 244 + #define RK805_LDO2_ON_VSEL_REG 0x3D 245 + #define RK805_LDO2_SLP_VSEL_REG 0x3E 246 + #define RK805_LDO3_ON_VSEL_REG 0x3F 247 + #define RK805_LDO3_SLP_VSEL_REG 0x40 248 + 249 + /* INTERRUPT REGISTER */ 250 + #define RK805_PWRON_LP_INT_TIME_REG 0x47 251 + #define RK805_PWRON_DB_REG 0x48 252 + #define RK805_DEV_CTRL_REG 0x4B 253 + #define RK805_INT_STS_REG 0x4C 254 + #define RK805_INT_STS_MSK_REG 0x4D 255 + #define RK805_GPIO_IO_POL_REG 0x50 256 + #define RK805_OUT_REG 0x52 257 + #define RK805_ON_SOURCE_REG 0xAE 258 + #define RK805_OFF_SOURCE_REG 0xAF 259 + 260 + #define RK805_NUM_REGULATORS 7 261 + 262 + #define RK805_PWRON_FALL_RISE_INT_EN 0x0 263 + #define RK805_PWRON_FALL_RISE_INT_MSK 0x81 264 + 265 + /* RK805 IRQ Definitions */ 266 + #define RK805_IRQ_PWRON_RISE 0 267 + #define RK805_IRQ_VB_LOW 1 268 + #define RK805_IRQ_PWRON 2 269 + #define RK805_IRQ_PWRON_LP 3 270 + #define RK805_IRQ_HOTDIE 4 271 + #define RK805_IRQ_RTC_ALARM 5 272 + #define RK805_IRQ_RTC_PERIOD 6 273 + #define RK805_IRQ_PWRON_FALL 7 274 + 275 + #define RK805_IRQ_PWRON_RISE_MSK BIT(0) 276 + #define RK805_IRQ_VB_LOW_MSK BIT(1) 277 + #define RK805_IRQ_PWRON_MSK BIT(2) 278 + #define RK805_IRQ_PWRON_LP_MSK BIT(3) 279 + #define RK805_IRQ_HOTDIE_MSK BIT(4) 280 + #define RK805_IRQ_RTC_ALARM_MSK BIT(5) 281 + #define RK805_IRQ_RTC_PERIOD_MSK BIT(6) 282 + #define RK805_IRQ_PWRON_FALL_MSK BIT(7) 283 + 284 + #define RK805_PWR_RISE_INT_STATUS BIT(0) 285 + #define RK805_VB_LOW_INT_STATUS BIT(1) 286 + #define RK805_PWRON_INT_STATUS BIT(2) 287 + #define RK805_PWRON_LP_INT_STATUS BIT(3) 288 + #define RK805_HOTDIE_INT_STATUS BIT(4) 289 + #define RK805_ALARM_INT_STATUS BIT(5) 290 + #define RK805_PERIOD_INT_STATUS BIT(6) 291 + #define RK805_PWR_FALL_INT_STATUS BIT(7) 292 + 293 + #define RK805_BUCK1_2_ILMAX_MASK (3 << 6) 294 + #define RK805_BUCK3_4_ILMAX_MASK (3 << 3) 295 + #define RK805_RTC_PERIOD_INT_MASK (1 << 6) 296 + #define RK805_RTC_ALARM_INT_MASK (1 << 5) 297 + #define RK805_INT_ALARM_EN (1 << 3) 298 + #define RK805_INT_TIMER_EN (1 << 2) 299 + 209 300 /* RK808 IRQ Definitions */ 210 301 #define RK808_IRQ_VOUT_LO 0 211 302 #define RK808_IRQ_VB_LO 1 ··· 389 298 #define VOUT_LO_INT BIT(0) 390 299 #define CLK32KOUT2_EN BIT(0) 391 300 301 + #define TEMP115C 0x0c 302 + #define TEMP_HOTDIE_MSK 0x0c 303 + #define SLP_SD_MSK (0x3 << 2) 304 + #define SHUTDOWN_FUN (0x2 << 2) 305 + #define SLEEP_FUN (0x1 << 2) 306 + #define RK8XX_ID_MSK 0xfff0 307 + #define FPWM_MODE BIT(7) 308 + 392 309 enum { 393 310 BUCK_ILMIN_50MA, 394 311 BUCK_ILMIN_100MA, ··· 420 321 }; 421 322 422 323 enum { 324 + RK805_BUCK1_2_ILMAX_2500MA, 325 + RK805_BUCK1_2_ILMAX_3000MA, 326 + RK805_BUCK1_2_ILMAX_3500MA, 327 + RK805_BUCK1_2_ILMAX_4000MA, 328 + }; 329 + 330 + enum { 331 + RK805_BUCK3_ILMAX_1500MA, 332 + RK805_BUCK3_ILMAX_2000MA, 333 + RK805_BUCK3_ILMAX_2500MA, 334 + RK805_BUCK3_ILMAX_3000MA, 335 + }; 336 + 337 + enum { 338 + RK805_BUCK4_ILMAX_2000MA, 339 + RK805_BUCK4_ILMAX_2500MA, 340 + RK805_BUCK4_ILMAX_3000MA, 341 + RK805_BUCK4_ILMAX_3500MA, 342 + }; 343 + 344 + enum { 345 + RK805_ID = 0x8050, 423 346 RK808_ID = 0x0000, 424 347 RK818_ID = 0x8181, 425 348 };
+62
include/linux/mfd/stm32-lptimer.h
··· 1 + /* 2 + * STM32 Low-Power Timer parent driver. 3 + * 4 + * Copyright (C) STMicroelectronics 2017 5 + * 6 + * Author: Fabrice Gasnier <fabrice.gasnier@st.com> 7 + * 8 + * Inspired by Benjamin Gaignard's stm32-timers driver 9 + * 10 + * License terms: GNU General Public License (GPL), version 2 11 + */ 12 + 13 + #ifndef _LINUX_STM32_LPTIMER_H_ 14 + #define _LINUX_STM32_LPTIMER_H_ 15 + 16 + #include <linux/clk.h> 17 + #include <linux/regmap.h> 18 + 19 + #define STM32_LPTIM_ISR 0x00 /* Interrupt and Status Reg */ 20 + #define STM32_LPTIM_ICR 0x04 /* Interrupt Clear Reg */ 21 + #define STM32_LPTIM_IER 0x08 /* Interrupt Enable Reg */ 22 + #define STM32_LPTIM_CFGR 0x0C /* Configuration Reg */ 23 + #define STM32_LPTIM_CR 0x10 /* Control Reg */ 24 + #define STM32_LPTIM_CMP 0x14 /* Compare Reg */ 25 + #define STM32_LPTIM_ARR 0x18 /* Autoreload Reg */ 26 + #define STM32_LPTIM_CNT 0x1C /* Counter Reg */ 27 + 28 + /* STM32_LPTIM_ISR - bit fields */ 29 + #define STM32_LPTIM_CMPOK_ARROK GENMASK(4, 3) 30 + #define STM32_LPTIM_ARROK BIT(4) 31 + #define STM32_LPTIM_CMPOK BIT(3) 32 + 33 + /* STM32_LPTIM_ICR - bit fields */ 34 + #define STM32_LPTIM_CMPOKCF_ARROKCF GENMASK(4, 3) 35 + 36 + /* STM32_LPTIM_CR - bit fields */ 37 + #define STM32_LPTIM_CNTSTRT BIT(2) 38 + #define STM32_LPTIM_ENABLE BIT(0) 39 + 40 + /* STM32_LPTIM_CFGR - bit fields */ 41 + #define STM32_LPTIM_ENC BIT(24) 42 + #define STM32_LPTIM_COUNTMODE BIT(23) 43 + #define STM32_LPTIM_WAVPOL BIT(21) 44 + #define STM32_LPTIM_PRESC GENMASK(11, 9) 45 + #define STM32_LPTIM_CKPOL GENMASK(2, 1) 46 + 47 + /* STM32_LPTIM_ARR */ 48 + #define STM32_LPTIM_MAX_ARR 0xFFFF 49 + 50 + /** 51 + * struct stm32_lptimer - STM32 Low-Power Timer data assigned by parent device 52 + * @clk: clock reference for this instance 53 + * @regmap: register map reference for this instance 54 + * @has_encoder: indicates this Low-Power Timer supports encoder mode 55 + */ 56 + struct stm32_lptimer { 57 + struct clk *clk; 58 + struct regmap *regmap; 59 + bool has_encoder; 60 + }; 61 + 62 + #endif
+23 -9
include/linux/mfd/syscon/atmel-smc.h
··· 15 15 #define _LINUX_MFD_SYSCON_ATMEL_SMC_H_ 16 16 17 17 #include <linux/kernel.h> 18 + #include <linux/of.h> 18 19 #include <linux/regmap.h> 19 20 20 21 #define ATMEL_SMC_SETUP(cs) (((cs) * 0x10)) 21 - #define ATMEL_HSMC_SETUP(cs) (0x600 + ((cs) * 0x14)) 22 + #define ATMEL_HSMC_SETUP(layout, cs) \ 23 + ((layout)->timing_regs_offset + ((cs) * 0x14)) 22 24 #define ATMEL_SMC_PULSE(cs) (((cs) * 0x10) + 0x4) 23 - #define ATMEL_HSMC_PULSE(cs) (0x600 + ((cs) * 0x14) + 0x4) 25 + #define ATMEL_HSMC_PULSE(layout, cs) \ 26 + ((layout)->timing_regs_offset + ((cs) * 0x14) + 0x4) 24 27 #define ATMEL_SMC_CYCLE(cs) (((cs) * 0x10) + 0x8) 25 - #define ATMEL_HSMC_CYCLE(cs) (0x600 + ((cs) * 0x14) + 0x8) 28 + #define ATMEL_HSMC_CYCLE(layout, cs) \ 29 + ((layout)->timing_regs_offset + ((cs) * 0x14) + 0x8) 26 30 #define ATMEL_SMC_NWE_SHIFT 0 27 31 #define ATMEL_SMC_NCS_WR_SHIFT 8 28 32 #define ATMEL_SMC_NRD_SHIFT 16 29 33 #define ATMEL_SMC_NCS_RD_SHIFT 24 30 34 31 35 #define ATMEL_SMC_MODE(cs) (((cs) * 0x10) + 0xc) 32 - #define ATMEL_HSMC_MODE(cs) (0x600 + ((cs) * 0x14) + 0x10) 36 + #define ATMEL_HSMC_MODE(layout, cs) \ 37 + ((layout)->timing_regs_offset + ((cs) * 0x14) + 0x10) 33 38 #define ATMEL_SMC_MODE_READMODE_MASK BIT(0) 34 39 #define ATMEL_SMC_MODE_READMODE_NCS (0 << 0) 35 40 #define ATMEL_SMC_MODE_READMODE_NRD (1 << 0) ··· 64 59 #define ATMEL_SMC_MODE_PS_16 (2 << 28) 65 60 #define ATMEL_SMC_MODE_PS_32 (3 << 28) 66 61 67 - #define ATMEL_HSMC_TIMINGS(cs) (0x600 + ((cs) * 0x14) + 0xc) 62 + #define ATMEL_HSMC_TIMINGS(layout, cs) \ 63 + ((layout)->timing_regs_offset + ((cs) * 0x14) + 0xc) 68 64 #define ATMEL_HSMC_TIMINGS_OCMS BIT(12) 69 65 #define ATMEL_HSMC_TIMINGS_RBNSEL(x) ((x) << 28) 70 66 #define ATMEL_HSMC_TIMINGS_NFSEL BIT(31) ··· 74 68 #define ATMEL_HSMC_TIMINGS_TAR_SHIFT 8 75 69 #define ATMEL_HSMC_TIMINGS_TRR_SHIFT 16 76 70 #define ATMEL_HSMC_TIMINGS_TWB_SHIFT 24 71 + 72 + struct atmel_hsmc_reg_layout { 73 + unsigned int timing_regs_offset; 74 + }; 77 75 78 76 /** 79 77 * struct atmel_smc_cs_conf - SMC CS config as described in the datasheet. ··· 108 98 unsigned int shift, unsigned int ncycles); 109 99 void atmel_smc_cs_conf_apply(struct regmap *regmap, int cs, 110 100 const struct atmel_smc_cs_conf *conf); 111 - void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs, 112 - const struct atmel_smc_cs_conf *conf); 101 + void atmel_hsmc_cs_conf_apply(struct regmap *regmap, 102 + const struct atmel_hsmc_reg_layout *reglayout, 103 + int cs, const struct atmel_smc_cs_conf *conf); 113 104 void atmel_smc_cs_conf_get(struct regmap *regmap, int cs, 114 105 struct atmel_smc_cs_conf *conf); 115 - void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs, 116 - struct atmel_smc_cs_conf *conf); 106 + void atmel_hsmc_cs_conf_get(struct regmap *regmap, 107 + const struct atmel_hsmc_reg_layout *reglayout, 108 + int cs, struct atmel_smc_cs_conf *conf); 109 + const struct atmel_hsmc_reg_layout * 110 + atmel_hsmc_get_reg_layout(struct device_node *np); 117 111 118 112 #endif /* _LINUX_MFD_SYSCON_ATMEL_SMC_H_ */
+97
include/linux/mfd/tps68470.h
··· 1 + /* 2 + * Copyright (c) 2017 Intel Corporation 3 + * 4 + * Functions to access TPS68470 power management chip. 5 + * 6 + * This program is free software; you can redistribute it and/or 7 + * modify it under the terms of the GNU General Public License as 8 + * published by the Free Software Foundation version 2. 9 + * 10 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 11 + * kind, whether express or implied; without even the implied warranty 12 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + */ 15 + 16 + #ifndef __LINUX_MFD_TPS68470_H 17 + #define __LINUX_MFD_TPS68470_H 18 + 19 + /* Register addresses */ 20 + #define TPS68470_REG_POSTDIV2 0x06 21 + #define TPS68470_REG_BOOSTDIV 0x07 22 + #define TPS68470_REG_BUCKDIV 0x08 23 + #define TPS68470_REG_PLLSWR 0x09 24 + #define TPS68470_REG_XTALDIV 0x0A 25 + #define TPS68470_REG_PLLDIV 0x0B 26 + #define TPS68470_REG_POSTDIV 0x0C 27 + #define TPS68470_REG_PLLCTL 0x0D 28 + #define TPS68470_REG_PLLCTL2 0x0E 29 + #define TPS68470_REG_CLKCFG1 0x0F 30 + #define TPS68470_REG_CLKCFG2 0x10 31 + #define TPS68470_REG_GPCTL0A 0x14 32 + #define TPS68470_REG_GPCTL0B 0x15 33 + #define TPS68470_REG_GPCTL1A 0x16 34 + #define TPS68470_REG_GPCTL1B 0x17 35 + #define TPS68470_REG_GPCTL2A 0x18 36 + #define TPS68470_REG_GPCTL2B 0x19 37 + #define TPS68470_REG_GPCTL3A 0x1A 38 + #define TPS68470_REG_GPCTL3B 0x1B 39 + #define TPS68470_REG_GPCTL4A 0x1C 40 + #define TPS68470_REG_GPCTL4B 0x1D 41 + #define TPS68470_REG_GPCTL5A 0x1E 42 + #define TPS68470_REG_GPCTL5B 0x1F 43 + #define TPS68470_REG_GPCTL6A 0x20 44 + #define TPS68470_REG_GPCTL6B 0x21 45 + #define TPS68470_REG_SGPO 0x22 46 + #define TPS68470_REG_GPDI 0x26 47 + #define TPS68470_REG_GPDO 0x27 48 + #define TPS68470_REG_VCMVAL 0x3C 49 + #define TPS68470_REG_VAUX1VAL 0x3D 50 + #define TPS68470_REG_VAUX2VAL 0x3E 51 + #define TPS68470_REG_VIOVAL 0x3F 52 + #define TPS68470_REG_VSIOVAL 0x40 53 + #define TPS68470_REG_VAVAL 0x41 54 + #define TPS68470_REG_VDVAL 0x42 55 + #define TPS68470_REG_S_I2C_CTL 0x43 56 + #define TPS68470_REG_VCMCTL 0x44 57 + #define TPS68470_REG_VAUX1CTL 0x45 58 + #define TPS68470_REG_VAUX2CTL 0x46 59 + #define TPS68470_REG_VACTL 0x47 60 + #define TPS68470_REG_VDCTL 0x48 61 + #define TPS68470_REG_RESET 0x50 62 + #define TPS68470_REG_REVID 0xFF 63 + 64 + #define TPS68470_REG_MAX TPS68470_REG_REVID 65 + 66 + /* Register field definitions */ 67 + 68 + #define TPS68470_REG_RESET_MASK GENMASK(7, 0) 69 + #define TPS68470_VAVAL_AVOLT_MASK GENMASK(6, 0) 70 + 71 + #define TPS68470_VDVAL_DVOLT_MASK GENMASK(5, 0) 72 + #define TPS68470_VCMVAL_VCVOLT_MASK GENMASK(6, 0) 73 + #define TPS68470_VIOVAL_IOVOLT_MASK GENMASK(6, 0) 74 + #define TPS68470_VSIOVAL_IOVOLT_MASK GENMASK(6, 0) 75 + #define TPS68470_VAUX1VAL_AUX1VOLT_MASK GENMASK(6, 0) 76 + #define TPS68470_VAUX2VAL_AUX2VOLT_MASK GENMASK(6, 0) 77 + 78 + #define TPS68470_VACTL_EN_MASK GENMASK(0, 0) 79 + #define TPS68470_VDCTL_EN_MASK GENMASK(0, 0) 80 + #define TPS68470_VCMCTL_EN_MASK GENMASK(0, 0) 81 + #define TPS68470_S_I2C_CTL_EN_MASK GENMASK(1, 0) 82 + #define TPS68470_VAUX1CTL_EN_MASK GENMASK(0, 0) 83 + #define TPS68470_VAUX2CTL_EN_MASK GENMASK(0, 0) 84 + #define TPS68470_PLL_EN_MASK GENMASK(0, 0) 85 + 86 + #define TPS68470_CLKCFG1_MODE_A_MASK GENMASK(1, 0) 87 + #define TPS68470_CLKCFG1_MODE_B_MASK GENMASK(3, 2) 88 + 89 + #define TPS68470_GPIO_CTL_REG_A(x) (TPS68470_REG_GPCTL0A + (x) * 2) 90 + #define TPS68470_GPIO_CTL_REG_B(x) (TPS68470_REG_GPCTL0B + (x) * 2) 91 + #define TPS68470_GPIO_MODE_MASK GENMASK(1, 0) 92 + #define TPS68470_GPIO_MODE_IN 0 93 + #define TPS68470_GPIO_MODE_IN_PULLUP 1 94 + #define TPS68470_GPIO_MODE_OUT_CMOS 2 95 + #define TPS68470_GPIO_MODE_OUT_ODRAIN 3 96 + 97 + #endif /* __LINUX_MFD_TPS68470_H */
+1 -1
sound/soc/codecs/twl4030.c
··· 28 28 #include <linux/platform_device.h> 29 29 #include <linux/of.h> 30 30 #include <linux/of_gpio.h> 31 - #include <linux/i2c/twl.h> 31 + #include <linux/mfd/twl.h> 32 32 #include <linux/slab.h> 33 33 #include <linux/gpio.h> 34 34 #include <sound/core.h>