drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/dispnv04/tvnv17.c- Extension
.c- Size
- 24833 bytes
- Lines
- 833
- 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
drm/drm_crtc_helper.hdrm/drm_modeset_helper_vtables.hdrm/drm_probe_helper.hnouveau_drv.hnouveau_reg.hnouveau_encoder.hnouveau_connector.hnouveau_crtc.hhw.htvnv17.h
Detected Declarations
function nv42_tv_sample_loadfunction get_tv_detect_quirksfunction nv17_tv_detectfunction nv17_tv_get_ld_modesfunction nv17_tv_get_hd_modesfunction nv17_tv_get_modesfunction nv17_tv_mode_validfunction nv17_tv_mode_fixupfunction nv17_tv_dpmsfunction nv17_tv_preparefunction list_for_each_entryfunction nv17_tv_mode_setfunction nv17_tv_commitfunction nv17_tv_savefunction nv17_tv_restorefunction nv17_tv_create_resourcesfunction nv17_tv_set_propertyfunction nv17_tv_destroyfunction nv17_tv_create
Annotated Snippet
if (output_mode->vdisplay >= 1024) {
mode->vtotal = output_mode->vtotal;
mode->vsync_start = output_mode->vsync_start;
mode->vsync_end = output_mode->vsync_end;
}
mode->type |= DRM_MODE_TYPE_DRIVER;
drm_mode_probed_add(connector, mode);
n++;
}
return n;
}
static int nv17_tv_get_modes(struct drm_encoder *encoder,
struct drm_connector *connector)
{
struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
if (tv_norm->kind == CTV_ENC_MODE)
return nv17_tv_get_hd_modes(encoder, connector);
else
return nv17_tv_get_ld_modes(encoder, connector);
}
static int nv17_tv_mode_valid(struct drm_encoder *encoder,
const struct drm_display_mode *mode)
{
struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
if (tv_norm->kind == CTV_ENC_MODE) {
struct drm_display_mode *output_mode =
&tv_norm->ctv_enc_mode.mode;
if (mode->clock > 400000)
return MODE_CLOCK_HIGH;
if (mode->hdisplay > output_mode->hdisplay ||
mode->vdisplay > output_mode->vdisplay)
return MODE_BAD;
if ((mode->flags & DRM_MODE_FLAG_INTERLACE) !=
(output_mode->flags & DRM_MODE_FLAG_INTERLACE))
return MODE_NO_INTERLACE;
if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
return MODE_NO_DBLESCAN;
} else {
const int vsync_tolerance = 600;
if (mode->clock > 70000)
return MODE_CLOCK_HIGH;
if (abs(drm_mode_vrefresh(mode) * 1000 -
tv_norm->tv_enc_mode.vrefresh) > vsync_tolerance)
return MODE_VSYNC;
/* The encoder takes care of the actual interlacing */
if (mode->flags & DRM_MODE_FLAG_INTERLACE)
return MODE_NO_INTERLACE;
}
return MODE_OK;
}
static bool nv17_tv_mode_fixup(struct drm_encoder *encoder,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
if (nv04_dac_in_use(encoder))
return false;
if (tv_norm->kind == CTV_ENC_MODE)
adjusted_mode->clock = tv_norm->ctv_enc_mode.mode.clock;
else
adjusted_mode->clock = 90000;
return true;
}
static void nv17_tv_dpms(struct drm_encoder *encoder, int mode)
{
struct drm_device *dev = encoder->dev;
struct nouveau_drm *drm = nouveau_drm(dev);
struct nvkm_gpio *gpio = nvxx_gpio(drm);
struct nv17_tv_state *regs = &to_tv_enc(encoder)->state;
struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
Annotation
- Immediate include surface: `drm/drm_crtc_helper.h`, `drm/drm_modeset_helper_vtables.h`, `drm/drm_probe_helper.h`, `nouveau_drv.h`, `nouveau_reg.h`, `nouveau_encoder.h`, `nouveau_connector.h`, `nouveau_crtc.h`.
- Detected declarations: `function nv42_tv_sample_load`, `function get_tv_detect_quirks`, `function nv17_tv_detect`, `function nv17_tv_get_ld_modes`, `function nv17_tv_get_hd_modes`, `function nv17_tv_get_modes`, `function nv17_tv_mode_valid`, `function nv17_tv_mode_fixup`, `function nv17_tv_dpms`, `function nv17_tv_prepare`.
- 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.