drivers/gpu/drm/omapdrm/omap_encoder.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/omapdrm/omap_encoder.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/omapdrm/omap_encoder.c- Extension
.c- Size
- 4002 bytes
- Lines
- 145
- 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.
- 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/list.hdrm/drm_bridge.hdrm/drm_crtc.hdrm/drm_modeset_helper_vtables.hdrm/drm_edid.homap_drv.h
Detected Declarations
struct omap_encoderfunction omap_encoder_destroyfunction omap_encoder_update_videomode_flagsfunction omap_encoder_mode_setfunction list_for_each_entry
Annotated Snippet
struct omap_encoder {
struct drm_encoder base;
struct omap_dss_device *output;
};
static void omap_encoder_destroy(struct drm_encoder *encoder)
{
struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
drm_encoder_cleanup(encoder);
kfree(omap_encoder);
}
static const struct drm_encoder_funcs omap_encoder_funcs = {
.destroy = omap_encoder_destroy,
};
static void omap_encoder_update_videomode_flags(struct videomode *vm,
u32 bus_flags)
{
if (!(vm->flags & (DISPLAY_FLAGS_DE_LOW |
DISPLAY_FLAGS_DE_HIGH))) {
if (bus_flags & DRM_BUS_FLAG_DE_LOW)
vm->flags |= DISPLAY_FLAGS_DE_LOW;
else if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
vm->flags |= DISPLAY_FLAGS_DE_HIGH;
}
if (!(vm->flags & (DISPLAY_FLAGS_PIXDATA_POSEDGE |
DISPLAY_FLAGS_PIXDATA_NEGEDGE))) {
if (bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE)
vm->flags |= DISPLAY_FLAGS_PIXDATA_POSEDGE;
else if (bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE)
vm->flags |= DISPLAY_FLAGS_PIXDATA_NEGEDGE;
}
if (!(vm->flags & (DISPLAY_FLAGS_SYNC_POSEDGE |
DISPLAY_FLAGS_SYNC_NEGEDGE))) {
if (bus_flags & DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE)
vm->flags |= DISPLAY_FLAGS_SYNC_POSEDGE;
else if (bus_flags & DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE)
vm->flags |= DISPLAY_FLAGS_SYNC_NEGEDGE;
}
}
static void omap_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
struct omap_dss_device *output = omap_encoder->output;
struct drm_device *dev = encoder->dev;
struct drm_connector *connector;
struct videomode vm = { 0 };
u32 bus_flags;
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
if (connector->encoder == encoder)
break;
}
drm_display_mode_to_videomode(adjusted_mode, &vm);
/*
* HACK: This fixes the vm flags.
* struct drm_display_mode does not contain the VSYNC/HSYNC/DE flags and
* they get lost when converting back and forth between struct
* drm_display_mode and struct videomode. The hack below goes and
* fetches the missing flags.
*
* A better solution is to use DRM's bus-flags through the whole driver.
*/
drm_for_each_bridge_in_chain_from(output->bridge, bridge) {
if (!bridge->timings)
continue;
bus_flags = bridge->timings->input_bus_flags;
omap_encoder_update_videomode_flags(&vm, bus_flags);
}
bus_flags = connector->display_info.bus_flags;
omap_encoder_update_videomode_flags(&vm, bus_flags);
/* Set timings for all devices in the display pipeline. */
dss_mgr_set_timings(output, &vm);
}
static const struct drm_encoder_helper_funcs omap_encoder_helper_funcs = {
.mode_set = omap_encoder_mode_set,
};
Annotation
- Immediate include surface: `linux/list.h`, `drm/drm_bridge.h`, `drm/drm_crtc.h`, `drm/drm_modeset_helper_vtables.h`, `drm/drm_edid.h`, `omap_drv.h`.
- Detected declarations: `struct omap_encoder`, `function omap_encoder_destroy`, `function omap_encoder_update_videomode_flags`, `function omap_encoder_mode_set`, `function list_for_each_entry`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.