summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/video/tegra/dc/dc.c15
-rw-r--r--drivers/video/tegra/dc/dc_priv.h2
-rw-r--r--drivers/video/tegra/dc/hdmi.c12
3 files changed, 28 insertions, 1 deletions
diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c
index 9b3f3a3014cd..fbdf82d7f506 100644
--- a/drivers/video/tegra/dc/dc.c
+++ b/drivers/video/tegra/dc/dc.c
@@ -33,9 +33,12 @@
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/backlight.h>
-#include <linux/switch.h>
#include <video/tegrafb.h>
#include <drm/drm_fixed.h>
+#ifdef CONFIG_SWITCH
+#include <linux/switch.h>
+#endif
+
#include <mach/clk.h>
#include <mach/dc.h>
@@ -1656,8 +1659,10 @@ static int tegra_dc_program_mode(struct tegra_dc *dc, struct tegra_dc_mode *mode
tegra_dc_writel(dc, PIXEL_CLK_DIVIDER_PCD1 | SHIFT_CLK_DIVIDER(div),
DC_DISP_DISP_CLOCK_CONTROL);
+#ifdef CONFIG_SWITCH
switch_set_state(&dc->modeset_switch,
(mode->h_active << 16) | mode->v_active);
+#endif
dc->pixel_clk = dc->mode.pclk;
@@ -2558,7 +2563,9 @@ void tegra_dc_disable(struct tegra_dc *dc)
_tegra_dc_disable(dc);
}
+#ifdef CONFIG_SWITCH
switch_set_state(&dc->modeset_switch, 0);
+#endif
mutex_unlock(&dc->lock);
}
@@ -2609,6 +2616,7 @@ unlock:
}
#endif
+#ifdef CONFIG_SWITCH
static ssize_t switch_modeset_print_mode(struct switch_dev *sdev, char *buf)
{
struct tegra_dc *dc =
@@ -2619,6 +2627,7 @@ static ssize_t switch_modeset_print_mode(struct switch_dev *sdev, char *buf)
return sprintf(buf, "%dx%d\n", dc->mode.h_active, dc->mode.v_active);
}
+#endif
static int tegra_dc_probe(struct nvhost_device *ndev)
{
@@ -2734,10 +2743,12 @@ static int tegra_dc_probe(struct nvhost_device *ndev)
nvhost_set_drvdata(ndev, dc);
+#ifdef CONFIG_SWITCH
dc->modeset_switch.name = dev_name(&ndev->dev);
dc->modeset_switch.state = 0;
dc->modeset_switch.print_state = switch_modeset_print_mode;
switch_dev_register(&dc->modeset_switch);
+#endif
if (dc->pdata->default_out)
tegra_dc_set_out(dc, dc->pdata->default_out);
@@ -2851,7 +2862,9 @@ static int tegra_dc_remove(struct nvhost_device *ndev)
if (dc->enabled)
_tegra_dc_disable(dc);
+#ifdef CONFIG_SWITCH
switch_dev_unregister(&dc->modeset_switch);
+#endif
free_irq(dc->irq, dc);
clk_put(dc->emc_clk);
clk_put(dc->clk);
diff --git a/drivers/video/tegra/dc/dc_priv.h b/drivers/video/tegra/dc/dc_priv.h
index 6567c859e47b..bd0625b1cf8c 100644
--- a/drivers/video/tegra/dc/dc_priv.h
+++ b/drivers/video/tegra/dc/dc_priv.h
@@ -117,7 +117,9 @@ struct tegra_dc {
unsigned long underflow_mask;
struct work_struct reset_work;
+#ifdef CONFIG_SWITCH
struct switch_dev modeset_switch;
+#endif
struct completion frame_end_complete;
diff --git a/drivers/video/tegra/dc/hdmi.c b/drivers/video/tegra/dc/hdmi.c
index 5a63c9ada582..86d61c53a71e 100644
--- a/drivers/video/tegra/dc/hdmi.c
+++ b/drivers/video/tegra/dc/hdmi.c
@@ -26,7 +26,9 @@
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
+#ifdef CONFIG_SWITCH
#include <linux/switch.h>
+#endif
#include <linux/workqueue.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
@@ -81,7 +83,9 @@ struct tegra_dc_hdmi_data {
struct clk *hda2codec_clk;
struct clk *hda2hdmi_clk;
+#ifdef CONFIG_SWITCH
struct switch_dev hpd_switch;
+#endif
spinlock_t suspend_lock;
bool suspended;
@@ -755,8 +759,10 @@ void tegra_dc_hdmi_detect_config(struct tegra_dc *dc,
hdmi->dvi = !(specs->misc & FB_MISC_HDMI);
tegra_fb_update_monspecs(dc->fb, specs, tegra_dc_hdmi_mode_filter);
+#ifdef CONFIG_SWITCH
hdmi->hpd_switch.state = 0;
switch_set_state(&hdmi->hpd_switch, 1);
+#endif
dev_info(&dc->ndev->dev, "display detected\n");
dc->connected = true;
@@ -827,7 +833,9 @@ static bool tegra_dc_hdmi_detect(struct tegra_dc *dc)
fail:
hdmi->eld_retrieved = false;
+#ifdef CONFIG_SWITCH
switch_set_state(&hdmi->hpd_switch, 0);
+#endif
tegra_nvhdcp_set_plug(hdmi->nvhdcp, 0);
return false;
}
@@ -1021,8 +1029,10 @@ static int tegra_dc_hdmi_init(struct tegra_dc *dc)
hdmi->audio_source = AUTO;
spin_lock_init(&hdmi->suspend_lock);
+#ifdef CONFIG_SWITCH
hdmi->hpd_switch.name = "hdmi";
switch_dev_register(&hdmi->hpd_switch);
+#endif
dc->out->depth = 24;
@@ -1076,7 +1086,9 @@ static void tegra_dc_hdmi_destroy(struct tegra_dc *dc)
free_irq(gpio_to_irq(dc->out->hotplug_gpio), dc);
cancel_delayed_work_sync(&hdmi->work);
+#ifdef CONFIG_SWITCH
switch_dev_unregister(&hdmi->hpd_switch);
+#endif
iounmap(hdmi->base);
release_resource(hdmi->base_res);
#if !defined(CONFIG_ARCH_TEGRA_2x_SOC)