[PATCH v4 07/11] clk: sunxi-ng: nm: Support finding closest rate

Maxime Ripard mripard at kernel.org
Mon Jul 17 07:12:30 PDT 2023


On Mon, Jul 17, 2023 at 03:34:31PM +0200, Frank Oltmanns wrote:
> Use the helper function ccu_is_better_rate() to determine the rate that
> is closest to the requested rate, thereby supporting rates that are
> higher than the requested rate if the clock uses the
> CCU_FEATURE_CLOSEST_RATE.
> 
> Add the macro SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST which
> sets CCU_FEATURE_CLOSEST_RATE.
> 
> To avoid code duplication, add the macros
> SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_FEAT that allows selecting
> arbitrary features and use it in the original
> SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX as well as the newly introduced
> SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST macros.
> 
> Signed-off-by: Frank Oltmanns <frank at oltmanns.dev>
> ---
>  drivers/clk/sunxi-ng/ccu_nm.c | 11 ++++------
>  drivers/clk/sunxi-ng/ccu_nm.h | 48 ++++++++++++++++++++++++++++++++++++++++---
>  2 files changed, 49 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/clk/sunxi-ng/ccu_nm.c b/drivers/clk/sunxi-ng/ccu_nm.c
> index c1fd11542c45..35d00783d748 100644
> --- a/drivers/clk/sunxi-ng/ccu_nm.c
> +++ b/drivers/clk/sunxi-ng/ccu_nm.c
> @@ -28,7 +28,7 @@ static unsigned long ccu_nm_calc_rate(unsigned long parent,
>  }
>  
>  static unsigned long ccu_nm_find_best(unsigned long parent, unsigned long rate,
> -				      struct _ccu_nm *nm)
> +				      struct _ccu_nm *nm, struct ccu_common *common)

The common pointer must be the first argument.

Once fixed,
Acked-by: Maxime Ripard <mripard at kernel.org>

Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20230717/71f153f7/attachment.sig>


More information about the linux-arm-kernel mailing list