#include <linux/bits.h>
#include <linux/iio/consumer.h>
#include <linux/iio/types.h>
#include <linux/interrupt.h>
#include <linux/mfd/mp2629.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/regmap.h>
#define MP2629_REG_INPUT_ILIM …
#define MP2629_REG_INPUT_VLIM …
#define MP2629_REG_CHARGE_CTRL …
#define MP2629_REG_CHARGE_ILIM …
#define MP2629_REG_PRECHARGE …
#define MP2629_REG_TERM_CURRENT …
#define MP2629_REG_CHARGE_VLIM …
#define MP2629_REG_TIMER_CTRL …
#define MP2629_REG_IMPEDANCE_COMP …
#define MP2629_REG_INTERRUPT …
#define MP2629_REG_STATUS …
#define MP2629_REG_FAULT …
#define MP2629_MASK_INPUT_TYPE …
#define MP2629_MASK_CHARGE_TYPE …
#define MP2629_MASK_CHARGE_CTRL …
#define MP2629_MASK_WDOG_CTRL …
#define MP2629_MASK_IMPEDANCE …
#define MP2629_INPUTSOURCE_CHANGE …
#define MP2629_CHARGING_CHANGE …
#define MP2629_FAULT_BATTERY …
#define MP2629_FAULT_THERMAL …
#define MP2629_FAULT_INPUT …
#define MP2629_FAULT_OTG …
#define MP2629_MAX_BATT_CAPACITY …
#define MP2629_PROPS(_idx, _min, _max, _step) …
enum mp2629_source_type { … };
enum mp2629_field { … };
struct mp2629_charger { … };
struct mp2629_prop { … };
static enum power_supply_usb_type mp2629_usb_types[] = …;
static enum power_supply_property mp2629_charger_usb_props[] = …;
static enum power_supply_property mp2629_charger_bat_props[] = …;
static struct mp2629_prop props[] = …;
static const struct reg_field mp2629_reg_fields[] = …;
static char *adc_chan_name[] = …;
static int mp2629_read_adc(struct mp2629_charger *charger,
enum mp2629_adc_chan ch,
union power_supply_propval *val)
{ … }
static int mp2629_get_prop(struct mp2629_charger *charger,
enum mp2629_field fld,
union power_supply_propval *val)
{ … }
static int mp2629_set_prop(struct mp2629_charger *charger,
enum mp2629_field fld,
const union power_supply_propval *val)
{ … }
static int mp2629_get_battery_capacity(struct mp2629_charger *charger,
union power_supply_propval *val)
{ … }
static int mp2629_charger_battery_get_prop(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int mp2629_charger_battery_set_prop(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int mp2629_charger_usb_get_prop(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int mp2629_charger_usb_set_prop(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int mp2629_charger_battery_prop_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static int mp2629_charger_usb_prop_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static irqreturn_t mp2629_irq_handler(int irq, void *dev_id)
{ … }
static const struct power_supply_desc mp2629_usb_desc = …;
static const struct power_supply_desc mp2629_battery_desc = …;
static ssize_t batt_impedance_compensation_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t batt_impedance_compensation_store(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t count)
{ … }
static DEVICE_ATTR_RW(batt_impedance_compensation);
static struct attribute *mp2629_charger_sysfs_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static void mp2629_charger_disable(void *data)
{ … }
static int mp2629_charger_probe(struct platform_device *pdev)
{ … }
static const struct of_device_id mp2629_charger_of_match[] = …;
MODULE_DEVICE_TABLE(of, mp2629_charger_of_match);
static struct platform_driver mp2629_charger_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;