• Sascha Hauer's avatar
    clk: imx: pll14xx: Support dynamic rates · b09c68dc
    Sascha Hauer authored
    The pll1443x PLL so far only supports rates from a rate table passed
    during initialization. Calculating PLL settings dynamically helps audio
    applications to get their desired rates, so support for this is added
    in this patch.
    
    The strategy to get to the PLL setting for a rate is:
    
    - First try to only adjust kdiv which specifies the fractional part of the PLL.
      This setting can be changed without glitches on the output and is therefore
      preferred
    - When that isn't possible then the rate table is searched for suitable rates,
      so for standard rates the same settings are used as without this patch
    - As a last resort the best settings are calculated dynamically
    
    The code in this patch is based on patches from Adrian Alonso <adrian.alonso@nxp.com>
    and Mads Bligaard Nielsen <bli@bang-olufsen.dk>
    Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
    Reviewed-by: default avatarAbel Vesa <abel.vesa@nxp.com>
    Link: https://lore.kernel.org/r/20220304125256.2125023-9-s.hauer@pengutronix.deSigned-off-by: default avatarAbel Vesa <abel.vesa@nxp.com>
    b09c68dc
clk-pll14xx.c 13.6 KB