Linux Media Controller development
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	dongcheng.yan@intel.com
Subject: [PATCH v3 04/11] media: ccs-pll: Correct the upper limit of maximum op_pre_pll_clk_div
Date: Wed, 23 Apr 2025 15:33:52 +0300	[thread overview]
Message-ID: <20250423123359.1800904-5-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <20250423123359.1800904-1-sakari.ailus@linux.intel.com>

The PLL calculator does a search of the PLL configuration space for all
valid OP pre-PLL clock dividers. The maximum did not take into account the
CCS PLL flag CCS_PLL_FLAG_EXT_IP_PLL_DIVIDER in which case also odd PLL
dividers (other than 1) are valid. Do that now.

Fixes: 4e1e8d240dff ("media: ccs-pll: Add support for extended input PLL clock divider")
Cc: stable@vger.kernel.org
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/i2c/ccs-pll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ccs-pll.c b/drivers/media/i2c/ccs-pll.c
index 266fcd160da6..d985686b0a36 100644
--- a/drivers/media/i2c/ccs-pll.c
+++ b/drivers/media/i2c/ccs-pll.c
@@ -799,7 +799,7 @@ int ccs_pll_calculate(struct device *dev, const struct ccs_pll_limits *lim,
 		op_lim_fr->min_pre_pll_clk_div, op_lim_fr->max_pre_pll_clk_div);
 	max_op_pre_pll_clk_div =
 		min_t(u16, op_lim_fr->max_pre_pll_clk_div,
-		      clk_div_even(pll->ext_clk_freq_hz /
+		      DIV_ROUND_UP(pll->ext_clk_freq_hz,
 				   op_lim_fr->min_pll_ip_clk_freq_hz));
 	min_op_pre_pll_clk_div =
 		max_t(u16, op_lim_fr->min_pre_pll_clk_div,
-- 
2.39.5


  parent reply	other threads:[~2025-04-23 12:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23 12:33 [PATCH v3 00/11] CCS PLL fixes and improvements Sakari Ailus
2025-04-23 12:33 ` [PATCH v3 01/11] media: ccs-pll: Start OP pre-PLL multiplier search from correct value Sakari Ailus
2025-04-23 12:33 ` [PATCH v3 02/11] media: ccs-pll: Start VT " Sakari Ailus
2025-04-23 12:33 ` [PATCH v3 03/11] media: ccs-pll: Check for too high VT PLL multiplier in dual PLL case Sakari Ailus
2025-04-23 12:33 ` Sakari Ailus [this message]
2025-04-23 12:33 ` [PATCH v3 05/11] media: ccs-pll: Print a debug message on too high VT PLL OP clock Sakari Ailus
2025-04-23 12:33 ` [PATCH v3 06/11] media: ccs-pll: Drop LINK_DECOUPLED flag Sakari Ailus
2025-04-23 12:33 ` [PATCH v3 07/11] media: ccs-pll: Print missing PLL flags Sakari Ailus
2025-04-23 12:33 ` [PATCH v3 08/11] media: ccs-pll: Add a flag for even PLL multipliers Sakari Ailus
2025-04-23 21:49   ` Laurent Pinchart
2025-04-23 12:33 ` [PATCH v3 09/11] media: ccs-pll: Better validate VT PLL branch Sakari Ailus
2025-04-23 12:33 ` [PATCH v3 10/11] media: ccs-pll: Print PLL calculator flags in the beginning Sakari Ailus
2025-04-23 12:33 ` [PATCH v3 11/11] media: ccs-pll: Document the CCS PLL flags Sakari Ailus
2025-04-23 12:43   ` Laurent Pinchart
2025-04-23 12:51     ` Sakari Ailus
2025-04-23 15:37     ` [PATCH v4 " Sakari Ailus
2025-04-23 17:50       ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250423123359.1800904-5-sakari.ailus@linux.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=dongcheng.yan@intel.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox