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>
This commit is contained in:
Abhinav Kumar 2017-04-27 21:05:08 -07:00
parent 6c90c8860c
commit e998aabf44
5 changed files with 68 additions and 5 deletions

View file

@ -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;

View file

@ -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;
};

View file

@ -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");

View file

@ -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;

View file

@ -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