aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2013-11-06 17:18:22 -0500
committerStephen Warren <swarren@nvidia.com>2013-12-11 18:43:35 -0500
commit5185e0acc831e250257ba04f5204dc5f5c1e5d0a (patch)
treec2fbc955e54aeab1a70ab811d944b46f1c91abf6 /sound/soc
parent996556c92a706058cf5ce6b3ef8dacc4032a3e0d (diff)
ASoC: tegra: use reset framework
Tegra's clock driver now provides an implementation of the common reset API (include/linux/reset.h). Use this instead of the old Tegra- specific API; that will soon be removed. This change also renames "clock"/"clk" to "modules"/"mod" in symbols related to entries in configlink_clocks[], since: - We don't care about clock handles any more, but rather reset handles, so the old name isn't applicable. - It really is a list of modules on the bus, about which we currently only care about reset handles. If we start caring about any other aspect of the modules in the future, we won't have to rename all these symbols again. Note: The addition of "depends COMMON_CLOCK" is something that was missing before, not a new requirement. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Mark Brown <broonie@linaro.org> Reviewed-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/tegra/Kconfig2
-rw-r--r--sound/soc/tegra/tegra30_ahub.c71
-rw-r--r--sound/soc/tegra/tegra30_ahub.h2
3 files changed, 41 insertions, 34 deletions
diff --git a/sound/soc/tegra/Kconfig b/sound/soc/tegra/Kconfig
index 8fc653ca3ab4..896292bb853f 100644
--- a/sound/soc/tegra/Kconfig
+++ b/sound/soc/tegra/Kconfig
@@ -1,6 +1,8 @@
1config SND_SOC_TEGRA 1config SND_SOC_TEGRA
2 tristate "SoC Audio for the Tegra System-on-Chip" 2 tristate "SoC Audio for the Tegra System-on-Chip"
3 depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST 3 depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST
4 depends on COMMON_CLK
5 depends on RESET_CONTROLLER
4 select REGMAP_MMIO 6 select REGMAP_MMIO
5 select SND_SOC_GENERIC_DMAENGINE_PCM 7 select SND_SOC_GENERIC_DMAENGINE_PCM
6 help 8 help
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
index 31154338c1eb..38c6962b7d66 100644
--- a/sound/soc/tegra/tegra30_ahub.c
+++ b/sound/soc/tegra/tegra30_ahub.c
@@ -24,8 +24,8 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/pm_runtime.h> 25#include <linux/pm_runtime.h>
26#include <linux/regmap.h> 26#include <linux/regmap.h>
27#include <linux/reset.h>
27#include <linux/slab.h> 28#include <linux/slab.h>
28#include <linux/clk/tegra.h>
29#include <sound/soc.h> 29#include <sound/soc.h>
30#include "tegra30_ahub.h" 30#include "tegra30_ahub.h"
31 31
@@ -301,27 +301,27 @@ int tegra30_ahub_unset_rx_cif_source(enum tegra30_ahub_rxcif rxcif)
301} 301}
302EXPORT_SYMBOL_GPL(tegra30_ahub_unset_rx_cif_source); 302EXPORT_SYMBOL_GPL(tegra30_ahub_unset_rx_cif_source);
303 303
304#define CLK_LIST_MASK_TEGRA30 BIT(0) 304#define MOD_LIST_MASK_TEGRA30 BIT(0)
305#define CLK_LIST_MASK_TEGRA114 BIT(1) 305#define MOD_LIST_MASK_TEGRA114 BIT(1)
306 306
307#define CLK_LIST_MASK_TEGRA30_OR_LATER \ 307#define MOD_LIST_MASK_TEGRA30_OR_LATER \
308 (CLK_LIST_MASK_TEGRA30 | CLK_LIST_MASK_TEGRA114) 308 (MOD_LIST_MASK_TEGRA30 | MOD_LIST_MASK_TEGRA114)
309 309
310static const struct { 310static const struct {
311 const char *clk_name; 311 const char *rst_name;
312 u32 clk_list_mask; 312 u32 mod_list_mask;
313} configlink_clocks[] = { 313} configlink_mods[] = {
314 { "i2s0", CLK_LIST_MASK_TEGRA30_OR_LATER }, 314 { "i2s0", MOD_LIST_MASK_TEGRA30_OR_LATER },
315 { "i2s1", CLK_LIST_MASK_TEGRA30_OR_LATER }, 315 { "i2s1", MOD_LIST_MASK_TEGRA30_OR_LATER },
316 { "i2s2", CLK_LIST_MASK_TEGRA30_OR_LATER }, 316 { "i2s2", MOD_LIST_MASK_TEGRA30_OR_LATER },
317 { "i2s3", CLK_LIST_MASK_TEGRA30_OR_LATER }, 317 { "i2s3", MOD_LIST_MASK_TEGRA30_OR_LATER },
318 { "i2s4", CLK_LIST_MASK_TEGRA30_OR_LATER }, 318 { "i2s4", MOD_LIST_MASK_TEGRA30_OR_LATER },
319 { "dam0", CLK_LIST_MASK_TEGRA30_OR_LATER }, 319 { "dam0", MOD_LIST_MASK_TEGRA30_OR_LATER },
320 { "dam1", CLK_LIST_MASK_TEGRA30_OR_LATER }, 320 { "dam1", MOD_LIST_MASK_TEGRA30_OR_LATER },
321 { "dam2", CLK_LIST_MASK_TEGRA30_OR_LATER }, 321 { "dam2", MOD_LIST_MASK_TEGRA30_OR_LATER },
322 { "spdif_in", CLK_LIST_MASK_TEGRA30_OR_LATER }, 322 { "spdif", MOD_LIST_MASK_TEGRA30_OR_LATER },
323 { "amx", CLK_LIST_MASK_TEGRA114 }, 323 { "amx", MOD_LIST_MASK_TEGRA114 },
324 { "adx", CLK_LIST_MASK_TEGRA114 }, 324 { "adx", MOD_LIST_MASK_TEGRA114 },
325}; 325};
326 326
327#define LAST_REG(name) \ 327#define LAST_REG(name) \
@@ -450,17 +450,17 @@ static const struct regmap_config tegra30_ahub_ahub_regmap_config = {
450}; 450};
451 451
452static struct tegra30_ahub_soc_data soc_data_tegra30 = { 452static struct tegra30_ahub_soc_data soc_data_tegra30 = {
453 .clk_list_mask = CLK_LIST_MASK_TEGRA30, 453 .mod_list_mask = MOD_LIST_MASK_TEGRA30,
454 .set_audio_cif = tegra30_ahub_set_cif, 454 .set_audio_cif = tegra30_ahub_set_cif,
455}; 455};
456 456
457static struct tegra30_ahub_soc_data soc_data_tegra114 = { 457static struct tegra30_ahub_soc_data soc_data_tegra114 = {
458 .clk_list_mask = CLK_LIST_MASK_TEGRA114, 458 .mod_list_mask = MOD_LIST_MASK_TEGRA114,
459 .set_audio_cif = tegra30_ahub_set_cif, 459 .set_audio_cif = tegra30_ahub_set_cif,
460}; 460};
461 461
462static struct tegra30_ahub_soc_data soc_data_tegra124 = { 462static struct tegra30_ahub_soc_data soc_data_tegra124 = {
463 .clk_list_mask = CLK_LIST_MASK_TEGRA114, 463 .mod_list_mask = MOD_LIST_MASK_TEGRA114,
464 .set_audio_cif = tegra124_ahub_set_cif, 464 .set_audio_cif = tegra124_ahub_set_cif,
465}; 465};
466 466
@@ -475,7 +475,7 @@ static int tegra30_ahub_probe(struct platform_device *pdev)
475{ 475{
476 const struct of_device_id *match; 476 const struct of_device_id *match;
477 const struct tegra30_ahub_soc_data *soc_data; 477 const struct tegra30_ahub_soc_data *soc_data;
478 struct clk *clk; 478 struct reset_control *rst;
479 int i; 479 int i;
480 struct resource *res0, *res1, *region; 480 struct resource *res0, *res1, *region;
481 u32 of_dma[2]; 481 u32 of_dma[2];
@@ -495,19 +495,24 @@ static int tegra30_ahub_probe(struct platform_device *pdev)
495 * operate correctly, all devices on this bus must be out of reset. 495 * operate correctly, all devices on this bus must be out of reset.
496 * Ensure that here. 496 * Ensure that here.
497 */ 497 */
498 for (i = 0; i < ARRAY_SIZE(configlink_clocks); i++) { 498 for (i = 0; i < ARRAY_SIZE(configlink_mods); i++) {
499 if (!(configlink_clocks[i].clk_list_mask & 499 if (!(configlink_mods[i].mod_list_mask &
500 soc_data->clk_list_mask)) 500 soc_data->mod_list_mask))
501 continue; 501 continue;
502 clk = clk_get(&pdev->dev, configlink_clocks[i].clk_name); 502
503 if (IS_ERR(clk)) { 503 rst = reset_control_get(&pdev->dev,
504 dev_err(&pdev->dev, "Can't get clock %s\n", 504 configlink_mods[i].rst_name);
505 configlink_clocks[i].clk_name); 505 if (IS_ERR(rst)) {
506 ret = PTR_ERR(clk); 506 dev_err(&pdev->dev, "Can't get reset %s\n",
507 configlink_mods[i].rst_name);
508 ret = PTR_ERR(rst);
507 goto err; 509 goto err;
508 } 510 }
509 tegra_periph_reset_deassert(clk); 511
510 clk_put(clk); 512 ret = reset_control_deassert(rst);
513 reset_control_put(rst);
514 if (ret)
515 goto err;
511 } 516 }
512 517
513 ahub = devm_kzalloc(&pdev->dev, sizeof(struct tegra30_ahub), 518 ahub = devm_kzalloc(&pdev->dev, sizeof(struct tegra30_ahub),
diff --git a/sound/soc/tegra/tegra30_ahub.h b/sound/soc/tegra/tegra30_ahub.h
index d67321d90faa..1383f8cd3572 100644
--- a/sound/soc/tegra/tegra30_ahub.h
+++ b/sound/soc/tegra/tegra30_ahub.h
@@ -502,7 +502,7 @@ void tegra124_ahub_set_cif(struct regmap *regmap, unsigned int reg,
502 struct tegra30_ahub_cif_conf *conf); 502 struct tegra30_ahub_cif_conf *conf);
503 503
504struct tegra30_ahub_soc_data { 504struct tegra30_ahub_soc_data {
505 u32 clk_list_mask; 505 u32 mod_list_mask;
506 void (*set_audio_cif)(struct regmap *regmap, 506 void (*set_audio_cif)(struct regmap *regmap,
507 unsigned int reg, 507 unsigned int reg,
508 struct tegra30_ahub_cif_conf *conf); 508 struct tegra30_ahub_cif_conf *conf);