linux/drivers/power/supply/lp8788-charger.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * TI LP8788 MFD - battery charger driver
 *
 * Copyright 2012 Texas Instruments
 *
 * Author: Milo(Woogyom) Kim <[email protected]>
 */

#include <linux/err.h>
#include <linux/iio/consumer.h>
#include <linux/interrupt.h>
#include <linux/irqdomain.h>
#include <linux/mfd/lp8788.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/slab.h>
#include <linux/workqueue.h>

/* register address */
#define LP8788_CHG_STATUS
#define LP8788_CHG_IDCIN
#define LP8788_CHG_IBATT
#define LP8788_CHG_VTERM
#define LP8788_CHG_EOC

/* mask/shift bits */
#define LP8788_CHG_INPUT_STATE_M
#define LP8788_CHG_STATE_M
#define LP8788_CHG_STATE_S
#define LP8788_NO_BATT_M
#define LP8788_BAD_BATT_M
#define LP8788_CHG_IBATT_M
#define LP8788_CHG_VTERM_M
#define LP8788_CHG_EOC_LEVEL_M
#define LP8788_CHG_EOC_LEVEL_S
#define LP8788_CHG_EOC_TIME_M
#define LP8788_CHG_EOC_TIME_S
#define LP8788_CHG_EOC_MODE_M

#define LP8788_CHARGER_NAME
#define LP8788_BATTERY_NAME

#define LP8788_CHG_START
#define LP8788_CHG_END

#define LP8788_ISEL_MAX
#define LP8788_ISEL_STEP
#define LP8788_VTERM_MIN
#define LP8788_VTERM_STEP
#define LP8788_MAX_BATT_CAPACITY
#define LP8788_MAX_CHG_IRQS

enum lp8788_charging_state {};

enum lp8788_charger_adc_sel {};

enum lp8788_charger_input_state {};

/*
 * struct lp8788_chg_irq
 * @which        : lp8788 interrupt id
 * @virq         : Linux IRQ number from irq_domain
 */
struct lp8788_chg_irq {};

/*
 * struct lp8788_charger
 * @lp           : used for accessing the registers of mfd lp8788 device
 * @charger      : power supply driver for the battery charger
 * @battery      : power supply driver for the battery
 * @charger_work : work queue for charger input interrupts
 * @chan         : iio channels for getting adc values
 *                 eg) battery voltage, capacity and temperature
 * @irqs         : charger dedicated interrupts
 * @num_irqs     : total numbers of charger interrupts
 * @pdata        : charger platform specific data
 */
struct lp8788_charger {};

static char *battery_supplied_to[] =;

static enum power_supply_property lp8788_charger_prop[] =;

static enum power_supply_property lp8788_battery_prop[] =;

static bool lp8788_is_charger_detected(struct lp8788_charger *pchg)
{}

static int lp8788_charger_get_property(struct power_supply *psy,
					enum power_supply_property psp,
					union power_supply_propval *val)
{}

static int lp8788_get_battery_status(struct lp8788_charger *pchg,
				union power_supply_propval *val)
{}

static int lp8788_get_battery_health(struct lp8788_charger *pchg,
				union power_supply_propval *val)
{}

static int lp8788_get_battery_present(struct lp8788_charger *pchg,
				union power_supply_propval *val)
{}

static int lp8788_get_vbatt_adc(struct lp8788_charger *pchg, int *result)
{}

static int lp8788_get_battery_voltage(struct lp8788_charger *pchg,
				union power_supply_propval *val)
{}

static int lp8788_get_battery_capacity(struct lp8788_charger *pchg,
				union power_supply_propval *val)
{}

static int lp8788_get_battery_temperature(struct lp8788_charger *pchg,
				union power_supply_propval *val)
{}

static int lp8788_get_battery_charging_current(struct lp8788_charger *pchg,
				union power_supply_propval *val)
{}

static int lp8788_get_charging_termination_voltage(struct lp8788_charger *pchg,
				union power_supply_propval *val)
{}

static int lp8788_battery_get_property(struct power_supply *psy,
					enum power_supply_property psp,
					union power_supply_propval *val)
{}

static inline bool lp8788_is_valid_charger_register(u8 addr)
{}

static int lp8788_update_charger_params(struct platform_device *pdev,
					struct lp8788_charger *pchg)
{}

static const struct power_supply_desc lp8788_psy_charger_desc =;

static const struct power_supply_desc lp8788_psy_battery_desc =;

static void lp8788_charger_event(struct work_struct *work)
{}

static bool lp8788_find_irq_id(struct lp8788_charger *pchg, int virq, int *id)
{}

static irqreturn_t lp8788_charger_irq_thread(int virq, void *ptr)
{}

static int lp8788_set_irqs(struct platform_device *pdev,
			struct lp8788_charger *pchg, const char *name)
{}

static int lp8788_irq_register(struct platform_device *pdev,
				struct lp8788_charger *pchg)
{}

static void lp8788_irq_unregister(struct platform_device *pdev,
				  struct lp8788_charger *pchg)
{}

static void lp8788_setup_adc_channel(struct device *dev,
				struct lp8788_charger *pchg)
{}

static ssize_t lp8788_show_charger_status(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static ssize_t lp8788_show_eoc_time(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static ssize_t lp8788_show_eoc_level(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static DEVICE_ATTR(charger_status, S_IRUSR, lp8788_show_charger_status, NULL);
static DEVICE_ATTR(eoc_time, S_IRUSR, lp8788_show_eoc_time, NULL);
static DEVICE_ATTR(eoc_level, S_IRUSR, lp8788_show_eoc_level, NULL);

static struct attribute *lp8788_charger_sysfs_attrs[] =;

ATTRIBUTE_GROUPS();

static int lp8788_psy_register(struct platform_device *pdev,
				struct lp8788_charger *pchg)
{}

static int lp8788_charger_probe(struct platform_device *pdev)
{}

static void lp8788_charger_remove(struct platform_device *pdev)
{}

static struct platform_driver lp8788_charger_driver =;
module_platform_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_ALIAS();