#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/syscalls.h>
#include <linux/suspend.h>
#include <linux/debugfs.h>
#include <linux/extcon.h>
#include <linux/extcon-provider.h>
#include <linux/sys_soc.h>
#include <linux/nvmem-consumer.h>
#include <linux/gpio/consumer.h>
#include <linux/usb/otg.h>
#include <linux/usb/typec.h>
struct cc_param { … };
struct type_c_cfg { … };
struct type_c_data { … };
#define USB_TYPEC_CTRL_CC1_0 …
#define USB_TYPEC_CTRL_CC1_1 …
#define USB_TYPEC_CTRL_CC2_0 …
#define USB_TYPEC_CTRL_CC2_1 …
#define USB_TYPEC_STS …
#define USB_TYPEC_CTRL …
#define USB_DBUS_PWR_CTRL …
#define ENABLE_CC1 …
#define ENABLE_CC2 …
#define DISABLE_CC …
#define PLR_EN …
#define CC_SWITCH_MASK …
#define CC_CODE_MASK …
#define rp4pk_code(val) …
#define code_rp4pk(val) …
#define rp36k_code(val) …
#define code_rp36k(val) …
#define rp12k_code(val) …
#define code_rp12k(val) …
#define rd_code(val) …
#define code_rd(val) …
#define dfp_mode(val) …
#define EN_RP4P7K …
#define EN_RP36K …
#define EN_RP12K …
#define EN_RD …
#define EN_CC_DET …
#define CC_MODE_UFP …
#define CC_MODE_DFP_USB …
#define CC_MODE_DFP_1_5 …
#define CC_MODE_DFP_3_0 …
enum parameter_version { … };
#define V0_vref_2p6v(val) …
#define V0_vref_1p23v(val) …
#define V0_vref_0p8v(val) …
#define V0_vref_0p66v(val) …
#define V0_vref_0p4v(val) …
#define V0_vref_0p2v(val) …
#define V0_vref_1_1p6v(val) …
#define V0_vref_0_1p6v(val) …
#define V0_decode_2p6v(val) …
#define V0_decode_1p23v(val) …
#define V0_decode_0p8v(val) …
#define V0_decode_0p66v(val) …
#define V0_decode_0p4v(val) …
#define V0_decode_0p2v(val) …
#define V0_decode_1_1p6v(val) …
#define V0_decode_0_1p6v(val) …
#define V1_vref_2p6v(val) …
#define V1_vref_1p23v(val) …
#define V1_vref_0p8v(val) …
#define V1_vref_0p66v(val) …
#define V1_vref_0p4v(val) …
#define V1_vref_0p2v(val) …
#define V1_vref_1_1p6v(val) …
#define V1_vref_0_1p6v(val) …
#define V1_decode_2p6v(val) …
#define V1_decode_1p23v(val) …
#define V1_decode_0p8v(val) …
#define V1_decode_0p66v(val) …
#define V1_decode_0p4v(val) …
#define V1_decode_0p2v(val) …
#define V1_decode_1_1p6v(val) …
#define V1_decode_0_1p6v(val) …
#define DET_STS …
#define CC1_DET_STS …
#define CC2_DET_STS …
#define DET_STS_RA …
#define DET_STS_RD …
#define DET_STS_RP …
#define CC1_DET_STS_RA …
#define CC1_DET_STS_RD …
#define CC1_DET_STS_RP …
#define CC2_DET_STS_RA …
#define CC2_DET_STS_RD …
#define CC2_DET_STS_RP …
#define CC2_INT_EN …
#define CC1_INT_EN …
#define CC2_INT_STS …
#define CC1_INT_STS …
#define DEBOUNCE_TIME_MASK …
#define DEBOUNCE_EN …
#define ENABLE_TYPE_C_DETECT …
#define ALL_CC_INT_STS …
#define DETECT_TIME …
static const unsigned int usb_type_c_cable[] = …;
enum usb_data_roles { … };
static const struct soc_device_attribute rtk_soc_kylin[] = …;
static int rtd129x_switch_type_c_plug_config(struct type_c_data *type_c,
int dr_mode, int cc)
{ … }
static inline void switch_type_c_plug_config(struct type_c_data *type_c,
int dr_mode, int cc)
{ … }
static void switch_type_c_dr_mode(struct type_c_data *type_c, int dr_mode, int cc)
{ … }
static int connector_attached(struct type_c_data *type_c, u32 cc, int dr_mode)
{ … }
static int connector_detached(struct type_c_data *type_c, u32 cc, int dr_mode)
{ … }
static int __detect_host_device(struct type_c_data *type_c, u32 rp_or_rd_en)
{ … }
static int detect_device(struct type_c_data *type_c)
{ … }
static int detect_host(struct type_c_data *type_c)
{ … }
static int host_device_switch_detection(struct type_c_data *type_c)
{ … }
static int detect_type_c_state(struct type_c_data *type_c)
{ … }
static void host_device_switch(struct work_struct *work)
{ … }
static irqreturn_t type_c_detect_irq(int irq, void *__data)
{ … }
static int type_c_port_dr_set(struct typec_port *port,
enum typec_data_role role)
{ … }
static const struct typec_operations type_c_port_ops = …;
#ifdef CONFIG_DEBUG_FS
static int type_c_parameter_show(struct seq_file *s, void *unused)
{ … }
static int type_c_parameter_open(struct inode *inode, struct file *file)
{ … }
static const struct file_operations type_c_parameter_fops = …;
static int type_c_status_show(struct seq_file *s, void *unused)
{ … }
static int type_c_status_open(struct inode *inode, struct file *file)
{ … }
static const struct file_operations type_c_status_fops = …;
static inline void create_debug_files(struct type_c_data *type_c)
{ … }
static inline void remove_debug_files(struct type_c_data *type_c)
{ … }
#else
static inline void create_debug_files(struct type_c_data *type_c) { }
static inline void remove_debug_files(struct type_c_data *type_c) { }
#endif
static inline s8 get_value(s8 value)
{ … }
static int __updated_type_c_parameter_by_efuse(struct type_c_data *type_c)
{ … }
static int __updated_type_c_parameter_by_efuse_v2(struct type_c_data *type_c)
{ … }
static void get_default_type_c_parameter(struct type_c_data *type_c)
{ … }
static int setup_type_c_parameter(struct type_c_data *type_c)
{ … }
static int extcon_rtk_type_c_init(struct type_c_data *type_c)
{ … }
static int extcon_rtk_type_c_edev_register(struct type_c_data *type_c)
{ … }
static int extcon_rtk_type_c_probe(struct platform_device *pdev)
{ … }
static void extcon_rtk_type_c_remove(struct platform_device *pdev)
{ … }
static const struct type_c_cfg rtd1295_type_c_cfg = …;
static const struct type_c_cfg rtd1395_type_c_cfg = …;
static const struct type_c_cfg rtd1619_type_c_cfg = …;
static const struct type_c_cfg rtd1319_type_c_cfg = …;
static const struct type_c_cfg rtd1312c_type_c_cfg = …;
static const struct type_c_cfg rtd1619b_type_c_cfg = …;
static const struct type_c_cfg rtd1319d_type_c_cfg = …;
static const struct type_c_cfg rtd1315e_type_c_cfg = …;
static const struct of_device_id extcon_rtk_type_c_match[] = …;
MODULE_DEVICE_TABLE(of, extcon_rtk_type_c_match);
#ifdef CONFIG_PM_SLEEP
static int extcon_rtk_type_c_prepare(struct device *dev)
{ … }
static void extcon_rtk_type_c_complete(struct device *dev)
{ … }
static int extcon_rtk_type_c_suspend(struct device *dev)
{ … }
static int extcon_rtk_type_c_resume(struct device *dev)
{ … }
static const struct dev_pm_ops extcon_rtk_type_c_pm_ops = …;
#define DEV_PM_OPS …
#else
#define DEV_PM_OPS …
#endif
static struct platform_driver extcon_rtk_type_c_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;