drivers/usb/typec/tcpm/tcpci_mt6360.c
Source file repositories/reference/linux-study-clean/drivers/usb/typec/tcpm/tcpci_mt6360.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/typec/tcpm/tcpci_mt6360.c- Extension
.c- Size
- 5694 bytes
- Lines
- 231
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/interrupt.hlinux/kernel.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regmap.hlinux/usb/tcpci.hlinux/usb/tcpm.h
Detected Declarations
struct mt6360_tcpc_infofunction mt6360_tcpc_write16function mt6360_tcpc_initfunction mt6360_irqfunction mt6360_tcpc_probefunction mt6360_tcpc_removefunction mt6360_tcpc_suspendfunction mt6360_tcpc_resume
Annotated Snippet
struct mt6360_tcpc_info {
struct tcpci_data tdata;
struct tcpci *tcpci;
struct device *dev;
int irq;
};
static inline int mt6360_tcpc_write16(struct regmap *regmap,
unsigned int reg, u16 val)
{
return regmap_raw_write(regmap, reg, &val, sizeof(u16));
}
static int mt6360_tcpc_init(struct tcpci *tcpci, struct tcpci_data *tdata)
{
struct regmap *regmap = tdata->regmap;
int ret;
ret = regmap_write(regmap, MT6360_REG_SWRESET, 0x01);
if (ret)
return ret;
/* after reset command, wait 1~2ms to wait IC action */
usleep_range(1000, 2000);
/* write all alert to masked */
ret = mt6360_tcpc_write16(regmap, TCPC_ALERT_MASK, 0);
if (ret)
return ret;
/* config I2C timeout reset enable , and timeout to 200ms */
ret = regmap_write(regmap, MT6360_REG_I2CTORST, 0x8F);
if (ret)
return ret;
/* config CC Detect Debounce : 26.7*val us */
ret = regmap_write(regmap, MT6360_REG_DEBCTRL1, 0x10);
if (ret)
return ret;
/* DRP Toggle Cycle : 51.2 + 6.4*val ms */
ret = regmap_write(regmap, MT6360_REG_DRPCTRL1, 4);
if (ret)
return ret;
/* DRP Duyt Ctrl : dcSRC: /1024 */
ret = mt6360_tcpc_write16(regmap, MT6360_REG_DRPCTRL2, 330);
if (ret)
return ret;
/* Enable VCONN Current Limit function */
ret = regmap_update_bits(regmap, MT6360_REG_VCONNCTRL1, MT6360_VCONNCL_ENABLE,
MT6360_VCONNCL_ENABLE);
if (ret)
return ret;
/* Enable cc open 40ms when pmic send vsysuv signal */
ret = regmap_update_bits(regmap, MT6360_REG_RXCTRL2, MT6360_OPEN40M_ENABLE,
MT6360_OPEN40M_ENABLE);
if (ret)
return ret;
/* Enable Rpdet oneshot detection */
ret = regmap_update_bits(regmap, MT6360_REG_CTDCTRL2, MT6360_RPONESHOT_ENABLE,
MT6360_RPONESHOT_ENABLE);
if (ret)
return ret;
/* BMC PHY */
ret = mt6360_tcpc_write16(regmap, MT6360_REG_PHYCTRL1, 0x3A70);
if (ret)
return ret;
ret = regmap_write(regmap, MT6360_REG_PHYCTRL3, 0x82);
if (ret)
return ret;
ret = regmap_write(regmap, MT6360_REG_PHYCTRL7, 0x36);
if (ret)
return ret;
ret = mt6360_tcpc_write16(regmap, MT6360_REG_PHYCTRL11, 0x3C60);
if (ret)
return ret;
ret = regmap_write(regmap, MT6360_REG_RXCTRL1, 0xE8);
if (ret)
return ret;
/* Set shipping mode off, AUTOIDLE on */
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/kernel.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/usb/tcpci.h`, `linux/usb/tcpm.h`.
- Detected declarations: `struct mt6360_tcpc_info`, `function mt6360_tcpc_write16`, `function mt6360_tcpc_init`, `function mt6360_irq`, `function mt6360_tcpc_probe`, `function mt6360_tcpc_remove`, `function mt6360_tcpc_suspend`, `function mt6360_tcpc_resume`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.