All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: archit@ti.com, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
Cc: rob@ti.com, Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH 07/12] OMAPDSS: add dss_calc_clock_rates() back
Date: Tue, 30 Oct 2012 16:10:04 +0000	[thread overview]
Message-ID: <1351613409-21186-8-git-send-email-tomi.valkeinen@ti.com> (raw)
In-Reply-To: <1351613409-21186-1-git-send-email-tomi.valkeinen@ti.com>

dss_calc_clock_rates() was removed earlier as it was not used, but it is
needed for DSI PLL calculations, so this patch adds it back.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/dss.c |   23 +++++++++++++++++++++++
 drivers/video/omap2/dss/dss.h |    1 +
 2 files changed, 24 insertions(+)

diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index a85bd05..5affa86 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -432,6 +432,29 @@ enum omap_dss_clk_source dss_get_lcd_clk_source(enum omap_channel channel)
 	}
 }
 
+/* calculate clock rates using dividers in cinfo */
+int dss_calc_clock_rates(struct dss_clock_info *cinfo)
+{
+	if (dss.dpll4_m4_ck) {
+		unsigned long prate;
+
+		if (cinfo->fck_div > dss.feat->fck_div_max ||
+				cinfo->fck_div = 0)
+			return -EINVAL;
+
+		prate = clk_get_rate(clk_get_parent(dss.dpll4_m4_ck));
+
+		cinfo->fck = prate / cinfo->fck_div *
+			dss.feat->dss_fck_multiplier;
+	} else {
+		if (cinfo->fck_div != 0)
+			return -EINVAL;
+		cinfo->fck = clk_get_rate(dss.dss_clk);
+	}
+
+	return 0;
+}
+
 int dss_set_clock_div(struct dss_clock_info *cinfo)
 {
 	if (dss.dpll4_m4_ck) {
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index fb89165..ae4e618 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -297,6 +297,7 @@ void dss_set_venc_output(enum omap_dss_venc_type type);
 void dss_set_dac_pwrdn_bgz(bool enable);
 
 unsigned long dss_get_dpll4_rate(void);
+int dss_calc_clock_rates(struct dss_clock_info *cinfo);
 int dss_set_clock_div(struct dss_clock_info *cinfo);
 int dss_calc_clock_div(unsigned long req_pck, struct dss_clock_info *dss_cinfo,
 		struct dispc_clock_info *dispc_cinfo);
-- 
1.7.10.4


WARNING: multiple messages have this Message-ID (diff)
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: archit@ti.com, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
Cc: rob@ti.com, Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH 07/12] OMAPDSS: add dss_calc_clock_rates() back
Date: Tue, 30 Oct 2012 18:10:04 +0200	[thread overview]
Message-ID: <1351613409-21186-8-git-send-email-tomi.valkeinen@ti.com> (raw)
In-Reply-To: <1351613409-21186-1-git-send-email-tomi.valkeinen@ti.com>

dss_calc_clock_rates() was removed earlier as it was not used, but it is
needed for DSI PLL calculations, so this patch adds it back.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/dss.c |   23 +++++++++++++++++++++++
 drivers/video/omap2/dss/dss.h |    1 +
 2 files changed, 24 insertions(+)

diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index a85bd05..5affa86 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -432,6 +432,29 @@ enum omap_dss_clk_source dss_get_lcd_clk_source(enum omap_channel channel)
 	}
 }
 
