Alsa-dapm

Материал из Toshiba AC100 wiki
Перейти к: навигация, поиск

PAGE IS NOT COMPLETED

Links

wm8903.c from nVidia's tree. full codec path

Samples of DAPM usage

Example 1

Dapm example1.PNG

SND_SOC_DAPM_INPUT("DMICDAT"),

SND_SOC_DAPM_AIF_OUT("AIFTXL", "HiFi Capture", 0, SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_AIF_OUT("AIFTXR", "HiFi Capture", 0, SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_AIF_OUT("VAIFTX", "Voice Capture", 0, SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_AIF_OUT("VAIFRX", "Voice Playback", 0, SND_SOC_NOPM, 0, 0),

/* ADC right output select */
static const char *adcr_func_sel[] = {"Stereo ADC", "Voice ADC"};
static const struct soc_enum adcr_func_enum =
        SOC_ENUM_SINGLE(DAC_FUNC_SELECT, 5, 2, adcr_func_sel);
static const struct snd_kcontrol_new adcr_func_controls =
        SOC_DAPM_ENUM("ADCR Mux", adcr_func_enum); // is name important?

/* I2S out select */
static const char *i2s_out_sel[] = {"ADC LR", "Voice Stereo Digital"};
static const struct soc_enum i2s_out_enum =
        SOC_ENUM_SINGLE(I2S_OUT_CTL, 5, 2, i2s_out_sel);
static cpmst struct snd_kcontrol_new i2s_out_controls =
        SOC_DAPM_ENUM("I2SOut Mux", i2s_out_enum);

/* input mixers */
SND_SOC_DAPM_MIXER("Left Capture Mix", PWR_MANAG_ADD2, 1, 0,
        &captureL_mixer_controls[0],
        ARRAY_SIZE(captureL_mixer_controls)),
SND_SOC_DAPM_MIXER("Right Capture Mix", PWR_MANAG_ADD2, 0, 0,
        &captureR_mixer_controls[0],
        ARRAY_SIZE(captureR_mixer_controls)),

/* DACs and ADCs */
SND_SOC_DAPM_ADC("Voice DAC", NULL, PWR_MANAG_ADD2, 10, 0),
SND_SOC_DAPM_ADC("Left ADC", NULL, PWR_MANAG_ADD2, 7, 0),
SND_SOC_DAPM_ADC("Right ADC", NULL, PWR_MANAG_ADD2, 6, 0),

/* Muxes */
SND_SOC_DAPM_MUX("ADCR Mux", SND_SOC_NOPM, 0, 0, &adcr_func_controls),
SND_SOC_DAPM_MUX("I2SOut Mux", SND_SOC_NOPM, 0, 0, &i2s_out_controls),

Routes:

{"Left Capture Mix", "Mic Capture Switch", "Mic"},
{"Left Capture Mix", "SeakerL Capture Switch", "Speaker"},
{"Right Capture Mix", "Mic Capture Switch", "Mic"},
{"Right Capture Mix", "SeakerR Capture Switch", "Speaker"},

/* left ADC */
{"Left ADC", NULL, "Left Capture Mix"},
{"Left ADC", NULL, "DMICDAT"},
{"I2SOut Mux", "ADC LR", "Left ADC"},

/* right ADC */
{"Right ADC", NULL, "Right Capture Mix"},
{"Right ADC", NULL, "DMICDAT"},
{"ADCR Mux", "Stereo ADC", "Right ADC"},
{"ADCR Mux", "Voice ADC", "Right ADC"},
{"I2SOut Mux", "ADC LR", "ADCR Mux"},
{"I2SOut Mux", "Voice Stereo Digital", "VAIFRX"},

/* HiFi Capture */
{"AIFTXL", NULL, "I2SOut Mux"}
{"AIFTXR", NULL, "I2SOut Mux"}

/* Voice Capture */
{"VAIFTX", NULL, "ADCR Mux"},

/* Voice Playback */
{"Voice DAC", NULL, "VAIFRX"}


WRONG IMAGE!!! Dapm example1 graph.png