diff options
author | Mark Brown <broonie@linaro.org> | 2014-02-23 00:26:10 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-02-23 00:26:21 -0500 |
commit | ff2878644eed7765a917a02d0af864697ceaf73e (patch) | |
tree | d423631b020aaa4a08afea7d6da60c5db348abf5 /sound | |
parent | 66841345073b049c0c194486bac4d7f07266a57e (diff) | |
parent | 89c6785715592a6b082b3f9f28c27bb14b041c7d (diff) |
Merge branch 'topic/of' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-simple
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-core.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 0540cb08e0ea..5b7d3ba87c7a 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -3609,6 +3609,30 @@ int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) | |||
3609 | EXPORT_SYMBOL_GPL(snd_soc_dai_set_fmt); | 3609 | EXPORT_SYMBOL_GPL(snd_soc_dai_set_fmt); |
3610 | 3610 | ||
3611 | /** | 3611 | /** |
3612 | * snd_soc_of_xlate_tdm_slot - generate tx/rx slot mask. | ||
3613 | * @slots: Number of slots in use. | ||
3614 | * @tx_mask: bitmask representing active TX slots. | ||
3615 | * @rx_mask: bitmask representing active RX slots. | ||
3616 | * | ||
3617 | * Generates the TDM tx and rx slot default masks for DAI. | ||
3618 | */ | ||
3619 | static int snd_soc_of_xlate_tdm_slot_mask(unsigned int slots, | ||
3620 | unsigned int *tx_mask, | ||
3621 | unsigned int *rx_mask) | ||
3622 | { | ||
3623 | if (*tx_mask || *rx_mask) | ||
3624 | return 0; | ||
3625 | |||
3626 | if (!slots) | ||
3627 | return -EINVAL; | ||
3628 | |||
3629 | *tx_mask = (1 << slots) - 1; | ||
3630 | *rx_mask = (1 << slots) - 1; | ||
3631 | |||
3632 | return 0; | ||
3633 | } | ||
3634 | |||
3635 | /** | ||
3612 | * snd_soc_dai_set_tdm_slot - configure DAI TDM. | 3636 | * snd_soc_dai_set_tdm_slot - configure DAI TDM. |
3613 | * @dai: DAI | 3637 | * @dai: DAI |
3614 | * @tx_mask: bitmask representing active TX slots. | 3638 | * @tx_mask: bitmask representing active TX slots. |
@@ -3622,6 +3646,12 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_fmt); | |||
3622 | int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, | 3646 | int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, |
3623 | unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) | 3647 | unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) |
3624 | { | 3648 | { |
3649 | if (dai->driver && dai->driver->ops->of_xlate_tdm_slot_mask) | ||
3650 | dai->driver->ops->of_xlate_tdm_slot_mask(slots, | ||
3651 | &tx_mask, &rx_mask); | ||
3652 | else | ||
3653 | snd_soc_of_xlate_tdm_slot_mask(slots, &tx_mask, &rx_mask); | ||
3654 | |||
3625 | if (dai->driver && dai->driver->ops->set_tdm_slot) | 3655 | if (dai->driver && dai->driver->ops->set_tdm_slot) |
3626 | return dai->driver->ops->set_tdm_slot(dai, tx_mask, rx_mask, | 3656 | return dai->driver->ops->set_tdm_slot(dai, tx_mask, rx_mask, |
3627 | slots, slot_width); | 3657 | slots, slot_width); |
@@ -4504,6 +4534,35 @@ int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card, | |||
4504 | } | 4534 | } |
4505 | EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_simple_widgets); | 4535 | EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_simple_widgets); |
4506 | 4536 | ||
4537 | int snd_soc_of_parse_tdm_slot(struct device_node *np, | ||
4538 | unsigned int *slots, | ||
4539 | unsigned int *slot_width) | ||
4540 | { | ||
4541 | u32 val; | ||
4542 | int ret; | ||
4543 | |||
4544 | if (of_property_read_bool(np, "dai-tdm-slot-num")) { | ||
4545 | ret = of_property_read_u32(np, "dai-tdm-slot-num", &val); | ||
4546 | if (ret) | ||
4547 | return ret; | ||
4548 | |||
4549 | if (slots) | ||
4550 | *slots = val; | ||
4551 | } | ||
4552 | |||
4553 | if (of_property_read_bool(np, "dai-tdm-slot-width")) { | ||
4554 | ret = of_property_read_u32(np, "dai-tdm-slot-width", &val); | ||
4555 | if (ret) | ||
4556 | return ret; | ||
4557 | |||
4558 | if (slot_width) | ||
4559 | *slot_width = val; | ||
4560 | } | ||
4561 | |||
4562 | return 0; | ||
4563 | } | ||
4564 | EXPORT_SYMBOL_GPL(snd_soc_of_parse_tdm_slot); | ||
4565 | |||
4507 | int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | 4566 | int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, |
4508 | const char *propname) | 4567 | const char *propname) |
4509 | { | 4568 | { |