diff options
author | Mursalin Akon <makon@nvidia.com> | 2011-09-15 11:09:18 -0700 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-09-19 17:58:07 -0700 |
commit | 50f3468a018407419b70fc72905755d520c76704 (patch) | |
tree | c7783a9afb08276c0e52ef8adea51377c6099a1a | |
parent | 7eb5215660d7e54d2ff84dae17cb00071695aed1 (diff) |
driver: video: terga: dc: fix switch class dependencies
Mark the dependencies of dc driver on switch class explicit,
using proper pre-processors.
Bug 877239
Change-Id: I977f24173a0e19f3371afbd82c70bdc00aad41f4
Signed-off-by: Mursalin Akon <makon@nvidia.com>
Reviewed-on: http://git-master/r/52679
Reviewed-by: Robert Morell <rmorell@nvidia.com>
Reviewed-by: Allen Martin <amartin@nvidia.com>
-rw-r--r-- | drivers/video/tegra/dc/dc.c | 15 | ||||
-rw-r--r-- | drivers/video/tegra/dc/dc_priv.h | 2 | ||||
-rw-r--r-- | drivers/video/tegra/dc/hdmi.c | 12 |
3 files changed, 28 insertions, 1 deletions
diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c index 0e617a9c29f4..f1792cb97bdb 100644 --- a/drivers/video/tegra/dc/dc.c +++ b/drivers/video/tegra/dc/dc.c @@ -33,8 +33,11 @@ #include <linux/debugfs.h> #include <linux/seq_file.h> #include <linux/backlight.h> -#include <linux/switch.h> #include <drm/drm_fixed.h> +#ifdef CONFIG_SWITCH +#include <linux/switch.h> +#endif + #include <mach/clk.h> #include <mach/dc.h> @@ -1540,8 +1543,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; @@ -2392,7 +2397,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); } @@ -2443,6 +2450,7 @@ unlock: } #endif +#ifdef CONFIG_SWITCH static ssize_t switch_modeset_print_mode(struct switch_dev *sdev, char *buf) { struct tegra_dc *dc = @@ -2453,6 +2461,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) { @@ -2573,10 +2582,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); @@ -2679,7 +2690,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 027fd8490f20..2b5de20951fc 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 vblank_complete; diff --git a/drivers/video/tegra/dc/hdmi.c b/drivers/video/tegra/dc/hdmi.c index 5679ce8134e1..19d1d5c12a13 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 *hda2hdmicodec_clk; +#ifdef CONFIG_SWITCH struct switch_dev hpd_switch; +#endif spinlock_t suspend_lock; bool suspended; @@ -765,8 +769,10 @@ static bool tegra_dc_hdmi_detect(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; @@ -776,7 +782,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; } @@ -970,8 +978,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; @@ -1025,7 +1035,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) |