drivers/gpu/drm/amd/display/modules/power/power_abm.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/modules/power/power_abm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/modules/power/power_abm.c- Extension
.c- Size
- 74377 bytes
- Lines
- 2071
- 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
dm_services.hdc.hmod_power.hcore_types.hdmcu.habm.hpower_helpers.hdce/dmub_psr.hdal_asic_id.hlink_service.hlinux/math.h
Detected Declarations
struct abm_parametersstruct custom_backlight_profilestruct iram_table_v_2struct iram_table_v_2_2function container_offunction backlight_millipercent_to_millinitfunction backlight_millinit_to_millipercentfunction backlight_pwm_to_millipercentfunction backlight_pwm_to_millinitfunction backlight_millipercent_to_pwmfunction backlight_millinit_to_pwmfunction validate_ext_backlight_capsfunction initialize_backlight_capsfunction varibright_set_levelfunction mod_power_hw_init_backlightfunction mod_power_update_backlight_on_mode_changefunction set_backlight_millinits_auxfunction set_backlightfunction fill_backlight_level_paramsfunction mod_power_set_backlight_nitsfunction mod_power_backlight_percent_to_nitsfunction mod_power_backlight_nits_to_percentfunction mod_power_set_backlight_percentfunction mod_power_update_backlightfunction mod_power_update_backlight_nitsfunction mod_power_get_backlight_pwmfunction mod_power_get_backlight_nitsfunction mod_power_get_backlight_percentfunction mod_power_get_hw_target_backlight_pwm_nitsfunction mod_power_get_hw_target_backlight_pwm_percentfunction mod_power_get_hw_target_backlight_pwmfunction mod_power_get_hw_backlight_pwm_nitsfunction mod_power_get_hw_backlight_aux_nitsfunction mod_power_get_hw_backlight_pwm_percentfunction mod_power_get_hw_backlight_pwmfunction mod_power_get_panel_backlight_boundariesfunction mod_power_set_smooth_brightnessfunction mod_power_varibright_feature_enablefunction mod_power_varibright_activatefunction mod_power_varibright_set_levelfunction mod_power_varibright_set_hw_levelfunction mod_power_get_varibright_levelfunction mod_power_get_varibright_hw_levelfunction mod_power_get_varibright_default_levelfunction mod_power_get_varibright_enablefunction mod_power_is_abm_activefunction fill_backlight_transform_tablefunction fill_backlight_transform_table_v_2_2
Annotated Snippet
struct abm_parameters {
unsigned char min_reduction;
unsigned char max_reduction;
unsigned char bright_pos_gain;
unsigned char dark_pos_gain;
unsigned char brightness_gain;
unsigned char contrast_factor;
unsigned char deviation_gain;
unsigned char min_knee;
unsigned char max_knee;
unsigned short blRampReduction;
unsigned short blRampStart;
};
static const struct abm_parameters abm_settings_config0[abm_defines_max_level] = {
// min_red max_red bright_pos dark_pos bright_gain contrast dev min_knee max_knee blRed blStart
{0xff, 0xbf, 0x20, 0x00, 0xff, 0x99, 0xb3, 0x40, 0xe0, 0xf777, 0xcccc},
{0xde, 0x85, 0x20, 0x00, 0xe0, 0x90, 0xa8, 0x40, 0xc8, 0xf777, 0xcccc},
{0xb0, 0x50, 0x20, 0x00, 0xc0, 0x88, 0x78, 0x70, 0xa0, 0xeeee, 0x9999},
{0x82, 0x40, 0x20, 0x00, 0x00, 0xb8, 0xb3, 0x70, 0x70, 0xe333, 0xb333},
};
static const struct abm_parameters abm_settings_config1[abm_defines_max_level] = {
// min_red max_red bright_pos dark_pos bright_gain contrast dev min_knee max_knee blRed blStart
{0xf0, 0xd9, 0x20, 0x00, 0x00, 0xff, 0xb3, 0x70, 0x70, 0xcccc, 0xcccc},
{0xcd, 0xa5, 0x20, 0x00, 0x00, 0xff, 0xb3, 0x70, 0x70, 0xcccc, 0xcccc},
{0x99, 0x65, 0x20, 0x00, 0x00, 0xff, 0xb3, 0x70, 0x70, 0xcccc, 0xcccc},
{0x82, 0x4d, 0x20, 0x00, 0x00, 0xff, 0xb3, 0x70, 0x70, 0xcccc, 0xcccc},
};
static const struct abm_parameters abm_settings_config2[abm_defines_max_level] = {
// min_red max_red bright_pos dark_pos bright_gain contrast dev min_knee max_knee blRed blStart
{0xf0, 0xbf, 0x20, 0x00, 0x88, 0x99, 0xb3, 0x40, 0xe0, 0x0000, 0xcccc},
{0xd8, 0x85, 0x20, 0x00, 0x70, 0x90, 0xa8, 0x40, 0xc8, 0x0700, 0xb333},
{0xb8, 0x58, 0x20, 0x00, 0x64, 0x88, 0x78, 0x70, 0xa0, 0x7000, 0x9999},
{0x82, 0x40, 0x20, 0x00, 0x00, 0xb8, 0xb3, 0x70, 0x70, 0xc333, 0xb333},
};
static const struct abm_parameters * const abm_settings[] = {
abm_settings_config0,
abm_settings_config1,
abm_settings_config2,
};
static const struct dm_bl_data_point custom_backlight_curve0[] = {
{2, 14}, {4, 16}, {6, 18}, {8, 21}, {10, 23}, {12, 26}, {14, 29}, {16, 32}, {18, 35},
{20, 38}, {22, 41}, {24, 44}, {26, 48}, {28, 52}, {30, 55}, {32, 59}, {34, 62},
{36, 67}, {38, 71}, {40, 75}, {42, 80}, {44, 84}, {46, 88}, {48, 93}, {50, 98},
{52, 103}, {54, 108}, {56, 113}, {58, 118}, {60, 123}, {62, 129}, {64, 135}, {66, 140},
{68, 146}, {70, 152}, {72, 158}, {74, 164}, {76, 171}, {78, 177}, {80, 183}, {82, 190},
{84, 197}, {86, 204}, {88, 211}, {90, 218}, {92, 225}, {94, 232}, {96, 240}, {98, 247}};
struct custom_backlight_profile {
uint8_t ac_level_percentage;
uint8_t dc_level_percentage;
uint8_t min_input_signal;
uint8_t max_input_signal;
uint8_t num_data_points;
const struct dm_bl_data_point *data_points;
};
static const struct custom_backlight_profile custom_backlight_profiles[] = {
{100, 32, 12, 255, ARRAY_SIZE(custom_backlight_curve0), custom_backlight_curve0},
};
#define NUM_AMBI_LEVEL 5
#define NUM_AGGR_LEVEL 4
#define NUM_POWER_FN_SEGS 8
#define NUM_BL_CURVE_SEGS 16
#define IRAM_SIZE 256
#define IRAM_RESERVE_AREA_START_V2 0xF0 // reserve 0xF0~0xF6 are write by DMCU only
#define IRAM_RESERVE_AREA_END_V2 0xF6 // reserve 0xF0~0xF6 are write by DMCU only
#define IRAM_RESERVE_AREA_START_V2_2 0xF0 // reserve 0xF0~0xFF are write by DMCU only
#define IRAM_RESERVE_AREA_END_V2_2 0xFF // reserve 0xF0~0xFF are write by DMCU only
#pragma pack(push, 1)
/* NOTE: iRAM is 256B in size */
struct iram_table_v_2 {
/* flags */
uint16_t min_abm_backlight; /* 0x00 U16 */
/* parameters for ABM2.0 algorithm */
uint8_t min_reduction[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; /* 0x02 U0.8 */
uint8_t max_reduction[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; /* 0x16 U0.8 */
uint8_t bright_pos_gain[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; /* 0x2a U2.6 */
uint8_t bright_neg_gain[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; /* 0x3e U2.6 */
uint8_t dark_pos_gain[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; /* 0x52 U2.6 */
uint8_t dark_neg_gain[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; /* 0x66 U2.6 */
Annotation
- Immediate include surface: `dm_services.h`, `dc.h`, `mod_power.h`, `core_types.h`, `dmcu.h`, `abm.h`, `power_helpers.h`, `dce/dmub_psr.h`.
- Detected declarations: `struct abm_parameters`, `struct custom_backlight_profile`, `struct iram_table_v_2`, `struct iram_table_v_2_2`, `function container_of`, `function backlight_millipercent_to_millinit`, `function backlight_millinit_to_millipercent`, `function backlight_pwm_to_millipercent`, `function backlight_pwm_to_millinit`, `function backlight_millipercent_to_pwm`.
- 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.