diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-03-31 12:33:09 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-03-31 12:33:09 +0200 |
commit | 69dd89fd2b9406603d218cab8996cfb232d5b8b9 (patch) | |
tree | 467a65877d0c550ae7c937bc658abd313958122f /sound/soc/fsl/fsl_utils.c | |
parent | 8c1d843460f42417d6b9553147a1a04ca1470602 (diff) | |
parent | c159a85013afbb8283f0c7272812952e04d5c3a1 (diff) |
Merge tag 'asoc-v3.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linussound-3.15-rc1
ASoC: Final updates for v3.15 merge window
A few more updates from last week - use of the tdm_slot mapping from
Xiubo plus a few smaller fixes and cleanups.
Diffstat (limited to 'sound/soc/fsl/fsl_utils.c')
-rw-r--r-- | sound/soc/fsl/fsl_utils.c | 27 |
1 files changed, 27 insertions, 0 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, } EXPORT_SYMBOL(fsl_asoc_get_dma_channel); +/** + * fsl_asoc_xlate_tdm_slot_mask - generate TDM slot TX/RX mask. + * + * @slots: Number of slots in use. + * @tx_mask: bitmask representing active TX slots. + * @rx_mask: bitmask representing active RX slots. + * + * This function used to generate the TDM slot TX/RX mask. And the TX/RX + * mask will use a 0 bit for an active slot as default, and the default + * active bits are at the LSB of the mask value. + */ +int fsl_asoc_xlate_tdm_slot_mask(unsigned int slots, + unsigned int *tx_mask, + unsigned int *rx_mask) +{ + if (!slots) + return -EINVAL; + + if (tx_mask) + *tx_mask = ~((1 << slots) - 1); + if (rx_mask) + *rx_mask = ~((1 << slots) - 1); + + return 0; +} +EXPORT_SYMBOL_GPL(fsl_asoc_xlate_tdm_slot_mask); + MODULE_AUTHOR("Timur Tabi <timur@freescale.com>"); MODULE_DESCRIPTION("Freescale ASoC utility code"); MODULE_LICENSE("GPL v2"); |