aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/tlv320dac33.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/tlv320dac33.c')
-rw-r--r--sound/soc/codecs/tlv320dac33.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index bf6d01f4a45a..d251ff54a2d3 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -524,6 +524,22 @@ static const struct soc_enum dac33_fifo_mode_enum =
524 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(dac33_fifo_mode_texts), 524 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(dac33_fifo_mode_texts),
525 dac33_fifo_mode_texts); 525 dac33_fifo_mode_texts);
526 526
527/* L/R Line Output Gain */
528static const char *lr_lineout_gain_texts[] = {
529 "Line -12dB DAC 0dB", "Line -6dB DAC 6dB",
530 "Line 0dB DAC 12dB", "Line 6dB DAC 18dB",
531};
532
533static const struct soc_enum l_lineout_gain_enum =
534 SOC_ENUM_SINGLE(DAC33_LDAC_PWR_CTRL, 0,
535 ARRAY_SIZE(lr_lineout_gain_texts),
536 lr_lineout_gain_texts);
537
538static const struct soc_enum r_lineout_gain_enum =
539 SOC_ENUM_SINGLE(DAC33_RDAC_PWR_CTRL, 0,
540 ARRAY_SIZE(lr_lineout_gain_texts),
541 lr_lineout_gain_texts);
542
527/* 543/*
528 * DACL/R digital volume control: 544 * DACL/R digital volume control:
529 * from 0 dB to -63.5 in 0.5 dB steps 545 * from 0 dB to -63.5 in 0.5 dB steps
@@ -541,6 +557,8 @@ static const struct snd_kcontrol_new dac33_snd_controls[] = {
541 DAC33_LDAC_DIG_VOL_CTRL, DAC33_RDAC_DIG_VOL_CTRL, 7, 1, 1), 557 DAC33_LDAC_DIG_VOL_CTRL, DAC33_RDAC_DIG_VOL_CTRL, 7, 1, 1),
542 SOC_DOUBLE_R("Line to Line Out Volume", 558 SOC_DOUBLE_R("Line to Line Out Volume",
543 DAC33_LINEL_TO_LLO_VOL, DAC33_LINER_TO_RLO_VOL, 0, 127, 1), 559 DAC33_LINEL_TO_LLO_VOL, DAC33_LINER_TO_RLO_VOL, 0, 127, 1),
560 SOC_ENUM("Left Line Output Gain", l_lineout_gain_enum),
561 SOC_ENUM("Right Line Output Gain", r_lineout_gain_enum),
544}; 562};
545 563
546static const struct snd_kcontrol_new dac33_mode_snd_controls[] = { 564static const struct snd_kcontrol_new dac33_mode_snd_controls[] = {
@@ -651,6 +669,7 @@ static int dac33_set_bias_level(struct snd_soc_codec *codec,
651static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33) 669static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33)
652{ 670{
653 struct snd_soc_codec *codec = dac33->codec; 671 struct snd_soc_codec *codec = dac33->codec;
672 unsigned int delay;
654 673
655 switch (dac33->fifo_mode) { 674 switch (dac33->fifo_mode) {
656 case DAC33_FIFO_MODE1: 675 case DAC33_FIFO_MODE1:
@@ -666,8 +685,9 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33)
666 dac33_write16(codec, DAC33_PREFILL_MSB, 685 dac33_write16(codec, DAC33_PREFILL_MSB,
667 DAC33_THRREG(dac33->alarm_threshold)); 686 DAC33_THRREG(dac33->alarm_threshold));
668 /* Enable Alarm Threshold IRQ with a delay */ 687 /* Enable Alarm Threshold IRQ with a delay */
669 udelay(SAMPLES_TO_US(dac33->burst_rate, 688 delay = SAMPLES_TO_US(dac33->burst_rate,
670 dac33->alarm_threshold)); 689 dac33->alarm_threshold) + 1000;
690 usleep_range(delay, delay + 500);
671 dac33_write(codec, DAC33_FIFO_IRQ_MASK, DAC33_MAT); 691 dac33_write(codec, DAC33_FIFO_IRQ_MASK, DAC33_MAT);
672 break; 692 break;
673 case DAC33_FIFO_MODE7: 693 case DAC33_FIFO_MODE7:
@@ -767,11 +787,11 @@ static irqreturn_t dac33_interrupt_handler(int irq, void *dev)
767 787
768static void dac33_oscwait(struct snd_soc_codec *codec) 788static void dac33_oscwait(struct snd_soc_codec *codec)
769{ 789{
770 int timeout = 20; 790 int timeout = 60;
771 u8 reg; 791 u8 reg;
772 792
773 do { 793 do {
774 msleep(1); 794 usleep_range(1000, 2000);
775 dac33_read(codec, DAC33_INT_OSC_STATUS, &reg); 795 dac33_read(codec, DAC33_INT_OSC_STATUS, &reg);
776 } while (((reg & 0x03) != DAC33_OSCSTATUS_NORMAL) && timeout--); 796 } while (((reg & 0x03) != DAC33_OSCSTATUS_NORMAL) && timeout--);
777 if ((reg & 0x03) != DAC33_OSCSTATUS_NORMAL) 797 if ((reg & 0x03) != DAC33_OSCSTATUS_NORMAL)