Skip to contentSkip to conversation

mfd/regulator/clk/input: bd71837: ROHM BD71837 PMIC driver

PATCH Applied Matti Vaittinen 2 participants 7 messages Aug 3, 2018 – Aug 16, 2018

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v12 cover mfd/regulator/clk/input: bd71837: ROHM BD71837 PMIC driver

Patch series adding support for ROHM BD71837 PMIC.

BD71837 is a programmable Power Management IC for powering single-core, dual-core, and quad-core SoCs such as NXP-i.MX 8M. It is optimized for low BOM cost and compact solution footprint. It integrates 8 buck regulators and 7 LDOs to provide all the power rails required by the SoC and the commonly used peripherals.

This is reduced set of patches containing only the MFD and devicetree bindings. This enables alrady applied regulator part and power button support using gpio-keys. Clock and reset support will be sent as separate set of patches.

Changelog v12
- fix return value check for regmap_irq_get_virq spotted by build bot.

Changelog v11
More fixes based on comments from Lee Jones
- styling issues/spelling errors.
- drop i2c_client struct from driver data.
- add chip revision validation.

Changelog v10
Fixes based on comments from Lee Jones
- Drop the platform data.
- Drop the regmap wrapper functions and use regmap directly.
- Rename files with rohm-prefix.
- Replace goto from probe by in-place returns.
- Drop unnecessary i2c_id table.
- Change gpio_keys_button array to simple struct.
- Fix return value checks for regmap functions.
- Various styling/spelling fixes.
- Replace foo-bar with something more meaningfull in DT example

Changelog v9
Fixes initiated by feedback from Enric Balletbo Serra, Lee and Dmitry.
- Simplified control flow for probe
- Removed accidentally left squash commit message
- Some comma presence toggling after last member in an array =)
- Styling of multi line comments.

Changelog v8
- Dropped clk-bd71837 from series (will send later)
- Dropped bd718xx-pwrkey driver and used gpio_keys instead.
- Added power-button short/long press duration configuratio to MFD
- Cleaned MFD driver according to comments from Enric Balletbo Serra. (used devm, removed unnecessary header inclusions, removed redundant assignment, styling issues, allow building MFD part as module, fixed license mismatch).

Changelog v7
- patch 1: Cleaned MFD probe since MFD no longer directly reads DT properties.
- patch 1/4: Moved power-key related definitions from powerkey patch (4) to MFD patch (1) so that powerkey can be applied independently
- Patch 2 is unchanged.
- patch 3: Added missing allocation check back to clk probe

Changelog v6
- Added power-key input driver
Based on feedback from Rob Herring and Stephen Boyd
- Added link to datasheet
- Removed interrupt-controller from DT and fixed binding document
- clk styling fixes
- remove clkdev usage
- add clk bindings to MFD documentation
- removed clk binding document

Changelog v5
- dropped regulator patches which are already applied to Mark's tree Based on feedback from Rob Herring and Stephen Boyd
- mfd bindings: explain why this can be interrupt-controller
- mfd bindings: describe interrupts better
- mfd bindings: require one cell interrupt specifier
- mfd bindings: use generic node names in example
- mfd driver: ack masked interrupt once at init
- clk bindings: use generic node names in example

- clk driver:   use devm
- clk driver:   use of_clk_add_hw_provider
- clk driver:   change severity of print and how prints are emitted at
                probe error path.
- clk driver:   dropped forward declared functions
- clk configs:  drop unnecessary dependencies
- clk driver:   other styling issues
- mfd/clk DT:   drop clk node.

Changelog v4
- remove mutex from regulator state check as core prevents simultaneous accesses
- allow voltage change for bucks 1 to 4 when regulator is enabled
- fix indentiation problems
- properly correct SPDX comments

Changelog v3
- kill unused variable
- kill unused definitions
- use REGMAP_IRQ_REG

Changelog v2
Based on feedback from Mark Brown
- Squashed code and buildfile changes to same patch
- Fixed some styling issues
- Changed SPDX comments to CPP style
- Error out if voltage is changed when regulator is enabled instead of Disabling the regulator for duration of change
- Use devm_regulator_register
- Remove compatible usage from regulators - use parent dev for config
- Add a note about using regulator-boot-on for BUCK6 and 7
- fixed warnings from kbuild test robot

