#include <linux/bitfield.h>
#include <linux/completion.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/power_supply.h>
#include <linux/regmap.h>
#include <linux/usb/pd.h>
#include <linux/usb/role.h>
#include <linux/usb/typec.h>
#define RT1719_REG_TXCTRL1 …
#define RT1719_REG_TXCTRL2 …
#define RT1719_REG_POLICYINFO …
#define RT1719_REG_SRCPDO1 …
#define RT1719_REG_MASKS …
#define RT1719_REG_EVENTS …
#define RT1719_REG_STATS …
#define RT1719_REG_PSELINFO …
#define RT1719_REG_USBSETINFO …
#define RT1719_REG_VENID …
#define RT1719_UNIQUE_PID …
#define RT1719_REQDRSWAP_MASK …
#define RT1719_EVALMODE_MASK …
#define RT1719_REQSRCPDO_MASK …
#define RT1719_TXSPDOREQ_MASK …
#define RT1719_INT_DRSW_ACCEPT …
#define RT1719_INT_RX_SRCCAP …
#define RT1719_INT_VBUS_DCT …
#define RT1719_INT_VBUS_PRESENT …
#define RT1719_INT_PE_SNK_RDY …
#define RT1719_CC1_STAT …
#define RT1719_CC2_STAT …
#define RT1719_POLARITY_MASK …
#define RT1719_DATAROLE_MASK …
#define RT1719_PDSPECREV_MASK …
#define RT1719_SPDOSEL_MASK …
#define RT1719_SPDONUM_MASK …
#define RT1719_ATTACH_VBUS …
#define RT1719_ATTACH_DBG …
#define RT1719_ATTACH_SNK …
#define RT1719_ATTACHDEV_MASK …
#define RT1719_PE_EXP_CONTRACT …
#define RT1719_PSEL_SUPPORT …
#define RT1719_TBLSEL_MASK …
#define RT1719_LATPSEL_MASK …
#define RT1719_USBINFO_MASK …
#define RT1719_USB_DFPUFP …
#define RT1719_MAX_SRCPDO …
enum { … };
enum { … };
enum rt1719_snkcap { … };
struct rt1719_psel_cap { … };
struct rt1719_data { … };
static const enum power_supply_usb_type rt1719_psy_usb_types[] = …;
static const enum power_supply_property rt1719_psy_properties[] = …;
static int rt1719_read16(struct rt1719_data *data, unsigned int reg, u16 *val)
{ … }
static int rt1719_read32(struct rt1719_data *data, unsigned int reg, u32 *val)
{ … }
static int rt1719_write32(struct rt1719_data *data, unsigned int reg, u32 val)
{ … }
static enum typec_pwr_opmode rt1719_get_pwr_opmode(u32 conn, u16 stat)
{ … }
static enum typec_data_role rt1719_get_data_role(u32 conn)
{ … }
static void rt1719_set_data_role(struct rt1719_data *data,
enum typec_data_role data_role,
bool attached)
{ … }
static void rt1719_update_data_role(struct rt1719_data *data)
{ … }
static void rt1719_register_partner(struct rt1719_data *data)
{ … }
static void rt1719_attach(struct rt1719_data *data)
{ … }
static void rt1719_detach(struct rt1719_data *data)
{ … }
static void rt1719_update_operating_status(struct rt1719_data *data)
{ … }
static void rt1719_update_pwr_opmode(struct rt1719_data *data)
{ … }
static void rt1719_update_source_pdos(struct rt1719_data *data)
{ … }
static int rt1719_dr_set(struct typec_port *port, enum typec_data_role role)
{ … }
static const struct typec_operations rt1719_port_ops = …;
static int rt1719_usbpd_request_voltage(struct rt1719_data *data)
{ … }
static int rt1719_psy_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int rt1719_psy_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int rt1719_psy_property_is_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static int devm_rt1719_psy_register(struct rt1719_data *data)
{ … }
static irqreturn_t rt1719_irq_handler(int irq, void *priv)
{ … }
static int rt1719_irq_init(struct rt1719_data *data)
{ … }
static int rt1719_init_attach_state(struct rt1719_data *data)
{ … }
#define RT1719_PSEL_CAPINFO(_lomask, _milliwatt, _himask, _milliamp) …
static const struct rt1719_psel_cap rt1719_psel_caps[] = …;
static u16 rt1719_gen_snkcap_by_current(const struct rt1719_psel_cap *psel_cap,
enum rt1719_snkcap capsel)
{ … }
static u16 rt1719_gen_snkcap_by_watt(const struct rt1719_psel_cap *psel_cap,
enum rt1719_snkcap capsel)
{ … }
static u16 rt1719_gen_snkcap(unsigned int pselinfo, enum rt1719_snkcap capsel)
{ … }
static int rt1719_get_caps(struct rt1719_data *data)
{ … }
static int rt1719_check_exist(struct rt1719_data *data)
{ … }
static const struct regmap_config rt1719_regmap_config = …;
static int rt1719_probe(struct i2c_client *i2c)
{ … }
static void rt1719_remove(struct i2c_client *i2c)
{ … }
static const struct of_device_id __maybe_unused rt1719_device_table[] = …;
MODULE_DEVICE_TABLE(of, rt1719_device_table);
static struct i2c_driver rt1719_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;