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 4B330C4167B for ; Tue, 28 Nov 2023 11:51:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A8C3C10E4E8; Tue, 28 Nov 2023 11:51:52 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id C0C7110E4E8 for ; Tue, 28 Nov 2023 11:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701172310; x=1732708310; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=003sWAA/kVc7Tu8wyKFCBQO7V5Jzg41p2A21KkPESik=; b=BQQWNv7ebOSxRsE0Y9/Vv6EaekPN5AJUjfCidgkV/gMcDY0x4d/aVFJu biyoR+OOTo4Q75Edt+gTyd2tKzuVrImublel++hko5dbQJ4dKL347G24s ayNgvbhm39XwU/ewHRebSxdwWW7tUnnSXdPOY7tRfaIMWPYaMdt73M/Hr OUD5ZZOQdVTs3Vkh2NXreTkfFKlK6j4WctG0a4inBX/+0dSJn5WsCD9uA jWQ7YK3j4KbnOgmIiuXPpVK86tb6tbkp7Q7lMFJX57Npmka6CLwrVYmZZ +kbYNVTLY/A3Vz4pr0L8j3Ug8laL2xjypYqyS5OrRvmm9QqeqSuy4rftr A==; X-IronPort-AV: E=McAfee;i="6600,9927,10907"; a="459411595" X-IronPort-AV: E=Sophos;i="6.04,233,1695711600"; d="scan'208";a="459411595" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2023 03:51:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10907"; a="761907437" X-IronPort-AV: E=Sophos;i="6.04,233,1695711600"; d="scan'208";a="761907437" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by orsmga007.jf.intel.com with SMTP; 28 Nov 2023 03:51:48 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 28 Nov 2023 13:51:48 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Date: Tue, 28 Nov 2023 13:51:33 +0200 Message-ID: <20231128115138.13238-4-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231128115138.13238-1-ville.syrjala@linux.intel.com> References: <20231128115138.13238-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Intel-gfx] [PATCH 3/8] drm/i915/cdclk: Remove the assumption that cd2x div==2 when using squashing 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" From: Ville Syrjälä Currently we have a hardcoded assumption that the cd2x divider is always 2 when squahsing is used. While that is true for all current platforms it might not hold in the future. So eliminate the assumption and calculate the correct divider from the other parameters. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_cdclk.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c index 87d5e5b67c4e..d45071675629 100644 --- a/drivers/gpu/drm/i915/display/intel_cdclk.c +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c @@ -1899,10 +1899,8 @@ static void _bxt_set_cdclk(struct drm_i915_private *dev_priv, waveform = cdclk_squash_waveform(dev_priv, cdclk); - if (waveform) - clock = vco / 2; - else - clock = cdclk; + clock = DIV_ROUND_CLOSEST(cdclk * cdclk_squash_len, + cdclk_squash_divider(waveform)); if (HAS_CDCLK_SQUASH(dev_priv)) dg2_cdclk_squash_program(dev_priv, waveform); -- 2.41.0