diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 19:52:22 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 19:52:22 -0700 |
commit | 1286da8bc009cb2aee7f285e94623fc974c0c983 (patch) | |
tree | 51ec0a79c3de63fa809b831ae0cbb5b85e44482f /sound/soc/codecs/ab8500-codec.c | |
parent | 9e220385c4eb8b7e66174a60ea0e15b6b296f228 (diff) | |
parent | 1ba65ae4bdbd43265c51ee4c30ff21a48124b6d8 (diff) |
Merge tag 'sound-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai:
"A relative calm release at this time with a flat diffstat. The only
significant change in the ALSA core side is the support for more than
32 card instances, configurable via kconfig. Other than that, in both
ASoC and other parts, mostly some improvements and fixes on the driver
side.
- hda: More quirks for ALC269-variants on Dell & co, VIA codec fixes
- hda: Haswell HDMI audio fixes, runtime PM improvements
- hda: Intel BayTrail support, ALC5505 DSP support
- es1968: MediaForte M56VAP support
- usb-audio: Improved support for Yamaha/Roland devices
- usb-audio: M2Tech hiFace, Audio Advantage Micro II support
- hdspm: wordclock fixes
- ASoC: Pending fixes for WM8962
- ASoC: Cleanups and fixes for Blackfin, SGTL5000 and UX500
- ASoC: Generalisation of the Bluetooth and HDMI stub drivers
- ASoC: SSM2518 and RT5640 codec drivers.
- ASoC: Tegra CPUs with RT5640 machine driver
- ASoC: AC'97 refactoring bug fixes
- ASoC: ADAU1701 driver fixes
- Clean up of *_set_drvdata() in a wide range of drivers"
* tag 'sound-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (284 commits)
ALSA: vmaster: Fix the regression of missing vmaster hook call
ALSA: hda - Add Dell SSID to support Headset Mic recording
ASoC: adau1701: remove control_data assignment
ASoC: adau1701: more direct regmap usage
ASoC: ac97: fixup multi-platform AC'97 module build failure
ASoC: pxa2xx: fixup multi-platform AC'97 build failures
ASoC: tegra20-ac97: Remove unused variable
ASoC: tegra20-ac97: Remove duplicate error message
ALSA: usb-audio: Add Audio Advantage Micro II
ASoC: tas5086: fix Mid-Z implementation
ASoC: tas5086: fix TAS5086_CLOCK_CONTROL register size
ALSA: Replace the magic number 44 with const
ALSA: hda - Fix the max length of control name in generic parser
ALSA: hda - Guess what, it's two more Dell headset mic quirks
ALSA: hda - Yet another Dell headset mic quirk
ALSA: hda - Add support for ALC5505 DSP power-save mode
ASoC: mfld: Remove unused variable
ALSA: usb-audio: add quirks for Roland QUAD/OCTO-CAPTURE
ALSA: usb-audio: claim autodetected PCM interfaces all at once
ALSA: usb-audio: remove superfluous Roland quirks
...
Diffstat (limited to 'sound/soc/codecs/ab8500-codec.c')
-rw-r--r-- | sound/soc/codecs/ab8500-codec.c | 85 |
1 files changed, 52 insertions, 33 deletions
diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c index a153b168129b..b8ba0adacfce 100644 --- a/sound/soc/codecs/ab8500-codec.c +++ b/sound/soc/codecs/ab8500-codec.c @@ -1496,6 +1496,12 @@ static const char * const enum_ad_to_slot_map[] = {"AD_OUT1", "AD_OUT7", "AD_OUT8", "zeroes", + "zeroes", + "zeroes", + "zeroes", + "tristate", + "tristate", + "tristate", "tristate"}; static SOC_ENUM_SINGLE_DECL(soc_enum_adslot0map, AB8500_ADSLOTSEL1, AB8500_ADSLOTSELX_EVEN_SHIFT, @@ -2230,7 +2236,7 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, int slots, int slot_width) { struct snd_soc_codec *codec = dai->codec; - unsigned int val, mask, slots_active; + unsigned int val, mask, slot, slots_active; mask = BIT(AB8500_DIGIFCONF2_IF0WL0) | BIT(AB8500_DIGIFCONF2_IF0WL1); @@ -2286,27 +2292,34 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, snd_soc_update_bits(codec, AB8500_DIGIFCONF1, mask, val); /* Setup TDM DA according to active tx slots */ + + if (tx_mask & ~0xff) + return -EINVAL; + mask = AB8500_DASLOTCONFX_SLTODAX_MASK; + tx_mask = tx_mask << AB8500_DA_DATA0_OFFSET; slots_active = hweight32(tx_mask); + dev_dbg(dai->codec->dev, "%s: Slots, active, TX: %d\n", __func__, slots_active); + switch (slots_active) { case 0: break; case 1: - /* Slot 9 -> DA_IN1 & DA_IN3 */ - snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, 11); - snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, 11); - snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, 11); - snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, 11); + slot = find_first_bit((unsigned long *)&tx_mask, 32); + snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot); + snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot); + snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot); + snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot); break; case 2: - /* Slot 9 -> DA_IN1 & DA_IN3, Slot 11 -> DA_IN2 & DA_IN4 */ - snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, 9); - snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, 9); - snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, 11); - snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, 11); - + slot = find_first_bit((unsigned long *)&tx_mask, 32); + snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot); + snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot); + slot = find_next_bit((unsigned long *)&tx_mask, 32, slot + 1); + snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot); + snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot); break; case 8: dev_dbg(dai->codec->dev, @@ -2321,25 +2334,36 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, } /* Setup TDM AD according to active RX-slots */ + + if (rx_mask & ~0xff) + return -EINVAL; + + rx_mask = rx_mask << AB8500_AD_DATA0_OFFSET; slots_active = hweight32(rx_mask); + dev_dbg(dai->codec->dev, "%s: Slots, active, RX: %d\n", __func__, slots_active); + switch (slots_active) { case 0: break; case 1: - /* AD_OUT3 -> slot 0 & 1 */ - snd_soc_update_bits(codec, AB8500_ADSLOTSEL1, AB8500_MASK_ALL, - AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_EVEN | - AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_ODD); + slot = find_first_bit((unsigned long *)&rx_mask, 32); + snd_soc_update_bits(codec, AB8500_ADSLOTSEL(slot), + AB8500_MASK_SLOT(slot), + AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot)); break; case 2: - /* AD_OUT3 -> slot 0, AD_OUT2 -> slot 1 */ + slot = find_first_bit((unsigned long *)&rx_mask, 32); snd_soc_update_bits(codec, - AB8500_ADSLOTSEL1, - AB8500_MASK_ALL, - AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_EVEN | - AB8500_ADSLOTSELX_AD_OUT2_TO_SLOT_ODD); + AB8500_ADSLOTSEL(slot), + AB8500_MASK_SLOT(slot), + AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot)); + slot = find_next_bit((unsigned long *)&rx_mask, 32, slot + 1); + snd_soc_update_bits(codec, + AB8500_ADSLOTSEL(slot), + AB8500_MASK_SLOT(slot), + AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT2, slot)); break; case 8: dev_dbg(dai->codec->dev, @@ -2356,6 +2380,11 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, return 0; } +static const struct snd_soc_dai_ops ab8500_codec_ops = { + .set_fmt = ab8500_codec_set_dai_fmt, + .set_tdm_slot = ab8500_codec_set_dai_tdm_slot, +}; + static struct snd_soc_dai_driver ab8500_codec_dai[] = { { .name = "ab8500-codec-dai.0", @@ -2367,12 +2396,7 @@ static struct snd_soc_dai_driver ab8500_codec_dai[] = { .rates = AB8500_SUPPORTED_RATE, .formats = AB8500_SUPPORTED_FMT, }, - .ops = (struct snd_soc_dai_ops[]) { - { - .set_tdm_slot = ab8500_codec_set_dai_tdm_slot, - .set_fmt = ab8500_codec_set_dai_fmt, - } - }, + .ops = &ab8500_codec_ops, .symmetric_rates = 1 }, { @@ -2385,12 +2409,7 @@ static struct snd_soc_dai_driver ab8500_codec_dai[] = { .rates = AB8500_SUPPORTED_RATE, .formats = AB8500_SUPPORTED_FMT, }, - .ops = (struct snd_soc_dai_ops[]) { - { - .set_tdm_slot = ab8500_codec_set_dai_tdm_slot, - .set_fmt = ab8500_codec_set_dai_fmt, - } - }, + .ops = &ab8500_codec_ops, .symmetric_rates = 1 } }; |