ux500_chargalg.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (C) ST-Ericsson SA 2012
  3. * Author: Johan Gardsmark <johan.gardsmark@stericsson.com> for ST-Ericsson.
  4. * License terms: GNU General Public License (GPL), version 2
  5. */
  6. #ifndef _UX500_CHARGALG_H
  7. #define _UX500_CHARGALG_H
  8. #include <linux/power_supply.h>
  9. /*
  10. * Valid only for supplies of type:
  11. * - POWER_SUPPLY_TYPE_MAINS,
  12. * - POWER_SUPPLY_TYPE_USB,
  13. * because only them store as drv_data pointer to struct ux500_charger.
  14. */
  15. #define psy_to_ux500_charger(x) power_supply_get_drvdata(psy)
  16. /* Forward declaration */
  17. struct ux500_charger;
  18. struct ux500_charger_ops {
  19. int (*enable) (struct ux500_charger *, int, int, int);
  20. int (*check_enable) (struct ux500_charger *, int, int);
  21. int (*kick_wd) (struct ux500_charger *);
  22. int (*update_curr) (struct ux500_charger *, int);
  23. int (*pp_enable) (struct ux500_charger *, bool);
  24. int (*pre_chg_enable) (struct ux500_charger *, bool);
  25. };
  26. /**
  27. * struct ux500_charger - power supply ux500 charger sub class
  28. * @psy power supply base class
  29. * @ops ux500 charger operations
  30. * @max_out_volt maximum output charger voltage in mV
  31. * @max_out_curr maximum output charger current in mA
  32. * @enabled indicates if this charger is used or not
  33. * @external external charger unit (pm2xxx)
  34. * @power_path USB power path support
  35. */
  36. struct ux500_charger {
  37. struct power_supply *psy;
  38. struct ux500_charger_ops ops;
  39. int max_out_volt;
  40. int max_out_curr;
  41. int wdt_refresh;
  42. bool enabled;
  43. bool external;
  44. bool power_path;
  45. };
  46. extern struct blocking_notifier_head charger_notifier_list;
  47. #endif