aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/tegra/tegra30_ahub.c25
-rw-r--r--sound/soc/tegra/tegra30_i2s.c26
-rw-r--r--sound/soc/tegra/tegra_asoc_utils.c23
3 files changed, 56 insertions, 18 deletions
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
index 23e592f453fa..d554d46d08b5 100644
--- a/sound/soc/tegra/tegra30_ahub.c
+++ b/sound/soc/tegra/tegra30_ahub.c
@@ -627,9 +627,34 @@ static int tegra30_ahub_remove(struct platform_device *pdev)
627 return 0; 627 return 0;
628} 628}
629 629
630#ifdef CONFIG_PM_SLEEP
631static int tegra30_ahub_suspend(struct device *dev)
632{
633 regcache_mark_dirty(ahub->regmap_ahub);
634 regcache_mark_dirty(ahub->regmap_apbif);
635
636 return 0;
637}
638
639static int tegra30_ahub_resume(struct device *dev)
640{
641 int ret;
642
643 ret = pm_runtime_get_sync(dev);
644 if (ret < 0)
645 return ret;
646 ret = regcache_sync(ahub->regmap_ahub);
647 ret |= regcache_sync(ahub->regmap_apbif);
648 pm_runtime_put(dev);
649
650 return ret;
651}
652#endif
653
630static const struct dev_pm_ops tegra30_ahub_pm_ops = { 654static const struct dev_pm_ops tegra30_ahub_pm_ops = {
631 SET_RUNTIME_PM_OPS(tegra30_ahub_runtime_suspend, 655 SET_RUNTIME_PM_OPS(tegra30_ahub_runtime_suspend,
632 tegra30_ahub_runtime_resume, NULL) 656 tegra30_ahub_runtime_resume, NULL)
657 SET_SYSTEM_SLEEP_PM_OPS(tegra30_ahub_suspend, tegra30_ahub_resume)
633}; 658};
634 659
635static struct platform_driver tegra30_ahub_driver = { 660static struct platform_driver tegra30_ahub_driver = {
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c
index 31d092d83c71..d04146cad61f 100644
--- a/sound/soc/tegra/tegra30_i2s.c
+++ b/sound/soc/tegra/tegra30_i2s.c
@@ -514,6 +514,31 @@ static int tegra30_i2s_platform_remove(struct platform_device *pdev)
514 return 0; 514 return 0;
515} 515}
516 516
517#ifdef CONFIG_PM_SLEEP
518static int tegra30_i2s_suspend(struct device *dev)
519{
520 struct tegra30_i2s *i2s = dev_get_drvdata(dev);
521
522 regcache_mark_dirty(i2s->regmap);
523
524 return 0;
525}
526
527static int tegra30_i2s_resume(struct device *dev)
528{
529 struct tegra30_i2s *i2s = dev_get_drvdata(dev);
530 int ret;
531
532 ret = pm_runtime_get_sync(dev);
533 if (ret < 0)
534 return ret;
535 ret = regcache_sync(i2s->regmap);
536 pm_runtime_put(dev);
537
538 return ret;
539}
540#endif
541
517static const struct of_device_id tegra30_i2s_of_match[] = { 542static const struct of_device_id tegra30_i2s_of_match[] = {
518 { .compatible = "nvidia,tegra30-i2s", }, 543 { .compatible = "nvidia,tegra30-i2s", },
519 {}, 544 {},
@@ -522,6 +547,7 @@ static const struct of_device_id tegra30_i2s_of_match[] = {
522static const struct dev_pm_ops tegra30_i2s_pm_ops = { 547static const struct dev_pm_ops tegra30_i2s_pm_ops = {
523 SET_RUNTIME_PM_OPS(tegra30_i2s_runtime_suspend, 548 SET_RUNTIME_PM_OPS(tegra30_i2s_runtime_suspend,
524 tegra30_i2s_runtime_resume, NULL) 549 tegra30_i2s_runtime_resume, NULL)
550 SET_SYSTEM_SLEEP_PM_OPS(tegra30_i2s_suspend, tegra30_i2s_resume)
525}; 551};
526 552
527static struct platform_driver tegra30_i2s_driver = { 553static struct platform_driver tegra30_i2s_driver = {
diff --git a/sound/soc/tegra/tegra_asoc_utils.c b/sound/soc/tegra/tegra_asoc_utils.c
index 24fb001be7f4..d173880f290d 100644
--- a/sound/soc/tegra/tegra_asoc_utils.c
+++ b/sound/soc/tegra/tegra_asoc_utils.c
@@ -173,7 +173,6 @@ int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data,
173 struct device *dev) 173 struct device *dev)
174{ 174{
175 int ret; 175 int ret;
176 bool new_clocks = false;
177 176
178 data->dev = dev; 177 data->dev = dev;
179 178
@@ -181,40 +180,28 @@ int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data,
181 data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA20; 180 data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA20;
182 else if (of_machine_is_compatible("nvidia,tegra30")) 181 else if (of_machine_is_compatible("nvidia,tegra30"))
183 data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA30; 182 data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA30;
184 else if (of_machine_is_compatible("nvidia,tegra114")) { 183 else if (of_machine_is_compatible("nvidia,tegra114"))
185 data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA114; 184 data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA114;
186 new_clocks = true; 185 else {
187 } else {
188 dev_err(data->dev, "SoC unknown to Tegra ASoC utils\n"); 186 dev_err(data->dev, "SoC unknown to Tegra ASoC utils\n");
189 return -EINVAL; 187 return -EINVAL;
190 } 188 }
191 189
192 if (new_clocks) 190 data->clk_pll_a = clk_get(dev, "pll_a");
193 data->clk_pll_a = clk_get(dev, "pll_a");
194 else
195 data->clk_pll_a = clk_get_sys(NULL, "pll_a");
196 if (IS_ERR(data->clk_pll_a)) { 191 if (IS_ERR(data->clk_pll_a)) {
197 dev_err(data->dev, "Can't retrieve clk pll_a\n"); 192 dev_err(data->dev, "Can't retrieve clk pll_a\n");
198 ret = PTR_ERR(data->clk_pll_a); 193 ret = PTR_ERR(data->clk_pll_a);
199 goto err; 194 goto err;
200 } 195 }
201 196
202 if (new_clocks) 197 data->clk_pll_a_out0 = clk_get(dev, "pll_a_out0");
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");
206 if (IS_ERR(data->clk_pll_a_out0)) { 198 if (IS_ERR(data->clk_pll_a_out0)) {
207 dev_err(data->dev, "Can't retrieve clk pll_a_out0\n"); 199 dev_err(data->dev, "Can't retrieve clk pll_a_out0\n");
208 ret = PTR_ERR(data->clk_pll_a_out0); 200 ret = PTR_ERR(data->clk_pll_a_out0);
209 goto err_put_pll_a; 201 goto err_put_pll_a;
210 } 202 }
211 203
212 if (new_clocks) 204 data->clk_cdev1 = clk_get(dev, "mclk");
213 data->clk_cdev1 = clk_get(dev, "mclk");
214 else if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA20)
215 data->clk_cdev1 = clk_get_sys(NULL, "cdev1");
216 else
217 data->clk_cdev1 = clk_get_sys("extern1", NULL);
218 if (IS_ERR(data->clk_cdev1)) { 205 if (IS_ERR(data->clk_cdev1)) {
219 dev_err(data->dev, "Can't retrieve clk cdev1\n"); 206 dev_err(data->dev, "Can't retrieve clk cdev1\n");
220 ret = PTR_ERR(data->clk_cdev1); 207 ret = PTR_ERR(data->clk_cdev1);