]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/blobdiff - drivers/video/tegra/dc/sor.c
Revert "video: tegra: dc: make SOR instance configurable"
[sojka/nv-tegra/linux-3.10.git] / drivers / video / tegra / dc / sor.c
index c93123b939c1080877b437adefecaffcb91f01af..c4aed990555f03ac5aac8dbd7929a374066636e5 100644 (file)
@@ -216,7 +216,7 @@ static int dbg_sor_show(struct seq_file *s, void *unused)
        DUMP_REG(NV_SOR_DP_SPARE(1));
        DUMP_REG(NV_SOR_DP_TPG);
        DUMP_REG(NV_SOR_HDMI2_CTRL);
-       if (sor->instance) { /* sor1 */
+       if (sor->dc->ndev->id == 1) { /* sor1 */
                DUMP_REG(NV_SOR_DP_AUDIO_CTRL);
 
                DUMP_REG(NV_SOR_DP_GENERIC_INFOFRAME_HEADER);
@@ -445,18 +445,22 @@ struct tegra_dc_sor_data *tegra_dc_sor_init(struct tegra_dc *dc,
        struct clk *brick_clk = NULL;
        struct clk *src_clk = NULL;
        struct device_node *np = dc->ndev->dev.of_node;
-       int sor_num = tegra_dc_which_sor(dc);
        struct device_node *np_sor =
-               sor_num ? of_find_node_by_path(SOR1_NODE) :
+               dc->ndev->id ? of_find_node_by_path(SOR1_NODE) :
                of_find_node_by_path(SOR_NODE);
-       const char *res_name = sor_num ? "sor1" : "sor0";
+       const char *res_name = dc->ndev->id ? "sor1" : "sor0";
+
+       if (dc->out->type == TEGRA_DC_OUT_HDMI) {
+               of_node_put(np_sor);
+               np_sor = of_find_node_by_path(SOR1_NODE);
+               res_name = "sor1";
+       }
 
        sor = devm_kzalloc(&dc->ndev->dev, sizeof(*sor), GFP_KERNEL);
        if (!sor) {
                err = -ENOMEM;
                goto err_allocate;
        }
-       sor->instance = sor_num;
 
        if (np) {
                if (np_sor && (of_device_is_available(np_sor) ||
@@ -602,10 +606,15 @@ int tegra_dc_sor_set_power_state(struct tegra_dc_sor_data *sor, int pu_pd)
 
 void tegra_dc_sor_destroy(struct tegra_dc_sor_data *sor)
 {
-       struct device_node *np_sor = sor->instance ?
+       struct device_node *np_sor = (sor->dc->ndev->id) ?
                of_find_node_by_path(SOR1_NODE) :
                of_find_node_by_path(SOR_NODE);
 
+       if (sor->dc->out->type == TEGRA_DC_OUT_HDMI) {
+               of_node_put(np_sor);
+               np_sor = of_find_node_by_path(SOR1_NODE);
+       }
+
        clk_put(sor->sor_clk);
        if (sor->safe_clk)
                clk_put(sor->safe_clk);
@@ -1381,16 +1390,15 @@ void tegra_dc_sor_enable_dp(struct tegra_dc_sor_data *sor)
 static void tegra_dc_sor_enable_sor(struct tegra_dc_sor_data *sor, bool enable)
 {
        struct tegra_dc *dc = sor->dc;
-       int sor_num = sor->instance;
        u32 reg_val = tegra_dc_readl(sor->dc, DC_DISP_DISP_WIN_OPTIONS);
-       u32 enb = sor_num ? SOR1_ENABLE : SOR_ENABLE;
+       u32 enb = dc->ndev->id ? SOR1_ENABLE : SOR_ENABLE;
 
        /* Do not disable SOR during seamless boot */
        if (sor->dc->initialized && !enable)
                return;
 
        if (sor->dc->out->type == TEGRA_DC_OUT_HDMI)
-               enb = sor_num ? SOR1_ENABLE : SOR_ENABLE;
+               enb = SOR1_ENABLE;
 
        if (dc->out->type == TEGRA_DC_OUT_HDMI)
                enb |= SOR1_TIMING_CYA;