if (ret < 0) { printk("%s: snd_soc_dai_set_sysclk err =%d\n",__FUNCTION__,ret); return ret; } return ret; } static const struct snd_soc_dapm_widget rk29_dapm_widgets[] = { SND_SOC_DAPM_SPK("Ext Left Spk", NULL), SND_SOC_DAPM_SPK("Ext Right Spk", NULL), SND_SOC_DAPM_SPK("Ext Rcv", NULL), SND_SOC_DAPM_HP("Headset Stereophone", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Main Mic", NULL), SND_SOC_DAPM_MIC("2nd Mic", NULL), // SND_SOC_DAPM_LINE("Radio In", NULL), SND_SOC_DAPM_LINE("Line In", NULL), SND_SOC_DAPM_LINE("Line Out", NULL), }; static const struct snd_soc_dapm_route rk29_dapm_routes[] = { {"Ext Left Spk", NULL, "SPKOUTLP"}, {"Ext Left Spk", NULL, "SPKOUTLN"}, {"Ext Right Spk", NULL, "SPKOUTRP"}, {"Ext Right Spk", NULL, "SPKOUTRN"},
return 1; } /* tosa dapm event handlers */ static int tosa_hp_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *k, int event) { gpio_set_value(TOSA_GPIO_L_MUTE, SND_SOC_DAPM_EVENT_ON(event) ? 1 :0); return 0; } /* tosa machine dapm widgets */ static const struct snd_soc_dapm_widget tosa_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", tosa_hp_event), SND_SOC_DAPM_HP("Headset Jack", NULL), SND_SOC_DAPM_MIC("Mic (Internal)", NULL), SND_SOC_DAPM_SPK("Speaker", NULL), }; /* tosa audio map */ static const struct snd_soc_dapm_route audio_map[] = { /* headphone connected to HPOUTL, HPOUTR */ {"Headphone Jack", NULL, "HPOUTL"}, {"Headphone Jack", NULL, "HPOUTR"}, /* ext speaker connected to LOUT2, ROUT2 */ {"Speaker", NULL, "LOUT2"}, {"Speaker", NULL, "ROUT2"}, /* internal mic is connected to mic1, mic2 differential - with bias */
9600000, 5, /* Digital Codec root */ 0, }; static atomic_t mclk_rsc_ref; static struct mutex cdc_mclk_mutex; static int msm8x16_mclk_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event); static const struct snd_soc_dapm_widget msm8x16_dapm_widgets[] = { SND_SOC_DAPM_SUPPLY("MCLK", SND_SOC_NOPM, 0, 0, msm8x16_mclk_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MIC("Handset Mic", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Secondary Mic", NULL), }; static int msm_config_mclk(u16 port_id, struct afe_digital_clk_cfg *cfg) { iowrite32(0x1, ioremap(MSM8X16_TOMBAK_LPASS_DIGCODEC_CBCR, 4)); /* Set the update bit to make the settings go through */ iowrite32(0x1, ioremap(MSM8X16_TOMBAK_LPASS_DIGCODEC_CMD_RCGR, 4)); return 0; } static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
static int rt5616_resume_post(struct snd_soc_card *card) { printk(KERN_DEBUG "enter %s\n", __func__); return 0; } #else #define rt5616_suspend_pre NULL #define rt5616_suspend_post NULL #define rt5616_resume_pre NULL #define rt5616_resume_post NULL #endif static const struct snd_soc_dapm_widget rt5616_dapm_widgets[] = { SND_SOC_DAPM_SPK("Ext Spk", NULL), SND_SOC_DAPM_HP("HP", NULL), SND_SOC_DAPM_MIC("MAIN MIC", NULL), }; static const struct snd_soc_dapm_route rt5616_dapm_intercon[] = { {"Ext Spk", NULL, "LOUTL"}, {"Ext Spk", NULL, "LOUTR"}, {"HP", NULL, "HPOL"}, {"HP", NULL, "HPOR"}, {"MIC1", NULL, "micbias1"}, {"micbias1", NULL, "MAIN MIC"}, }; #if HP_DET
static struct snd_soc_jack_pin tegra_rt5677_mic_jack_pins = { .pin = "Headset Mic", .mask = SND_JACK_MICROPHONE, }; static struct snd_soc_jack_gpio tegra_rt5677_mic_jack_gpio = { .name = "Headset Mic detection", .report = SND_JACK_MICROPHONE, .debounce_time = 150, .invert = 1 }; static const struct snd_soc_dapm_widget tegra_rt5677_dapm_widgets[] = { SND_SOC_DAPM_SPK("Speaker", NULL), SND_SOC_DAPM_HP("Headphone", tegra_rt5677_event_hp), SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Internal Mic 1", NULL), SND_SOC_DAPM_MIC("Internal Mic 2", NULL), }; static const struct snd_kcontrol_new tegra_rt5677_controls[] = { SOC_DAPM_PIN_SWITCH("Speaker"), SOC_DAPM_PIN_SWITCH("Headphone"), SOC_DAPM_PIN_SWITCH("Headset Mic"), SOC_DAPM_PIN_SWITCH("Internal Mic 1"), SOC_DAPM_PIN_SWITCH("Internal Mic 2"), }; static int tegra_rt5677_asoc_init(struct snd_soc_pcm_runtime *rtd) { struct tegra_rt5677 *machine = snd_soc_card_get_drvdata(rtd->card);
} static const char *Tty_mode_texts[]={ "TTY_OFF", "TTY_VCO", "TTY_HCO", "TTY_FULL" }; static const struct soc_enum Tty_mode_soc_enum = SOC_ENUM_SINGLE_EXT(4, Tty_mode_texts); static const struct snd_kcontrol_new tty_mode_control = SOC_ENUM_EXT("Route", Tty_mode_soc_enum, get_tty_mode, set_tty_mode); #endif //[LG_FW_AUDIO_TTY End] static const struct snd_soc_dapm_widget hub_twl4030_dapm_widgets[] = { #if 0 //[email protected] SND_SOC_DAPM_MIC("Ext Mic", NULL), #else SND_SOC_DAPM_MIC("Ext Mic1", NULL), SND_SOC_DAPM_MIC("Ext Mic2", NULL), #endif SND_SOC_DAPM_SPK("Ext Spk", NULL), SND_SOC_DAPM_SPK("Receiver", NULL), SND_SOC_DAPM_HP("Headset Jack", NULL), SND_SOC_DAPM_MIC("Ext Headset Mic", NULL), //[email protected] SND_SOC_DAPM_LINE("Aux In", NULL), SND_SOC_DAPM_MUX("ExtAmp", SND_SOC_NOPM, 0, 0, &ext_amp_mode_control), SND_SOC_DAPM_MUX("Voice", SND_SOC_NOPM, 0, 0, &voice_mode_control), /* LGE_CHANGE_S [[email protected]] 2009-08-06, audio path */ SND_SOC_DAPM_MUX("Mic", SND_SOC_NOPM, 0, 0, &mic_mode_control), // 20100426 [email protected] Add the mic mute [START_LGE] SND_SOC_DAPM_MUX("CallRec", SND_SOC_NOPM, 0, 0, &callrec_mode_control), // 20100521 [email protected] call recording path [START_LGE] //20101205 [email protected] Add STREAM for FM Radio [START] SND_SOC_DAPM_MUX("FMradio", SND_SOC_NOPM, 0, 0, &FM_volume_control),
ret = clk_prepare_enable(ctx->mclk); if (ret < 0) { dev_err(card->dev, "could not configure MCLK state"); return ret; } } else { clk_disable_unprepare(ctx->mclk); } return 0; } static const struct snd_soc_dapm_widget cht_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Int Mic", NULL), SND_SOC_DAPM_SPK("Ext Spk", NULL), SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0, platform_clock_control, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), }; static const struct snd_soc_dapm_route cht_audio_map[] = { {"IN34", NULL, "Headset Mic"}, {"Headset Mic", NULL, "MICBIAS"}, {"DMICL", NULL, "Int Mic"}, {"Headphone", NULL, "HPL"}, {"Headphone", NULL, "HPR"}, {"Ext Spk", NULL, "SPKL"}, {"Ext Spk", NULL, "SPKR"},
SOC_ENUM_EXT("Input Clamp", input_clamp_enum[0], get_input_clamp, set_input_clamp), SOC_ENUM_EXT("LineoutSwitch Mode", lineout_mode_enum[0], get_lineout_mode, set_lineout_mode), }; const struct snd_soc_dapm_widget midas_dapm_widgets[] = { SND_SOC_DAPM_HP("HP", NULL), SND_SOC_DAPM_SPK("SPK", midas_ext_spkmode), SND_SOC_DAPM_SPK("RCV", NULL), SND_SOC_DAPM_LINE("LINE", midas_lineout_switch), SND_SOC_DAPM_LINE("HDMI", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Main Mic", midas_ext_micbias), SND_SOC_DAPM_MIC("Sub Mic", midas_ext_submicbias), SND_SOC_DAPM_MIC("Third Mic", midas_ext_thirdmicbias), SND_SOC_DAPM_LINE("FM In", NULL), SND_SOC_DAPM_INPUT("S5P RP"), }; const struct snd_soc_dapm_route midas_dapm_routes[] = { { "HP", NULL, "HPOUT1L" }, { "HP", NULL, "HPOUT1R" }, { "SPK", NULL, "SPKOUTLN" }, { "SPK", NULL, "SPKOUTLP" }, { "SPK", NULL, "SPKOUTRN" },
/*{ "Speaker_L", NULL, "SPK_LP" }, { "Speaker_L", NULL, "SPK_LN" }, { "Speaker_R", NULL, "SPK_RP" }, { "Speaker_R", NULL, "SPK_RN" },*/ { "Speaker_L", NULL, "LOUTL" }, { "Speaker_R", NULL, "LOUTR" }, { "Speaker_L_up", NULL, "LOUTL" }, { "Speaker_R_up", NULL, "LOUTR" }, }; /* mixtilev310 Capture widgets */ static const struct snd_soc_dapm_widget rt5640_dapm_widgets_cpt[] = { //SND_SOC_DAPM_MIC("Mic Jack", NULL), SND_SOC_DAPM_MIC("Mic main", NULL), //SND_SOC_DAPM_LINE("Line Input 3 (FM)", NULL), }; /* mixtilev310 TX connections */ static const struct snd_soc_dapm_route audio_map_tx[] = { /* Line Input 3 (FM)*/ /* { "LINPUT3", NULL, "Line Input 3 (FM)" }, { "RINPUT3", NULL, "Line Input 3 (FM)" },*/ { "IN1P", NULL, "Mic main"}, //{ "RINPUT2", NULL, "Mic Jack"}, }; static const struct snd_soc_dapm_route audio_map_tx_htpc[] = { /* Line Input 3 (FM)*/
} static int nusmart_machine_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { //struct snd_soc_pcm_runtime *rtd = substream->private_data; //struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; //struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; //unsigned int clk = 0; //int ret = 0; //DBG_PRINT("nusmart_machine_hw_params ..\n"); return 0; } static const struct snd_soc_dapm_widget es8388_dapm_widgets[] = { SND_SOC_DAPM_MIC("Mic Jack", NULL), SND_SOC_DAPM_MIC("HeadSet Mic", NULL), SND_SOC_DAPM_SPK("Ext Spk", NULL), SND_SOC_DAPM_HP("Headphone Jack", NULL), }; static const struct snd_soc_dapm_route audio_map[]={ /* mic Jack --> MIC_IN*/ {"Mic Jack", NULL, "RINPUT1"}, {"Mic Jack", NULL, "LINPUT1"}, {"HeadSet Mic", NULL, "RINPUT2"}, {"HeadSet Mic", NULL, "LINPUT2"}, /* HP_OUT --> Headphone Jack */ {"Headphone Jack", NULL, "LOUT2"},
SND_SOC_DAPM_SUPPLY("MCLK", SND_SOC_NOPM, 0, 0, msm_mclk_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_SPK("Ext Spk Bottom Pos", msm_spkramp_event), SND_SOC_DAPM_SPK("Ext Spk Bottom Neg", msm_spkramp_event), SND_SOC_DAPM_SPK("Ext Spk Top Pos", msm_spkramp_event), SND_SOC_DAPM_SPK("Ext Spk Top Neg", msm_spkramp_event), /************ Analog MICs ************/ /** * Analog mic7 (Front Top) on Liquid. * Used as Handset mic on CDP. */ SND_SOC_DAPM_MIC("Analog mic7", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("ANCRight Headset Mic", NULL), SND_SOC_DAPM_MIC("ANCLeft Headset Mic", NULL), /*********** Digital Mics ***************/ SND_SOC_DAPM_MIC("Digital Mic1", NULL), SND_SOC_DAPM_MIC("Digital Mic2", NULL), SND_SOC_DAPM_MIC("Digital Mic3", NULL), SND_SOC_DAPM_MIC("Digital Mic4", NULL), SND_SOC_DAPM_MIC("Digital Mic5", NULL), SND_SOC_DAPM_MIC("Digital Mic6", NULL), }; static const struct snd_soc_dapm_route apq8064_common_audio_map[] = {
struct tegra_asoc_platform_data *pdata = machine->pdata; if (!(machine->gpio_requested & GPIO_HP_MUTE)) return 0; gpio_set_value_cansleep(pdata->gpio_hp_mute, !SND_SOC_DAPM_EVENT_ON(event)); return 0; } static const struct snd_soc_dapm_widget tegra_aic326x_dapm_widgets[] = { SND_SOC_DAPM_SPK("Int Spk", tegra_aic326x_event_int_spk), SND_SOC_DAPM_HP("Earpiece", NULL), SND_SOC_DAPM_HP("Headphone Jack", tegra_aic326x_event_hp), SND_SOC_DAPM_MIC("Mic Jack", NULL), SND_SOC_DAPM_INPUT("Ext Mic"), SND_SOC_DAPM_LINE("Linein", NULL), SND_SOC_DAPM_MIC("Int Mic", NULL), }; static const struct snd_soc_dapm_route aic326x_audio_map[] = { {"Int Spk", NULL, "SPKL"}, {"Int Spk", NULL, "SPKR"}, {"Earpiece", NULL, "RECP"}, {"Earpiece", NULL, "RECM"}, {"Headphone Jack", NULL, "HPL"}, {"Headphone Jack", NULL, "HPR"}, /* internal (IN2L/IN2R) mic is stero */ {"Mic Bias Int" ,NULL, "Int Mic"}, {"IN2L", NULL, "Mic Bias Int"},
static int fighter_hac_power_amp_on(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { int ret; struct pm_gpio param = { .direction = PM_GPIO_DIR_OUT, .output_buffer = PM_GPIO_OUT_BUF_CMOS, .output_value = 1, .pull = PM_GPIO_PULL_NO, .vin_sel = PM_GPIO_VIN_S4, .out_strength = PM_GPIO_STRENGTH_MED, .function = PM_GPIO_FUNC_NORMAL, }; pr_info("%s %d\n", __func__, event); switch (event) { case SND_SOC_DAPM_PRE_PMU: ret = gpio_request(HAC_PAMP_GPIO, "AUDIO_HAC_AMP"); if (ret) { pr_err("%s: Error requesting GPIO %d\n", __func__, HAC_PAMP_GPIO); return ret; } ret = pm8xxx_gpio_config(HAC_PAMP_GPIO, ¶m); if (ret) pr_err("%s: Failed to configure Top Spk Ampl" " gpio %u\n", __func__, HAC_PAMP_GPIO); else { pr_debug("%s: enable hac amp gpio\n", __func__); gpio_direction_output(HAC_PAMP_GPIO, 1); } break; case SND_SOC_DAPM_POST_PMD: gpio_direction_output(HAC_PAMP_GPIO, 0); gpio_free(HAC_PAMP_GPIO); pr_debug("%s: sleeping 4 ms after turning off external" " HAC Ampl\n", __func__); usleep_range(4000, 4000); break; } return 0; } static const struct snd_kcontrol_new hacamp_switch_controls = SOC_DAPM_SINGLE("Switch", 0, 0, 1, 0); static const struct snd_kcontrol_new spkamp_switch_controls = SOC_DAPM_SINGLE("Switch", 0, 0, 1, 0); static const struct snd_soc_dapm_widget fighter_dapm_widgets[] = { SND_SOC_DAPM_MIXER("Lineout Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), SND_SOC_DAPM_MIXER_E("SPK AMP EN", SND_SOC_NOPM, 0, 0, &spkamp_switch_controls, 1, fighter_spk_power_amp_on, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MIXER_E("HAC AMP EN", SND_SOC_NOPM, 0, 0, &hacamp_switch_controls, 1, fighter_hac_power_amp_on, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), }; static const struct snd_soc_dapm_widget msm8960_dapm_widgets[] = { SND_SOC_DAPM_SUPPLY("MCLK", SND_SOC_NOPM, 0, 0, msm8960_mclk_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_SPK("Ext Spk Bottom Pos", NULL), SND_SOC_DAPM_SPK("Ext Spk Bottom Neg", NULL), SND_SOC_DAPM_SPK("Ext USB AMP Pos", msm8960_spkramp_event), SND_SOC_DAPM_SPK("Ext USB AMP Neg", msm8960_spkramp_event), SND_SOC_DAPM_MIC("Handset Mic", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Back Mic", NULL), SND_SOC_DAPM_MIC("Digital Mic1", NULL), SND_SOC_DAPM_MIC("ANCRight Headset Mic", NULL), SND_SOC_DAPM_MIC("ANCLeft Headset Mic", NULL), SND_SOC_DAPM_MIC("Digital Mic1", NULL), SND_SOC_DAPM_MIC("Digital Mic2", NULL), SND_SOC_DAPM_MIC("Digital Mic3", NULL), SND_SOC_DAPM_MIC("Digital Mic4", NULL), SND_SOC_DAPM_MIC("Digital Mic5", NULL), SND_SOC_DAPM_MIC("Digital Mic6", NULL), }; static const struct snd_soc_dapm_route tabla_1_x_audio_map[] = { /* Speaker/HAC path */ {"Lineout Mixer", NULL, "LINEOUT2"}, {"Lineout Mixer", NULL, "LINEOUT1"}, /* USB Audio path */ {"Ext USB AMP Pos", NULL, "LINEOUT3"}, {"Ext USB AMP Neg", NULL, "LINEOUT4"}, }; static const struct snd_soc_dapm_route tabla_2_x_audio_map[] = { /* Speaker/HAC path */ {"Lineout Mixer", NULL, "LINEOUT3"}, {"Lineout Mixer", NULL, "LINEOUT1"}, /* USB Audio path */ {"Ext USB AMP Pos", NULL, "LINEOUT2"}, {"Ext USB AMP Neg", NULL, "LINEOUT4"}, }; static const struct snd_soc_dapm_route common_audio_map[] = { {"RX_BIAS", NULL, "MCLK"}, {"LDO_H", NULL, "MCLK"}, /* Speaker path */ {"Ext Spk Bottom Pos", NULL, "SPK AMP EN"}, {"Ext Spk Bottom Neg", NULL, "SPK AMP EN"}, {"SPK AMP EN", "Switch", "Lineout Mixer"}, /* HAC path */ {"Ext Spk Bottom Pos", NULL, "HAC AMP EN"}, {"Ext Spk Bottom Neg", NULL, "HAC AMP EN"}, {"HAC AMP EN", "Switch", "Lineout Mixer"}, /* Microphone path */ {"AMIC1", NULL, "MIC BIAS1 External"}, {"MIC BIAS1 External", NULL, "Handset Mic"}, {"AMIC2", NULL, "MIC BIAS2 External"}, {"MIC BIAS2 External", NULL, "Headset Mic"}, {"AMIC3", NULL, "MIC BIAS3 External"}, {"MIC BIAS3 External", NULL, "Back Mic"}, {"HEADPHONE", NULL, "LDO_H"}, /** * The digital Mic routes are setup considering * fluid as default device. */ /** * Digital Mic1. Front Bottom left Digital Mic on Fluid and MTP. * Digital Mic GM5 on CDP mainboard. * Conncted to DMIC2 Input on Tabla codec. */ {"DMIC2", NULL, "MIC BIAS1 External"}, {"MIC BIAS1 External", NULL, "Digital Mic1"}, /** * Digital Mic2. Front Bottom right Digital Mic on Fluid and MTP. * Digital Mic GM6 on CDP mainboard. * Conncted to DMIC1 Input on Tabla codec. */ {"DMIC1", NULL, "MIC BIAS1 External"}, {"MIC BIAS1 External", NULL, "Digital Mic2"}, /** * Digital Mic3. Back Bottom Digital Mic on Fluid. * Digital Mic GM1 on CDP mainboard. * Conncted to DMIC4 Input on Tabla codec. */ {"DMIC4", NULL, "MIC BIAS3 External"}, {"MIC BIAS3 External", NULL, "Digital Mic3"}, /** * Digital Mic4. Back top Digital Mic on Fluid. * Digital Mic GM2 on CDP mainboard. * Conncted to DMIC3 Input on Tabla codec. */ {"DMIC3", NULL, "MIC BIAS3 External"}, {"MIC BIAS3 External", NULL, "Digital Mic4"}, /** * Digital Mic5. Front top Digital Mic on Fluid. * Digital Mic GM3 on CDP mainboard. * Conncted to DMIC5 Input on Tabla codec. */ {"DMIC5", NULL, "MIC BIAS4 External"}, {"MIC BIAS4 External", NULL, "Digital Mic5"}, }; static const char *spk_function[] = {"Off", "On"}; static const char *slim0_rx_ch_text[] = {"One", "Two"}; static const char *slim0_tx_ch_text[] = {"One", "Two", "Three", "Four"}; static const struct soc_enum msm8960_enum[] = { SOC_ENUM_SINGLE_EXT(2, spk_function), SOC_ENUM_SINGLE_EXT(2, slim0_rx_ch_text), SOC_ENUM_SINGLE_EXT(4, slim0_tx_ch_text), }; static const char *btsco_rate_text[] = {"8000", "16000"}; static const struct soc_enum msm8960_btsco_enum[] = { SOC_ENUM_SINGLE_EXT(2, btsco_rate_text), }; static int msm8960_slim_0_rx_ch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { pr_debug("%s: msm8960_slim_0_rx_ch = %d\n", __func__, msm8960_slim_0_rx_ch); ucontrol->value.integer.value[0] = msm8960_slim_0_rx_ch - 1; return 0; }
return 0; } static struct snd_soc_ops omap_twl4030_ops = { .hw_params = omap_twl4030_hw_params, }; static const struct snd_soc_dapm_widget dapm_widgets[] = { SND_SOC_DAPM_SPK("Earpiece Spk", NULL), SND_SOC_DAPM_SPK("Handsfree Spk", NULL), SND_SOC_DAPM_HP("Headset Stereophone", NULL), SND_SOC_DAPM_SPK("Ext Spk", NULL), SND_SOC_DAPM_SPK("Carkit Spk", NULL), SND_SOC_DAPM_MIC("Main Mic", NULL), SND_SOC_DAPM_MIC("Sub Mic", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Carkit Mic", NULL), SND_SOC_DAPM_MIC("Digital0 Mic", NULL), SND_SOC_DAPM_MIC("Digital1 Mic", NULL), SND_SOC_DAPM_LINE("Line In", NULL), }; static const struct snd_soc_dapm_route audio_map[] = { /* Headset Stereophone: HSOL, HSOR */ {"Headset Stereophone", NULL, "HSOL"}, {"Headset Stereophone", NULL, "HSOR"}, /* External Speakers: HFL, HFR */ {"Handsfree Spk", NULL, "HFL"}, {"Handsfree Spk", NULL, "HFR"},
#include <sound/jack.h> #include <asm/mach-types.h> #include <plat/board-ams-delta.h> #include <plat/mcbsp.h> #include "omap-mcbsp.h" #include "omap-pcm.h" #include "../codecs/cx20442.h" /* Board specific DAPM widgets */ static const struct snd_soc_dapm_widget ams_delta_dapm_widgets[] = { /* Handset */ SND_SOC_DAPM_MIC("Mouthpiece", NULL), SND_SOC_DAPM_HP("Earpiece", NULL), /* Handsfree/Speakerphone */ SND_SOC_DAPM_MIC("Microphone", NULL), SND_SOC_DAPM_SPK("Speaker", NULL), }; /* How they are connected to codec pins */ static const struct snd_soc_dapm_route ams_delta_audio_map[] = { {"TELIN", NULL, "Mouthpiece"}, {"Earpiece", NULL, "TELOUT"}, {"MIC", NULL, "Microphone"}, {"Speaker", NULL, "SPKOUT"}, };
#endif #if defined (CONFIG_SND_CODEC_SOC_MASTER) ret = cpu_dai->ops->set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); #endif if (ret < 0) return ret; } return 0; } static const struct snd_soc_dapm_widget rk2818_dapm_widgets[] = { SND_SOC_DAPM_LINE("Audio Out", NULL), SND_SOC_DAPM_LINE("Line in", NULL), SND_SOC_DAPM_MIC("Micn", NULL), SND_SOC_DAPM_MIC("Micp", NULL), }; static const struct snd_soc_dapm_route audio_map[]= { {"Audio Out", NULL, "LOUT1"}, {"Audio Out", NULL, "ROUT1"}, {"Line in", NULL, "RINPUT1"}, {"Line in", NULL, "LINPUT1"}, {"Micn", NULL, "RINPUT2"}, {"Micp", NULL, "LINPUT2"}, }; /* * Logic for a wm8988 as connected on a rockchip board.
/* * There is a physical switch SW15 on the board which changes the MCLK * for the WM9713 between the standard AC97 master clock and the * output of the CLK_POUT signal from the PXA. */ static int clk_pout; module_param(clk_pout, int, 0); MODULE_PARM_DESC(clk_pout, "Use CLK_POUT as WM9713 MCLK (SW15 on board)."); static struct clk *pout; static struct snd_soc_card zylonite; static const struct snd_soc_dapm_widget zylonite_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_MIC("Headset Microphone", NULL), SND_SOC_DAPM_MIC("Handset Microphone", NULL), SND_SOC_DAPM_SPK("Multiactor", NULL), SND_SOC_DAPM_SPK("Headset Earpiece", NULL), }; /* Currently supported audio map */ static const struct snd_soc_dapm_route audio_map[] = { /* Headphone output connected to HPL/HPR */ { "Headphone", NULL, "HPL" }, { "Headphone", NULL, "HPR" }, /* On-board earpiece */ { "Headset Earpiece", NULL, "OUT3" },
/* Headphones jack detection gpios */ static struct snd_soc_jack_gpio hs_jack_gpios[] = { [0] = { /* gpio is set on per-platform basis */ .name = "hp-gpio", .report = SND_JACK_HEADPHONE, .debounce_time = 200, }, }; /* Palm27x machine dapm widgets */ static const struct snd_soc_dapm_widget palm27x_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_SPK("Ext. Speaker", NULL), SND_SOC_DAPM_MIC("Ext. Microphone", NULL), }; /* PalmTX audio map */ static const struct snd_soc_dapm_route audio_map[] = { /* headphone connected to HPOUTL, HPOUTR */ {"Headphone Jack", NULL, "HPOUTL"}, {"Headphone Jack", NULL, "HPOUTR"}, /* ext speaker connected to ROUT2, LOUT2 */ {"Ext. Speaker", NULL, "LOUT2"}, {"Ext. Speaker", NULL, "ROUT2"}, /* mic connected to MIC1 */ {"Ext. Microphone", NULL, "MIC1"}, };
struct snd_kcontrol *k, int event) { #if 0 if (SND_SOC_DAPM_EVENT_ON(event)) // set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MIC_BIAS); else // reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MIC_BIAS); #endif return 0; } /* tcc machine dapm widgets */ static const struct snd_soc_dapm_widget wm8731_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_MIC("Mic Jack", tcc_mic_event), SND_SOC_DAPM_SPK("Ext Spk", tcc_amp_event), SND_SOC_DAPM_LINE("Line Jack", NULL), SND_SOC_DAPM_HP("Headset Jack", NULL), }; /* tcc machine audio map (connections to the codec pins) */ static const struct snd_soc_dapm_route audio_map[] = { /* headset Jack - in = micin, out = LHPOUT*/ {"Headset Jack", NULL, "LHPOUT"}, /* headphone connected to LHPOUT1, RHPOUT1 */ {"Headphone Jack", NULL, "LHPOUT"}, {"Headphone Jack", NULL, "RHPOUT"},
} static int e800_hp_amp_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { if (event & SND_SOC_DAPM_PRE_PMU) gpio_set_value(GPIO_E800_HP_AMP_OFF, 0); else if (event & SND_SOC_DAPM_POST_PMD) gpio_set_value(GPIO_E800_HP_AMP_OFF, 1); return 0; } static const struct snd_soc_dapm_widget e800_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_MIC("Mic (Internal1)", NULL), SND_SOC_DAPM_MIC("Mic (Internal2)", NULL), SND_SOC_DAPM_SPK("Speaker", NULL), SND_SOC_DAPM_PGA_E("Headphone Amp", SND_SOC_NOPM, 0, 0, NULL, 0, e800_hp_amp_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_PGA_E("Speaker Amp", SND_SOC_NOPM, 0, 0, NULL, 0, e800_spk_amp_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), }; static const struct snd_soc_dapm_route audio_map[] = { {"Headphone Jack", NULL, "HPOUTL"}, {"Headphone Jack", NULL, "HPOUTR"}, {"Headphone Jack", NULL, "Headphone Amp"},
* signal_inversion<<8 == SND_SOC_DAIFMT_IB_NF * daudio_master<<12 == SND_SOC_DAIFMT_CBM_CFM */ DAUDIO_DBG("%s,line:%d,audio_format:%d,SND_SOC_DAIFMT_DSP_A:%d\n",\ __func__, __LINE__, audio_format, SND_SOC_DAIFMT_DSP_A); DAUDIO_DBG("%s,line:%d,signal_inversion:%d,signal_inversion<<8:%d,SND_SOC_DAIFMT_IB_NF:%d\n",\ __func__, __LINE__, signal_inversion, signal_inversion<<8, SND_SOC_DAIFMT_IB_NF); DAUDIO_DBG("%s,line:%d,daudio_master:%d,daudio_master<<12:%d,SND_SOC_DAIFMT_CBM_CFM:%d\n",\ __func__, __LINE__, daudio_master, daudio_master<<12, SND_SOC_DAIFMT_CBM_CFM); return 0; } static const struct snd_soc_dapm_widget rt3261_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_MIC("micbias1", NULL), SND_SOC_DAPM_LINE("Line In Jack", NULL), }; static const struct snd_soc_dapm_route audio_map[] = { {"Headphone Jack", NULL, "LOUTL"}, {"Headphone Jack", NULL, "LOUTR"}, { "IN1P", NULL, "micbias1" }, { "IN2P", NULL, "micbias1" }, { "IN2N", NULL, "micbias1" }, }; static const struct snd_kcontrol_new rt3261_imapx_controls[] = { };
{ if (machine_is_borzoi() || machine_is_spitz()) gpio_set_value(SPITZ_GPIO_MIC_BIAS, SND_SOC_DAPM_EVENT_ON(event)); if (machine_is_akita()) gpio_set_value(AKITA_GPIO_MIC_BIAS, SND_SOC_DAPM_EVENT_ON(event)); return 0; } /* spitz machine dapm widgets */ static const struct snd_soc_dapm_widget wm8750_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_MIC("Mic Jack", spitz_mic_bias), SND_SOC_DAPM_SPK("Ext Spk", NULL), SND_SOC_DAPM_LINE("Line Jack", NULL), /* headset is a mic and mono headphone */ SND_SOC_DAPM_HP("Headset Jack", NULL), }; /* Spitz machine audio_map */ static const struct snd_soc_dapm_route audio_map[] = { /* headphone connected to LOUT1, ROUT1 */ {"Headphone Jack", NULL, "LOUT1"}, {"Headphone Jack", NULL, "ROUT1"}, /* headset connected to ROUT1 and LINPUT1 with bias (def below) */
SND_SOC_CLOCK_IN); if (ret < 0) { printk(KERN_ERR "can't set codec system clock\n"); return ret; } return 0; } static struct snd_soc_ops zoom2_ops = { .hw_params = zoom2_hw_params, }; /* Zoom2 machine DAPM */ static const struct snd_soc_dapm_widget zoom2_twl4030_dapm_widgets[] = { SND_SOC_DAPM_MIC("Ext Mic", NULL), SND_SOC_DAPM_SPK("Ext Spk", NULL), SND_SOC_DAPM_HP("Headset Jack", NULL), SND_SOC_DAPM_LINE("Aux In", NULL), }; static const struct snd_soc_dapm_route audio_map[] = { /* External Mics: MAINMIC, SUBMIC with bias*/ {"MAINMIC", NULL, "Mic Bias 1"}, {"SUBMIC", NULL, "Mic Bias 2"}, {"Mic Bias 1", NULL, "Ext Mic"}, {"Mic Bias 2", NULL, "Ext Mic"}, /* External Speakers: HFL, HFR */ {"Ext Spk", NULL, "HFL"}, {"Ext Spk", NULL, "HFR"},
return msm8960_enable_codec_ext_clk(w->codec, 1, true); case SND_SOC_DAPM_POST_PMD: return msm8960_enable_codec_ext_clk(w->codec, 0, true); } return 0; } static const struct snd_soc_dapm_widget blue_msm8960_dapm_widgets[] = { SND_SOC_DAPM_SUPPLY("MCLK", SND_SOC_NOPM, 0, 0, msm8960_mclk_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_SPK("Ext Spk Bottom", msm8960_single_ended_spkramp_event), SND_SOC_DAPM_SPK("Ext Spk Top", msm8960_single_ended_spkramp_event), SND_SOC_DAPM_MIC("Handset Mic", msm8960_handset_mic_event), SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Secondary Mic", msm8960_handset_mic_event), }; static const struct snd_soc_dapm_widget blue_msm8960_dapm_widgets_no_pmic[] = { SND_SOC_DAPM_SUPPLY("MCLK", SND_SOC_NOPM, 0, 0, msm8960_mclk_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_SPK("Ext Spk Bottom", msm8960_single_ended_spkramp_event), SND_SOC_DAPM_SPK("Ext Spk Top", msm8960_single_ended_spkramp_event), SND_SOC_DAPM_MIC("Handset Mic", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL),
return snd_soc_dai_set_fmt(cpu_dai, AUDIO_FORMAT); } static struct snd_soc_ops evm_ops = { .hw_params = evm_hw_params, }; static struct snd_soc_ops evm_spdif_ops = { .hw_params = evm_spdif_hw_params, }; /* davinci-evm machine dapm widgets */ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_LINE("Line Out", NULL), SND_SOC_DAPM_MIC("Mic Jack", NULL), SND_SOC_DAPM_LINE("Line In", NULL), }; /* davinci-evm machine audio_mapnections to the codec pins */ static const struct snd_soc_dapm_route audio_map[] = { /* Headphone connected to HPLOUT, HPROUT */ {"Headphone Jack", NULL, "HPLOUT"}, {"Headphone Jack", NULL, "HPROUT"}, /* Line Out connected to LLOUT, RLOUT */ {"Line Out", NULL, "LLOUT"}, {"Line Out", NULL, "RLOUT"}, /* Mic connected to (MIC3L | MIC3R) */ {"MIC3L", NULL, "Mic Bias 2V"},
dev_err(dev, "Failed to reset WM8731 SYSCLK: %d\n", ret); } } static struct snd_soc_ops de1soc_ops = { // .startup .shutdown = de1soc_shutdown, .hw_params = de1soc_hw_params, // .hw_free // .prepare // .trigger }; static const struct snd_soc_dapm_widget de1soc_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_MIC("Microphone Jack", NULL), SND_SOC_DAPM_LINE("Line In Jack", NULL), SND_SOC_DAPM_LINE("Line Out Jack", NULL), }; static const struct snd_soc_dapm_route intercon[] = { {"MICIN", NULL, "Mic Bias"}, {"Mic Bias", NULL, "Microphone Jack"}, {"LLINEIN", NULL, "Line In Jack"}, {"RLINEIN", NULL, "Line In Jack"}, {"Line Out Jack", NULL, "LOUT"}, {"Line Out Jack", NULL, "ROUT"}, {"Headphone Jack", NULL, "LHPOUT"}, {"Headphone Jack", NULL, "RHPOUT"}, };
* SMDK WM8991 DAI operations. */ static struct snd_soc_ops smdk_i2s_ops = { .hw_params = smdk_socmst_hw_params, }; /* SMDK Playback widgets */ static const struct snd_soc_dapm_widget wm8991_dapm_widgets_pbk[] = { SND_SOC_DAPM_HP("Front-L/R", NULL), SND_SOC_DAPM_HP("Center/Sub", NULL), SND_SOC_DAPM_HP("Rear-L/R", NULL), }; /* SMDK Capture widgets */ static const struct snd_soc_dapm_widget wm8991_dapm_widgets_cpt[] = { SND_SOC_DAPM_MIC("MicIn", NULL), SND_SOC_DAPM_LINE("LineIn", NULL), }; /* SMDK-PAIFTX connections */ static const struct snd_soc_dapm_route audio_map_tx[] = { /* MicIn feeds AINL */ {"AINL", NULL, "MicIn"}, /* LineIn feeds AINL/R */ {"AINL", NULL, "LineIn"}, {"AINR", NULL, "LineIn"}, }; /* SMDK-PAIFRX connections */ static const struct snd_soc_dapm_route audio_map_rx[] = {
static int n810_jack_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *k, int event) { if (SND_SOC_DAPM_EVENT_ON(event)) gpio_set_value(N810_HEADSET_AMP_GPIO, 1); else gpio_set_value(N810_HEADSET_AMP_GPIO, 0); return 0; } static const struct snd_soc_dapm_widget aic33_dapm_widgets[] = { SND_SOC_DAPM_SPK("Ext Spk", n810_spk_event), SND_SOC_DAPM_HP("Headphone Jack", n810_jack_event), SND_SOC_DAPM_MIC("DMic", NULL), }; static const struct snd_soc_dapm_route audio_map[] = { {"Headphone Jack", NULL, "HPLOUT"}, {"Headphone Jack", NULL, "HPROUT"}, {"Ext Spk", NULL, "LLOUT"}, {"Ext Spk", NULL, "RLOUT"}, {"DMic Rate 64", NULL, "Mic Bias 2V"}, {"Mic Bias 2V", NULL, "DMic"}, }; static const char *spk_function[] = {"Off", "On"}; static const char *jack_function[] = {"Off", "Headphone", "Headset", "Mic"};
{ gpio_set_value(CORGI_GPIO_APM_ON, SND_SOC_DAPM_EVENT_ON(event)); return 0; } static int corgi_mic_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *k, int event) { gpio_set_value(CORGI_GPIO_MIC_BIAS, SND_SOC_DAPM_EVENT_ON(event)); return 0; } /* corgi machine dapm widgets */ static const struct snd_soc_dapm_widget wm8731_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_MIC("Mic Jack", corgi_mic_event), SND_SOC_DAPM_SPK("Ext Spk", corgi_amp_event), SND_SOC_DAPM_LINE("Line Jack", NULL), SND_SOC_DAPM_HP("Headset Jack", NULL), }; /* Corgi machine audio map (connections to the codec pins) */ static const struct snd_soc_dapm_route audio_map[] = { /* headset Jack - in = micin, out = LHPOUT*/ {"Headset Jack", NULL, "LHPOUT"}, /* headphone connected to LHPOUT1, RHPOUT1 */ {"Headphone Jack", NULL, "LHPOUT"}, {"Headphone Jack", NULL, "RHPOUT"},
if (ret < 0) { printk("rk29_hw_params_rt3261:failed to set the sysclk for codec side\n"); return ret; } snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0); snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, (pll_out/4)/params_rate(params)-1); snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, 3); DBG("Enter:%s, %d, pll_out/4/params_rate(params) = %d \n", __FUNCTION__, __LINE__, (pll_out/4)/params_rate(params)); return 0; } static const struct snd_soc_dapm_widget rt3261_dapm_widgets[] = { SND_SOC_DAPM_MIC("Mic Jack", NULL), SND_SOC_DAPM_MIC("Headset Jack", NULL), SND_SOC_DAPM_SPK("Ext Spk", NULL), SND_SOC_DAPM_HP("Headphone Jack", NULL), }; static const struct snd_soc_dapm_route audio_map[]={ /* Mic Jack --> MIC_IN*/ {"micbias1", NULL, "Mic Jack"}, {"MIC1", NULL, "micbias1"}, // HP MIC {"micbias1", NULL, "Headset Jack"}, {"MIC3", NULL, "micbias1"},