drivers/gpu/drm/imx/dc/dc-lb.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/imx/dc/dc-lb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/imx/dc/dc-lb.c- Extension
.c- Size
- 8359 bytes
- Lines
- 326
- 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/bitfield.hlinux/bits.hlinux/component.hlinux/mod_devicetable.hlinux/module.hlinux/platform_device.hlinux/regmap.hdrm/drm_blend.hdc-drv.hdc-pe.h
Detected Declarations
enum dc_lb_blend_funcenum dc_lb_shadow_selfunction dc_lb_get_link_idfunction dc_lb_pec_dynamic_prim_selfunction dc_lb_pec_dynamic_sec_selfunction dc_lb_pec_clkenfunction dc_lb_enable_shdenfunction dc_lb_shdtokselfunction dc_lb_shdldselfunction dc_lb_modefunction dc_lb_blendcontrolfunction dc_lb_positionfunction dc_lb_get_idfunction dc_lb_initfunction dc_lb_bindfunction dc_lb_probefunction dc_lb_remove
Annotated Snippet
if (prim_sels[i] == prim) {
regmap_write_bits(lb->reg_pec, PIXENGCFG_DYNAMIC,
PIXENGCFG_DYNAMIC_PRIM_SEL_MASK,
PIXENGCFG_DYNAMIC_PRIM_SEL(prim));
return;
}
}
dev_warn(lb->dev, "invalid primary input selection:%d\n", prim);
}
void dc_lb_pec_dynamic_sec_sel(struct dc_lb *lb, enum dc_link_id sec)
{
int i;
for (i = 0; i < ARRAY_SIZE(sec_sels); i++) {
if (sec_sels[i] == sec) {
regmap_write_bits(lb->reg_pec, PIXENGCFG_DYNAMIC,
PIXENGCFG_DYNAMIC_SEC_SEL_MASK,
PIXENGCFG_DYNAMIC_SEC_SEL(sec));
return;
}
}
dev_warn(lb->dev, "invalid secondary input selection:%d\n", sec);
}
void dc_lb_pec_clken(struct dc_lb *lb, enum dc_pec_clken clken)
{
regmap_write_bits(lb->reg_pec, PIXENGCFG_DYNAMIC, CLKEN_MASK,
CLKEN(clken));
}
static inline void dc_lb_enable_shden(struct dc_lb *lb)
{
regmap_write_bits(lb->reg_cfg, STATICCONTROL, SHDEN, SHDEN);
}
static inline void dc_lb_shdtoksel(struct dc_lb *lb, enum dc_lb_shadow_sel sel)
{
regmap_write_bits(lb->reg_cfg, STATICCONTROL, SHDTOKSEL_MASK,
SHDTOKSEL(sel));
}
static inline void dc_lb_shdldsel(struct dc_lb *lb, enum dc_lb_shadow_sel sel)
{
regmap_write_bits(lb->reg_cfg, STATICCONTROL, SHDLDSEL_MASK,
SHDLDSEL(sel));
}
void dc_lb_mode(struct dc_lb *lb, enum dc_lb_mode mode)
{
regmap_write_bits(lb->reg_cfg, CONTROL, CTRL_MODE_MASK, mode);
}
static inline void dc_lb_blendcontrol(struct dc_lb *lb)
{
u32 val = PRIM_A_BLD_FUNC(DC_LAYERBLEND_BLEND_ZERO) |
SEC_A_BLD_FUNC(DC_LAYERBLEND_BLEND_ZERO) |
PRIM_C_BLD_FUNC(DC_LAYERBLEND_BLEND_ZERO) |
SEC_C_BLD_FUNC(DC_LAYERBLEND_BLEND_CONST_ALPHA) |
ALPHA(DRM_BLEND_ALPHA_OPAQUE >> 8);
regmap_write(lb->reg_cfg, BLENDCONTROL, val);
}
void dc_lb_position(struct dc_lb *lb, int x, int y)
{
regmap_write(lb->reg_cfg, POSITION, XPOS(x) | YPOS(y));
}
int dc_lb_get_id(struct dc_lb *lb)
{
return lb->id;
}
void dc_lb_init(struct dc_lb *lb)
{
dc_lb_pec_dynamic_prim_sel(lb, LINK_ID_NONE);
dc_lb_pec_dynamic_sec_sel(lb, LINK_ID_NONE);
dc_lb_pec_clken(lb, CLKEN_DISABLE);
dc_lb_shdldsel(lb, BOTH);
dc_lb_shdtoksel(lb, BOTH);
dc_lb_blendcontrol(lb);
dc_lb_enable_shden(lb);
}
static int dc_lb_bind(struct device *dev, struct device *master, void *data)
{
struct platform_device *pdev = to_platform_device(dev);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bits.h`, `linux/component.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/platform_device.h`, `linux/regmap.h`, `drm/drm_blend.h`.
- Detected declarations: `enum dc_lb_blend_func`, `enum dc_lb_shadow_sel`, `function dc_lb_get_link_id`, `function dc_lb_pec_dynamic_prim_sel`, `function dc_lb_pec_dynamic_sec_sel`, `function dc_lb_pec_clken`, `function dc_lb_enable_shden`, `function dc_lb_shdtoksel`, `function dc_lb_shdldsel`, `function dc_lb_mode`.
- 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.