···142142 * Called by soc_card drivers, normally in their hw_params.143143 */144144 int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);145145- int (*of_xlate_tdm_slot_mask)(unsigned int slots,145145+ int (*xlate_tdm_slot_mask)(unsigned int slots,146146 unsigned int *tx_mask, unsigned int *rx_mask);147147 int (*set_tdm_slot)(struct snd_soc_dai *dai,148148 unsigned int tx_mask, unsigned int rx_mask,
···8686}8787EXPORT_SYMBOL(fsl_asoc_get_dma_channel);88888989+/**9090+ * fsl_asoc_xlate_tdm_slot_mask - generate TDM slot TX/RX mask.9191+ *9292+ * @slots: Number of slots in use.9393+ * @tx_mask: bitmask representing active TX slots.9494+ * @rx_mask: bitmask representing active RX slots.9595+ *9696+ * This function used to generate the TDM slot TX/RX mask. And the TX/RX9797+ * mask will use a 0 bit for an active slot as default, and the default9898+ * active bits are at the LSB of the mask value.9999+ */100100+int fsl_asoc_xlate_tdm_slot_mask(unsigned int slots,101101+ unsigned int *tx_mask,102102+ unsigned int *rx_mask)103103+{104104+ if (!slots)105105+ return -EINVAL;106106+107107+ if (tx_mask)108108+ *tx_mask = ~((1 << slots) - 1);109109+ if (rx_mask)110110+ *rx_mask = ~((1 << slots) - 1);111111+112112+ return 0;113113+}114114+EXPORT_SYMBOL_GPL(fsl_asoc_xlate_tdm_slot_mask);115115+89116MODULE_AUTHOR("Timur Tabi <timur@freescale.com>");90117MODULE_DESCRIPTION("Freescale ASoC utility code");91118MODULE_LICENSE("GPL v2");
+3-1
sound/soc/fsl/fsl_utils.h
···2222 struct snd_soc_dai_link *dai,2323 unsigned int *dma_channel_id,2424 unsigned int *dma_id);2525-2525+int fsl_asoc_xlate_tdm_slot_mask(unsigned int slots,2626+ unsigned int *tx_mask,2727+ unsigned int *rx_mask);2628#endif /* _FSL_UTILS_H */
···36203620EXPORT_SYMBOL_GPL(snd_soc_dai_set_fmt);3621362136223622/**36233623- * snd_soc_of_xlate_tdm_slot - generate tx/rx slot mask.36233623+ * snd_soc_xlate_tdm_slot - generate tx/rx slot mask.36243624 * @slots: Number of slots in use.36253625 * @tx_mask: bitmask representing active TX slots.36263626 * @rx_mask: bitmask representing active RX slots.36273627 *36283628 * Generates the TDM tx and rx slot default masks for DAI.36293629 */36303630-static int snd_soc_of_xlate_tdm_slot_mask(unsigned int slots,36303630+static int snd_soc_xlate_tdm_slot_mask(unsigned int slots,36313631 unsigned int *tx_mask,36323632 unsigned int *rx_mask)36333633{···36573657int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,36583658 unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)36593659{36603660- if (dai->driver && dai->driver->ops->of_xlate_tdm_slot_mask)36613661- dai->driver->ops->of_xlate_tdm_slot_mask(slots,36603660+ if (dai->driver && dai->driver->ops->xlate_tdm_slot_mask)36613661+ dai->driver->ops->xlate_tdm_slot_mask(slots,36623662 &tx_mask, &rx_mask);36633663 else36643664- snd_soc_of_xlate_tdm_slot_mask(slots, &tx_mask, &rx_mask);36643664+ snd_soc_xlate_tdm_slot_mask(slots, &tx_mask, &rx_mask);3665366536663666 if (dai->driver && dai->driver->ops->set_tdm_slot)36673667 return dai->driver->ops->set_tdm_slot(dai, tx_mask, rx_mask,
+1-14
sound/soc/tegra/tegra20_ac97.c
···3737#include <sound/soc.h>3838#include <sound/dmaengine_pcm.h>39394040-#include "tegra_asoc_utils.h"4140#include "tegra20_ac97.h"42414342#define DRV_NAME "tegra20-ac97"···375376 ac97->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;376377 ac97->playback_dma_data.maxburst = 4;377378378378- ret = tegra_asoc_utils_init(&ac97->util_data, &pdev->dev);379379- if (ret)380380- goto err_clk_put;381381-382382- ret = tegra_asoc_utils_set_ac97_rate(&ac97->util_data);383383- if (ret)384384- goto err_asoc_utils_fini;385385-386379 ret = clk_prepare_enable(ac97->clk_ac97);387380 if (ret) {388381 dev_err(&pdev->dev, "clk_enable failed: %d\n", ret);389389- goto err_asoc_utils_fini;382382+ goto err;390383 }391384392385 ret = snd_soc_set_ac97_ops(&tegra20_ac97_ops);···410419 snd_soc_unregister_component(&pdev->dev);411420err_clk_disable_unprepare:412421 clk_disable_unprepare(ac97->clk_ac97);413413-err_asoc_utils_fini:414414- tegra_asoc_utils_fini(&ac97->util_data);415422err_clk_put:416423err:417424 snd_soc_set_ac97_ops(NULL);···422433423434 tegra_pcm_platform_unregister(&pdev->dev);424435 snd_soc_unregister_component(&pdev->dev);425425-426426- tegra_asoc_utils_fini(&ac97->util_data);427436428437 clk_disable_unprepare(ac97->clk_ac97);429438
-1
sound/soc/tegra/tegra20_ac97.h
···9090 struct regmap *regmap;9191 int reset_gpio;9292 int sync_gpio;9393- struct tegra_asoc_utils_data util_data;9493};9594#endif /* __TEGRA20_AC97_H__ */