drivers/gpu/drm/meson/meson_encoder_dsi.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/meson/meson_encoder_dsi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/meson/meson_encoder_dsi.c- Extension
.c- Size
- 5137 bytes
- Lines
- 171
- 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/kernel.hlinux/module.hlinux/of_graph.hdrm/drm_atomic_helper.hdrm/drm_simple_kms_helper.hdrm/drm_bridge.hdrm/drm_bridge_connector.hdrm/drm_device.hdrm/drm_probe_helper.hmeson_drv.hmeson_encoder_dsi.hmeson_registers.hmeson_venc.hmeson_vclk.h
Detected Declarations
struct meson_encoder_dsifunction meson_encoder_dsi_attachfunction meson_encoder_dsi_atomic_enablefunction meson_encoder_dsi_atomic_disablefunction meson_encoder_dsi_probefunction meson_encoder_dsi_remove
Annotated Snippet
struct meson_encoder_dsi {
struct drm_encoder encoder;
struct drm_bridge bridge;
struct meson_drm *priv;
};
#define bridge_to_meson_encoder_dsi(x) \
container_of(x, struct meson_encoder_dsi, bridge)
static int meson_encoder_dsi_attach(struct drm_bridge *bridge,
struct drm_encoder *encoder,
enum drm_bridge_attach_flags flags)
{
struct meson_encoder_dsi *encoder_dsi = bridge_to_meson_encoder_dsi(bridge);
return drm_bridge_attach(encoder, encoder_dsi->bridge.next_bridge,
&encoder_dsi->bridge, flags);
}
static void meson_encoder_dsi_atomic_enable(struct drm_bridge *bridge,
struct drm_atomic_commit *state)
{
struct meson_encoder_dsi *encoder_dsi = bridge_to_meson_encoder_dsi(bridge);
struct meson_drm *priv = encoder_dsi->priv;
struct drm_connector_state *conn_state;
struct drm_crtc_state *crtc_state;
struct drm_connector *connector;
connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
if (WARN_ON(!connector))
return;
conn_state = drm_atomic_get_new_connector_state(state, connector);
if (WARN_ON(!conn_state))
return;
crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
if (WARN_ON(!crtc_state))
return;
/* ENCL clock setup is handled by CCF */
meson_venc_mipi_dsi_mode_set(priv, &crtc_state->adjusted_mode);
meson_encl_load_gamma(priv);
writel_relaxed(0, priv->io_base + _REG(ENCL_VIDEO_EN));
writel_bits_relaxed(ENCL_VIDEO_MODE_ADV_VFIFO_EN, ENCL_VIDEO_MODE_ADV_VFIFO_EN,
priv->io_base + _REG(ENCL_VIDEO_MODE_ADV));
writel_relaxed(0, priv->io_base + _REG(ENCL_TST_EN));
writel_bits_relaxed(BIT(0), 0, priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_EN_CTRL));
writel_relaxed(1, priv->io_base + _REG(ENCL_VIDEO_EN));
}
static void meson_encoder_dsi_atomic_disable(struct drm_bridge *bridge,
struct drm_atomic_commit *state)
{
struct meson_encoder_dsi *meson_encoder_dsi =
bridge_to_meson_encoder_dsi(bridge);
struct meson_drm *priv = meson_encoder_dsi->priv;
writel_relaxed(0, priv->io_base + _REG(ENCL_VIDEO_EN));
writel_bits_relaxed(BIT(0), BIT(0), priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_EN_CTRL));
}
static const struct drm_bridge_funcs meson_encoder_dsi_bridge_funcs = {
.attach = meson_encoder_dsi_attach,
.atomic_enable = meson_encoder_dsi_atomic_enable,
.atomic_disable = meson_encoder_dsi_atomic_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,
};
int meson_encoder_dsi_probe(struct meson_drm *priv)
{
struct meson_encoder_dsi *meson_encoder_dsi;
struct device_node *remote;
int ret;
meson_encoder_dsi = devm_drm_bridge_alloc(priv->dev,
struct meson_encoder_dsi,
bridge,
&meson_encoder_dsi_bridge_funcs);
if (IS_ERR(meson_encoder_dsi))
return PTR_ERR(meson_encoder_dsi);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/of_graph.h`, `drm/drm_atomic_helper.h`, `drm/drm_simple_kms_helper.h`, `drm/drm_bridge.h`, `drm/drm_bridge_connector.h`, `drm/drm_device.h`.
- Detected declarations: `struct meson_encoder_dsi`, `function meson_encoder_dsi_attach`, `function meson_encoder_dsi_atomic_enable`, `function meson_encoder_dsi_atomic_disable`, `function meson_encoder_dsi_probe`, `function meson_encoder_dsi_remove`.
- 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.