Lines Matching +full:active +full:- +full:discharge +full:- +full:time +full:- +full:us
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) ST-Ericsson SA 2012
34 #include "ab8500-bm.h"
35 #include "ab8500-chargalg.h"
40 /* End-of-charge criteria counter */
169 * struct ab8500_charge_curr_maximization - Charger maximization parameters
197 * struct ab8500_chargalg - ab8500 Charging algorithm device information
200 * @eoc_cnt: counter used to determine end-of_charge
201 * @maintenance_chg: indicate if maintenance charge is active
256 * ab8500_chargalg_safety_timer_expired() - Expiration of the safety timer
267 dev_err(di->dev, "Safety timer expired\n"); in ab8500_chargalg_safety_timer_expired()
268 di->events.safety_timer_expired = true; in ab8500_chargalg_safety_timer_expired()
271 queue_work(di->chargalg_wq, &di->chargalg_work); in ab8500_chargalg_safety_timer_expired()
277 * ab8500_chargalg_maintenance_timer_expired() - Expiration of
291 dev_dbg(di->dev, "Maintenance timer expired\n"); in ab8500_chargalg_maintenance_timer_expired()
292 di->events.maintenance_timer_expired = true; in ab8500_chargalg_maintenance_timer_expired()
295 queue_work(di->chargalg_wq, &di->chargalg_work); in ab8500_chargalg_maintenance_timer_expired()
301 * ab8500_chargalg_state_to() - Change charge state
309 dev_dbg(di->dev, in ab8500_chargalg_state_to()
311 di->charge_state == state ? "NO" : "YES", in ab8500_chargalg_state_to()
312 di->charge_state, in ab8500_chargalg_state_to()
313 states[di->charge_state], in ab8500_chargalg_state_to()
317 di->charge_state = state; in ab8500_chargalg_state_to()
322 struct power_supply_battery_info *bi = di->bm->bi; in ab8500_chargalg_check_charger_enable()
324 switch (di->charge_state) { in ab8500_chargalg_check_charger_enable()
333 if (di->chg_info.charger_type & USB_CHG) { in ab8500_chargalg_check_charger_enable()
334 return di->usb_chg->ops.check_enable(di->usb_chg, in ab8500_chargalg_check_charger_enable()
335 bi->constant_charge_voltage_max_uv, in ab8500_chargalg_check_charger_enable()
336 bi->constant_charge_current_max_ua); in ab8500_chargalg_check_charger_enable()
337 } else if (di->chg_info.charger_type & AC_CHG) { in ab8500_chargalg_check_charger_enable()
338 return di->ac_chg->ops.check_enable(di->ac_chg, in ab8500_chargalg_check_charger_enable()
339 bi->constant_charge_voltage_max_uv, in ab8500_chargalg_check_charger_enable()
340 bi->constant_charge_current_max_ua); in ab8500_chargalg_check_charger_enable()
346 * ab8500_chargalg_check_charger_connection() - Check charger connection change
354 if (di->chg_info.conn_chg != di->chg_info.prev_conn_chg) { in ab8500_chargalg_check_charger_connection()
356 if (di->chg_info.conn_chg & AC_CHG) { in ab8500_chargalg_check_charger_connection()
357 dev_info(di->dev, "Charging source is AC\n"); in ab8500_chargalg_check_charger_connection()
358 if (di->chg_info.charger_type != AC_CHG) { in ab8500_chargalg_check_charger_connection()
359 di->chg_info.charger_type = AC_CHG; in ab8500_chargalg_check_charger_connection()
362 } else if (di->chg_info.conn_chg & USB_CHG) { in ab8500_chargalg_check_charger_connection()
363 dev_info(di->dev, "Charging source is USB\n"); in ab8500_chargalg_check_charger_connection()
364 di->chg_info.charger_type = USB_CHG; in ab8500_chargalg_check_charger_connection()
367 dev_dbg(di->dev, "Charging source is OFF\n"); in ab8500_chargalg_check_charger_connection()
368 di->chg_info.charger_type = NO_CHG; in ab8500_chargalg_check_charger_connection()
371 di->chg_info.prev_conn_chg = di->chg_info.conn_chg; in ab8500_chargalg_check_charger_connection()
373 return di->chg_info.conn_chg; in ab8500_chargalg_check_charger_connection()
377 * ab8500_chargalg_start_safety_timer() - Start charging safety timer
385 /* Charger-dependent expiration time in hours*/ in ab8500_chargalg_start_safety_timer()
388 switch (di->chg_info.charger_type) { in ab8500_chargalg_start_safety_timer()
390 timer_expiration = di->bm->main_safety_tmr_h; in ab8500_chargalg_start_safety_timer()
394 timer_expiration = di->bm->usb_safety_tmr_h; in ab8500_chargalg_start_safety_timer()
398 dev_err(di->dev, "Unknown charger to charge from\n"); in ab8500_chargalg_start_safety_timer()
402 di->events.safety_timer_expired = false; in ab8500_chargalg_start_safety_timer()
403 hrtimer_set_expires_range(&di->safety_timer, in ab8500_chargalg_start_safety_timer()
406 hrtimer_start_expires(&di->safety_timer, HRTIMER_MODE_REL); in ab8500_chargalg_start_safety_timer()
410 * ab8500_chargalg_stop_safety_timer() - Stop charging safety timer
417 if (hrtimer_try_to_cancel(&di->safety_timer) >= 0) in ab8500_chargalg_stop_safety_timer()
418 di->events.safety_timer_expired = false; in ab8500_chargalg_stop_safety_timer()
422 * ab8500_chargalg_start_maintenance_timer() - Start charging maintenance timer
428 * discharge curve of the battery
434 hrtimer_set_expires_range(&di->maintenance_timer, in ab8500_chargalg_start_maintenance_timer()
437 di->events.maintenance_timer_expired = false; in ab8500_chargalg_start_maintenance_timer()
438 hrtimer_start_expires(&di->maintenance_timer, HRTIMER_MODE_REL); in ab8500_chargalg_start_maintenance_timer()
442 * ab8500_chargalg_stop_maintenance_timer() - Stop maintenance timer
450 if (hrtimer_try_to_cancel(&di->maintenance_timer) >= 0) in ab8500_chargalg_stop_maintenance_timer()
451 di->events.maintenance_timer_expired = false; in ab8500_chargalg_stop_maintenance_timer()
455 * ab8500_chargalg_kick_watchdog() - Kick charger watchdog
464 if (di->ac_chg && di->ac_chg->ops.kick_wd && in ab8500_chargalg_kick_watchdog()
465 di->chg_info.online_chg & AC_CHG) { in ab8500_chargalg_kick_watchdog()
466 return di->ac_chg->ops.kick_wd(di->ac_chg); in ab8500_chargalg_kick_watchdog()
467 } else if (di->usb_chg && di->usb_chg->ops.kick_wd && in ab8500_chargalg_kick_watchdog()
468 di->chg_info.online_chg & USB_CHG) in ab8500_chargalg_kick_watchdog()
469 return di->usb_chg->ops.kick_wd(di->usb_chg); in ab8500_chargalg_kick_watchdog()
471 return -ENXIO; in ab8500_chargalg_kick_watchdog()
475 * ab8500_chargalg_ac_en() - Turn on/off the AC charger
487 if (!di->ac_chg || !di->ac_chg->ops.enable) in ab8500_chargalg_ac_en()
488 return -ENXIO; in ab8500_chargalg_ac_en()
491 if (di->ac_chg->max_out_volt_uv) in ab8500_chargalg_ac_en()
492 vset_uv = min(vset_uv, di->ac_chg->max_out_volt_uv); in ab8500_chargalg_ac_en()
493 if (di->ac_chg->max_out_curr_ua) in ab8500_chargalg_ac_en()
494 iset_ua = min(iset_ua, di->ac_chg->max_out_curr_ua); in ab8500_chargalg_ac_en()
496 di->chg_info.ac_iset_ua = iset_ua; in ab8500_chargalg_ac_en()
497 di->chg_info.ac_vset_uv = vset_uv; in ab8500_chargalg_ac_en()
499 return di->ac_chg->ops.enable(di->ac_chg, enable, vset_uv, iset_ua); in ab8500_chargalg_ac_en()
503 * ab8500_chargalg_usb_en() - Turn on/off the USB charger
515 if (!di->usb_chg || !di->usb_chg->ops.enable) in ab8500_chargalg_usb_en()
516 return -ENXIO; in ab8500_chargalg_usb_en()
519 if (di->usb_chg->max_out_volt_uv) in ab8500_chargalg_usb_en()
520 vset_uv = min(vset_uv, di->usb_chg->max_out_volt_uv); in ab8500_chargalg_usb_en()
521 if (di->usb_chg->max_out_curr_ua) in ab8500_chargalg_usb_en()
522 iset_ua = min(iset_ua, di->usb_chg->max_out_curr_ua); in ab8500_chargalg_usb_en()
524 di->chg_info.usb_iset_ua = iset_ua; in ab8500_chargalg_usb_en()
525 di->chg_info.usb_vset_uv = vset_uv; in ab8500_chargalg_usb_en()
527 return di->usb_chg->ops.enable(di->usb_chg, enable, vset_uv, iset_ua); in ab8500_chargalg_usb_en()
531 * ab8500_chargalg_update_chg_curr() - Update charger current
542 if (di->ac_chg && di->ac_chg->ops.update_curr && in ab8500_chargalg_update_chg_curr()
543 di->chg_info.charger_type & AC_CHG) { in ab8500_chargalg_update_chg_curr()
548 if (di->ac_chg->max_out_curr_ua) in ab8500_chargalg_update_chg_curr()
549 iset_ua = min(iset_ua, di->ac_chg->max_out_curr_ua); in ab8500_chargalg_update_chg_curr()
551 di->chg_info.ac_iset_ua = iset_ua; in ab8500_chargalg_update_chg_curr()
553 return di->ac_chg->ops.update_curr(di->ac_chg, iset_ua); in ab8500_chargalg_update_chg_curr()
554 } else if (di->usb_chg && di->usb_chg->ops.update_curr && in ab8500_chargalg_update_chg_curr()
555 di->chg_info.charger_type & USB_CHG) { in ab8500_chargalg_update_chg_curr()
560 if (di->usb_chg->max_out_curr_ua) in ab8500_chargalg_update_chg_curr()
561 iset_ua = min(iset_ua, di->usb_chg->max_out_curr_ua); in ab8500_chargalg_update_chg_curr()
563 di->chg_info.usb_iset_ua = iset_ua; in ab8500_chargalg_update_chg_curr()
565 return di->usb_chg->ops.update_curr(di->usb_chg, iset_ua); in ab8500_chargalg_update_chg_curr()
568 return -ENXIO; in ab8500_chargalg_update_chg_curr()
572 * ab8500_chargalg_stop_charging() - Stop charging
585 di->charge_status = POWER_SUPPLY_STATUS_NOT_CHARGING; in ab8500_chargalg_stop_charging()
586 di->maintenance_chg = false; in ab8500_chargalg_stop_charging()
587 cancel_delayed_work(&di->chargalg_wd_work); in ab8500_chargalg_stop_charging()
588 power_supply_changed(di->chargalg_psy); in ab8500_chargalg_stop_charging()
592 * ab8500_chargalg_hold_charging() - Pauses charging
605 di->charge_status = POWER_SUPPLY_STATUS_CHARGING; in ab8500_chargalg_hold_charging()
606 di->maintenance_chg = false; in ab8500_chargalg_hold_charging()
607 cancel_delayed_work(&di->chargalg_wd_work); in ab8500_chargalg_hold_charging()
608 power_supply_changed(di->chargalg_psy); in ab8500_chargalg_hold_charging()
612 * ab8500_chargalg_start_charging() - Start the charger
623 switch (di->chg_info.charger_type) { in ab8500_chargalg_start_charging()
625 dev_dbg(di->dev, in ab8500_chargalg_start_charging()
632 dev_dbg(di->dev, in ab8500_chargalg_start_charging()
639 dev_err(di->dev, "Unknown charger to charge from\n"); in ab8500_chargalg_start_charging()
645 * ab8500_chargalg_check_temp() - Check battery temperature ranges
653 struct power_supply_battery_info *bi = di->bm->bi; in ab8500_chargalg_check_temp()
655 if (di->batt_data.temp > (bi->temp_alert_min + di->t_hyst_norm) && in ab8500_chargalg_check_temp()
656 di->batt_data.temp < (bi->temp_alert_max - di->t_hyst_norm)) { in ab8500_chargalg_check_temp()
658 di->events.btemp_underover = false; in ab8500_chargalg_check_temp()
659 di->events.btemp_low = false; in ab8500_chargalg_check_temp()
660 di->events.btemp_high = false; in ab8500_chargalg_check_temp()
661 di->t_hyst_norm = 0; in ab8500_chargalg_check_temp()
662 di->t_hyst_lowhigh = 0; in ab8500_chargalg_check_temp()
664 if ((di->batt_data.temp >= bi->temp_alert_max) && in ab8500_chargalg_check_temp()
665 (di->batt_data.temp < (bi->temp_max - di->t_hyst_lowhigh))) { in ab8500_chargalg_check_temp()
667 di->events.btemp_underover = false; in ab8500_chargalg_check_temp()
668 di->events.btemp_high = true; in ab8500_chargalg_check_temp()
669 di->t_hyst_norm = di->bm->temp_hysteresis; in ab8500_chargalg_check_temp()
670 di->t_hyst_lowhigh = 0; in ab8500_chargalg_check_temp()
671 } else if ((di->batt_data.temp > (bi->temp_min + di->t_hyst_lowhigh)) && in ab8500_chargalg_check_temp()
672 (di->batt_data.temp <= bi->temp_alert_min)) { in ab8500_chargalg_check_temp()
674 di->events.btemp_underover = false; in ab8500_chargalg_check_temp()
675 di->events.btemp_low = true; in ab8500_chargalg_check_temp()
676 di->t_hyst_norm = di->bm->temp_hysteresis; in ab8500_chargalg_check_temp()
677 di->t_hyst_lowhigh = 0; in ab8500_chargalg_check_temp()
678 } else if (di->batt_data.temp <= bi->temp_min || in ab8500_chargalg_check_temp()
679 di->batt_data.temp >= bi->temp_max) { in ab8500_chargalg_check_temp()
681 di->events.btemp_underover = true; in ab8500_chargalg_check_temp()
682 di->events.btemp_low = false; in ab8500_chargalg_check_temp()
683 di->events.btemp_high = false; in ab8500_chargalg_check_temp()
684 di->t_hyst_norm = 0; in ab8500_chargalg_check_temp()
685 di->t_hyst_lowhigh = di->bm->temp_hysteresis; in ab8500_chargalg_check_temp()
688 dev_dbg(di->dev, "Within hysteresis limit temp: %d " in ab8500_chargalg_check_temp()
690 di->batt_data.temp, di->t_hyst_lowhigh, in ab8500_chargalg_check_temp()
691 di->t_hyst_norm); in ab8500_chargalg_check_temp()
697 * ab8500_chargalg_check_charger_voltage() - Check charger voltage
704 if (di->chg_info.usb_volt_uv > di->bm->chg_params->usb_volt_max_uv) in ab8500_chargalg_check_charger_voltage()
705 di->chg_info.usb_chg_ok = false; in ab8500_chargalg_check_charger_voltage()
707 di->chg_info.usb_chg_ok = true; in ab8500_chargalg_check_charger_voltage()
709 if (di->chg_info.ac_volt_uv > di->bm->chg_params->ac_volt_max_uv) in ab8500_chargalg_check_charger_voltage()
710 di->chg_info.ac_chg_ok = false; in ab8500_chargalg_check_charger_voltage()
712 di->chg_info.ac_chg_ok = true; in ab8500_chargalg_check_charger_voltage()
717 * ab8500_chargalg_end_of_charge() - Check if end-of-charge criteria is fulfilled
720 * End-of-charge criteria is fulfilled when the battery voltage is above a
726 if (di->charge_status == POWER_SUPPLY_STATUS_CHARGING && in ab8500_chargalg_end_of_charge()
727 di->charge_state == STATE_NORMAL && in ab8500_chargalg_end_of_charge()
728 !di->maintenance_chg && (di->batt_data.volt_uv >= in ab8500_chargalg_end_of_charge()
729 di->bm->bi->voltage_max_design_uv || in ab8500_chargalg_end_of_charge()
730 di->events.usb_cv_active || di->events.ac_cv_active) && in ab8500_chargalg_end_of_charge()
731 di->batt_data.avg_curr_ua < in ab8500_chargalg_end_of_charge()
732 di->bm->bi->charge_term_current_ua && in ab8500_chargalg_end_of_charge()
733 di->batt_data.avg_curr_ua > 0) { in ab8500_chargalg_end_of_charge()
734 if (++di->eoc_cnt >= EOC_COND_CNT) { in ab8500_chargalg_end_of_charge()
735 di->eoc_cnt = 0; in ab8500_chargalg_end_of_charge()
736 di->charge_status = POWER_SUPPLY_STATUS_FULL; in ab8500_chargalg_end_of_charge()
737 di->maintenance_chg = true; in ab8500_chargalg_end_of_charge()
738 dev_dbg(di->dev, "EOC reached!\n"); in ab8500_chargalg_end_of_charge()
739 power_supply_changed(di->chargalg_psy); in ab8500_chargalg_end_of_charge()
741 dev_dbg(di->dev, in ab8500_chargalg_end_of_charge()
743 " time, out of %d before EOC\n", in ab8500_chargalg_end_of_charge()
744 di->eoc_cnt, in ab8500_chargalg_end_of_charge()
748 di->eoc_cnt = 0; in ab8500_chargalg_end_of_charge()
754 struct power_supply_battery_info *bi = di->bm->bi; in init_maxim_chg_curr()
756 di->ccm.original_iset_ua = bi->constant_charge_current_max_ua; in init_maxim_chg_curr()
757 di->ccm.current_iset_ua = bi->constant_charge_current_max_ua; in init_maxim_chg_curr()
758 di->ccm.max_current_ua = di->bm->maxi->chg_curr_ua; in init_maxim_chg_curr()
759 di->ccm.condition_cnt = di->bm->maxi->wait_cycles; in init_maxim_chg_curr()
760 di->ccm.level = 0; in init_maxim_chg_curr()
764 * ab8500_chargalg_chg_curr_maxim - increases the charger current to
775 if (!di->bm->maxi->ena_maxi) in ab8500_chargalg_chg_curr_maxim()
778 if (di->events.vbus_collapsed) { in ab8500_chargalg_chg_curr_maxim()
779 dev_dbg(di->dev, "Charger voltage has collapsed %d\n", in ab8500_chargalg_chg_curr_maxim()
780 di->ccm.wait_cnt); in ab8500_chargalg_chg_curr_maxim()
781 if (di->ccm.wait_cnt == 0) { in ab8500_chargalg_chg_curr_maxim()
782 dev_dbg(di->dev, "lowering current\n"); in ab8500_chargalg_chg_curr_maxim()
783 di->ccm.wait_cnt++; in ab8500_chargalg_chg_curr_maxim()
784 di->ccm.condition_cnt = di->bm->maxi->wait_cycles; in ab8500_chargalg_chg_curr_maxim()
785 di->ccm.max_current_ua = di->ccm.current_iset_ua; in ab8500_chargalg_chg_curr_maxim()
786 di->ccm.current_iset_ua = di->ccm.max_current_ua; in ab8500_chargalg_chg_curr_maxim()
787 di->ccm.level--; in ab8500_chargalg_chg_curr_maxim()
790 dev_dbg(di->dev, "waiting\n"); in ab8500_chargalg_chg_curr_maxim()
792 di->ccm.wait_cnt = (di->ccm.wait_cnt + 1) % 3; in ab8500_chargalg_chg_curr_maxim()
797 di->ccm.wait_cnt = 0; in ab8500_chargalg_chg_curr_maxim()
799 if (di->batt_data.inst_curr_ua > di->ccm.original_iset_ua) { in ab8500_chargalg_chg_curr_maxim()
800 dev_dbg(di->dev, " Maximization Ibat (%duA) too high" in ab8500_chargalg_chg_curr_maxim()
802 di->batt_data.inst_curr_ua, di->ccm.original_iset_ua, in ab8500_chargalg_chg_curr_maxim()
803 di->ccm.current_iset_ua); in ab8500_chargalg_chg_curr_maxim()
805 if (di->ccm.current_iset_ua == di->ccm.original_iset_ua) in ab8500_chargalg_chg_curr_maxim()
808 di->ccm.condition_cnt = di->bm->maxi->wait_cycles; in ab8500_chargalg_chg_curr_maxim()
809 di->ccm.current_iset_ua = di->ccm.original_iset_ua; in ab8500_chargalg_chg_curr_maxim()
810 di->ccm.level = 0; in ab8500_chargalg_chg_curr_maxim()
815 di->ccm.condition_cnt = di->bm->maxi->wait_cycles; in ab8500_chargalg_chg_curr_maxim()
821 struct power_supply_battery_info *bi = di->bm->bi; in handle_maxim_chg_curr()
829 di->ccm.current_iset_ua); in handle_maxim_chg_curr()
831 dev_err(di->dev, "failed to set chg curr\n"); in handle_maxim_chg_curr()
835 bi->constant_charge_current_max_ua); in handle_maxim_chg_curr()
837 dev_err(di->dev, "failed to set chg curr\n"); in handle_maxim_chg_curr()
851 const char **supplicants = (const char **)ext->supplied_to; in ab8500_chargalg_get_ext_psy_data()
860 j = match_string(supplicants, ext->num_supplicants, psy->desc->name); in ab8500_chargalg_get_ext_psy_data()
870 di->batt_data.percent = ret.intval; in ab8500_chargalg_get_ext_psy_data()
875 for (j = 0; j < ext->desc->num_properties; j++) { in ab8500_chargalg_get_ext_psy_data()
877 prop = ext->desc->properties[j]; in ab8500_chargalg_get_ext_psy_data()
882 if (!di->ac_chg && in ab8500_chargalg_get_ext_psy_data()
883 ext->desc->type == POWER_SUPPLY_TYPE_MAINS) in ab8500_chargalg_get_ext_psy_data()
884 di->ac_chg = psy_to_ux500_charger(ext); in ab8500_chargalg_get_ext_psy_data()
885 else if (!di->usb_chg && in ab8500_chargalg_get_ext_psy_data()
886 ext->desc->type == POWER_SUPPLY_TYPE_USB) in ab8500_chargalg_get_ext_psy_data()
887 di->usb_chg = psy_to_ux500_charger(ext); in ab8500_chargalg_get_ext_psy_data()
893 switch (ext->desc->type) { in ab8500_chargalg_get_ext_psy_data()
897 di->events.batt_rem = false; in ab8500_chargalg_get_ext_psy_data()
900 di->events.batt_rem = true; in ab8500_chargalg_get_ext_psy_data()
905 (di->chg_info.conn_chg & AC_CHG)) { in ab8500_chargalg_get_ext_psy_data()
906 di->chg_info.prev_conn_chg = in ab8500_chargalg_get_ext_psy_data()
907 di->chg_info.conn_chg; in ab8500_chargalg_get_ext_psy_data()
908 di->chg_info.conn_chg &= ~AC_CHG; in ab8500_chargalg_get_ext_psy_data()
912 !(di->chg_info.conn_chg & AC_CHG)) { in ab8500_chargalg_get_ext_psy_data()
913 di->chg_info.prev_conn_chg = in ab8500_chargalg_get_ext_psy_data()
914 di->chg_info.conn_chg; in ab8500_chargalg_get_ext_psy_data()
915 di->chg_info.conn_chg |= AC_CHG; in ab8500_chargalg_get_ext_psy_data()
921 (di->chg_info.conn_chg & USB_CHG)) { in ab8500_chargalg_get_ext_psy_data()
922 di->chg_info.prev_conn_chg = in ab8500_chargalg_get_ext_psy_data()
923 di->chg_info.conn_chg; in ab8500_chargalg_get_ext_psy_data()
924 di->chg_info.conn_chg &= ~USB_CHG; in ab8500_chargalg_get_ext_psy_data()
928 !(di->chg_info.conn_chg & USB_CHG)) { in ab8500_chargalg_get_ext_psy_data()
929 di->chg_info.prev_conn_chg = in ab8500_chargalg_get_ext_psy_data()
930 di->chg_info.conn_chg; in ab8500_chargalg_get_ext_psy_data()
931 di->chg_info.conn_chg |= USB_CHG; in ab8500_chargalg_get_ext_psy_data()
940 switch (ext->desc->type) { in ab8500_chargalg_get_ext_psy_data()
946 (di->chg_info.online_chg & AC_CHG)) { in ab8500_chargalg_get_ext_psy_data()
947 di->chg_info.prev_online_chg = in ab8500_chargalg_get_ext_psy_data()
948 di->chg_info.online_chg; in ab8500_chargalg_get_ext_psy_data()
949 di->chg_info.online_chg &= ~AC_CHG; in ab8500_chargalg_get_ext_psy_data()
953 !(di->chg_info.online_chg & AC_CHG)) { in ab8500_chargalg_get_ext_psy_data()
954 di->chg_info.prev_online_chg = in ab8500_chargalg_get_ext_psy_data()
955 di->chg_info.online_chg; in ab8500_chargalg_get_ext_psy_data()
956 di->chg_info.online_chg |= AC_CHG; in ab8500_chargalg_get_ext_psy_data()
957 queue_delayed_work(di->chargalg_wq, in ab8500_chargalg_get_ext_psy_data()
958 &di->chargalg_wd_work, 0); in ab8500_chargalg_get_ext_psy_data()
964 (di->chg_info.online_chg & USB_CHG)) { in ab8500_chargalg_get_ext_psy_data()
965 di->chg_info.prev_online_chg = in ab8500_chargalg_get_ext_psy_data()
966 di->chg_info.online_chg; in ab8500_chargalg_get_ext_psy_data()
967 di->chg_info.online_chg &= ~USB_CHG; in ab8500_chargalg_get_ext_psy_data()
971 !(di->chg_info.online_chg & USB_CHG)) { in ab8500_chargalg_get_ext_psy_data()
972 di->chg_info.prev_online_chg = in ab8500_chargalg_get_ext_psy_data()
973 di->chg_info.online_chg; in ab8500_chargalg_get_ext_psy_data()
974 di->chg_info.online_chg |= USB_CHG; in ab8500_chargalg_get_ext_psy_data()
975 queue_delayed_work(di->chargalg_wq, in ab8500_chargalg_get_ext_psy_data()
976 &di->chargalg_wd_work, 0); in ab8500_chargalg_get_ext_psy_data()
985 switch (ext->desc->type) { in ab8500_chargalg_get_ext_psy_data()
991 di->events.mainextchnotok = true; in ab8500_chargalg_get_ext_psy_data()
992 di->events.main_thermal_prot = false; in ab8500_chargalg_get_ext_psy_data()
993 di->events.main_ovv = false; in ab8500_chargalg_get_ext_psy_data()
994 di->events.ac_wd_expired = false; in ab8500_chargalg_get_ext_psy_data()
997 di->events.ac_wd_expired = true; in ab8500_chargalg_get_ext_psy_data()
998 di->events.mainextchnotok = false; in ab8500_chargalg_get_ext_psy_data()
999 di->events.main_ovv = false; in ab8500_chargalg_get_ext_psy_data()
1000 di->events.main_thermal_prot = false; in ab8500_chargalg_get_ext_psy_data()
1004 di->events.main_thermal_prot = true; in ab8500_chargalg_get_ext_psy_data()
1005 di->events.mainextchnotok = false; in ab8500_chargalg_get_ext_psy_data()
1006 di->events.main_ovv = false; in ab8500_chargalg_get_ext_psy_data()
1007 di->events.ac_wd_expired = false; in ab8500_chargalg_get_ext_psy_data()
1010 di->events.main_ovv = true; in ab8500_chargalg_get_ext_psy_data()
1011 di->events.mainextchnotok = false; in ab8500_chargalg_get_ext_psy_data()
1012 di->events.main_thermal_prot = false; in ab8500_chargalg_get_ext_psy_data()
1013 di->events.ac_wd_expired = false; in ab8500_chargalg_get_ext_psy_data()
1016 di->events.main_thermal_prot = false; in ab8500_chargalg_get_ext_psy_data()
1017 di->events.mainextchnotok = false; in ab8500_chargalg_get_ext_psy_data()
1018 di->events.main_ovv = false; in ab8500_chargalg_get_ext_psy_data()
1019 di->events.ac_wd_expired = false; in ab8500_chargalg_get_ext_psy_data()
1029 di->events.usbchargernotok = true; in ab8500_chargalg_get_ext_psy_data()
1030 di->events.usb_thermal_prot = false; in ab8500_chargalg_get_ext_psy_data()
1031 di->events.vbus_ovv = false; in ab8500_chargalg_get_ext_psy_data()
1032 di->events.usb_wd_expired = false; in ab8500_chargalg_get_ext_psy_data()
1035 di->events.usb_wd_expired = true; in ab8500_chargalg_get_ext_psy_data()
1036 di->events.usbchargernotok = false; in ab8500_chargalg_get_ext_psy_data()
1037 di->events.usb_thermal_prot = false; in ab8500_chargalg_get_ext_psy_data()
1038 di->events.vbus_ovv = false; in ab8500_chargalg_get_ext_psy_data()
1042 di->events.usb_thermal_prot = true; in ab8500_chargalg_get_ext_psy_data()
1043 di->events.usbchargernotok = false; in ab8500_chargalg_get_ext_psy_data()
1044 di->events.vbus_ovv = false; in ab8500_chargalg_get_ext_psy_data()
1045 di->events.usb_wd_expired = false; in ab8500_chargalg_get_ext_psy_data()
1048 di->events.vbus_ovv = true; in ab8500_chargalg_get_ext_psy_data()
1049 di->events.usbchargernotok = false; in ab8500_chargalg_get_ext_psy_data()
1050 di->events.usb_thermal_prot = false; in ab8500_chargalg_get_ext_psy_data()
1051 di->events.usb_wd_expired = false; in ab8500_chargalg_get_ext_psy_data()
1054 di->events.usbchargernotok = false; in ab8500_chargalg_get_ext_psy_data()
1055 di->events.usb_thermal_prot = false; in ab8500_chargalg_get_ext_psy_data()
1056 di->events.vbus_ovv = false; in ab8500_chargalg_get_ext_psy_data()
1057 di->events.usb_wd_expired = false; in ab8500_chargalg_get_ext_psy_data()
1069 switch (ext->desc->type) { in ab8500_chargalg_get_ext_psy_data()
1071 di->batt_data.volt_uv = ret.intval; in ab8500_chargalg_get_ext_psy_data()
1074 di->chg_info.ac_volt_uv = ret.intval; in ab8500_chargalg_get_ext_psy_data()
1077 di->chg_info.usb_volt_uv = ret.intval; in ab8500_chargalg_get_ext_psy_data()
1085 switch (ext->desc->type) { in ab8500_chargalg_get_ext_psy_data()
1090 di->events.ac_cv_active = true; in ab8500_chargalg_get_ext_psy_data()
1092 di->events.ac_cv_active = false; in ab8500_chargalg_get_ext_psy_data()
1099 di->events.usb_cv_active = true; in ab8500_chargalg_get_ext_psy_data()
1101 di->events.usb_cv_active = false; in ab8500_chargalg_get_ext_psy_data()
1110 switch (ext->desc->type) { in ab8500_chargalg_get_ext_psy_data()
1113 di->events.batt_unknown = false; in ab8500_chargalg_get_ext_psy_data()
1115 di->events.batt_unknown = true; in ab8500_chargalg_get_ext_psy_data()
1124 di->batt_data.temp = ret.intval / 10; in ab8500_chargalg_get_ext_psy_data()
1128 switch (ext->desc->type) { in ab8500_chargalg_get_ext_psy_data()
1130 di->chg_info.ac_curr_ua = ret.intval; in ab8500_chargalg_get_ext_psy_data()
1133 di->chg_info.usb_curr_ua = ret.intval; in ab8500_chargalg_get_ext_psy_data()
1136 di->batt_data.inst_curr_ua = ret.intval; in ab8500_chargalg_get_ext_psy_data()
1144 switch (ext->desc->type) { in ab8500_chargalg_get_ext_psy_data()
1146 di->batt_data.avg_curr_ua = ret.intval; in ab8500_chargalg_get_ext_psy_data()
1150 di->events.vbus_collapsed = true; in ab8500_chargalg_get_ext_psy_data()
1152 di->events.vbus_collapsed = false; in ab8500_chargalg_get_ext_psy_data()
1160 di->batt_data.percent = ret.intval; in ab8500_chargalg_get_ext_psy_data()
1170 * ab8500_chargalg_external_power_changed() - callback for power supply changes
1186 if (di->chargalg_wq) in ab8500_chargalg_external_power_changed()
1187 queue_work(di->chargalg_wq, &di->chargalg_work); in ab8500_chargalg_external_power_changed()
1191 * ab8500_chargalg_time_to_restart() - time to restart CC/CV charging?
1199 struct power_supply_battery_info *bi = di->bm->bi; in ab8500_chargalg_time_to_restart()
1201 /* Sanity check - these need to have some reasonable values */ in ab8500_chargalg_time_to_restart()
1202 if (!di->batt_data.volt_uv || !di->batt_data.percent) in ab8500_chargalg_time_to_restart()
1205 /* Some batteries tell us at which voltage we should restart charging */ in ab8500_chargalg_time_to_restart()
1206 if (bi->charge_restart_voltage_uv > 0) { in ab8500_chargalg_time_to_restart()
1207 if (di->batt_data.volt_uv <= bi->charge_restart_voltage_uv) in ab8500_chargalg_time_to_restart()
1211 if (di->batt_data.percent <= AB8500_RECHARGE_CAP) in ab8500_chargalg_time_to_restart()
1219 * ab8500_chargalg_algorithm() - Main function for the algorithm
1229 struct power_supply_battery_info *bi = di->bm->bi; in ab8500_chargalg_algorithm()
1234 power_supply_for_each_device(di->chargalg_psy, ab8500_chargalg_get_ext_psy_data); in ab8500_chargalg_algorithm()
1242 if (is_ab8500(di->parent)) { in ab8500_chargalg_algorithm()
1245 dev_err(di->dev, "Checking charger is enabled error" in ab8500_chargalg_algorithm()
1255 (di->events.batt_unknown && !di->bm->chg_unknown_bat)) { in ab8500_chargalg_algorithm()
1256 if (di->charge_state != STATE_HANDHELD) { in ab8500_chargalg_algorithm()
1257 di->events.safety_timer_expired = false; in ab8500_chargalg_algorithm()
1263 else if (di->events.safety_timer_expired) { in ab8500_chargalg_algorithm()
1264 if (di->charge_state != STATE_SAFETY_TIMER_EXPIRED) in ab8500_chargalg_algorithm()
1270 * that will prevent us from charging in ab8500_chargalg_algorithm()
1274 else if (di->events.batt_rem) { in ab8500_chargalg_algorithm()
1275 if (di->charge_state != STATE_BATT_REMOVED) in ab8500_chargalg_algorithm()
1279 else if (di->events.mainextchnotok || di->events.usbchargernotok) { in ab8500_chargalg_algorithm()
1284 if (di->charge_state != STATE_CHG_NOT_OK && in ab8500_chargalg_algorithm()
1285 !di->events.vbus_collapsed) in ab8500_chargalg_algorithm()
1289 else if (di->events.vbus_ovv || in ab8500_chargalg_algorithm()
1290 di->events.main_ovv || in ab8500_chargalg_algorithm()
1291 di->events.batt_ovv || in ab8500_chargalg_algorithm()
1292 !di->chg_info.usb_chg_ok || in ab8500_chargalg_algorithm()
1293 !di->chg_info.ac_chg_ok) { in ab8500_chargalg_algorithm()
1294 if (di->charge_state != STATE_OVV_PROTECT) in ab8500_chargalg_algorithm()
1298 else if (di->events.main_thermal_prot || in ab8500_chargalg_algorithm()
1299 di->events.usb_thermal_prot) { in ab8500_chargalg_algorithm()
1300 if (di->charge_state != STATE_HW_TEMP_PROTECT) in ab8500_chargalg_algorithm()
1305 else if (di->events.btemp_underover) { in ab8500_chargalg_algorithm()
1306 if (di->charge_state != STATE_TEMP_UNDEROVER) in ab8500_chargalg_algorithm()
1311 else if (di->events.ac_wd_expired || in ab8500_chargalg_algorithm()
1312 di->events.usb_wd_expired) { in ab8500_chargalg_algorithm()
1313 if (di->charge_state != STATE_WD_EXPIRED) in ab8500_chargalg_algorithm()
1317 else if (di->events.btemp_low || di->events.btemp_high) { in ab8500_chargalg_algorithm()
1318 if (di->charge_state != STATE_TEMP_LOWHIGH) in ab8500_chargalg_algorithm()
1322 dev_dbg(di->dev, in ab8500_chargalg_algorithm()
1327 di->batt_data.volt_uv, in ab8500_chargalg_algorithm()
1328 di->batt_data.avg_curr_ua, in ab8500_chargalg_algorithm()
1329 di->batt_data.inst_curr_ua, in ab8500_chargalg_algorithm()
1330 di->batt_data.temp, in ab8500_chargalg_algorithm()
1331 di->batt_data.percent, in ab8500_chargalg_algorithm()
1332 di->maintenance_chg, in ab8500_chargalg_algorithm()
1333 states[di->charge_state], in ab8500_chargalg_algorithm()
1334 di->chg_info.charger_type, in ab8500_chargalg_algorithm()
1335 di->charge_status, in ab8500_chargalg_algorithm()
1336 di->chg_info.conn_chg & AC_CHG, in ab8500_chargalg_algorithm()
1337 di->chg_info.conn_chg & USB_CHG, in ab8500_chargalg_algorithm()
1338 di->chg_info.online_chg & AC_CHG, in ab8500_chargalg_algorithm()
1339 di->chg_info.online_chg & USB_CHG, in ab8500_chargalg_algorithm()
1340 di->events.ac_cv_active, in ab8500_chargalg_algorithm()
1341 di->events.usb_cv_active, in ab8500_chargalg_algorithm()
1342 di->chg_info.ac_curr_ua, in ab8500_chargalg_algorithm()
1343 di->chg_info.usb_curr_ua, in ab8500_chargalg_algorithm()
1344 di->chg_info.ac_vset_uv, in ab8500_chargalg_algorithm()
1345 di->chg_info.ac_iset_ua, in ab8500_chargalg_algorithm()
1346 di->chg_info.usb_vset_uv, in ab8500_chargalg_algorithm()
1347 di->chg_info.usb_iset_ua); in ab8500_chargalg_algorithm()
1349 switch (di->charge_state) { in ab8500_chargalg_algorithm()
1352 di->charge_status = POWER_SUPPLY_STATUS_DISCHARGING; in ab8500_chargalg_algorithm()
1365 if (!di->events.batt_rem) in ab8500_chargalg_algorithm()
1375 if (!di->events.main_thermal_prot && in ab8500_chargalg_algorithm()
1376 !di->events.usb_thermal_prot) in ab8500_chargalg_algorithm()
1386 if (!di->events.vbus_ovv && in ab8500_chargalg_algorithm()
1387 !di->events.main_ovv && in ab8500_chargalg_algorithm()
1388 !di->events.batt_ovv && in ab8500_chargalg_algorithm()
1389 di->chg_info.usb_chg_ok && in ab8500_chargalg_algorithm()
1390 di->chg_info.ac_chg_ok) in ab8500_chargalg_algorithm()
1400 if (!di->events.mainextchnotok && in ab8500_chargalg_algorithm()
1401 !di->events.usbchargernotok) in ab8500_chargalg_algorithm()
1415 if (bi->constant_charge_current_max_ua == 0) in ab8500_chargalg_algorithm()
1420 bi->constant_charge_voltage_max_uv, in ab8500_chargalg_algorithm()
1421 bi->constant_charge_current_max_ua); in ab8500_chargalg_algorithm()
1428 di->charge_status = POWER_SUPPLY_STATUS_CHARGING; in ab8500_chargalg_algorithm()
1429 di->eoc_cnt = 0; in ab8500_chargalg_algorithm()
1430 di->maintenance_chg = false; in ab8500_chargalg_algorithm()
1431 power_supply_changed(di->chargalg_psy); in ab8500_chargalg_algorithm()
1437 if (di->charge_status == POWER_SUPPLY_STATUS_FULL && in ab8500_chargalg_algorithm()
1438 di->maintenance_chg) { in ab8500_chargalg_algorithm()
1469 power_supply_changed(di->chargalg_psy); in ab8500_chargalg_algorithm()
1474 mt->charge_safety_timer_minutes); in ab8500_chargalg_algorithm()
1476 mt->charge_voltage_max_uv, in ab8500_chargalg_algorithm()
1477 mt->charge_current_max_ua); in ab8500_chargalg_algorithm()
1479 power_supply_changed(di->chargalg_psy); in ab8500_chargalg_algorithm()
1483 if (di->events.maintenance_timer_expired) { in ab8500_chargalg_algorithm()
1493 dev_info(di->dev, "restarted charging from maintenance state A - battery getting old?\n"); in ab8500_chargalg_algorithm()
1502 power_supply_changed(di->chargalg_psy); in ab8500_chargalg_algorithm()
1506 mt->charge_safety_timer_minutes); in ab8500_chargalg_algorithm()
1508 mt->charge_voltage_max_uv, in ab8500_chargalg_algorithm()
1509 mt->charge_current_max_ua); in ab8500_chargalg_algorithm()
1511 power_supply_changed(di->chargalg_psy); in ab8500_chargalg_algorithm()
1515 if (di->events.maintenance_timer_expired) { in ab8500_chargalg_algorithm()
1525 dev_info(di->dev, "restarted charging from maintenance state B - battery getting old?\n"); in ab8500_chargalg_algorithm()
1530 if (di->events.btemp_low) { in ab8500_chargalg_algorithm()
1532 bi->alert_low_temp_charge_voltage_uv, in ab8500_chargalg_algorithm()
1533 bi->alert_low_temp_charge_current_ua); in ab8500_chargalg_algorithm()
1534 } else if (di->events.btemp_high) { in ab8500_chargalg_algorithm()
1536 bi->alert_high_temp_charge_voltage_uv, in ab8500_chargalg_algorithm()
1537 bi->alert_high_temp_charge_current_ua); in ab8500_chargalg_algorithm()
1539 dev_err(di->dev, "neither low or high temp event occurred\n"); in ab8500_chargalg_algorithm()
1544 di->charge_status = POWER_SUPPLY_STATUS_CHARGING; in ab8500_chargalg_algorithm()
1546 power_supply_changed(di->chargalg_psy); in ab8500_chargalg_algorithm()
1550 if (!di->events.btemp_low && !di->events.btemp_high) in ab8500_chargalg_algorithm()
1560 if (!di->events.ac_wd_expired && in ab8500_chargalg_algorithm()
1561 !di->events.usb_wd_expired) in ab8500_chargalg_algorithm()
1571 if (!di->events.btemp_underover) in ab8500_chargalg_algorithm()
1577 if (di->charge_state == STATE_NORMAL_INIT || in ab8500_chargalg_algorithm()
1578 di->charge_state == STATE_MAINTENANCE_A_INIT || in ab8500_chargalg_algorithm()
1579 di->charge_state == STATE_MAINTENANCE_B_INIT) in ab8500_chargalg_algorithm()
1580 queue_work(di->chargalg_wq, &di->chargalg_work); in ab8500_chargalg_algorithm()
1584 * ab8500_chargalg_periodic_work() - Periodic work for the algorithm
1600 if (di->chg_info.conn_chg) in ab8500_chargalg_periodic_work()
1601 queue_delayed_work(di->chargalg_wq, in ab8500_chargalg_periodic_work()
1602 &di->chargalg_periodic_work, in ab8500_chargalg_periodic_work()
1603 di->bm->interval_charging * HZ); in ab8500_chargalg_periodic_work()
1605 queue_delayed_work(di->chargalg_wq, in ab8500_chargalg_periodic_work()
1606 &di->chargalg_periodic_work, in ab8500_chargalg_periodic_work()
1607 di->bm->interval_not_charging * HZ); in ab8500_chargalg_periodic_work()
1611 * ab8500_chargalg_wd_work() - periodic work to kick the charger watchdog
1624 dev_err(di->dev, "failed to kick watchdog\n"); in ab8500_chargalg_wd_work()
1626 queue_delayed_work(di->chargalg_wq, in ab8500_chargalg_wd_work()
1627 &di->chargalg_wd_work, CHG_WD_INTERVAL); in ab8500_chargalg_wd_work()
1631 * ab8500_chargalg_work() - Work to run the charging algorithm instantly
1645 * ab8500_chargalg_get_property() - get the chargalg properties
1664 val->intval = di->charge_status; in ab8500_chargalg_get_property()
1667 if (di->events.batt_ovv) { in ab8500_chargalg_get_property()
1668 val->intval = POWER_SUPPLY_HEALTH_OVERVOLTAGE; in ab8500_chargalg_get_property()
1669 } else if (di->events.btemp_underover) { in ab8500_chargalg_get_property()
1670 if (di->batt_data.temp <= di->bm->bi->temp_min) in ab8500_chargalg_get_property()
1671 val->intval = POWER_SUPPLY_HEALTH_COLD; in ab8500_chargalg_get_property()
1673 val->intval = POWER_SUPPLY_HEALTH_OVERHEAT; in ab8500_chargalg_get_property()
1674 } else if (di->charge_state == STATE_SAFETY_TIMER_EXPIRED || in ab8500_chargalg_get_property()
1675 di->charge_state == STATE_SAFETY_TIMER_EXPIRED_INIT) { in ab8500_chargalg_get_property()
1676 val->intval = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE; in ab8500_chargalg_get_property()
1678 val->intval = POWER_SUPPLY_HEALTH_GOOD; in ab8500_chargalg_get_property()
1682 return -EINVAL; in ab8500_chargalg_get_property()
1692 if (di->chg_info.online_chg) in ab8500_chargalg_resume()
1693 queue_delayed_work(di->chargalg_wq, &di->chargalg_wd_work, 0); in ab8500_chargalg_resume()
1699 queue_delayed_work(di->chargalg_wq, &di->chargalg_periodic_work, 0); in ab8500_chargalg_resume()
1708 if (di->chg_info.online_chg) in ab8500_chargalg_suspend()
1709 cancel_delayed_work_sync(&di->chargalg_wd_work); in ab8500_chargalg_suspend()
1711 cancel_delayed_work_sync(&di->chargalg_periodic_work); in ab8500_chargalg_suspend()
1735 di->chargalg_wq = alloc_ordered_workqueue("ab8500_chargalg_wq", in ab8500_chargalg_bind()
1737 if (di->chargalg_wq == NULL) { in ab8500_chargalg_bind()
1738 dev_err(di->dev, "failed to create work queue\n"); in ab8500_chargalg_bind()
1739 return -ENOMEM; in ab8500_chargalg_bind()
1743 queue_delayed_work(di->chargalg_wq, &di->chargalg_periodic_work, 0); in ab8500_chargalg_bind()
1754 hrtimer_cancel(&di->safety_timer); in ab8500_chargalg_unbind()
1755 hrtimer_cancel(&di->maintenance_timer); in ab8500_chargalg_unbind()
1757 cancel_delayed_work_sync(&di->chargalg_periodic_work); in ab8500_chargalg_unbind()
1758 cancel_delayed_work_sync(&di->chargalg_wd_work); in ab8500_chargalg_unbind()
1759 cancel_work_sync(&di->chargalg_work); in ab8500_chargalg_unbind()
1762 destroy_workqueue(di->chargalg_wq); in ab8500_chargalg_unbind()
1772 struct device *dev = &pdev->dev; in ab8500_chargalg_probe()
1778 return -ENOMEM; in ab8500_chargalg_probe()
1780 di->bm = &ab8500_bm_data; in ab8500_chargalg_probe()
1783 di->dev = dev; in ab8500_chargalg_probe()
1784 di->parent = dev_get_drvdata(pdev->dev.parent); in ab8500_chargalg_probe()
1791 hrtimer_init(&di->safety_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in ab8500_chargalg_probe()
1792 di->safety_timer.function = ab8500_chargalg_safety_timer_expired; in ab8500_chargalg_probe()
1795 hrtimer_init(&di->maintenance_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in ab8500_chargalg_probe()
1796 di->maintenance_timer.function = in ab8500_chargalg_probe()
1800 INIT_DEFERRABLE_WORK(&di->chargalg_periodic_work, in ab8500_chargalg_probe()
1802 INIT_DEFERRABLE_WORK(&di->chargalg_wd_work, in ab8500_chargalg_probe()
1806 INIT_WORK(&di->chargalg_work, ab8500_chargalg_work); in ab8500_chargalg_probe()
1809 di->chg_info.prev_conn_chg = -1; in ab8500_chargalg_probe()
1812 di->chargalg_psy = devm_power_supply_register(di->dev, in ab8500_chargalg_probe()
1815 if (IS_ERR(di->chargalg_psy)) { in ab8500_chargalg_probe()
1816 dev_err(di->dev, "failed to register chargalg psy\n"); in ab8500_chargalg_probe()
1817 return PTR_ERR(di->chargalg_psy); in ab8500_chargalg_probe()
1822 dev_info(di->dev, "probe success\n"); in ab8500_chargalg_probe()
1828 component_del(&pdev->dev, &ab8500_chargalg_component_ops); in ab8500_chargalg_remove()
1834 { .compatible = "stericsson,ab8500-chargalg", },
1849 MODULE_ALIAS("platform:ab8500-chargalg");