All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH v2 16/28] drm: omapdrm: hdmi: Store PLL hardware data in HDMI transmitter drivers
Date: Mon,  8 May 2017 14:32:51 +0300	[thread overview]
Message-ID: <20170508113303.27521-17-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20170508113303.27521-1-laurent.pinchart@ideasonboard.com>

The HDMI PLL hardware data are dependent on the HDMI transmitter model.
The PLL driver contains hardware data for all supported transmitters,
and selects the appropriate hardware data based on the OMAP SoC version.

It makes more sense to store the PLL hardware data in the HDMI
transmitter drivers and pass them to the HDMI PLL initialization
function, as the HDMI transmitter drivers are transmitter-specific and
don't need to check the OMAP SoC version.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/dss/hdmi.h     |  2 +-
 drivers/gpu/drm/omapdrm/dss/hdmi4.c    | 27 +++++++++++-
 drivers/gpu/drm/omapdrm/dss/hdmi5.c    | 28 ++++++++++++-
 drivers/gpu/drm/omapdrm/dss/hdmi_pll.c | 77 +++-------------------------------
 4 files changed, 60 insertions(+), 74 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi.h b/drivers/gpu/drm/omapdrm/dss/hdmi.h
index 2b4312f8e97d..7ae26c7c5189 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi.h
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi.h
@@ -316,7 +316,7 @@ phys_addr_t hdmi_wp_get_audio_dma_addr(struct hdmi_wp_data *wp);
 /* HDMI PLL funcs */
 void hdmi_pll_dump(struct hdmi_pll_data *pll, struct seq_file *s);
 int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll,
-	struct hdmi_wp_data *wp);
+		  const struct dss_pll_hw *pll_hw, struct hdmi_wp_data *wp);
 void hdmi_pll_uninit(struct hdmi_pll_data *hpll);
 
 /* HDMI PHY funcs */
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index 1feb6deab108..b34f82bb61d5 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -689,6 +689,31 @@ static const struct hdmi_phy_features hdmi4_phy_feats = {
 	.max_phy	=	185675000,
 };
 
+static const struct dss_pll_hw hdmi4_pll_hw = {
+	.type = DSS_PLL_TYPE_B,
+
+	.n_max = 255,
+	.m_min = 20,
+	.m_max = 4095,
+	.mX_max = 127,
+	.fint_min = 500000,
+	.fint_max = 2500000,
+
+	.clkdco_min = 500000000,
+	.clkdco_low = 1000000000,
+	.clkdco_max = 2000000000,
+
+	.n_msb = 8,
+	.n_lsb = 1,
+	.m_msb = 20,
+	.m_lsb = 9,
+
+	.mX_msb[0] = 24,
+	.mX_lsb[0] = 18,
+
+	.has_selfreqdco = true,
+};
+
 static int hdmi4_bind(struct device *dev, struct device *master, void *data)
 {
 	struct platform_device *pdev = to_platform_device(dev);
@@ -709,7 +734,7 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)
 	if (r)
 		return r;
 
-	r = hdmi_pll_init(pdev, &hdmi.pll, &hdmi.wp);
+	r = hdmi_pll_init(pdev, &hdmi.pll, &hdmi4_pll_hw, &hdmi.wp);
 	if (r)
 		return r;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index 529653180bfc..54df41f24085 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -721,6 +721,32 @@ static const struct hdmi_phy_features hdmi5_phy_feats = {
 	.max_phy	=	186000000,
 };
 
+static const struct dss_pll_hw hdmi5_pll_hw = {
+	.type = DSS_PLL_TYPE_B,
+
+	.n_max = 255,
+	.m_min = 20,
+	.m_max = 2045,
+	.mX_max = 127,
+	.fint_min = 620000,
+	.fint_max = 2500000,
+
+	.clkdco_min = 750000000,
+	.clkdco_low = 1500000000,
+	.clkdco_max = 2500000000UL,
+
+	.n_msb = 8,
+	.n_lsb = 1,
+	.m_msb = 20,
+	.m_lsb = 9,
+
+	.mX_msb[0] = 24,
+	.mX_lsb[0] = 18,
+
+	.has_selfreqdco = true,
+	.has_refsel = true,
+};
+
 static int hdmi5_bind(struct device *dev, struct device *master, void *data)
 {
 	struct platform_device *pdev = to_platform_device(dev);
@@ -741,7 +767,7 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data)
 	if (r)
 		return r;
 
-	r = hdmi_pll_init(pdev, &hdmi.pll, &hdmi.wp);
+	r = hdmi_pll_init(pdev, &hdmi.pll, &hdmi5_pll_hw, &hdmi.wp);
 	if (r)
 		return r;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
index 46239358655a..870c5e633075 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
@@ -77,58 +77,9 @@ static const struct dss_pll_ops dsi_pll_ops = {
 	.set_config = dss_pll_write_config_type_b,
 };
 