patch 1:
MFD driver and definitions bringing interrupt support and enabling clk, regulator and input subsystems.
patch 2:
MFD driver DT bindings

This patch series is based on for-mfd-next

---

Matti Vaittinen (2):
mfd: bd71837: mfd driver for ROHM BD71837 PMIC
mfd: bd71837: Devicetree bindings for ROHM BD71837 PMIC

 .../devicetree/bindings/mfd/rohm,bd71837-pmic.txt  |  62 ++++
 drivers/mfd/Kconfig                                |  13 +
 drivers/mfd/Makefile                               |   1 +
 drivers/mfd/rohm-bd718x7.c                         | 211 +++++++++++++
 include/linux/mfd/rohm-bd718x7.h                   | 332 +++++++++++++++++++++
 5 files changed, 619 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt
 create mode 100644 drivers/mfd/rohm-bd718x7.c
 create mode 100644 include/linux/mfd/rohm-bd718x7.h
Signature · 1 line
2.14.3
#1 lore raw

PATCH v12 1/2 mfd: bd71837: mfd driver for ROHM BD71837 PMIC

ROHM BD71837 PMIC MFD driver providing interrupts and support for three subsystems:
- clk
- Regulators
- input/power-key

---
 drivers/mfd/Kconfig              |  13 ++
 drivers/mfd/Makefile             |   1 +
 drivers/mfd/rohm-bd718x7.c       | 211 +++++++++++++++++++++++++
 include/linux/mfd/rohm-bd718x7.h | 332 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 557 insertions(+)
 create mode 100644 drivers/mfd/rohm-bd718x7.c
 create mode 100644 include/linux/mfd/rohm-bd718x7.h
drivers/mfd/Kconfig +13 -0
index f3fa516011ec..11841f4b7b2b 100644
@@ -1817,6 +1817,19 @@ config MFD_STW481X
 	  in various ST Microelectronics and ST-Ericsson embedded
 	  Nomadik series.
 
+config MFD_ROHM_BD718XX
+	tristate "ROHM BD71837 Power Management IC"
+	depends on I2C=y
+	depends on OF
+	select REGMAP_I2C
+	select REGMAP_IRQ
+	select MFD_CORE
+	help
+	  Select this option to get support for the ROHM BD71837
+	  Power Management ICs. BD71837 is designed to power processors like
+	  NXP i.MX8. It contains 8 BUCK outputs and 7 LDOs, voltage monitoring
+	  and emergency shut down as well as 32,768KHz clock output.
+
 config MFD_STM32_LPTIMER
 	tristate "Support for STM32 Low-Power Timer"
 	depends on (ARCH_STM32 && OF) || COMPILE_TEST
drivers/mfd/Makefile +1 -0
index 2852a6042ecf..5856a9489cbd 100644
@@ -239,4 +239,5 @@ obj-$(CONFIG_MFD_STM32_TIMERS) 	+= stm32-timers.o
 obj-$(CONFIG_MFD_MXS_LRADC)     += mxs-lradc.o
 obj-$(CONFIG_MFD_SC27XX_PMIC)	+= sprd-sc27xx-spi.o
 obj-$(CONFIG_RAVE_SP_CORE)	+= rave-sp.o
+obj-$(CONFIG_MFD_ROHM_BD718XX)	+= rohm-bd718x7.o
 
drivers/mfd/rohm-bd718x7.c new file +211 -0

211 lines not on this page · raw message

include/linux/mfd/rohm-bd718x7.h new file +332 -0

332 lines not on this page · raw message

Signature · 1 line
2.14.3
#2 lore raw

Re: [PATCH v12 1/2] mfd: bd71837: mfd driver for ROHM BD71837 PMIC

Quoted 8 lines · Matti Vaittinen

ROHM BD71837 PMIC MFD driver providing interrupts and support for three subsystems:
- clk
- Regulators
- input/power-key

I maintained Enric's Reviewed-by as only change I did to v12 was:

drivers/mfd/rohm-bd718x7.c line 169

Quoted 8 lines
drivers/mfd/rohm-bd718x7.c new file +8 -0
+	ret = regmap_irq_get_virq(bd71837->irq_data, BD71837_INT_PWRBTN_S);
+
+	if (ret < 0) {
+		dev_err(&i2c->dev, "Failed to get the IRQ\n");
+		return ret;
+	}
+
+	button.irq = ret;

