mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-30 07:34:12 +08:00
f1c74a6c07
Trying to get the AB8500 charging driver working I ran into a bit
of bitrot: we haven't used the driver for a while so errors in
refactorings won't be noticed.
This one is pretty self evident: use argument to the macro or we
end up with a random pointer to something else.
Cc: stable@vger.kernel.org
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Marcus Cooper <codekipper@gmail.com>
Fixes: 297d716f62
("power_supply: Change ownership from driver to core")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
52 lines
1.4 KiB
C
52 lines
1.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) ST-Ericsson SA 2012
|
|
* Author: Johan Gardsmark <johan.gardsmark@stericsson.com> for ST-Ericsson.
|
|
*/
|
|
|
|
#ifndef _AB8500_CHARGALG_H_
|
|
#define _AB8500_CHARGALG_H_
|
|
|
|
#include <linux/power_supply.h>
|
|
|
|
/*
|
|
* 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.
|
|
*/
|
|
#define psy_to_ux500_charger(x) power_supply_get_drvdata(x)
|
|
|
|
/* Forward declaration */
|
|
struct ux500_charger;
|
|
|
|
struct ux500_charger_ops {
|
|
int (*enable) (struct ux500_charger *, int, int, int);
|
|
int (*check_enable) (struct ux500_charger *, int, int);
|
|
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
|
|
* @enabled indicates if this charger is used or not
|
|
* @external external charger unit (pm2xxx)
|
|
*/
|
|
struct ux500_charger {
|
|
struct power_supply *psy;
|
|
struct ux500_charger_ops ops;
|
|
int max_out_volt;
|
|
int max_out_curr;
|
|
int wdt_refresh;
|
|
bool enabled;
|
|
bool external;
|
|
};
|
|
|
|
extern struct blocking_notifier_head charger_notifier_list;
|
|
|
|
#endif /* _AB8500_CHARGALG_H_ */
|