diff options
author | Thierry Reding <treding@nvidia.com> | 2014-03-26 07:32:14 -0400 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2014-06-05 17:09:32 -0400 |
commit | dbb3f2f751069bc757fbdbe8911a7e784e850b24 (patch) | |
tree | 6df9c968a5b1f2203f95861c8a032370c7934e3d /drivers/gpu/drm/tegra | |
parent | cb825d89f50c043839a9dbb0efd882ba96457c7d (diff) |
drm/tegra: dc - Move around shift clock programming
Program the shift clock divider in tegra_crtc_setup_clk() since that's
where the divider is computed, so passing it around can be avoided.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra')
-rw-r--r-- | drivers/gpu/drm/tegra/dc.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index b1b1395f06c7..69f48ca78e49 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c | |||
@@ -617,13 +617,14 @@ static int tegra_dc_set_timings(struct tegra_dc *dc, | |||
617 | } | 617 | } |
618 | 618 | ||
619 | static int tegra_crtc_setup_clk(struct drm_crtc *crtc, | 619 | static int tegra_crtc_setup_clk(struct drm_crtc *crtc, |
620 | struct drm_display_mode *mode, | 620 | struct drm_display_mode *mode) |
621 | unsigned long *div) | ||
622 | { | 621 | { |
623 | unsigned long pclk = mode->clock * 1000, rate; | 622 | unsigned long pclk = mode->clock * 1000, rate; |
624 | struct tegra_dc *dc = to_tegra_dc(crtc); | 623 | struct tegra_dc *dc = to_tegra_dc(crtc); |
625 | struct tegra_output *output = NULL; | 624 | struct tegra_output *output = NULL; |
626 | struct drm_encoder *encoder; | 625 | struct drm_encoder *encoder; |
626 | unsigned int div; | ||
627 | u32 value; | ||
627 | long err; | 628 | long err; |
628 | 629 | ||
629 | list_for_each_entry(encoder, &crtc->dev->mode_config.encoder_list, head) | 630 | list_for_each_entry(encoder, &crtc->dev->mode_config.encoder_list, head) |
@@ -646,9 +647,12 @@ static int tegra_crtc_setup_clk(struct drm_crtc *crtc, | |||
646 | } | 647 | } |
647 | 648 | ||
648 | rate = clk_get_rate(dc->clk); | 649 | rate = clk_get_rate(dc->clk); |
649 | *div = (rate * 2 / pclk) - 2; | 650 | div = (rate * 2 / pclk) - 2; |
651 | |||
652 | DRM_DEBUG_KMS("rate: %lu, div: %u\n", rate, div); | ||
650 | 653 | ||
651 | DRM_DEBUG_KMS("rate: %lu, div: %lu\n", rate, *div); | 654 | value = SHIFT_CLK_DIVIDER(div) | PIXEL_CLK_DIVIDER_PCD1; |
655 | tegra_dc_writel(dc, value, DC_DISP_DISP_CLOCK_CONTROL); | ||
652 | 656 | ||
653 | return 0; | 657 | return 0; |
654 | } | 658 | } |
@@ -661,12 +665,12 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc, | |||
661 | struct tegra_bo *bo = tegra_fb_get_plane(crtc->primary->fb, 0); | 665 | struct tegra_bo *bo = tegra_fb_get_plane(crtc->primary->fb, 0); |
662 | struct tegra_dc *dc = to_tegra_dc(crtc); | 666 | struct tegra_dc *dc = to_tegra_dc(crtc); |
663 | struct tegra_dc_window window; | 667 | struct tegra_dc_window window; |
664 | unsigned long div, value; | 668 | u32 value; |
665 | int err; | 669 | int err; |
666 | 670 | ||
667 | drm_vblank_pre_modeset(crtc->dev, dc->pipe); | 671 | drm_vblank_pre_modeset(crtc->dev, dc->pipe); |
668 | 672 | ||
669 | err = tegra_crtc_setup_clk(crtc, mode, &div); | 673 | err = tegra_crtc_setup_clk(crtc, mode); |
670 | if (err) { | 674 | if (err) { |
671 | dev_err(dc->dev, "failed to setup clock for CRTC: %d\n", err); | 675 | dev_err(dc->dev, "failed to setup clock for CRTC: %d\n", err); |
672 | return err; | 676 | return err; |
@@ -682,9 +686,6 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc, | |||
682 | tegra_dc_writel(dc, value, DC_DISP_INTERLACE_CONTROL); | 686 | tegra_dc_writel(dc, value, DC_DISP_INTERLACE_CONTROL); |
683 | } | 687 | } |
684 | 688 | ||
685 | value = SHIFT_CLK_DIVIDER(div) | PIXEL_CLK_DIVIDER_PCD1; | ||
686 | tegra_dc_writel(dc, value, DC_DISP_DISP_CLOCK_CONTROL); | ||
687 | |||
688 | /* setup window parameters */ | 689 | /* setup window parameters */ |
689 | memset(&window, 0, sizeof(window)); | 690 | memset(&window, 0, sizeof(window)); |
690 | window.src.x = 0; | 691 | window.src.x = 0; |