#include <linux/module.h>
#include <linux/bitfield.h>
#include <linux/delay.h>
#include <linux/ulpi/driver.h>
#include <linux/ulpi/regs.h>
#include <linux/gpio/consumer.h>
#include <linux/phy/ulpi_phy.h>
#include <linux/power_supply.h>
#include <linux/property.h>
#include <linux/workqueue.h>
#define TI_VENDOR_ID …
#define TI_DEVICE_TUSB1210 …
#define TI_DEVICE_TUSB1211 …
#define TUSB1211_POWER_CONTROL …
#define TUSB1211_POWER_CONTROL_SET …
#define TUSB1211_POWER_CONTROL_CLEAR …
#define TUSB1211_POWER_CONTROL_SW_CONTROL …
#define TUSB1211_POWER_CONTROL_DET_COMP …
#define TUSB1211_POWER_CONTROL_DP_VSRC_EN …
#define TUSB1210_VENDOR_SPECIFIC2 …
#define TUSB1210_VENDOR_SPECIFIC2_IHSTX_MASK …
#define TUSB1210_VENDOR_SPECIFIC2_ZHSDRV_MASK …
#define TUSB1210_VENDOR_SPECIFIC2_DP_MASK …
#define TUSB1211_VENDOR_SPECIFIC3 …
#define TUSB1211_VENDOR_SPECIFIC3_SET …
#define TUSB1211_VENDOR_SPECIFIC3_CLEAR …
#define TUSB1211_VENDOR_SPECIFIC3_SW_USB_DET …
#define TUSB1211_VENDOR_SPECIFIC3_CHGD_IDP_SRC_EN …
#define TUSB1210_RESET_TIME_MS …
#define TUSB1210_CHG_DET_MAX_RETRIES …
enum tusb1210_chg_det_state { … };
struct tusb1210 { … };
static int tusb1210_ulpi_write(struct tusb1210 *tusb, u8 reg, u8 val)
{ … }
static int tusb1210_ulpi_read(struct tusb1210 *tusb, u8 reg, u8 *val)
{ … }
static int tusb1210_power_on(struct phy *phy)
{ … }
static int tusb1210_power_off(struct phy *phy)
{ … }
static int tusb1210_set_mode(struct phy *phy, enum phy_mode mode, int submode)
{ … }
#ifdef CONFIG_POWER_SUPPLY
static const char * const tusb1210_chg_det_states[] = …;
static void tusb1210_reset(struct tusb1210 *tusb)
{ … }
static void tusb1210_chg_det_set_type(struct tusb1210 *tusb,
enum power_supply_usb_type type)
{ … }
static void tusb1210_chg_det_set_state(struct tusb1210 *tusb,
enum tusb1210_chg_det_state new_state,
int delay_ms)
{ … }
static void tusb1210_chg_det_handle_ulpi_error(struct tusb1210 *tusb)
{ … }
static const char * const tusb1210_chargers[] = …;
static bool tusb1210_get_online(struct tusb1210 *tusb)
{ … }
static void tusb1210_chg_det_work(struct work_struct *work)
{ … }
static int tusb1210_psy_notifier(struct notifier_block *nb,
unsigned long event, void *ptr)
{ … }
static int tusb1210_psy_get_prop(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static const enum power_supply_property tusb1210_psy_props[] = …;
static const struct power_supply_desc tusb1210_psy_desc = …;
static void tusb1210_probe_charger_detect(struct tusb1210 *tusb)
{ … }
static void tusb1210_remove_charger_detect(struct tusb1210 *tusb)
{ … }
#else
static void tusb1210_probe_charger_detect(struct tusb1210 *tusb) { }
static void tusb1210_remove_charger_detect(struct tusb1210 *tusb) { }
#endif
static const struct phy_ops phy_ops = …;
static int tusb1210_probe(struct ulpi *ulpi)
{ … }
static void tusb1210_remove(struct ulpi *ulpi)
{ … }
static const struct ulpi_device_id tusb1210_ulpi_id[] = …;
MODULE_DEVICE_TABLE(ulpi, tusb1210_ulpi_id);
static struct ulpi_driver tusb1210_driver = …;
module_ulpi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_DESCRIPTION(…) …;