diff options
-rw-r--r-- | sound/soc/tegra/tegra_asoc_utils.c | 29 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_asoc_utils.h | 9 |
2 files changed, 31 insertions, 7 deletions
diff --git a/sound/soc/tegra/tegra_asoc_utils.c b/sound/soc/tegra/tegra_asoc_utils.c index 30424e157f69..266189d4ff13 100644 --- a/sound/soc/tegra/tegra_asoc_utils.c +++ b/sound/soc/tegra/tegra_asoc_utils.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * tegra_asoc_utils.c - Harmony machine ASoC driver | 2 | * tegra_asoc_utils.c - Harmony machine ASoC driver |
3 | * | 3 | * |
4 | * Author: Stephen Warren <swarren@nvidia.com> | 4 | * Author: Stephen Warren <swarren@nvidia.com> |
5 | * Copyright (C) 2010 - NVIDIA, Inc. | 5 | * Copyright (C) 2010,2012 - NVIDIA, Inc. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/of.h> | ||
28 | 29 | ||
29 | #include "tegra_asoc_utils.h" | 30 | #include "tegra_asoc_utils.h" |
30 | 31 | ||
@@ -40,7 +41,10 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate, | |||
40 | case 22050: | 41 | case 22050: |
41 | case 44100: | 42 | case 44100: |
42 | case 88200: | 43 | case 88200: |
43 | new_baseclock = 56448000; | 44 | if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA20) |
45 | new_baseclock = 56448000; | ||
46 | else | ||
47 | new_baseclock = 564480000; | ||
44 | break; | 48 | break; |
45 | case 8000: | 49 | case 8000: |
46 | case 16000: | 50 | case 16000: |
@@ -48,7 +52,10 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate, | |||
48 | case 48000: | 52 | case 48000: |
49 | case 64000: | 53 | case 64000: |
50 | case 96000: | 54 | case 96000: |
51 | new_baseclock = 73728000; | 55 | if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA20) |
56 | new_baseclock = 73728000; | ||
57 | else | ||
58 | new_baseclock = 552960000; | ||
52 | break; | 59 | break; |
53 | default: | 60 | default: |
54 | return -EINVAL; | 61 | return -EINVAL; |
@@ -78,7 +85,7 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate, | |||
78 | return err; | 85 | return err; |
79 | } | 86 | } |
80 | 87 | ||
81 | /* Don't set cdev1 rate; its locked to pll_a_out0 */ | 88 | /* Don't set cdev1/extern1 rate; it's locked to pll_a_out0 */ |
82 | 89 | ||
83 | err = clk_enable(data->clk_pll_a); | 90 | err = clk_enable(data->clk_pll_a); |
84 | if (err) { | 91 | if (err) { |
@@ -112,6 +119,15 @@ int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data, | |||
112 | 119 | ||
113 | data->dev = dev; | 120 | data->dev = dev; |
114 | 121 | ||
122 | if (!of_have_populated_dt()) | ||
123 | data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA20; | ||
124 | else if (of_machine_is_compatible("nvidia,tegra20")) | ||
125 | data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA20; | ||
126 | else if (of_machine_is_compatible("nvidia,tegra30")) | ||
127 | data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA30; | ||
128 | else | ||
129 | return -EINVAL; | ||
130 | |||
115 | data->clk_pll_a = clk_get_sys(NULL, "pll_a"); | 131 | data->clk_pll_a = clk_get_sys(NULL, "pll_a"); |
116 | if (IS_ERR(data->clk_pll_a)) { | 132 | if (IS_ERR(data->clk_pll_a)) { |
117 | dev_err(data->dev, "Can't retrieve clk pll_a\n"); | 133 | dev_err(data->dev, "Can't retrieve clk pll_a\n"); |
@@ -126,7 +142,10 @@ int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data, | |||
126 | goto err_put_pll_a; | 142 | goto err_put_pll_a; |
127 | } | 143 | } |
128 | 144 | ||
129 | data->clk_cdev1 = clk_get_sys(NULL, "cdev1"); | 145 | if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA20) |
146 | data->clk_cdev1 = clk_get_sys(NULL, "cdev1"); | ||
147 | else | ||
148 | data->clk_cdev1 = clk_get_sys("extern1", NULL); | ||
130 | if (IS_ERR(data->clk_cdev1)) { | 149 | if (IS_ERR(data->clk_cdev1)) { |
131 | dev_err(data->dev, "Can't retrieve clk cdev1\n"); | 150 | dev_err(data->dev, "Can't retrieve clk cdev1\n"); |
132 | ret = PTR_ERR(data->clk_cdev1); | 151 | ret = PTR_ERR(data->clk_cdev1); |
diff --git a/sound/soc/tegra/tegra_asoc_utils.h b/sound/soc/tegra/tegra_asoc_utils.h index 4818195da25c..44db1dbb8f21 100644 --- a/sound/soc/tegra/tegra_asoc_utils.h +++ b/sound/soc/tegra/tegra_asoc_utils.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * tegra_asoc_utils.h - Definitions for Tegra DAS driver | 2 | * tegra_asoc_utils.h - Definitions for Tegra DAS driver |
3 | * | 3 | * |
4 | * Author: Stephen Warren <swarren@nvidia.com> | 4 | * Author: Stephen Warren <swarren@nvidia.com> |
5 | * Copyright (C) 2010 - NVIDIA, Inc. | 5 | * Copyright (C) 2010,2012 - NVIDIA, Inc. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
@@ -26,8 +26,14 @@ | |||
26 | struct clk; | 26 | struct clk; |
27 | struct device; | 27 | struct device; |
28 | 28 | ||
29 | enum tegra_asoc_utils_soc { | ||
30 | TEGRA_ASOC_UTILS_SOC_TEGRA20, | ||
31 | TEGRA_ASOC_UTILS_SOC_TEGRA30, | ||
32 | }; | ||
33 | |||
29 | struct tegra_asoc_utils_data { | 34 | struct tegra_asoc_utils_data { |
30 | struct device *dev; | 35 | struct device *dev; |
36 | enum tegra_asoc_utils_soc soc; | ||
31 | struct clk *clk_pll_a; | 37 | struct clk *clk_pll_a; |
32 | struct clk *clk_pll_a_out0; | 38 | struct clk *clk_pll_a_out0; |
33 | struct clk *clk_cdev1; | 39 | struct clk *clk_cdev1; |
@@ -42,4 +48,3 @@ int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data, | |||
42 | void tegra_asoc_utils_fini(struct tegra_asoc_utils_data *data); | 48 | void tegra_asoc_utils_fini(struct tegra_asoc_utils_data *data); |
43 | 49 | ||
44 | #endif | 50 | #endif |
45 | |||