Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge remote-tracking branches 'asoc/topic/tdm' and 'asoc/topic/tegra' into asoc-next

+59 -23
+1 -1
include/sound/soc-dai.h
··· 142 142 * Called by soc_card drivers, normally in their hw_params. 143 143 */ 144 144 int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt); 145 - int (*of_xlate_tdm_slot_mask)(unsigned int slots, 145 + int (*xlate_tdm_slot_mask)(unsigned int slots, 146 146 unsigned int *tx_mask, unsigned int *rx_mask); 147 147 int (*set_tdm_slot)(struct snd_soc_dai *dai, 148 148 unsigned int tx_mask, unsigned int rx_mask,
+2
sound/soc/fsl/Kconfig
··· 13 13 config SND_SOC_FSL_ESAI 14 14 tristate 15 15 select REGMAP_MMIO 16 + select SND_SOC_FSL_UTILS 16 17 17 18 config SND_SOC_FSL_UTILS 18 19 tristate ··· 121 120 122 121 config SND_SOC_IMX_SSI 123 122 tristate 123 + select SND_SOC_FSL_UTILS 124 124 125 125 config SND_SOC_IMX_PCM_FIQ 126 126 tristate
+2
sound/soc/fsl/fsl_esai.c
··· 18 18 19 19 #include "fsl_esai.h" 20 20 #include "imx-pcm.h" 21 + #include "fsl_utils.h" 21 22 22 23 #define FSL_ESAI_RATES SNDRV_PCM_RATE_8000_192000 23 24 #define FSL_ESAI_FORMATS (SNDRV_PCM_FMTBIT_S8 | \ ··· 582 581 .hw_params = fsl_esai_hw_params, 583 582 .set_sysclk = fsl_esai_set_dai_sysclk, 584 583 .set_fmt = fsl_esai_set_dai_fmt, 584 + .xlate_tdm_slot_mask = fsl_asoc_xlate_tdm_slot_mask, 585 585 .set_tdm_slot = fsl_esai_set_dai_tdm_slot, 586 586 }; 587 587
+27
sound/soc/fsl/fsl_utils.c
··· 86 86 } 87 87 EXPORT_SYMBOL(fsl_asoc_get_dma_channel); 88 88 89 + /** 90 + * fsl_asoc_xlate_tdm_slot_mask - generate TDM slot TX/RX mask. 91 + * 92 + * @slots: Number of slots in use. 93 + * @tx_mask: bitmask representing active TX slots. 94 + * @rx_mask: bitmask representing active RX slots. 95 + * 96 + * This function used to generate the TDM slot TX/RX mask. And the TX/RX 97 + * mask will use a 0 bit for an active slot as default, and the default 98 + * active bits are at the LSB of the mask value. 99 + */ 100 + int fsl_asoc_xlate_tdm_slot_mask(unsigned int slots, 101 + unsigned int *tx_mask, 102 + unsigned int *rx_mask) 103 + { 104 + if (!slots) 105 + return -EINVAL; 106 + 107 + if (tx_mask) 108 + *tx_mask = ~((1 << slots) - 1); 109 + if (rx_mask) 110 + *rx_mask = ~((1 << slots) - 1); 111 + 112 + return 0; 113 + } 114 + EXPORT_SYMBOL_GPL(fsl_asoc_xlate_tdm_slot_mask); 115 + 89 116 MODULE_AUTHOR("Timur Tabi <timur@freescale.com>"); 90 117 MODULE_DESCRIPTION("Freescale ASoC utility code"); 91 118 MODULE_LICENSE("GPL v2");
+3 -1
sound/soc/fsl/fsl_utils.h
··· 22 22 struct snd_soc_dai_link *dai, 23 23 unsigned int *dma_channel_id, 24 24 unsigned int *dma_id); 25 - 25 + int fsl_asoc_xlate_tdm_slot_mask(unsigned int slots, 26 + unsigned int *tx_mask, 27 + unsigned int *rx_mask); 26 28 #endif /* _FSL_UTILS_H */
+2
sound/soc/fsl/imx-ssi.c
··· 50 50 #include <linux/platform_data/asoc-imx-ssi.h> 51 51 52 52 #include "imx-ssi.h" 53 + #include "fsl_utils.h" 53 54 54 55 #define SSI_SACNT_DEFAULT (SSI_SACNT_AC97EN | SSI_SACNT_FV) 55 56 ··· 340 339 .set_fmt = imx_ssi_set_dai_fmt, 341 340 .set_clkdiv = imx_ssi_set_dai_clkdiv, 342 341 .set_sysclk = imx_ssi_set_dai_sysclk, 342 + .xlate_tdm_slot_mask = fsl_asoc_xlate_tdm_slot_mask, 343 343 .set_tdm_slot = imx_ssi_set_dai_tdm_slot, 344 344 .trigger = imx_ssi_trigger, 345 345 };
+5 -5
sound/soc/soc-core.c
··· 3620 3620 EXPORT_SYMBOL_GPL(snd_soc_dai_set_fmt); 3621 3621 3622 3622 /** 3623 - * snd_soc_of_xlate_tdm_slot - generate tx/rx slot mask. 3623 + * snd_soc_xlate_tdm_slot - generate tx/rx slot mask. 3624 3624 * @slots: Number of slots in use. 3625 3625 * @tx_mask: bitmask representing active TX slots. 3626 3626 * @rx_mask: bitmask representing active RX slots. 3627 3627 * 3628 3628 * Generates the TDM tx and rx slot default masks for DAI. 3629 3629 */ 3630 - static int snd_soc_of_xlate_tdm_slot_mask(unsigned int slots, 3630 + static int snd_soc_xlate_tdm_slot_mask(unsigned int slots, 3631 3631 unsigned int *tx_mask, 3632 3632 unsigned int *rx_mask) 3633 3633 { ··· 3657 3657 int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, 3658 3658 unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) 3659 3659 { 3660 - if (dai->driver && dai->driver->ops->of_xlate_tdm_slot_mask) 3661 - dai->driver->ops->of_xlate_tdm_slot_mask(slots, 3660 + if (dai->driver && dai->driver->ops->xlate_tdm_slot_mask) 3661 + dai->driver->ops->xlate_tdm_slot_mask(slots, 3662 3662 &tx_mask, &rx_mask); 3663 3663 else 3664 - snd_soc_of_xlate_tdm_slot_mask(slots, &tx_mask, &rx_mask); 3664 + snd_soc_xlate_tdm_slot_mask(slots, &tx_mask, &rx_mask); 3665 3665 3666 3666 if (dai->driver && dai->driver->ops->set_tdm_slot) 3667 3667 return dai->driver->ops->set_tdm_slot(dai, tx_mask, rx_mask,
+1 -14
sound/soc/tegra/tegra20_ac97.c
··· 37 37 #include <sound/soc.h> 38 38 #include <sound/dmaengine_pcm.h> 39 39 40 - #include "tegra_asoc_utils.h" 41 40 #include "tegra20_ac97.h" 42 41 43 42 #define DRV_NAME "tegra20-ac97" ··· 375 376 ac97->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 376 377 ac97->playback_dma_data.maxburst = 4; 377 378 378 - ret = tegra_asoc_utils_init(&ac97->util_data, &pdev->dev); 379 - if (ret) 380 - goto err_clk_put; 381 - 382 - ret = tegra_asoc_utils_set_ac97_rate(&ac97->util_data); 383 - if (ret) 384 - goto err_asoc_utils_fini; 385 - 386 379 ret = clk_prepare_enable(ac97->clk_ac97); 387 380 if (ret) { 388 381 dev_err(&pdev->dev, "clk_enable failed: %d\n", ret); 389 - goto err_asoc_utils_fini; 382 + goto err; 390 383 } 391 384 392 385 ret = snd_soc_set_ac97_ops(&tegra20_ac97_ops); ··· 410 419 snd_soc_unregister_component(&pdev->dev); 411 420 err_clk_disable_unprepare: 412 421 clk_disable_unprepare(ac97->clk_ac97); 413 - err_asoc_utils_fini: 414 - tegra_asoc_utils_fini(&ac97->util_data); 415 422 err_clk_put: 416 423 err: 417 424 snd_soc_set_ac97_ops(NULL); ··· 422 433 423 434 tegra_pcm_platform_unregister(&pdev->dev); 424 435 snd_soc_unregister_component(&pdev->dev); 425 - 426 - tegra_asoc_utils_fini(&ac97->util_data); 427 436 428 437 clk_disable_unprepare(ac97->clk_ac97); 429 438
-1
sound/soc/tegra/tegra20_ac97.h
··· 90 90 struct regmap *regmap; 91 91 int reset_gpio; 92 92 int sync_gpio; 93 - struct tegra_asoc_utils_data util_data; 94 93 }; 95 94 #endif /* __TEGRA20_AC97_H__ */
+16 -1
sound/soc/tegra/tegra_wm9712.c
··· 29 29 #include <sound/pcm_params.h> 30 30 #include <sound/soc.h> 31 31 32 + #include "tegra_asoc_utils.h" 33 + 32 34 #define DRV_NAME "tegra-snd-wm9712" 33 35 34 36 struct tegra_wm9712 { 35 37 struct platform_device *codec; 38 + struct tegra_asoc_utils_data util_data; 36 39 }; 37 40 38 41 static const struct snd_soc_dapm_widget tegra_wm9712_dapm_widgets[] = { ··· 121 118 122 119 tegra_wm9712_dai.platform_of_node = tegra_wm9712_dai.cpu_of_node; 123 120 121 + ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); 122 + if (ret) 123 + goto codec_unregister; 124 + 125 + ret = tegra_asoc_utils_set_ac97_rate(&machine->util_data); 126 + if (ret) 127 + goto asoc_utils_fini; 128 + 124 129 ret = snd_soc_register_card(card); 125 130 if (ret) { 126 131 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", 127 132 ret); 128 - goto codec_unregister; 133 + goto asoc_utils_fini; 129 134 } 130 135 131 136 return 0; 132 137 138 + asoc_utils_fini: 139 + tegra_asoc_utils_fini(&machine->util_data); 133 140 codec_unregister: 134 141 platform_device_del(machine->codec); 135 142 codec_put: ··· 153 140 struct tegra_wm9712 *machine = snd_soc_card_get_drvdata(card); 154 141 155 142 snd_soc_unregister_card(card); 143 + 144 + tegra_asoc_utils_fini(&machine->util_data); 156 145 157 146 platform_device_unregister(machine->codec); 158 147