diff options
-rw-r--r-- | Documentation/devicetree/bindings/sound/nvidia,tegra30-ahub.txt | 26 | ||||
-rw-r--r-- | include/sound/tegra_wm8903.h | 26 | ||||
-rw-r--r-- | sound/soc/tegra/tegra30_ahub.c | 64 | ||||
-rw-r--r-- | sound/soc/tegra/tegra30_ahub.h | 16 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_alc5632.c | 15 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_asoc_utils.c | 34 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_asoc_utils.h | 1 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_wm8753.c | 15 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_wm8903.c | 179 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_wm9712.c | 5 | ||||
-rw-r--r-- | sound/soc/tegra/trimslice.c | 56 |
11 files changed, 214 insertions, 223 deletions
diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra30-ahub.txt b/Documentation/devicetree/bindings/sound/nvidia,tegra30-ahub.txt index 1ac7b1642186..0e5c12c66523 100644 --- a/Documentation/devicetree/bindings/sound/nvidia,tegra30-ahub.txt +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra30-ahub.txt | |||
@@ -1,12 +1,22 @@ | |||
1 | NVIDIA Tegra30 AHUB (Audio Hub) | 1 | NVIDIA Tegra30 AHUB (Audio Hub) |
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : "nvidia,tegra30-ahub" | 4 | - compatible : "nvidia,tegra30-ahub", "nvidia,tegra114-ahub", etc. |
5 | - reg : Should contain the register physical address and length for each of | 5 | - reg : Should contain the register physical address and length for each of |
6 | the AHUB's APBIF registers and the AHUB's own registers. | 6 | the AHUB's register blocks. |
7 | - Tegra30 requires 2 entries, for the APBIF and AHUB/AUDIO register blocks. | ||
8 | - Tegra114 requires an additional entry, for the APBIF2 register block. | ||
7 | - interrupts : Should contain AHUB interrupt | 9 | - interrupts : Should contain AHUB interrupt |
8 | - nvidia,dma-request-selector : The Tegra DMA controller's phandle and | 10 | - nvidia,dma-request-selector : A list of the DMA channel specifiers. Each |
9 | request selector for the first APBIF channel. | 11 | entry contains the Tegra DMA controller's phandle and request selector. |
12 | If a single entry is present, the request selectors for the channels are | ||
13 | assumed to be contiguous, and increment from this value. | ||
14 | If multiple values are given, one value must be given per channel. | ||
15 | - clocks : Must contain an entry for each required entry in clock-names. | ||
16 | - clock-names : Must include the following entries: | ||
17 | - Tegra30: Requires d_audio, apbif, i2s0, i2s1, i2s2, i2s3, i2s4, dam0, | ||
18 | dam1, dam2, spdif_in. | ||
19 | - Tegra114: Additionally requires amx, adx. | ||
10 | - ranges : The bus address mapping for the configlink register bus. | 20 | - ranges : The bus address mapping for the configlink register bus. |
11 | Can be empty since the mapping is 1:1. | 21 | Can be empty since the mapping is 1:1. |
12 | - #address-cells : For the configlink bus. Should be <1>; | 22 | - #address-cells : For the configlink bus. Should be <1>; |
@@ -25,7 +35,13 @@ ahub@70080000 { | |||
25 | reg = <0x70080000 0x200 0x70080200 0x100>; | 35 | reg = <0x70080000 0x200 0x70080200 0x100>; |
26 | interrupts = < 0 103 0x04 >; | 36 | interrupts = < 0 103 0x04 >; |
27 | nvidia,dma-request-selector = <&apbdma 1>; | 37 | nvidia,dma-request-selector = <&apbdma 1>; |
28 | 38 | clocks = <&tegra_car 106>, <&tegra_car 107>, <&tegra_car 30>, | |
39 | <&tegra_car 11>, <&tegra_car 18>, <&tegra_car 101>, | ||
40 | <&tegra_car 102>, <&tegra_car 108>, <&tegra_car 109>, | ||
41 | <&tegra_car 110>, <&tegra_car 162>; | ||
42 | clock-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2", | ||
43 | "i2s3", "i2s4", "dam0", "dam1", "dam2", | ||
44 | "spdif_in"; | ||
29 | ranges; | 45 | ranges; |
30 | #address-cells = <1>; | 46 | #address-cells = <1>; |
31 | #size-cells = <1>; | 47 | #size-cells = <1>; |
diff --git a/include/sound/tegra_wm8903.h b/include/sound/tegra_wm8903.h deleted file mode 100644 index 57b202ee97c3..000000000000 --- a/include/sound/tegra_wm8903.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2011 NVIDIA, Inc. | ||
3 | * | ||
4 | * This software is licensed under the terms of the GNU General Public | ||
5 | * License version 2, as published by the Free Software Foundation, and | ||
6 | * may be copied, distributed, and modified under those terms. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #ifndef __SOUND_TEGRA_WM38903_H | ||
16 | #define __SOUND_TEGRA_WM38903_H | ||
17 | |||
18 | struct tegra_wm8903_platform_data { | ||
19 | int gpio_spkr_en; | ||
20 | int gpio_hp_det; | ||
21 | int gpio_hp_mute; | ||
22 | int gpio_int_mic_en; | ||
23 | int gpio_ext_mic_en; | ||
24 | }; | ||
25 | |||
26 | #endif | ||
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index 5e08f3e7e6cf..23e592f453fa 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c | |||
@@ -287,16 +287,27 @@ int tegra30_ahub_unset_rx_cif_source(enum tegra30_ahub_rxcif rxcif) | |||
287 | } | 287 | } |
288 | EXPORT_SYMBOL_GPL(tegra30_ahub_unset_rx_cif_source); | 288 | EXPORT_SYMBOL_GPL(tegra30_ahub_unset_rx_cif_source); |
289 | 289 | ||
290 | static const char * const configlink_clocks[] = { | 290 | #define CLK_LIST_MASK_TEGRA30 BIT(0) |
291 | "i2s0", | 291 | #define CLK_LIST_MASK_TEGRA114 BIT(1) |
292 | "i2s1", | 292 | |
293 | "i2s2", | 293 | #define CLK_LIST_MASK_TEGRA30_OR_LATER \ |
294 | "i2s3", | 294 | (CLK_LIST_MASK_TEGRA30 | CLK_LIST_MASK_TEGRA114) |
295 | "i2s4", | 295 | |
296 | "dam0", | 296 | static const struct { |
297 | "dam1", | 297 | const char *clk_name; |
298 | "dam2", | 298 | u32 clk_list_mask; |
299 | "spdif_in", | 299 | } configlink_clocks[] = { |
300 | { "i2s0", CLK_LIST_MASK_TEGRA30_OR_LATER }, | ||
301 | { "i2s1", CLK_LIST_MASK_TEGRA30_OR_LATER }, | ||
302 | { "i2s2", CLK_LIST_MASK_TEGRA30_OR_LATER }, | ||
303 | { "i2s3", CLK_LIST_MASK_TEGRA30_OR_LATER }, | ||
304 | { "i2s4", CLK_LIST_MASK_TEGRA30_OR_LATER }, | ||
305 | { "dam0", CLK_LIST_MASK_TEGRA30_OR_LATER }, | ||
306 | { "dam1", CLK_LIST_MASK_TEGRA30_OR_LATER }, | ||
307 | { "dam2", CLK_LIST_MASK_TEGRA30_OR_LATER }, | ||
308 | { "spdif_in", CLK_LIST_MASK_TEGRA30_OR_LATER }, | ||
309 | { "amx", CLK_LIST_MASK_TEGRA114 }, | ||
310 | { "adx", CLK_LIST_MASK_TEGRA114 }, | ||
300 | }; | 311 | }; |
301 | 312 | ||
302 | #define LAST_REG(name) \ | 313 | #define LAST_REG(name) \ |
@@ -424,8 +435,24 @@ static const struct regmap_config tegra30_ahub_ahub_regmap_config = { | |||
424 | .cache_type = REGCACHE_RBTREE, | 435 | .cache_type = REGCACHE_RBTREE, |
425 | }; | 436 | }; |
426 | 437 | ||
438 | static struct tegra30_ahub_soc_data soc_data_tegra30 = { | ||
439 | .clk_list_mask = CLK_LIST_MASK_TEGRA30, | ||
440 | }; | ||
441 | |||
442 | static struct tegra30_ahub_soc_data soc_data_tegra114 = { | ||
443 | .clk_list_mask = CLK_LIST_MASK_TEGRA114, | ||
444 | }; | ||
445 | |||
446 | static const struct of_device_id tegra30_ahub_of_match[] = { | ||
447 | { .compatible = "nvidia,tegra114-ahub", .data = &soc_data_tegra114 }, | ||
448 | { .compatible = "nvidia,tegra30-ahub", .data = &soc_data_tegra30 }, | ||
449 | {}, | ||
450 | }; | ||
451 | |||
427 | static int tegra30_ahub_probe(struct platform_device *pdev) | 452 | static int tegra30_ahub_probe(struct platform_device *pdev) |
428 | { | 453 | { |
454 | const struct of_device_id *match; | ||
455 | const struct tegra30_ahub_soc_data *soc_data; | ||
429 | struct clk *clk; | 456 | struct clk *clk; |
430 | int i; | 457 | int i; |
431 | struct resource *res0, *res1, *region; | 458 | struct resource *res0, *res1, *region; |
@@ -436,16 +463,24 @@ static int tegra30_ahub_probe(struct platform_device *pdev) | |||
436 | if (ahub) | 463 | if (ahub) |
437 | return -ENODEV; | 464 | return -ENODEV; |
438 | 465 | ||
466 | match = of_match_device(tegra30_ahub_of_match, &pdev->dev); | ||
467 | if (!match) | ||
468 | return -EINVAL; | ||
469 | soc_data = match->data; | ||
470 | |||
439 | /* | 471 | /* |
440 | * The AHUB hosts a register bus: the "configlink". For this to | 472 | * The AHUB hosts a register bus: the "configlink". For this to |
441 | * operate correctly, all devices on this bus must be out of reset. | 473 | * operate correctly, all devices on this bus must be out of reset. |
442 | * Ensure that here. | 474 | * Ensure that here. |
443 | */ | 475 | */ |
444 | for (i = 0; i < ARRAY_SIZE(configlink_clocks); i++) { | 476 | for (i = 0; i < ARRAY_SIZE(configlink_clocks); i++) { |
445 | clk = clk_get(&pdev->dev, configlink_clocks[i]); | 477 | if (!(configlink_clocks[i].clk_list_mask & |
478 | soc_data->clk_list_mask)) | ||
479 | continue; | ||
480 | clk = clk_get(&pdev->dev, configlink_clocks[i].clk_name); | ||
446 | if (IS_ERR(clk)) { | 481 | if (IS_ERR(clk)) { |
447 | dev_err(&pdev->dev, "Can't get clock %s\n", | 482 | dev_err(&pdev->dev, "Can't get clock %s\n", |
448 | configlink_clocks[i]); | 483 | configlink_clocks[i].clk_name); |
449 | ret = PTR_ERR(clk); | 484 | ret = PTR_ERR(clk); |
450 | goto err; | 485 | goto err; |
451 | } | 486 | } |
@@ -592,11 +627,6 @@ static int tegra30_ahub_remove(struct platform_device *pdev) | |||
592 | return 0; | 627 | return 0; |
593 | } | 628 | } |
594 | 629 | ||
595 | static const struct of_device_id tegra30_ahub_of_match[] = { | ||
596 | { .compatible = "nvidia,tegra30-ahub", }, | ||
597 | {}, | ||
598 | }; | ||
599 | |||
600 | static const struct dev_pm_ops tegra30_ahub_pm_ops = { | 630 | static const struct dev_pm_ops tegra30_ahub_pm_ops = { |
601 | SET_RUNTIME_PM_OPS(tegra30_ahub_runtime_suspend, | 631 | SET_RUNTIME_PM_OPS(tegra30_ahub_runtime_suspend, |
602 | tegra30_ahub_runtime_resume, NULL) | 632 | tegra30_ahub_runtime_resume, NULL) |
diff --git a/sound/soc/tegra/tegra30_ahub.h b/sound/soc/tegra/tegra30_ahub.h index b7d7c1a30302..09766cdc45ca 100644 --- a/sound/soc/tegra/tegra30_ahub.h +++ b/sound/soc/tegra/tegra30_ahub.h | |||
@@ -468,7 +468,23 @@ extern int tegra30_ahub_set_rx_cif_source(enum tegra30_ahub_rxcif rxcif, | |||
468 | enum tegra30_ahub_txcif txcif); | 468 | enum tegra30_ahub_txcif txcif); |
469 | extern int tegra30_ahub_unset_rx_cif_source(enum tegra30_ahub_rxcif rxcif); | 469 | extern int tegra30_ahub_unset_rx_cif_source(enum tegra30_ahub_rxcif rxcif); |
470 | 470 | ||
471 | struct tegra30_ahub_soc_data { | ||
472 | u32 clk_list_mask; | ||
473 | /* | ||
474 | * FIXME: There are many more differences in HW, such as: | ||
475 | * - More APBIF channels. | ||
476 | * - Extra separate chunks of register address space to represent | ||
477 | * the extra APBIF channels. | ||
478 | * - More units connected to the AHUB, so that tegra30_ahub_[rt]xcif | ||
479 | * need expansion, coupled with there being more defined bits in | ||
480 | * the AHUB routing registers. | ||
481 | * However, the driver doesn't support those new features yet, so we | ||
482 | * don't represent them here yet. | ||
483 | */ | ||
484 | }; | ||
485 | |||
471 | struct tegra30_ahub { | 486 | struct tegra30_ahub { |
487 | const struct tegra30_ahub_soc_data *soc_data; | ||
472 | struct device *dev; | 488 | struct device *dev; |
473 | struct clk *clk_d_audio; | 489 | struct clk *clk_d_audio; |
474 | struct clk *clk_apbif; | 490 | struct clk *clk_apbif; |
diff --git a/sound/soc/tegra/tegra_alc5632.c b/sound/soc/tegra/tegra_alc5632.c index c80adb9da472..48d05d9e1002 100644 --- a/sound/soc/tegra/tegra_alc5632.c +++ b/sound/soc/tegra/tegra_alc5632.c | |||
@@ -161,20 +161,13 @@ static int tegra_alc5632_probe(struct platform_device *pdev) | |||
161 | sizeof(struct tegra_alc5632), GFP_KERNEL); | 161 | sizeof(struct tegra_alc5632), GFP_KERNEL); |
162 | if (!alc5632) { | 162 | if (!alc5632) { |
163 | dev_err(&pdev->dev, "Can't allocate tegra_alc5632\n"); | 163 | dev_err(&pdev->dev, "Can't allocate tegra_alc5632\n"); |
164 | ret = -ENOMEM; | 164 | return -ENOMEM; |
165 | goto err; | ||
166 | } | 165 | } |
167 | 166 | ||
168 | card->dev = &pdev->dev; | 167 | card->dev = &pdev->dev; |
169 | platform_set_drvdata(pdev, card); | 168 | platform_set_drvdata(pdev, card); |
170 | snd_soc_card_set_drvdata(card, alc5632); | 169 | snd_soc_card_set_drvdata(card, alc5632); |
171 | 170 | ||
172 | if (!(pdev->dev.of_node)) { | ||
173 | dev_err(&pdev->dev, "Must be instantiated using device tree\n"); | ||
174 | ret = -EINVAL; | ||
175 | goto err; | ||
176 | } | ||
177 | |||
178 | alc5632->gpio_hp_det = of_get_named_gpio(np, "nvidia,hp-det-gpios", 0); | 171 | alc5632->gpio_hp_det = of_get_named_gpio(np, "nvidia,hp-det-gpios", 0); |
179 | if (alc5632->gpio_hp_det == -EPROBE_DEFER) | 172 | if (alc5632->gpio_hp_det == -EPROBE_DEFER) |
180 | return -EPROBE_DEFER; | 173 | return -EPROBE_DEFER; |
@@ -197,11 +190,11 @@ static int tegra_alc5632_probe(struct platform_device *pdev) | |||
197 | goto err; | 190 | goto err; |
198 | } | 191 | } |
199 | 192 | ||
200 | tegra_alc5632_dai.cpu_of_node = of_parse_phandle( | 193 | tegra_alc5632_dai.cpu_of_node = of_parse_phandle(np, |
201 | pdev->dev.of_node, "nvidia,i2s-controller", 0); | 194 | "nvidia,i2s-controller", 0); |
202 | if (!tegra_alc5632_dai.cpu_of_node) { | 195 | if (!tegra_alc5632_dai.cpu_of_node) { |
203 | dev_err(&pdev->dev, | 196 | dev_err(&pdev->dev, |
204 | "Property 'nvidia,i2s-controller' missing or invalid\n"); | 197 | "Property 'nvidia,i2s-controller' missing or invalid\n"); |
205 | ret = -EINVAL; | 198 | ret = -EINVAL; |
206 | goto err; | 199 | goto err; |
207 | } | 200 | } |
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); |
diff --git a/sound/soc/tegra/tegra_asoc_utils.h b/sound/soc/tegra/tegra_asoc_utils.h index 974c9f8830f9..19fdcafed32f 100644 --- a/sound/soc/tegra/tegra_asoc_utils.h +++ b/sound/soc/tegra/tegra_asoc_utils.h | |||
@@ -29,6 +29,7 @@ struct device; | |||
29 | enum tegra_asoc_utils_soc { | 29 | enum tegra_asoc_utils_soc { |
30 | TEGRA_ASOC_UTILS_SOC_TEGRA20, | 30 | TEGRA_ASOC_UTILS_SOC_TEGRA20, |
31 | TEGRA_ASOC_UTILS_SOC_TEGRA30, | 31 | TEGRA_ASOC_UTILS_SOC_TEGRA30, |
32 | TEGRA_ASOC_UTILS_SOC_TEGRA114, | ||
32 | }; | 33 | }; |
33 | 34 | ||
34 | struct tegra_asoc_utils_data { | 35 | struct tegra_asoc_utils_data { |
diff --git a/sound/soc/tegra/tegra_wm8753.c b/sound/soc/tegra/tegra_wm8753.c index c8ef88a67c59..f87fc53e9b8c 100644 --- a/sound/soc/tegra/tegra_wm8753.c +++ b/sound/soc/tegra/tegra_wm8753.c | |||
@@ -124,6 +124,7 @@ static struct snd_soc_card snd_soc_tegra_wm8753 = { | |||
124 | 124 | ||
125 | static int tegra_wm8753_driver_probe(struct platform_device *pdev) | 125 | static int tegra_wm8753_driver_probe(struct platform_device *pdev) |
126 | { | 126 | { |
127 | struct device_node *np = pdev->dev.of_node; | ||
127 | struct snd_soc_card *card = &snd_soc_tegra_wm8753; | 128 | struct snd_soc_card *card = &snd_soc_tegra_wm8753; |
128 | struct tegra_wm8753 *machine; | 129 | struct tegra_wm8753 *machine; |
129 | int ret; | 130 | int ret; |
@@ -132,8 +133,7 @@ static int tegra_wm8753_driver_probe(struct platform_device *pdev) | |||
132 | GFP_KERNEL); | 133 | GFP_KERNEL); |
133 | if (!machine) { | 134 | if (!machine) { |
134 | dev_err(&pdev->dev, "Can't allocate tegra_wm8753 struct\n"); | 135 | dev_err(&pdev->dev, "Can't allocate tegra_wm8753 struct\n"); |
135 | ret = -ENOMEM; | 136 | return -ENOMEM; |
136 | goto err; | ||
137 | } | 137 | } |
138 | 138 | ||
139 | card->dev = &pdev->dev; | 139 | card->dev = &pdev->dev; |
@@ -148,8 +148,8 @@ static int tegra_wm8753_driver_probe(struct platform_device *pdev) | |||
148 | if (ret) | 148 | if (ret) |
149 | goto err; | 149 | goto err; |
150 | 150 | ||
151 | tegra_wm8753_dai.codec_of_node = of_parse_phandle( | 151 | tegra_wm8753_dai.codec_of_node = of_parse_phandle(np, |
152 | pdev->dev.of_node, "nvidia,audio-codec", 0); | 152 | "nvidia,audio-codec", 0); |
153 | if (!tegra_wm8753_dai.codec_of_node) { | 153 | if (!tegra_wm8753_dai.codec_of_node) { |
154 | dev_err(&pdev->dev, | 154 | dev_err(&pdev->dev, |
155 | "Property 'nvidia,audio-codec' missing or invalid\n"); | 155 | "Property 'nvidia,audio-codec' missing or invalid\n"); |
@@ -157,8 +157,8 @@ static int tegra_wm8753_driver_probe(struct platform_device *pdev) | |||
157 | goto err; | 157 | goto err; |
158 | } | 158 | } |
159 | 159 | ||
160 | tegra_wm8753_dai.cpu_of_node = of_parse_phandle( | 160 | tegra_wm8753_dai.cpu_of_node = of_parse_phandle(np, |
161 | pdev->dev.of_node, "nvidia,i2s-controller", 0); | 161 | "nvidia,i2s-controller", 0); |
162 | if (!tegra_wm8753_dai.cpu_of_node) { | 162 | if (!tegra_wm8753_dai.cpu_of_node) { |
163 | dev_err(&pdev->dev, | 163 | dev_err(&pdev->dev, |
164 | "Property 'nvidia,i2s-controller' missing or invalid\n"); | 164 | "Property 'nvidia,i2s-controller' missing or invalid\n"); |
@@ -166,8 +166,7 @@ static int tegra_wm8753_driver_probe(struct platform_device *pdev) | |||
166 | goto err; | 166 | goto err; |
167 | } | 167 | } |
168 | 168 | ||
169 | tegra_wm8753_dai.platform_of_node = | 169 | tegra_wm8753_dai.platform_of_node = tegra_wm8753_dai.cpu_of_node; |
170 | tegra_wm8753_dai.cpu_of_node; | ||
171 | 170 | ||
172 | ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); | 171 | ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); |
173 | if (ret) | 172 | if (ret) |
diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c index bbd79bf56303..4ac73730d79a 100644 --- a/sound/soc/tegra/tegra_wm8903.c +++ b/sound/soc/tegra/tegra_wm8903.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <sound/pcm.h> | 39 | #include <sound/pcm.h> |
40 | #include <sound/pcm_params.h> | 40 | #include <sound/pcm_params.h> |
41 | #include <sound/soc.h> | 41 | #include <sound/soc.h> |
42 | #include <sound/tegra_wm8903.h> | ||
43 | 42 | ||
44 | #include "../codecs/wm8903.h" | 43 | #include "../codecs/wm8903.h" |
45 | 44 | ||
@@ -48,7 +47,11 @@ | |||
48 | #define DRV_NAME "tegra-snd-wm8903" | 47 | #define DRV_NAME "tegra-snd-wm8903" |
49 | 48 | ||
50 | struct tegra_wm8903 { | 49 | struct tegra_wm8903 { |
51 | struct tegra_wm8903_platform_data pdata; | 50 | int gpio_spkr_en; |
51 | int gpio_hp_det; | ||
52 | int gpio_hp_mute; | ||
53 | int gpio_int_mic_en; | ||
54 | int gpio_ext_mic_en; | ||
52 | struct tegra_asoc_utils_data util_data; | 55 | struct tegra_asoc_utils_data util_data; |
53 | }; | 56 | }; |
54 | 57 | ||
@@ -129,12 +132,11 @@ static int tegra_wm8903_event_int_spk(struct snd_soc_dapm_widget *w, | |||
129 | struct snd_soc_dapm_context *dapm = w->dapm; | 132 | struct snd_soc_dapm_context *dapm = w->dapm; |
130 | struct snd_soc_card *card = dapm->card; | 133 | struct snd_soc_card *card = dapm->card; |
131 | struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); | 134 | struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); |
132 | struct tegra_wm8903_platform_data *pdata = &machine->pdata; | ||
133 | 135 | ||
134 | if (!gpio_is_valid(pdata->gpio_spkr_en)) | 136 | if (!gpio_is_valid(machine->gpio_spkr_en)) |
135 | return 0; | 137 | return 0; |
136 | 138 | ||
137 | gpio_set_value_cansleep(pdata->gpio_spkr_en, | 139 | gpio_set_value_cansleep(machine->gpio_spkr_en, |
138 | SND_SOC_DAPM_EVENT_ON(event)); | 140 | SND_SOC_DAPM_EVENT_ON(event)); |
139 | 141 | ||
140 | return 0; | 142 | return 0; |
@@ -146,12 +148,11 @@ static int tegra_wm8903_event_hp(struct snd_soc_dapm_widget *w, | |||
146 | struct snd_soc_dapm_context *dapm = w->dapm; | 148 | struct snd_soc_dapm_context *dapm = w->dapm; |
147 | struct snd_soc_card *card = dapm->card; | 149 | struct snd_soc_card *card = dapm->card; |
148 | struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); | 150 | struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); |
149 | struct tegra_wm8903_platform_data *pdata = &machine->pdata; | ||
150 | 151 | ||
151 | if (!gpio_is_valid(pdata->gpio_hp_mute)) | 152 | if (!gpio_is_valid(machine->gpio_hp_mute)) |
152 | return 0; | 153 | return 0; |
153 | 154 | ||
154 | gpio_set_value_cansleep(pdata->gpio_hp_mute, | 155 | gpio_set_value_cansleep(machine->gpio_hp_mute, |
155 | !SND_SOC_DAPM_EVENT_ON(event)); | 156 | !SND_SOC_DAPM_EVENT_ON(event)); |
156 | 157 | ||
157 | return 0; | 158 | return 0; |
@@ -163,17 +164,6 @@ static const struct snd_soc_dapm_widget tegra_wm8903_dapm_widgets[] = { | |||
163 | SND_SOC_DAPM_MIC("Mic Jack", NULL), | 164 | SND_SOC_DAPM_MIC("Mic Jack", NULL), |
164 | }; | 165 | }; |
165 | 166 | ||
166 | static const struct snd_soc_dapm_route harmony_audio_map[] = { | ||
167 | {"Headphone Jack", NULL, "HPOUTR"}, | ||
168 | {"Headphone Jack", NULL, "HPOUTL"}, | ||
169 | {"Int Spk", NULL, "ROP"}, | ||
170 | {"Int Spk", NULL, "RON"}, | ||
171 | {"Int Spk", NULL, "LOP"}, | ||
172 | {"Int Spk", NULL, "LON"}, | ||
173 | {"Mic Jack", NULL, "MICBIAS"}, | ||
174 | {"IN1L", NULL, "Mic Jack"}, | ||
175 | }; | ||
176 | |||
177 | static const struct snd_kcontrol_new tegra_wm8903_controls[] = { | 167 | static const struct snd_kcontrol_new tegra_wm8903_controls[] = { |
178 | SOC_DAPM_PIN_SWITCH("Int Spk"), | 168 | SOC_DAPM_PIN_SWITCH("Int Spk"), |
179 | }; | 169 | }; |
@@ -185,10 +175,9 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) | |||
185 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 175 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
186 | struct snd_soc_card *card = codec->card; | 176 | struct snd_soc_card *card = codec->card; |
187 | struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); | 177 | struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); |
188 | struct tegra_wm8903_platform_data *pdata = &machine->pdata; | ||
189 | 178 | ||
190 | if (gpio_is_valid(pdata->gpio_hp_det)) { | 179 | if (gpio_is_valid(machine->gpio_hp_det)) { |
191 | tegra_wm8903_hp_jack_gpio.gpio = pdata->gpio_hp_det; | 180 | tegra_wm8903_hp_jack_gpio.gpio = machine->gpio_hp_det; |
192 | snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE, | 181 | snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE, |
193 | &tegra_wm8903_hp_jack); | 182 | &tegra_wm8903_hp_jack); |
194 | snd_soc_jack_add_pins(&tegra_wm8903_hp_jack, | 183 | snd_soc_jack_add_pins(&tegra_wm8903_hp_jack, |
@@ -226,9 +215,6 @@ static int tegra_wm8903_remove(struct snd_soc_card *card) | |||
226 | static struct snd_soc_dai_link tegra_wm8903_dai = { | 215 | static struct snd_soc_dai_link tegra_wm8903_dai = { |
227 | .name = "WM8903", | 216 | .name = "WM8903", |
228 | .stream_name = "WM8903 PCM", | 217 | .stream_name = "WM8903 PCM", |
229 | .codec_name = "wm8903.0-001a", | ||
230 | .platform_name = "tegra20-i2s.0", | ||
231 | .cpu_dai_name = "tegra20-i2s.0", | ||
232 | .codec_dai_name = "wm8903-hifi", | 218 | .codec_dai_name = "wm8903-hifi", |
233 | .init = tegra_wm8903_init, | 219 | .init = tegra_wm8903_init, |
234 | .ops = &tegra_wm8903_ops, | 220 | .ops = &tegra_wm8903_ops, |
@@ -257,96 +243,25 @@ static int tegra_wm8903_driver_probe(struct platform_device *pdev) | |||
257 | struct device_node *np = pdev->dev.of_node; | 243 | struct device_node *np = pdev->dev.of_node; |
258 | struct snd_soc_card *card = &snd_soc_tegra_wm8903; | 244 | struct snd_soc_card *card = &snd_soc_tegra_wm8903; |
259 | struct tegra_wm8903 *machine; | 245 | struct tegra_wm8903 *machine; |
260 | struct tegra_wm8903_platform_data *pdata; | ||
261 | int ret; | 246 | int ret; |
262 | 247 | ||
263 | if (!pdev->dev.platform_data && !pdev->dev.of_node) { | ||
264 | dev_err(&pdev->dev, "No platform data supplied\n"); | ||
265 | return -EINVAL; | ||
266 | } | ||
267 | |||
268 | machine = devm_kzalloc(&pdev->dev, sizeof(struct tegra_wm8903), | 248 | machine = devm_kzalloc(&pdev->dev, sizeof(struct tegra_wm8903), |
269 | GFP_KERNEL); | 249 | GFP_KERNEL); |
270 | if (!machine) { | 250 | if (!machine) { |
271 | dev_err(&pdev->dev, "Can't allocate tegra_wm8903 struct\n"); | 251 | dev_err(&pdev->dev, "Can't allocate tegra_wm8903 struct\n"); |
272 | ret = -ENOMEM; | 252 | return -ENOMEM; |
273 | goto err; | ||
274 | } | 253 | } |
275 | pdata = &machine->pdata; | ||
276 | 254 | ||
277 | card->dev = &pdev->dev; | 255 | card->dev = &pdev->dev; |
278 | platform_set_drvdata(pdev, card); | 256 | platform_set_drvdata(pdev, card); |
279 | snd_soc_card_set_drvdata(card, machine); | 257 | snd_soc_card_set_drvdata(card, machine); |
280 | 258 | ||
281 | if (pdev->dev.platform_data) { | 259 | machine->gpio_spkr_en = of_get_named_gpio(np, "nvidia,spkr-en-gpios", |
282 | memcpy(pdata, card->dev->platform_data, sizeof(*pdata)); | 260 | 0); |
283 | } else if (np) { | 261 | if (machine->gpio_spkr_en == -EPROBE_DEFER) |
284 | pdata->gpio_spkr_en = of_get_named_gpio(np, | 262 | return -EPROBE_DEFER; |
285 | "nvidia,spkr-en-gpios", 0); | 263 | if (gpio_is_valid(machine->gpio_spkr_en)) { |
286 | if (pdata->gpio_spkr_en == -EPROBE_DEFER) | 264 | ret = devm_gpio_request_one(&pdev->dev, machine->gpio_spkr_en, |
287 | return -EPROBE_DEFER; | ||
288 | |||
289 | pdata->gpio_hp_mute = of_get_named_gpio(np, | ||
290 | "nvidia,hp-mute-gpios", 0); | ||
291 | if (pdata->gpio_hp_mute == -EPROBE_DEFER) | ||
292 | return -EPROBE_DEFER; | ||
293 | |||
294 | pdata->gpio_hp_det = of_get_named_gpio(np, | ||
295 | "nvidia,hp-det-gpios", 0); | ||
296 | if (pdata->gpio_hp_det == -EPROBE_DEFER) | ||
297 | return -EPROBE_DEFER; | ||
298 | |||
299 | pdata->gpio_int_mic_en = of_get_named_gpio(np, | ||
300 | "nvidia,int-mic-en-gpios", 0); | ||
301 | if (pdata->gpio_int_mic_en == -EPROBE_DEFER) | ||
302 | return -EPROBE_DEFER; | ||
303 | |||
304 | pdata->gpio_ext_mic_en = of_get_named_gpio(np, | ||
305 | "nvidia,ext-mic-en-gpios", 0); | ||
306 | if (pdata->gpio_ext_mic_en == -EPROBE_DEFER) | ||
307 | return -EPROBE_DEFER; | ||
308 | } | ||
309 | |||
310 | if (np) { | ||
311 | ret = snd_soc_of_parse_card_name(card, "nvidia,model"); | ||
312 | if (ret) | ||
313 | goto err; | ||
314 | |||
315 | ret = snd_soc_of_parse_audio_routing(card, | ||
316 | "nvidia,audio-routing"); | ||
317 | if (ret) | ||
318 | goto err; | ||
319 | |||
320 | tegra_wm8903_dai.codec_name = NULL; | ||
321 | tegra_wm8903_dai.codec_of_node = of_parse_phandle(np, | ||
322 | "nvidia,audio-codec", 0); | ||
323 | if (!tegra_wm8903_dai.codec_of_node) { | ||
324 | dev_err(&pdev->dev, | ||
325 | "Property 'nvidia,audio-codec' missing or invalid\n"); | ||
326 | ret = -EINVAL; | ||
327 | goto err; | ||
328 | } | ||
329 | |||
330 | tegra_wm8903_dai.cpu_dai_name = NULL; | ||
331 | tegra_wm8903_dai.cpu_of_node = of_parse_phandle(np, | ||
332 | "nvidia,i2s-controller", 0); | ||
333 | if (!tegra_wm8903_dai.cpu_of_node) { | ||
334 | dev_err(&pdev->dev, | ||
335 | "Property 'nvidia,i2s-controller' missing or invalid\n"); | ||
336 | ret = -EINVAL; | ||
337 | goto err; | ||
338 | } | ||
339 | |||
340 | tegra_wm8903_dai.platform_name = NULL; | ||
341 | tegra_wm8903_dai.platform_of_node = | ||
342 | tegra_wm8903_dai.cpu_of_node; | ||
343 | } else { | ||
344 | card->dapm_routes = harmony_audio_map; | ||
345 | card->num_dapm_routes = ARRAY_SIZE(harmony_audio_map); | ||
346 | } | ||
347 | |||
348 | if (gpio_is_valid(pdata->gpio_spkr_en)) { | ||
349 | ret = devm_gpio_request_one(&pdev->dev, pdata->gpio_spkr_en, | ||
350 | GPIOF_OUT_INIT_LOW, "spkr_en"); | 265 | GPIOF_OUT_INIT_LOW, "spkr_en"); |
351 | if (ret) { | 266 | if (ret) { |
352 | dev_err(card->dev, "cannot get spkr_en gpio\n"); | 267 | dev_err(card->dev, "cannot get spkr_en gpio\n"); |
@@ -354,8 +269,12 @@ static int tegra_wm8903_driver_probe(struct platform_device *pdev) | |||
354 | } | 269 | } |
355 | } | 270 | } |
356 | 271 | ||
357 | if (gpio_is_valid(pdata->gpio_hp_mute)) { | 272 | machine->gpio_hp_mute = of_get_named_gpio(np, "nvidia,hp-mute-gpios", |
358 | ret = devm_gpio_request_one(&pdev->dev, pdata->gpio_hp_mute, | 273 | 0); |
274 | if (machine->gpio_hp_mute == -EPROBE_DEFER) | ||
275 | return -EPROBE_DEFER; | ||
276 | if (gpio_is_valid(machine->gpio_hp_mute)) { | ||
277 | ret = devm_gpio_request_one(&pdev->dev, machine->gpio_hp_mute, | ||
359 | GPIOF_OUT_INIT_HIGH, "hp_mute"); | 278 | GPIOF_OUT_INIT_HIGH, "hp_mute"); |
360 | if (ret) { | 279 | if (ret) { |
361 | dev_err(card->dev, "cannot get hp_mute gpio\n"); | 280 | dev_err(card->dev, "cannot get hp_mute gpio\n"); |
@@ -363,9 +282,18 @@ static int tegra_wm8903_driver_probe(struct platform_device *pdev) | |||
363 | } | 282 | } |
364 | } | 283 | } |
365 | 284 | ||
366 | if (gpio_is_valid(pdata->gpio_int_mic_en)) { | 285 | machine->gpio_hp_det = of_get_named_gpio(np, "nvidia,hp-det-gpios", 0); |
286 | if (machine->gpio_hp_det == -EPROBE_DEFER) | ||
287 | return -EPROBE_DEFER; | ||
288 | |||
289 | machine->gpio_int_mic_en = of_get_named_gpio(np, | ||
290 | "nvidia,int-mic-en-gpios", 0); | ||
291 | if (machine->gpio_int_mic_en == -EPROBE_DEFER) | ||
292 | return -EPROBE_DEFER; | ||
293 | if (gpio_is_valid(machine->gpio_int_mic_en)) { | ||
367 | /* Disable int mic; enable signal is active-high */ | 294 | /* Disable int mic; enable signal is active-high */ |
368 | ret = devm_gpio_request_one(&pdev->dev, pdata->gpio_int_mic_en, | 295 | ret = devm_gpio_request_one(&pdev->dev, |
296 | machine->gpio_int_mic_en, | ||
369 | GPIOF_OUT_INIT_LOW, "int_mic_en"); | 297 | GPIOF_OUT_INIT_LOW, "int_mic_en"); |
370 | if (ret) { | 298 | if (ret) { |
371 | dev_err(card->dev, "cannot get int_mic_en gpio\n"); | 299 | dev_err(card->dev, "cannot get int_mic_en gpio\n"); |
@@ -373,9 +301,14 @@ static int tegra_wm8903_driver_probe(struct platform_device *pdev) | |||
373 | } | 301 | } |
374 | } | 302 | } |
375 | 303 | ||
376 | if (gpio_is_valid(pdata->gpio_ext_mic_en)) { | 304 | machine->gpio_ext_mic_en = of_get_named_gpio(np, |
305 | "nvidia,ext-mic-en-gpios", 0); | ||
306 | if (machine->gpio_ext_mic_en == -EPROBE_DEFER) | ||
307 | return -EPROBE_DEFER; | ||
308 | if (gpio_is_valid(machine->gpio_ext_mic_en)) { | ||
377 | /* Enable ext mic; enable signal is active-low */ | 309 | /* Enable ext mic; enable signal is active-low */ |
378 | ret = devm_gpio_request_one(&pdev->dev, pdata->gpio_ext_mic_en, | 310 | ret = devm_gpio_request_one(&pdev->dev, |
311 | machine->gpio_ext_mic_en, | ||
379 | GPIOF_OUT_INIT_LOW, "ext_mic_en"); | 312 | GPIOF_OUT_INIT_LOW, "ext_mic_en"); |
380 | if (ret) { | 313 | if (ret) { |
381 | dev_err(card->dev, "cannot get ext_mic_en gpio\n"); | 314 | dev_err(card->dev, "cannot get ext_mic_en gpio\n"); |
@@ -383,6 +316,34 @@ static int tegra_wm8903_driver_probe(struct platform_device *pdev) | |||
383 | } | 316 | } |
384 | } | 317 | } |
385 | 318 | ||
319 | ret = snd_soc_of_parse_card_name(card, "nvidia,model"); | ||
320 | if (ret) | ||
321 | goto err; | ||
322 | |||
323 | ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing"); | ||
324 | if (ret) | ||
325 | goto err; | ||
326 | |||
327 | tegra_wm8903_dai.codec_of_node = of_parse_phandle(np, | ||
328 | "nvidia,audio-codec", 0); | ||
329 | if (!tegra_wm8903_dai.codec_of_node) { | ||
330 | dev_err(&pdev->dev, | ||
331 | "Property 'nvidia,audio-codec' missing or invalid\n"); | ||
332 | ret = -EINVAL; | ||
333 | goto err; | ||
334 | } | ||
335 | |||
336 | tegra_wm8903_dai.cpu_of_node = of_parse_phandle(np, | ||
337 | "nvidia,i2s-controller", 0); | ||
338 | if (!tegra_wm8903_dai.cpu_of_node) { | ||
339 | dev_err(&pdev->dev, | ||
340 | "Property 'nvidia,i2s-controller' missing or invalid\n"); | ||
341 | ret = -EINVAL; | ||
342 | goto err; | ||
343 | } | ||
344 | |||
345 | tegra_wm8903_dai.platform_of_node = tegra_wm8903_dai.cpu_of_node; | ||
346 | |||
386 | ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); | 347 | ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); |
387 | if (ret) | 348 | if (ret) |
388 | goto err; | 349 | goto err; |
diff --git a/sound/soc/tegra/tegra_wm9712.c b/sound/soc/tegra/tegra_wm9712.c index 6839f88167d0..5e119630b0e0 100644 --- a/sound/soc/tegra/tegra_wm9712.c +++ b/sound/soc/tegra/tegra_wm9712.c | |||
@@ -79,11 +79,6 @@ static int tegra_wm9712_driver_probe(struct platform_device *pdev) | |||
79 | struct tegra_wm9712 *machine; | 79 | struct tegra_wm9712 *machine; |
80 | int ret; | 80 | int ret; |
81 | 81 | ||
82 | if (!pdev->dev.of_node) { | ||
83 | dev_err(&pdev->dev, "No platform data supplied\n"); | ||
84 | return -EINVAL; | ||
85 | } | ||
86 | |||
87 | machine = devm_kzalloc(&pdev->dev, sizeof(struct tegra_wm9712), | 82 | machine = devm_kzalloc(&pdev->dev, sizeof(struct tegra_wm9712), |
88 | GFP_KERNEL); | 83 | GFP_KERNEL); |
89 | if (!machine) { | 84 | if (!machine) { |
diff --git a/sound/soc/tegra/trimslice.c b/sound/soc/tegra/trimslice.c index 7fcf6c2297db..05c68aab5cf0 100644 --- a/sound/soc/tegra/trimslice.c +++ b/sound/soc/tegra/trimslice.c | |||
@@ -97,9 +97,6 @@ static const struct snd_soc_dapm_route trimslice_audio_map[] = { | |||
97 | static struct snd_soc_dai_link trimslice_tlv320aic23_dai = { | 97 | static struct snd_soc_dai_link trimslice_tlv320aic23_dai = { |
98 | .name = "TLV320AIC23", | 98 | .name = "TLV320AIC23", |
99 | .stream_name = "AIC23", | 99 | .stream_name = "AIC23", |
100 | .codec_name = "tlv320aic23-codec.2-001a", | ||
101 | .platform_name = "tegra20-i2s.0", | ||
102 | .cpu_dai_name = "tegra20-i2s.0", | ||
103 | .codec_dai_name = "tlv320aic23-hifi", | 100 | .codec_dai_name = "tlv320aic23-hifi", |
104 | .ops = &trimslice_asoc_ops, | 101 | .ops = &trimslice_asoc_ops, |
105 | .dai_fmt = SND_SOC_DAIFMT_I2S | | 102 | .dai_fmt = SND_SOC_DAIFMT_I2S | |
@@ -122,6 +119,7 @@ static struct snd_soc_card snd_soc_trimslice = { | |||
122 | 119 | ||
123 | static int tegra_snd_trimslice_probe(struct platform_device *pdev) | 120 | static int tegra_snd_trimslice_probe(struct platform_device *pdev) |
124 | { | 121 | { |
122 | struct device_node *np = pdev->dev.of_node; | ||
125 | struct snd_soc_card *card = &snd_soc_trimslice; | 123 | struct snd_soc_card *card = &snd_soc_trimslice; |
126 | struct tegra_trimslice *trimslice; | 124 | struct tegra_trimslice *trimslice; |
127 | int ret; | 125 | int ret; |
@@ -130,44 +128,38 @@ static int tegra_snd_trimslice_probe(struct platform_device *pdev) | |||
130 | GFP_KERNEL); | 128 | GFP_KERNEL); |
131 | if (!trimslice) { | 129 | if (!trimslice) { |
132 | dev_err(&pdev->dev, "Can't allocate tegra_trimslice\n"); | 130 | dev_err(&pdev->dev, "Can't allocate tegra_trimslice\n"); |
133 | ret = -ENOMEM; | 131 | return -ENOMEM; |
132 | } | ||
133 | |||
134 | card->dev = &pdev->dev; | ||
135 | platform_set_drvdata(pdev, card); | ||
136 | snd_soc_card_set_drvdata(card, trimslice); | ||
137 | |||
138 | trimslice_tlv320aic23_dai.codec_of_node = of_parse_phandle(np, | ||
139 | "nvidia,audio-codec", 0); | ||
140 | if (!trimslice_tlv320aic23_dai.codec_of_node) { | ||
141 | dev_err(&pdev->dev, | ||
142 | "Property 'nvidia,audio-codec' missing or invalid\n"); | ||
143 | ret = -EINVAL; | ||
134 | goto err; | 144 | goto err; |
135 | } | 145 | } |
136 | 146 | ||
137 | if (pdev->dev.of_node) { | 147 | trimslice_tlv320aic23_dai.cpu_of_node = of_parse_phandle(np, |
138 | trimslice_tlv320aic23_dai.codec_name = NULL; | 148 | "nvidia,i2s-controller", 0); |
139 | trimslice_tlv320aic23_dai.codec_of_node = of_parse_phandle( | 149 | if (!trimslice_tlv320aic23_dai.cpu_of_node) { |
140 | pdev->dev.of_node, "nvidia,audio-codec", 0); | 150 | dev_err(&pdev->dev, |
141 | if (!trimslice_tlv320aic23_dai.codec_of_node) { | 151 | "Property 'nvidia,i2s-controller' missing or invalid\n"); |
142 | dev_err(&pdev->dev, | 152 | ret = -EINVAL; |
143 | "Property 'nvidia,audio-codec' missing or invalid\n"); | 153 | goto err; |
144 | ret = -EINVAL; | ||
145 | goto err; | ||
146 | } | ||
147 | |||
148 | trimslice_tlv320aic23_dai.cpu_dai_name = NULL; | ||
149 | trimslice_tlv320aic23_dai.cpu_of_node = of_parse_phandle( | ||
150 | pdev->dev.of_node, "nvidia,i2s-controller", 0); | ||
151 | if (!trimslice_tlv320aic23_dai.cpu_of_node) { | ||
152 | dev_err(&pdev->dev, | ||
153 | "Property 'nvidia,i2s-controller' missing or invalid\n"); | ||
154 | ret = -EINVAL; | ||
155 | goto err; | ||
156 | } | ||
157 | |||
158 | trimslice_tlv320aic23_dai.platform_name = NULL; | ||
159 | trimslice_tlv320aic23_dai.platform_of_node = | ||
160 | trimslice_tlv320aic23_dai.cpu_of_node; | ||
161 | } | 154 | } |
162 | 155 | ||
156 | trimslice_tlv320aic23_dai.platform_of_node = | ||
157 | trimslice_tlv320aic23_dai.cpu_of_node; | ||
158 | |||
163 | ret = tegra_asoc_utils_init(&trimslice->util_data, &pdev->dev); | 159 | ret = tegra_asoc_utils_init(&trimslice->util_data, &pdev->dev); |
164 | if (ret) | 160 | if (ret) |
165 | goto err; | 161 | goto err; |
166 | 162 | ||
167 | card->dev = &pdev->dev; | ||
168 | platform_set_drvdata(pdev, card); | ||
169 | snd_soc_card_set_drvdata(card, trimslice); | ||
170 | |||
171 | ret = snd_soc_register_card(card); | 163 | ret = snd_soc_register_card(card); |
172 | if (ret) { | 164 | if (ret) { |
173 | dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", | 165 | dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", |