drivers/gpu/drm/amd/display/dc/optc/dcn401/dcn401_optc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/optc/dcn401/dcn401_optc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dc/optc/dcn401/dcn401_optc.c- Extension
.c- Size
- 17589 bytes
- Lines
- 555
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
dcn401_optc.hdcn30/dcn30_optc.hdcn31/dcn31_optc.hdcn32/dcn32_optc.hreg_helper.hdc.hdcn_calc_math.hdc_dmub_srv.h
Detected Declarations
function decide_odm_mem_bit_mapfunction optc401_set_odm_combinefunction optc401_set_h_timing_div_manual_modefunction optc401_enable_crtcfunction optc401_disable_crtcfunction optc401_phantom_crtc_post_enablefunction optc401_disable_phantom_otgfunction optc401_set_odm_bypassfunction optc401_setup_manual_triggerfunction optc401_set_drrfunction optc401_set_out_muxfunction optc401_set_vtotal_min_maxfunction optc401_program_global_syncfunction optc401_set_vupdate_keepoutfunction optc401_wait_update_lock_statusfunction dcn401_timing_generator_init
Annotated Snippet
if (second_preferred_memory_for_opp[i] == false) {
second_preferred_memory_for_opp[i] = true;
total_allocated++;
if (total_required == total_allocated)
break;
}
}
}
ASSERT(total_required == total_allocated);
for (i = 0; i < MAX_PIPES; i++) {
if (first_preferred_memory_for_opp[i])
memory_bit_map |= 0x1 << (i * 2);
if (second_preferred_memory_for_opp[i])
memory_bit_map |= 0x2 << (i * 2);
}
return memory_bit_map;
}
void optc401_set_odm_combine(struct timing_generator *optc, int *opp_id,
int opp_cnt, int segment_width, int last_segment_width)
{
struct optc *optc1 = DCN10TG_FROM_TG(optc);
uint32_t h_active = segment_width * (opp_cnt - 1) + last_segment_width;
uint32_t odm_mem_bit_map = decide_odm_mem_bit_map(
opp_id, opp_cnt, h_active);
REG_SET(OPTC_MEMORY_CONFIG, 0,
OPTC_MEM_SEL, odm_mem_bit_map);
switch (opp_cnt) {
case 2: /* ODM Combine 2:1 */
REG_SET_3(OPTC_DATA_SOURCE_SELECT, 0,
OPTC_NUM_OF_INPUT_SEGMENT, 1,
OPTC_SEG0_SRC_SEL, opp_id[0],
OPTC_SEG1_SRC_SEL, opp_id[1]);
REG_UPDATE(OPTC_WIDTH_CONTROL,
OPTC_SEGMENT_WIDTH, segment_width);
REG_UPDATE(OTG_H_TIMING_CNTL,
OTG_H_TIMING_DIV_MODE, H_TIMING_DIV_BY2);
break;
case 3: /* ODM Combine 3:1 */
REG_SET_4(OPTC_DATA_SOURCE_SELECT, 0,
OPTC_NUM_OF_INPUT_SEGMENT, 2,
OPTC_SEG0_SRC_SEL, opp_id[0],
OPTC_SEG1_SRC_SEL, opp_id[1],
OPTC_SEG2_SRC_SEL, opp_id[2]);
REG_UPDATE(OPTC_WIDTH_CONTROL,
OPTC_SEGMENT_WIDTH, segment_width);
REG_UPDATE(OPTC_WIDTH_CONTROL2,
OPTC_SEGMENT_WIDTH_LAST,
last_segment_width);
/* In ODM combine 3:1 mode ODM packs 4 pixels per data transfer
* so OTG_H_TIMING_DIV_MODE should be configured to
* H_TIMING_DIV_BY4 even though ODM combines 3 OPP inputs, it
* outputs 4 pixels from single OPP at a time.
*/
REG_UPDATE(OTG_H_TIMING_CNTL,
OTG_H_TIMING_DIV_MODE, H_TIMING_DIV_BY4);
break;
case 4: /* ODM Combine 4:1 */
REG_SET_5(OPTC_DATA_SOURCE_SELECT, 0,
OPTC_NUM_OF_INPUT_SEGMENT, 3,
OPTC_SEG0_SRC_SEL, opp_id[0],
OPTC_SEG1_SRC_SEL, opp_id[1],
OPTC_SEG2_SRC_SEL, opp_id[2],
OPTC_SEG3_SRC_SEL, opp_id[3]);
REG_UPDATE(OPTC_WIDTH_CONTROL,
OPTC_SEGMENT_WIDTH, segment_width);
REG_UPDATE(OTG_H_TIMING_CNTL,
OTG_H_TIMING_DIV_MODE, H_TIMING_DIV_BY4);
break;
default:
ASSERT(false);
}
;
optc1->opp_count = opp_cnt;
}
void optc401_set_h_timing_div_manual_mode(struct timing_generator *optc, bool manual_mode)
{
struct optc *optc1 = DCN10TG_FROM_TG(optc);
REG_UPDATE(OTG_H_TIMING_CNTL,
OTG_H_TIMING_DIV_MODE_MANUAL, manual_mode ? 1 : 0);
}
/**
* optc401_enable_crtc() - Enable CRTC
Annotation
- Immediate include surface: `dcn401_optc.h`, `dcn30/dcn30_optc.h`, `dcn31/dcn31_optc.h`, `dcn32/dcn32_optc.h`, `reg_helper.h`, `dc.h`, `dcn_calc_math.h`, `dc_dmub_srv.h`.
- Detected declarations: `function decide_odm_mem_bit_map`, `function optc401_set_odm_combine`, `function optc401_set_h_timing_div_manual_mode`, `function optc401_enable_crtc`, `function optc401_disable_crtc`, `function optc401_phantom_crtc_post_enable`, `function optc401_disable_phantom_otg`, `function optc401_set_odm_bypass`, `function optc401_setup_manual_trigger`, `function optc401_set_drr`.
- 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.