-static const struct dss_pll_hw dss_omap4_hdmi_pll_hw = {
-	.type = DSS_PLL_TYPE_B,
-
-	.n_max = 255,
-	.m_min = 20,
-	.m_max = 4095,
-	.mX_max = 127,
-	.fint_min = 500000,
-	.fint_max = 2500000,
-
-	.clkdco_min = 500000000,
-	.clkdco_low = 1000000000,
-	.clkdco_max = 2000000000,
-
-	.n_msb = 8,
-	.n_lsb = 1,
-	.m_msb = 20,
-	.m_lsb = 9,
-
-	.mX_msb[0] = 24,
-	.mX_lsb[0] = 18,
-
-	.has_selfreqdco = true,
-};
-
-static const struct dss_pll_hw dss_omap5_hdmi_pll_hw = {
-	.type = DSS_PLL_TYPE_B,
-
-	.n_max = 255,
-	.m_min = 20,
-	.m_max = 2045,
-	.mX_max = 127,
-	.fint_min = 620000,
-	.fint_max = 2500000,
-
-	.clkdco_min = 750000000,
-	.clkdco_low = 1500000000,
-	.clkdco_max = 2500000000UL,
-
-	.n_msb = 8,
-	.n_lsb = 1,
-	.m_msb = 20,
-	.m_lsb = 9,
-
-	.mX_msb[0] = 24,
-	.mX_lsb[0] = 18,
-
-	.has_selfreqdco = true,
-	.has_refsel = true,
-};
-
-static int dsi_init_pll_data(struct platform_device *pdev, struct hdmi_pll_data *hpll)
+static int dsi_init_pll_data(struct platform_device *pdev,
+			     struct hdmi_pll_data *hpll,
+			     const struct dss_pll_hw *pll_hw)
 {
 	struct dss_pll *pll = &hpll->pll;
 	struct clk *clk;
@@ -144,23 +95,7 @@ static int dsi_init_pll_data(struct platform_device *pdev, struct hdmi_pll_data
 	pll->id = DSS_PLL_HDMI;
 	pll->base = hpll->base;
 	pll->clkin = clk;
-
-	switch (omapdss_get_version()) {
-	case OMAPDSS_VER_OMAP4430_ES1:
-	case OMAPDSS_VER_OMAP4430_ES2:
-	case OMAPDSS_VER_OMAP4:
-		pll->hw = &dss_omap4_hdmi_pll_hw;
-		break;
-
-	case OMAPDSS_VER_OMAP5:
-	case OMAPDSS_VER_DRA7xx:
-		pll->hw = &dss_omap5_hdmi_pll_hw;
-		break;
-
-	default:
-		return -ENODEV;
-	}
-
+	pll->hw = pll_hw;
 	pll->ops = &dsi_pll_ops;
 
 	r = dss_pll_register(pll);
@@ -171,7 +106,7 @@ static int dsi_init_pll_data(struct platform_device *pdev, struct hdmi_pll_data
 }
 
 int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll,
-	struct hdmi_wp_data *wp)
+		  const struct dss_pll_hw *pll_hw, struct hdmi_wp_data *wp)
 {
 	int r;
 	struct resource *res;
@@ -184,7 +119,7 @@ int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll,
 	if (IS_ERR(pll->base))
 		return PTR_ERR(pll->base);
 
-	r = dsi_init_pll_data(pdev, pll);
+	r = dsi_init_pll_data(pdev, pll, pll_hw);
 	if (r) {
 		DSSERR("failed to init HDMI PLL\n");
 		return r;
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-05-08 11:33 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-08 11:32 [PATCH v2 00/29] Remove the omapdrm and omapdss devices from platform code Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 01/28] drm: omapdrm: Remove duplicate error messages when mapping memory Laurent Pinchart
2017-05-08 12:52   ` Tomi Valkeinen
2017-05-08 13:55     ` Laurent Pinchart
2017-05-09  8:37       ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 02/28] drm: omapdrm: Drop support for non-DT devices Laurent Pinchart
2017-05-09  8:40   ` Tomi Valkeinen
2017-05-09  8:46     ` Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 03/28] drm: omapdrm: Remove unused dss_get_core_pdev() function Laurent Pinchart
2017-05-09  8:57   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 04/28] drm: omapdrm: Remove unused default display name support Laurent Pinchart
2017-05-08 12:30   ` Bartlomiej Zolnierkiewicz
2017-05-09  8:58   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 05/28] drm: omapdrm: Infer the OMAP version from the SoC family Laurent Pinchart
2017-05-09  9:02   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 06/28] drm: omapdrm: dispc: Select features based on compatible string Laurent Pinchart
2017-05-09  9:04   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 07/28] drm: omapdrm: dpi: Remove platform driver Laurent Pinchart
2017-05-09  9:06   ` Tomi Valkeinen
2017-05-09 21:38     ` Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 08/28] drm: omapdrm: dpi: Replace OMAP SoC model checks with DSS device type Laurent Pinchart
2017-05-09  9:23   ` Tomi Valkeinen
2017-05-09 22:24     ` Laurent Pinchart
2017-05-09 22:26       ` Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 09/28] drm: omapdrm: dsi: Store DSI type and PLL hardware data in OF data Laurent Pinchart
2017-05-09  9:31   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 10/28] drm: omapdrm: dsi: Handle pin muxing internally Laurent Pinchart
2017-05-09  9:37   ` Tomi Valkeinen
2017-05-09 21:45     ` Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 11/28] drm: omapdrm: dss: Select features based on compatible string Laurent Pinchart
2017-05-09  9:41   ` Tomi Valkeinen
2017-05-09 21:47     ` Laurent Pinchart
2017-05-10  6:52       ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 12/28] drm: omapdrm: dss: Split operations out of dss_features structure Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 13/28] drm: omapdrm: dss: Initialize DSS internal features at probe time Laurent Pinchart
2017-05-09  9:48   ` Tomi Valkeinen
2017-05-09 21:49     ` Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 14/28] drm: omapdrm: hdmi: Store PHY features in PHY data structure Laurent Pinchart
2017-05-09 11:14   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 15/28] drm: omapdrm: hdmi: Store PHY features in HDMI transmitter drivers Laurent Pinchart
2017-05-09 11:27   ` Tomi Valkeinen
2017-05-08 11:32 ` Laurent Pinchart [this message]
2017-05-08 11:32 ` [PATCH v2 17/28] drm: omapdrm: hdmi: Replace OMAP SoC model check with HDMI xmit version Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 18/28] drm: omapdrm: hdmi: Pass HDMI core version as integer to HDMI audio Laurent Pinchart
2017-05-14  9:28   ` Mark Brown
2017-05-08 11:32 ` [PATCH v2 19/28] drm: omapdrm: sdi: Remove platform driver Laurent Pinchart
2017-05-09 11:29   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 20/28] drm: omapdrm: Don't forward set_min_bus_tput() to no-op platform code Laurent Pinchart
2017-05-09 11:30   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 21/28] drm: omapdrm: Move all debugfs code from core to dss Laurent Pinchart
2017-05-09 11:35   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 22/28] drm: omapdrm: Move shutdown() handler " Laurent Pinchart
2017-05-09 11:38   ` Tomi Valkeinen
2017-05-09 21:42     ` Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 23/28] drm: omapdrm: Merge the dss_features and omap_dss_features structures Laurent Pinchart
2017-05-09 12:02   ` Tomi Valkeinen
2017-05-09 22:09     ` Laurent Pinchart
2017-05-10  7:43       ` Tomi Valkeinen
2017-05-13 11:12         ` Laurent Pinchart
2017-05-15  6:32           ` Tomi Valkeinen
2017-08-04 14:03             ` Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 24/28] drm: omapdrm: Register omapdrm platform device in omapdss driver Laurent Pinchart
2017-05-09 11:48   ` Tomi Valkeinen
2017-05-08 11:33 ` [PATCH v2 25/28] drm: omapdrm: Remove the " Laurent Pinchart
2017-05-09 11:49   ` Tomi Valkeinen
2017-05-08 11:33 ` [PATCH v2 26/28] ARM: OMAP2+: Remove unused omapdrm platform device Laurent Pinchart
2017-05-08 17:09   ` Tony Lindgren
2017-05-09  8:49     ` Laurent Pinchart
2017-05-09 11:49   ` Tomi Valkeinen
2017-05-08 11:33 ` [PATCH v2 27/28] ARM: OMAP2+: Don't register omapdss device for omapdrm Laurent Pinchart
2017-05-08 17:09   ` Tony Lindgren
2017-05-09 11:51   ` Tomi Valkeinen
2017-05-08 11:33 ` [PATCH v2 28/28] drm: omapdrm: Remove omapdrm platform data Laurent Pinchart
2017-05-09 11:51   ` Tomi Valkeinen
2017-05-08 17:07 ` [PATCH v2 00/29] Remove the omapdrm and omapdss devices from platform code Tony Lindgren
2017-05-09 11:53   ` Tomi Valkeinen
2017-05-09 13:54     ` Tony Lindgren
2017-05-09 12:10 ` Tomi Valkeinen
2017-05-09 15:05   ` Sebastian Reichel
2017-05-10  7:23     ` Tomi Valkeinen
2017-05-10 16:46       ` Tony Lindgren
2017-05-10 17:40         ` Tomi Valkeinen
2017-05-10 18:29           ` Tony Lindgren
2017-05-11  8:34             ` Tomi Valkeinen
2017-05-11 14:16               ` Tony Lindgren
2017-05-12  7:29                 ` Tomi Valkeinen
2017-05-12 15:03                   ` Tony Lindgren
2017-05-09 22:18   ` Laurent Pinchart
2017-05-10  6:48     ` 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=20170508113303.27521-17-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=tomi.valkeinen@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.