drivers/gpu/drm/radeon/atombios_encoders.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/radeon/atombios_encoders.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/radeon/atombios_encoders.c- Extension
.c- Size
- 89906 bytes
- Lines
- 2789
- 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/dmi.hlinux/pci.hdrm/drm_crtc_helper.hdrm/drm_edid.hdrm/drm_file.hdrm/drm_modeset_helper_vtables.hdrm/radeon_drm.hacpi/video.hatom.hradeon_atombios.hradeon.hradeon_asic.hradeon_audio.h
Detected Declarations
function radeon_atom_get_backlight_level_from_regfunction radeon_atom_set_backlight_level_to_regfunction atombios_get_backlight_levelfunction atombios_set_backlight_levelfunction radeon_atom_bl_levelfunction radeon_atom_backlight_update_statusfunction radeon_atom_backlight_get_brightnessfunction radeon_atom_backlight_initfunction radeon_atom_backlight_exitfunction radeon_atom_mode_fixupfunction atombios_dac_setupfunction atombios_tv_setupfunction radeon_atom_get_bpcfunction atombios_dvo_setupfunction atombios_digital_setupfunction atombios_get_encoder_modefunction atombios_dig_encoder_setup2function atombios_dig_encoder_setupfunction atombios_dig_transmitter_setup2function atombios_dig_transmitter_setupfunction atombios_set_edp_panel_powerfunction atombios_external_encoder_setupfunction atombios_yuv_setupfunction radeon_atom_encoder_dpms_avivofunction radeon_atom_encoder_dpms_digfunction radeon_atom_encoder_dpmsfunction atombios_set_encoder_crtc_sourcefunction atombios_apply_encoder_quirksfunction radeon_atom_release_dig_encoderfunction radeon_atom_pick_dig_encoderfunction radeon_atom_encoder_initfunction list_for_each_entryfunction radeon_atom_encoder_mode_setfunction atombios_dac_load_detectfunction radeon_atom_dac_detectfunction radeon_atom_dig_detectfunction radeon_atom_ext_encoder_setup_ddcfunction radeon_atom_encoder_preparefunction radeon_atom_encoder_commitfunction radeon_atom_encoder_disablefunction list_for_each_entryfunction radeon_atom_ext_preparefunction radeon_enc_destroyfunction radeon_atombios_set_dac_infofunction radeon_atombios_set_dig_infofunction radeon_add_atom_encoder
Annotated Snippet
switch (radeon_encoder->encoder_id) {
case ENCODER_OBJECT_ID_INTERNAL_LVDS:
case ENCODER_OBJECT_ID_INTERNAL_LVTM1:
index = GetIndexIntoMasterTable(COMMAND, LCD1OutputControl);
if (dig->backlight_level == 0) {
args.ucAction = ATOM_LCD_BLOFF;
atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args));
} else {
args.ucAction = ATOM_LCD_BL_BRIGHTNESS_CONTROL;
atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args));
args.ucAction = ATOM_LCD_BLON;
atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args));
}
break;
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY3:
if (dig->backlight_level == 0)
atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_LCD_BLOFF, 0, 0);
else {
atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_BL_BRIGHTNESS_CONTROL, 0, 0);
atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_LCD_BLON, 0, 0);
}
break;
default:
break;
}
}
}
static u8 radeon_atom_bl_level(struct backlight_device *bd)
{
u8 level;
/* Convert brightness to hardware level */
if (bd->props.brightness < 0)
level = 0;
else if (bd->props.brightness > RADEON_MAX_BL_LEVEL)
level = RADEON_MAX_BL_LEVEL;
else
level = bd->props.brightness;
return level;
}
static int radeon_atom_backlight_update_status(struct backlight_device *bd)
{
struct radeon_backlight_privdata *pdata = bl_get_data(bd);
struct radeon_encoder *radeon_encoder = pdata->encoder;
atombios_set_backlight_level(radeon_encoder, radeon_atom_bl_level(bd));
return 0;
}
static int radeon_atom_backlight_get_brightness(struct backlight_device *bd)
{
struct radeon_backlight_privdata *pdata = bl_get_data(bd);
struct radeon_encoder *radeon_encoder = pdata->encoder;
struct drm_device *dev = radeon_encoder->base.dev;
struct radeon_device *rdev = dev->dev_private;
return radeon_atom_get_backlight_level_from_reg(rdev);
}
static const struct backlight_ops radeon_atom_backlight_ops = {
.get_brightness = radeon_atom_backlight_get_brightness,
.update_status = radeon_atom_backlight_update_status,
};
void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
struct drm_connector *drm_connector)
{
struct drm_device *dev = radeon_encoder->base.dev;
struct radeon_device *rdev = dev->dev_private;
struct backlight_device *bd;
struct backlight_properties props;
struct radeon_backlight_privdata *pdata;
struct radeon_encoder_atom_dig *dig;
char bl_name[16];
/* Mac laptops with multiple GPUs use the gmux driver for backlight
* so don't register a backlight device
*/
if ((rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) &&
(rdev->pdev->device == 0x6741) &&
!(dmi_match(DMI_PRODUCT_NAME, "iMac12,1") || dmi_match(DMI_PRODUCT_NAME, "iMac12,2")))
return;
Annotation
- Immediate include surface: `linux/backlight.h`, `linux/dmi.h`, `linux/pci.h`, `drm/drm_crtc_helper.h`, `drm/drm_edid.h`, `drm/drm_file.h`, `drm/drm_modeset_helper_vtables.h`, `drm/radeon_drm.h`.
- Detected declarations: `function radeon_atom_get_backlight_level_from_reg`, `function radeon_atom_set_backlight_level_to_reg`, `function atombios_get_backlight_level`, `function atombios_set_backlight_level`, `function radeon_atom_bl_level`, `function radeon_atom_backlight_update_status`, `function radeon_atom_backlight_get_brightness`, `function radeon_atom_backlight_init`, `function radeon_atom_backlight_exit`, `function radeon_atom_mode_fixup`.
- 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.