mtk battery_table

mtk电池曲线是按照mah,voltage,resistance,percentage来读取的

而在fg_custom_parse_table中实际用到的只有mah,voltage,resistance;

static void fg_custom_parse_table(const struct device_node *np,
    const char *node_srting, struct FUELGAUGE_PROFILE_STRUCT *profile_struct)
{
 int mah, voltage, resistance, idx, saddles;
 struct FUELGAUGE_PROFILE_STRUCT *profile_p;
 profile_p = profile_struct;
 saddles = fg_table_cust_data.fg_profile_t0_size;
 idx = 0;
 bm_debug("fg_custom_parse_table: %s, %d ", node_srting, saddles);
 while (!of_property_read_u32_index(np, node_srting, idx, &mah)) {
  idx++;
  if (!of_property_read_u32_index(np, node_srting, idx, &voltage)) {
   /*bm_err("fg_custom_parse_table: mah: %d, voltage: %d ", mah, voltage);*/
   /*bm_err("fg_custom_parse_table: mah: %d, voltage: %d ", mah, voltage);*/
  }
  idx++;
  if (!of_property_read_u32_index(np, node_srting, idx, &resistance)) {
   bm_debug("fg_custom_parse_table: mah: %d, voltage: %d, resistance: %d ",
        mah, voltage, resistance);
  }
  profile_p->mah = mah;
  profile_p->voltage = voltage;
  profile_p->resistance = resistance;
  /* dump parsing data */
  #if 0
  msleep(20);
  bm_print(BM_LOG_CRTI, "__batt_meter_parse_table>> %s[%d]: <%d, %d> ",
    node_srting, (idx/2), profile_p->percentage, profile_p->voltage);
  #endif
  profile_p++;
  if ((idx++) >= (saddles * 3))
   break;
 }

原文地址:https://www.cnblogs.com/chjgongzuo/p/12133089.html