ab8500-chargalg.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) ST-Ericsson SA 2012
  4. * Author: Johan Gardsmark <[email protected]> for ST-Ericsson.
  5. */
  6. #ifndef _AB8500_CHARGALG_H_
  7. #define _AB8500_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(x)
  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. };
  24. /**
  25. * struct ux500_charger - power supply ux500 charger sub class
  26. * @psy power supply base class
  27. * @ops ux500 charger operations
  28. * @max_out_volt_uv maximum output charger voltage in uV
  29. * @max_out_curr_ua maximum output charger current in uA
  30. * @enabled indicates if this charger is used or not
  31. */
  32. struct ux500_charger {
  33. struct power_supply *psy;
  34. struct ux500_charger_ops ops;
  35. int max_out_volt_uv;
  36. int max_out_curr_ua;
  37. int wdt_refresh;
  38. bool enabled;
  39. };
  40. #endif /* _AB8500_CHARGALG_H_ */