diff mbox series

[1/3] phy: freescale: fsl-samsung-hdmi: Expand Integer divider range

Message ID 20241020165102.340838-1-aford173@gmail.com
State Superseded
Headers show
Series [1/3] phy: freescale: fsl-samsung-hdmi: Expand Integer divider range | expand

Commit Message

Adam Ford Oct. 20, 2024, 4:50 p.m. UTC
The Integer divder uses values of P,M, and S to determine the PLL
rate.  Currently, the range of M was set based on a series of
table entries where the range was limited.  Since the ref manual
shows it is 8-bit wide, expand the range to be up to 255.

Signed-off-by: Adam Ford <aford173@gmail.com>
---
 drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Frieder Schrempf Oct. 22, 2024, 7:04 a.m. UTC | #1
On 20.10.24 6:50 PM, Adam Ford wrote:
> The Integer divder uses values of P,M, and S to determine the PLL
> rate.  Currently, the range of M was set based on a series of
> table entries where the range was limited.  Since the ref manual
> shows it is 8-bit wide, expand the range to be up to 255.
> 
> Signed-off-by: Adam Ford <aford173@gmail.com>

With the typo below fixed:

Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>

> ---
>  drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> index 2c8038864357..3f9578f3f0ac 100644
> --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> @@ -406,16 +406,15 @@ static unsigned long fsl_samsung_hdmi_phy_find_pms(unsigned long fout, u8 *p, u1
>  				continue;
>  
>  			/*
> -			 * TODO: Ref Manual doesn't state the range of _m
> -			 * so this should be further refined if possible.
> -			 * This range was set based on the original values
> -			 * in the lookup table
> +			 * The Ref manual doesn't explicitly state the range of M,
> +			 * bit it does show it as an 8-bit value, so we'll reject

                           ^ but

> +			 * any value above 255.
>  			 */
>  			tmp = (u64)fout * (_p * _s);
>  			do_div(tmp, 24 * MHZ);
> -			_m = tmp;
> -			if (_m < 0x30 || _m > 0x7b)
> +			if (tmp > 255)
>  				continue;
> +			_m = tmp;
>  
>  			/*
>  			 * Rev 2 of the Ref Manual states the
Adam Ford Oct. 23, 2024, 3:04 p.m. UTC | #2
On Tue, Oct 22, 2024 at 2:04 AM Frieder Schrempf
<frieder.schrempf@kontron.de> wrote:
>
> On 20.10.24 6:50 PM, Adam Ford wrote:
> > The Integer divder uses values of P,M, and S to determine the PLL
> > rate.  Currently, the range of M was set based on a series of
> > table entries where the range was limited.  Since the ref manual
> > shows it is 8-bit wide, expand the range to be up to 255.
> >
> > Signed-off-by: Adam Ford <aford173@gmail.com>
>
> With the typo below fixed:
>
> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>

Thanks for the review.  I'll post V2 in the next few days.
>
> > ---
> >  drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 11 +++++------
> >  1 file changed, 5 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> > index 2c8038864357..3f9578f3f0ac 100644
> > --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> > +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> > @@ -406,16 +406,15 @@ static unsigned long fsl_samsung_hdmi_phy_find_pms(unsigned long fout, u8 *p, u1
> >                               continue;
> >
> >                       /*
> > -                      * TODO: Ref Manual doesn't state the range of _m
> > -                      * so this should be further refined if possible.
> > -                      * This range was set based on the original values
> > -                      * in the lookup table
> > +                      * The Ref manual doesn't explicitly state the range of M,
> > +                      * bit it does show it as an 8-bit value, so we'll reject
>
>                            ^ but

whoops!  Good catch.

adam
>
> > +                      * any value above 255.
> >                        */
> >                       tmp = (u64)fout * (_p * _s);
> >                       do_div(tmp, 24 * MHZ);
> > -                     _m = tmp;
> > -                     if (_m < 0x30 || _m > 0x7b)
> > +                     if (tmp > 255)
> >                               continue;
> > +                     _m = tmp;
> >
> >                       /*
> >                        * Rev 2 of the Ref Manual states the
>
diff mbox series

Patch

diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
index 2c8038864357..3f9578f3f0ac 100644
--- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
+++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
@@ -406,16 +406,15 @@  static unsigned long fsl_samsung_hdmi_phy_find_pms(unsigned long fout, u8 *p, u1
 				continue;
 
 			/*
-			 * TODO: Ref Manual doesn't state the range of _m
-			 * so this should be further refined if possible.
-			 * This range was set based on the original values
-			 * in the lookup table
+			 * The Ref manual doesn't explicitly state the range of M,
+			 * bit it does show it as an 8-bit value, so we'll reject
+			 * any value above 255.
 			 */
 			tmp = (u64)fout * (_p * _s);
 			do_div(tmp, 24 * MHZ);
-			_m = tmp;
-			if (_m < 0x30 || _m > 0x7b)
+			if (tmp > 255)
 				continue;
+			_m = tmp;
 
 			/*
 			 * Rev 2 of the Ref Manual states the