2019-05-29 00:57:21 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2012-03-01 00:24:25 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) ST-Ericsson SA 2012
|
|
|
|
* Author: Johan Gardsmark <johan.gardsmark@stericsson.com> for ST-Ericsson.
|
|
|
|
*/
|
|
|
|
|
2021-03-12 16:36:03 +08:00
|
|
|
#ifndef _AB8500_CHARGALG_H_
|
|
|
|
#define _AB8500_CHARGALG_H_
|
2012-03-01 00:24:25 +08:00
|
|
|
|
|
|
|
#include <linux/power_supply.h>
|
|
|
|
|
2015-03-12 15:44:11 +08:00
|
|
|
/*
|
|
|
|
* Valid only for supplies of type:
|
|
|
|
* - POWER_SUPPLY_TYPE_MAINS,
|
|
|
|
* - POWER_SUPPLY_TYPE_USB,
|
|
|
|
* because only them store as drv_data pointer to struct ux500_charger.
|
|
|
|
*/
|
2021-06-27 07:47:49 +08:00
|
|
|
#define psy_to_ux500_charger(x) power_supply_get_drvdata(x)
|
2012-03-01 00:24:25 +08:00
|
|
|
|
|
|
|
/* Forward declaration */
|
|
|
|
struct ux500_charger;
|
|
|
|
|
|
|
|
struct ux500_charger_ops {
|
|
|
|
int (*enable) (struct ux500_charger *, int, int, int);
|
2013-02-14 17:24:10 +08:00
|
|
|
int (*check_enable) (struct ux500_charger *, int, int);
|
2012-03-01 00:24:25 +08:00
|
|
|
int (*kick_wd) (struct ux500_charger *);
|
|
|
|
int (*update_curr) (struct ux500_charger *, int);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct ux500_charger - power supply ux500 charger sub class
|
|
|
|
* @psy power supply base class
|
|
|
|
* @ops ux500 charger operations
|
|
|
|
* @max_out_volt maximum output charger voltage in mV
|
|
|
|
* @max_out_curr maximum output charger current in mA
|
2012-04-26 16:00:04 +08:00
|
|
|
* @enabled indicates if this charger is used or not
|
2012-05-10 21:33:56 +08:00
|
|
|
* @external external charger unit (pm2xxx)
|
2012-03-01 00:24:25 +08:00
|
|
|
*/
|
|
|
|
struct ux500_charger {
|
2015-03-12 15:44:11 +08:00
|
|
|
struct power_supply *psy;
|
2012-03-01 00:24:25 +08:00
|
|
|
struct ux500_charger_ops ops;
|
|
|
|
int max_out_volt;
|
|
|
|
int max_out_curr;
|
2012-05-10 21:33:56 +08:00
|
|
|
int wdt_refresh;
|
2012-04-26 16:00:04 +08:00
|
|
|
bool enabled;
|
2012-05-10 21:33:56 +08:00
|
|
|
bool external;
|
2012-03-01 00:24:25 +08:00
|
|
|
};
|
|
|
|
|
2013-02-13 19:39:19 +08:00
|
|
|
extern struct blocking_notifier_head charger_notifier_list;
|
|
|
|
|
2021-03-12 16:36:03 +08:00
|
|
|
#endif /* _AB8500_CHARGALG_H_ */
|