From 6428a5058cd96e7d560c7bf3c70b9bcbe033f5f4 Mon Sep 17 00:00:00 2001 From: wutao Date: Sun, 14 Nov 2021 14:36:41 +0800 Subject: [PATCH] arm/dts: add charger and fg and tcpc dts add charger and fgauge and cc logic and qc logic dts for charging bring up Change-Id: I5cfeed25f05d03b134408db924cb070a9e6f26be Signed-off-by: wutao Reviewed-on: https://gerrit.mot.com/2114586 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- qcom/blair-rhodep-common-overlay.dtsi | 2 +- qcom/discrete_charging_rhodep.dtsi | 323 ++++++++++++++++++++++++++ 2 files changed, 324 insertions(+), 1 deletion(-) create mode 100644 qcom/discrete_charging_rhodep.dtsi diff --git a/qcom/blair-rhodep-common-overlay.dtsi b/qcom/blair-rhodep-common-overlay.dtsi index b96c22364681..d5b0902d0fc8 100644 --- a/qcom/blair-rhodep-common-overlay.dtsi +++ b/qcom/blair-rhodep-common-overlay.dtsi @@ -26,7 +26,7 @@ #include "rhodep-wl286xx.dtsi" #include "tcpc_config.dtsi" #include "sgm7220.dtsi" -#include "discrete_charging.dtsi" +#include "discrete_charging_rhodep.dtsi" #include "discrete-rt-pd-manger.dtsi" diff --git a/qcom/discrete_charging_rhodep.dtsi b/qcom/discrete_charging_rhodep.dtsi new file mode 100644 index 000000000000..a5e29d50ea33 --- /dev/null +++ b/qcom/discrete_charging_rhodep.dtsi @@ -0,0 +1,323 @@ +/* Copyright (c) 2021, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + + +&pm6125_vadc { + gpio6_div3{ + reg = ; + label = "gpio3_div3"; + qcom,pre-scaling = <1 3>; + }; +}; + +&pm6125_gpios { + gpio6_adc{ + gpio6_adc_default:gpio6_adc_default{ + pins = "gpio6"; + function = "normal"; + bias-high-impedance; + }; + }; + + indicator_led { + indicator_led_default: indicator_led_default { + pins = "gpio8"; + function = "func1"; + output-low; + }; + }; +}; + +&soc { + indicator_led { + compatible = "qcom,indicator-pwm-led"; + pinctrl-names = "default"; + pinctrl-0 = <&indicator_led_default>; + indicator_led { + label = "charging"; + led-sources = <0>; + pwms = <&pm6125_pwm 0 1000000>; + linux,default-trigger = "timer"; + }; + }; +}; + +&spmi_bus { + qcom,pm6125@1 { + #address-cells = <1>; + qcom,pwms@b300 { + status = "ok"; + }; + }; +}; + +&qupv3_se10_i2c { + status = "okay"; + bq2597x-charger@65 { + compatible = "ti,bq25970-charger"; + reg = <0x65>; + //ti,bq2597x,interrupt_gpios = <&pio 30 0>; + //interrupt-parent = <&pio>; + //interrupts = <2 IRQ_TYPE_EDGE_FALLING 2 0>; + //interrupt-names = "bq2597x_irq"; + + //pinctrl-names = "default_slave"; + //pinctrl-0 = <&bq2597x_int_default_slave>; + interrupt-parent = <&tlmm>; + interrupts = <84 0>; //irq num base on hardware design + bq2597x,irq-gpio = <&tlmm 84 0>; //irq num base on hardware design + + ti,bq2597x,bat-ovp-disable = <0>; + ti,bq2597x,bat-ocp_disable = <0>; + ti,bq2597x,bat-ovp-alarm-disable = <0>; + ti,bq2597x,bus-ocp-disable = <0>; + ti,bq2597x,bus-ovp-alarm-disable = <0>; + ti,bq2597x,bus-ocp-alarm-disable = <0>; + ti,bq2597x,bat-ucp-alarm-disable = <0>; + ti,bq2597x,bat-therm-disable = <0>; + ti,bq2597x,bus-therm-disable = <0>; + + ti,bq2597x,bat-ovp-threshold = <4500>; + ti,bq2597x,bat-ovp-alarm-threshold = <4450>; + ti,bq2597x,bat-ocp-threshold = <8000>; + ti,bq2597x,bat-ocp-alarm-threshold = <7500>; + + ti,bq2597x,bus-ovp-threshold = <12000>; + ti,bq2597x,bus-ovp-alarm-threshold = <11000>; + ti,bq2597x,bus-ocp-threshold = <3750>; + ti,bq2597x,bus-ocp-alarm-threshold = <3500>; + + ti,bq2597x,bat-ucp-alarm-threshold = <2000>; + + ti,bq2597x,bat-therm-threshold = <0x15>; + ti,bq2597x,bus-therm-threshold = <0x15>; + ti,bq2597x,die-therm-threshold = <125>; + + ti,bq2597x,ac-ovp-threshold = <17>; + ti,bq2597x,sense-resistor-mohm = <5>; + }; +}; + +&qupv3_se8_i2c { + status = "okay"; + + sgm4154x: sgm4154x@3B { + status = "okay"; + compatible = "sgm,sgm41542"; + reg = <0x3B>; + + pinctrl-names = "default"; + pinctrl-0 = <&gpio6_adc_default>; + io-channels = <&pm6125_vadc ADC5_GPIO3_DIV3>; + io-channel-names = "gpio3_div3"; + + interrupt-parent = <&tlmm>; + interrupts = <12 0>; //irq num base on hardware design + sgm,irq-gpio = <&tlmm 12 0>; //irq num base on hardware design + //sgm,chg-en-gpio = <&tlmm 92 0>; //gpio num base on hardware design 1.MTK parent node name is pio 2.QUALCOMM parent node name is tlmm or other + + dpdm-supply = <&usb2_phy0>; + mmi,qc3-support; + + /* sw jeita parameter customer defined*/ + enable_sw_jeita; + jeita_temp_above_t4_cv = <0>; + jeita_temp_t3_to_t4_cv = <4100000>; + jeita_temp_t2_to_t3_cv = <4350000>; + jeita_temp_t1_to_t2_cv = <4350000>; + jeita_temp_t0_to_t1_cv = <0>; + jeita_temp_below_t0_cv = <0>; + + jeita_temp_above_t4_cc_current = <0>; + jeita_temp_t3_to_t4_cc_current = <1000000>; + jeita_temp_t2_to_t3_cc_current = <1250000>; + jeita_temp_t1_to_t2_cc_current = <1000000>; + jeita_temp_below_t0_cc_current = <0>; + + temp_t4_thres = <50>; + temp_t4_thres_minus_x_degree = <48>; + temp_t3_thres = <45>; + temp_t3_thres_minus_x_degree = <45>; + temp_t2_thres = <20>; + temp_t2_thres_plus_x_degree = <15>; + temp_t1_thres = <0>; + temp_t1_thres_plus_x_degree = <0>; + temp_t0_thres = <0>; + temp_t0_thres_plus_x_degree = <2>; + temp_neg_10_thres = <0>; + }; + + bq25890@62 { + status = "okay"; + compatible = "ti,bq2589x-1"; + reg = <0x62>; + + pinctrl-names = "default"; + pinctrl-0 = <&bq2589x_irq &gpio6_adc_default>; + io-channels = <&pm6125_vadc ADC5_GPIO3_DIV3>; + io-channel-names = "gpio3_div3"; + + bq2589x_irq-gpio = <&tlmm 12 0>; + //bq2589x_en-gpio = <&tlmm 92 0>; + dpdm-supply = <&usb2_phy0>; + + mmi,qc3-support; + ti,bq2589x,vbus-volt-high-level = <8700>;/* tune adapter to output 9v */ + ti,bq2589x,vbus-volt-low-level = <4400>;/* tune adapter to output 5v */ + ti,bq2589x,vbat-min-volt-to-tuneup = <3000>; + ti,bq2589x,charge-voltage = <4450>; + ti,bq2589x,charge-current = <3000>; + ti,bq2589x,term-current = <128>; + ti,bq2589x,enable-auto-dpdm; + ti,bq2589x,enable-termination; + ti,bq2589x,enable-ico; + ti,bq2589x,use-absolute-vindpm; + }; + + wt6670f@35 { + status = "okay"; + compatible = "mediatek,wt6670f_qc3p"; + reg = <0x35>; + wt6670f-reset-gpio = <&tlmm 56 0x0>; + wt6670f-int-gpio = <&tlmm 85 0x0>; + //wt6670f-i2c-scl-pin = <&tlmm 1 0x0>; + //wt6670f-i2c-sda-pin = <&tlmm 0 0x0>; + + //pinctrl-names = "default", + //"wt6670_i2c_scl_low", "wt6670_i2c_scl_high", + //"wt6670_i2c_sda_low", "wt6670_i2c_sda_high", + //"wt6670_i2c"; + + //pinctrl-0 = <&wt6670_pins_default>; + //pinctrl-1 = <&wt6670_pins_scl_low>; + //pinctrl-2 = <&wt6670_pins_scl_high>; + //pinctrl-3 = <&wt6670_pins_sda_low>; + //pinctrl-4 = <&wt6670_pins_sda_high>; + //pinctrl-5 = <&wt6670_pins_i2c>; + }; +}; + +&tlmm { + bq2589x_irq: bq2589x_irq { + mux { + pins = "gpio12"; + function = "gpio"; + }; + + config { + pins = "gpio12"; + drive-strength = <2>; + bias-disable; + input-enable; + }; + }; + //add wt6670 pins + wt6670_pins_default: wt6670_default_mode { + }; + wt6670_pins_scl_low: wt6670_scl_low { + mux { + pins = "gpio1"; + function = "gpio"; + }; + + config { + pins = "gpio1"; + drive-strength = <2>; + bias-pull-down; + }; + }; + wt6670_pins_scl_high: wt6670_scl_high { + mux { + pins = "gpio1"; + function = "gpio"; + }; + + config { + pins = "gpio1"; + drive-strength = <2>; + bias-pull-up; + output-high; + }; + }; + wt6670_pins_sda_low: wt6670_sda_low { + mux { + pins = "gpio0"; + function = "gpio"; + }; + + config { + pins = "gpio0"; + drive-strength = <2>; + bias-pull-down; + }; + }; + wt6670_pins_sda_high: wt6670_sda_high { + mux { + pins = "gpio0"; + function = "gpio"; + }; + + config { + pins = "gpio0"; + drive-strength = <2>; + bias-pull-up; + output-high; + }; + }; +/* + wt6670_pins_i2c: wt6670_i2c_mode { + pins_cmd_dat { + pinmux = , + ; + }; + }; +*/ +}; + +&soc { + mmi_charger: mmi,charger { + status = "ok"; + compatible = "mmi,mmi-charger"; + mmi,enable-charging-limit; + mmi,upper-limit-capacity = <65>; + mmi,lower-limit-capacity = <60>; + mmi,heartbeat-interval = <100000>; + mmi,dcp-power-max = <10000>; + mmi,hvdcp-power-max = <15000>; + }; + + mmi_discrete_charger: mmi,discrete-charging { + status = "ok"; + compatible = "mmi,mmi-discrete-charger"; + #io-channel-cells = <1>; + battery-names = "battery"; + supplied-from = "mmi_battery"; + + mmi,chrg-iterm-ma = <243>; + mmi,fg-iterm-ma = <500>; + mmi,max-fv-mv = <4450>; + mmi,max-fcc-ma = <3000>; + mmi,demo-fv-mv = <4000>; + mmi,otg-cl-ua = <2000000>; + mmi,df-serialnum = "SB18D33989"; + mmi,mmi-temp-zones = <0 4200 970 0>, + <10 4200 2500 970>, + <15 0 2500 2500>, + <45 0 3000 3000>, + <60 4200 2500 0>; + mmi,thermal-mitigation = <3000000 2500000 + 2000000 1500000 + 1200000 900000 + 600000 300000>; + }; +}; +