summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhinav Kumar <abhinavk@codeaurora.org>2017-04-27 21:05:08 -0700
committerAbhinav Kumar <abhinavk@codeaurora.org>2017-06-08 11:40:49 -0700
commite998aabf44a7c843362c68db282e6739568ca79d (patch)
tree4d67256e8a6f2e98ec298d5d47c13123bd2783c7
parent6c90c8860c5863fda38b2d2f3145c1d9b940d883 (diff)
drm/msm: align HDMI register address space mapping with SDE
HDMI driver currently maps register addresses using ioremap() but doesn't use the SDE driver utilities for register read/write. Copy the mapped register spaces to SDE utility headers so that other SDE APIs can be used seamlessly for HDMI. Change-Id: I3cbe57778ff3a63ffd9176f1a2c60778238e3fe2 Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
-rw-r--r--drivers/gpu/drm/msm/hdmi-staging/sde_hdmi.c12
-rw-r--r--drivers/gpu/drm/msm/hdmi-staging/sde_hdmi.h12
-rw-r--r--drivers/gpu/drm/msm/hdmi/hdmi.c41
-rw-r--r--drivers/gpu/drm/msm/hdmi/hdmi.h6
-rw-r--r--drivers/gpu/drm/msm/hdmi/hdmi_hdcp.c2
5 files changed, 68 insertions, 5 deletions
diff --git a/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi.c b/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi.c
index acc417737558..2e0665274199 100644
--- a/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi.c
@@ -918,6 +918,16 @@ static void _sde_hdmi_cec_update_phys_addr(struct sde_hdmi *display)
CEC_PHYS_ADDR_INVALID);
}
+static void _sde_hdmi_map_regs(struct sde_hdmi *display, struct hdmi *hdmi)
+{
+ display->io[HDMI_TX_CORE_IO].base = hdmi->mmio;
+ display->io[HDMI_TX_CORE_IO].len = hdmi->mmio_len;
+ display->io[HDMI_TX_QFPROM_IO].base = hdmi->qfprom_mmio;
+ display->io[HDMI_TX_QFPROM_IO].len = hdmi->qfprom_mmio_len;
+ display->io[HDMI_TX_HDCP_IO].base = hdmi->hdcp_mmio;
+ display->io[HDMI_TX_HDCP_IO].len = hdmi->hdcp_mmio_len;
+}
+
static void _sde_hdmi_hotplug_work(struct work_struct *work)
{
struct sde_hdmi *sde_hdmi =
@@ -1767,6 +1777,8 @@ static int sde_hdmi_bind(struct device *dev, struct device *master, void *data)
display_ctrl->ctrl = priv->hdmi;
display->drm_dev = drm;
+ _sde_hdmi_map_regs(display, priv->hdmi);
+
mutex_unlock(&display->display_lock);
return rc;
diff --git a/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi.h b/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi.h
index dff245dec764..a50f9533bd62 100644
--- a/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi.h
+++ b/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi.h
@@ -25,7 +25,9 @@
#include <drm/drm_crtc.h>
#include <media/cec-notifier.h>
#include "hdmi.h"
-
+#include "sde_kms.h"
+#include "sde_connector.h"
+#include "msm_drv.h"
#include "sde_edid_parser.h"
#ifdef HDMI_DEBUG_ENABLE
@@ -69,6 +71,13 @@ struct sde_hdmi_ctrl {
u32 hdmi_ctrl_idx;
};
+enum hdmi_tx_io_type {
+ HDMI_TX_CORE_IO,
+ HDMI_TX_QFPROM_IO,
+ HDMI_TX_HDCP_IO,
+ HDMI_TX_MAX_IO
+};
+
/**
* struct sde_hdmi - hdmi display information
* @pdev: Pointer to platform device.
@@ -120,6 +129,7 @@ struct sde_hdmi {
struct irq_domain *irq_domain;
struct cec_notifier *notifier;
+ struct dss_io_data io[HDMI_TX_MAX_IO];
/* DEBUG FS */
struct dentry *root;
};
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index 7915562057d6..7d660ba56594 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -95,7 +95,7 @@ static struct hdmi *hdmi_init(struct platform_device *pdev)
struct hdmi_platform_config *config = pdev->dev.platform_data;
struct hdmi *hdmi = NULL;
struct resource *res;
- int i, ret;
+ int i, ret = 0;
hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
if (!hdmi) {
@@ -119,9 +119,19 @@ static struct hdmi *hdmi_init(struct platform_device *pdev)
}
}
+ res = platform_get_resource_byname(pdev,
+ IORESOURCE_MEM, config->mmio_name);
+ if (!res) {
+ dev_err(&pdev->dev, "failed to find ctrl resource\n");
+ ret = -ENOMEM;
+ goto fail;
+ }
+ hdmi->mmio_len = (u32)resource_size(res);
hdmi->mmio = msm_ioremap(pdev, config->mmio_name, "HDMI");
if (IS_ERR(hdmi->mmio)) {
ret = PTR_ERR(hdmi->mmio);
+ dev_info(&pdev->dev, "can't map hdmi resource\n");
+ hdmi->mmio = NULL;
goto fail;
}
@@ -130,13 +140,39 @@ static struct hdmi *hdmi_init(struct platform_device *pdev)
config->mmio_name);
hdmi->mmio_phy_addr = res->start;
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+ config->qfprom_mmio_name);
+
+ if (!res) {
+ dev_err(&pdev->dev, "failed to find qfprom resource\n");
+ ret = -ENOMEM;
+ goto fail;
+ }
+ hdmi->qfprom_mmio_len = (u32)resource_size(res);
+
hdmi->qfprom_mmio = msm_ioremap(pdev,
config->qfprom_mmio_name, "HDMI_QFPROM");
+
if (IS_ERR(hdmi->qfprom_mmio)) {
- dev_info(&pdev->dev, "can't find qfprom resource\n");
+ dev_info(&pdev->dev, "can't map qfprom resource\n");
hdmi->qfprom_mmio = NULL;
}
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+ config->hdcp_mmio_name);
+ if (!res) {
+ dev_err(&pdev->dev, "failed to find hdcp resource: %d\n", ret);
+ ret = -ENOMEM;
+ goto fail;
+ }
+ hdmi->hdcp_mmio_len = (u32)resource_size(res);
+ hdmi->hdcp_mmio = msm_ioremap(pdev,
+ config->hdcp_mmio_name, "HDMI_HDCP");
+ if (IS_ERR(hdmi->hdcp_mmio)) {
+ dev_info(&pdev->dev, "can't map hdcp resource\n");
+ hdmi->hdcp_mmio = NULL;
+ }
+
hdmi->hpd_regs = devm_kzalloc(&pdev->dev, sizeof(hdmi->hpd_regs[0]) *
config->hpd_reg_cnt, GFP_KERNEL);
if (!hdmi->hpd_regs) {
@@ -468,6 +504,7 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data)
hdmi_cfg->mmio_name = "core_physical";
hdmi_cfg->qfprom_mmio_name = "qfprom_physical";
+ hdmi_cfg->hdcp_mmio_name = "hdcp_physical";
hdmi_cfg->ddc_clk_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-clk");
hdmi_cfg->ddc_data_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-data");
hdmi_cfg->hpd_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-hpd");
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h
index 9ce8ff513210..5bf87ae20255 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.h
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.h
@@ -54,6 +54,10 @@ struct hdmi {
void __iomem *mmio;
void __iomem *qfprom_mmio;
+ void __iomem *hdcp_mmio;
+ u32 mmio_len;
+ u32 qfprom_mmio_len;
+ u32 hdcp_mmio_len;
phys_addr_t mmio_phy_addr;
struct regulator **hpd_regs;
@@ -91,7 +95,7 @@ struct hdmi_platform_config {
struct hdmi_phy *(*phy_init)(struct hdmi *hdmi);
const char *mmio_name;
const char *qfprom_mmio_name;
-
+ const char *hdcp_mmio_name;
/* regulators that need to be on for hpd: */
const char **hpd_reg_names;
int hpd_reg_cnt;
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_hdcp.c b/drivers/gpu/drm/msm/hdmi/hdmi_hdcp.c
index e56a8675c0a4..cdd89f892df6 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi_hdcp.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi_hdcp.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and