drivers/gpu/drm/gma500/cdv_intel_display.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/gma500/cdv_intel_display.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/gma500/cdv_intel_display.c- Extension
.c- Size
- 25675 bytes
- Lines
- 976
- 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/delay.hlinux/i2c.hdrm/drm_crtc.hdrm/drm_modeset_helper_vtables.hdrm/drm_print.hcdv_device.hframebuffer.hgma_display.hpower.hpsb_drv.hpsb_intel_drv.hpsb_intel_reg.h
Detected Declarations
function cdv_sb_readfunction cdv_sb_writefunction cdv_sb_resetfunction cdv_dpll_set_clock_cdvfunction gma_pipe_has_typefunction cdv_intel_clockfunction cdv_intel_find_dp_pllfunction cdv_intel_pipe_enabledfunction cdv_disable_srfunction cdv_update_wmfunction cdv_intel_panel_fitter_pipefunction cdv_intel_crtc_mode_setfunction i8xx_clockfunction cdv_intel_crtc_clock_get
Annotated Snippet
if (time_after(jiffies, timeout__)) { \
ret__ = -ETIMEDOUT; \
break; \
} \
if (W && !in_dbg_master()) \
msleep(W); \
} \
ret__; \
})
#define wait_for(COND, MS) _wait_for(COND, MS, 1)
int cdv_sb_read(struct drm_device *dev, u32 reg, u32 *val)
{
int ret;
ret = wait_for((REG_READ(SB_PCKT) & SB_BUSY) == 0, 1000);
if (ret) {
DRM_ERROR("timeout waiting for SB to idle before read\n");
return ret;
}
REG_WRITE(SB_ADDR, reg);
REG_WRITE(SB_PCKT,
SET_FIELD(SB_OPCODE_READ, SB_OPCODE) |
SET_FIELD(SB_DEST_DPLL, SB_DEST) |
SET_FIELD(0xf, SB_BYTE_ENABLE));
ret = wait_for((REG_READ(SB_PCKT) & SB_BUSY) == 0, 1000);
if (ret) {
DRM_ERROR("timeout waiting for SB to idle after read\n");
return ret;
}
*val = REG_READ(SB_DATA);
return 0;
}
int cdv_sb_write(struct drm_device *dev, u32 reg, u32 val)
{
int ret;
static bool dpio_debug = true;
u32 temp;
if (dpio_debug) {
if (cdv_sb_read(dev, reg, &temp) == 0)
DRM_DEBUG_KMS("0x%08x: 0x%08x (before)\n", reg, temp);
DRM_DEBUG_KMS("0x%08x: 0x%08x\n", reg, val);
}
ret = wait_for((REG_READ(SB_PCKT) & SB_BUSY) == 0, 1000);
if (ret) {
DRM_ERROR("timeout waiting for SB to idle before write\n");
return ret;
}
REG_WRITE(SB_ADDR, reg);
REG_WRITE(SB_DATA, val);
REG_WRITE(SB_PCKT,
SET_FIELD(SB_OPCODE_WRITE, SB_OPCODE) |
SET_FIELD(SB_DEST_DPLL, SB_DEST) |
SET_FIELD(0xf, SB_BYTE_ENABLE));
ret = wait_for((REG_READ(SB_PCKT) & SB_BUSY) == 0, 1000);
if (ret) {
DRM_ERROR("timeout waiting for SB to idle after write\n");
return ret;
}
if (dpio_debug) {
if (cdv_sb_read(dev, reg, &temp) == 0)
DRM_DEBUG_KMS("0x%08x: 0x%08x (after)\n", reg, temp);
}
return 0;
}
/* Reset the DPIO configuration register. The BIOS does this at every
* mode set.
*/
void cdv_sb_reset(struct drm_device *dev)
{
REG_WRITE(DPIO_CFG, 0);
REG_READ(DPIO_CFG);
REG_WRITE(DPIO_CFG, DPIO_MODE_SELECT_0 | DPIO_CMN_RESET_N);
}
Annotation
- Immediate include surface: `linux/delay.h`, `linux/i2c.h`, `drm/drm_crtc.h`, `drm/drm_modeset_helper_vtables.h`, `drm/drm_print.h`, `cdv_device.h`, `framebuffer.h`, `gma_display.h`.
- Detected declarations: `function cdv_sb_read`, `function cdv_sb_write`, `function cdv_sb_reset`, `function cdv_dpll_set_clock_cdv`, `function gma_pipe_has_type`, `function cdv_intel_clock`, `function cdv_intel_find_dp_pll`, `function cdv_intel_pipe_enabled`, `function cdv_disable_sr`, `function cdv_update_wm`.
- 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.