All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tretter <m.tretter@pengutronix.de>
To: Adam Ford <aford173@gmail.com>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Robert Foss <rfoss@kernel.org>,
	kernel@pengutronix.de, Jonas Karlman <jonas@kwiboo.se>,
	Marco Felsch <m.felsch@pengutronix.de>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Jagan Teki <jagan@amarulasolutions.com>
Subject: Re: [PATCH 3/5] drm/bridge: samsung-dsim: update PLL reference clock
Date: Tue, 29 Aug 2023 09:49:52 +0200	[thread overview]
Message-ID: <20230829074952.GF17387@pengutronix.de> (raw)
In-Reply-To: <CAHCN7xL8nMs3w82EWtxr1DGncejZtwDgVfR6KBxmkJdD7xAYQg@mail.gmail.com>

On Mon, 28 Aug 2023 13:17:44 -0500, Adam Ford wrote:
> On Mon, Aug 28, 2023 at 11:42 AM Marco Felsch <m.felsch@pengutronix.de> wrote:
> >
> > On 23-08-28, Michael Tretter wrote:
> > > The PLL requires a clock between 2 MHz and 30 MHz after the pre-divider.
> > > The reference clock for the PLL may change due to changes to it's parent
> > > clock. Thus, the frequency may be out of range or unsuited for
> > > generating the high speed clock for MIPI DSI.
> > >
> > > Try to keep the pre-devider small, and set the reference clock close to
> > > 30 MHz before recalculating the PLL configuration. Use a divider with a
> > > power of two for the reference clock as this seems to work best in
> > > my tests.
> > >
> > > Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> > > ---
> > >  drivers/gpu/drm/bridge/samsung-dsim.c | 15 +++++++++++++--
> > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
> > > index da90c2038042..4de6e4f116db 100644
> > > --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> > > +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> > > @@ -611,10 +611,21 @@ static unsigned long samsung_dsim_set_pll(struct samsung_dsim *dsi,
> > >       u16 m;
> > >       u32 reg;
> > >
> > > -     if (dsi->pll_clk)
> > > +     if (dsi->pll_clk) {
> > > +             /*
> > > +              * Ensure that the reference clock is generated with a power of
> > > +              * two divider from its parent, but close to the PLLs upper
> > > +              * limit of the valid range of 2 MHz to 30 MHz.
> > > +              */
> > > +             fin = clk_get_rate(clk_get_parent(dsi->pll_clk));
> > > +             while (fin > 30 * MHZ)
> > > +                     fin = fin / 2;
> >
> > Really just a cosmetic nit: fin /= 2;
> >
> > Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
> >
> > > +             clk_set_rate(dsi->pll_clk, fin);
> > > +
> > >               fin = clk_get_rate(dsi->pll_clk);
> > > -     else
> > > +     } else {
> > >               fin = dsi->pll_clk_rate;
> > > +     }
> 
> I don't have all the code style rules memorized.  Did you run it
> through checkpatch?  I wonder if the braces here are appropriate for a
> 1-line after the else.  If checkpatch is happy, I am fine with it.

checkpatch is happy: The coding style states that if one of the branches needs
braces because it has multiple statements, all branches should have braces.

Michael

> 
> adam
> > >       dev_dbg(dsi->dev, "PLL ref clock freq %lu\n", fin);
> > >
> > >       fout = samsung_dsim_pll_find_pms(dsi, fin, freq, &p, &m, &s);
> > >
> > > --
> > > 2.39.2
> > >
> > >
> > >
> 

  reply	other threads:[~2023-08-29  7:50 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28 15:59 [PATCH 0/5] drm/bridge: samsung-dsim: fix various modes with ADV7535 bridge Michael Tretter
2023-08-28 15:59 ` [PATCH 1/5] drm/bridge: samsung-dsim: add more mipi-dsi device debug information Michael Tretter
2023-08-28 22:37   ` Adam Ford
2023-09-04  1:04     ` Inki Dae
2023-09-27 12:47       ` Adam Ford
2023-10-04 15:22         ` Michael Tretter
2023-08-28 15:59 ` [PATCH 2/5] drm/bridge: samsung-dsim: reread ref clock before configuring PLL Michael Tretter
2023-09-04  4:38   ` Inki Dae
2023-09-04 11:04     ` Michael Tretter
2023-09-05  9:18       ` Inki Dae
2023-09-05  9:25   ` Inki Dae
2023-08-28 15:59 ` [PATCH 3/5] drm/bridge: samsung-dsim: update PLL reference clock Michael Tretter
2023-08-28 16:41   ` Marco Felsch
2023-08-28 18:17     ` Adam Ford
2023-08-29  7:49       ` Michael Tretter [this message]
2023-09-04  5:44   ` Inki Dae
2023-09-04 11:15     ` Michael Tretter
2023-09-05  9:06       ` 대인기/Tizen Platform Lab(SR)/삼성전자
2023-09-08  9:47         ` Michael Tretter
2023-09-18  8:42           ` 대인기/Tizen Platform Lab(SR)/삼성전자
2023-08-28 15:59 ` [PATCH 4/5] drm/bridge: samsung-dsim: adjust porches by rounding up Michael Tretter
2023-08-28 18:26   ` Fabio Estevam
2023-08-28 22:39     ` Adam Ford
2023-08-29  7:51       ` Michael Tretter
2023-08-28 15:59 ` [PATCH 5/5] drm/bridge: samsung-dsim: calculate porches in Hz Michael Tretter
2023-08-28 22:41   ` Adam Ford
2023-09-04 14:28   ` Maxim Schwalm
2023-09-08  8:20     ` Michael Tretter
2023-08-28 16:13 ` [PATCH 0/5] drm/bridge: samsung-dsim: fix various modes with ADV7535 bridge Adam Ford
2023-08-28 23:07   ` Adam Ford
2023-08-29  8:03     ` Michael Tretter
2023-08-28 16:42 ` Marco Felsch
2023-09-04 14:02 ` Frieder Schrempf
2023-09-06  9:31   ` Frieder Schrempf
2023-09-06  9:56     ` Michael Tretter
2023-09-07  8:20       ` Frieder Schrempf

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=20230829074952.GF17387@pengutronix.de \
    --to=m.tretter@pengutronix.de \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=aford173@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jagan@amarulasolutions.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.felsch@pengutronix.de \
    --cc=m.szyprowski@samsung.com \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    /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.