diff options
| -rw-r--r-- | sound/soc/fsl/fsl_utils.c | 27 | ||||
| -rw-r--r-- | sound/soc/fsl/fsl_utils.h | 4 |
2 files changed, 30 insertions, 1 deletions
diff --git a/sound/soc/fsl/fsl_utils.c b/sound/soc/fsl/fsl_utils.c index b9e42b503a37..2ac7755da876 100644 --- a/sound/soc/fsl/fsl_utils.c +++ b/sound/soc/fsl/fsl_utils.c | |||
| @@ -86,6 +86,33 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np, | |||
| 86 | } | 86 | } |
| 87 | EXPORT_SYMBOL(fsl_asoc_get_dma_channel); | 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 | MODULE_AUTHOR("Timur Tabi <timur@freescale.com>"); | 116 | MODULE_AUTHOR("Timur Tabi <timur@freescale.com>"); |
| 90 | MODULE_DESCRIPTION("Freescale ASoC utility code"); | 117 | MODULE_DESCRIPTION("Freescale ASoC utility code"); |
| 91 | MODULE_LICENSE("GPL v2"); | 118 | MODULE_LICENSE("GPL v2"); |
diff --git a/sound/soc/fsl/fsl_utils.h b/sound/soc/fsl/fsl_utils.h index b2951126527c..df535db40313 100644 --- a/sound/soc/fsl/fsl_utils.h +++ b/sound/soc/fsl/fsl_utils.h | |||
| @@ -22,5 +22,7 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np, const char *name, | |||
| 22 | struct snd_soc_dai_link *dai, | 22 | struct snd_soc_dai_link *dai, |
| 23 | unsigned int *dma_channel_id, | 23 | unsigned int *dma_channel_id, |
| 24 | unsigned int *dma_id); | 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 | #endif /* _FSL_UTILS_H */ | 28 | #endif /* _FSL_UTILS_H */ |
