/* Default: under this temperature, charging is stopped */ #define AB8500_TEMP_UNDER 3 /* Default: between this temp and AB8500_TEMP_UNDER charging is reduced */ #define AB8500_TEMP_LOW 8 /* Default: between this temp and AB8500_TEMP_OVER charging is reduced */ #define AB8500_TEMP_HIGH 43 /* Default: over this temp, charging is stopped */ #define AB8500_TEMP_OVER 48 /* Default: temperature hysteresis */ #define AB8500_TEMP_HYSTERESIS 3
int ab8500_bm_of_probe(struct power_supply *psy, struct ab8500_bm_data *bm)
{ struct power_supply_battery_info *bi; struct device *dev = &psy->dev; int ret;
ret = power_supply_get_battery_info(psy, &bm->bi); if (ret) {
dev_err(dev, "cannot retrieve battery info\n"); return ret;
}
bi = bm->bi;
/* Fill in defaults for any data missing from the device tree */ if (bi->charge_full_design_uah < 0) /* The default capacity is 612 mAh for unknown batteries */
bi->charge_full_design_uah = 612000;
/* *Allofthesevoltagesneedtobespecifiedorwewillsimply *fallbacktosafedefaults.
*/ if ((bi->voltage_min_design_uv < 0) ||
(bi->voltage_max_design_uv < 0)) { /* Nominal voltage is 3.7V for unknown batteries */
bi->voltage_min_design_uv = 3700000; /* Termination voltage 4.05V */
bi->voltage_max_design_uv = 4050000;
}
if (bi->constant_charge_current_max_ua < 0)
bi->constant_charge_current_max_ua = 400000;
if (bi->constant_charge_voltage_max_uv < 0)
bi->constant_charge_voltage_max_uv = 4100000;
if (bi->charge_term_current_ua) /* Charging stops when we drop below this current */
bi->charge_term_current_ua = 200000;
/* The default battery is emulated by a resistor at 7K */ if (bi->bti_resistance_ohm < 0 ||
bi->bti_resistance_tolerance < 0) {
bi->bti_resistance_ohm = 7000;
bi->bti_resistance_tolerance = 20;
}
if (!bi->ocv_table[0]) { /* Default capacity table at say 25 degrees Celsius */
bi->ocv_temp[0] = 25;
bi->ocv_table[0] = ocv_cap_tbl;
bi->ocv_table_size[0] = ARRAY_SIZE(ocv_cap_tbl);
}
if (bi->temp_min == INT_MIN)
bi->temp_min = AB8500_TEMP_UNDER; if (bi->temp_max == INT_MAX)
bi->temp_max = AB8500_TEMP_OVER; if (bi->temp_alert_min == INT_MIN)
bi->temp_alert_min = AB8500_TEMP_LOW; if (bi->temp_alert_max == INT_MAX)
bi->temp_alert_max = AB8500_TEMP_HIGH;
bm->temp_hysteresis = AB8500_TEMP_HYSTERESIS;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.