From f939885e6f77ac92bad278487ccf651f2256a7b0 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Wed, 22 Jan 2014 18:09:13 +0100 Subject: video: tegra: updated comments, move front_porch work around Updated several comments to make code easier to read and understand. Also use the front_porch workaround in any case, for HDMI output too. --- drivers/video/tegra/dc/mode.c | 24 +++++++++++++++--------- drivers/video/tegra/fb.c | 15 +++++++++++++-- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/drivers/video/tegra/dc/mode.c b/drivers/video/tegra/dc/mode.c index 0a0e730ad174..be0d2bc5f035 100644 --- a/drivers/video/tegra/dc/mode.c +++ b/drivers/video/tegra/dc/mode.c @@ -388,19 +388,22 @@ int tegra_dc_var_to_dc_mode(struct tegra_dc *dc, struct fb_var_screeninfo *var, mode->h_front_porch = var->right_margin; mode->v_front_porch = var->lower_margin; mode->stereo_mode = stereo_mode; + + /* + * HACK: + * If v_front_porch is only 1, we would violate Constraint 5/6 + * in this case, increase front porch by 1 + */ + if (mode->v_front_porch <= 1) + mode->v_front_porch = 2; + + if (dc->out->type == TEGRA_DC_OUT_HDMI) { /* HDMI controller requires h_ref=1, v_ref=1 */ mode->h_ref_to_sync = 1; mode->v_ref_to_sync = 1; } else { - /* - * HACK: - * If v_front_porch is only 1, we would violate Constraint 5/6 - * in this case, increase front porch by 1 - */ - if (mode->v_front_porch <= 1) - mode->v_front_porch = 2; - + /* Calculate ref_to_sync signals */ err = calc_ref_to_sync(mode); if (err) { dev_err(&dc->ndev->dev, "display timing ref_to_sync" @@ -441,7 +444,10 @@ int tegra_dc_var_to_dc_mode(struct tegra_dc *dc, struct fb_var_screeninfo *var, } EXPORT_SYMBOL(tegra_dc_var_to_dc_mode); - +/* + * This method is only used by sysfs interface + * /sys/devices/tegradc.1/nvdps + */ int tegra_dc_set_fb_mode(struct tegra_dc *dc, const struct fb_videomode *fbmode, bool stereo_mode) { diff --git a/drivers/video/tegra/fb.c b/drivers/video/tegra/fb.c index 90d1363ecf9c..70b82bde9e43 100644 --- a/drivers/video/tegra/fb.c +++ b/drivers/video/tegra/fb.c @@ -125,7 +125,9 @@ static int tegra_fb_set_par(struct fb_info *info) struct tegra_dc_mode mode; - + /* This is usually altered to 16/32 by tegra_fb_check_var + * above which is called before this function + */ switch (var->bits_per_pixel) { case 32: tegra_fb->win->fmt = TEGRA_WIN_FMT_R8G8B8A8; @@ -167,6 +169,7 @@ static int tegra_fb_set_par(struct fb_info *info) return -EINVAL; } + /* Reflect changes on HW */ if (dc->enabled) tegra_dc_disable(dc); tegra_dc_enable(dc); @@ -678,6 +681,12 @@ struct tegra_fb_info *tegra_fb_register(struct nvhost_device *ndev, if (option != NULL) { if (!strcmp(option, "off")) { + /* This off option works perfectly for framebuffer + * device, however the tegra binary driver somehow + * has troubles to handle a missing fb0 when there + * (then, dc1 gets remapped to fb0, which seems + * to be an issue for the binary driver)... + */ ret = -ENODEV; goto err_iounmap_fb; } @@ -687,7 +696,9 @@ struct tegra_fb_info *tegra_fb_register(struct nvhost_device *ndev, } } - /* activate current settings.. */ + /* Activate current settings (tegra_fb_find_mode has call + * tegra_fb_check_var already) + */ if (fb_mem) tegra_fb_set_par(info); -- cgit v1.2.3