~ubuntu-branches/ubuntu/precise/alsa-driver/precise

« back to all changes in this revision

Viewing changes to alsa-kernel/soc/codecs/wm9713.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2009-11-04 16:28:58 UTC
  • mfrom: (1.1.12 upstream) (3.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091104162858-7ky0tu33d7mn6oys
Tags: 1.0.21+dfsg-3ubuntu1
* Merge from debian unstable, remaining changes:
  - Script paths (/usr/sbin -> /sbin, /usr/bin -> /bin);
  - debian/rules:
    + Don't install snddevices and program-wrapper
    + install alsa-base apport hook
    + Package separate USB card list file
  - Vcs and maintainer fields mangling
  - Rename blacklist files in /etc/modprobe.d to be consistant with the rest
    of the distro
  - debian/alsa-base.init:
    + create /var/run/alsa if it doesn't exist
    + Run alsactl store before force unloading modules
    + Run alsactl restore after reloading unloaded modules
  - debian/linux-sound-base.postrm: Remove /etc/modprobe.d/blacklist* files
    on package removal
  - Add missing $CMDLINE_OPTS to all install rules.
  - Replace -Q with --quiet.
  - Add --use-blacklist to all rules so the blacklist still takes effect.
  - debian/alsa-base.postinst: Do not run snddevices
  - retain patches:
    + add_suspend_quirk_hp_nc6220_nw8240.patch,
    + refix_lp_68659_by_disabling_dxs_for_0x1458a002.patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
189
189
SOC_SINGLE("3D Depth", AC97_REC_GAIN_MIC, 0, 15, 1),
190
190
};
191
191
 
 
192
static int wm9713_voice_shutdown(struct snd_soc_dapm_widget *w,
 
193
                                 struct snd_kcontrol *kcontrol, int event)
 
194
{
 
195
        struct snd_soc_codec *codec = w->codec;
 
196
        u16 status, rate;
 
197
 
 
198
        BUG_ON(event != SND_SOC_DAPM_PRE_PMD);
 
199
 
 
200
        /* Gracefully shut down the voice interface. */
 
201
        status = ac97_read(codec, AC97_EXTENDED_MID) | 0x1000;
 
202
        rate = ac97_read(codec, AC97_HANDSET_RATE) & 0xF0FF;
 
203
        ac97_write(codec, AC97_HANDSET_RATE, rate | 0x0200);
 
204
        schedule_timeout_interruptible(msecs_to_jiffies(1));
 
205
        ac97_write(codec, AC97_HANDSET_RATE, rate | 0x0F00);
 
206
        ac97_write(codec, AC97_EXTENDED_MID, status);
 
207
 
 
208
        return 0;
 
209
}
 
210
 
 
211
 
192
212
/* We have to create a fake left and right HP mixers because
193
213
 * the codec only has a single control that is shared by both channels.
194
214
 * This makes it impossible to determine the audio path using the current
400
420
SND_SOC_DAPM_MIXER("HP Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
401
421
SND_SOC_DAPM_MIXER("Line Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
402
422
SND_SOC_DAPM_MIXER("Capture Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
403
 
SND_SOC_DAPM_DAC("Voice DAC", "Voice Playback", AC97_EXTENDED_MID, 12, 1),
 
423
SND_SOC_DAPM_DAC_E("Voice DAC", "Voice Playback", AC97_EXTENDED_MID, 12, 1,
 
424
                   wm9713_voice_shutdown, SND_SOC_DAPM_PRE_PMD),
404
425
SND_SOC_DAPM_DAC("Aux DAC", "Aux Playback", AC97_EXTENDED_MID, 11, 1),
405
426
SND_SOC_DAPM_PGA("Left ADC", AC97_EXTENDED_MID, 5, 1, NULL, 0),
406
427
SND_SOC_DAPM_PGA("Right ADC", AC97_EXTENDED_MID, 4, 1, NULL, 0),
689
710
        Ndiv = target / source;
690
711
        if ((Ndiv < 5) || (Ndiv > 12))
691
712
                printk(KERN_WARNING
692
 
                        "WM9713 PLL N value %d out of recommended range!\n",
 
713
                        "WM9713 PLL N value %u out of recommended range!\n",
693
714
                        Ndiv);
694
715
 
695
716
        pll_div->n = Ndiv;
936
957
        return 0;
937
958
}
938
959
 
939
 
static void wm9713_voiceshutdown(struct snd_pcm_substream *substream,
940
 
                                 struct snd_soc_dai *dai)
941
 
{
942
 
        struct snd_soc_codec *codec = dai->codec;
943
 
        u16 status, rate;
944
 
 
945
 
        /* Gracefully shut down the voice interface. */
946
 
        status = ac97_read(codec, AC97_EXTENDED_STATUS) | 0x1000;
947
 
        rate = ac97_read(codec, AC97_HANDSET_RATE) & 0xF0FF;
948
 
        ac97_write(codec, AC97_HANDSET_RATE, rate | 0x0200);
949
 
        schedule_timeout_interruptible(msecs_to_jiffies(1));
950
 
        ac97_write(codec, AC97_HANDSET_RATE, rate | 0x0F00);
951
 
        ac97_write(codec, AC97_EXTENDED_MID, status);
952
 
}
953
 
 
954
960
static int ac97_hifi_prepare(struct snd_pcm_substream *substream,
955
961
                             struct snd_soc_dai *dai)
956
962
{
1019
1025
 
1020
1026
static struct snd_soc_dai_ops wm9713_dai_ops_voice = {
1021
1027
        .hw_params      = wm9713_pcm_hw_params,
1022
 
        .shutdown       = wm9713_voiceshutdown,
1023
1028
        .set_clkdiv     = wm9713_set_dai_clkdiv,
1024
1029
        .set_pll        = wm9713_set_dai_pll,
1025
1030
        .set_fmt        = wm9713_set_dai_fmt,
1035
1040
                .channels_min = 1,
1036
1041
                .channels_max = 2,
1037
1042
                .rates = WM9713_RATES,
1038
 
                .formats = SNDRV_PCM_FMTBIT_S16_LE,},
 
1043
                .formats = SND_SOC_STD_AC97_FMTS,},
1039
1044
        .capture = {
1040
1045
                .stream_name = "HiFi Capture",
1041
1046
                .channels_min = 1,
1042
1047
                .channels_max = 2,
1043
1048
                .rates = WM9713_RATES,
1044
 
                .formats = SNDRV_PCM_FMTBIT_S16_LE,},
 
1049
                .formats = SND_SOC_STD_AC97_FMTS,},
1045
1050
        .ops = &wm9713_dai_ops_hifi,
1046
1051
        },
1047
1052
        {
1051
1056
                .channels_min = 1,
1052
1057
                .channels_max = 1,
1053
1058
                .rates = WM9713_RATES,
1054
 
                .formats = SNDRV_PCM_FMTBIT_S16_LE,},
 
1059
                .formats = SND_SOC_STD_AC97_FMTS,},
1055
1060
        .ops = &wm9713_dai_ops_aux,
1056
1061
        },
1057
1062
        {
1069
1074
                .rates = WM9713_PCM_RATES,
1070
1075
                .formats = WM9713_PCM_FORMATS,},
1071
1076
        .ops = &wm9713_dai_ops_voice,
 
1077
        .symmetric_rates = 1,
1072
1078
        },
1073
1079
};
1074
1080
EXPORT_SYMBOL_GPL(wm9713_dai);