diff options
-rw-r--r-- | sound/soc/codecs/tlv320dac33.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index c684aa23bd51..bc35f3ff8717 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c | |||
@@ -62,6 +62,7 @@ enum dac33_state { | |||
62 | enum dac33_fifo_modes { | 62 | enum dac33_fifo_modes { |
63 | DAC33_FIFO_BYPASS = 0, | 63 | DAC33_FIFO_BYPASS = 0, |
64 | DAC33_FIFO_MODE1, | 64 | DAC33_FIFO_MODE1, |
65 | DAC33_FIFO_MODE7, | ||
65 | DAC33_FIFO_LAST_MODE, | 66 | DAC33_FIFO_LAST_MODE, |
66 | }; | 67 | }; |
67 | 68 | ||
@@ -422,7 +423,7 @@ static int dac33_set_fifo_mode(struct snd_kcontrol *kcontrol, | |||
422 | 423 | ||
423 | /* Codec operation modes */ | 424 | /* Codec operation modes */ |
424 | static const char *dac33_fifo_mode_texts[] = { | 425 | static const char *dac33_fifo_mode_texts[] = { |
425 | "Bypass", "Mode 1" | 426 | "Bypass", "Mode 1", "Mode 7" |
426 | }; | 427 | }; |
427 | 428 | ||
428 | static const struct soc_enum dac33_fifo_mode_enum = | 429 | static const struct soc_enum dac33_fifo_mode_enum = |
@@ -556,6 +557,10 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33) | |||
556 | dac33_write16(codec, DAC33_PREFILL_MSB, | 557 | dac33_write16(codec, DAC33_PREFILL_MSB, |
557 | DAC33_THRREG(dac33->alarm_threshold)); | 558 | DAC33_THRREG(dac33->alarm_threshold)); |
558 | break; | 559 | break; |
560 | case DAC33_FIFO_MODE7: | ||
561 | dac33_write16(codec, DAC33_PREFILL_MSB, | ||
562 | DAC33_THRREG(20)); | ||
563 | break; | ||
559 | default: | 564 | default: |
560 | dev_warn(codec->dev, "Unhandled FIFO mode: %d\n", | 565 | dev_warn(codec->dev, "Unhandled FIFO mode: %d\n", |
561 | dac33->fifo_mode); | 566 | dac33->fifo_mode); |
@@ -574,6 +579,9 @@ static inline void dac33_playback_handler(struct tlv320dac33_priv *dac33) | |||
574 | dac33_write16(codec, DAC33_NSAMPLE_MSB, | 579 | dac33_write16(codec, DAC33_NSAMPLE_MSB, |
575 | DAC33_THRREG(dac33->nsample)); | 580 | DAC33_THRREG(dac33->nsample)); |
576 | break; | 581 | break; |
582 | case DAC33_FIFO_MODE7: | ||
583 | /* At the moment we are not using interrupts in mode7 */ | ||
584 | break; | ||
577 | default: | 585 | default: |
578 | dev_warn(codec->dev, "Unhandled FIFO mode: %d\n", | 586 | dev_warn(codec->dev, "Unhandled FIFO mode: %d\n", |
579 | dac33->fifo_mode); | 587 | dac33->fifo_mode); |
@@ -788,6 +796,10 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream) | |||
788 | DAC33_ATM(DAC33_FIFO_IRQ_MODE_LEVEL)); | 796 | DAC33_ATM(DAC33_FIFO_IRQ_MODE_LEVEL)); |
789 | dac33_write(codec, DAC33_FIFO_IRQ_MASK, DAC33_MAT); | 797 | dac33_write(codec, DAC33_FIFO_IRQ_MASK, DAC33_MAT); |
790 | break; | 798 | break; |
799 | case DAC33_FIFO_MODE7: | ||
800 | /* Disable all interrupts */ | ||
801 | dac33_write(codec, DAC33_FIFO_IRQ_MASK, 0); | ||
802 | break; | ||
791 | default: | 803 | default: |
792 | /* in FIFO bypass mode, the interrupts are not used */ | 804 | /* in FIFO bypass mode, the interrupts are not used */ |
793 | break; | 805 | break; |
@@ -807,6 +819,17 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream) | |||
807 | fifoctrl_a &= ~DAC33_FAUTO; | 819 | fifoctrl_a &= ~DAC33_FAUTO; |
808 | aictrl_b &= ~DAC33_BCLKON; | 820 | aictrl_b &= ~DAC33_BCLKON; |
809 | break; | 821 | break; |
822 | case DAC33_FIFO_MODE7: | ||
823 | /* | ||
824 | * For mode1: | ||
825 | * Disable the FIFO bypass (Enable the use of FIFO) | ||
826 | * Select Threshold mode | ||
827 | * BCLK is only running when data is needed by DAC33 | ||
828 | */ | ||
829 | fifoctrl_a &= ~DAC33_FBYPAS; | ||
830 | fifoctrl_a |= DAC33_FAUTO; | ||
831 | aictrl_b &= ~DAC33_BCLKON; | ||
832 | break; | ||
810 | default: | 833 | default: |
811 | /* | 834 | /* |
812 | * For FIFO bypass mode: | 835 | * For FIFO bypass mode: |
@@ -830,6 +853,16 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream) | |||
830 | dac33_write16(codec, DAC33_ATHR_MSB, | 853 | dac33_write16(codec, DAC33_ATHR_MSB, |
831 | DAC33_THRREG(dac33->alarm_threshold)); | 854 | DAC33_THRREG(dac33->alarm_threshold)); |
832 | break; | 855 | break; |
856 | case DAC33_FIFO_MODE7: | ||
857 | /* | ||
858 | * Configure the threshold levels, and leave 10 sample space | ||
859 | * at the bottom, and also at the top of the FIFO | ||
860 | */ | ||
861 | dac33_write16(codec, DAC33_UTHR_MSB, | ||
862 | DAC33_THRREG(DAC33_BUFFER_SIZE_SAMPLES - 10)); | ||
863 | dac33_write16(codec, DAC33_LTHR_MSB, | ||
864 | DAC33_THRREG(10)); | ||
865 | break; | ||
833 | default: | 866 | default: |
834 | /* BYPASS mode */ | 867 | /* BYPASS mode */ |
835 | dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_C, 32); | 868 | dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_C, 32); |