On 31/05/2022 12:28, ChiaEn Wu wrote: > From: ChiYuan Huang <cy_huang@xxxxxxxxxxx> > > Add Mediatek MT6370 binding documentation. Subject: same as previous patches. > > Signed-off-by: ChiYuan Huang <cy_huang@xxxxxxxxxxx> > --- > .../bindings/mfd/mediatek,mt6370.yaml | 282 ++++++++++++++++++ > .../dt-bindings/iio/adc/mediatek,mt6370_adc.h | 18 ++ > include/dt-bindings/mfd/mediatek,mt6370.h | 83 ++++++ > 3 files changed, 383 insertions(+) > create mode 100644 Documentation/devicetree/bindings/mfd/mediatek,mt6370.yaml > create mode 100644 include/dt-bindings/iio/adc/mediatek,mt6370_adc.h > create mode 100644 include/dt-bindings/mfd/mediatek,mt6370.h > > diff --git a/Documentation/devicetree/bindings/mfd/mediatek,mt6370.yaml b/Documentation/devicetree/bindings/mfd/mediatek,mt6370.yaml > new file mode 100644 > index 000000000000..96a12dce0108 > --- /dev/null > +++ b/Documentation/devicetree/bindings/mfd/mediatek,mt6370.yaml > @@ -0,0 +1,282 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/mfd/mediatek,mt6370.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Mediatek MT6370 SubPMIC > + > +maintainers: > + - ChiYuan Huang <cy_huang@xxxxxxxxxxx> > + > +description: | > + MT6370 is a highly-integrated smart power management IC, which includes a > + single cell Li-Ion/Li-Polymer switching battery charger, a USB Type-C & > + Power Delivery (PD) controller, dual flash LED current sources, a RGB LED > + driver, a backlight WLED driver, a display bias driver and a general LDO for > + portable devices. > + > +properties: > + compatible: > + const: mediatek,mt6370 > + > + reg: > + maxItems: 1 > + > + wakeup-source: true > + > + interrupts: > + maxItems: 1 > + > + interrupt-controller: true > + > + '#interrupt-cells': > + const: 1 > + > + adc: > + type: object > + description: | > + List the compatible configurations of MT6370 ADC. This sentence does not make any sense. The "description" field is to describe, explain the meaning behind given property. > + > + properties: > + compatible: > + const: mediatek,mt6370-adc > + > + "#io-channel-cells": > + const: 1 > + > + required: > + - compatible > + - '#io-channel-cells' > + > + backlight: > + type: object > + $ref: /schemas/leds/backlight/mediatek,mt6370-backlight.yaml# > + > + charger: > + type: object > + $ref: /schemas/power/supply/mediatek,mt6370-charger.yaml# > + > + tcpc: > + type: object > + $ref: /schemas/usb/mediatek,mt6370-tcpc.yaml# > + > + indicator: > + type: object > + $ref: /schemas/leds/mediatek,mt6370-indicator.yaml# > + > + flashlight: > + type: object > + $ref: /schemas/leds/mediatek,mt6370-flashlight.yaml# > + > + regulators: > + type: object > + description: | > + List all supported regulators Ditto > + > + patternProperties: > + "^(dsvbst|vibldo)$": > + $ref: /schemas/regulator/regulator.yaml# > + type: object > + unevaluatedProperties: false > + > + "^(dsvpos|dsvneg)$": > + $ref: /schemas/regulator/regulator.yaml# > + type: object > + unevaluatedProperties: false > + > + properties: > + enable-gpio: > + maxItems: 1 > + description: | > + Specify a valid 'enable' gpio for the regulator and it's optional Same comment as your patch #10. > + > +required: > + - compatible > + - reg > + - interrupts > + - interrupt-controller > + - '#interrupt-cells' > + - regulators > + - adc > + - backlight > + - indicator > + - tcpc > + - charger > + - flashlight > + > +additionalProperties: false > + > +examples: > + - | > + #include <dt-bindings/interrupt-controller/irq.h> > + #include <dt-bindings/leds/common.h> > + #include <dt-bindings/mfd/mediatek,mt6370.h> > + #include <dt-bindings/iio/adc/mediatek,mt6370_adc.h> > + #include <dt-bindings/usb/pd.h> > + i2c { > + #address-cells = <1>; > + #size-cells = <0>; > + > + mt6370@34 { Generic node name, so "pmic". > + compatible = "mediatek,mt6370"; > + reg = <0x34>; > + wakeup-source; > + interrupts-extended = <&gpio26 3 IRQ_TYPE_LEVEL_LOW>; > + interrupt-controller; > + #interrupt-cells = <1>; > + > + mt6370_adc: adc { > + compatible = "mediatek,mt6370-adc"; > + #io-channel-cells = <1>; > + }; > + > + backlight { > + compatible = "mediatek,mt6370-backlight"; > + mediatek,bled-channel-use = /bits/ 8 <15>; > + }; > + > + charger { > + compatible = "mediatek,mt6370-charger"; > + interrupts = <MT6370_IRQ_ATTACH>, <MT6370_IRQ_OVPCTRL_UVP_D>, > + <MT6370_IRQ_CHG_MIVR>; > + interrupt-names = "attach_i", "uvp_d_evt", "mivr"; > + io-channels = <&mt6370_adc MT6370_CHAN_IBUS>; > + > + mt6370_otg_vbus: usb-otg-vbus { > + regulator-compatible = "mt6370,otg-vbus"; > + regulator-name = "usb-otg-vbus"; > + regulator-min-microvolt = <4350000>; > + regulator-max-microvolt = <5800000>; > + regulator-min-microamp = <500000>; > + regulator-max-microamp = <3000000>; > + }; > + }; > + > + indicator { > + compatible = "mediatek,mt6370-indicator"; > + #address-cells = <1>; > + #size-cells = <0>; > + > + multi-led@0 { > + reg = <0>; > + function = LED_FUNCTION_INDICATOR; > + color = <LED_COLOR_ID_RGB>; > + led-max-microamp = <24000>; > + #address-cells = <1>; > + #size-cells = <0>; > + mediatek,soft-start = <3>; > + led@0 { Messed up indentation. > + reg = <0>; > + color = <LED_COLOR_ID_RED>; > + }; > + led@1 { > + reg = <1>; > + color = <LED_COLOR_ID_GREEN>; > + }; > + led@2 { > + reg = <2>; > + color = <LED_COLOR_ID_BLUE>; > + }; > + }; > + led@3 { > + reg = <3>; > + function = LED_FUNCTION_INDICATOR; > + color = <LED_COLOR_ID_WHITE>; > + led-max-microamp = <6000>; > + }; > + }; > + > + flashlight { > + compatible = "mediatek,mt6370-flashlight"; > + #address-cells = <1>; > + #size-cells = <0>; > + led@0 { > + reg = <0>; > + led-sources = <0>; > + function = LED_FUNCTION_FLASH; > + color = <LED_COLOR_ID_WHITE>; > + function-enumerator = <1>; > + led-max-microamp = <200000>; > + flash-max-microamp = <500000>; > + flash-max-timeout-us = <1248000>; > + }; > + led@1 { > + reg = <1>; > + led-sources = <1>; > + function = LED_FUNCTION_FLASH; > + color = <LED_COLOR_ID_WHITE>; > + function-enumerator = <2>; > + led-max-microamp = <200000>; > + flash-max-microamp = <500000>; > + flash-max-timeout-us = <1248000>; > + }; > + }; > + > + tcpc { > + compatible = "mediatek,mt6370-tcpc"; > + interrupts-extended = <&gpio26 4 IRQ_TYPE_LEVEL_LOW>; > + > + connector { > + compatible = "usb-c-connector"; > + label = "USB-C"; > + vbus-supply = <&mt6370_otg_vbus>; > + data-role = "dual"; > + power-role = "dual"; > + try-power-role = "sink"; > + source-pdos = <PDO_FIXED(5000, 1000, PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP)>; > + sink-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP)>; > + op-sink-microwatt = <10000000>; > + > + ports { > + #address-cells = <1>; > + #size-cells = <0>; > + > + port@0 { > + reg = <0>; > + endpoint { > + remote-endpoint = <&usb_hs>; > + }; > + }; > + port@1 { > + reg = <1>; > + endpoint { > + remote-endpoint = <&usb_ss>; > + }; > + }; > + port@2 { > + reg = <2>; > + endpoint { > + remote-endpoint = <&dp_aux>; > + }; > + }; > + }; > + }; > + }; > + > + regulators { > + dsvbst { > + regulator-name = "mt6370-dsv-vbst"; > + regulator-min-microvolt = <4000000>; > + regulator-max-microvolt = <6200000>; > + }; > + dsvpos { > + regulator-name = "mt6370-dsv-vpos"; > + regulator-min-microvolt = <4000000>; > + regulator-max-microvolt = <6000000>; > + regulator-boot-on; > + }; > + dsvneg { > + regulator-name = "mt6370-dsv-vneg"; > + regulator-min-microvolt = <4000000>; > + regulator-max-microvolt = <6000000>; > + regulator-boot-on; > + }; > + vibldo { > + regulator-name = "mt6370-vib-ldo"; > + regulator-min-microvolt = <1600000>; > + regulator-max-microvolt = <4000000>; > + }; > + }; > + }; > + }; > diff --git a/include/dt-bindings/iio/adc/mediatek,mt6370_adc.h b/include/dt-bindings/iio/adc/mediatek,mt6370_adc.h > new file mode 100644 > index 000000000000..18ce2fef8f9e > --- /dev/null > +++ b/include/dt-bindings/iio/adc/mediatek,mt6370_adc.h > @@ -0,0 +1,18 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ Same license as bindings, please. > + > +#ifndef __DT_BINDINGS_MEDIATEK_MT6370_ADC_H__ > +#define __DT_BINDINGS_MEDIATEK_MT6370_ADC_H__ > + > +/* ADC Channel Index */ > +#define MT6370_CHAN_VBUSDIV5 0 > +#define MT6370_CHAN_VBUSDIV2 1 > +#define MT6370_CHAN_VSYS 2 > +#define MT6370_CHAN_VBAT 3 > +#define MT6370_CHAN_TS_BAT 4 > +#define MT6370_CHAN_IBUS 5 > +#define MT6370_CHAN_IBAT 6 > +#define MT6370_CHAN_CHG_VDDP 7 > +#define MT6370_CHAN_TEMP_JC 8 > +#define MT6370_CHAN_MAX 9 > + > +#endif > diff --git a/include/dt-bindings/mfd/mediatek,mt6370.h b/include/dt-bindings/mfd/mediatek,mt6370.h > new file mode 100644 > index 000000000000..df641e5d651f > --- /dev/null > +++ b/include/dt-bindings/mfd/mediatek,mt6370.h > @@ -0,0 +1,83 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ Same license as bindings, please. > + > +#ifndef __DT_BINDINGS_MEDIATEK_MT6370_H__ > +#define __DT_BINDINGS_MEDIATEK_MT6370_H__ > + > +/* IRQ definitions */ > +#define MT6370_IRQ_DIRCHGON 0 > +#define MT6370_IRQ_CHG_TREG 4 These should be IDs, so numbers incremented by one. Holes are not accepted. There is no point in encoding actual hardware numbers which are directly passed to implementation. Just pass the number, not define. Therefore remove entire file. > +#define MT6370_IRQ_CHG_AICR 5 > +#define MT6370_IRQ_CHG_MIVR 6 > +#define MT6370_IRQ_PWR_RDY 7 > +#define MT6370_IRQ_FL_CHG_VINOVP 11 Best regards, Krzysztof