drivers/gpu/drm/bridge/tc358775.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/bridge/tc358775.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/bridge/tc358775.c- Extension
.c- Size
- 23220 bytes
- Lines
- 757
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/clk.hlinux/device.hlinux/gpio/consumer.hlinux/i2c.hlinux/kernel.hlinux/media-bus-format.hlinux/module.hlinux/of_device.hlinux/regulator/consumer.hlinux/slab.hlinux/unaligned.hdrm/display/drm_dp_helper.hdrm/drm_atomic_helper.hdrm/drm_bridge.hdrm/drm_mipi_dsi.hdrm/drm_of.hdrm/drm_probe_helper.h
Detected Declarations
struct tc_dataenum tc358775_portsenum tc3587x5_typefunction TC358775_VPCTRL_VSDELAYfunction TC358775_VPCTRL_OPXLFMTfunction TC358775_VPCTRL_MSFfunction TC358775_LVCFG_PCLKDIVfunction TC358775_LVCFG_LVDLINKfunction tc_bridge_atomic_pre_enablefunction tc_bridge_atomic_post_disablefunction d2l_readfunction d2l_writefunction tc_bridge_atomic_enablefunction tc_mode_validfunction tc358775_parse_dtfunction tc_bridge_attachfunction tc_attach_hostfunction tc_probefunction tc_remove
Annotated Snippet
struct tc_data {
struct i2c_client *i2c;
struct device *dev;
struct drm_bridge bridge;
struct drm_bridge *panel_bridge;
struct device_node *host_node;
struct mipi_dsi_device *dsi;
u8 num_dsi_lanes;
struct regulator *vdd;
struct regulator *vddio;
struct gpio_desc *reset_gpio;
struct gpio_desc *stby_gpio;
u8 lvds_link; /* single-link or dual-link */
u8 bpc;
enum tc3587x5_type type;
};
static inline struct tc_data *bridge_to_tc(struct drm_bridge *b)
{
return container_of(b, struct tc_data, bridge);
}
static void tc_bridge_atomic_pre_enable(struct drm_bridge *bridge,
struct drm_atomic_commit *state)
{
struct tc_data *tc = bridge_to_tc(bridge);
struct device *dev = &tc->dsi->dev;
int ret;
ret = regulator_enable(tc->vddio);
if (ret < 0)
dev_err(dev, "regulator vddio enable failed, %d\n", ret);
usleep_range(10000, 11000);
ret = regulator_enable(tc->vdd);
if (ret < 0)
dev_err(dev, "regulator vdd enable failed, %d\n", ret);
usleep_range(10000, 11000);
gpiod_set_value(tc->stby_gpio, 0);
usleep_range(10000, 11000);
gpiod_set_value(tc->reset_gpio, 0);
usleep_range(10, 20);
}
static void tc_bridge_atomic_post_disable(struct drm_bridge *bridge,
struct drm_atomic_commit *state)
{
struct tc_data *tc = bridge_to_tc(bridge);
struct device *dev = &tc->dsi->dev;
int ret;
gpiod_set_value(tc->reset_gpio, 1);
usleep_range(10, 20);
gpiod_set_value(tc->stby_gpio, 1);
usleep_range(10000, 11000);
ret = regulator_disable(tc->vdd);
if (ret < 0)
dev_err(dev, "regulator vdd disable failed, %d\n", ret);
usleep_range(10000, 11000);
ret = regulator_disable(tc->vddio);
if (ret < 0)
dev_err(dev, "regulator vddio disable failed, %d\n", ret);
usleep_range(10000, 11000);
}
static void d2l_read(struct i2c_client *i2c, u16 addr, u32 *val)
{
int ret;
u8 buf_addr[2];
put_unaligned_be16(addr, buf_addr);
ret = i2c_master_send(i2c, buf_addr, sizeof(buf_addr));
if (ret < 0)
goto fail;
ret = i2c_master_recv(i2c, (u8 *)val, sizeof(*val));
if (ret < 0)
goto fail;
pr_debug("d2l: I2C : addr:%04x value:%08x\n", addr, *val);
return;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/device.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/kernel.h`, `linux/media-bus-format.h`, `linux/module.h`.
- Detected declarations: `struct tc_data`, `enum tc358775_ports`, `enum tc3587x5_type`, `function TC358775_VPCTRL_VSDELAY`, `function TC358775_VPCTRL_OPXLFMT`, `function TC358775_VPCTRL_MSF`, `function TC358775_LVCFG_PCLKDIV`, `function TC358775_LVCFG_LVDLINK`, `function tc_bridge_atomic_pre_enable`, `function tc_bridge_atomic_post_disable`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.