drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c- Extension
.c- Size
- 17364 bytes
- Lines
- 676
- 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
dp.hconn.hhead.hior.hdrm/display/drm_dp.hsubdev/bios.hsubdev/bios/init.hsubdev/gpio.hsubdev/i2c.hnvif/event.h
Detected Declarations
struct lt_statefunction filesfunction nvkm_dp_mst_id_getfunction nvkm_dp_aux_xferfunction nvkm_dp_aux_pwrfunction nvkm_dp_train_sensefunction nvkm_dp_train_drivefunction nvkm_dp_train_patternfunction nvkm_dp_train_eqfunction nvkm_dp_train_crfunction nvkm_dp_train_linkfunction nvkm_dp_train_linksfunction nvkm_dp_train_finifunction nvkm_dp_train_initfunction nvkm_dp_drivefunction nvkm_dp_trainfunction nvkm_dp_disablefunction nvkm_dp_releasefunction nvkm_dp_enablefunction nvkm_dp_finifunction nvkm_dp_initfunction nvkm_dp_dtorfunction nvkm_dp_new
Annotated Snippet
struct lt_state {
struct nvkm_outp *outp;
int repeaters;
int repeater;
u8 stat[6];
u8 conf[4];
bool pc2;
u8 pc2stat;
u8 pc2conf[2];
};
static int
nvkm_dp_train_sense(struct lt_state *lt, bool pc, u32 delay)
{
struct nvkm_outp *outp = lt->outp;
u32 addr;
int ret;
usleep_range(delay, delay * 2);
if (lt->repeater)
addr = DPCD_LTTPR_LANE0_1_STATUS(lt->repeater);
else
addr = DPCD_LS02;
ret = nvkm_rdaux(outp->dp.aux, addr, <->stat[0], 3);
if (ret)
return ret;
if (lt->repeater)
addr = DPCD_LTTPR_LANE0_1_ADJUST(lt->repeater);
else
addr = DPCD_LS06;
ret = nvkm_rdaux(outp->dp.aux, addr, <->stat[4], 2);
if (ret)
return ret;
if (pc) {
ret = nvkm_rdaux(outp->dp.aux, DPCD_LS0C, <->pc2stat, 1);
if (ret)
lt->pc2stat = 0x00;
OUTP_TRACE(outp, "status %6ph pc2 %02x", lt->stat, lt->pc2stat);
} else {
OUTP_TRACE(outp, "status %6ph", lt->stat);
}
return 0;
}
static int
nvkm_dp_train_drive(struct lt_state *lt, bool pc)
{
struct nvkm_outp *outp = lt->outp;
struct nvkm_ior *ior = outp->ior;
struct nvkm_bios *bios = ior->disp->engine.subdev.device->bios;
struct nvbios_dpout info;
struct nvbios_dpcfg ocfg;
u8 ver, hdr, cnt, len;
u32 addr;
u32 data;
int ret, i;
for (i = 0; i < ior->dp.nr; i++) {
u8 lane = (lt->stat[4 + (i >> 1)] >> ((i & 1) * 4)) & 0xf;
u8 lpc2 = (lt->pc2stat >> (i * 2)) & 0x3;
u8 lpre = (lane & 0x0c) >> 2;
u8 lvsw = (lane & 0x03) >> 0;
u8 hivs = 3 - lpre;
u8 hipe = 3;
u8 hipc = 3;
if (lpc2 >= hipc)
lpc2 = hipc | DPCD_LC0F_LANE0_MAX_POST_CURSOR2_REACHED;
if (lpre >= hipe) {
lpre = hipe | DPCD_LC03_MAX_SWING_REACHED; /* yes. */
lvsw = hivs = 3 - (lpre & 3);
} else
if (lvsw >= hivs) {
lvsw = hivs | DPCD_LC03_MAX_SWING_REACHED;
}
lt->conf[i] = (lpre << 3) | lvsw;
lt->pc2conf[i >> 1] |= lpc2 << ((i & 1) * 4);
OUTP_TRACE(outp, "config lane %d %02x %02x", i, lt->conf[i], lpc2);
Annotation
- Immediate include surface: `dp.h`, `conn.h`, `head.h`, `ior.h`, `drm/display/drm_dp.h`, `subdev/bios.h`, `subdev/bios/init.h`, `subdev/gpio.h`.
- Detected declarations: `struct lt_state`, `function files`, `function nvkm_dp_mst_id_get`, `function nvkm_dp_aux_xfer`, `function nvkm_dp_aux_pwr`, `function nvkm_dp_train_sense`, `function nvkm_dp_train_drive`, `function nvkm_dp_train_pattern`, `function nvkm_dp_train_eq`, `function nvkm_dp_train_cr`.
- 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.