Loading Documentation/devicetree/bindings/power/supply/qcom/qpnp-linear-charger.txt 0 → 100644 +211 −0 Original line number Diff line number Diff line Qualcomm QPNP Linear Charger The charger module supports the linear battery charger peripherals on Qualcomm PMIC chips. There are four different peripherals in the charger module. Each of these peripherals are implemented as subnodes. - qcom,chgr: Supports charging control and status reporting - qcom,bat-if: Battery status reporting such as presence and temperature reporting. - qcom,usb-chgpth: USB charge path detection and input current limiting configuration. - qcom,chg-misc: Miscellaneous features such as comparator override features etc. Parent node required properties: - qcom,vddmax-mv: Target voltage of battery in mV. - qcom,vddsafe-mv: Maximum Vdd voltage in mV. - qcom,vinmin-mv: Minimum input voltage in mV. - qcom,ibatsafe-ma: Safety battery current setting Parent node optional properties: - qcom,vbatweak-uv: Weak battery voltage threshold in uV, above which fast charging can start. The supported voltage range is from 3000000uV to 3581250uV with a step size of 18750000 uV. - qcom,charging-disabled: Set this property to disable charging by default. - qcom,use-default-batt-values: Set this flag to force reporting of fake battery. - qcom,warm-bat-decidegc: Warm battery temperature in decidegC. - qcom,cool-bat-decidegc: Cool battery temperature in decidegC. Note that if both warm and cool battery temperatures are set, the corresponding ibatmax and bat-mv properties are required to be set. - qcom,ibatmax-cool-ma: Maximum cool battery charge current. - qcom,ibatmax-warm-ma: Maximum warm battery charge current. - qcom,warm-bat-mv: Warm temperature battery target voltage. - qcom,cool-bat-mv: Cool temperature battery target voltage. - qcom,thermal-mitigation: Array of ibatmax values for different system thermal mitigation level. - qcom,tchg-mins: Maximum total software initialized charge time. - qcom,bpd-detection: Select a battery presence detection scheme by specifying either "bpd_thm" "bpd_id" or "bpd_thm_id". "bpd_thm" selects the temperature pin, "bpd_id" uses the id pin for battery presence detection, "bpd_thm_id" selects both. If the property is not set, the temperatue pin will be used. - qcom,btc-disabled: If flag is set battery hot and cold monitoring is disabled in hardware. This monitoring is turned on by default. - qcom,batt-hot-percentage: Specify a supported hot threshold percentage. Supported thresholds: 25% and 35%. If none is specified hardware defaults will be used. - qcom,batt-cold-percentage: Specify a supported cold threshold percentage. Supported thresholds: 70% and 80%. If none is specified hardwaredefaults will be used. - qcom,chg-adc_tm Corresponding ADC TM device's phandle to set recurring measurements and receive notification for batt_therm. -qcom,float-charge If specified enable float charging. - qcom,chg-vadc Corresponding VADC device's phandle. - qcom,charger-detect-eoc If specified charger hardware will detect end-of-charge. If not specified charger driver depends on BMSfor end-of-charge detection. - qcom,disable-vbatdet-based-recharge If specified disable VBATDET irq and charging can only be resumed if charger is re-inserted or SOC falls below resume SOC. This property should always be used along with the BMS property: "qcom,disable-suspend-on-usb". - qcom,use-external-charger If specified the LBC module will be disabled and the driver will not register. It also enables BID for BPD and disables BTC. Declare this node only if you are using an external charger and not the PMIC internal LBC. - qcom,chgr-led-support There is a current sink device in linear charger module, it is used to control a led which can act as a charger led as well as a general notification led. - qcom,parallel-charger This is a bool property to indicate the LBC will operate as a secondary charger in the parallel mode. If this is enabled the charging operations will be controlled by the primary-charger. - qcom,collapsible-chgr-support If specified the collapsible charger feature will be supported. LBC will disable VIN_MIN comparator and use chg_gone interrupt to detect charger removal. Sub node required structure: - A qcom,charger node must be a child of an SPMI node that has specified the spmi-dev-container property. Each subnode reflects a hardware peripheral which adds a unique set of features to the collective charging device. For example USB detection and the battery interface are each separate peripherals and each should be their own subnode. Sub node required properties: - compatible: Must be "qcom,qpnp-linear-charger". - reg: Specifies the SPMI address and size for this peripheral. - interrupts: Specifies the interrupt associated with the peripheral. - interrupt-names: Specifies the interrupt names for the peripheral. Every available interrupt needs to have an associated name with it to indentify its purpose. The following lists each subnode and their corresponding required interrupt names: qcom,usb-chgpth: - usbin-valid The following interrupts are available: qcom,usb-chgpth: - usbin-valid: Indicates valid USB connection. - coarse-det-usb: Coarse detect interrupt triggers at low voltage on USB_IN. - chg-gone: Triggers on VCHG line. - overtemp: Triggers on over temperature condition qcom,chgr: - chg-done: Triggers on charge completion. - chg-failed: Notifies of charge failures. - fast-chg-on: Notifies of fast charging. - vbat-det-lo: Triggers on vbat-det-lo voltage. Example: pm8916-chg: qcom,charger { spmi-dev-container; compatible = "qcom,qpnp-linear-charger"; #address-cells = <1>; #size-cells = <1>; qcom,vddmax-mv = <4200>; qcom,vddsafe-mv = <4200>; qcom,vinmin-mv = <4200>; qcom,ibatsafe-ma = <1440>; qcom,vbatweak-uv = <3200>; qcom,thermal-mitigation = <1500 700 600 325>; qcom,cool-bat-decidegc = <100>; qcom,warm-bat-decidegc = <450>; qcom,cool-bat-mv = <4100>; qcom,ibatmax-warm-ma = <360>; qcom,ibatmax-cool-ma = <360>; qcom,warm-bat-mv = <4100>; qcom,batt-hot-percentage = <25>; qcom,batt-cold-percentage = <85>; qcom,tchg-mins = <152>; qcom,resume-soc = <99>; qcom,btc-disabled = <0>; qcom,chg-vadc = <&pm8916_vadc>; qcom,chgr@1000 { reg = <0x1000 0x100>; interrupts = <0x0 0x10 0x7>, <0x0 0x10 0x6>, <0x0 0x10 0x5>, <0x0 0x10 0x0>; interrupt-names = "chg-done", "chg-failed", "fast-chg-on", "vbat-det-lo"; }; qcom,bat-if@1200 { reg = <0x1200 0x100>; interrupts = <0x0 0x12 0x1>, <0x0 0x12 0x0>; interrupt-names = "bat-temp-ok", "batt-pres"; }; qcom,usb-chgpth@1300 { reg = <0x1300 0x100>; interrupts = <0 0x13 0x2>, <0 0x13 0x1>; interrupt-names = "chg-gone", "usbin-valid"; }; qcom,chg-misc@1600 { reg = <0x1600 0x100>; }; }; Documentation/devicetree/bindings/power/supply/qcom/qpnp-vm-bms.txt 0 → 100644 +180 −0 Original line number Diff line number Diff line Qualcomm's QPNP Voltage-Mode(VM) PMIC Battery Management System QPNP PMIC VM BMS provides interface to clients to read properties related to the battery. Its main function is to calculate the SOC (state of charge) of the battery based on periodic sampling of the VBAT (battery voltage). Parent node required properties: - compatible : Must be "qcom,qpnp-vm-bms" for the BM driver. - reg : Offset and length of the PMIC peripheral register map. - interrupts : The interrupt mappings. The format should be <slave-id peripheral-id interrupt-number>. - interrupt-names : names for the mapped bms interrupt The following interrupts are required: 0 : leave CV state 1 : enter CV state 2 : good ocv generated 3 : ocv_thr 4 : fifo update 5 : fsm state chnaged Additionally, optional subnodes may be included: - qcom,batt-pres-status : A subnode with a register address for the SMBB battery interface's BATT_PRES_STATUS register. If this node is added, then the BMS will try to detect offmode battery removal via the battery interface's offmode battery removal circuit. - qcom,battery-data : A phandle to a node containing the available batterydata profiles. See the batterydata bindings documentation for more details. Parent node required properties: - qcom,v-cutoff-uv : cutoff voltage where the battery is considered dead in micro-volts. - qcom,max-voltage-uv : maximum voltage for the battery in micro-volts. - qcom,r-conn-mohm : connector resistance in milli-ohms. - qcom,shutdown-soc-valid-limit : If the ocv upon restart is within this distance of the shutdown ocv, the BMS will try to force the new SoC to the old one to provide charge continuity. That is to say, if (abs(shutdown-soc - current-soc) < limit) then use old SoC. - qcom,low-soc-calculate-soc-threshold : The SoC threshold for when the periodic calculate_soc work speeds up. This ensures SoC is updated in userspace constantly when we are near shutdown. - qcom,low-voltage-threshold : The battery voltage threshold in micro-volts for when the BMS tries to wake up and hold a wakelock to ensure a clean shutdown. - qcom,low-voltage-calculate-soc-ms : The time period between subsequent SoC recalculations when the current voltage is below qcom,low-voltage threshold. This takes precedence over qcom,low-soc-calculate-soc-ms. - qcom,low-soc-calculate-soc-ms : The time period between subsequent SoC recalculations when the current SoC is below qcom,low-soc-calculate-soc-threshold. This takes precedence over qcom,calculate-soc-ms. - qcom,calculate-soc-ms : The time period between subsequent SoC recalculations when the current SoC is above or equal qcom,low-soc-calculate-soc-threshold. - qcom,volatge-soc-timeout-ms : The timeout period after which the module starts reporting volage based SOC and does not use the VMBMS algorithm for SOC calculation. - qcom,bms-vadc: Corresponding VADC device's phandle. - qcom,bms-adc_tm: Corresponding ADC_TM device's phandle to set recurring measurements and receive notifications for vbatt. - qcom,pmic-revid : Phandle pointing to the revision peripheral node. Parent node Optional properties - qcom,s1-sample-interval-ms: The sampling rate in ms of the accumulator in state S1. (i.e) the rate at which the accumulator is being filled with vbat samples. Minimum value = 0 and Maximum value = 2550ms. - qcom,s2-sample-interval-ms: The sampling rate in ms of the accumulator in state S2. (i.e) the rate at which the accumulator is being filled with vbat samples. Minimum value = 0 and Maximum value = 2550ms. - qcom,s1-sample-count: The number of samples to be accululated for one FIFO in state S1. Possible values are - 0, 4, 8, 16, 32, 64, 128, 256. - qcom,s2-sample-count: The number of samples to be accululated for one FIFO in state S2. Possible values are - 0, 4, 8, 16, 32, 64, 128, 256. - qcom,s1-fifo-legth: Number of FIFO's to be filled in state S1, to generate the fifo_update_done interrupt. Possile values - 0 to 8 - qcom,s2-fifo-legth: Number of FIFO's to be filled in state S2, to generate the fifo_update_done interrupt. Possible values- 0 to 8 - qcom,force-s3-on-suspend : Bool property to force the BMS into S3 (sleep) state while entering into system suspend. - qcom,force-bms-active-on-charger: Bool property to keep BMS FSM active if charger is present. - qcom,report-charger-eoc : Bool property to indicate if BMS needs to indicate EOC to charger. - qcom,ignore-shutdown-soc: A boolean that controls whether BMS will try to force the startup SoC to be the same as the shutdown SoC. Defining it will make BMS ignore the shutdown SoC. - qcom,use-voltage-soc : A boolean that controls whether BMS will use voltage-based SoC instead of a coulomb counter based one. Voltage-based SoC will not guarantee linearity. - qcom,disable-bms : Bool property to disable the VMBMS hardware module. Enable this property if BMS is not supported or an external fuel gauge is used. - qcom,s3-ocv-tolerence-uv : The S3 state OCV tolerence threshold in uV. The LSB value is 300uV and maximum value is 76500uV. - qcom,low-soc-fifo-length : The fifo length (of S2 STATE) to be used at lower SOCs. If this value is not specified the system uses default length. - qcom,resume-soc: Capacity in percent at which charging should resume when a fully charged battery drops below this level. - qcom,low-temp-threshold : The temperature threshold below which the IBAT averaging and UUC smoothening is disabled. This value is in deci-degrees centigrade. If not specified it defaults to 0. - qcom,ibat-avg-samples : The number of samples to be averaged for IBAT estimation. If not specified it defaults to 16. The possible values are 1 to 16. - qcom,batt-aging-comp : A boolean that defines if battery aging compensation is enabled. - qcom,use-reported-soc : Bool property to enable the reported_soc logic. To enable this feature, qcom,resume-soc must be defined as a proper value. The BMS is also required to control the charging, discharging and recharging. qcom,batt-pres-status node required properties: - reg : offset and length of the PMIC LBC battery interface BATT_PRES_STATUS register. qcom,qpnp-chg-pres required properties: - reg : offset and length of the PMIC LBC charger interafce CHARGER_OPTION register. Example: pm8916_bms: qcom,qpnp-vm-bms { spmi-dev-container; compatible = "qcom,qpnp-vm-bms"; #address-cells = <1>; #size-cells = <1>; status = "disabled"; qcom,v-cutoff-uv = <3400000>; qcom,max-voltage-uv = <4200000>; qcom,r-conn-mohm = <18>; qcom,shutdown-soc-valid-limit = <20>; qcom,low-soc-calculate-soc-threshold = <15>; qcom,low-voltage-threshold = <3420000>; qcom,low-voltage-calculate-soc-ms = <1000>; qcom,low-soc-calculate-soc-ms = <5000>; qcom,low-soc-fifo-length = <2>; qcom,calculate-soc-ms = <20000>; qcom,s3-ocv-tolerence-uv = <1200>; qcom,volatge-soc-timeout-ms = <60000>; qcom,battery-data = <&mtp_batterydata>; qcom,bms-vadc = <&pm8916_vadc>; qcom,bms-adc_tm = <&pm8916_adc_tm>; qcom,batt-pres-status@1208 { reg = <0x1208 0x1>; } qcom,qpnp-chg-pres@1208 { reg = <0x1108 0x1>; } qcom,bms-bms@4000 { reg = <0x4000 0x100>; interrupts = <0x0 0x40 0x0>, <0x0 0x40 0x1>, <0x0 0x40 0x2>, <0x0 0x40 0x3>, <0x0 0x40 0x4>, <0x0 0x40 0x5>, interrupt-names = "leave_cv", "enter_cv", "good_ocv", "ocv_thr", "fifo_updtaed", "fsm_state_change"; }; }; Documentation/devicetree/bindings/power/smb1360-charger-fg.txt→Documentation/devicetree/bindings/power/supply/qcom/smb1360-charger-fg.txt +0 −0 File moved. View file arch/arm64/boot/dts/qcom/pm8916.dtsi +115 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,121 @@ qcom,pmic-revid = <&pm8916_revid>; }; pm8916_chg: qcom,charger { compatible = "qcom,qpnp-linear-charger"; #address-cells = <1>; #size-cells = <1>; qcom,vddmax-mv = <4200>; qcom,vddsafe-mv = <4200>; qcom,vinmin-mv = <4308>; qcom,ibatsafe-ma = <1440>; qcom,thermal-mitigation = <1440 720 630 0>; qcom,cool-bat-decidegc = <100>; qcom,warm-bat-decidegc = <450>; qcom,cool-bat-mv = <4100>; qcom,warm-bat-mv = <4100>; qcom,ibatmax-warm-ma = <360>; qcom,ibatmax-cool-ma = <360>; qcom,batt-hot-percentage = <25>; qcom,batt-cold-percentage = <80>; qcom,tchg-mins = <232>; qcom,resume-soc = <99>; qcom,chg-vadc = <&pm8916_vadc>; qcom,chg-adc_tm = <&pm8916_adc_tm>; status = "disabled"; qcom,chgr@1000 { reg = <0x1000 0x100>; interrupts = <0x0 0x10 0x7 IRQ_TYPE_EDGE_RISING>, <0x0 0x10 0x6 IRQ_TYPE_EDGE_RISING>, <0x0 0x10 0x5 IRQ_TYPE_EDGE_BOTH>, <0x0 0x10 0x0 IRQ_TYPE_EDGE_FALLING>; interrupt-names = "chg-done", "chg-failed", "fast-chg-on", "vbat-det-lo"; }; qcom,bat-if@1200 { reg = <0x1200 0x100>; interrupts = <0x0 0x12 0x1 IRQ_TYPE_EDGE_BOTH>, <0x0 0x12 0x0 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "bat-temp-ok", "batt-pres"; }; qcom,usb-chgpth@1300 { reg = <0x1300 0x100>; interrupts = <0 0x13 0x4 IRQ_TYPE_EDGE_BOTH>, <0 0x13 0x2 IRQ_TYPE_EDGE_RISING>, <0 0x13 0x1 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "usb-over-temp", "chg-gone", "usbin-valid"; }; qcom,chg-misc@1600 { reg = <0x1600 0x100>; }; }; pm8916_bms: qcom,vmbms { compatible = "qcom,qpnp-vm-bms"; #address-cells = <1>; #size-cells = <1>; status = "disabled"; qcom,v-cutoff-uv = <3400000>; qcom,max-voltage-uv = <4200000>; qcom,r-conn-mohm = <0>; qcom,shutdown-soc-valid-limit = <100>; qcom,low-soc-calculate-soc-threshold = <15>; qcom,low-voltage-calculate-soc-ms = <1000>; qcom,low-soc-calculate-soc-ms = <5000>; qcom,calculate-soc-ms = <20000>; qcom,volatge-soc-timeout-ms = <60000>; qcom,low-voltage-threshold = <3450000>; qcom,s3-ocv-tolerence-uv = <1200>; qcom,s2-fifo-length = <5>; qcom,low-soc-fifo-length = <2>; qcom,bms-vadc = <&pm8916_vadc>; qcom,bms-adc_tm = <&pm8916_adc_tm>; qcom,pmic-revid = <&pm8916_revid>; qcom,force-s3-on-suspend; qcom,force-s2-in-charging; qcom,report-charger-eoc; qcom,batt-pres-status@1208 { reg = <0x1208 0x1>; }; qcom,qpnp-chg-pres@1008 { reg = <0x1008 0x1>; }; qcom,vm-bms@4000 { reg = <0x4000 0x100>; interrupts = <0x0 0x40 0x0 IRQ_TYPE_NONE>, <0x0 0x40 0x1 IRQ_TYPE_NONE>, <0x0 0x40 0x2 IRQ_TYPE_NONE>, <0x0 0x40 0x3 IRQ_TYPE_NONE>, <0x0 0x40 0x4 IRQ_TYPE_NONE>, <0x0 0x40 0x5 IRQ_TYPE_NONE>; interrupt-names = "leave_cv", "enter_cv", "good_ocv", "ocv_thr", "fifo_update_done", "fsm_state_change"; }; }; pm8916_leds: qcom,leds@a100 { compatible = "qcom,leds-qpnp"; reg = <0xa100 0x100>; Loading drivers/power/supply/qcom/Kconfig +31 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,17 @@ config SMB135X_CHARGER The driver reports the charger status via the power supply framework. A charger status change triggers an IRQ via the device STAT pin. config SMB1360_CHARGER_FG tristate "SMB1360 Charger and Fuel Gauge" depends on I2C help Say Y to include support for SMB1360 Charger and Fuel Gauge. SMB1360 is a single path switching mode charger capable of charging the battery with 1.5Amps of current. It supports a fuel gauge which uses voltage and coloumb counting for state of charge reporting. The driver reports the status via the power supply framework. A status change triggers an IRQ via the device STAT pin. config SMB1355_SLAVE_CHARGER tristate "SMB1355 Slave Battery Charger" depends on MFD_I2C_PMIC Loading Loading @@ -104,6 +115,26 @@ config QPNP_QNOVO module. It also allows userspace code to read diagnostics of voltage and current measured during certain phases of the pulses. config QPNP_VM_BMS tristate "QPNP Voltage-Mode Battery Monitoring System driver" depends on MFD_SPMI_PMIC help Say Y here to enable support for QPNP chip vm-bms device. The voltage-mode (vm) BMS driver uses periodic VBATT readings from the battery to calculate the State of Charge. config QPNP_LINEAR_CHARGER tristate "QPNP Linear Charger driver" depends on MFD_SPMI_PMIC depends on THERMAL_QPNP_ADC_TM help Say Y here to enable the Linear battery charger which supports USB detection and charging. The driver also offers relevant information to userspace via the power supply framework. The power supply framework is used to communicate battery and usb properties to userspace and other driver consumers like USB. config QPNP_TYPEC tristate "QPNP Type-C driver" depends on MFD_SPMI_PMIC Loading Loading
Documentation/devicetree/bindings/power/supply/qcom/qpnp-linear-charger.txt 0 → 100644 +211 −0 Original line number Diff line number Diff line Qualcomm QPNP Linear Charger The charger module supports the linear battery charger peripherals on Qualcomm PMIC chips. There are four different peripherals in the charger module. Each of these peripherals are implemented as subnodes. - qcom,chgr: Supports charging control and status reporting - qcom,bat-if: Battery status reporting such as presence and temperature reporting. - qcom,usb-chgpth: USB charge path detection and input current limiting configuration. - qcom,chg-misc: Miscellaneous features such as comparator override features etc. Parent node required properties: - qcom,vddmax-mv: Target voltage of battery in mV. - qcom,vddsafe-mv: Maximum Vdd voltage in mV. - qcom,vinmin-mv: Minimum input voltage in mV. - qcom,ibatsafe-ma: Safety battery current setting Parent node optional properties: - qcom,vbatweak-uv: Weak battery voltage threshold in uV, above which fast charging can start. The supported voltage range is from 3000000uV to 3581250uV with a step size of 18750000 uV. - qcom,charging-disabled: Set this property to disable charging by default. - qcom,use-default-batt-values: Set this flag to force reporting of fake battery. - qcom,warm-bat-decidegc: Warm battery temperature in decidegC. - qcom,cool-bat-decidegc: Cool battery temperature in decidegC. Note that if both warm and cool battery temperatures are set, the corresponding ibatmax and bat-mv properties are required to be set. - qcom,ibatmax-cool-ma: Maximum cool battery charge current. - qcom,ibatmax-warm-ma: Maximum warm battery charge current. - qcom,warm-bat-mv: Warm temperature battery target voltage. - qcom,cool-bat-mv: Cool temperature battery target voltage. - qcom,thermal-mitigation: Array of ibatmax values for different system thermal mitigation level. - qcom,tchg-mins: Maximum total software initialized charge time. - qcom,bpd-detection: Select a battery presence detection scheme by specifying either "bpd_thm" "bpd_id" or "bpd_thm_id". "bpd_thm" selects the temperature pin, "bpd_id" uses the id pin for battery presence detection, "bpd_thm_id" selects both. If the property is not set, the temperatue pin will be used. - qcom,btc-disabled: If flag is set battery hot and cold monitoring is disabled in hardware. This monitoring is turned on by default. - qcom,batt-hot-percentage: Specify a supported hot threshold percentage. Supported thresholds: 25% and 35%. If none is specified hardware defaults will be used. - qcom,batt-cold-percentage: Specify a supported cold threshold percentage. Supported thresholds: 70% and 80%. If none is specified hardwaredefaults will be used. - qcom,chg-adc_tm Corresponding ADC TM device's phandle to set recurring measurements and receive notification for batt_therm. -qcom,float-charge If specified enable float charging. - qcom,chg-vadc Corresponding VADC device's phandle. - qcom,charger-detect-eoc If specified charger hardware will detect end-of-charge. If not specified charger driver depends on BMSfor end-of-charge detection. - qcom,disable-vbatdet-based-recharge If specified disable VBATDET irq and charging can only be resumed if charger is re-inserted or SOC falls below resume SOC. This property should always be used along with the BMS property: "qcom,disable-suspend-on-usb". - qcom,use-external-charger If specified the LBC module will be disabled and the driver will not register. It also enables BID for BPD and disables BTC. Declare this node only if you are using an external charger and not the PMIC internal LBC. - qcom,chgr-led-support There is a current sink device in linear charger module, it is used to control a led which can act as a charger led as well as a general notification led. - qcom,parallel-charger This is a bool property to indicate the LBC will operate as a secondary charger in the parallel mode. If this is enabled the charging operations will be controlled by the primary-charger. - qcom,collapsible-chgr-support If specified the collapsible charger feature will be supported. LBC will disable VIN_MIN comparator and use chg_gone interrupt to detect charger removal. Sub node required structure: - A qcom,charger node must be a child of an SPMI node that has specified the spmi-dev-container property. Each subnode reflects a hardware peripheral which adds a unique set of features to the collective charging device. For example USB detection and the battery interface are each separate peripherals and each should be their own subnode. Sub node required properties: - compatible: Must be "qcom,qpnp-linear-charger". - reg: Specifies the SPMI address and size for this peripheral. - interrupts: Specifies the interrupt associated with the peripheral. - interrupt-names: Specifies the interrupt names for the peripheral. Every available interrupt needs to have an associated name with it to indentify its purpose. The following lists each subnode and their corresponding required interrupt names: qcom,usb-chgpth: - usbin-valid The following interrupts are available: qcom,usb-chgpth: - usbin-valid: Indicates valid USB connection. - coarse-det-usb: Coarse detect interrupt triggers at low voltage on USB_IN. - chg-gone: Triggers on VCHG line. - overtemp: Triggers on over temperature condition qcom,chgr: - chg-done: Triggers on charge completion. - chg-failed: Notifies of charge failures. - fast-chg-on: Notifies of fast charging. - vbat-det-lo: Triggers on vbat-det-lo voltage. Example: pm8916-chg: qcom,charger { spmi-dev-container; compatible = "qcom,qpnp-linear-charger"; #address-cells = <1>; #size-cells = <1>; qcom,vddmax-mv = <4200>; qcom,vddsafe-mv = <4200>; qcom,vinmin-mv = <4200>; qcom,ibatsafe-ma = <1440>; qcom,vbatweak-uv = <3200>; qcom,thermal-mitigation = <1500 700 600 325>; qcom,cool-bat-decidegc = <100>; qcom,warm-bat-decidegc = <450>; qcom,cool-bat-mv = <4100>; qcom,ibatmax-warm-ma = <360>; qcom,ibatmax-cool-ma = <360>; qcom,warm-bat-mv = <4100>; qcom,batt-hot-percentage = <25>; qcom,batt-cold-percentage = <85>; qcom,tchg-mins = <152>; qcom,resume-soc = <99>; qcom,btc-disabled = <0>; qcom,chg-vadc = <&pm8916_vadc>; qcom,chgr@1000 { reg = <0x1000 0x100>; interrupts = <0x0 0x10 0x7>, <0x0 0x10 0x6>, <0x0 0x10 0x5>, <0x0 0x10 0x0>; interrupt-names = "chg-done", "chg-failed", "fast-chg-on", "vbat-det-lo"; }; qcom,bat-if@1200 { reg = <0x1200 0x100>; interrupts = <0x0 0x12 0x1>, <0x0 0x12 0x0>; interrupt-names = "bat-temp-ok", "batt-pres"; }; qcom,usb-chgpth@1300 { reg = <0x1300 0x100>; interrupts = <0 0x13 0x2>, <0 0x13 0x1>; interrupt-names = "chg-gone", "usbin-valid"; }; qcom,chg-misc@1600 { reg = <0x1600 0x100>; }; };
Documentation/devicetree/bindings/power/supply/qcom/qpnp-vm-bms.txt 0 → 100644 +180 −0 Original line number Diff line number Diff line Qualcomm's QPNP Voltage-Mode(VM) PMIC Battery Management System QPNP PMIC VM BMS provides interface to clients to read properties related to the battery. Its main function is to calculate the SOC (state of charge) of the battery based on periodic sampling of the VBAT (battery voltage). Parent node required properties: - compatible : Must be "qcom,qpnp-vm-bms" for the BM driver. - reg : Offset and length of the PMIC peripheral register map. - interrupts : The interrupt mappings. The format should be <slave-id peripheral-id interrupt-number>. - interrupt-names : names for the mapped bms interrupt The following interrupts are required: 0 : leave CV state 1 : enter CV state 2 : good ocv generated 3 : ocv_thr 4 : fifo update 5 : fsm state chnaged Additionally, optional subnodes may be included: - qcom,batt-pres-status : A subnode with a register address for the SMBB battery interface's BATT_PRES_STATUS register. If this node is added, then the BMS will try to detect offmode battery removal via the battery interface's offmode battery removal circuit. - qcom,battery-data : A phandle to a node containing the available batterydata profiles. See the batterydata bindings documentation for more details. Parent node required properties: - qcom,v-cutoff-uv : cutoff voltage where the battery is considered dead in micro-volts. - qcom,max-voltage-uv : maximum voltage for the battery in micro-volts. - qcom,r-conn-mohm : connector resistance in milli-ohms. - qcom,shutdown-soc-valid-limit : If the ocv upon restart is within this distance of the shutdown ocv, the BMS will try to force the new SoC to the old one to provide charge continuity. That is to say, if (abs(shutdown-soc - current-soc) < limit) then use old SoC. - qcom,low-soc-calculate-soc-threshold : The SoC threshold for when the periodic calculate_soc work speeds up. This ensures SoC is updated in userspace constantly when we are near shutdown. - qcom,low-voltage-threshold : The battery voltage threshold in micro-volts for when the BMS tries to wake up and hold a wakelock to ensure a clean shutdown. - qcom,low-voltage-calculate-soc-ms : The time period between subsequent SoC recalculations when the current voltage is below qcom,low-voltage threshold. This takes precedence over qcom,low-soc-calculate-soc-ms. - qcom,low-soc-calculate-soc-ms : The time period between subsequent SoC recalculations when the current SoC is below qcom,low-soc-calculate-soc-threshold. This takes precedence over qcom,calculate-soc-ms. - qcom,calculate-soc-ms : The time period between subsequent SoC recalculations when the current SoC is above or equal qcom,low-soc-calculate-soc-threshold. - qcom,volatge-soc-timeout-ms : The timeout period after which the module starts reporting volage based SOC and does not use the VMBMS algorithm for SOC calculation. - qcom,bms-vadc: Corresponding VADC device's phandle. - qcom,bms-adc_tm: Corresponding ADC_TM device's phandle to set recurring measurements and receive notifications for vbatt. - qcom,pmic-revid : Phandle pointing to the revision peripheral node. Parent node Optional properties - qcom,s1-sample-interval-ms: The sampling rate in ms of the accumulator in state S1. (i.e) the rate at which the accumulator is being filled with vbat samples. Minimum value = 0 and Maximum value = 2550ms. - qcom,s2-sample-interval-ms: The sampling rate in ms of the accumulator in state S2. (i.e) the rate at which the accumulator is being filled with vbat samples. Minimum value = 0 and Maximum value = 2550ms. - qcom,s1-sample-count: The number of samples to be accululated for one FIFO in state S1. Possible values are - 0, 4, 8, 16, 32, 64, 128, 256. - qcom,s2-sample-count: The number of samples to be accululated for one FIFO in state S2. Possible values are - 0, 4, 8, 16, 32, 64, 128, 256. - qcom,s1-fifo-legth: Number of FIFO's to be filled in state S1, to generate the fifo_update_done interrupt. Possile values - 0 to 8 - qcom,s2-fifo-legth: Number of FIFO's to be filled in state S2, to generate the fifo_update_done interrupt. Possible values- 0 to 8 - qcom,force-s3-on-suspend : Bool property to force the BMS into S3 (sleep) state while entering into system suspend. - qcom,force-bms-active-on-charger: Bool property to keep BMS FSM active if charger is present. - qcom,report-charger-eoc : Bool property to indicate if BMS needs to indicate EOC to charger. - qcom,ignore-shutdown-soc: A boolean that controls whether BMS will try to force the startup SoC to be the same as the shutdown SoC. Defining it will make BMS ignore the shutdown SoC. - qcom,use-voltage-soc : A boolean that controls whether BMS will use voltage-based SoC instead of a coulomb counter based one. Voltage-based SoC will not guarantee linearity. - qcom,disable-bms : Bool property to disable the VMBMS hardware module. Enable this property if BMS is not supported or an external fuel gauge is used. - qcom,s3-ocv-tolerence-uv : The S3 state OCV tolerence threshold in uV. The LSB value is 300uV and maximum value is 76500uV. - qcom,low-soc-fifo-length : The fifo length (of S2 STATE) to be used at lower SOCs. If this value is not specified the system uses default length. - qcom,resume-soc: Capacity in percent at which charging should resume when a fully charged battery drops below this level. - qcom,low-temp-threshold : The temperature threshold below which the IBAT averaging and UUC smoothening is disabled. This value is in deci-degrees centigrade. If not specified it defaults to 0. - qcom,ibat-avg-samples : The number of samples to be averaged for IBAT estimation. If not specified it defaults to 16. The possible values are 1 to 16. - qcom,batt-aging-comp : A boolean that defines if battery aging compensation is enabled. - qcom,use-reported-soc : Bool property to enable the reported_soc logic. To enable this feature, qcom,resume-soc must be defined as a proper value. The BMS is also required to control the charging, discharging and recharging. qcom,batt-pres-status node required properties: - reg : offset and length of the PMIC LBC battery interface BATT_PRES_STATUS register. qcom,qpnp-chg-pres required properties: - reg : offset and length of the PMIC LBC charger interafce CHARGER_OPTION register. Example: pm8916_bms: qcom,qpnp-vm-bms { spmi-dev-container; compatible = "qcom,qpnp-vm-bms"; #address-cells = <1>; #size-cells = <1>; status = "disabled"; qcom,v-cutoff-uv = <3400000>; qcom,max-voltage-uv = <4200000>; qcom,r-conn-mohm = <18>; qcom,shutdown-soc-valid-limit = <20>; qcom,low-soc-calculate-soc-threshold = <15>; qcom,low-voltage-threshold = <3420000>; qcom,low-voltage-calculate-soc-ms = <1000>; qcom,low-soc-calculate-soc-ms = <5000>; qcom,low-soc-fifo-length = <2>; qcom,calculate-soc-ms = <20000>; qcom,s3-ocv-tolerence-uv = <1200>; qcom,volatge-soc-timeout-ms = <60000>; qcom,battery-data = <&mtp_batterydata>; qcom,bms-vadc = <&pm8916_vadc>; qcom,bms-adc_tm = <&pm8916_adc_tm>; qcom,batt-pres-status@1208 { reg = <0x1208 0x1>; } qcom,qpnp-chg-pres@1208 { reg = <0x1108 0x1>; } qcom,bms-bms@4000 { reg = <0x4000 0x100>; interrupts = <0x0 0x40 0x0>, <0x0 0x40 0x1>, <0x0 0x40 0x2>, <0x0 0x40 0x3>, <0x0 0x40 0x4>, <0x0 0x40 0x5>, interrupt-names = "leave_cv", "enter_cv", "good_ocv", "ocv_thr", "fifo_updtaed", "fsm_state_change"; }; };
Documentation/devicetree/bindings/power/smb1360-charger-fg.txt→Documentation/devicetree/bindings/power/supply/qcom/smb1360-charger-fg.txt +0 −0 File moved. View file
arch/arm64/boot/dts/qcom/pm8916.dtsi +115 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,121 @@ qcom,pmic-revid = <&pm8916_revid>; }; pm8916_chg: qcom,charger { compatible = "qcom,qpnp-linear-charger"; #address-cells = <1>; #size-cells = <1>; qcom,vddmax-mv = <4200>; qcom,vddsafe-mv = <4200>; qcom,vinmin-mv = <4308>; qcom,ibatsafe-ma = <1440>; qcom,thermal-mitigation = <1440 720 630 0>; qcom,cool-bat-decidegc = <100>; qcom,warm-bat-decidegc = <450>; qcom,cool-bat-mv = <4100>; qcom,warm-bat-mv = <4100>; qcom,ibatmax-warm-ma = <360>; qcom,ibatmax-cool-ma = <360>; qcom,batt-hot-percentage = <25>; qcom,batt-cold-percentage = <80>; qcom,tchg-mins = <232>; qcom,resume-soc = <99>; qcom,chg-vadc = <&pm8916_vadc>; qcom,chg-adc_tm = <&pm8916_adc_tm>; status = "disabled"; qcom,chgr@1000 { reg = <0x1000 0x100>; interrupts = <0x0 0x10 0x7 IRQ_TYPE_EDGE_RISING>, <0x0 0x10 0x6 IRQ_TYPE_EDGE_RISING>, <0x0 0x10 0x5 IRQ_TYPE_EDGE_BOTH>, <0x0 0x10 0x0 IRQ_TYPE_EDGE_FALLING>; interrupt-names = "chg-done", "chg-failed", "fast-chg-on", "vbat-det-lo"; }; qcom,bat-if@1200 { reg = <0x1200 0x100>; interrupts = <0x0 0x12 0x1 IRQ_TYPE_EDGE_BOTH>, <0x0 0x12 0x0 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "bat-temp-ok", "batt-pres"; }; qcom,usb-chgpth@1300 { reg = <0x1300 0x100>; interrupts = <0 0x13 0x4 IRQ_TYPE_EDGE_BOTH>, <0 0x13 0x2 IRQ_TYPE_EDGE_RISING>, <0 0x13 0x1 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "usb-over-temp", "chg-gone", "usbin-valid"; }; qcom,chg-misc@1600 { reg = <0x1600 0x100>; }; }; pm8916_bms: qcom,vmbms { compatible = "qcom,qpnp-vm-bms"; #address-cells = <1>; #size-cells = <1>; status = "disabled"; qcom,v-cutoff-uv = <3400000>; qcom,max-voltage-uv = <4200000>; qcom,r-conn-mohm = <0>; qcom,shutdown-soc-valid-limit = <100>; qcom,low-soc-calculate-soc-threshold = <15>; qcom,low-voltage-calculate-soc-ms = <1000>; qcom,low-soc-calculate-soc-ms = <5000>; qcom,calculate-soc-ms = <20000>; qcom,volatge-soc-timeout-ms = <60000>; qcom,low-voltage-threshold = <3450000>; qcom,s3-ocv-tolerence-uv = <1200>; qcom,s2-fifo-length = <5>; qcom,low-soc-fifo-length = <2>; qcom,bms-vadc = <&pm8916_vadc>; qcom,bms-adc_tm = <&pm8916_adc_tm>; qcom,pmic-revid = <&pm8916_revid>; qcom,force-s3-on-suspend; qcom,force-s2-in-charging; qcom,report-charger-eoc; qcom,batt-pres-status@1208 { reg = <0x1208 0x1>; }; qcom,qpnp-chg-pres@1008 { reg = <0x1008 0x1>; }; qcom,vm-bms@4000 { reg = <0x4000 0x100>; interrupts = <0x0 0x40 0x0 IRQ_TYPE_NONE>, <0x0 0x40 0x1 IRQ_TYPE_NONE>, <0x0 0x40 0x2 IRQ_TYPE_NONE>, <0x0 0x40 0x3 IRQ_TYPE_NONE>, <0x0 0x40 0x4 IRQ_TYPE_NONE>, <0x0 0x40 0x5 IRQ_TYPE_NONE>; interrupt-names = "leave_cv", "enter_cv", "good_ocv", "ocv_thr", "fifo_update_done", "fsm_state_change"; }; }; pm8916_leds: qcom,leds@a100 { compatible = "qcom,leds-qpnp"; reg = <0xa100 0x100>; Loading
drivers/power/supply/qcom/Kconfig +31 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,17 @@ config SMB135X_CHARGER The driver reports the charger status via the power supply framework. A charger status change triggers an IRQ via the device STAT pin. config SMB1360_CHARGER_FG tristate "SMB1360 Charger and Fuel Gauge" depends on I2C help Say Y to include support for SMB1360 Charger and Fuel Gauge. SMB1360 is a single path switching mode charger capable of charging the battery with 1.5Amps of current. It supports a fuel gauge which uses voltage and coloumb counting for state of charge reporting. The driver reports the status via the power supply framework. A status change triggers an IRQ via the device STAT pin. config SMB1355_SLAVE_CHARGER tristate "SMB1355 Slave Battery Charger" depends on MFD_I2C_PMIC Loading Loading @@ -104,6 +115,26 @@ config QPNP_QNOVO module. It also allows userspace code to read diagnostics of voltage and current measured during certain phases of the pulses. config QPNP_VM_BMS tristate "QPNP Voltage-Mode Battery Monitoring System driver" depends on MFD_SPMI_PMIC help Say Y here to enable support for QPNP chip vm-bms device. The voltage-mode (vm) BMS driver uses periodic VBATT readings from the battery to calculate the State of Charge. config QPNP_LINEAR_CHARGER tristate "QPNP Linear Charger driver" depends on MFD_SPMI_PMIC depends on THERMAL_QPNP_ADC_TM help Say Y here to enable the Linear battery charger which supports USB detection and charging. The driver also offers relevant information to userspace via the power supply framework. The power supply framework is used to communicate battery and usb properties to userspace and other driver consumers like USB. config QPNP_TYPEC tristate "QPNP Type-C driver" depends on MFD_SPMI_PMIC Loading