Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) ST-Ericsson SA 2012
0004  * Author: Johan Gardsmark <johan.gardsmark@stericsson.com> for ST-Ericsson.
0005  */
0006 
0007 #ifndef _AB8500_CHARGALG_H_
0008 #define _AB8500_CHARGALG_H_
0009 
0010 #include <linux/power_supply.h>
0011 
0012 /*
0013  * Valid only for supplies of type:
0014  * - POWER_SUPPLY_TYPE_MAINS,
0015  * - POWER_SUPPLY_TYPE_USB,
0016  * because only them store as drv_data pointer to struct ux500_charger.
0017  */
0018 #define psy_to_ux500_charger(x) power_supply_get_drvdata(x)
0019 
0020 /* Forward declaration */
0021 struct ux500_charger;
0022 
0023 struct ux500_charger_ops {
0024     int (*enable) (struct ux500_charger *, int, int, int);
0025     int (*check_enable) (struct ux500_charger *, int, int);
0026     int (*kick_wd) (struct ux500_charger *);
0027     int (*update_curr) (struct ux500_charger *, int);
0028 };
0029 
0030 /**
0031  * struct ux500_charger - power supply ux500 charger sub class
0032  * @psy         power supply base class
0033  * @ops         ux500 charger operations
0034  * @max_out_volt_uv maximum output charger voltage in uV
0035  * @max_out_curr_ua maximum output charger current in uA
0036  * @enabled     indicates if this charger is used or not
0037  */
0038 struct ux500_charger {
0039     struct power_supply *psy;
0040     struct ux500_charger_ops ops;
0041     int max_out_volt_uv;
0042     int max_out_curr_ua;
0043     int wdt_refresh;
0044     bool enabled;
0045 };
0046 
0047 #endif /* _AB8500_CHARGALG_H_ */