drivers/gpu/drm/tidss/tidss_encoder.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/tidss/tidss_encoder.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/tidss/tidss_encoder.c- Extension
.c- Size
- 3757 bytes
- Lines
- 132
- 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/export.hdrm/drm_atomic_helper.hdrm/drm_bridge.hdrm/drm_bridge_connector.hdrm/drm_crtc.hdrm/drm_modeset_helper_vtables.hdrm/drm_panel.hdrm/drm_of.hdrm/drm_simple_kms_helper.htidss_crtc.htidss_drv.htidss_encoder.h
Detected Declarations
struct tidss_encoderfunction tidss_bridge_attachfunction tidss_bridge_atomic_checkfunction tidss_encoder_create
Annotated Snippet
struct tidss_encoder {
struct drm_bridge bridge;
struct drm_encoder encoder;
struct drm_connector *connector;
struct drm_bridge *next_bridge;
struct tidss_device *tidss;
};
static inline struct tidss_encoder
*bridge_to_tidss_encoder(struct drm_bridge *b)
{
return container_of(b, struct tidss_encoder, bridge);
}
static int tidss_bridge_attach(struct drm_bridge *bridge,
struct drm_encoder *encoder,
enum drm_bridge_attach_flags flags)
{
struct tidss_encoder *t_enc = bridge_to_tidss_encoder(bridge);
return drm_bridge_attach(encoder, t_enc->next_bridge,
bridge, flags);
}
static int tidss_bridge_atomic_check(struct drm_bridge *bridge,
struct drm_bridge_state *bridge_state,
struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state)
{
struct tidss_encoder *t_enc = bridge_to_tidss_encoder(bridge);
struct tidss_device *tidss = t_enc->tidss;
struct tidss_crtc_state *tcrtc_state = to_tidss_crtc_state(crtc_state);
struct drm_display_info *di = &conn_state->connector->display_info;
struct drm_bridge_state *next_bridge_state = NULL;
if (t_enc->next_bridge)
next_bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state,
t_enc->next_bridge);
if (next_bridge_state) {
tcrtc_state->bus_flags = next_bridge_state->input_bus_cfg.flags;
tcrtc_state->bus_format = next_bridge_state->input_bus_cfg.format;
} else if (di->num_bus_formats) {
tcrtc_state->bus_format = di->bus_formats[0];
tcrtc_state->bus_flags = di->bus_flags;
} else {
dev_err(tidss->dev, "%s: No bus_formats in connected display\n",
__func__);
return -EINVAL;
}
return 0;
}
static const struct drm_bridge_funcs tidss_bridge_funcs = {
.attach = tidss_bridge_attach,
.atomic_check = tidss_bridge_atomic_check,
.atomic_reset = drm_atomic_helper_bridge_reset,
.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
};
int tidss_encoder_create(struct tidss_device *tidss,
struct drm_bridge *next_bridge,
u32 encoder_type, u32 possible_crtcs)
{
struct tidss_encoder *t_enc;
struct drm_encoder *enc;
struct drm_connector *connector;
int ret;
t_enc = devm_drm_bridge_alloc(tidss->dev, struct tidss_encoder,
bridge, &tidss_bridge_funcs);
if (IS_ERR(t_enc))
return PTR_ERR(t_enc);
ret = drm_simple_encoder_init(&tidss->ddev, &t_enc->encoder,
encoder_type);
if (ret)
return ret;
t_enc->tidss = tidss;
t_enc->next_bridge = next_bridge;
enc = &t_enc->encoder;
enc->possible_crtcs = possible_crtcs;
devm_drm_bridge_add(tidss->dev, &t_enc->bridge);
/* Attaching first bridge to the encoder */
Annotation
- Immediate include surface: `linux/export.h`, `drm/drm_atomic_helper.h`, `drm/drm_bridge.h`, `drm/drm_bridge_connector.h`, `drm/drm_crtc.h`, `drm/drm_modeset_helper_vtables.h`, `drm/drm_panel.h`, `drm/drm_of.h`.
- Detected declarations: `struct tidss_encoder`, `function tidss_bridge_attach`, `function tidss_bridge_atomic_check`, `function tidss_encoder_create`.
- 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.