]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: adf: Remove DC_EXTENSIONS dependency
authorXia Yang <xiay@nvidia.com>
Tue, 24 Jun 2014 21:07:00 +0000 (14:07 -0700)
committerJon Mayo <jmayo@nvidia.com>
Tue, 11 Nov 2014 23:38:39 +0000 (15:38 -0800)
Disable CONFIG_TEGRA_DC_EXTENSIONS when ADF is enabled.  Add
appropriate ifdefs code so DC_EXTENSIONS ciode won't build as part of
an ADF-enabled driver.

ADF has two seperate interface for hotplug connect and disconnect,
and ADF_EVENT_HOTPLUG must have connect state as payload.  Thus
event simulation in debugfs was modified us following:

ADF:
0x0 - ADF_EVENT_HOTPLUG (connect=1)
0x1 - ADF_EVENT_HOTPLUG (connect=0)
0x2 - TEGRA_ADF_EVENT_BANDWIDTH_RENEGOTIATE (bw=0)

DC_EXT:
0x0 - TEGRA_DC_EXT_EVENT_HOTPLUG
0x1 - TEGRA_DC_EXT_EVENT_HOTPLUG
0x2 - TEGRA_DC_EXT_EVENT_BANDWIDTH_DEC

Bug 1459374

Change-Id: Idecbc269504966c371d49dc0307bddce96c52fbe
Signed-off-by: Xia Yang <xiay@nvidia.com>
Reviewed-on: http://git-master/r/427912
(cherry picked from commit 590fba5ebdd2da344df7fba0f0eef1896381912c)
Reviewed-on: http://git-master/r/438982
Reviewed-by: Jon Mayo <jmayo@nvidia.com>
Tested-by: Jon Mayo <jmayo@nvidia.com>
drivers/video/tegra/Kconfig
drivers/video/tegra/dc/bandwidth.c
drivers/video/tegra/dc/dc.c
drivers/video/tegra/dc/dc_priv_defs.h
drivers/video/tegra/dc/hdmi_state_machine.c

index f927da4a22fad1112c0864492478b24dfc62b6d9..0b212e75981114e78b9d94c56209a07a8d7ad6b9 100644 (file)
@@ -225,7 +225,7 @@ config ADF_TEGRA_FBDEV
 
 config TEGRA_DC_EXTENSIONS
        bool "Tegra Display Controller Extensions"
-       depends on TEGRA_DC
+       depends on TEGRA_DC && ADF_TEGRA = n
        default y
        help
          Provides additional IOCTLs exposing display controller specific features
index b831a59ee5a208640266b8cdde25453be86ec57d..b35382a542c9eff169e447f691176c88e3768872 100644 (file)
@@ -528,7 +528,9 @@ static void tegra_dc_process_bandwidth_renegotiate(struct tegra_dc *dc,
 #ifdef CONFIG_ADF_TEGRA
        tegra_adf_process_bandwidth_renegotiate(dc->adf, bw);
 #endif
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
        tegra_dc_ext_process_bandwidth_renegotiate(dc->ctrl_num, bw);
+#endif
 }
 #endif
 
