From 13a7e5e3e7fc0e64c2f5b38767049f9864474b67 Mon Sep 17 00:00:00 2001 From: Hiroshi DOYU Date: Wed, 21 Mar 2012 10:36:15 +0200 Subject: video: tegra: nvmap: Disable CONFIG_NVMAP_ALLOW_SYSMEM This is necessary to introduce DMA iommu mapping API in nvmap. Change-Id: I9c043460ca08cc25c4688811a2021820aed5c9f7 Signed-off-by: Hiroshi DOYU Reviewed-on: http://git-master/r/96378 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Krishna Reddy --- drivers/video/tegra/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/Kconfig b/drivers/video/tegra/Kconfig index 7de26267155e..468a5566b667 100644 --- a/drivers/video/tegra/Kconfig +++ b/drivers/video/tegra/Kconfig @@ -53,7 +53,7 @@ config NVMAP_RECLAIM_UNPINNED_VM config NVMAP_ALLOW_SYSMEM bool "Allow physical system memory to be used by nvmap" depends on TEGRA_NVMAP - default y + default n help Say Y here to allow nvmap to use physical system memory (i.e., shared with the operating system but not translated through -- cgit v1.2.3 From 54c32208ccb8866575a2f7d9f4faa7878f54e7ad Mon Sep 17 00:00:00 2001 From: Jon Mayo Date: Fri, 16 Mar 2012 12:50:59 -0700 Subject: Revert "video: tegra: dc: load video mode during vblank" Change-Id: Ib1b0fc6015a9dd45982a97231972dadba6b5a92e Reviewed-on: http://git-master/r/96966 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Rohan Somvanshi Tested-by: Rohan Somvanshi --- drivers/video/tegra/dc/dc.c | 84 +--------------------------------------- drivers/video/tegra/dc/dc_priv.h | 4 -- drivers/video/tegra/fb.c | 20 +++++----- 3 files changed, 12 insertions(+), 96 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c index 51af1e008e8b..20f80f940650 100644 --- a/drivers/video/tegra/dc/dc.c +++ b/drivers/video/tegra/dc/dc.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -64,8 +63,6 @@ #define ALL_UF_INT (0) #endif -static int calc_refresh(const struct tegra_dc_mode *m); - static int no_vsync; static void _tegra_dc_controller_disable(struct tegra_dc *dc); @@ -1614,6 +1611,7 @@ static bool check_ref_to_sync(struct tegra_dc_mode *mode) return true; } +#ifdef DEBUG /* return in 1000ths of a Hertz */ static int calc_refresh(const struct tegra_dc_mode *m) { @@ -1628,7 +1626,6 @@ static int calc_refresh(const struct tegra_dc_mode *m) return refresh; } -#ifdef DEBUG static void print_mode(struct tegra_dc *dc, const struct tegra_dc_mode *mode, const char *note) { @@ -1739,12 +1736,7 @@ static int tegra_dc_program_mode(struct tegra_dc *dc, struct tegra_dc_mode *mode int tegra_dc_set_mode(struct tegra_dc *dc, const struct tegra_dc_mode *mode) { - unsigned long flags; - - spin_lock_irqsave(&dc->mode_lock, flags); memcpy(&dc->mode, mode, sizeof(dc->mode)); - dc->mode_dirty = true; - spin_unlock_irqrestore(&dc->mode_lock, flags); print_mode(dc, mode, __func__); @@ -1752,46 +1744,6 @@ int tegra_dc_set_mode(struct tegra_dc *dc, const struct tegra_dc_mode *mode) } EXPORT_SYMBOL(tegra_dc_set_mode); -/* convert tegra_dc_mode to fb_videomode - * return non-zero on error. */ -int tegra_dc_to_fb_videomode(struct fb_videomode *fbmode, - const struct tegra_dc_mode *mode) -{ - if (!fbmode || !mode || !mode->pclk) - return -EINVAL; - - memset(fbmode, 0, sizeof(*fbmode)); - - if (mode->rated_pclk >= 1000) - fbmode->pixclock = KHZ2PICOS(mode->rated_pclk / 1000); - else if (mode->pclk >= 1000) - fbmode->pixclock = KHZ2PICOS(mode->pclk / 1000); - fbmode->hsync_len = mode->h_sync_width; - fbmode->vsync_len = mode->v_sync_width; - fbmode->left_margin = mode->h_back_porch; - fbmode->upper_margin = mode->v_back_porch; - fbmode->xres = mode->h_active; - fbmode->yres = mode->v_active; - fbmode->right_margin = mode->h_front_porch; - fbmode->lower_margin = mode->v_front_porch; - fbmode->vmode = FB_VMODE_NONINTERLACED; - fbmode->vmode |= mode->stereo_mode ? -#ifndef CONFIG_TEGRA_HDMI_74MHZ_LIMIT - FB_VMODE_STEREO_FRAME_PACK -#else - FB_VMODE_STEREO_LEFT_RIGHT -#endif - : 0; - fbmode->sync |= (mode->flags & TEGRA_DC_MODE_FLAG_NEG_H_SYNC) ? - 0 : FB_SYNC_HOR_HIGH_ACT; - fbmode->sync |= (mode->flags & TEGRA_DC_MODE_FLAG_NEG_V_SYNC) ? - 0 : FB_SYNC_VERT_HIGH_ACT; - fbmode->refresh = (calc_refresh(mode) + 500) / 1000; - - return 0; -} -EXPORT_SYMBOL(tegra_dc_to_fb_videomode); - int tegra_dc_set_fb_mode(struct tegra_dc *dc, const struct fb_videomode *fbmode, bool stereo_mode) { @@ -2180,18 +2132,6 @@ static bool tegra_dc_windows_are_dirty(struct tegra_dc *dc) return false; } -static void tegra_dc_update_mode(struct tegra_dc *dc) -{ - unsigned long flags; - - spin_lock_irqsave(&dc->mode_lock, flags); - if (dc->mode_dirty) { - tegra_dc_program_mode(dc, &dc->mode); - dc->mode_dirty = false; - } - spin_unlock_irqrestore(&dc->mode_lock, flags); -} - static void tegra_dc_trigger_windows(struct tegra_dc *dc) { u32 val, i; @@ -2251,9 +2191,6 @@ static void tegra_dc_one_shot_irq(struct tegra_dc *dc, unsigned long status) /* Mark the frame_end as complete. */ if (!completion_done(&dc->frame_end_complete)) complete(&dc->frame_end_complete); - - /* handle a mode change, if it was scheduled */ - tegra_dc_update_mode(dc); } } @@ -2278,8 +2215,6 @@ static void tegra_dc_continuous_irq(struct tegra_dc *dc, unsigned long status) if (!completion_done(&dc->frame_end_complete)) complete(&dc->frame_end_complete); - /* handle a mode change, if it was scheduled */ - tegra_dc_update_mode(dc); tegra_dc_trigger_windows(dc); } } @@ -2932,7 +2867,6 @@ static int tegra_dc_probe(struct nvhost_device *ndev) mutex_init(&dc->lock); mutex_init(&dc->one_shot_lock); - spin_lock_init(&dc->mode_lock); init_completion(&dc->frame_end_complete); init_waitqueue_head(&dc->wq); #ifdef CONFIG_ARCH_TEGRA_2x_SOC @@ -3019,22 +2953,6 @@ static int tegra_dc_probe(struct nvhost_device *ndev) dc->fb = NULL; } - if (dc->out && dc->out->n_modes) { - struct fb_monspecs specs; - int i; - - memset(&specs, 0, sizeof(specs)); - specs.max_x = dc->mode.h_active * 1000; - specs.max_y = dc->mode.v_active * 1000; - specs.modedb_len = dc->out->n_modes; - specs.modedb = kzalloc(specs.modedb_len * - sizeof(struct fb_videomode), GFP_KERNEL); - for (i = 0; i < dc->out->n_modes; i++) - tegra_dc_to_fb_videomode(&specs.modedb[i], - &dc->out->modes[i]); - tegra_fb_update_monspecs(dc->fb, &specs, NULL); - } - if (dc->out && dc->out->hotplug_init) dc->out->hotplug_init(); diff --git a/drivers/video/tegra/dc/dc_priv.h b/drivers/video/tegra/dc/dc_priv.h index 5cba88f9e806..a10e648debc9 100644 --- a/drivers/video/tegra/dc/dc_priv.h +++ b/drivers/video/tegra/dc/dc_priv.h @@ -4,8 +4,6 @@ * Copyright (C) 2010 Google, Inc. * Author: Erik Gilling * - * Copyright (C) 2010-2012 NVIDIA Corporation - * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. @@ -95,8 +93,6 @@ struct tegra_dc { void *out_data; struct tegra_dc_mode mode; - bool mode_dirty; - spinlock_t mode_lock; struct tegra_dc_win windows[DC_N_WINDOWS]; struct tegra_dc_blend blend; diff --git a/drivers/video/tegra/fb.c b/drivers/video/tegra/fb.c index e24588bdd0b7..0272b7f68f04 100644 --- a/drivers/video/tegra/fb.c +++ b/drivers/video/tegra/fb.c @@ -6,7 +6,7 @@ * Colin Cross * Travis Geiselbrecht * - * Copyright (C) 2010-2012 NVIDIA Corporation + * Copyright (C) 2010-2011 NVIDIA Corporation * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -79,10 +79,6 @@ static int tegra_fb_set_par(struct fb_info *info) struct tegra_fb_info *tegra_fb = info->par; struct fb_var_screeninfo *var = &info->var; - BUG_ON(info == NULL); - if (!info) - return -EINVAL; - if (var->bits_per_pixel) { /* we only support RGB ordering for now */ switch (var->bits_per_pixel) { @@ -524,7 +520,6 @@ struct tegra_fb_info *tegra_fb_register(struct nvhost_device *ndev, unsigned long fb_size = 0; unsigned long fb_phys = 0; int ret = 0; - struct fb_videomode m; win = tegra_dc_get_window(dc, fb_data->win); if (!win) { @@ -576,15 +571,22 @@ struct tegra_fb_info *tegra_fb_register(struct nvhost_device *ndev, info->fix.line_length = round_up(info->fix.line_length, TEGRA_LINEAR_PITCH_ALIGNMENT); - INIT_LIST_HEAD(&info->modelist); - tegra_dc_to_fb_videomode(&m, &dc->mode); - fb_videomode_to_var(&info->var, &m); + info->var.xres = fb_data->xres; + info->var.yres = fb_data->yres; info->var.xres_virtual = fb_data->xres; info->var.yres_virtual = fb_data->yres * 2; info->var.bits_per_pixel = fb_data->bits_per_pixel; info->var.activate = FB_ACTIVATE_VBL; info->var.height = tegra_dc_get_out_height(dc); info->var.width = tegra_dc_get_out_width(dc); + info->var.pixclock = 0; + info->var.left_margin = 0; + info->var.right_margin = 0; + info->var.upper_margin = 0; + info->var.lower_margin = 0; + info->var.hsync_len = 0; + info->var.vsync_len = 0; + info->var.vmode = FB_VMODE_NONINTERLACED; win->x.full = dfixed_const(0); win->y.full = dfixed_const(0); -- cgit v1.2.3 From b26d1dbafda0ff28b3aa2811b185411f67c0a768 Mon Sep 17 00:00:00 2001 From: Adam Cheney Date: Tue, 20 Mar 2012 18:07:12 -0700 Subject: video: tegra: dc: update windows after set lut TEGRA_DC_EXT_SET_LUT programmed the proper shadow registers but did not copy the shadow registers to the active set. Signed-off-by: Adam Cheney bug 947281 Change-Id: Id734e128bb708f1a75c0cad22b0c51b083d8df3b Reviewed-on: http://git-master/r/91368 Reviewed-by: Simone Willett Tested-by: Simone Willett --- drivers/video/tegra/dc/dc.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/video') diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c index 20f80f940650..b2a7281757a4 100644 --- a/drivers/video/tegra/dc/dc.c +++ b/drivers/video/tegra/dc/dc.c @@ -764,6 +764,8 @@ static int tegra_dc_update_winlut(struct tegra_dc *dc, int win_idx, int fbovr) mutex_unlock(&dc->lock); + tegra_dc_update_windows(&win, 1); + return 0; } -- cgit v1.2.3 From a60c525119bfbe1b4f2fa5655be0d087dfa4017b Mon Sep 17 00:00:00 2001 From: Jon Mayo Date: Tue, 14 Feb 2012 13:12:04 -0800 Subject: video: tegra: dc: add tracing information add trace_printk to log useful debug information. Bug 870685 Change-Id: I29c0b1600f234ebb06d19c8b6c713b16f6e7643c Signed-off-by: Jon Mayo Reviewed-on: http://git-master/r/89204 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Prashant Malani --- drivers/video/tegra/dc/dc.c | 76 +++++++++++++++++++++++++++++++++++++--- drivers/video/tegra/dc/dc_priv.h | 7 +++- drivers/video/tegra/dc/dsi.c | 7 +++- drivers/video/tegra/dc/hdmi.c | 6 +++- 4 files changed, 88 insertions(+), 8 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c index b2a7281757a4..5f44b373fc11 100644 --- a/drivers/video/tegra/dc/dc.c +++ b/drivers/video/tegra/dc/dc.c @@ -168,6 +168,34 @@ static inline bool tegra_dc_is_yuv_planar(int fmt) print(data, buff); \ } while (0) +#define print_mode_info(dc, mode) do { \ + trace_printk("%s:Mode settings: " \ + "ref_to_sync: H = %d V = %d, " \ + "sync_width: H = %d V = %d, " \ + "back_porch: H = %d V = %d, " \ + "active: H = %d V = %d, " \ + "front_porch: H = %d V = %d, " \ + "pclk = %d, stereo mode = %d\n", \ + dc->ndev->name, \ + mode.h_ref_to_sync, mode.v_ref_to_sync, \ + mode.h_sync_width, mode.v_sync_width, \ + mode.h_back_porch, mode.v_back_porch, \ + mode.h_active, mode.v_active, \ + mode.h_front_porch, mode.v_front_porch, \ + mode.pclk, mode.stereo_mode); \ + } while (0) + +#define print_underflow_info(dc) do { \ + trace_printk("%s:Underflow stats: underflows : %llu, " \ + "undeflows_a : %llu, " \ + "underflows_b : %llu, " \ + "underflows_c : %llu\n", \ + dc->ndev->name, \ + dc->stats.underflows, \ + dc->stats.underflows_a, dc->stats.underflows_b, \ + dc->stats.underflows_c); \ + } while (0) + static void _dump_regs(struct tegra_dc *dc, void *data, void (* print)(void *data, const char *str)) { @@ -980,6 +1008,8 @@ static unsigned long tegra_dc_get_bandwidth( /* to save power, call when display memory clients would be idle */ static void tegra_dc_clear_bandwidth(struct tegra_dc *dc) { + trace_printk("%s:%s rate=%d\n", dc->ndev->name, __func__, + dc->emc_clk_rate); if (tegra_is_clk_enabled(dc->emc_clk)) clk_disable(dc->emc_clk); dc->emc_clk_rate = 0; @@ -1006,6 +1036,8 @@ static void tegra_dc_program_bandwidth(struct tegra_dc *dc) if (w->bandwidth != w->new_bandwidth && w->new_bandwidth != 0) tegra_dc_set_latency_allowance(dc, w); + trace_printk("%s:win%u bandwidth=%d\n", dc->ndev->name, w->idx, + w->bandwidth); } } @@ -1029,6 +1061,7 @@ static int tegra_dc_set_dynamic_emc(struct tegra_dc_win *windows[], int n) if (tegra_dc_has_multiple_dc()) new_rate = ULONG_MAX; + trace_printk("%s:new_emc_clk_rate=%ld\n", dc->ndev->name, new_rate); dc->new_emc_clk_rate = new_rate; return 0; @@ -1258,6 +1291,9 @@ int tegra_dc_update_windows(struct tegra_dc_win *windows[], int n) dfixed_trunc(win->w), dfixed_trunc(win->h), win->out_x, win->out_y, win->out_w, win->out_h, win->fmt, yuvp, Bpp, filter_h, filter_v); + trace_printk("%s:win%u in:%ux%u out:%ux%u fmt=%d\n", + dc->ndev->name, win->idx, dfixed_trunc(win->w), + dfixed_trunc(win->h), win->out_w, win->out_h, win->fmt); } if (update_blend) { @@ -1295,6 +1331,7 @@ int tegra_dc_update_windows(struct tegra_dc_win *windows[], int n) update_mask |= NC_HOST_TRIG; tegra_dc_writel(dc, update_mask, DC_CMD_STATE_CONTROL); + trace_printk("%s:update_mask=%#lx\n", dc->ndev->name, update_mask); mutex_unlock(&dc->lock); if (dc->out->flags & TEGRA_DC_OUT_ONE_SHOT_MODE) @@ -1352,6 +1389,7 @@ static bool tegra_dc_windows_are_clean(struct tegra_dc_win *windows[], /* does not support syncing windows on multiple dcs in one call */ int tegra_dc_sync_windows(struct tegra_dc_win *windows[], int n) { + int ret; if (n < 1 || n > DC_N_WINDOWS) return -EINVAL; @@ -1360,13 +1398,18 @@ int tegra_dc_sync_windows(struct tegra_dc_win *windows[], int n) #ifdef CONFIG_TEGRA_SIMULATION_PLATFORM /* Don't want to timeout on simulator */ - return wait_event_interruptible(windows[0]->dc->wq, + ret = wait_event_interruptible(windows[0]->dc->wq, tegra_dc_windows_are_clean(windows, n)); #else - return wait_event_interruptible_timeout(windows[0]->dc->wq, + trace_printk("%s:Before wait_event_interruptible_timeout\n", + windows[0]->dc->ndev->name); + ret = wait_event_interruptible_timeout(windows[0]->dc->wq, tegra_dc_windows_are_clean(windows, n), HZ); + trace_printk("%s:After wait_event_interruptible_timeout\n", + windows[0]->dc->ndev->name); #endif + return ret; } EXPORT_SYMBOL(tegra_dc_sync_windows); @@ -1707,6 +1750,7 @@ static int tegra_dc_program_mode(struct tegra_dc *dc, struct tegra_dc_mode *mode rate = tegra_dc_clk_get_rate(dc); pclk = tegra_dc_pclk_round_rate(dc, mode->pclk); + trace_printk("%s:pclk=%ld\n", dc->ndev->name, pclk); if (pclk < (mode->pclk / 100 * 99) || pclk > (mode->pclk / 100 * 109)) { dev_err(&dc->ndev->dev, @@ -1718,6 +1762,7 @@ static int tegra_dc_program_mode(struct tegra_dc *dc, struct tegra_dc_mode *mode } div = (rate * 2 / pclk) - 2; + trace_printk("%s:div=%ld\n", dc->ndev->name, div); tegra_dc_writel(dc, 0x00010001, DC_DISP_SHIFT_CLOCK_OPTIONS); @@ -1732,6 +1777,7 @@ static int tegra_dc_program_mode(struct tegra_dc *dc, struct tegra_dc_mode *mode tegra_dc_writel(dc, GENERAL_UPDATE, DC_CMD_STATE_CONTROL); tegra_dc_writel(dc, GENERAL_ACT_REQ, DC_CMD_STATE_CONTROL); + print_mode_info(dc, dc->mode); return 0; } @@ -2087,15 +2133,21 @@ static void tegra_dc_underflow_handler(struct tegra_dc *dc) int i; dc->stats.underflows++; - if (dc->underflow_mask & WIN_A_UF_INT) + if (dc->underflow_mask & WIN_A_UF_INT) { dc->stats.underflows_a += tegra_dc_underflow_count(dc, DC_WINBUF_AD_UFLOW_STATUS); - if (dc->underflow_mask & WIN_B_UF_INT) + trace_printk("%s:Window A Underflow\n", dc->ndev->name); + } + if (dc->underflow_mask & WIN_B_UF_INT) { dc->stats.underflows_b += tegra_dc_underflow_count(dc, DC_WINBUF_BD_UFLOW_STATUS); - if (dc->underflow_mask & WIN_C_UF_INT) + trace_printk("%s:Window B Underflow\n", dc->ndev->name); + } + if (dc->underflow_mask & WIN_C_UF_INT) { dc->stats.underflows_c += tegra_dc_underflow_count(dc, DC_WINBUF_CD_UFLOW_STATUS); + trace_printk("%s:Window C Underflow\n", dc->ndev->name); + } /* Check for any underflow reset conditions */ for (i = 0; i < DC_N_WINDOWS; i++) { @@ -2107,6 +2159,9 @@ static void tegra_dc_underflow_handler(struct tegra_dc *dc) schedule_work(&dc->reset_work); /* reset counter */ dc->windows[i].underflows = 0; + trace_printk("%s:Reset work scheduled for " + "window %c\n", + dc->ndev->name, (65 + i)); } #endif } else { @@ -2119,6 +2174,7 @@ static void tegra_dc_underflow_handler(struct tegra_dc *dc) dc->underflow_mask = 0; val = tegra_dc_readl(dc, DC_CMD_INT_MASK); tegra_dc_writel(dc, val | ALL_UF_INT, DC_CMD_INT_MASK); + print_underflow_info(dc); } #ifndef CONFIG_TEGRA_FPGA_PLATFORM @@ -2488,6 +2544,7 @@ static bool _tegra_dc_controller_enable(struct tegra_dc *dc) tegra_dc_ext_enable(dc->ext); + trace_printk("%s:enable\n", dc->ndev->name); return true; } @@ -2549,6 +2606,7 @@ static bool _tegra_dc_controller_reset_enable(struct tegra_dc *dc) _tegra_dc_controller_disable(dc); } + trace_printk("%s:reset enable\n", dc->ndev->name); return ret; } #endif @@ -2574,6 +2632,7 @@ void tegra_dc_enable(struct tegra_dc *dc) dc->enabled = _tegra_dc_enable(dc); mutex_unlock(&dc->lock); + print_mode_info(dc, dc->mode); } static void _tegra_dc_controller_disable(struct tegra_dc *dc) @@ -2606,12 +2665,15 @@ static void _tegra_dc_controller_disable(struct tegra_dc *dc) /* flush any pending syncpt waits */ while (dc->syncpt[i].min < dc->syncpt[i].max) { + trace_printk("%s:syncpt flush id=%d\n", dc->ndev->name, + dc->syncpt[i].id); dc->syncpt[i].min++; nvhost_syncpt_cpu_incr( &nvhost_get_host(dc->ndev)->syncpt, dc->syncpt[i].id); } } + trace_printk("%s:disabled\n", dc->ndev->name); } void tegra_dc_stats_enable(struct tegra_dc *dc, bool enable) @@ -2696,6 +2758,7 @@ void tegra_dc_disable(struct tegra_dc *dc) mutex_unlock(&dc->lock); if (dc->out->flags & TEGRA_DC_OUT_ONE_SHOT_MODE) mutex_unlock(&dc->one_shot_lock); + print_mode_info(dc, dc->mode); } #ifdef CONFIG_ARCH_TEGRA_2x_SOC @@ -2749,6 +2812,7 @@ static void tegra_dc_reset_worker(struct work_struct *work) unlock: mutex_unlock(&dc->lock); mutex_unlock(&shared_lock); + trace_printk("%s:reset complete\n", dc->ndev->name); } #endif @@ -3025,6 +3089,7 @@ static int tegra_dc_suspend(struct nvhost_device *ndev, pm_message_t state) { struct tegra_dc *dc = nvhost_get_drvdata(ndev); + trace_printk("%s:suspend\n", dc->ndev->name); dev_info(&ndev->dev, "suspend\n"); tegra_dc_ext_disable(dc->ext); @@ -3058,6 +3123,7 @@ static int tegra_dc_resume(struct nvhost_device *ndev) { struct tegra_dc *dc = nvhost_get_drvdata(ndev); + trace_printk("%s:resume\n", dc->ndev->name); dev_info(&ndev->dev, "resume\n"); mutex_lock(&dc->lock); diff --git a/drivers/video/tegra/dc/dc_priv.h b/drivers/video/tegra/dc/dc_priv.h index a10e648debc9..a91c42a5edc4 100644 --- a/drivers/video/tegra/dc/dc_priv.h +++ b/drivers/video/tegra/dc/dc_priv.h @@ -155,14 +155,19 @@ static inline void tegra_dc_io_end(struct tegra_dc *dc) static inline unsigned long tegra_dc_readl(struct tegra_dc *dc, unsigned long reg) { + unsigned long ret; + BUG_ON(!nvhost_module_powered(nvhost_get_host(dc->ndev)->dev)); - return readl(dc->base + reg * 4); + ret = readl(dc->base + reg * 4); + trace_printk("readl %p=%#08lx\n", dc->base + reg * 4, ret); + return ret; } static inline void tegra_dc_writel(struct tegra_dc *dc, unsigned long val, unsigned long reg) { BUG_ON(!nvhost_module_powered(nvhost_get_host(dc->ndev)->dev)); + trace_printk("writel %p=%#08lx\n", dc->base + reg * 4, val); writel(val, dc->base + reg * 4); } diff --git a/drivers/video/tegra/dc/dsi.c b/drivers/video/tegra/dc/dsi.c index c33d6e0a58b3..52639696ba85 100644 --- a/drivers/video/tegra/dc/dsi.c +++ b/drivers/video/tegra/dc/dsi.c @@ -287,14 +287,19 @@ const u32 init_reg[] = { inline unsigned long tegra_dsi_readl(struct tegra_dc_dsi_data *dsi, u32 reg) { + unsigned long ret; + BUG_ON(!nvhost_module_powered(nvhost_get_host(dsi->dc->ndev)->dev)); - return readl(dsi->base + reg * 4); + ret = readl(dsi->base + reg * 4); + trace_printk("readl %p=%#08lx\n", dsi->base + reg * 4, ret); + return ret; } EXPORT_SYMBOL(tegra_dsi_readl); inline void tegra_dsi_writel(struct tegra_dc_dsi_data *dsi, u32 val, u32 reg) { BUG_ON(!nvhost_module_powered(nvhost_get_host(dsi->dc->ndev)->dev)); + trace_printk("writel %p=%#08x\n", dsi->base + reg * 4, val); writel(val, dsi->base + reg * 4); } EXPORT_SYMBOL(tegra_dsi_writel); diff --git a/drivers/video/tegra/dc/hdmi.c b/drivers/video/tegra/dc/hdmi.c index 2e1df8d82641..9c96badee373 100644 --- a/drivers/video/tegra/dc/hdmi.c +++ b/drivers/video/tegra/dc/hdmi.c @@ -947,12 +947,16 @@ static const struct tegra_hdmi_audio_config unsigned long tegra_hdmi_readl(struct tegra_dc_hdmi_data *hdmi, unsigned long reg) { - return readl(hdmi->base + reg * 4); + unsigned long ret; + ret = readl(hdmi->base + reg * 4); + trace_printk("readl %p=%#08lx\n", hdmi->base + reg * 4, ret); + return ret; } void tegra_hdmi_writel(struct tegra_dc_hdmi_data *hdmi, unsigned long val, unsigned long reg) { + trace_printk("writel %p=%#08lx\n", hdmi->base + reg * 4, val); writel(val, hdmi->base + reg * 4); } -- cgit v1.2.3 From fbfd93a5d14f4eda665f56b748da037b8194b1d3 Mon Sep 17 00:00:00 2001 From: Jon Mayo Date: Fri, 13 May 2011 11:55:16 -0700 Subject: ARM: tegra: dc: support YUV422 format Change-Id: I8aa25b03fe6801882b65209cb1a6e125ef27ac2c Signed-off-by: Michael I. Gold Reviewed-on: http://git-master/r/98319 Reviewed-by: Rohan Somvanshi Tested-by: Rohan Somvanshi --- drivers/video/tegra/dc/dc.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c index 5f44b373fc11..228cbf1ae575 100644 --- a/drivers/video/tegra/dc/dc.c +++ b/drivers/video/tegra/dc/dc.c @@ -138,14 +138,32 @@ static inline int tegra_dc_fmt_bpp(int fmt) case TEGRA_WIN_FMT_YUV422RA: return 8; + /* YUYV packed into 32-bits */ case TEGRA_WIN_FMT_YCbCr422: case TEGRA_WIN_FMT_YUV422: - /* FIXME: need to know the bpp of these formats */ - return 0; + return 16; } return 0; } +static inline bool tegra_dc_is_yuv(int fmt) +{ + switch (fmt) { + case TEGRA_WIN_FMT_YUV420P: + case TEGRA_WIN_FMT_YCbCr420P: + case TEGRA_WIN_FMT_YCbCr422P: + case TEGRA_WIN_FMT_YUV422P: + case TEGRA_WIN_FMT_YCbCr422: + case TEGRA_WIN_FMT_YUV422: + case TEGRA_WIN_FMT_YCbCr422R: + case TEGRA_WIN_FMT_YUV422R: + case TEGRA_WIN_FMT_YCbCr422RA: + case TEGRA_WIN_FMT_YUV422RA: + return true; + } + return false; +} + static inline bool tegra_dc_is_yuv_planar(int fmt) { switch (fmt) { @@ -1161,6 +1179,7 @@ int tegra_dc_update_windows(struct tegra_dc_win *windows[], int n) fixed20_12 h_offset, v_offset; bool invert_h = (win->flags & TEGRA_WIN_FLAG_INVERT_H) != 0; bool invert_v = (win->flags & TEGRA_WIN_FLAG_INVERT_V) != 0; + bool yuv = tegra_dc_is_yuv(win->fmt); bool yuvp = tegra_dc_is_yuv_planar(win->fmt); unsigned Bpp = tegra_dc_fmt_bpp(win->fmt) / 8; /* Bytes per pixel of bandwidth, used for dda_inc calculation */ @@ -1190,8 +1209,8 @@ int tegra_dc_update_windows(struct tegra_dc_win *windows[], int n) continue; } - tegra_dc_writel(dc, win->fmt, DC_WIN_COLOR_DEPTH); - tegra_dc_writel(dc, 0, DC_WIN_BYTE_SWAP); + tegra_dc_writel(dc, win->fmt & 0x1f, DC_WIN_COLOR_DEPTH); + tegra_dc_writel(dc, win->fmt >> 6, DC_WIN_BYTE_SWAP); tegra_dc_writel(dc, V_POSITION(win->out_y) | H_POSITION(win->out_x), @@ -1261,7 +1280,7 @@ int tegra_dc_update_windows(struct tegra_dc_win *windows[], int n) DC_WIN_BUFFER_ADDR_MODE); val = WIN_ENABLE; - if (yuvp) + if (yuv) val |= CSC_ENABLE; else if (tegra_dc_fmt_bpp(win->fmt) < 24) val |= COLOR_EXPAND; -- cgit v1.2.3 From 76191dd9546c6cf1b2a574272fc106141b4acb31 Mon Sep 17 00:00:00 2001 From: Anton Kondratenko Date: Tue, 17 Apr 2012 13:52:42 -0700 Subject: kernel: nvhost: add OOM checks This change adds check for out of memory conditions after memory allocations Bug 967504 Change-Id: Icafc16528880ea376dd69a023570b85c25e3d057 Signed-off-by: Anton Kondratenko Reviewed-on: http://git-master/r/97113 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/video/tegra/host/nvhost_job.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/host/nvhost_job.c b/drivers/video/tegra/host/nvhost_job.c index df7a62d689bc..a4f0cfc44212 100644 --- a/drivers/video/tegra/host/nvhost_job.c +++ b/drivers/video/tegra/host/nvhost_job.c @@ -73,7 +73,7 @@ static int alloc_gathers(struct nvhost_job *job, gather_size(num_cmdbufs), 32, NVMAP_HANDLE_CACHEABLE, 0); if (IS_ERR_OR_NULL(job->gather_mem)) { - err = PTR_ERR(job->gather_mem); + err = job->gather_mem ? PTR_ERR(job->gather_mem) : -ENOMEM; job->gather_mem = NULL; goto error; } @@ -82,7 +82,7 @@ static int alloc_gathers(struct nvhost_job *job, /* Map memory to kernel */ job->gathers = nvmap_mmap(job->gather_mem); if (IS_ERR_OR_NULL(job->gathers)) { - err = PTR_ERR(job->gathers); + err = job->gathers ? PTR_ERR(job->gathers) : -ENOMEM; job->gathers = NULL; goto error; } -- cgit v1.2.3 From 1fc87cc0d8b5f00711a72da4101330ff589573f7 Mon Sep 17 00:00:00 2001 From: Mark Zhang Date: Tue, 24 Apr 2012 10:41:08 +0800 Subject: video: tegra: dc: Activate register update after programmed Inform DC register updated after we programmed. This eliminates the display corruption while device enters and resumes from LP0. Signed-off-by: Mark Zhang bug 964626 Change-Id: I4c655d4800474c675d4cdb6204d6fe66e8c6c4b5 Reviewed-on: http://git-master/r/98336 Tested-by: Mark Zhang Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Peer Chen Reviewed-by: Jon Mayo --- drivers/video/tegra/dc/rgb.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/video') diff --git a/drivers/video/tegra/dc/rgb.c b/drivers/video/tegra/dc/rgb.c index 2112643058f4..6787ec38d38d 100644 --- a/drivers/video/tegra/dc/rgb.c +++ b/drivers/video/tegra/dc/rgb.c @@ -144,6 +144,10 @@ void tegra_dc_rgb_enable(struct tegra_dc *dc) } tegra_dc_write_table(dc, out_sel_pintable); + + /* Inform DC register updated */ + tegra_dc_writel(dc, GENERAL_UPDATE, DC_CMD_STATE_CONTROL); + tegra_dc_writel(dc, GENERAL_ACT_REQ, DC_CMD_STATE_CONTROL); } void tegra_dc_rgb_disable(struct tegra_dc *dc) -- cgit v1.2.3 From 7704ad9bb06b97de75437700dc08549c99d16f0c Mon Sep 17 00:00:00 2001 From: Sayak Ghosh Choudhury Date: Tue, 24 Apr 2012 20:09:09 +0530 Subject: hdmi: Set INJECT_NULL_SAMPLE only for stereo streams Bug 953210 Change-Id: Id40b3fe90174a2a8c9a6faf3f35f61d9f7eeb642 Signed-off-by: Sayak Ghosh Choudhury Reviewed-on: http://git-master/r/98477 Reviewed-by: Simone Willett Tested-by: Simone Willett --- drivers/video/tegra/dc/hdmi.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/dc/hdmi.c b/drivers/video/tegra/dc/hdmi.c index 9c96badee373..112c1aa19e39 100644 --- a/drivers/video/tegra/dc/hdmi.c +++ b/drivers/video/tegra/dc/hdmi.c @@ -94,6 +94,7 @@ struct tegra_dc_hdmi_data { bool clk_enabled; unsigned audio_freq; unsigned audio_source; + bool audio_inject_null; bool dvi; }; @@ -1820,7 +1821,10 @@ static int tegra_dc_hdmi_setup_audio(struct tegra_dc *dc, unsigned audio_freq, a_source = AUDIO_CNTRL0_SOURCE_SELECT_SPDIF; #if !defined(CONFIG_ARCH_TEGRA_2x_SOC) - tegra_hdmi_writel(hdmi,a_source | AUDIO_CNTRL0_INJECT_NULLSMPL, + if (hdmi->audio_inject_null) + a_source |= AUDIO_CNTRL0_INJECT_NULLSMPL; + + tegra_hdmi_writel(hdmi,a_source, HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_0); tegra_hdmi_writel(hdmi, AUDIO_CNTRL0_ERROR_TOLERANCE(6) | @@ -1923,6 +1927,31 @@ int tegra_hdmi_setup_audio_freq_source(unsigned audio_freq, unsigned audio_sourc EXPORT_SYMBOL(tegra_hdmi_setup_audio_freq_source); #if !defined(CONFIG_ARCH_TEGRA_2x_SOC) +int tegra_hdmi_audio_null_sample_inject(bool on) +{ + struct tegra_dc_hdmi_data *hdmi = dc_hdmi; + unsigned int val = 0; + + if (!hdmi) + return -EAGAIN; + + if (hdmi->audio_inject_null != on) { + hdmi->audio_inject_null = on; + if (hdmi->clk_enabled) { + val = tegra_hdmi_readl(hdmi, + HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_0); + val &= ~AUDIO_CNTRL0_INJECT_NULLSMPL; + if (on) + val |= AUDIO_CNTRL0_INJECT_NULLSMPL; + tegra_hdmi_writel(hdmi,val, + HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_0); + } + } + + return 0; +} +EXPORT_SYMBOL(tegra_hdmi_audio_null_sample_inject); + int tegra_hdmi_setup_hda_presence() { struct tegra_dc_hdmi_data *hdmi = dc_hdmi; -- cgit v1.2.3 From c0df55efeec575262e8a739851b0ea364dba69fa Mon Sep 17 00:00:00 2001 From: Kevin Huang Date: Tue, 24 Apr 2012 11:48:39 -0700 Subject: video: tegra: dsi: Add DSI register dump in debugfs. Bug 951349 Change-Id: I79fb2e49fa38b83af78323b5f5cf6dbca8fd83c2 Signed-off-by: Kevin Huang Reviewed-on: http://git-master/r/98512 Reviewed-by: Rohan Somvanshi Tested-by: Rohan Somvanshi --- drivers/video/tegra/dc/dsi.c | 108 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) (limited to 'drivers/video') diff --git a/drivers/video/tegra/dc/dsi.c b/drivers/video/tegra/dc/dsi.c index 52639696ba85..4b055ec529c6 100644 --- a/drivers/video/tegra/dc/dsi.c +++ b/drivers/video/tegra/dc/dsi.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include @@ -304,6 +306,111 @@ inline void tegra_dsi_writel(struct tegra_dc_dsi_data *dsi, u32 val, u32 reg) } EXPORT_SYMBOL(tegra_dsi_writel); +#ifdef CONFIG_DEBUG_FS +static int dbg_dsi_show(struct seq_file *s, void *unused) +{ + struct tegra_dc_dsi_data *dsi = s->private; + +#define DUMP_REG(a) do { \ + seq_printf(s, "%-32s\t%03x\t%08lx\n", \ + #a, a, tegra_dsi_readl(dsi, a)); \ + } while (0) + + tegra_dc_io_start(dsi->dc); + clk_enable(dsi->dsi_clk); + + DUMP_REG(DSI_INCR_SYNCPT_CNTRL); + DUMP_REG(DSI_INCR_SYNCPT_ERROR); + DUMP_REG(DSI_CTXSW); + DUMP_REG(DSI_POWER_CONTROL); + DUMP_REG(DSI_INT_ENABLE); + DUMP_REG(DSI_CONTROL); + DUMP_REG(DSI_SOL_DELAY); + DUMP_REG(DSI_MAX_THRESHOLD); + DUMP_REG(DSI_TRIGGER); + DUMP_REG(DSI_TX_CRC); + DUMP_REG(DSI_STATUS); + DUMP_REG(DSI_INIT_SEQ_CONTROL); + DUMP_REG(DSI_INIT_SEQ_DATA_0); + DUMP_REG(DSI_INIT_SEQ_DATA_1); + DUMP_REG(DSI_INIT_SEQ_DATA_2); + DUMP_REG(DSI_INIT_SEQ_DATA_3); + DUMP_REG(DSI_INIT_SEQ_DATA_4); + DUMP_REG(DSI_INIT_SEQ_DATA_5); + DUMP_REG(DSI_INIT_SEQ_DATA_6); + DUMP_REG(DSI_INIT_SEQ_DATA_7); + DUMP_REG(DSI_PKT_SEQ_0_LO); + DUMP_REG(DSI_PKT_SEQ_0_HI); + DUMP_REG(DSI_PKT_SEQ_1_LO); + DUMP_REG(DSI_PKT_SEQ_1_HI); + DUMP_REG(DSI_PKT_SEQ_2_LO); + DUMP_REG(DSI_PKT_SEQ_2_HI); + DUMP_REG(DSI_PKT_SEQ_3_LO); + DUMP_REG(DSI_PKT_SEQ_3_HI); + DUMP_REG(DSI_PKT_SEQ_4_LO); + DUMP_REG(DSI_PKT_SEQ_4_HI); + DUMP_REG(DSI_PKT_SEQ_5_LO); + DUMP_REG(DSI_PKT_SEQ_5_HI); + DUMP_REG(DSI_DCS_CMDS); + DUMP_REG(DSI_PKT_LEN_0_1); + DUMP_REG(DSI_PKT_LEN_2_3); + DUMP_REG(DSI_PKT_LEN_4_5); + DUMP_REG(DSI_PKT_LEN_6_7); + DUMP_REG(DSI_PHY_TIMING_0); + DUMP_REG(DSI_PHY_TIMING_1); + DUMP_REG(DSI_PHY_TIMING_2); + DUMP_REG(DSI_BTA_TIMING); + DUMP_REG(DSI_TIMEOUT_0); + DUMP_REG(DSI_TIMEOUT_1); + DUMP_REG(DSI_TO_TALLY); + DUMP_REG(DSI_PAD_CONTROL); + DUMP_REG(DSI_PAD_CONTROL_CD); + DUMP_REG(DSI_PAD_CD_STATUS); + DUMP_REG(DSI_VID_MODE_CONTROL); +#undef DUMP_REG + + clk_disable(dsi->dsi_clk); + tegra_dc_io_end(dsi->dc); + + return 0; +} + +static int dbg_dsi_open(struct inode *inode, struct file *file) +{ + return single_open(file, dbg_dsi_show, inode->i_private); +} + +static const struct file_operations dbg_fops = { + .open = dbg_dsi_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static struct dentry *dsidir; + +static void tegra_dc_dsi_debug_create(struct tegra_dc_dsi_data *dsi) +{ + struct dentry *retval; + + dsidir = debugfs_create_dir("tegra_dsi", NULL); + if (!dsidir) + return; + retval = debugfs_create_file("regs", S_IRUGO, dsidir, dsi, + &dbg_fops); + if (!retval) + goto free_out; + return; +free_out: + debugfs_remove_recursive(dsidir); + dsidir = NULL; + return; +} +#else +static inline void tegra_dc_dsi_debug_create(struct tegra_dc_dsi_data *dsi) +{ } +#endif + static int tegra_dsi_syncpt(struct tegra_dc_dsi_data *dsi) { u32 val; @@ -2589,6 +2696,7 @@ static void _tegra_dc_dsi_init(struct tegra_dc *dc) { struct tegra_dc_dsi_data *dsi = tegra_dc_get_outdata(dc); + tegra_dc_dsi_debug_create(dsi); tegra_dsi_init_sw(dc, dsi); /* TODO: Configure the CSI pad configuration */ } -- cgit v1.2.3 From bc888e85389ee98c69e844b9cc14088539f7528b Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Mon, 5 Mar 2012 09:02:30 +0200 Subject: video: tegra: host: Reset 3D after power on Sometimes 3D unit comes up with incorrect scissor configuration. Earlier patch added the scissor registers to the context save list, but that did not solve the problem. Remove the extra registers, and reset 3D after powering it up. Bug 939307 Change-Id: Id795f2d99ec3c6b907da2785b1816ce753af7a3f Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/87654 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Graziano Misuraca Tested-by: Graziano Misuraca Reviewed-by: Juha Tukkinen Reviewed-by: Mayuresh Kulkarni --- drivers/video/tegra/host/gr3d/gr3d_t30.c | 1 - drivers/video/tegra/host/nvhost_acm.c | 22 ++++++++++++++-------- drivers/video/tegra/host/t30/t30.c | 3 ++- 3 files changed, 16 insertions(+), 10 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/host/gr3d/gr3d_t30.c b/drivers/video/tegra/host/gr3d/gr3d_t30.c index 8ca6b7b44b9e..ab4d04f89ab2 100644 --- a/drivers/video/tegra/host/gr3d/gr3d_t30.c +++ b/drivers/video/tegra/host/gr3d/gr3d_t30.c @@ -71,7 +71,6 @@ static const struct hwctx_reginfo ctxsave_regs_3d_global[] = { HWCTX_REGINFO(0xa02, 10, DIRECT), HWCTX_REGINFO(0xb04, 1, DIRECT), HWCTX_REGINFO(0xb06, 13, DIRECT), - HWCTX_REGINFO(0xe42, 2, DIRECT), /* HW bug workaround */ }; static const struct hwctx_reginfo ctxsave_regs_3d_perset[] = { diff --git a/drivers/video/tegra/host/nvhost_acm.c b/drivers/video/tegra/host/nvhost_acm.c index f2a61a9547a0..015b7c4dbf66 100644 --- a/drivers/video/tegra/host/nvhost_acm.c +++ b/drivers/video/tegra/host/nvhost_acm.c @@ -55,15 +55,8 @@ static void do_unpowergate_locked(int id) tegra_unpowergate_partition(id); } -void nvhost_module_reset(struct nvhost_device *dev) +static void do_module_reset_locked(struct nvhost_device *dev) { - dev_dbg(&dev->dev, - "%s: asserting %s module reset (id %d, id2 %d)\n", - __func__, dev->name, - dev->powergate_ids[0], dev->powergate_ids[1]); - - mutex_lock(&dev->lock); - /* assert module and mc client reset */ if (dev->powergate_ids[0] != -1) { tegra_powergate_mc_disable(dev->powergate_ids[0]); @@ -89,7 +82,17 @@ void nvhost_module_reset(struct nvhost_device *dev) tegra_periph_reset_deassert(dev->clk[1]); tegra_powergate_mc_enable(dev->powergate_ids[1]); } +} +void nvhost_module_reset(struct nvhost_device *dev) +{ + dev_dbg(&dev->dev, + "%s: asserting %s module reset (id %d, id2 %d)\n", + __func__, dev->name, + dev->powergate_ids[0], dev->powergate_ids[1]); + + mutex_lock(&dev->lock); + do_module_reset_locked(dev); mutex_unlock(&dev->lock); dev_dbg(&dev->dev, "%s: module %s out of reset\n", @@ -108,6 +111,9 @@ static void to_state_clockgated_locked(struct nvhost_device *dev) && dev->can_powergate) { do_unpowergate_locked(dev->powergate_ids[0]); do_unpowergate_locked(dev->powergate_ids[1]); + + if (dev->powerup_reset) + do_module_reset_locked(dev); } dev->powerstate = NVHOST_POWER_STATE_CLOCKGATED; } diff --git a/drivers/video/tegra/host/t30/t30.c b/drivers/video/tegra/host/t30/t30.c index 8a8b1f4d9240..da56a9b66e11 100644 --- a/drivers/video/tegra/host/t30/t30.c +++ b/drivers/video/tegra/host/t30/t30.c @@ -82,7 +82,8 @@ struct nvhost_device t30_devices[] = { .powergate_ids = { TEGRA_POWERGATE_3D, TEGRA_POWERGATE_3D1 }, NVHOST_DEFAULT_CLOCKGATE_DELAY, - .can_powergate = false, + .can_powergate = true, + .powerup_reset = true, .powergate_delay = 250, .moduleid = NVHOST_MODULE_NONE, }, -- cgit v1.2.3 From 5bdd03b21f625d0a07c66e4894b79e557287a3a1 Mon Sep 17 00:00:00 2001 From: Donghan Ryu Date: Wed, 25 Apr 2012 15:43:09 +0900 Subject: video: tegra: host: t30: use max 2d clock setting max 2d clock can make noticeable performance difference in 2d limited usecase such as buffer clearing Change-Id: I40ef999e7eeebff45b657f00293608561cae831d Signed-off-by: Donghan Ryu Reviewed-on: http://git-master/r/98644 Reviewed-by: Simone Willett Tested-by: Simone Willett --- drivers/video/tegra/host/t30/t30.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/host/t30/t30.c b/drivers/video/tegra/host/t30/t30.c index da56a9b66e11..fb69d4e0f57a 100644 --- a/drivers/video/tegra/host/t30/t30.c +++ b/drivers/video/tegra/host/t30/t30.c @@ -96,7 +96,7 @@ struct nvhost_device t30_devices[] = { .waitbases = BIT(NVWAITBASE_2D_0) | BIT(NVWAITBASE_2D_1), .modulemutexes = BIT(NVMODMUTEX_2D_FULL) | BIT(NVMODMUTEX_2D_SIMPLE) | BIT(NVMODMUTEX_2D_SB_A) | BIT(NVMODMUTEX_2D_SB_B), - .clocks = { {"gr2d", 0}, + .clocks = { {"gr2d", UINT_MAX}, {"epp", 0}, {"emc", 300000000} }, NVHOST_MODULE_NO_POWERGATE_IDS, -- cgit v1.2.3 From d5e341a0b8bbabf9096bb5d271c49b40b29da42a Mon Sep 17 00:00:00 2001 From: Kevin Huang Date: Thu, 26 Apr 2012 16:45:05 -0700 Subject: Revert "video: tegra: dc: Clear window option before window update." This reverts commit 90b79e5712300baab889772a5af348559ac95836. Bug 955393 Change-Id: I0e2a15b7d0898dbbb62f09d8bd3502ec93366664 Signed-off-by: Kevin Huang Reviewed-on: http://git-master/r/99261 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Jon Mayo Reviewed-by: Nirav Patel Reviewed-by: Adam Cheney Tested-by: Adam Cheney --- drivers/video/tegra/dc/dc.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c index 228cbf1ae575..11e62815f45a 100644 --- a/drivers/video/tegra/dc/dc.c +++ b/drivers/video/tegra/dc/dc.c @@ -1164,14 +1164,6 @@ int tegra_dc_update_windows(struct tegra_dc_win *windows[], int n) else tegra_dc_writel(dc, WRITE_MUX_ASSEMBLY | READ_MUX_ASSEMBLY, DC_CMD_STATE_ACCESS); - for (i = 0; i < DC_N_WINDOWS; i++) { - tegra_dc_writel(dc, WINDOW_A_SELECT << i, - DC_CMD_DISPLAY_WINDOW_HEADER); - tegra_dc_writel(dc, 0, DC_WIN_WIN_OPTIONS); - if (!no_vsync) - update_mask |= WIN_A_ACT_REQ << i; - } - for (i = 0; i < n; i++) { struct tegra_dc_win *win = windows[i]; unsigned h_dda; -- cgit v1.2.3 From 9349cedf17f9b3c10760c8d48f831473f87a3a15 Mon Sep 17 00:00:00 2001 From: Shashank Sharma Date: Mon, 30 Apr 2012 17:36:24 +0530 Subject: video: tegra: dc: Set default videomode Set default videomode during the dc probe. This patch enables HDMI during the probe only and fixes following issues: 1. Until Xinit there was no display on HDMI. 2. Framebuffer console on HDMI needs it to be enabled well before Xinit. Bug: 930136 Change-Id: Ieaf5c69eefa4a6584893425ad4fd772bcd91ea11 Signed-off-by: Shashank Sharma Reviewed-on: http://git-master/r/99635 Reviewed-by: Simone Willett Tested-by: Simone Willett --- drivers/video/tegra/dc/dc.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c index 11e62815f45a..7161d8bf1694 100644 --- a/drivers/video/tegra/dc/dc.c +++ b/drivers/video/tegra/dc/dc.c @@ -64,6 +64,20 @@ #endif static int no_vsync; +static struct fb_videomode tegra_dc_hdmi_fallback_mode = { + .refresh = 60, + .xres = 640, + .yres = 480, + .pixclock = KHZ2PICOS(25200), + .hsync_len = 96, /* h_sync_width */ + .vsync_len = 2, /* v_sync_width */ + .left_margin = 48, /* h_back_porch */ + .upper_margin = 33, /* v_back_porch */ + .right_margin = 16, /* h_front_porch */ + .lower_margin = 10, /* v_front_porch */ + .vmode = 0, + .sync = 0, +}; static void _tegra_dc_controller_disable(struct tegra_dc *dc); @@ -2622,10 +2636,19 @@ static bool _tegra_dc_controller_reset_enable(struct tegra_dc *dc) } #endif +static int _tegra_dc_set_default_videomode(struct tegra_dc *dc) +{ + return tegra_dc_set_fb_mode(dc, &tegra_dc_hdmi_fallback_mode, 0); +} + static bool _tegra_dc_enable(struct tegra_dc *dc) { - if (dc->mode.pclk == 0) - return false; + if (dc->mode.pclk == 0) { + /* DC enable called but no videomode is loaded. + Set fallback mode to enable driver with.*/ + if (_tegra_dc_set_default_videomode(dc)) + return false; + } if (!dc->out) return false; -- cgit v1.2.3 From 2b4ccbfaaaeefcb89cc07504527a034d0f9140eb Mon Sep 17 00:00:00 2001 From: Shashank Sharma Date: Fri, 27 Apr 2012 16:54:04 +0530 Subject: video: tegra: fb: Enable window state while pan Set window enabled flag in pan display. This fixes a blank window display while switching console from dc_ext device to framebuffer device, and allows dc_ext and fbdev to co-exist. Removed previous work around to unblank fb from tegra_dc_blank function. Bug: 970263 Bug: 963480 Change-Id: I9853da211f78815246965d240d1717345c5ab391 Signed-off-by: Shashank Sharma Reviewed-on: http://git-master/r/99422 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Jon Mayo Reviewed-by: Kiran Adduri Reviewed-by: Allen Martin --- drivers/video/tegra/fb.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/fb.c b/drivers/video/tegra/fb.c index 0272b7f68f04..32ae6527c640 100644 --- a/drivers/video/tegra/fb.c +++ b/drivers/video/tegra/fb.c @@ -283,16 +283,6 @@ static int tegra_fb_blank(int blank, struct fb_info *info) dev_dbg(&tegra_fb->ndev->dev, "unblank\n"); tegra_fb->win->flags = TEGRA_WIN_FLAG_ENABLED; tegra_dc_enable(tegra_fb->win->dc); -#if defined(CONFIG_FRAMEBUFFER_CONSOLE) - /* - * TODO: - * This is a work around to provide an unblanking flip - * to dc driver, required to display fb-console after - * a blank event,and needs to be replaced by a proper - * unblanking mechanism - */ - tegra_fb_flip_win(tegra_fb); -#endif return 0; case FB_BLANK_NORMAL: @@ -331,7 +321,8 @@ static int tegra_fb_pan_display(struct fb_var_screeninfo *var, (var->xoffset * (var->bits_per_pixel/8)); tegra_fb->win->phys_addr = addr; - /* TODO: update virt_addr */ + tegra_fb->win->flags = TEGRA_WIN_FLAG_ENABLED; + tegra_fb->win->virt_addr = info->screen_base; tegra_dc_update_windows(&tegra_fb->win, 1); tegra_dc_sync_windows(&tegra_fb->win, 1); -- cgit v1.2.3 From da0d098d0ecc5cb99b8367f7067b4e57604347de Mon Sep 17 00:00:00 2001 From: Kevin Huang Date: Mon, 23 Apr 2012 13:59:55 -0700 Subject: video: tegra: dsi: Ref-count pllp_out3 clock in DSI. Bug 933653 Change-Id: If7ce4dc5129782a7e3487028d2dba01c9380ba90 Signed-off-by: Kevin Huang Reviewed-on: http://git-master/r/98256 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Aleksandr Frid Reviewed-by: Animesh Kishore Reviewed-by: Yu-Huan Hsu --- drivers/video/tegra/dc/dsi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/dc/dsi.c b/drivers/video/tegra/dc/dsi.c index 4b055ec529c6..def5b38b8b9d 100644 --- a/drivers/video/tegra/dc/dsi.c +++ b/drivers/video/tegra/dc/dsi.c @@ -109,6 +109,7 @@ struct tegra_dc_dsi_data { struct clk *dc_clk; struct clk *dsi_clk; + struct clk *dsi_fixed_clk; bool clk_ref; struct mutex lock; @@ -1453,6 +1454,7 @@ static void tegra_dsi_set_dsi_clk(struct tegra_dc *dc, if (!dsi->clk_ref) { dsi->clk_ref = true; clk_enable(dsi->dsi_clk); + clk_enable(dsi->dsi_fixed_clk); tegra_periph_reset_deassert(dsi->dsi_clk); } dsi->current_dsi_clk_khz = clk_get_rate(dsi->dsi_clk) / 1000; @@ -2861,6 +2863,7 @@ static int tegra_dc_dsi_init(struct tegra_dc *dc) void __iomem *base; struct clk *dc_clk = NULL; struct clk *dsi_clk = NULL; + struct clk *dsi_fixed_clk = NULL; struct tegra_dsi_out *dsi_pdata; int err; @@ -2903,8 +2906,9 @@ static int tegra_dc_dsi_init(struct tegra_dc *dc) dsi_clk = clk_get(&dc->ndev->dev, "dsib"); else dsi_clk = clk_get(&dc->ndev->dev, "dsia"); + dsi_fixed_clk = clk_get(&dc->ndev->dev, "dsi-fixed"); - if (IS_ERR_OR_NULL(dsi_clk)) { + if (IS_ERR_OR_NULL(dsi_clk) || IS_ERR_OR_NULL(dsi_fixed_clk)) { dev_err(&dc->ndev->dev, "dsi: can't get clock\n"); err = -EBUSY; goto err_release_regs; @@ -2924,6 +2928,7 @@ static int tegra_dc_dsi_init(struct tegra_dc *dc) dsi->base_res = base_res; dsi->dc_clk = dc_clk; dsi->dsi_clk = dsi_clk; + dsi->dsi_fixed_clk = dsi_fixed_clk; err = tegra_dc_dsi_cp_info(dsi, dsi_pdata); if (err < 0) @@ -2937,6 +2942,7 @@ static int tegra_dc_dsi_init(struct tegra_dc *dc) err_dsi_data: err_clk_put: clk_put(dsi_clk); + clk_put(dsi_fixed_clk); err_release_regs: release_resource(base_res); err_free_dsi: @@ -3050,6 +3056,7 @@ static int tegra_dsi_deep_sleep(struct tegra_dc *dc, /* Disable dsi source clock */ clk_disable(dsi->dsi_clk); + clk_disable(dsi->dsi_fixed_clk); dsi->clk_ref = false; dsi->enabled = false; -- cgit v1.2.3 From 9c36a7d25b978864c25a5c5649cd803898872600 Mon Sep 17 00:00:00 2001 From: Hunk Lin Date: Thu, 3 May 2012 05:35:47 +0800 Subject: Revert "video: tegra: dc: Set default videomode" This reverts commit 9349cedf17f9b3c10760c8d48f831473f87a3a15. It is reviewed on http://git-master/r/99635 It will cause HDMI power ON and emc clock bump up to 667Mhz after resume from LP0. bug 930136 Change-Id: I130494fdb381b3d322ac0e3fc8be2e44f2c2d7a7 Signed-off-by: Hunk Lin Reviewed-on: http://git-master/r/100202 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Jon Mayo --- drivers/video/tegra/dc/dc.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c index 7161d8bf1694..11e62815f45a 100644 --- a/drivers/video/tegra/dc/dc.c +++ b/drivers/video/tegra/dc/dc.c @@ -64,20 +64,6 @@ #endif static int no_vsync; -static struct fb_videomode tegra_dc_hdmi_fallback_mode = { - .refresh = 60, - .xres = 640, - .yres = 480, - .pixclock = KHZ2PICOS(25200), - .hsync_len = 96, /* h_sync_width */ - .vsync_len = 2, /* v_sync_width */ - .left_margin = 48, /* h_back_porch */ - .upper_margin = 33, /* v_back_porch */ - .right_margin = 16, /* h_front_porch */ - .lower_margin = 10, /* v_front_porch */ - .vmode = 0, - .sync = 0, -}; static void _tegra_dc_controller_disable(struct tegra_dc *dc); @@ -2636,19 +2622,10 @@ static bool _tegra_dc_controller_reset_enable(struct tegra_dc *dc) } #endif -static int _tegra_dc_set_default_videomode(struct tegra_dc *dc) -{ - return tegra_dc_set_fb_mode(dc, &tegra_dc_hdmi_fallback_mode, 0); -} - static bool _tegra_dc_enable(struct tegra_dc *dc) { - if (dc->mode.pclk == 0) { - /* DC enable called but no videomode is loaded. - Set fallback mode to enable driver with.*/ - if (_tegra_dc_set_default_videomode(dc)) - return false; - } + if (dc->mode.pclk == 0) + return false; if (!dc->out) return false; -- cgit v1.2.3 From 8d709aefa05d224373c0337f1aa35c39fd50431c Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Thu, 26 Apr 2012 12:26:30 +0300 Subject: video: tegra: host: Clean up includes Clean up #includes. Replace #includes with forward declarations where possible, and remove extraneous #includes. Bug 871237 Change-Id: I6942e0c632b42ad7009589ebdd78def88ae4baa4 Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/99046 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Mayuresh Kulkarni GVS: Gerrit_Virtual_Submit Reviewed-by: Juha Tukkinen --- drivers/video/tegra/dc/dc_priv.h | 1 + drivers/video/tegra/host/bus_client.c | 5 +++++ drivers/video/tegra/host/chip_support.h | 10 +++++----- drivers/video/tegra/host/debug.c | 2 ++ drivers/video/tegra/host/dev.c | 9 ++++++--- drivers/video/tegra/host/dev.h | 4 ++-- drivers/video/tegra/host/gr3d/gr3d.c | 1 + drivers/video/tegra/host/gr3d/gr3d_t20.c | 1 + drivers/video/tegra/host/gr3d/gr3d_t30.c | 2 ++ drivers/video/tegra/host/host1x/host1x_cdma.c | 2 ++ drivers/video/tegra/host/host1x/host1x_channel.c | 2 ++ drivers/video/tegra/host/host1x/host1x_debug.c | 4 ++-- drivers/video/tegra/host/host1x/host1x_hwctx.h | 1 + drivers/video/tegra/host/host1x/host1x_intr.c | 1 + drivers/video/tegra/host/host1x/host1x_syncpt.c | 2 ++ drivers/video/tegra/host/mpe/mpe.c | 1 + drivers/video/tegra/host/nvhost_cdma.c | 3 +++ drivers/video/tegra/host/nvhost_cdma.h | 2 -- drivers/video/tegra/host/nvhost_channel.c | 1 + drivers/video/tegra/host/nvhost_channel.h | 8 +++----- drivers/video/tegra/host/nvhost_intr.c | 7 +++---- drivers/video/tegra/host/nvhost_job.c | 1 + drivers/video/tegra/host/nvhost_syncpt.c | 1 + drivers/video/tegra/host/nvhost_syncpt.h | 4 +--- drivers/video/tegra/host/t20/t20.c | 6 ++++-- drivers/video/tegra/host/t30/t30.c | 6 ++++-- 26 files changed, 57 insertions(+), 30 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/dc/dc_priv.h b/drivers/video/tegra/dc/dc_priv.h index a91c42a5edc4..c08cd12f5a22 100644 --- a/drivers/video/tegra/dc/dc_priv.h +++ b/drivers/video/tegra/dc/dc_priv.h @@ -27,6 +27,7 @@ #include #include "../host/dev.h" +#include "../host/nvhost_acm.h" #include "../host/host1x/host1x_syncpt.h" #include diff --git a/drivers/video/tegra/host/bus_client.c b/drivers/video/tegra/host/bus_client.c index b49c26e04f29..a3dc3781f81c 100644 --- a/drivers/video/tegra/host/bus_client.c +++ b/drivers/video/tegra/host/bus_client.c @@ -44,6 +44,11 @@ #include "debug.h" #include "bus_client.h" #include "dev.h" +#include "nvhost_acm.h" + +#include "nvhost_channel.h" +#include "nvhost_job.h" +#include "nvhost_hwctx.h" void nvhost_read_module_regs(struct nvhost_device *ndev, u32 offset, int count, u32 *values) diff --git a/drivers/video/tegra/host/chip_support.h b/drivers/video/tegra/host/chip_support.h index 6727e7a69fb4..6e32feb9676e 100644 --- a/drivers/video/tegra/host/chip_support.h +++ b/drivers/video/tegra/host/chip_support.h @@ -22,20 +22,20 @@ #include struct output; + +struct nvhost_master; +struct nvhost_intr; +struct nvhost_syncpt; struct nvhost_waitchk; struct nvhost_userctx_timeout; -struct nvhost_master; struct nvhost_channel; struct nvmap_handle; struct nvmap_client; struct nvhost_hwctx; struct nvhost_cdma; -struct nvhost_intr; +struct nvhost_job; struct push_buffer; -struct nvhost_syncpt; -struct nvhost_master; struct dentry; -struct nvhost_job; struct nvhost_chip_support { struct { diff --git a/drivers/video/tegra/host/debug.c b/drivers/video/tegra/host/debug.c index 91436c903fc6..b7adb0e573eb 100644 --- a/drivers/video/tegra/host/debug.c +++ b/drivers/video/tegra/host/debug.c @@ -24,6 +24,8 @@ #include "dev.h" #include "debug.h" +#include "nvhost_acm.h" +#include "nvhost_channel.h" pid_t nvhost_debug_null_kickoff_pid; unsigned int nvhost_debug_trace_cmdbuf; diff --git a/drivers/video/tegra/host/dev.c b/drivers/video/tegra/host/dev.c index 2e1ffeea7729..d21719bcda56 100644 --- a/drivers/video/tegra/host/dev.c +++ b/drivers/video/tegra/host/dev.c @@ -36,16 +36,18 @@ #include #include -#include #include #include #include #include "debug.h" -#include "nvhost_job.h" #include "t20/t20.h" #include "t30/t30.h" #include "bus_client.h" +#include "nvhost_acm.h" +#include +#include "nvhost_channel.h" +#include "nvhost_job.h" #define DRIVER_NAME "host1x" @@ -79,7 +81,8 @@ static int nvhost_ctrlrelease(struct inode *inode, struct file *filp) static int nvhost_ctrlopen(struct inode *inode, struct file *filp) { - struct nvhost_master *host = container_of(inode->i_cdev, struct nvhost_master, cdev); + struct nvhost_master *host = + container_of(inode->i_cdev, struct nvhost_master, cdev); struct nvhost_ctrl_userctx *priv; u32 *mod_locks; diff --git a/drivers/video/tegra/host/dev.h b/drivers/video/tegra/host/dev.h index 74d7e16fc272..70199d8a5914 100644 --- a/drivers/video/tegra/host/dev.h +++ b/drivers/video/tegra/host/dev.h @@ -21,10 +21,9 @@ #ifndef __NVHOST_DEV_H #define __NVHOST_DEV_H -#include "nvhost_acm.h" +#include #include "nvhost_syncpt.h" #include "nvhost_intr.h" -#include "nvhost_channel.h" #include "chip_support.h" #define TRACE_MAX_LENGTH 128U @@ -34,6 +33,7 @@ extern int nvhost_major; extern int nvhost_minor; struct nvhost_hwctx; +struct nvhost_channel; struct nvhost_master { void __iomem *aperture; diff --git a/drivers/video/tegra/host/gr3d/gr3d.c b/drivers/video/tegra/host/gr3d/gr3d.c index f387d54e585e..da3d498a398f 100644 --- a/drivers/video/tegra/host/gr3d/gr3d.c +++ b/drivers/video/tegra/host/gr3d/gr3d.c @@ -29,6 +29,7 @@ #include "dev.h" #include "gr3d.h" #include "bus_client.h" +#include "nvhost_channel.h" #ifndef TEGRA_POWERGATE_3D1 #define TEGRA_POWERGATE_3D1 -1 diff --git a/drivers/video/tegra/host/gr3d/gr3d_t20.c b/drivers/video/tegra/host/gr3d/gr3d_t20.c index 9ca990f89077..e3a887d34b96 100644 --- a/drivers/video/tegra/host/gr3d/gr3d_t20.c +++ b/drivers/video/tegra/host/gr3d/gr3d_t20.c @@ -19,6 +19,7 @@ */ #include "nvhost_hwctx.h" +#include "nvhost_channel.h" #include "dev.h" #include "host1x/host1x_channel.h" #include "host1x/host1x_hardware.h" diff --git a/drivers/video/tegra/host/gr3d/gr3d_t30.c b/drivers/video/tegra/host/gr3d/gr3d_t30.c index ab4d04f89ab2..01eac53d0608 100644 --- a/drivers/video/tegra/host/gr3d/gr3d_t30.c +++ b/drivers/video/tegra/host/gr3d/gr3d_t30.c @@ -19,6 +19,8 @@ */ #include "nvhost_hwctx.h" +#include "nvhost_channel.h" +#include "nvhost_cdma.h" #include "dev.h" #include "host1x/host1x_hardware.h" #include "host1x/host1x_syncpt.h" diff --git a/drivers/video/tegra/host/host1x/host1x_cdma.c b/drivers/video/tegra/host/host1x/host1x_cdma.c index cdd6026718b1..08762020f366 100644 --- a/drivers/video/tegra/host/host1x/host1x_cdma.c +++ b/drivers/video/tegra/host/host1x/host1x_cdma.c @@ -19,7 +19,9 @@ */ #include +#include "nvhost_acm.h" #include "nvhost_cdma.h" +#include "nvhost_channel.h" #include "dev.h" #include "host1x_hardware.h" diff --git a/drivers/video/tegra/host/host1x/host1x_channel.c b/drivers/video/tegra/host/host1x/host1x_channel.c index b16a34f416ab..04c5d0629ec2 100644 --- a/drivers/video/tegra/host/host1x/host1x_channel.c +++ b/drivers/video/tegra/host/host1x/host1x_channel.c @@ -20,6 +20,8 @@ #include "nvhost_channel.h" #include "dev.h" +#include "nvhost_acm.h" +#include "nvhost_job.h" #include "nvhost_hwctx.h" #include #include diff --git a/drivers/video/tegra/host/host1x/host1x_debug.c b/drivers/video/tegra/host/host1x/host1x_debug.c index 1a1d764bbd63..46ae9c1db019 100644 --- a/drivers/video/tegra/host/host1x/host1x_debug.c +++ b/drivers/video/tegra/host/host1x/host1x_debug.c @@ -25,10 +25,10 @@ #include "dev.h" #include "debug.h" +#include "host1x_hardware.h" #include "nvhost_cdma.h" +#include "nvhost_channel.h" #include "../../nvmap/nvmap.h" - -#include "host1x_hardware.h" #include "host1x_cdma.h" #define NVHOST_DEBUG_MAX_PAGE_OFFSET 102400 diff --git a/drivers/video/tegra/host/host1x/host1x_hwctx.h b/drivers/video/tegra/host/host1x/host1x_hwctx.h index 7587642d0e14..b5046c461d9d 100644 --- a/drivers/video/tegra/host/host1x/host1x_hwctx.h +++ b/drivers/video/tegra/host/host1x/host1x_hwctx.h @@ -24,6 +24,7 @@ #define __NVHOST_HOST1X_HWCTX_H #include +#include "nvhost_hwctx.h" struct nvhost_hwctx_handler; struct nvhost_channel; diff --git a/drivers/video/tegra/host/host1x/host1x_intr.c b/drivers/video/tegra/host/host1x/host1x_intr.c index 47e984e2943e..6d2aedbb9803 100644 --- a/drivers/video/tegra/host/host1x/host1x_intr.c +++ b/drivers/video/tegra/host/host1x/host1x_intr.c @@ -20,6 +20,7 @@ #include #include +#include #include "nvhost_intr.h" #include "dev.h" diff --git a/drivers/video/tegra/host/host1x/host1x_syncpt.c b/drivers/video/tegra/host/host1x/host1x_syncpt.c index b431fa350638..d0de49463993 100644 --- a/drivers/video/tegra/host/host1x/host1x_syncpt.c +++ b/drivers/video/tegra/host/host1x/host1x_syncpt.c @@ -19,7 +19,9 @@ */ #include +#include #include "nvhost_syncpt.h" +#include "nvhost_acm.h" #include "dev.h" #include "host1x_syncpt.h" #include "host1x_hardware.h" diff --git a/drivers/video/tegra/host/mpe/mpe.c b/drivers/video/tegra/host/mpe/mpe.c index 36d1d6f26682..8d599a44adc3 100644 --- a/drivers/video/tegra/host/mpe/mpe.c +++ b/drivers/video/tegra/host/mpe/mpe.c @@ -19,6 +19,7 @@ */ #include "nvhost_hwctx.h" +#include "nvhost_channel.h" #include "dev.h" #include "host1x/host1x_hardware.h" #include "host1x/host1x_channel.h" diff --git a/drivers/video/tegra/host/nvhost_cdma.c b/drivers/video/tegra/host/nvhost_cdma.c index 775d761e65c9..7ebb0c8b4020 100644 --- a/drivers/video/tegra/host/nvhost_cdma.c +++ b/drivers/video/tegra/host/nvhost_cdma.c @@ -19,6 +19,9 @@ */ #include "nvhost_cdma.h" +#include "nvhost_channel.h" +#include "nvhost_job.h" +#include "nvhost_hwctx.h" #include "dev.h" #include diff --git a/drivers/video/tegra/host/nvhost_cdma.h b/drivers/video/tegra/host/nvhost_cdma.h index 9cb9b8277254..9583fbbe5b16 100644 --- a/drivers/video/tegra/host/nvhost_cdma.h +++ b/drivers/video/tegra/host/nvhost_cdma.h @@ -28,8 +28,6 @@ #include #include -#include "nvhost_acm.h" - struct nvhost_syncpt; struct nvhost_userctx_timeout; struct nvhost_job; diff --git a/drivers/video/tegra/host/nvhost_channel.c b/drivers/video/tegra/host/nvhost_channel.c index afbac6fe4c4e..129a41cc2f42 100644 --- a/drivers/video/tegra/host/nvhost_channel.c +++ b/drivers/video/tegra/host/nvhost_channel.c @@ -20,6 +20,7 @@ #include "nvhost_channel.h" #include "dev.h" +#include "nvhost_acm.h" #include "nvhost_job.h" #include #include diff --git a/drivers/video/tegra/host/nvhost_channel.h b/drivers/video/tegra/host/nvhost_channel.h index 7b946c8ee853..4a67596c7cd7 100644 --- a/drivers/video/tegra/host/nvhost_channel.h +++ b/drivers/video/tegra/host/nvhost_channel.h @@ -21,13 +21,9 @@ #ifndef __NVHOST_CHANNEL_H #define __NVHOST_CHANNEL_H -#include "nvhost_cdma.h" -#include "nvhost_acm.h" -#include "nvhost_hwctx.h" -#include "nvhost_job.h" - #include #include +#include "nvhost_cdma.h" #define NVHOST_MAX_WAIT_CHECKS 256 #define NVHOST_MAX_GATHERS 512 @@ -37,6 +33,8 @@ struct nvhost_master; struct nvhost_waitchk; struct nvhost_device; +struct nvhost_channel; +struct nvhost_hwctx; struct nvhost_channel_gather { u32 words; diff --git a/drivers/video/tegra/host/nvhost_intr.c b/drivers/video/tegra/host/nvhost_intr.c index 7c4bdc7bafb6..d1f7d69fa5f1 100644 --- a/drivers/video/tegra/host/nvhost_intr.c +++ b/drivers/video/tegra/host/nvhost_intr.c @@ -20,14 +20,13 @@ #include "nvhost_intr.h" #include "dev.h" +#include "nvhost_acm.h" #include #include #include #include - - - - +#include "nvhost_channel.h" +#include "nvhost_hwctx.h" /*** Wait list management ***/ diff --git a/drivers/video/tegra/host/nvhost_job.c b/drivers/video/tegra/host/nvhost_job.c index a4f0cfc44212..5cd04a3a78a1 100644 --- a/drivers/video/tegra/host/nvhost_job.c +++ b/drivers/video/tegra/host/nvhost_job.c @@ -25,6 +25,7 @@ #include #include "nvhost_channel.h" #include "nvhost_job.h" +#include "nvhost_hwctx.h" #include "dev.h" /* Magic to use to fill freed handle slots */ diff --git a/drivers/video/tegra/host/nvhost_syncpt.c b/drivers/video/tegra/host/nvhost_syncpt.c index 13ad0fc3a3cf..d69883ee51b2 100644 --- a/drivers/video/tegra/host/nvhost_syncpt.c +++ b/drivers/video/tegra/host/nvhost_syncpt.c @@ -22,6 +22,7 @@ #include #include #include "nvhost_syncpt.h" +#include "nvhost_acm.h" #include "dev.h" #define MAX_STUCK_CHECK_COUNT 15 diff --git a/drivers/video/tegra/host/nvhost_syncpt.h b/drivers/video/tegra/host/nvhost_syncpt.h index b71cb3e6287e..966a49fbd92c 100644 --- a/drivers/video/tegra/host/nvhost_syncpt.h +++ b/drivers/video/tegra/host/nvhost_syncpt.h @@ -27,9 +27,6 @@ #include #include -struct nvhost_syncpt; -struct nvhost_waitchk; - /* host managed and invalid syncpt id */ #define NVSYNCPT_GRAPHICS_HOST (0) #define NVSYNCPT_INVALID (-1) @@ -151,6 +148,7 @@ static inline int nvhost_syncpt_wait(struct nvhost_syncpt *sp, u32 id, u32 thres * @param: wait - start of filled in array of waitchk structs * @param: waitend - end ptr (one beyond last valid waitchk) */ +struct nvhost_waitchk; int nvhost_syncpt_wait_check(struct nvhost_syncpt *sp, struct nvmap_client *nvmap, u32 mask, diff --git a/drivers/video/tegra/host/t20/t20.c b/drivers/video/tegra/host/t20/t20.c index 24ddedc842e4..19967cb8c7a4 100644 --- a/drivers/video/tegra/host/t20/t20.c +++ b/drivers/video/tegra/host/t20/t20.c @@ -19,17 +19,19 @@ */ #include +#include #include #include "dev.h" #include "t20.h" -#include "host1x/host1x_channel.h" #include "host1x/host1x_syncpt.h" #include "host1x/host1x_hardware.h" -#include "host1x/host1x_cdma.h" #include "gr3d/gr3d.h" #include "gr3d/gr3d_t20.h" #include "mpe/mpe.h" #include "nvhost_hwctx.h" +#include "nvhost_channel.h" +#include "host1x/host1x_channel.h" +#include "host1x/host1x_cdma.h" #define NVMODMUTEX_2D_FULL (1) #define NVMODMUTEX_2D_SIMPLE (2) diff --git a/drivers/video/tegra/host/t30/t30.c b/drivers/video/tegra/host/t30/t30.c index fb69d4e0f57a..fce8081df332 100644 --- a/drivers/video/tegra/host/t30/t30.c +++ b/drivers/video/tegra/host/t30/t30.c @@ -19,19 +19,21 @@ */ #include +#include #include #include #include "dev.h" #include "t20/t20.h" #include "t30.h" #include "gr3d/gr3d.h" -#include "mpe/mpe.h" #include "gr3d/gr3d_t30.h" #include "gr3d/scale3d.h" +#include "mpe/mpe.h" #include "host1x/host1x_hardware.h" -#include "host1x/host1x_cdma.h" #include "host1x/host1x_syncpt.h" #include "chip_support.h" +#include "nvhost_channel.h" +#include "host1x/host1x_cdma.h" #define NVMODMUTEX_2D_FULL (1) #define NVMODMUTEX_2D_SIMPLE (2) -- cgit v1.2.3 From 91eb75c90ef8acd92573ca5145fee67f1781719f Mon Sep 17 00:00:00 2001 From: Pranav Chaturvedi Date: Mon, 16 Apr 2012 09:09:44 +0530 Subject: video: early exit from update_cdma when update_cdma_locked() is invoked, CDMA is not running implies that the queue is cleared and we can return immediately. Bug 960487 Change-Id: I599027906dc405f4490590443d4f4d5a3202b5b0 Reviewed-on: http://git-master/r/96650 (cherry picked from commit f297b4812d15540f4b14c87178662a7ca6575ce9) Reviewed-on: http://git-master/r/99994 Reviewed-by: Varun Colbert Tested-by: Varun Colbert --- drivers/video/tegra/host/nvhost_cdma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/host/nvhost_cdma.c b/drivers/video/tegra/host/nvhost_cdma.c index 7ebb0c8b4020..f1f4405d0745 100644 --- a/drivers/video/tegra/host/nvhost_cdma.c +++ b/drivers/video/tegra/host/nvhost_cdma.c @@ -156,7 +156,9 @@ static void update_cdma_locked(struct nvhost_cdma *cdma) struct nvhost_syncpt *sp = &dev->syncpt; struct nvhost_job *job, *n; - BUG_ON(!cdma->running); + /* If CDMA is stopped, queue is cleared and we can return */ + if (!cdma->running) + return; /* * Walk the sync queue, reading the sync point registers as necessary, -- cgit v1.2.3 From a3be04f0f9deefa1aef4bb89e7f5991816bb929a Mon Sep 17 00:00:00 2001 From: Krishna Reddy Date: Thu, 3 May 2012 15:36:48 -0700 Subject: video: tegra: nvmap: config option to enable page pools. Add config option to enable/disable nvmap page pools. Change-Id: I873e81a675fecd768534d4ce03c2f8fdd3c6a063 Signed-off-by: Krishna Reddy Reviewed-on: http://git-master/r/100424 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Yu-Huan Hsu --- drivers/video/tegra/Kconfig | 16 ++++++++++++++++ drivers/video/tegra/nvmap/nvmap.h | 5 ++++- drivers/video/tegra/nvmap/nvmap_dev.c | 4 ++++ drivers/video/tegra/nvmap/nvmap_handle.c | 31 ++++++++++++++++++++++++++----- 4 files changed, 50 insertions(+), 6 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/Kconfig b/drivers/video/tegra/Kconfig index 468a5566b667..59e27788680d 100644 --- a/drivers/video/tegra/Kconfig +++ b/drivers/video/tegra/Kconfig @@ -85,6 +85,22 @@ config NVMAP_CARVEOUT_COMPACTOR heap and retries the failed allocation. Say Y here to let nvmap to keep carveout fragmentation under control. +config NVMAP_PAGE_POOLS + bool "Use page pools to reduce allocation overhead" + depends on TEGRA_NVMAP + default y + help + say Y here to reduce the alloction overhead, which is significant + for uncached, writecombine and inner cacheable memories as it + involves changing page attributes during every allocation per page + and flushing cache. Alloc time is reduced by allcoating the pages + ahead and keeping them aside. The reserved pages would be released + when system is low on memory and acquired back during release of + memory. + +config NVMAP_PAGE_POOL_SIZE + hex + default 0x0 config NVMAP_VPR bool "Enable VPR Heap." diff --git a/drivers/video/tegra/nvmap/nvmap.h b/drivers/video/tegra/nvmap/nvmap.h index 44a0d86b6039..87a5a74cf515 100644 --- a/drivers/video/tegra/nvmap/nvmap.h +++ b/drivers/video/tegra/nvmap/nvmap.h @@ -86,7 +86,7 @@ struct nvmap_handle { struct mutex lock; }; -#define NVMAP_DEFAULT_PAGE_POOL_SIZE 8192 +#ifdef CONFIG_NVMAP_PAGE_POOLS #define NVMAP_UC_POOL NVMAP_HANDLE_UNCACHEABLE #define NVMAP_WC_POOL NVMAP_HANDLE_WRITE_COMBINE #define NVMAP_IWB_POOL NVMAP_HANDLE_INNER_CACHEABLE @@ -103,11 +103,13 @@ struct nvmap_page_pool { }; int nvmap_page_pool_init(struct nvmap_page_pool *pool, int flags); +#endif struct nvmap_share { struct tegra_iovmm_client *iovmm; wait_queue_head_t pin_wait; struct mutex pin_lock; +#ifdef CONFIG_NVMAP_PAGE_POOLS union { struct nvmap_page_pool pools[NVMAP_NUM_POOLS]; struct { @@ -117,6 +119,7 @@ struct nvmap_share { struct nvmap_page_pool wb_pool; }; }; +#endif #ifdef CONFIG_NVMAP_RECLAIM_UNPINNED_VM struct mutex mru_lock; struct list_head *mru_lists; diff --git a/drivers/video/tegra/nvmap/nvmap_dev.c b/drivers/video/tegra/nvmap/nvmap_dev.c index f84f38c93aad..27c4f61e8956 100644 --- a/drivers/video/tegra/nvmap/nvmap_dev.c +++ b/drivers/video/tegra/nvmap/nvmap_dev.c @@ -1182,8 +1182,10 @@ static int nvmap_probe(struct platform_device *pdev) init_waitqueue_head(&dev->iovmm_master.pin_wait); mutex_init(&dev->iovmm_master.pin_lock); +#ifdef CONFIG_NVMAP_PAGE_POOLS for (i = 0; i < NVMAP_NUM_POOLS; i++) nvmap_page_pool_init(&dev->iovmm_master.pools[i], i); +#endif dev->iovmm_master.iovmm = tegra_iovmm_alloc_client(dev_name(&pdev->dev), NULL, @@ -1311,6 +1313,7 @@ static int nvmap_probe(struct platform_device *pdev) dev, &debug_iovmm_clients_fops); debugfs_create_file("allocations", 0664, iovmm_root, dev, &debug_iovmm_allocations_fops); +#ifdef CONFIG_NVMAP_PAGE_POOLS for (i = 0; i < NVMAP_NUM_POOLS; i++) { char name[40]; char *memtype_string[] = {"uc", "wc", @@ -1321,6 +1324,7 @@ static int nvmap_probe(struct platform_device *pdev) iovmm_root, &dev->iovmm_master.pools[i].npages); } +#endif } } diff --git a/drivers/video/tegra/nvmap/nvmap_handle.c b/drivers/video/tegra/nvmap/nvmap_handle.c index 539b7ce9801f..0708e7468dad 100644 --- a/drivers/video/tegra/nvmap/nvmap_handle.c +++ b/drivers/video/tegra/nvmap/nvmap_handle.c @@ -66,6 +66,9 @@ * preserve kmalloc space, if the array of pages exceeds PAGELIST_VMALLOC_MIN, * the array is allocated using vmalloc. */ #define PAGELIST_VMALLOC_MIN (PAGE_SIZE * 2) + +#ifdef CONFIG_NVMAP_PAGE_POOLS + #define NVMAP_TEST_PAGE_POOL_SHRINKER 1 static bool enable_pp = 1; static int pool_size[NVMAP_NUM_POOLS]; @@ -377,6 +380,7 @@ int nvmap_page_pool_init(struct nvmap_page_pool *pool, int flags) int i; static int reg = 1; struct sysinfo info; + int highmem_pages = 0; typedef int (*set_pages_array) (struct page **pages, int addrinarray); set_pages_array s_cpa[] = { set_pages_array_uc, @@ -395,14 +399,16 @@ int nvmap_page_pool_init(struct nvmap_page_pool *pool, int flags) return 0; si_meminfo(&info); - if (!pool_size[flags]) { + if (!pool_size[flags] && !CONFIG_NVMAP_PAGE_POOL_SIZE) /* Use 3/8th of total ram for page pools. * 1/8th for uc, 1/8th for wc and 1/8th for iwb. */ pool->max_pages = info.totalram >> 3; - } + else + pool->max_pages = CONFIG_NVMAP_PAGE_POOL_SIZE; + if (pool->max_pages <= 0 || pool->max_pages >= info.totalram) - pool->max_pages = NVMAP_DEFAULT_PAGE_POOL_SIZE; + goto fail; pool_size[flags] = pool->max_pages; pr_info("nvmap %s page pool size=%d pages", s_memtype_str[flags], pool->max_pages); @@ -425,7 +431,14 @@ int nvmap_page_pool_init(struct nvmap_page_pool *pool, int flags) __free_page(page); goto do_cpa; } + if (PageHighMem(page)) + highmem_pages++; } + si_meminfo(&info); + pr_info("nvmap pool = %s, highmem=%d, pool_size=%d," + "totalram=%lu, freeram=%lu, totalhigh=%lu, freehigh=%lu", + s_memtype_str[flags], highmem_pages, pool->max_pages, + info.totalram, info.freeram, info.totalhigh, info.freehigh); do_cpa: (*s_cpa[flags])(pool->page_array, pool->npages); nvmap_page_pool_unlock(pool); @@ -436,6 +449,7 @@ fail: vfree(pool->page_array); return -ENOMEM; } +#endif static inline void *altalloc(size_t len) { @@ -460,7 +474,9 @@ void _nvmap_handle_free(struct nvmap_handle *h) { struct nvmap_share *share = nvmap_get_share_from_dev(h->dev); unsigned int i, nr_page, page_index = 0; +#ifdef CONFIG_NVMAP_PAGE_POOLS struct nvmap_page_pool *pool = NULL; +#endif if (nvmap_handle_remove(h->dev, h) != 0) return; @@ -481,6 +497,7 @@ void _nvmap_handle_free(struct nvmap_handle *h) nvmap_mru_remove(share, h); +#ifdef CONFIG_NVMAP_PAGE_POOLS if (h->flags < NVMAP_NUM_POOLS) pool = &share->pools[h->flags]; @@ -490,6 +507,7 @@ void _nvmap_handle_free(struct nvmap_handle *h) break; page_index++; } +#endif if (page_index == nr_page) goto skip_attr_restore; @@ -538,12 +556,14 @@ static int handle_page_alloc(struct nvmap_client *client, struct nvmap_handle *h, bool contiguous) { size_t size = PAGE_ALIGN(h->size); - struct nvmap_share *share = nvmap_get_share_from_dev(h->dev); unsigned int nr_page = size >> PAGE_SHIFT; pgprot_t prot; unsigned int i = 0, page_index = 0; struct page **pages; +#ifdef CONFIG_NVMAP_PAGE_POOLS struct nvmap_page_pool *pool = NULL; + struct nvmap_share *share = nvmap_get_share_from_dev(h->dev); +#endif pages = altalloc(nr_page * sizeof(*pages)); if (!pages) @@ -562,6 +582,7 @@ static int handle_page_alloc(struct nvmap_client *client, pages[i] = nth_page(page, i); } else { +#ifdef CONFIG_NVMAP_PAGE_POOLS if (h->flags < NVMAP_NUM_POOLS) pool = &share->pools[h->flags]; @@ -572,7 +593,7 @@ static int handle_page_alloc(struct nvmap_client *client, break; page_index++; } - +#endif for (; i < nr_page; i++) { pages[i] = nvmap_alloc_pages_exact(GFP_NVMAP, PAGE_SIZE); -- cgit v1.2.3 From dfd813141283891e397d73958aabad38eddfe350 Mon Sep 17 00:00:00 2001 From: Shashank Sharma Date: Mon, 30 Apr 2012 17:36:24 +0530 Subject: video: tegra: dc: Set default videomode Set default videomode during the dc probe. This patch enables HDMI during the probe only and fixes following issues: 1. Until Xinit there was no display on HDMI. 2. Framebuffer console on HDMI needs it to be enabled well before Xinit. To avoide un-necessary powering on HDMI,Check HPD and enable HDMI only if it's present. Bug: 930136 Bug: 977705 Change-Id: Ifb71328e5df0ccbb5751669db71fd24719fe3738 Signed-off-by: Shashank Sharma Reviewed-on: http://git-master/r/100656 Reviewed-by: Rohan Somvanshi Tested-by: Rohan Somvanshi --- drivers/video/tegra/dc/dc.c | 65 ++++++++++++++++++++++++++++++++++++++----- drivers/video/tegra/dc/hdmi.c | 10 +------ 2 files changed, 59 insertions(+), 16 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c index 11e62815f45a..c42df4c1957e 100644 --- a/drivers/video/tegra/dc/dc.c +++ b/drivers/video/tegra/dc/dc.c @@ -33,6 +33,7 @@ #include #include #include +#include #include