Android battery changes and android battery changes

Source: Internet
Author: User

Android battery changes and android battery changes

Problem:
1. Power jump to 50%
2. Battery ID pin grounding
3. temperature pin to determine whether the battery is in place

Speculative reason:
How to determine the battery position:

qpnp-linear-charger.cenum bpd_type{  BPD_TYPE_BAT_ID="bpd_id",  BPD_TYPE_BAT_THM="bpd_thm",  BPD_TYPE_BAT_THE_BAT_ID="bpd_thm_id",}

Check whether bpd has a value in the Device Tree.

of_property_read_string(chip->spmi->dev.of_node,"qcom,bpd-detection",&bpd)

If not, use the Code definition (based on the temperature script)

chip->cfg_bpd_detection = BPD_TYPE_BAT_THM;

Configure parameters to struct.
Battery capacity calculation:

get_prop_capacity(struct qpnp_lbd_chip *chip)


If the battery is not in place or is a false battery, the default battery (50) is returned)
Battery In-Place detection function: (call process)

Get_prop_batt_present (struct qpnp_lbc_chip * chip)
-> Qpnp_lbc_read (chip, chip-> bat_if_base + BAT_IF_PRES_STATUS_REG [0x08], & reg_val, 1)
->__ Qpnp_lbc_read (spmi, base, val, count)
-> Spmi_ext_register_read (spmi-> ctrl, spmi-> sid, base, val, count)
-> Spmi_read_cmd (ctrl, spmi_1__ext_readl, sid, addr, len-1, buf)
-> Ctrl-> read_cmd (ctrl, opcode, sid, addr, bc, buf)
Temperature Detection Function:

get_prop_batt_temp(struct qpnp_lbc_chip *chip) 

If the battery is false and the battery is not in place, the default temperature is returned.

qpnp_vadc_read(chip vadc_dev,LR_MUX1_BATT_THEM,&results)

If reading fails, the default temperature is returned.
-> If (channel = VBAT_SNS)
Read Voltage

qpnp_vadc_conv_seq_request(vadc,ADC_SEQ_NONE,channel,result)

Read Temperature

qpnp_vadc_conv_seq_request(vadc,ADC_SEQ_NONE,DIE_TEMP,&die_temp_result)

Read Compensation

qpnp_vbat_sns_comp(&result->physical,vadc,die_temp_result.physical)

Last return

qpnp_vadc_con_seq_request(vadc,ADC_SEQ_NONE,channel,result)

This project uses software to calculate power without a dedicated Power Meter Chip
Factors for calculating power: temperature, voltage, and current
Virtual electric gauge qpnp-vm-bms.c
Therefore, once the temperature collection is inaccurate, the electric usage percentage calculation will be incorrect.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.