index 8dd9a710f64039b913ddffbac10091c3048d306d..c8fcc32627f9a88086e7e92e06e596611a55d857 100644 (file)
@@ -938,7 +938,25 @@ static ssize_t dbg_dc_event_inject_write(struct file *file,
        if (ret < 0)
                return ret;
 
-       if (event == 0x1) /* TEGRA_DC_EXT_EVENT_HOTPLUG */
+       /*
+        * ADF has two seperate events for hotplug connect and disconnect.
+        * We map event 0x0, and 0x1 for them accordingly.  For DC_EXT,
+        * both events map to HOTPLUG.
+        */
+#ifdef CONFIG_ADF_TEGRA
+       if (event == 0x0)
+               tegra_adf_process_hotplug_connected(dc->adf, NULL);
+       else if (event == 0x1)
+               tegra_adf_process_hotplug_disconnected(dc->adf);
+       else if (event == 0x2)
+               tegra_adf_process_bandwidth_renegotiate(dc->adf, 0);
+       else {
+               dev_err(&dc->ndev->dev, "Unknown event 0x%lx\n", event);
+               return -EINVAL; /* unknown event number */
+       }
+#endif
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
+       if (event == 0x0 || event == 0x1) /* TEGRA_DC_EXT_EVENT_HOTPLUG */
                tegra_dc_ext_process_hotplug(dc->ndev->id);
        else if (event == 0x2) /* TEGRA_DC_EXT_EVENT_BANDWIDTH_DEC */
                tegra_dc_ext_process_bandwidth_renegotiate(
@@ -947,6 +965,7 @@ static ssize_t dbg_dc_event_inject_write(struct file *file,
                dev_err(&dc->ndev->dev, "Unknown event 0x%lx\n", event);
                return -EINVAL; /* unknown event number */
        }
+#endif
        return len;
 }
 
@@ -2529,11 +2548,14 @@ static void tegra_dc_vpulse2(struct work_struct *work)
 
 static void tegra_dc_process_vblank(struct tegra_dc *dc, ktime_t timestamp)
 {
-       if (test_bit(V_BLANK_USER, &dc->vblank_ref_count))
-               tegra_dc_ext_process_vblank(dc->ndev->id, timestamp);
+       if (test_bit(V_BLANK_USER, &dc->vblank_ref_count)) {
 #ifdef CONFIG_ADF_TEGRA
-       tegra_adf_process_vblank(dc->adf, timestamp);
+               tegra_adf_process_vblank(dc->adf, timestamp);
+#endif
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
+               tegra_dc_ext_process_vblank(dc->ndev->id, timestamp);
 #endif
+       }
 }
 
 int tegra_dc_config_frame_end_intr(struct tegra_dc *dc, bool enable)
@@ -3017,7 +3039,9 @@ static bool _tegra_dc_controller_enable(struct tegra_dc *dc)
        for (i = 0; i < DC_N_WINDOWS; i++)
                dc->blend.z[i] = -1;
 
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
        tegra_dc_ext_enable(dc->ext);
+#endif
 
        /* initialize cursor to defaults, as driver depends on HW state */
        tegra_dc_writel(dc, 0, DC_DISP_CURSOR_START_ADDR);
@@ -3109,7 +3133,9 @@ static bool _tegra_dc_controller_reset_enable(struct tegra_dc *dc)
        /* force a full blending update */
        dc->blend.z[0] = -1;
 
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
        tegra_dc_ext_enable(dc->ext);
+#endif
 
        if (!ret) {
                dev_err(&dc->ndev->dev, "initialization failed,disabling");
@@ -3331,7 +3357,11 @@ void tegra_dc_blank(struct tegra_dc *dc, unsigned windows)
 
 int tegra_dc_restore(struct tegra_dc *dc)
 {
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
        return tegra_dc_ext_restore(dc->ext);
+#else
+       return 0;
+#endif
 }
 
 static void _tegra_dc_disable(struct tegra_dc *dc)
@@ -3357,8 +3387,12 @@ void tegra_dc_disable(struct tegra_dc *dc)
        if (WARN_ON(!dc || !dc->out || !dc->out_ops))
                return;
 
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
        if (!tegra_dc_ext_disable(dc->ext))
                tegra_dc_blank(dc, BLANK_ALL);
+#else
+       tegra_dc_blank(dc, BLANK_ALL);
+#endif
 
        /* it's important that new underflow work isn't scheduled before the
         * lock is acquired. */
@@ -3410,7 +3444,9 @@ static void tegra_dc_reset_worker(struct work_struct *work)
        dev_warn(&dc->ndev->dev,
                "overlay stuck in underflow state.  resetting.\n");
 
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
        tegra_dc_ext_disable(dc->ext);
+#endif
 
        mutex_lock(&dc->lock);
 
@@ -3919,11 +3955,13 @@ static int tegra_dc_probe(struct platform_device *ndev)
                dc->emc_clk = emc_clk;
 #endif
 
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
        dc->ext = tegra_dc_ext_register(ndev, dc);
        if (IS_ERR_OR_NULL(dc->ext)) {
                dev_warn(&ndev->dev, "Failed to enable Tegra DC extensions.\n");
                dc->ext = NULL;
        }
+#endif
 
        /* interrupt handler must be registered before tegra_fb_register() */
        if (request_threaded_irq(irq, NULL, tegra_dc_irq, IRQF_ONESHOT,
@@ -4031,7 +4069,8 @@ static int tegra_dc_probe(struct platform_device *ndev)
                                goto err_remove_debugfs;
                        }
                }
-#else
+#endif
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
                tegra_dc_io_start(dc);
 #ifdef CONFIG_TEGRA_NVDISPLAY
                dc->fb = tegra_nvdisp_fb_register(ndev, dc, dc->pdata->fb,
@@ -4077,10 +4116,12 @@ err_remove_debugfs:
        tegra_dc_remove_debugfs(dc);
        free_irq(irq, dc);
 err_disable_dc:
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
        if (dc->ext) {
                tegra_dc_ext_disable(dc->ext);
                tegra_dc_ext_unregister(dc->ext);
        }
+#endif
        mutex_lock(&dc->lock);
        if (dc->enabled)
                _tegra_dc_disable(dc);
@@ -4135,11 +4176,12 @@ static int tegra_dc_remove(struct platform_device *ndev)
        if (dc->adf)
                tegra_adf_unregister(dc->adf);
 #endif
-
-       tegra_dc_ext_disable(dc->ext);
-
-       if (dc->ext)
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
+       if (dc->ext) {
+               tegra_dc_ext_disable(dc->ext);
                tegra_dc_ext_unregister(dc->ext);
+       }
+#endif
 
        if (dc->out->flags & TEGRA_DC_OUT_ONE_SHOT_MODE) {
                mutex_lock(&dc->one_shot_lock);
@@ -4186,7 +4228,9 @@ static int tegra_dc_suspend(struct platform_device *ndev, pm_message_t state)
        trace_display_suspend(dc);
        dev_info(&ndev->dev, "suspend\n");
 
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
        tegra_dc_ext_disable(dc->ext);
+#endif
 
        tegra_dc_cursor_suspend(dc);
 
@@ -4410,16 +4454,20 @@ __setup("disp_params=", tegra_dc_mode_override);
 
 static int __init tegra_dc_module_init(void)
 {
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
        int ret = tegra_dc_ext_module_init();
        if (ret)
                return ret;
+#endif
        return platform_driver_register(&tegra_dc_driver);
 }
 
 static void __exit tegra_dc_module_exit(void)
 {
        platform_driver_unregister(&tegra_dc_driver);
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
        tegra_dc_ext_module_exit();
+#endif
 }
 
 module_exit(tegra_dc_module_exit);
index ba37daf03812ca25adcc1f40535b956375108e3c..751d20695bce4a285bd6014588fed43f786f382b 100644 (file)
@@ -243,7 +243,9 @@ struct tegra_dc {
                u64                     underflows_t;
        } stats;
 
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
        struct tegra_dc_ext             *ext;
+#endif
 
        struct tegra_dc_feature         *feature;
        int                             gen1_blend_num;
index 43a54c66e80b2db9075c17ec7fccca6f3db2619f..9e45f4c79c319ddbed9ee12405f6cf5b3c8859a9 100644 (file)
@@ -185,7 +185,9 @@ static void hdmi_disable_l(struct tegra_dc_hdmi_data *hdmi)
        if (hdmi->dc->connected) {
                pr_info("HDMI from connected to disconnected\n");
                tegra_dc_disable(hdmi->dc);
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
                tegra_dc_ext_process_hotplug(hdmi->dc->ndev->id);
+#endif
        }
        hdmi->dc->connected = false;
 #ifdef CONFIG_ADF_TEGRA
@@ -193,7 +195,9 @@ static void hdmi_disable_l(struct tegra_dc_hdmi_data *hdmi)
 #else
        tegra_fb_update_monspecs(hdmi->dc->fb, NULL, NULL);
 #endif
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
        tegra_dc_ext_process_hotplug(hdmi->dc->ndev->id);
+#endif
 }
 
 static void handle_reset_l(struct tegra_dc_hdmi_data *hdmi)
@@ -280,7 +284,8 @@ static void handle_check_edid_l(struct tegra_dc_hdmi_data *hdmi)
 
 #ifdef CONFIG_ADF_TEGRA
        tegra_adf_process_hotplug_connected(hdmi->dc->adf, &specs);
-#else
+#endif
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
        tegra_fb_update_monspecs(hdmi->dc->fb, &specs,
                tegra_dc_hdmi_mode_filter);
 #endif
@@ -293,7 +298,9 @@ static void handle_check_edid_l(struct tegra_dc_hdmi_data *hdmi)
 #endif
        hdmi->dc->connected = true;
 
+#ifdef CONFIG_TEGRA_DC_EXTENSIONS
        tegra_dc_ext_process_hotplug(hdmi->dc->ndev->id);
+#endif
 
        if (unlikely(tegra_is_clk_enabled(hdmi->clk))) {
                /* the only time this should happen is on boot, where the