diff options
author | Dan Willemsen <dwillemsen@nvidia.com> | 2011-02-10 00:42:20 -0800 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-02-16 14:34:28 -0800 |
commit | 015a2817ef273b6540eae4ed2be7d9c4d596cbef (patch) | |
tree | d87518f2f490d0c22f10d459395e114d98c84956 /drivers | |
parent | 3a8c76ae1374e2fdb66b479dd56122c07c5729c2 (diff) |
video: tegra: add modeset switch to trigger uevents
Change-Id: I3b060b622a593d48319a442072a21d0c4f9527ae
Reviewed-on: http://git-master/r/19049
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/tegra/dc/dc.c | 22 | ||||
-rw-r--r-- | drivers/video/tegra/dc/dc_priv.h | 3 |
2 files changed, 25 insertions, 0 deletions
diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c index 22350d587472..f5ce9ecc3275 100644 --- a/drivers/video/tegra/dc/dc.c +++ b/drivers/video/tegra/dc/dc.c @@ -30,6 +30,7 @@ #include <linux/ktime.h> #include <linux/debugfs.h> #include <linux/seq_file.h> +#include <linux/switch.h> #include <mach/clk.h> #include <mach/dc.h> @@ -795,6 +796,9 @@ 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); + switch_set_state(&dc->modeset_switch, + (mode->h_active << 16) | mode->v_active); + return 0; } @@ -1202,6 +1206,8 @@ void tegra_dc_disable(struct tegra_dc *dc) _tegra_dc_disable(dc); } + switch_set_state(&dc->modeset_switch, 0); + mutex_unlock(&dc->lock); } @@ -1224,6 +1230,16 @@ static void tegra_dc_reset_worker(struct work_struct *work) mutex_unlock(&dc->lock); } +static ssize_t switch_modeset_print_mode(struct switch_dev *sdev, char *buf) +{ + struct tegra_dc *dc = + container_of(sdev, struct tegra_dc, modeset_switch); + + if (!sdev->state) + return sprintf(buf, "offline\n"); + + return sprintf(buf, "%dx%d\n", dc->mode.h_active, dc->mode.v_active); +} static int tegra_dc_probe(struct nvhost_device *ndev) { @@ -1340,6 +1356,11 @@ static int tegra_dc_probe(struct nvhost_device *ndev) nvhost_set_drvdata(ndev, dc); + 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); + if (dc->pdata->default_out) tegra_dc_set_out(dc, dc->pdata->default_out); else @@ -1418,6 +1439,7 @@ static int tegra_dc_remove(struct nvhost_device *ndev) if (dc->enabled) _tegra_dc_disable(dc); + switch_dev_unregister(&dc->modeset_switch); 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 ddd7d341e429..75561402167e 100644 --- a/drivers/video/tegra/dc/dc_priv.h +++ b/drivers/video/tegra/dc/dc_priv.h @@ -22,6 +22,7 @@ #include <linux/list.h> #include <linux/mutex.h> #include <linux/wait.h> +#include <linux/switch.h> #include "../host/dev.h" struct tegra_dc; @@ -89,6 +90,8 @@ struct tegra_dc { unsigned long underflow_mask; struct work_struct reset_work; + + struct switch_dev modeset_switch; }; static inline void tegra_dc_io_start(struct tegra_dc *dc) |