#include <linux/atomic.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/notifier.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/regmap.h>
#include <linux/gpio/consumer.h>
#include <linux/usb/phy_companion.h>
#include <linux/phy/omap_usb.h>
#include <linux/usb/otg.h>
#include <linux/iio/consumer.h>
#include <linux/mfd/motorola-cpcap.h>
#define CPCAP_REG_CRM_UNUSED_641_15 …
#define CPCAP_REG_CRM_UNUSED_641_14 …
#define CPCAP_REG_CRM_CHRG_LED_EN …
#define CPCAP_REG_CRM_RVRSMODE …
#define CPCAP_REG_CRM_ICHRG_TR1 …
#define CPCAP_REG_CRM_ICHRG_TR0 …
#define CPCAP_REG_CRM_FET_OVRD …
#define CPCAP_REG_CRM_FET_CTRL …
#define CPCAP_REG_CRM_VCHRG3 …
#define CPCAP_REG_CRM_VCHRG2 …
#define CPCAP_REG_CRM_VCHRG1 …
#define CPCAP_REG_CRM_VCHRG0 …
#define CPCAP_REG_CRM_ICHRG3 …
#define CPCAP_REG_CRM_ICHRG2 …
#define CPCAP_REG_CRM_ICHRG1 …
#define CPCAP_REG_CRM_ICHRG0 …
#define CPCAP_REG_CRM_TR(val) …
#define CPCAP_REG_CRM_TR_0A00 …
#define CPCAP_REG_CRM_TR_0A24 …
#define CPCAP_REG_CRM_TR_0A48 …
#define CPCAP_REG_CRM_TR_0A72 …
#define CPCAP_REG_CRM_VCHRG(val) …
#define CPCAP_REG_CRM_VCHRG_3V80 …
#define CPCAP_REG_CRM_VCHRG_4V10 …
#define CPCAP_REG_CRM_VCHRG_4V12 …
#define CPCAP_REG_CRM_VCHRG_4V15 …
#define CPCAP_REG_CRM_VCHRG_4V17 …
#define CPCAP_REG_CRM_VCHRG_4V20 …
#define CPCAP_REG_CRM_VCHRG_4V23 …
#define CPCAP_REG_CRM_VCHRG_4V25 …
#define CPCAP_REG_CRM_VCHRG_4V27 …
#define CPCAP_REG_CRM_VCHRG_4V30 …
#define CPCAP_REG_CRM_VCHRG_4V33 …
#define CPCAP_REG_CRM_VCHRG_4V35 …
#define CPCAP_REG_CRM_VCHRG_4V38 …
#define CPCAP_REG_CRM_VCHRG_4V40 …
#define CPCAP_REG_CRM_VCHRG_4V42 …
#define CPCAP_REG_CRM_VCHRG_4V44 …
#define CPCAP_REG_CRM_ICHRG(val) …
#define CPCAP_REG_CRM_ICHRG_0A000 …
#define CPCAP_REG_CRM_ICHRG_0A070 …
#define CPCAP_REG_CRM_ICHRG_0A177 …
#define CPCAP_REG_CRM_ICHRG_0A266 …
#define CPCAP_REG_CRM_ICHRG_0A355 …
#define CPCAP_REG_CRM_ICHRG_0A443 …
#define CPCAP_REG_CRM_ICHRG_0A532 …
#define CPCAP_REG_CRM_ICHRG_0A621 …
#define CPCAP_REG_CRM_ICHRG_0A709 …
#define CPCAP_REG_CRM_ICHRG_0A798 …
#define CPCAP_REG_CRM_ICHRG_0A886 …
#define CPCAP_REG_CRM_ICHRG_0A975 …
#define CPCAP_REG_CRM_ICHRG_1A064 …
#define CPCAP_REG_CRM_ICHRG_1A152 …
#define CPCAP_REG_CRM_ICHRG_1A596 …
#define CPCAP_REG_CRM_ICHRG_NO_LIMIT …
#define CPCAP_BIT_VBUS_SWITCH …
enum { … };
struct cpcap_charger_ddata { … };
struct cpcap_interrupt_desc { … };
struct cpcap_charger_ints_state { … };
static enum power_supply_property cpcap_charger_props[] = …;
static int cpcap_charger_get_charge_voltage(struct cpcap_charger_ddata *ddata)
{ … }
static int cpcap_charger_get_charge_current(struct cpcap_charger_ddata *ddata)
{ … }
static int cpcap_charger_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int cpcap_charger_match_voltage(int voltage)
{ … }
static int
cpcap_charger_get_bat_const_charge_voltage(struct cpcap_charger_ddata *ddata)
{ … }
static int cpcap_charger_current_to_regval(int microamp)
{ … }
static int cpcap_charger_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int cpcap_charger_property_is_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static void cpcap_charger_set_cable_path(struct cpcap_charger_ddata *ddata,
bool enabled)
{ … }
static void cpcap_charger_set_inductive_path(struct cpcap_charger_ddata *ddata,
bool enabled)
{ … }
static void cpcap_charger_update_state(struct cpcap_charger_ddata *ddata,
int state)
{ … }
static int cpcap_charger_disable(struct cpcap_charger_ddata *ddata)
{ … }
static int cpcap_charger_enable(struct cpcap_charger_ddata *ddata,
int max_voltage, int charge_current,
int trickle_current)
{ … }
static bool cpcap_charger_vbus_valid(struct cpcap_charger_ddata *ddata)
{ … }
static void cpcap_charger_vbus_work(struct work_struct *work)
{ … }
static int cpcap_charger_set_vbus(struct phy_companion *comparator,
bool enabled)
{ … }
static int cpcap_charger_get_ints_state(struct cpcap_charger_ddata *ddata,
struct cpcap_charger_ints_state *s)
{ … }
static int cpcap_charger_voltage_to_regval(int voltage)
{ … }
static void cpcap_charger_disconnect(struct cpcap_charger_ddata *ddata,
int state, unsigned long delay)
{ … }
static void cpcap_usb_detect(struct work_struct *work)
{ … }
static irqreturn_t cpcap_charger_irq_thread(int irq, void *data)
{ … }
static int cpcap_usb_init_irq(struct platform_device *pdev,
struct cpcap_charger_ddata *ddata,
const char *name)
{ … }
static const char * const cpcap_charger_irqs[] = …;
static int cpcap_usb_init_interrupts(struct platform_device *pdev,
struct cpcap_charger_ddata *ddata)
{ … }
static void cpcap_charger_init_optional_gpios(struct cpcap_charger_ddata *ddata)
{ … }
static int cpcap_charger_init_iio(struct cpcap_charger_ddata *ddata)
{ … }
static char *cpcap_charger_supplied_to[] = …;
static const struct power_supply_desc cpcap_charger_usb_desc = …;
static const struct of_device_id cpcap_charger_id_table[] = …;
MODULE_DEVICE_TABLE(of, cpcap_charger_id_table);
static int cpcap_charger_probe(struct platform_device *pdev)
{ … }
static void cpcap_charger_shutdown(struct platform_device *pdev)
{ … }
static void cpcap_charger_remove(struct platform_device *pdev)
{ … }
static struct platform_driver cpcap_charger_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;