drivers/gpu/drm/radeon/radeon_legacy_encoders.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/radeon/radeon_legacy_encoders.c- Extension
.c- Size
- 56663 bytes
- Lines
- 1817
- 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/backlight.hlinux/pci.hdrm/drm_device.hdrm/drm_file.hdrm/drm_modeset_helper_vtables.hdrm/drm_util.hdrm/radeon_drm.hacpi/video.hradeon.hradeon_asic.hradeon_legacy_encoders.hatom.hasm/backlight.h
Detected Declarations
function filesfunction radeon_legacy_lvds_updatefunction radeon_legacy_lvds_dpmsfunction radeon_legacy_lvds_preparefunction radeon_legacy_lvds_commitfunction radeon_legacy_lvds_mode_setfunction radeon_legacy_mode_fixupfunction radeon_legacy_get_backlight_levelfunction radeon_legacy_set_backlight_levelfunction radeon_legacy_lvds_levelfunction radeon_legacy_backlight_update_statusfunction radeon_legacy_backlight_get_brightnessfunction radeon_legacy_backlight_initfunction radeon_legacy_backlight_exitfunction radeon_lvds_enc_destroyfunction radeon_legacy_primary_dac_dpmsfunction radeon_legacy_primary_dac_preparefunction radeon_legacy_primary_dac_commitfunction radeon_legacy_primary_dac_mode_setfunction radeon_legacy_primary_dac_detectfunction radeon_legacy_tmds_int_dpmsfunction radeon_legacy_tmds_int_preparefunction radeon_legacy_tmds_int_commitfunction radeon_legacy_tmds_int_mode_setfunction radeon_legacy_tmds_ext_dpmsfunction radeon_legacy_tmds_ext_preparefunction radeon_legacy_tmds_ext_commitfunction radeon_legacy_tmds_ext_mode_setfunction radeon_ext_tmds_enc_destroyfunction radeon_legacy_tv_dac_dpmsfunction radeon_legacy_tv_dac_preparefunction radeon_legacy_tv_dac_commitfunction radeon_legacy_tv_dac_mode_setfunction r300_legacy_tv_detectfunction radeon_legacy_tv_detectfunction radeon_legacy_ext_dac_detectfunction radeon_legacy_tv_dac_detectfunction radeon_add_legacy_encoder
Annotated Snippet
if (rdev->is_atom_bios) {
struct radeon_encoder_atom_dig *lvds = radeon_encoder->enc_priv;
panel_pwr_delay = lvds->panel_pwr_delay;
if (lvds->bl_dev)
backlight_level = lvds->backlight_level;
} else {
struct radeon_encoder_lvds *lvds = radeon_encoder->enc_priv;
panel_pwr_delay = lvds->panel_pwr_delay;
if (lvds->bl_dev)
backlight_level = lvds->backlight_level;
}
}
/* macs (and possibly some x86 oem systems?) wire up LVDS strangely
* Taken from radeonfb.
*/
if ((rdev->mode_info.connector_table == CT_IBOOK) ||
(rdev->mode_info.connector_table == CT_POWERBOOK_EXTERNAL) ||
(rdev->mode_info.connector_table == CT_POWERBOOK_INTERNAL) ||
(rdev->mode_info.connector_table == CT_POWERBOOK_VGA))
is_mac = true;
switch (mode) {
case DRM_MODE_DPMS_ON:
disp_pwr_man = RREG32(RADEON_DISP_PWR_MAN);
disp_pwr_man |= RADEON_AUTO_PWRUP_EN;
WREG32(RADEON_DISP_PWR_MAN, disp_pwr_man);
lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL);
lvds_pll_cntl |= RADEON_LVDS_PLL_EN;
WREG32(RADEON_LVDS_PLL_CNTL, lvds_pll_cntl);
mdelay(1);
lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL);
lvds_pll_cntl &= ~RADEON_LVDS_PLL_RESET;
WREG32(RADEON_LVDS_PLL_CNTL, lvds_pll_cntl);
lvds_gen_cntl &= ~(RADEON_LVDS_DISPLAY_DIS |
RADEON_LVDS_BL_MOD_LEVEL_MASK);
lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_EN |
RADEON_LVDS_DIGON | RADEON_LVDS_BLON |
(backlight_level << RADEON_LVDS_BL_MOD_LEVEL_SHIFT));
if (is_mac)
lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN;
mdelay(panel_pwr_delay);
WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
break;
case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_OFF:
pixclks_cntl = RREG32_PLL(RADEON_PIXCLKS_CNTL);
WREG32_PLL_P(RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS;
if (is_mac) {
lvds_gen_cntl &= ~RADEON_LVDS_BL_MOD_EN;
WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_EN);
} else {
WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN | RADEON_LVDS_DIGON);
}
mdelay(panel_pwr_delay);
WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl);
mdelay(panel_pwr_delay);
break;
}
if (rdev->is_atom_bios)
radeon_atombios_encoder_dpms_scratch_regs(encoder, mode == DRM_MODE_DPMS_ON);
else
radeon_combios_encoder_dpms_scratch_regs(encoder, mode == DRM_MODE_DPMS_ON);
}
static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
{
struct radeon_device *rdev = encoder->dev->dev_private;
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
DRM_DEBUG("\n");
if (radeon_encoder->enc_priv) {
if (rdev->is_atom_bios) {
struct radeon_encoder_atom_dig *lvds = radeon_encoder->enc_priv;
lvds->dpms_mode = mode;
} else {
struct radeon_encoder_lvds *lvds = radeon_encoder->enc_priv;
lvds->dpms_mode = mode;
}
}
Annotation
- Immediate include surface: `linux/backlight.h`, `linux/pci.h`, `drm/drm_device.h`, `drm/drm_file.h`, `drm/drm_modeset_helper_vtables.h`, `drm/drm_util.h`, `drm/radeon_drm.h`, `acpi/video.h`.
- Detected declarations: `function files`, `function radeon_legacy_lvds_update`, `function radeon_legacy_lvds_dpms`, `function radeon_legacy_lvds_prepare`, `function radeon_legacy_lvds_commit`, `function radeon_legacy_lvds_mode_set`, `function radeon_legacy_mode_fixup`, `function radeon_legacy_get_backlight_level`, `function radeon_legacy_set_backlight_level`, `function radeon_legacy_lvds_level`.
- 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.