drivers/gpu/drm/bridge/ti-tdp158.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/bridge/ti-tdp158.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/bridge/ti-tdp158.c- Extension
.c- Size
- 3070 bytes
- Lines
- 116
- 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/gpio/consumer.hlinux/i2c.hdrm/drm_atomic_helper.hdrm/drm_bridge.h
Detected Declarations
struct tdp158function tdp158_enablefunction tdp158_disablefunction tdp158_attachfunction tdp158_probe
Annotated Snippet
struct tdp158 {
struct drm_bridge bridge;
struct drm_bridge *next;
struct gpio_desc *enable; // Operation Enable - pin 36
struct regulator *vcc; // 3.3V
struct regulator *vdd; // 1.1V
struct device *dev;
};
static void tdp158_enable(struct drm_bridge *bridge,
struct drm_atomic_commit *state)
{
int err;
struct tdp158 *tdp158 = bridge->driver_private;
err = regulator_enable(tdp158->vcc);
if (err)
dev_err(tdp158->dev, "failed to enable vcc: %d", err);
err = regulator_enable(tdp158->vdd);
if (err)
dev_err(tdp158->dev, "failed to enable vdd: %d", err);
gpiod_set_value_cansleep(tdp158->enable, 1);
}
static void tdp158_disable(struct drm_bridge *bridge,
struct drm_atomic_commit *state)
{
struct tdp158 *tdp158 = bridge->driver_private;
gpiod_set_value_cansleep(tdp158->enable, 0);
regulator_disable(tdp158->vdd);
regulator_disable(tdp158->vcc);
}
static int tdp158_attach(struct drm_bridge *bridge,
struct drm_encoder *encoder,
enum drm_bridge_attach_flags flags)
{
struct tdp158 *tdp158 = bridge->driver_private;
return drm_bridge_attach(encoder, tdp158->next, bridge, flags);
}
static const struct drm_bridge_funcs tdp158_bridge_funcs = {
.attach = tdp158_attach,
.atomic_enable = tdp158_enable,
.atomic_disable = tdp158_disable,
.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
.atomic_reset = drm_atomic_helper_bridge_reset,
};
static int tdp158_probe(struct i2c_client *client)
{
struct tdp158 *tdp158;
struct device *dev = &client->dev;
tdp158 = devm_drm_bridge_alloc(dev, struct tdp158, bridge,
&tdp158_bridge_funcs);
if (IS_ERR(tdp158))
return PTR_ERR(tdp158);
tdp158->next = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0);
if (IS_ERR(tdp158->next))
return dev_err_probe(dev, PTR_ERR(tdp158->next), "missing bridge");
tdp158->vcc = devm_regulator_get(dev, "vcc");
if (IS_ERR(tdp158->vcc))
return dev_err_probe(dev, PTR_ERR(tdp158->vcc), "vcc");
tdp158->vdd = devm_regulator_get(dev, "vdd");
if (IS_ERR(tdp158->vdd))
return dev_err_probe(dev, PTR_ERR(tdp158->vdd), "vdd");
tdp158->enable = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW);
if (IS_ERR(tdp158->enable))
return dev_err_probe(dev, PTR_ERR(tdp158->enable), "enable");
tdp158->bridge.of_node = dev->of_node;
tdp158->bridge.driver_private = tdp158;
tdp158->dev = dev;
return devm_drm_bridge_add(dev, &tdp158->bridge);
}
static const struct of_device_id tdp158_match_table[] = {
{ .compatible = "ti,tdp158" },
{ }
Annotation
- Immediate include surface: `linux/gpio/consumer.h`, `linux/i2c.h`, `drm/drm_atomic_helper.h`, `drm/drm_bridge.h`.
- Detected declarations: `struct tdp158`, `function tdp158_enable`, `function tdp158_disable`, `function tdp158_attach`, `function tdp158_probe`.
- 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.