misc: tegra-cec: enable DISA temporarily in init

Unpowergate DISA power domain if it is powergated during CEC driver initialization.

Bug 200175747

Change-Id: I8b3d879fe0c33eaef74c1b4d3b549559c4977e4d
Signed-off-by: Chun XU <chunx@nvidia.com>
Reviewed-on: http://git-master/r/1142593
Reviewed-on: http://git-master/r/1164149
(cherry picked from commit c341176715597fe8268b20b291bcef07bb429500)
This commit is contained in:
Chun XU
2016-05-06 15:34:37 +08:00
committed by Jon Hunter
parent d29a9f4d3c
commit aae6e6e3d3

View File

@@ -39,6 +39,8 @@
#include "tegra_cec.h" #include "tegra_cec.h"
#include <linux/tegra-powergate.h>
static ssize_t cec_logical_addr_store(struct device *dev, static ssize_t cec_logical_addr_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count); struct device_attribute *attr, const char *buf, size_t count);
@@ -287,6 +289,8 @@ static const struct file_operations tegra_cec_fops = {
static void tegra_cec_init(struct tegra_cec *cec) static void tegra_cec_init(struct tegra_cec *cec)
{ {
int power_tmp = 0, is_tegra186 = 0, ret;
cec->rx_wake = 0; cec->rx_wake = 0;
cec->tx_wake = 1; cec->tx_wake = 1;
cec->tx_buf_cnt = 0; cec->tx_buf_cnt = 0;
@@ -295,6 +299,17 @@ static void tegra_cec_init(struct tegra_cec *cec)
dev_notice(cec->dev, "%s started\n", __func__); dev_notice(cec->dev, "%s started\n", __func__);
is_tegra186 = of_device_is_compatible(cec->dev->of_node, "nvidia,tegra186-cec");
if (is_tegra186 && !tegra_powergate_is_powered(TEGRA_POWERGATE_DISA)) {
ret = tegra_unpowergate_partition_with_clk_on(TEGRA_POWERGATE_DISA);
if (ret) {
dev_err(cec->dev, "Fail to unpowergate DISP.\n");
return;
}
power_tmp = 1;
dev_warn(cec->dev, "Unpowergate DISP temporarily.\n");
}
writel(0x00, cec->cec_base + TEGRA_CEC_HW_CONTROL); writel(0x00, cec->cec_base + TEGRA_CEC_HW_CONTROL);
writel(0x00, cec->cec_base + TEGRA_CEC_INT_MASK); writel(0x00, cec->cec_base + TEGRA_CEC_INT_MASK);
writel(0xffffffff, cec->cec_base + TEGRA_CEC_INT_STAT); writel(0xffffffff, cec->cec_base + TEGRA_CEC_INT_STAT);
@@ -362,6 +377,16 @@ static void tegra_cec_init(struct tegra_cec *cec)
atomic_set(&cec->init_done, 1); atomic_set(&cec->init_done, 1);
wake_up_interruptible(&cec->init_waitq); wake_up_interruptible(&cec->init_waitq);
if (is_tegra186 && power_tmp == 1) {
ret = tegra_powergate_partition_with_clk_off(TEGRA_POWERGATE_DISA);
if (ret) {
dev_err(cec->dev, "Fail to powergate DISP.\n");
return;
}
power_tmp = 0;
dev_warn(cec->dev, "Powergate DISP.\n");
}
dev_notice(cec->dev, "%s Done.\n", __func__); dev_notice(cec->dev, "%s Done.\n", __func__);
} }
@@ -483,7 +508,8 @@ static int tegra_cec_probe(struct platform_device *pdev)
goto clk_error; goto clk_error;
} }
clk_prepare_enable(cec->clk); ret = clk_prepare_enable(cec->clk);
dev_info(&pdev->dev, "Enable clock result: %d.\n", ret);
/* set context info. */ /* set context info. */
cec->dev = &pdev->dev; cec->dev = &pdev->dev;