From patchwork Fri Feb 16 16:45:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gustavo Sousa X-Patchwork-Id: 13560323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7ECE8C48BEF for ; Fri, 16 Feb 2024 16:46:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0FA5410E24A; Fri, 16 Feb 2024 16:46:07 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="TGB8m6f8"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 10FF710E24A for ; Fri, 16 Feb 2024 16:46:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708101964; x=1739637964; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=7FwJK63WT7IoSsKFyZd+qvXFm2ka+lKKIA9983wfXkc=; b=TGB8m6f8F9EOAquvEpc8AQT46CzF7mgpcmg2VXwr1Kw1ScL7H0otTNAX 9kM52PnoZ4HumE0pZ+OcX7OAGkC/8BkIcT7tFC75L9MXbZhh7SiE00W2k daE9IB+zKNzRkSq56aO7ZM2358ObrkW/JbABWMQoNifcHA7opjimSKjrB 3so0RGzrQYUOuvc5KFGPPEbUnWzfaGLqO17C1nNNpayhweURHkp4YMlAL pV+v9T598BQeopcc+LNAHolEcN6zsGBQ2ExCAIMWwxfrXgAAkfv6Xt1om Ms0JqDOiLYjfAO0GcobTq/DnA7NPy+zDcNpTqvxof7ceakNWnNLiSlyz2 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10986"; a="2642270" X-IronPort-AV: E=Sophos;i="6.06,165,1705392000"; d="scan'208";a="2642270" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2024 08:46:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,165,1705392000"; d="scan'208";a="4271199" Received: from apradhan-mobl1.amr.corp.intel.com (HELO gjsousa-mobl2.intel.com) ([10.125.208.2]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2024 08:46:03 -0800 From: Gustavo Sousa To: intel-gfx@lists.freedesktop.org Cc: Ville Syrjala Subject: [PATCH] drm/i915/cdclk: Document CDCLK components Date: Fri, 16 Feb 2024 13:45:25 -0300 Message-ID: <20240216164524.188750-2-gustavo.sousa@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Improve documentation by giving an overview of the components involved in the generation of the CDCLK. Signed-off-by: Gustavo Sousa Reviewed-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_cdclk.c | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c index 30dae4fef6cb..ef1660f94e46 100644 --- a/drivers/gpu/drm/i915/display/intel_cdclk.c +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c @@ -63,6 +63,31 @@ * DMC will not change the active CDCLK frequency however, so that part * will still be performed by the driver directly. * + * There are multiple components involved in the generation of the CDCLK + * frequency: + * - We have the CDCLK PLL, which generates an output clock based on a + * reference clock and a ratio parameter. + * - The CD2X Divider, which divides the output of the PLL based on a + * divisor selected from a set of pre-defined choices. + * - The CD2X Squasher, which further divides the output based on a + * waveform represented as a sequence of bits where each zero + * "squashes out" a clock cycle. + * - And, finally, a fixed divider that divides the output frequency by 2. + * + * As such, the resulting CDCLK frequency can be calculated with the + * following formula: + * + * cdclk = vco / cd2x_div / (sq_len / sq_div) / 2 + * + * , where vco is the frequency generated by the PLL; cd2x_div + * represents the CD2X Divider; sq_len and sq_div are the bit length + * and the number of high bits for the CD2X Squasher waveform, respectively; + * and 2 represents the fixed divider. + * + * Note that some older platforms do not contain the CD2X Divider + * and/or CD2X Squasher, in which case we can ignore their respective + * factors in the formula above. + * * Several methods exist to change the CDCLK frequency, which ones are * supported depends on the platform: * - Full PLL disable + re-enable with new VCO frequency. Pipes must be inactive.