ACK: [SRU][Stonking][Resolute][Questing][PATCH 1/1] media: intel/ipu6: Improve DWC PHY HSFREQRANGE band selection for overlapping ranges

Edoardo Canepa edoardo.canepa at canonical.com
Wed Jul 29 21:05:42 UTC 2026


Acked-by: Edoardo Canepa <edoardo.canepa at canonical.com>

On 6/30/26 19:19, You-Sheng Yang via kernel-team wrote:
> From: Marco Nenciarini <mnencia at kcore.it>
>
> BugLink: https://bugs.launchpad.net/bugs/2156972
>
> The get_hsfreq_by_mbps() function searches the freqranges[] table
> backward (from highest to lowest index). Because adjacent frequency
> bands overlap, a data rate that falls in the overlap region always
> lands on the higher-indexed band.
>
> For data rates up to 1500 Mbps (index 42) every band uses
> osc_freq_target 335. Starting at index 43 (1461-1640 Mbps) the
> osc_freq_target drops to 208. A sensor running at 1498 Mbps sits in
> the overlap between index 42 (1414-1588, osc 335) and index 43
> (1461-1640, osc 208). The backward search picks index 43, programming
> the lower osc_freq_target of 208 instead of the optimal 335.
>
> This causes DDL lock instability and CSI-2 CRC errors on affected
> configurations, such as the OmniVision OV08X40 sensor on Intel Arrow
> Lake platforms (Dell Pro Max 16).
>
> Rewrite get_hsfreq_by_mbps() to select the optimal band:
>
> 1. Among bands whose min/max range covers the data rate, prefer
>     the one with the higher osc_freq_target.
> 2. If osc_freq_target is equal, prefer the band whose default_mbps
>     is closest to the requested rate.
>
> Since the frequency ranges are monotonically increasing, the loop
> exits early once min exceeds the requested rate.
>
> For 1498 Mbps this now correctly selects index 42 (osc_freq_target
> 335, range 1414-1588) instead of index 43 (osc_freq_target 208,
> range 1461-1640).
>
> Fixes: 1e7eeb301696 ("media: intel/ipu6: add the CSI2 DPHY implementation")
> Cc: stable at vger.kernel.org
> Signed-off-by: Marco Nenciarini <mnencia at kcore.it>
> Signed-off-by: Sakari Ailus <sakari.ailus at linux.intel.com>
> (cherry picked from commit 477620dccf3e9481ed6ae67cb5c747f25751c531)
> Signed-off-by: You-Sheng Yang <vicamo.yang at canonical.com>
> ---
>   .../media/pci/intel/ipu6/ipu6-isys-dwc-phy.c  | 26 ++++++++++++++-----
>   1 file changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-dwc-phy.c b/drivers/media/pci/intel/ipu6/ipu6-isys-dwc-phy.c
> index db28748434530..237906cb131ac 100644
> --- a/drivers/media/pci/intel/ipu6/ipu6-isys-dwc-phy.c
> +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-dwc-phy.c
> @@ -288,15 +288,27 @@ static const struct dwc_dphy_freq_range freqranges[DPHY_FREQ_RANGE_NUM] = {
>   
>   static u16 get_hsfreq_by_mbps(u32 mbps)
>   {
> -	unsigned int i = DPHY_FREQ_RANGE_NUM;
> -
> -	while (i--) {
> -		if (freqranges[i].default_mbps == mbps ||
> -		    (mbps >= freqranges[i].min && mbps <= freqranges[i].max))
> -			return i;
> +	u16 best = DPHY_FREQ_RANGE_INVALID_INDEX;
> +	unsigned int i;
> +
> +	for (i = 0; i < DPHY_FREQ_RANGE_NUM; i++) {
> +		if (mbps > freqranges[i].max)
> +			continue;
> +
> +		if (mbps < freqranges[i].min)
> +			break;
> +
> +		if (best == DPHY_FREQ_RANGE_INVALID_INDEX ||
> +		    freqranges[i].osc_freq_target >
> +		    freqranges[best].osc_freq_target ||
> +		    (freqranges[i].osc_freq_target ==
> +		     freqranges[best].osc_freq_target &&
> +		     abs((int)mbps - (int)freqranges[i].default_mbps) <
> +		     abs((int)mbps - (int)freqranges[best].default_mbps)))
> +			best = i;
>   	}
>   
> -	return DPHY_FREQ_RANGE_INVALID_INDEX;
> +	return best;
>   }
>   
>   static int ipu6_isys_dwc_phy_config(struct ipu6_isys *isys,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x20F88172E14F6784.asc
Type: application/pgp-keys
Size: 3167 bytes
Desc: OpenPGP public key
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20260729/bc18662a/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20260729/bc18662a/attachment.sig>


More information about the kernel-team mailing list