drivers/gpu/drm/bridge/aux-bridge.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/bridge/aux-bridge.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/bridge/aux-bridge.c
Extension
.c
Size
3807 bytes
Lines
151
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: exported/initcall integration point
Status
integration 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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct drm_aux_bridge_data {
	struct drm_bridge bridge;
	struct drm_bridge *next_bridge;
	struct device *dev;
};

static int drm_aux_bridge_attach(struct drm_bridge *bridge,
				 struct drm_encoder *encoder,
				 enum drm_bridge_attach_flags flags)
{
	struct drm_aux_bridge_data *data;

	if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
		return -EINVAL;

	data = container_of(bridge, struct drm_aux_bridge_data, bridge);

	return drm_bridge_attach(encoder, data->next_bridge, bridge,
				 DRM_BRIDGE_ATTACH_NO_CONNECTOR);
}

static const struct drm_bridge_funcs drm_aux_bridge_funcs = {
	.attach	= drm_aux_bridge_attach,
};

static int drm_aux_bridge_probe(struct auxiliary_device *auxdev,
				const struct auxiliary_device_id *id)
{
	struct drm_aux_bridge_data *data;

	data = devm_drm_bridge_alloc(&auxdev->dev, struct drm_aux_bridge_data,
				     bridge, &drm_aux_bridge_funcs);
	if (IS_ERR(data))
		return PTR_ERR(data);

	data->dev = &auxdev->dev;
	data->next_bridge = devm_drm_of_get_bridge(&auxdev->dev, auxdev->dev.of_node, 0, 0);
	if (IS_ERR(data->next_bridge))
		return dev_err_probe(&auxdev->dev, PTR_ERR(data->next_bridge),
				     "failed to acquire drm_bridge\n");

	data->bridge.of_node = data->dev->of_node;

	/* passthrough data, allow everything */
	data->bridge.interlace_allowed = true;
	data->bridge.ycbcr_420_allowed = true;

	return devm_drm_bridge_add(data->dev, &data->bridge);
}

static const struct auxiliary_device_id drm_aux_bridge_table[] = {
	{ .name = KBUILD_MODNAME ".aux_bridge" },
	{},
};
MODULE_DEVICE_TABLE(auxiliary, drm_aux_bridge_table);

static struct auxiliary_driver drm_aux_bridge_drv = {
	.name = "aux_bridge",
	.id_table = drm_aux_bridge_table,
	.probe = drm_aux_bridge_probe,
};
module_auxiliary_driver(drm_aux_bridge_drv);

MODULE_AUTHOR("Dmitry Baryshkov <dmitry.baryshkov@linaro.org>");
MODULE_DESCRIPTION("DRM transparent bridge");
MODULE_LICENSE("GPL");

Annotation

Implementation Notes