instead of v11 which was:

+ button.irq = regmap_irq_get_virq(bd71837->irq_data,
+ BD71837_INT_PWRBTN_S);
+
+ if (button.irq < 0) {
+ dev_err(&i2c->dev, "Failed to get the IRQ\n");
+ return button.irq;
+ }

Br,
Matti Vaittinen

Applied
#3 lore raw

Re: [PATCH v12 1/2] mfd: bd71837: mfd driver for ROHM BD71837 PMIC

In reply to Matti Vaittinen
Quoted 8 lines · Matti Vaittinen

ROHM BD71837 PMIC MFD driver providing interrupts and support for three subsystems:
- clk
- Regulators
- input/power-key

Quoted 8 lines
---
 drivers/mfd/Kconfig              |  13 ++
 drivers/mfd/Makefile             |   1 +
 drivers/mfd/rohm-bd718x7.c       | 211 +++++++++++++++++++++++++
 include/linux/mfd/rohm-bd718x7.h | 332 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 557 insertions(+)
 create mode 100644 drivers/mfd/rohm-bd718x7.c
 create mode 100644 include/linux/mfd/rohm-bd718x7.h

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#4 lore raw

PATCH v12 2/2 mfd: bd71837: Devicetree bindings for ROHM BD71837 PMIC

In reply to Matti Vaittinen

Document devicetree bindings for ROHM BD71837 PMIC MFD.

---
 .../devicetree/bindings/mfd/rohm,bd71837-pmic.txt  | 62 ++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt
Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt new file +62 -0
new file mode 100644
index 000000000000..3ca56fdb5ffe
@@ -0,0 +1,62 @@
+* ROHM BD71837 Power Management Integrated Circuit bindings
+
+BD71837MWV is a programmable Power Management IC for powering single-core,
+dual-core, and quad-core SoCs such as NXP-i.MX 8M. It is optimized for
+low BOM cost and compact solution footprint. It integrates 8 Buck
+egulators and 7 LDOs to provide all the power rails required by the SoC and
+the commonly used peripherals.
+
+Datasheet for PMIC is available at:
+https://www.rohm.com/datasheet/BD71837MWV/bd71837mwv-e
+
+Required properties:
+ - compatible		: Should be "rohm,bd71837".
+ - reg			: I2C slave address.
+ - interrupt-parent	: Phandle to the parent interrupt controller.
+ - interrupts		: The interrupt line the device is connected to.
+ - clocks		: The parent clock connected to PMIC. If this is missing
+			  32768 KHz clock is assumed.
+ - #clock-cells		: Should be 0.
+ - regulators:		: List of child nodes that specify the regulators.
+			  Please see ../regulator/rohm,bd71837-regulator.txt
+
+Optional properties:
+- clock-output-names	: Should contain name for output clock.
+
+Example:
+
+	/* external oscillator node */
+	osc: oscillator {
+		compatible = "fixed-clock";
+		#clock-cells = <1>;
+		clock-frequency  = <32768>;
+		clock-output-names = "osc";
+	};
+
+	pmic: pmic@4b {
+		compatible = "rohm,bd71837";
+		reg = <0x4b>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <29 GPIO_ACTIVE_LOW>;
+		interrupt-names = "irq";
+		#clock-cells = <0>;
+		clocks = <&osc 0>;
+		clock-output-names = "bd71837-32k-out";
+
+		regulators {
+			buck1: BUCK1 {
+				regulator-name = "buck1";
+				regulator-min-microvolt = <700000>;
+				regulator-max-microvolt = <1300000>;
+				regulator-boot-on;
+				regulator-ramp-delay = <1250>;
+			};
+		};
+	};
+
+	/* Clock consumer node */
+	rtc@0 {
+		compatible = "company,my-rtc";
+		clock-names = "my-clock";
+		clocks = <&pmic>;
+	};
Signature · 1 line
2.14.3
Applied
#6 lore raw

Re: [PATCH v12 2/2] mfd: bd71837: Devicetree bindings for ROHM BD71837 PMIC

In reply to Matti Vaittinen
Quoted 9 lines · Matti Vaittinen

Document devicetree bindings for ROHM BD71837 PMIC MFD.

---
 .../devicetree/bindings/mfd/rohm,bd71837-pmic.txt  | 62 ++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog