linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: lee.jones@linaro.org, linux-kernel@vger.kernel.org
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Stephan Gerhold <stephan@gerhold.net>
Subject: [PATCH] mfd: db8500-prcmu: Fix DSI LP clock
Date: Sun, 22 Dec 2019 21:27:35 +0100	[thread overview]
Message-ID: <20191222202735.13910-1-linus.walleij@linaro.org> (raw)

The DB8420 sysclk firmware is missing the ULPPLL
(ultra-low power phase locked loop) which has repercussions
on how the DSI LP clock is handled in the PRCMU driver.
This was missed in the patch adding support for the U8420
sysclk firmware variant.

Move the functions around a bit to avoid forward declarations.

This fix is not a regression as no systems in the kernel are
currently using it.

Cc: Stephan Gerhold <stephan@gerhold.net>
Fixes: 22fb3ad0cc5f ("mfd: db8500-prcmu: Support U8420-sysclk firmware")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mfd/db8500-prcmu.c | 34 +++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index 26d967a1a046..8aa701f81a08 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -561,7 +561,8 @@ static struct dsiescclk dsiescclk[3] = {
 /* DPI 50000000 Hz */
 #define PRCMU_DPI_CLOCK_SETTING		((1 << PRCMU_CLK_PLL_SW_SHIFT) | \
 					  (16 << PRCMU_CLK_PLL_DIV_SHIFT))
-#define PRCMU_DSI_LP_CLOCK_SETTING	0x00000E00
+#define PRCMU_DSI_LP_CLOCK_SETTING_ULPPLL_ON	0x00000E00
+#define PRCMU_DSI_LP_CLOCK_SETTING_ULPPLL_OFF	0x00000A00
 
 /* D=101, N=1, R=4, SELDIV2=0 */
 #define PRCMU_PLLDSI_FREQ_SETTING	0x00040165
@@ -577,6 +578,19 @@ static struct dsiescclk dsiescclk[3] = {
 
 #define PRCMU_PLLDSI_LOCKP_LOCKED	0x3
 
+struct prcmu_fw_version *prcmu_get_fw_version(void)
+{
+	return fw_info.valid ? &fw_info.version : NULL;
+}
+
+static bool prcmu_is_ulppll_disabled(void)
+{
+	struct prcmu_fw_version *ver;
+
+	ver = prcmu_get_fw_version();
+	return ver && ver->project == PRCMU_FW_PROJECT_U8420_SYSCLK;
+}
+
 int db8500_prcmu_enable_dsipll(void)
 {
 	int i;
@@ -627,7 +641,10 @@ int db8500_prcmu_set_display_clocks(void)
 		cpu_relax();
 
 	writel(PRCMU_DSI_CLOCK_SETTING, prcmu_base + PRCM_HDMICLK_MGT);
-	writel(PRCMU_DSI_LP_CLOCK_SETTING, prcmu_base + PRCM_TVCLK_MGT);
+	if (prcmu_is_ulppll_disabled())
+		writel(PRCMU_DSI_LP_CLOCK_SETTING_ULPPLL_OFF, prcmu_base + PRCM_TVCLK_MGT);
+	else
+		writel(PRCMU_DSI_LP_CLOCK_SETTING_ULPPLL_ON, prcmu_base + PRCM_TVCLK_MGT);
 	writel(PRCMU_DPI_CLOCK_SETTING, prcmu_base + PRCM_LCDCLK_MGT);
 
 	/* Release the HW semaphore. */
@@ -664,19 +681,6 @@ void db8500_prcmu_write_masked(unsigned int reg, u32 mask, u32 value)
 	spin_unlock_irqrestore(&prcmu_lock, flags);
 }
 
-struct prcmu_fw_version *prcmu_get_fw_version(void)
-{
-	return fw_info.valid ? &fw_info.version : NULL;
-}
-
-static bool prcmu_is_ulppll_disabled(void)
-{
-	struct prcmu_fw_version *ver;
-
-	ver = prcmu_get_fw_version();
-	return ver && ver->project == PRCMU_FW_PROJECT_U8420_SYSCLK;
-}
-
 bool prcmu_has_arm_maxopp(void)
 {
 	return (readb(tcdm_base + PRCM_AVS_VARM_MAX_OPP) &
-- 
2.21.0


             reply	other threads:[~2019-12-22 20:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-22 20:27 Linus Walleij [this message]
2019-12-22 21:44 ` [PATCH] mfd: db8500-prcmu: Fix DSI LP clock Linus Walleij

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=20191222202735.13910-1-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stephan@gerhold.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).