aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/tegra/tegra_asoc_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/tegra/tegra_asoc_utils.c')
-rw-r--r--sound/soc/tegra/tegra_asoc_utils.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/sound/soc/tegra/tegra_asoc_utils.c b/sound/soc/tegra/tegra_asoc_utils.c
index ba419f86384d..24fb001be7f4 100644
--- a/sound/soc/tegra/tegra_asoc_utils.c
+++ b/sound/soc/tegra/tegra_asoc_utils.c
@@ -43,8 +43,10 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate,
43 case 88200: 43 case 88200:
44 if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA20) 44 if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA20)
45 new_baseclock = 56448000; 45 new_baseclock = 56448000;
46 else 46 else if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA30)
47 new_baseclock = 564480000; 47 new_baseclock = 564480000;
48 else
49 new_baseclock = 282240000;
48 break; 50 break;
49 case 8000: 51 case 8000:
50 case 16000: 52 case 16000:
@@ -54,8 +56,10 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate,
54 case 96000: 56 case 96000:
55 if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA20) 57 if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA20)
56 new_baseclock = 73728000; 58 new_baseclock = 73728000;
57 else 59 else if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA30)
58 new_baseclock = 552960000; 60 new_baseclock = 552960000;
61 else
62 new_baseclock = 368640000;
59 break; 63 break;
60 default: 64 default:
61 return -EINVAL; 65 return -EINVAL;
@@ -169,6 +173,7 @@ int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data,
169 struct device *dev) 173 struct device *dev)
170{ 174{
171 int ret; 175 int ret;
176 bool new_clocks = false;
172 177
173 data->dev = dev; 178 data->dev = dev;
174 179
@@ -176,28 +181,37 @@ int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data,
176 data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA20; 181 data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA20;
177 else if (of_machine_is_compatible("nvidia,tegra30")) 182 else if (of_machine_is_compatible("nvidia,tegra30"))
178 data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA30; 183 data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA30;
179 else if (!dev->of_node) 184 else if (of_machine_is_compatible("nvidia,tegra114")) {
180 /* non-DT is always Tegra20 */ 185 data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA114;
181 data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA20; 186 new_clocks = true;
182 else 187 } else {
183 /* DT boot, but unknown SoC */ 188 dev_err(data->dev, "SoC unknown to Tegra ASoC utils\n");
184 return -EINVAL; 189 return -EINVAL;
190 }
185 191
186 data->clk_pll_a = clk_get_sys(NULL, "pll_a"); 192 if (new_clocks)
193 data->clk_pll_a = clk_get(dev, "pll_a");
194 else
195 data->clk_pll_a = clk_get_sys(NULL, "pll_a");
187 if (IS_ERR(data->clk_pll_a)) { 196 if (IS_ERR(data->clk_pll_a)) {
188 dev_err(data->dev, "Can't retrieve clk pll_a\n"); 197 dev_err(data->dev, "Can't retrieve clk pll_a\n");
189 ret = PTR_ERR(data->clk_pll_a); 198 ret = PTR_ERR(data->clk_pll_a);
190 goto err; 199 goto err;
191 } 200 }
192 201
193 data->clk_pll_a_out0 = clk_get_sys(NULL, "pll_a_out0"); 202 if (new_clocks)
203 data->clk_pll_a_out0 = clk_get(dev, "pll_a_out0");
204 else
205 data->clk_pll_a_out0 = clk_get_sys(NULL, "pll_a_out0");
194 if (IS_ERR(data->clk_pll_a_out0)) { 206 if (IS_ERR(data->clk_pll_a_out0)) {
195 dev_err(data->dev, "Can't retrieve clk pll_a_out0\n"); 207 dev_err(data->dev, "Can't retrieve clk pll_a_out0\n");
196 ret = PTR_ERR(data->clk_pll_a_out0); 208 ret = PTR_ERR(data->clk_pll_a_out0);
197 goto err_put_pll_a; 209 goto err_put_pll_a;
198 } 210 }
199 211
200 if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA20) 212 if (new_clocks)
213 data->clk_cdev1 = clk_get(dev, "mclk");
214 else if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA20)
201 data->clk_cdev1 = clk_get_sys(NULL, "cdev1"); 215 data->clk_cdev1 = clk_get_sys(NULL, "cdev1");
202 else 216 else
203 data->clk_cdev1 = clk_get_sys("extern1", NULL); 217 data->clk_cdev1 = clk_get_sys("extern1", NULL);