Add support for Silicon Mitus SM5703 MFD
Subsystems (3)
cover Add support for Silicon Mitus SM5703 MFD
This series adds support for Silicon Mitus SM5703 MFD and the appropriate device-tree bindings. This only adds support for the regulator module, leaving room for other modules implemented in future (code for other modules is really not ready for submission right now). Silicon Mitus SM5703 is used on various mobile phones, mostly Samsung Galaxy (J5 (2015, 2016), On7, J7 (2015, 2016) ...).
Markuss Broks (4):
dt-bindings: regulator: Add bindings for Silicon Mitus SM5703
regulators
dt-bindings: mfd: Add bindings for Silicon Mitus SM5703 MFD
mfd: sm5703: Add support for SM5703 MFD
regulator: sm5703-regulator: Add regulators support for SM5703 MFD
.../bindings/mfd/siliconmitus,sm5703.yaml | 91 ++++++++++ .../siliconmitus,sm5703-regulator.yaml | 48 ++++++ MAINTAINERS | 8 + drivers/mfd/Kconfig | 12 ++ drivers/mfd/Makefile | 1 + drivers/mfd/sm5703.c | 81 +++++++++ drivers/regulator/Kconfig | 7 + drivers/regulator/Makefile | 1 + drivers/regulator/sm5703-regulator.c | 162 ++++++++++++++++++ include/linux/mfd/sm5703.h | 105 ++++++++++++ 10 files changed, 516 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/siliconmitus,sm5703.yaml create mode 100644 Documentation/devicetree/bindings/regulator/siliconmitus,sm5703-regulator.yaml create mode 100644 drivers/mfd/sm5703.c create mode 100644 drivers/regulator/sm5703-regulator.c create mode 100644 include/linux/mfd/sm5703.h
Signature · 1 line
2.35.1
PATCH 3/4 mfd: sm5703: Add support for SM5703 MFD
Silicon Mitus SM5703 is a multi-function device, meant to be used in mobile devices. It has several modules: LDO, BUCK regulators, charger circuit, flash LED driver, a fuel gauge for monitoring the battery and a MUIC USB switcher. The MUIC and fuel gauge parts are separate in that they use separate i2c lines to communicate with the device, while charger circuit, LED driver and regulators are on the main i2c line the device is controlled with.
--- MAINTAINERS | 8 +++ drivers/mfd/Kconfig | 12 +++++ drivers/mfd/Makefile | 1 + drivers/mfd/sm5703.c | 81 ++++++++++++++++++++++++++++ include/linux/mfd/sm5703.h | 105 +++++++++++++++++++++++++++++++++++++ 5 files changed, 207 insertions(+) create mode 100644 drivers/mfd/sm5703.c create mode 100644 include/linux/mfd/sm5703.h
MAINTAINERS +8 -0
@@ -17886,6 +17886,14 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev F: include/linux/srcu*.h F: kernel/rcu/srcu*.c +SM5703 MFD DRIVER +M: Markuss Broks <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/mfd/siliconmitus,sm5703.yaml +F: Documentation/devicetree/bindings/regulator/siliconmitus,sm5703-regulator.yaml +F: drivers/mfd/sm5703.c +F: drivers/regulator/sm5703-regulator.c + SMACK SECURITY MODULE M: Casey Schaufler <[email protected]> L: [email protected]
drivers/mfd/Kconfig +12 -0
@@ -1223,6 +1223,18 @@ config MFD_SM501 interface. The device may be connected by PCI or local bus with varying functions enabled. +config MFD_SM5703 + tristate "Silicon Mitus SM5703 MFD" + depends on I2C + select MFD_CORE + select REGMAP_I2C + help + This is the core driver for the Silicon Mitus SM5703 multi-function + device. This device is meant to be used in phones and it has numerous + modules, including LED controller, regulators, fuel gauge, MUIC and + charger circuit. It also support muxing a serial interface over USB + data lines. + config MFD_SM501_GPIO bool "Export GPIO via GPIO layer" depends on MFD_SM501 && GPIOLIB
drivers/mfd/Makefile +1 -0
@@ -275,3 +275,4 @@ rsmu-i2c-objs := rsmu_core.o rsmu_i2c.o rsmu-spi-objs := rsmu_core.o rsmu_spi.o obj-$(CONFIG_MFD_RSMU_I2C) += rsmu-i2c.o obj-$(CONFIG_MFD_RSMU_SPI) += rsmu-spi.o +obj-$(CONFIG_MFD_SM5703) += sm5703.o
drivers/mfd/sm5703.c new file +81 -0
81 lines not on this page · raw message
include/linux/mfd/sm5703.h new file +105 -0
105 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH 2/4 dt-bindings: mfd: Add bindings for Silicon Mitus SM5703 MFD
In reply to Markuss BroksThis patch adds device-tree bindings for the Silicon Mitus SM5703 MFD.
--- .../bindings/mfd/siliconmitus,sm5703.yaml | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/siliconmitus,sm5703.yaml
Documentation/devicetree/bindings/mfd/siliconmitus,sm5703.yaml new file +96 -0
@@ -0,0 +1,96 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/siliconmitus,sm5703.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Silicon Mitus multi-function device bindings + +maintainers: + - Markuss Broks <[email protected]> + +description: | + Silicon Mitus SM5703 is a multi-function device, that consists of several + modules, designed for a mobile phone use. It consists of + LDO, Buck, USBLDO and VBUS regulators, a flash LED driver, a MUIC unit, + a fuel gauge and a battery charger circuit. The MUIC and Fuel-Gauge units + are separate from the main MFD, having their own i2c lines, while the + LED driver, regulators and charger are sharing the main i2c bus of the MFD. + +properties: + compatible: + const: + - siliconmitus,sm5703-mfd + + reg: + description: + I2C slave address. + maxItems: 1 + + regulators: + $ref: ../regulator/siliconmitus,sm5703-regulator.yaml + description: + List of child nodes that specify the regulators. + + reset-gpio: + description: + GPIO which is connected to the MRSTB pin. + maxItems: 1 + +required: + - compatible + - reg + - regulators + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + mfd@49 { + compatible = "siliconmitus,sm5703-mfd"; + reg = <0x49>; + + reset-gpio = <&msmgpio 24 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&mrstb_default>; + + regulator { + compatible = "siliconmitus,sm5703-regulator"; + + regulators { + sm5703_ldo1: ldo1 { + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + }; + + sm5703_ldo2: ldo2 { + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <3300000>; + }; + + sm5703_ldo3: ldo3 { + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + sm5703_usbldo1: usbldo1 { + regulator-min-microvolt = <4800000>; + regulator-max-microvolt = <4800000>; + }; + + sm5703_usbldo2: usbldo2 { + regulator-min-microvolt = <4800000>; + regulator-max-microvolt = <4800000>; + }; + + sm5703_vbus: vbus { + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + }; + }; + }; + };
Signature · 1 line
2.35.1
PATCH 4/4 regulator: sm5703-regulator: Add regulators support for SM5703 MFD
In reply to Markuss BroksRegulators block of SM5703 controls several voltage regulators which are used to power various components. There are 3 LDO outputs ranging from 1.5 to 3.3V, a buck regulator ranging from 1V to 3V, two fixed voltage LDO regulators for powering the USB devices and one high-power fixed voltage LDO line (actually two lines) meant to power high-power USB devices.
--- drivers/regulator/Kconfig | 7 ++ drivers/regulator/Makefile | 1 + drivers/regulator/sm5703-regulator.c | 162 +++++++++++++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 drivers/regulator/sm5703-regulator.c
drivers/regulator/Kconfig +7 -0
@@ -1147,6 +1147,13 @@ config REGULATOR_SLG51000 The SLG51000 is seven compact and customizable low dropout regulators. +config REGULATOR_SM5703 + tristate "Silicon Mitus SM5703 regulators" + depends on SM5703_MFD + help + This driver provides support for voltage regulators of SM5703 + multi-function device. + config REGULATOR_STM32_BOOSTER tristate "STMicroelectronics STM32 BOOSTER" depends on ARCH_STM32 || COMPILE_TEST
drivers/regulator/Makefile +1 -0
@@ -173,5 +173,6 @@ obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o obj-$(CONFIG_REGULATOR_WM8994) += wm8994-regulator.o +obj-$(CONFIG_REGULATOR_SM5703) += sm5703-regulator.o ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
drivers/regulator/sm5703-regulator.c new file +162 -0
162 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH 1/4 dt-bindings: regulator: Add bindings for Silicon Mitus SM5703 regulators
In reply to Markuss BroksThis patch adds device-tree bindings for regulators on Silicon Mitus SM5703 MFD.
--- .../siliconmitus,sm5703-regulator.yaml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/siliconmitus,sm5703-regulator.yaml
Documentation/devicetree/bindings/regulator/siliconmitus,sm5703-regulator.yaml new file +48 -0
@@ -0,0 +1,48 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/siliconmitus,sm5703-regulator.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Silicon Mitus SM5703 multi function device regulators + +maintainers: + - Markuss Broks <[email protected]> + +description: | + SM5703 regulators node should be a sub node of the SM5703 MFD node. See SM5703 MFD + bindings at Documentation/devicetree/bindings/mfd/siliconmitus,sm5703.yaml + Regulator nodes should be named as USBLDO_<number>, BUCK, VBUS, LDO_<number>. + The definition for each of these nodes is defined using the standard + binding for regulators at Documentation/devicetree/bindings/regulator/regulator.txt. + +properties: + compatible: + const: siliconmitus,sm5703-regulator + + buck: + type: object + $ref: regulator.yaml# + description: + Properties for the BUCK regulator. + + vbus: + type: object + $ref: regulator.yaml# + description: + Properties for the VBUS regulator. + +patternProperties: + "^ldo[1-3]$": + type: object + $ref: regulator.yaml# + description: + Properties for single LDO regulator. + + "^usbldo[1-2]$": + type: object + $ref: regulator.yaml# + description: + Properties for a single USBLDO regulator. + +additionalProperties: false
Signature · 1 line
2.35.1
Mark Brown
maintainerRe: [PATCH 4/4] regulator: sm5703-regulator: Add regulators support for SM5703 MFD
In reply to Markuss Broksdrivers/regulator/Makefile obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o · line 177
Quoted 7 lines · Markuss Broks
+++ b/drivers/regulator/Makefile
drivers/regulator/Makefile +1
-0@@ -173,5 +173,6 @@ obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o obj-$(CONFIG_REGULATOR_WM8994) += wm8994-regulator.o +obj-$(CONFIG_REGULATOR_SM5703) += sm5703-regulator.o
Please keep the Kconfig and Makefile sorted.
drivers/regulator/sm5703-regulator.c line 35
Quoted 10 lines
drivers/regulator/sm5703-regulator.c new file +10
-0+static const int sm5703_buck_voltagemap[] = { +1000000 ,1000000 ,1000000 ,1000000 , +1000000 ,1000000 ,1000000 ,1000000 , +1000000 ,1000000 ,1000000 ,1100000 , +1200000 ,1300000 ,1400000 ,1500000 , +1600000 ,1700000 ,1800000 ,1900000 , +2000000 ,2100000 ,2200000 ,2300000 , +2400000 ,2500000 ,2600000 ,2700000 , +2800000 ,2900000 ,3000000 ,3000000 , +};
Are the repeated values at the ends of the array actually valid or do they indicate the part being driven out of spec? If it's out of spec then it's better to exclude them since otherwise we might choose one of those values when configuring a voltage which may not actually work as desired.
Re: [PATCH 4/4] regulator: sm5703-regulator: Add regulators support for SM5703 MFD
Hi Mark,
Quoted 11 lines · Mark Brown
drivers/regulator/Makefile obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o · line 177
Quoted 7 lines · Markuss Broks
+++ b/drivers/regulator/Makefile
drivers/regulator/Makefile +1
-0@@ -173,5 +173,6 @@ obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o obj-$(CONFIG_REGULATOR_WM8994) += wm8994-regulator.o +obj-$(CONFIG_REGULATOR_SM5703) += sm5703-regulator.oPlease keep the
KconfigandMakefilesorted.
Quoted 15 lines
drivers/regulator/sm5703-regulator.c line 35
Quoted 10 lines
drivers/regulator/sm5703-regulator.c new file +10
-0+static const int sm5703_buck_voltagemap[] = { +1000000 ,1000000 ,1000000 ,1000000 , +1000000 ,1000000 ,1000000 ,1000000 , +1000000 ,1000000 ,1000000 ,1100000 , +1200000 ,1300000 ,1400000 ,1500000 , +1600000 ,1700000 ,1800000 ,1900000 , +2000000 ,2100000 ,2200000 ,2300000 , +2400000 ,2500000 ,2600000 ,2700000 , +2800000 ,2900000 ,3000000 ,3000000 , +};Are the repeated values at the ends of the array actually valid or do they indicate the part being driven out of spec? If it's out of spec then it's better to exclude them since otherwise we might choose one of those values when configuring a voltage which may not actually work as desired.
I am pretty sure those values are valid. This voltage map is taken directly from the downstream driver (I wish I had actual documentation...) , which also backs it by saying 32 voltage levels are supported. However, I find it rather improper to have separate values which result in same voltage level. Still, I'm not sure something like selector offset exists in struct regulator_desc or elsewhere.
- Markuss
Rob Herring
maintainerRe: [PATCH 2/4] dt-bindings: mfd: Add bindings for Silicon Mitus SM5703 MFD
In reply to Markuss BroksQuoted 9 lines · Markuss Broks
This patch adds device-tree bindings for the Silicon Mitus SM5703 MFD.
Signed-off-by Markuss Broks <[email protected]>--- .../bindings/mfd/siliconmitus,sm5703.yaml | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/siliconmitus,sm5703.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:./Documentation/devicetree/bindings/mfd/siliconmitus,sm5703.yaml:50:5: [error] syntax error: could not find expected ':' (syntax)
dtschema/dtc warnings/errors:
make[1]: *** Deleting file 'Documentation/devicetree/bindings/mfd/siliconmitus,sm5703.example.dts'
Traceback (most recent call last):
File "/usr/local/bin/dt-extract-example", line 52, in <module>
binding = yaml.load(open(args.yamlfile, encoding='utf-8').read())
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/main.py", line 434, in load
return constructor.get_single_data()
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 119, in get_single_data
node = self.composer.get_single_node()
File "_ruamel_yaml.pyx", line 706, in _ruamel_yaml.CParser.get_single_node
File "_ruamel_yaml.pyx", line 724, in _ruamel_yaml.CParser._compose_document
File "_ruamel_yaml.pyx", line 775, in _ruamel_yaml.CParser._compose_node
File "_ruamel_yaml.pyx", line 889, in _ruamel_yaml.CParser._compose_mapping_node
File "_ruamel_yaml.pyx", line 773, in _ruamel_yaml.CParser._compose_node
File "_ruamel_yaml.pyx", line 852, in _ruamel_yaml.CParser._compose_sequence_node
File "_ruamel_yaml.pyx", line 904, in _ruamel_yaml.CParser._parse_next_event
ruamel.yaml.scanner.ScannerError: while scanning a simple key
in "<unicode string>", line 49, column 3
could not find expected ':'
in "<unicode string>", line 50, column 5
make[1]: *** [Documentation/devicetree/bindings/Makefile:26: Documentation/devicetree/bindings/mfd/siliconmitus,sm5703.example.dts] Error 1 make[1]: *** Waiting for unfinished jobs...../Documentation/devicetree/bindings/mfd/siliconmitus,sm5703.yaml: while scanning a simple key
in "<unicode string>", line 49, column 3
could not find expected ':'
in "<unicode string>", line 50, column 5
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/mfd/siliconmitus,sm5703.yaml: ignoring, error parsing file
make: *** [Makefile:1401: dt_binding_check] Error 2
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.