+/* calculate clock rates using dividers in cinfo */
+int dss_calc_clock_rates(struct dss_clock_info *cinfo)
+{
+	if (dss.dpll4_m4_ck) {
+		unsigned long prate;
+
+		if (cinfo->fck_div > dss.feat->fck_div_max ||
+				cinfo->fck_div == 0)
+			return -EINVAL;
+
+		prate = clk_get_rate(clk_get_parent(dss.dpll4_m4_ck));
+
+		cinfo->fck = prate / cinfo->fck_div *
+			dss.feat->dss_fck_multiplier;
+	} else {
+		if (cinfo->fck_div != 0)
+			return -EINVAL;
+		cinfo->fck = clk_get_rate(dss.dss_clk);
+	}
+
+	return 0;
+}
+
 int dss_set_clock_div(struct dss_clock_info *cinfo)
 {
 	if (dss.dpll4_m4_ck) {
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index fb89165..ae4e618 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -297,6 +297,7 @@ void dss_set_venc_output(enum omap_dss_venc_type type);
 void dss_set_dac_pwrdn_bgz(bool enable);
 
 unsigned long dss_get_dpll4_rate(void);
+int dss_calc_clock_rates(struct dss_clock_info *cinfo);
 int dss_set_clock_div(struct dss_clock_info *cinfo);
 int dss_calc_clock_div(unsigned long req_pck, struct dss_clock_info *dss_cinfo,
 		struct dispc_clock_info *dispc_cinfo);
-- 
1.7.10.4


  parent reply	other threads:[~2012-10-30 16:10 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-30 16:09 [PATCH 00/12] OMAPDSS: use DSI PLL clk for DPI Tomi Valkeinen
2012-10-30 16:09 ` Tomi Valkeinen
2012-10-30 16:09 ` [PATCH 01/12] OMAPFB: remove use of extended edid block Tomi Valkeinen
2012-10-30 16:09   ` Tomi Valkeinen
2012-10-31  6:10   ` Archit Taneja
2012-10-31  6:22     ` Archit Taneja
2012-10-31  6:23     ` Tomi Valkeinen
2012-10-31  6:23       ` Tomi Valkeinen
2012-10-30 16:09 ` [PATCH 02/12] OMAPFB: improve mode selection from EDID Tomi Valkeinen
2012-10-30 16:09   ` Tomi Valkeinen
2012-10-30 16:10 ` [PATCH 03/12] OMAPDSS: fix DPI & DSI init order Tomi Valkeinen
2012-10-30 16:10   ` Tomi Valkeinen
2012-10-30 16:10 ` [PATCH 04/12] OMAPDSS: fix DSI2 PLL clk names Tomi Valkeinen
2012-10-30 16:10   ` Tomi Valkeinen
2012-10-30 16:10 ` [PATCH 05/12] OMAPDSS: DSI: skip odd dividers when pck >= 100MHz Tomi Valkeinen
2012-10-30 16:10   ` Tomi Valkeinen
2012-10-31  6:45   ` Archit Taneja
2012-10-31  6:57     ` Archit Taneja
2012-10-31  7:26     ` Tomi Valkeinen
2012-10-31  7:26       ` Tomi Valkeinen
2012-10-31  7:32       ` Archit Taneja
2012-10-31  7:44         ` Archit Taneja
2012-10-30 16:10 ` [PATCH 06/12] OMAPDSS: DSI: workaround for HSDiv problem Tomi Valkeinen
2012-10-30 16:10   ` Tomi Valkeinen
2012-10-30 16:10 ` Tomi Valkeinen [this message]
2012-10-30 16:10   ` [PATCH 07/12] OMAPDSS: add dss_calc_clock_rates() back Tomi Valkeinen
2012-10-30 16:10 ` [PATCH 08/12] OMAPDSS: setup default dss fck Tomi Valkeinen
2012-10-30 16:10   ` Tomi Valkeinen
2012-10-31  6:31   ` Archit Taneja
2012-10-31  6:43     ` Archit Taneja
2012-10-31  7:32     ` Tomi Valkeinen
2012-10-31  7:32       ` Tomi Valkeinen
2012-10-30 16:10 ` [PATCH 09/12] OMAPDSS: hide dss_select_dispc_clk_source() Tomi Valkeinen
2012-10-30 16:10   ` Tomi Valkeinen
2012-10-31  6:54   ` Archit Taneja
2012-10-31  6:54     ` Archit Taneja
2012-10-31  7:17     ` Tomi Valkeinen
2012-10-31  7:17       ` Tomi Valkeinen
2012-10-30 16:10 ` [PATCH 10/12] OMAPDSS: DPI: use dpi.dsidev to see whether to use dsi pll Tomi Valkeinen
2012-10-30 16:10   ` Tomi Valkeinen
2012-10-30 16:10 ` [PATCH 11/12] OMAPDSS: DPI: verify if DSI PLL is operational Tomi Valkeinen
2012-10-30 16:10   ` Tomi Valkeinen
2012-10-30 16:10 ` [PATCH 12/12] OMAPDSS: DPI: always use DSI PLL if available Tomi Valkeinen
2012-10-30 16:10   ` Tomi Valkeinen
2012-10-31  7:26   ` Archit Taneja
2012-10-31  7:38     ` Archit Taneja
2012-11-02 10:08     ` Tomi Valkeinen
2012-11-02 10:08       ` Tomi Valkeinen
2012-11-02 10:44       ` Archit Taneja
2012-11-02 10:56         ` Archit Taneja
2012-11-02 10:49         ` Tomi Valkeinen
2012-11-02 10:49           ` Tomi Valkeinen
2012-11-02 11:09           ` Archit Taneja
2012-11-02 11:21             ` Archit Taneja
2012-11-02 11:28             ` Tomi Valkeinen
2012-11-02 11:28               ` Tomi Valkeinen
2012-11-02 11:56               ` Archit Taneja
2012-11-02 11:56                 ` Archit Taneja
2012-11-05  8:55                 ` Tomi Valkeinen
2012-11-05  8:55                   ` Tomi Valkeinen
2012-11-05 14:21                   ` Rob Clark
2012-11-05 14:21                     ` Rob Clark
2012-11-06 13:41                     ` Tomi Valkeinen
2012-11-06 13:41                       ` Tomi Valkeinen
2012-11-06 14:40                       ` Rob Clark
2012-11-06 14:40                         ` Rob Clark
2012-11-07 10:01                         ` Tomi Valkeinen
2012-11-07 10:01                           ` Tomi Valkeinen
2012-11-07 14:32                           ` Rob Clark
2012-11-07 14:32                             ` Rob Clark
2012-11-07 15:13                             ` Tomi Valkeinen
2012-11-07 15:13                               ` Tomi Valkeinen
2012-11-07 19:18                               ` Rob Clark
2012-11-07 19:18                                 ` Rob Clark
2012-11-08  7:39                                 ` Tomi Valkeinen
2012-11-08  7:39                                   ` Tomi Valkeinen

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=1351613409-21186-8-git-send-email-tomi.valkeinen@ti.com \
    --to=tomi.valkeinen@ti.com \
    --cc=archit@ti.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=rob@ti.com \
    /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.