drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c- Extension
.c- Size
- 62419 bytes
- Lines
- 1943
- 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_types.hcore_types.hinclude/grph_object_id.hinclude/logger_interface.hdce_clock_source.hclk_mgr.hdccg.hreg_helper.h
Detected Declarations
function filesfunction calculate_fb_and_fractional_fb_dividerfunction calc_fb_divider_checking_tolerancefunction calc_pll_dividers_in_rangefunction calculate_pixel_clock_pll_dividersfunction pll_adjust_pix_clkfunction methodfunction dce112_get_pix_clk_dividers_helperfunction dce110_get_pix_clk_dividersfunction dce112_get_pix_clk_dividersfunction disable_spread_spectrumfunction calculate_ssfunction enable_spread_spectrumfunction dce110_program_pixel_clk_resyncfunction dce112_program_pixel_clk_resyncfunction dce110_program_pix_clkfunction PLLfunction dce112_program_pix_clkfunction dcn31_program_pix_clkfunction dc_is_virtual_signalfunction dcn401_program_pix_clkfunction dce110_clock_source_power_downfunction get_dp_dto_frequency_100hzfunction dcn401_get_dp_dto_frequency_100hzfunction dcn20_program_pix_clkfunction dcn20_override_dp_pix_clkfunction dcn3_program_pix_clkfunction dcn3_get_pix_clk_dividersfunction get_ss_info_from_atombiosfunction ss_info_from_atombios_createfunction calc_pll_max_vco_constructfunction dce110_clk_src_constructfunction dce112_clk_src_constructfunction dcn20_clk_src_constructfunction dcn3_clk_src_constructfunction dcn31_clk_src_constructfunction dcn401_clk_src_constructfunction dcn301_clk_src_construct
Annotated Snippet
if (ss_parm->freq_range_khz >= pix_clk_khz) {
ret = ss_parm;
break;
}
}
return ret;
}
/**
* calculate_fb_and_fractional_fb_divider - Calculates feedback and fractional
* feedback dividers values
*
* @calc_pll_cs: Pointer to clock source information
* @target_pix_clk_100hz: Desired frequency in 100 Hz
* @ref_divider: Reference divider (already known)
* @post_divider: Post Divider (already known)
* @feedback_divider_param: Pointer where to store
* calculated feedback divider value
* @fract_feedback_divider_param: Pointer where to store
* calculated fract feedback divider value
*
* return:
* It fills the locations pointed by feedback_divider_param
* and fract_feedback_divider_param
* It returns - true if feedback divider not 0
* - false should never happen)
*/
static bool calculate_fb_and_fractional_fb_divider(
struct calc_pll_clock_source *calc_pll_cs,
uint32_t target_pix_clk_100hz,
uint32_t ref_divider,
uint32_t post_divider,
uint32_t *feedback_divider_param,
uint32_t *fract_feedback_divider_param)
{
uint64_t feedback_divider;
feedback_divider =
(uint64_t)target_pix_clk_100hz * ref_divider * post_divider;
feedback_divider *= 10;
/* additional factor, since we divide by 10 afterwards */
feedback_divider *= (uint64_t)(calc_pll_cs->fract_fb_divider_factor);
feedback_divider = div_u64(feedback_divider, calc_pll_cs->ref_freq_khz * 10ull);
/*Round to the number of precision
* The following code replace the old code (ullfeedbackDivider + 5)/10
* for example if the difference between the number
* of fractional feedback decimal point and the fractional FB Divider precision
* is 2 then the equation becomes (ullfeedbackDivider + 5*100) / (10*100))*/
feedback_divider += 5ULL *
calc_pll_cs->fract_fb_divider_precision_factor;
feedback_divider =
div_u64(feedback_divider,
calc_pll_cs->fract_fb_divider_precision_factor * 10);
feedback_divider *= (uint64_t)
(calc_pll_cs->fract_fb_divider_precision_factor);
*feedback_divider_param = (uint32_t)div_u64_rem(
feedback_divider, calc_pll_cs->fract_fb_divider_factor,
fract_feedback_divider_param);
if (*feedback_divider_param != 0)
return true;
return false;
}
/**
* calc_fb_divider_checking_tolerance - Calculates Feedback and
* Fractional Feedback divider values
* for passed Reference and Post divider,
* checking for tolerance.
* @calc_pll_cs: Pointer to clock source information
* @pll_settings: Pointer to PLL settings
* @ref_divider: Reference divider (already known)
* @post_divider: Post Divider (already known)
* @tolerance: Tolerance for Calculated Pixel Clock to be within
*
* return:
* It fills the PLLSettings structure with PLL Dividers values
* if calculated values are within required tolerance
* It returns - true if error is within tolerance
* - false if error is not within tolerance
*/
static bool calc_fb_divider_checking_tolerance(
struct calc_pll_clock_source *calc_pll_cs,
struct pll_settings *pll_settings,
uint32_t ref_divider,
uint32_t post_divider,
Annotation
- Immediate include surface: `dm_services.h`, `dc_types.h`, `core_types.h`, `include/grph_object_id.h`, `include/logger_interface.h`, `dce_clock_source.h`, `clk_mgr.h`, `dccg.h`.
- Detected declarations: `function files`, `function calculate_fb_and_fractional_fb_divider`, `function calc_fb_divider_checking_tolerance`, `function calc_pll_dividers_in_range`, `function calculate_pixel_clock_pll_dividers`, `function pll_adjust_pix_clk`, `function method`, `function dce112_get_pix_clk_dividers_helper`, `function dce110_get_pix_clk_dividers`, `function dce112_get_pix_clk_dividers`.
- 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.