diff options
author | Thierry Reding <treding@nvidia.com> | 2014-08-07 16:55:34 +0200 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2014-08-07 16:55:34 +0200 |
commit | d8c76251d1d4de1358004e770f0d33ff1c2f4345 (patch) | |
tree | 5612c67350e45ab73886fa06711a823563cfbc77 | |
parent | b04df4d45cf93026d52748061156b6414cce1816 (diff) | |
parent | 97d5982fd099e9e8b36ab05beec6fadd486036b0 (diff) |
Merge branch 'staging/drm/tegra' into staging/master
-rw-r--r-- | drivers/gpu/drm/tegra/dc.c | 51 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/drm.h | 1 |
2 files changed, 49 insertions, 3 deletions
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 80b224fa9c3a..eb7844146a1b 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -12,6 +12,8 @@ #include <linux/iommu.h> #include <linux/reset.h> +#include <soc/tegra/pmc.h> + #include "dc.h" #include "drm.h" #include "gem.h" @@ -21,6 +23,8 @@ struct tegra_dc_soc_info { bool supports_cursor; bool supports_block_linear; unsigned int pitch_align; + bool has_powergate; + unsigned int pitch_align; }; struct tegra_plane { @@ -1369,6 +1373,8 @@ static const struct tegra_dc_soc_info tegra20_dc_soc_info = { .supports_cursor = false, .supports_block_linear = false, .pitch_align = 8, + .has_powergate = false, + .pitch_align = 8, }; static const struct tegra_dc_soc_info tegra30_dc_soc_info = { @@ -1376,6 +1382,8 @@ static const struct tegra_dc_soc_info tegra30_dc_soc_info = { .supports_cursor = false, .supports_block_linear = false, .pitch_align = 8, + .has_powergate = false, + .pitch_align = 8, }; static const struct tegra_dc_soc_info tegra114_dc_soc_info = { @@ -1383,6 +1391,8 @@ static const struct tegra_dc_soc_info tegra114_dc_soc_info = { .supports_cursor = false, .supports_block_linear = false, .pitch_align = 64, + .has_powergate = true, + .pitch_align = 64, }; static const struct tegra_dc_soc_info tegra124_dc_soc_info = { @@ -1390,6 +1400,8 @@ static const struct tegra_dc_soc_info tegra124_dc_soc_info = { .supports_cursor = true, .supports_block_linear = true, .pitch_align = 64, + .has_powergate = true, + .pitch_align = 64, }; static const struct of_device_id tegra_dc_of_match[] = { @@ -1397,6 +1409,9 @@ static const struct of_device_id tegra_dc_of_match[] = { .compatible = "nvidia,tegra124-dc", .data = &tegra124_dc_soc_info, }, { + .compatible = "nvidia,tegra114-dc", + .data = &tegra114_dc_soc_info, + }, { .compatible = "nvidia,tegra30-dc", .data = &tegra30_dc_soc_info, }, { @@ -1479,9 +1494,34 @@ static int tegra_dc_probe(struct platform_device *pdev) return PTR_ERR(dc->rst); } - err = clk_prepare_enable(dc->clk); - if (err < 0) - return err; + if (dc->soc->has_powergate) { + if (dc->pipe == 0) + dc->powergate = TEGRA_POWERGATE_DIS; + else + dc->powergate = TEGRA_POWERGATE_DISB; + + err = tegra_powergate_sequence_power_up(dc->powergate, dc->clk, + dc->rst); + if (err < 0) { + dev_err(&pdev->dev, "failed to power partition: %d\n", + err); + return err; + } + } else { + err = clk_prepare_enable(dc->clk); + if (err < 0) { + dev_err(&pdev->dev, "failed to enable clock: %d\n", + err); + return err; + } + + err = reset_control_deassert(dc->rst); + if (err < 0) { + dev_err(&pdev->dev, "failed to deassert reset: %d\n", + err); + return err; + } + } regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); dc->regs = devm_ioremap_resource(&pdev->dev, regs); @@ -1535,6 +1575,11 @@ static int tegra_dc_remove(struct platform_device *pdev) } reset_control_assert(dc->rst); + + if (dc->soc->has_powergate) + tegra_powergate_power_off(dc->powergate); + + reset_control_assert(dc->rst); clk_disable_unprepare(dc->clk); return 0; diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 27f87acb96a7..2fdae404e719 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -104,6 +104,7 @@ struct tegra_dc { spinlock_t lock; struct drm_crtc base; + int powergate; int pipe; struct clk *clk; |