All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Adam Ford <aford173@gmail.com>
Cc: linux-phy@lists.infradead.org,
	dominique.martinet@atmark-techno.com, linux-imx@nxp.com,
	festevam@gmail.com, frieder.schrempf@kontron.de,
	aford@beaconembedded.com,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Lucas Stach" <l.stach@pengutronix.de>,
	"Marco Felsch" <m.felsch@pengutronix.de>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC V2 2/2] phy: freescale: fsl-samsung-hdmi: Support dynamic integer divider
Date: Fri, 30 Aug 2024 13:25:32 +0530	[thread overview]
Message-ID: <ZtF69NSHFtAwDupq@vaman> (raw)
In-Reply-To: <CAHCN7xKW=zxips+J73913eEfS+p_e3dN9BWU08=poj599JbUxA@mail.gmail.com>

On 29-08-24, 13:30, Adam Ford wrote:
> On Thu, Aug 29, 2024 at 12:56 PM Vinod Koul <vkoul@kernel.org> wrote:
> >
> > On 28-08-24, 21:12, Adam Ford wrote:
> > > There is currently a look-up table for a variety of resolutions.
> > > Since the phy has the ability to dynamically calculate the values
> > > necessary to use the intger divider which should allow more
> > > resolutions without having to update the look-up-table.  If the
> > > integer calculator cannot get an exact frequency, it falls back
> > > to the look-up-table.  Because the LUT algorithm does some
> > > rounding, I did not remove integer entries from the LUT.
> >
> > Any reason why this is RFC?
> 
> Someone was asking for functionality, but I'm not 100% sure this is
> the right approach or it would even work.  I am waiting for feedback
> from Dominique to determine if this helps solve the display for that
> particular display.
> 
> >
> > >
> > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > >
> > > diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> > > index bc5d3625ece6..76e0899c6006 100644
> > > --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> > > +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> > > @@ -16,6 +16,8 @@
> > >
> > >  #define PHY_REG(reg)         (reg * 4)
> > >
> > > +#define REG01_PMS_P_MASK     GENMASK(3, 0)
> > > +#define REG03_PMS_S_MASK     GENMASK(7, 4)
> > >  #define REG12_CK_DIV_MASK    GENMASK(5, 4)
> > >  #define REG13_TG_CODE_LOW_MASK       GENMASK(7, 0)
> > >  #define REG14_TOL_MASK               GENMASK(7, 4)
> > > @@ -31,11 +33,17 @@
> > >
> > >  #define PHY_PLL_DIV_REGS_NUM 6
> > >
> > > +#ifndef MHZ
> > > +#define MHZ  (1000UL * 1000UL)
> > > +#endif
> > > +
> > >  struct phy_config {
> > >       u32     pixclk;
> > >       u8      pll_div_regs[PHY_PLL_DIV_REGS_NUM];
> > >  };
> > >
> > > +static struct phy_config custom_phy_pll_cfg;
> > > +
> > >  static const struct phy_config phy_pll_cfg[] = {
> > >       {
> > >               .pixclk = 22250000,
> > > @@ -440,10 +448,83 @@ fsl_samsung_hdmi_phy_configure_pll_lock_det(struct fsl_samsung_hdmi_phy *phy,
> > >              phy->regs + PHY_REG(14));
> > >  }
> > >
> > > +static unsigned long fsl_samsung_hdmi_phy_find_pms(unsigned long fout, u8 *p, u16 *m, u8 *s)
> > > +{
> > > +     unsigned long best_freq = 0;
> > > +     u32 min_delta = 0xffffffff;
> >
> > > +     u8 _p, best_p;
> > > +     u16 _m, best_m;
> > > +     u8 _s, best_s;
> > > +
> > > +     for (_p = 1; _p <= 11; ++_p) {
> >
> > starts with 1 to 11.. why?
> 
> According to Rev 2 of the 8MP Reference Manual, the Previder range is
> between 1 and 11.

Would be better to document these assumptions, am sure if someone asks
you this next year, it would be hard to recall :-)

-- 
~Vinod

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vkoul@kernel.org>
To: Adam Ford <aford173@gmail.com>
Cc: linux-phy@lists.infradead.org,
	dominique.martinet@atmark-techno.com, linux-imx@nxp.com,
	festevam@gmail.com, frieder.schrempf@kontron.de,
	aford@beaconembedded.com,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Lucas Stach" <l.stach@pengutronix.de>,
	"Marco Felsch" <m.felsch@pengutronix.de>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC V2 2/2] phy: freescale: fsl-samsung-hdmi: Support dynamic integer divider
Date: Fri, 30 Aug 2024 13:25:32 +0530	[thread overview]
Message-ID: <ZtF69NSHFtAwDupq@vaman> (raw)
In-Reply-To: <CAHCN7xKW=zxips+J73913eEfS+p_e3dN9BWU08=poj599JbUxA@mail.gmail.com>

On 29-08-24, 13:30, Adam Ford wrote:
> On Thu, Aug 29, 2024 at 12:56 PM Vinod Koul <vkoul@kernel.org> wrote:
> >
> > On 28-08-24, 21:12, Adam Ford wrote:
> > > There is currently a look-up table for a variety of resolutions.
> > > Since the phy has the ability to dynamically calculate the values
> > > necessary to use the intger divider which should allow more
> > > resolutions without having to update the look-up-table.  If the
> > > integer calculator cannot get an exact frequency, it falls back
> > > to the look-up-table.  Because the LUT algorithm does some
> > > rounding, I did not remove integer entries from the LUT.
> >
> > Any reason why this is RFC?
> 
> Someone was asking for functionality, but I'm not 100% sure this is
> the right approach or it would even work.  I am waiting for feedback
> from Dominique to determine if this helps solve the display for that
> particular display.
> 
> >
> > >
> > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > >
> > > diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> > > index bc5d3625ece6..76e0899c6006 100644
> > > --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> > > +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> > > @@ -16,6 +16,8 @@
> > >
> > >  #define PHY_REG(reg)         (reg * 4)
> > >
> > > +#define REG01_PMS_P_MASK     GENMASK(3, 0)
> > > +#define REG03_PMS_S_MASK     GENMASK(7, 4)
> > >  #define REG12_CK_DIV_MASK    GENMASK(5, 4)
> > >  #define REG13_TG_CODE_LOW_MASK       GENMASK(7, 0)
> > >  #define REG14_TOL_MASK               GENMASK(7, 4)
> > > @@ -31,11 +33,17 @@
> > >
> > >  #define PHY_PLL_DIV_REGS_NUM 6
> > >
> > > +#ifndef MHZ
> > > +#define MHZ  (1000UL * 1000UL)
> > > +#endif
> > > +
> > >  struct phy_config {
> > >       u32     pixclk;
> > >       u8      pll_div_regs[PHY_PLL_DIV_REGS_NUM];
> > >  };
> > >
> > > +static struct phy_config custom_phy_pll_cfg;
> > > +
> > >  static const struct phy_config phy_pll_cfg[] = {
> > >       {
> > >               .pixclk = 22250000,
> > > @@ -440,10 +448,83 @@ fsl_samsung_hdmi_phy_configure_pll_lock_det(struct fsl_samsung_hdmi_phy *phy,
> > >              phy->regs + PHY_REG(14));
> > >  }
> > >
> > > +static unsigned long fsl_samsung_hdmi_phy_find_pms(unsigned long fout, u8 *p, u16 *m, u8 *s)
> > > +{
> > > +     unsigned long best_freq = 0;
> > > +     u32 min_delta = 0xffffffff;
> >
> > > +     u8 _p, best_p;
> > > +     u16 _m, best_m;
> > > +     u8 _s, best_s;
> > > +
> > > +     for (_p = 1; _p <= 11; ++_p) {
> >
> > starts with 1 to 11.. why?
> 
> According to Rev 2 of the 8MP Reference Manual, the Previder range is
> between 1 and 11.

Would be better to document these assumptions, am sure if someone asks
you this next year, it would be hard to recall :-)

-- 
~Vinod

  reply	other threads:[~2024-08-30  7:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29  2:12 [RFC V2 1/2] phy: freescale: fsl-samsung-hdmi: Replace register defines with macro Adam Ford
2024-08-29  2:12 ` Adam Ford
2024-08-29  2:12 ` [RFC V2 2/2] phy: freescale: fsl-samsung-hdmi: Support dynamic integer divider Adam Ford
2024-08-29  2:12   ` Adam Ford
2024-08-29 17:55   ` Vinod Koul
2024-08-29 17:55     ` Vinod Koul
2024-08-29 18:30     ` Adam Ford
2024-08-29 18:30       ` Adam Ford
2024-08-30  7:55       ` Vinod Koul [this message]
2024-08-30  7:55         ` Vinod Koul
2024-08-30 13:05         ` Adam Ford
2024-08-30 13:05           ` Adam Ford

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=ZtF69NSHFtAwDupq@vaman \
    --to=vkoul@kernel.org \
    --cc=aford173@gmail.com \
    --cc=aford@beaconembedded.com \
    --cc=dominique.martinet@atmark-techno.com \
    --cc=festevam@gmail.com \
    --cc=frieder.schrempf@kontron.de \
    --cc=kishon@kernel.org \
    --cc=l.stach@pengutronix.de \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=m.felsch@pengutronix.de \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.