aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/ab8500-codec.c
diff options
context:
space:
mode:
authorFabio Baltieri <fabio.baltieri@linaro.org>2013-05-21 06:04:09 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-05-21 12:39:34 -0400
commitda33d723bcb3569400685b4e6e75a9894e2f42a7 (patch)
tree14c531a6c8e56cf12cd94c653d36973402b4736c /sound/soc/codecs/ab8500-codec.c
parent4510dbe324876f2f2f3dc9931e97ec0e98f1ee26 (diff)
ASoC: ab8500-codec: Set rx dai slots from rx_mask
Replace hard coded rx slot numbers from ab8500_codec_set_dai_tdm_slot using the ones requested by the machine driver in rx_mask instead. Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/ab8500-codec.c')
-rw-r--r--sound/soc/codecs/ab8500-codec.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c
index bace321a83dd..4ca45b9d9625 100644
--- a/sound/soc/codecs/ab8500-codec.c
+++ b/sound/soc/codecs/ab8500-codec.c
@@ -2334,25 +2334,36 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
2334 } 2334 }
2335 2335
2336 /* Setup TDM AD according to active RX-slots */ 2336 /* Setup TDM AD according to active RX-slots */
2337
2338 if (rx_mask & ~0xff)
2339 return -EINVAL;
2340
2341 rx_mask = rx_mask << AB8500_AD_DATA0_OFFSET;
2337 slots_active = hweight32(rx_mask); 2342 slots_active = hweight32(rx_mask);
2343
2338 dev_dbg(dai->codec->dev, "%s: Slots, active, RX: %d\n", __func__, 2344 dev_dbg(dai->codec->dev, "%s: Slots, active, RX: %d\n", __func__,
2339 slots_active); 2345 slots_active);
2346
2340 switch (slots_active) { 2347 switch (slots_active) {
2341 case 0: 2348 case 0:
2342 break; 2349 break;
2343 case 1: 2350 case 1:
2344 /* AD_OUT3 -> slot 0 & 1 */ 2351 slot = find_first_bit((unsigned long *)&rx_mask, 32);
2345 snd_soc_update_bits(codec, AB8500_ADSLOTSEL1, AB8500_MASK_ALL, 2352 snd_soc_update_bits(codec, AB8500_ADSLOTSEL(slot),
2346 AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_EVEN | 2353 AB8500_MASK_SLOT(slot),
2347 AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_ODD); 2354 AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot));
2348 break; 2355 break;
2349 case 2: 2356 case 2:
2350 /* AD_OUT3 -> slot 0, AD_OUT2 -> slot 1 */ 2357 slot = find_first_bit((unsigned long *)&rx_mask, 32);
2358 snd_soc_update_bits(codec,
2359 AB8500_ADSLOTSEL(slot),
2360 AB8500_MASK_SLOT(slot),
2361 AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot));
2362 slot = find_next_bit((unsigned long *)&rx_mask, 32, slot + 1);
2351 snd_soc_update_bits(codec, 2363 snd_soc_update_bits(codec,
2352 AB8500_ADSLOTSEL1, 2364 AB8500_ADSLOTSEL(slot),
2353 AB8500_MASK_ALL, 2365 AB8500_MASK_SLOT(slot),
2354 AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_EVEN | 2366 AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT2, slot));
2355 AB8500_ADSLOTSELX_AD_OUT2_TO_SLOT_ODD);
2356 break; 2367 break;
2357 case 8: 2368 case 8:
2358 dev_dbg(dai->codec->dev, 2369 dev_dbg(dai->codec->dev,