From 5cc35f2295bdf6766d8db4f2c3f5eb26a18e466c Mon Sep 17 00:00:00 2001 From: Kavya Nunna Date: Wed, 10 Mar 2021 15:49:20 +0530 Subject: [PATCH] ARM: dts: msm: Add iio support for pmi632 Add charger and QG support for the targets using pmi632 and pm6125. While at it, also update the pm6125 and pmi632 nodes for msm-5.4. Change-Id: I79641b72c5424708a971273de740233767efd5aa --- qcom/pm6125.dtsi | 41 ++++-------- qcom/pmi632.dtsi | 81 ++++++++--------------- qcom/pmi632_pm6125_iio.dtsi | 127 ++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+), 81 deletions(-) create mode 100644 qcom/pmi632_pm6125_iio.dtsi diff --git a/qcom/pm6125.dtsi b/qcom/pm6125.dtsi index fc8444727f6d..bc79c4423abf 100644 --- a/qcom/pm6125.dtsi +++ b/qcom/pm6125.dtsi @@ -3,6 +3,7 @@ #include #include #include +#include &spmi_bus { #address-cells = <2>; @@ -13,7 +14,7 @@ qcom,pm6125@0 { compatible = "qcom,spmi-pmic"; reg = <0x0 0x0>; - #address-cells = <2>; + #address-cells = <1>; #size-cells = <0>; qcom,power-on@800 { @@ -29,13 +30,13 @@ qcom,pon_1 { qcom,pon-type = ; - qcom,pull-up = <1>; + qcom,pull-up; linux,code = ; }; qcom,pon_2 { qcom,pon-type = ; - qcom,pull-up = <1>; + qcom,pull-up; linux,code = ; }; }; @@ -47,43 +48,42 @@ #size-cells = <0>; interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>; interrupt-names = "eoc-int-en-set"; - qcom,adc-vdd-reference = <1875>; #io-channel-cells = <1>; io-channel-ranges; /* Channel nodes */ ref_gnd { - reg = ; + reg = ; label = "ref_gnd"; qcom,pre-scaling = <1 1>; }; vref_1p25 { - reg = ; + reg = ; label = "vref_1p25"; qcom,pre-scaling = <1 1>; }; die_temp { - reg = ; + reg = ; label = "die_temp"; qcom,pre-scaling = <1 1>; }; vph_pwr { - reg = ; + reg = ; label = "vph_pwr"; qcom,pre-scaling = <1 3>; }; vcoin { - reg = ; + reg = ; label = "vcoin"; qcom,pre-scaling = <1 3>; }; xo_therm { - reg = ; + reg = ; label = "xo_therm"; qcom,ratiometric; qcom,hw-settle-time = <200>; @@ -105,8 +105,9 @@ compatible = "qcom,spmi-temp-alarm"; reg = <0x2400>; interrupts = <0x0 0x24 0x0 IRQ_TYPE_EDGE_BOTH>; + io-channels = <&pm6125_vadc ADC5_DIE_TEMP>; + io-channel-names = "thermal"; #thermal-sensor-cells = <0>; - qcom,temperature-threshold-set = <1>; }; pm6125_clkdiv: clock-controller@5b00 { @@ -117,29 +118,15 @@ clock-output-names = "pm6125_div_clk1"; clocks = <&rpmcc RPM_SMD_XO_CLK_SRC>; clock-names = "xo"; - assigned-clocks = <&pm6125_clkdiv 1>; - assigned-clock-rates = <9600000>; }; pm6125_gpios: pinctrl@c000 { compatible = "qcom,pm6125-gpio"; reg = <0xc000>; - interrupts = <0x0 0xc0 0 IRQ_TYPE_NONE>, - <0x0 0xc1 0 IRQ_TYPE_NONE>, - <0x0 0xc2 0 IRQ_TYPE_NONE>, - <0x0 0xc3 0 IRQ_TYPE_NONE>, - <0x0 0xc4 0 IRQ_TYPE_NONE>, - <0x0 0xc5 0 IRQ_TYPE_NONE>, - <0x0 0xc6 0 IRQ_TYPE_NONE>, - <0x0 0xc7 0 IRQ_TYPE_NONE>, - <0x0 0xc8 0 IRQ_TYPE_NONE>; - interrupt-names = "pm6125_gpio1", "pm6125_gpio2", - "pm6125_gpio3", "pm6125_gpio4", - "pm6125_gpio5", "pm6125_gpio6", - "pm6125_gpio7", "pm6125_gpio8", - "pm6125_gpio9"; gpio-controller; #gpio-cells = <2>; + interrupt-controller; + interrupt-cells = <2>; }; pm6125_rtc: qcom,pm6125_rtc { diff --git a/qcom/pmi632.dtsi b/qcom/pmi632.dtsi index a1b0428668f9..dcab23df597b 100644 --- a/qcom/pmi632.dtsi +++ b/qcom/pmi632.dtsi @@ -11,7 +11,7 @@ qcom,pmi632@2 { compatible = "qcom,spmi-pmic"; reg = <0x2 0x0>; - #address-cells = <2>; + #address-cells = <1>; #size-cells = <0>; pmi632_pon: qcom,power-on@800 { @@ -21,68 +21,65 @@ pmi632_vadc: vadc@3100 { compatible = "qcom,spmi-adc5-lite"; - reg = <0x3100>, <0x3700>; - reg-names = "adc5-usr-base", "adc5-cal-base"; + reg = <0x3100>; #address-cells = <1>; #size-cells = <0>; interrupts = <0x2 0x31 0x0 IRQ_TYPE_EDGE_RISING>; interrupt-names = "eoc-int-en-set"; - qcom,adc-vdd-reference = <1875>; #io-channel-cells = <1>; io-channel-ranges; - qcom,pmic-revid = <&pmi632_revid>; /* Channel nodes */ ref_gnd { - reg = ; + reg = ; label = "ref_gnd"; qcom,pre-scaling = <1 1>; }; vref_1p25 { - reg = ; + reg = ; label = "vref_1p25"; qcom,pre-scaling = <1 1>; }; die_temp { - reg = ; + reg = ; label = "die_temp"; qcom,pre-scaling = <1 1>; }; vph_pwr { - reg = ; + reg = ; label = "vph_pwr"; qcom,pre-scaling = <1 3>; }; vbat_sns { - reg = ; + reg = ; label = "vbat_sns"; qcom,pre-scaling = <1 3>; }; usb_in_i_uv { - reg = ; + reg = ; label = "usb_in_i_uv"; qcom,pre-scaling = <1 1>; }; usb_in_v_div_16 { - reg = ; + reg = ; label = "usb_in_v_div_16"; qcom,pre-scaling = <1 16>; }; chg_temp { - reg = ; + reg = ; label = "chg_temp"; qcom,pre-scaling = <1 1>; }; bat_therm { - reg = ; + reg = ; label = "bat_therm"; qcom,ratiometric; qcom,hw-settle-time = <200>; @@ -90,7 +87,7 @@ }; bat_therm_30k { - reg = ; + reg = ; label = "bat_therm_30k"; qcom,ratiometric; qcom,hw-settle-time = <200>; @@ -98,7 +95,7 @@ }; bat_therm_400k { - reg = ; + reg = ; label = "bat_therm_400k"; qcom,ratiometric; qcom,hw-settle-time = <200>; @@ -106,7 +103,7 @@ }; bat_id { - reg = ; + reg = ; label = "bat_id"; qcom,ratiometric; qcom,hw-settle-time = <200>; @@ -114,23 +111,11 @@ }; i_parallel { - reg = ; + reg = ; label = "i_parallel"; qcom,pre-scaling = <1 1>; }; - v_i_int_ext { - reg = ; - label = "v_i_int_vbat_vdata"; - qcom,pre-scaling = <1 1>; - }; - - v_i_parallel { - reg = ; - label = "v_i_parallel_vbat_vdata"; - qcom,pre-scaling = <1 1>; - }; - }; pmi632_adc_tm: adc_tm@3500 { @@ -147,6 +132,8 @@ compatible = "qcom,spmi-temp-alarm"; reg = <0x2400>; interrupts = <0x2 0x24 0x0 IRQ_TYPE_EDGE_BOTH>; + io-channels = <&pmi632_vadc ADC5_DIE_TEMP>; + io-channel-names = "thermal"; #thermal-sensor-cells = <0>; qcom,temperature-threshold-set = <1>; }; @@ -154,33 +141,22 @@ pmi632_gpios: pinctrl@c000 { compatible = "qcom,pmi632-gpio"; reg = <0xc000>; - interrupts = <0x2 0xc0 0 IRQ_TYPE_NONE>, - <0x2 0xc1 0 IRQ_TYPE_NONE>, - <0x2 0xc2 0 IRQ_TYPE_NONE>, - <0x2 0xc3 0 IRQ_TYPE_NONE>, - <0x2 0xc4 0 IRQ_TYPE_NONE>, - <0x2 0xc5 0 IRQ_TYPE_NONE>, - <0x2 0xc6 0 IRQ_TYPE_NONE>, - <0x2 0xc7 0 IRQ_TYPE_NONE>; - interrupt-names = "pmi632_gpio1", "pmi632_gpio2", - "pmi632_gpio3", "pmi632_gpio4", - "pmi632_gpio5", "pmi632_gpio6", - "pmi632_gpio7", "pmi632_gpio8"; gpio-controller; #gpio-cells = <2>; + interrupt-controller; + interrupt-cells = <2>; }; pmi632_charger: qcom,qpnp-smb5 { compatible = "qcom,qpnp-smb5"; #address-cells = <1>; - #size-cells = <1>; + #size-cells = <0>; #cooling-cells = <2>; - qcom,pmic-revid = <&pmi632_revid>; - io-channels = <&pmi632_vadc ADC_USB_IN_V_16>, - <&pmi632_vadc ADC_USB_IN_I>, - <&pmi632_vadc ADC_CHG_TEMP>, - <&pmi632_vadc ADC_DIE_TEMP>; + io-channels = <&pmi632_vadc ADC5_USB_IN_V_16>, + <&pmi632_vadc ADC5_USB_IN_I>, + <&pmi632_vadc ADC5_CHG_TEMP>, + <&pmi632_vadc ADC5_DIE_TEMP>; io-channel-names = "usb_in_voltage", "usb_in_current", "chg_temp", @@ -340,11 +316,10 @@ pmi632_qg: qpnp,qg { compatible = "qcom,qpnp-qg"; #address-cells = <1>; - #size-cells = <1>; + #size-cells = <0>; - qcom,pmic-revid = <&pmi632_revid>; - io-channels = <&pmi632_vadc ADC_BAT_THERM_PU2>, - <&pmi632_vadc ADC_BAT_ID_PU2>; + io-channels = <&pmi632_vadc ADC5_BAT_THERM_100K_PU>, + <&pmi632_vadc ADC5_BAT_ID_100K_PU>; io-channel-names = "batt-therm", "batt-id"; @@ -485,7 +460,6 @@ interrupts = <0x3 0xec 0x1 IRQ_TYPE_EDGE_RISING>; interrupt-names = "sc-irq"; - qcom,pmic-revid = <&pmi632_revid>; qcom,voltage-step-ramp; lcdb_ldo_vreg: ldo { @@ -527,7 +501,6 @@ qcom,thermal-derate-en; qcom,thermal-derate-current = <200 500 1000>; qcom,isc-delay = <192>; - qcom,pmic-revid = <&pmi632_revid>; pmi632_flash0: qcom,flash_0 { label = "flash"; diff --git a/qcom/pmi632_pm6125_iio.dtsi b/qcom/pmi632_pm6125_iio.dtsi new file mode 100644 index 000000000000..8e5da5b359ab --- /dev/null +++ b/qcom/pmi632_pm6125_iio.dtsi @@ -0,0 +1,127 @@ +#include +#include +#include +#include +#include "pmi632.dtsi" +#include "pm6125.dtsi" + +&soc { + mtp_batterydata: qcom,battery-data { + qcom,batt-id-range-pct = <15>; + #include "qg-batterydata-alium-3600mah.dtsi" + }; +}; + +&pmi632_gpios { + smb_en { + smb_en_default: smb_en_default { + pins = "gpio2"; + function = "func1"; + output-enable; + }; + }; + + pmi632_sense { + /* GPIO 7 and 8 are external-sense pins for PMI632 */ + pmi632_sense_default: pmi632_sense_default { + pins = "gpio7", "gpio8"; + bias-high-impedance; /* disable the GPIO */ + bias-disable; /* no-pull */ + }; + }; + + pmi632_ctm { + /* Disable GPIO1 for h/w base mitigation */ + pmi632_ctm_default: pmi632_ctm_default { + pins = "gpio1"; + bias-high-impedance; /* disable the GPIO */ + bias-disable; /* no-pull */ + }; + }; +}; + +&pmi632_charger { + status = "ok"; + #io-channel-cells = <1>; + io-channels = <&pmi632_vadc ADC5_USB_IN_V_16>, + <&pmi632_vadc ADC5_USB_IN_I>, + <&pmi632_vadc ADC5_CHG_TEMP>, + <&pmi632_vadc ADC5_DIE_TEMP>; + <&pmi632_qg PSY_IIO_RESISTANCE_ID>, + <&pmi632_qg PSY_IIO_VOLTAGE_NOW>, + <&pmi632_qg PSY_IIO_TEMP>, + <&pmi632_qg PSY_IIO_CAPACITY>, + <&pmi632_qg PSY_IIO_VOLTAGE_OCV>, + <&pmi632_qg PSY_IIO_VOLTAGE_AVG>, + <&pmi632_qg PSY_IIO_DEBUG_BATTERY>, + <&pmi632_qg PSY_IIO_REAL_CAPACITY>, + <&pmi632_qg PSY_IIO_CC_SOC>, + <&pmi632_qg PSY_IIO_CURRENT_NOW>, + <&pmi632_qg PSY_IIO_VOLTAGE_MAX>, + <&pmi632_qg PSY_IIO_CHARGE_FULL>, + <&pmi632_qg PSY_IIO_CHARGE_COUNTER>, + <&pmi632_qg PSY_IIO_CYCLE_COUNT>, + <&pmi632_qg PSY_IIO_CHARGE_FULL_DESIGN>, + <&pmi632_qg PSY_IIO_TIME_TO_FULL_NOW>, + io-channel-names = "usb_in_voltage", + "usb_in_current", + "chg_temp", + "die_temp", + "resistance_id", + "voltage_now", + "temp", + "capacity", + "voltage_ocv", + "voltage_avg", + "debug_battery", + "real_capacity", + "cc_soc", + "current_now", + "voltage_max", + "charge_full", + "charge_counter", + "cycle_count", + "charge_full_design", + "time_to_full_now", + qcom,battery-data = <&mtp_batterydata>; + qcom,suspend-input-on-debug-batt; + qcom,sw-jeita-enable; + qcom,step-charging-enable; + qcom,hvdcp2-max-icl-ua = <2000000>; + /* SMB1355 only */ + qcom,sec-charger-config = <2>; + dpdm-supply = <&qusb_phy0>; + qcom,charger-temp-max = <800>; + qcom,smb-temp-max = <800>; + qcom,auto-recharge-soc = <98>; + qcom,flash-disable-soc = <10>; + qcom,hw-die-temp-mitigation; + qcom,hw-connector-mitigation; + qcom,connector-internal-pull-kohm = <100>; + qcom,float-option = <1>; + qcom,thermal-mitigation = <3000000 2500000 + 2000000 1500000 1000000 500000>; +}; + +&pmi632_qg { + status = "ok"; + #io-channel-cells = <1>; + io-channels = <&pmi632_vadc ADC5_BAT_THERM_100K_PU>, + <&pmi632_vadc ADC5_BAT_ID_100K_PU>; + <&pmi632_charger PSY_IIO_INPUT_CURRENT_LIMITED>, + <&pmi632_charger PSY_IIO_RECHARGE_SOC>, + <&pmi632_charger PSY_IIO_FORCE_RECHARGE>, + <&pmi632_charger PSY_IIO_CHARGE_DONE>, + io-channel-names = "batt-therm", + "batt-id", + "input_current_limited", + "recharge_soc", + "force_recharge", + "charge_done", + "cp_charging_enabled"; + qcom,battery-data = <&mtp_batterydata>; + qcom,qg-iterm-ma = <100>; + qcom,hold-soc-while-full; + qcom,linearize-soc; + qcom,qg-use-s7-ocv; +};