diff options
author | Jon Mayo <jmayo@nvidia.com> | 2012-11-30 17:53:10 -0500 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:03:32 -0400 |
commit | 006bde68310f08ddcd92fe71677df5bc3450fee3 (patch) | |
tree | 3213ab21b618daa69cb07944a45f226743ac91f6 /drivers/video/tegra/dc/dsi.c | |
parent | 7f87773f3a98387c35b93c988a1ac5ebd88eb689 (diff) |
video: tegra: dc: organize clock setup by out type
Add an out_ops->setup_clk and move clock setup code to a function in each
output type.
Change-Id: I72bdce530fce2a68c5547ea2a6cee301bc9f2df1
Signed-off-by: Jon Mayo <jmayo@nvidia.com>
Reviewed-on: http://git-master/r/168138
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
Diffstat (limited to 'drivers/video/tegra/dc/dsi.c')
-rw-r--r-- | drivers/video/tegra/dc/dsi.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/video/tegra/dc/dsi.c b/drivers/video/tegra/dc/dsi.c index 31ba5c302..c27a59f94 100644 --- a/drivers/video/tegra/dc/dsi.c +++ b/drivers/video/tegra/dc/dsi.c | |||
@@ -4068,6 +4068,50 @@ static void tegra_dc_dsi_enable(struct tegra_dc *dc) | |||
4068 | } | 4068 | } |
4069 | } | 4069 | } |
4070 | 4070 | ||
4071 | static long tegra_dc_dsi_setup_clk(struct tegra_dc *dc, struct clk *clk) | ||
4072 | { | ||
4073 | unsigned long rate; | ||
4074 | struct clk *parent_clk; | ||
4075 | struct clk *base_clk; | ||
4076 | |||
4077 | if (clk == dc->clk) { | ||
4078 | parent_clk = clk_get_sys(NULL, | ||
4079 | dc->out->parent_clk ? : "pll_d_out0"); | ||
4080 | base_clk = clk_get_parent(parent_clk); | ||
4081 | tegra_clk_cfg_ex(base_clk, | ||
4082 | TEGRA_CLK_PLLD_DSI_OUT_ENB, 1); | ||
4083 | } else { | ||
4084 | if (dc->pdata->default_out->dsi->dsi_instance) { | ||
4085 | parent_clk = clk_get_sys(NULL, | ||
4086 | dc->out->parent_clk ? : "pll_d2_out0"); | ||
4087 | base_clk = clk_get_parent(parent_clk); | ||
4088 | tegra_clk_cfg_ex(base_clk, | ||
4089 | TEGRA_CLK_PLLD_CSI_OUT_ENB, 1); | ||
4090 | } else { | ||
4091 | parent_clk = clk_get_sys(NULL, | ||
4092 | dc->out->parent_clk ? : "pll_d_out0"); | ||
4093 | base_clk = clk_get_parent(parent_clk); | ||
4094 | tegra_clk_cfg_ex(base_clk, | ||
4095 | TEGRA_CLK_PLLD_DSI_OUT_ENB, 1); | ||
4096 | } | ||
4097 | } | ||
4098 | |||
4099 | /* divide by 1000 to avoid overflow */ | ||
4100 | dc->mode.pclk /= 1000; | ||
4101 | rate = (dc->mode.pclk * dc->shift_clk_div.mul * 2) | ||
4102 | / dc->shift_clk_div.div; | ||
4103 | rate *= 1000; | ||
4104 | dc->mode.pclk *= 1000; | ||
4105 | |||
4106 | if (rate != clk_get_rate(base_clk)) | ||
4107 | clk_set_rate(base_clk, rate); | ||
4108 | |||
4109 | if (clk_get_parent(clk) != parent_clk) | ||
4110 | clk_set_parent(clk, parent_clk); | ||
4111 | |||
4112 | return tegra_dc_pclk_round_rate(dc, dc->mode.pclk); | ||
4113 | } | ||
4114 | |||
4071 | struct tegra_dc_out_ops tegra_dc_dsi_ops = { | 4115 | struct tegra_dc_out_ops tegra_dc_dsi_ops = { |
4072 | .init = tegra_dc_dsi_init, | 4116 | .init = tegra_dc_dsi_init, |
4073 | .destroy = tegra_dc_dsi_destroy, | 4117 | .destroy = tegra_dc_dsi_destroy, |
@@ -4079,4 +4123,5 @@ struct tegra_dc_out_ops tegra_dc_dsi_ops = { | |||
4079 | .suspend = tegra_dc_dsi_suspend, | 4123 | .suspend = tegra_dc_dsi_suspend, |
4080 | .resume = tegra_dc_dsi_resume, | 4124 | .resume = tegra_dc_dsi_resume, |
4081 | #endif | 4125 | #endif |
4126 | .setup_clk = tegra_dc_dsi_setup_clk, | ||
4082 | }; | 4127 | }; |