#include <linux/bitfield.h>
#include <linux/extcon-provider.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/usb/typec.h>
#include <linux/usb/typec_altmode.h>
#include <linux/usb/role.h>
#include <linux/irq.h>
#define TUSB320_REG8 …
#define TUSB320_REG8_CURRENT_MODE_ADVERTISE …
#define TUSB320_REG8_CURRENT_MODE_ADVERTISE_USB …
#define TUSB320_REG8_CURRENT_MODE_ADVERTISE_15A …
#define TUSB320_REG8_CURRENT_MODE_ADVERTISE_30A …
#define TUSB320_REG8_CURRENT_MODE_DETECT …
#define TUSB320_REG8_CURRENT_MODE_DETECT_DEF …
#define TUSB320_REG8_CURRENT_MODE_DETECT_MED …
#define TUSB320_REG8_CURRENT_MODE_DETECT_ACC …
#define TUSB320_REG8_CURRENT_MODE_DETECT_HI …
#define TUSB320_REG8_ACCESSORY_CONNECTED …
#define TUSB320_REG8_ACCESSORY_CONNECTED_NONE …
#define TUSB320_REG8_ACCESSORY_CONNECTED_AUDIO …
#define TUSB320_REG8_ACCESSORY_CONNECTED_ACHRG …
#define TUSB320_REG8_ACCESSORY_CONNECTED_DBGDFP …
#define TUSB320_REG8_ACCESSORY_CONNECTED_DBGUFP …
#define TUSB320_REG8_ACTIVE_CABLE_DETECTION …
#define TUSB320_REG9 …
#define TUSB320_REG9_ATTACHED_STATE …
#define TUSB320_REG9_CABLE_DIRECTION …
#define TUSB320_REG9_INTERRUPT_STATUS …
#define TUSB320_REGA …
#define TUSB320L_REGA_DISABLE_TERM …
#define TUSB320_REGA_I2C_SOFT_RESET …
#define TUSB320_REGA_MODE_SELECT_SHIFT …
#define TUSB320_REGA_MODE_SELECT_MASK …
#define TUSB320L_REGA0_REVISION …
enum tusb320_attached_state { … };
enum tusb320_mode { … };
struct tusb320_priv;
struct tusb320_ops { … };
struct tusb320_priv { … };
static const char * const tusb_attached_states[] = …;
static const unsigned int tusb320_extcon_cable[] = …;
static int tusb320_check_signature(struct tusb320_priv *priv)
{ … }
static int tusb320_set_mode(struct tusb320_priv *priv, enum tusb320_mode mode)
{ … }
static int tusb320l_set_mode(struct tusb320_priv *priv, enum tusb320_mode mode)
{ … }
static int tusb320_reset(struct tusb320_priv *priv)
{ … }
static int tusb320l_get_revision(struct tusb320_priv *priv, unsigned int *revision)
{ … }
static struct tusb320_ops tusb320_ops = …;
static struct tusb320_ops tusb320l_ops = …;
static int tusb320_set_adv_pwr_mode(struct tusb320_priv *priv)
{ … }
static int tusb320_port_type_set(struct typec_port *port,
enum typec_port_type type)
{ … }
static const struct typec_operations tusb320_typec_ops = …;
static void tusb320_extcon_irq_handler(struct tusb320_priv *priv, u8 reg)
{ … }
static void tusb320_typec_irq_handler(struct tusb320_priv *priv, u8 reg9)
{ … }
static irqreturn_t tusb320_state_update_handler(struct tusb320_priv *priv,
bool force_update)
{ … }
static irqreturn_t tusb320_irq_handler(int irq, void *dev_id)
{ … }
static const struct regmap_config tusb320_regmap_config = …;
static int tusb320_extcon_probe(struct tusb320_priv *priv)
{ … }
static int tusb320_typec_probe(struct i2c_client *client,
struct tusb320_priv *priv)
{ … }
static void tusb320_typec_remove(struct tusb320_priv *priv)
{ … }
static int tusb320_probe(struct i2c_client *client)
{ … }
static void tusb320_remove(struct i2c_client *client)
{ … }
static const struct of_device_id tusb320_extcon_dt_match[] = …;
MODULE_DEVICE_TABLE(of, tusb320_extcon_dt_match);
static struct i2c_driver tusb320_extcon_driver = …;
static int __init tusb320_init(void)
{ … }
subsys_initcall(tusb320_init);
static void __exit tusb320_exit(void)
{ … }
module_exit(tusb320_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;