static int rx51_aic34_init(struct snd_soc_codec *codec) { int err; /* Set up NC codec pins */ snd_soc_dapm_nc_pin(codec, "MIC3L"); snd_soc_dapm_nc_pin(codec, "MIC3R"); snd_soc_dapm_nc_pin(codec, "LINE1R"); /* Add RX-51 specific controls */ err = snd_soc_add_controls(codec, aic34_rx51_controls, ARRAY_SIZE(aic34_rx51_controls)); if (err < 0) return err; /* Add RX-51 specific widgets */ snd_soc_dapm_new_controls(codec, aic34_dapm_widgets, ARRAY_SIZE(aic34_dapm_widgets)); /* Set up RX-51 specific audio path audio_map */ snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_sync(codec); return 0; }
static int hx4700_ak4641_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; int err; snd_soc_dapm_nc_pin(dapm, "MOUT1"); snd_soc_dapm_nc_pin(dapm, "MICEXT"); snd_soc_dapm_nc_pin(dapm, "AUX"); err = snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE, &hs_jack); if (err) return err; err = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pin), hs_jack_pin); if (err) return err; err = snd_soc_jack_add_gpios(&hs_jack, 1, &hs_jack_gpio); return err; }
/* * Logic for a uda1380 as connected on a HTC Magician */ static int magician_uda1380_init(struct snd_soc_codec *codec) { int err; /* NC codec pins */ snd_soc_dapm_nc_pin(codec, "VOUTLHP"); snd_soc_dapm_nc_pin(codec, "VOUTRHP"); /* FIXME: is anything connected here? */ snd_soc_dapm_nc_pin(codec, "VINL"); snd_soc_dapm_nc_pin(codec, "VINR"); /* Add magician specific controls */ err = snd_soc_add_controls(codec, uda1380_magician_controls, ARRAY_SIZE(uda1380_magician_controls)); if (err < 0) return err; /* Add magician specific widgets */ snd_soc_dapm_new_controls(codec, uda1380_dapm_widgets, ARRAY_SIZE(uda1380_dapm_widgets)); /* Set up magician specific audio path interconnects */ snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_sync(codec); return 0; }
/* * Logic for a ak4641 as connected on a HP iPAQ hx4700 */ static int hx4700_ak4641_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; int err; /* NC codec pins */ /* FIXME: is anything connected here? */ snd_soc_dapm_nc_pin(dapm, "MOUT1"); snd_soc_dapm_nc_pin(dapm, "MICEXT"); snd_soc_dapm_nc_pin(dapm, "AUX"); /* Jack detection API stuff */ err = snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE, &hs_jack); if (err) return err; err = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pin), hs_jack_pin); if (err) return err; err = snd_soc_jack_add_gpios(&hs_jack, 1, &hs_jack_gpio); return err; }
static int mini210_wm8960_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; snd_soc_dapm_nc_pin(dapm, "RINPUT1"); snd_soc_dapm_nc_pin(dapm, "LINPUT2"); snd_soc_dapm_nc_pin(dapm, "RINPUT2"); snd_soc_dapm_nc_pin(dapm, "OUT3"); snd_soc_dapm_new_controls(dapm, wm8960_dapm_widgets_cpt, ARRAY_SIZE(wm8960_dapm_widgets_cpt)); snd_soc_dapm_new_controls(dapm, wm8960_dapm_widgets_cpt2, ARRAY_SIZE(wm8960_dapm_widgets_cpt2)); snd_soc_dapm_add_routes(dapm, audio_map_tx, ARRAY_SIZE(audio_map_tx)); snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Mic Jack"); snd_soc_dapm_enable_pin(dapm, "Speaker_L"); snd_soc_dapm_enable_pin(dapm, "Speaker_R"); snd_soc_dapm_enable_pin(dapm, "Line Input 3 (FM)"); snd_soc_dapm_sync(dapm); return 0; }
/* * Pavo for a jzcodec as connected on jz4740 Device */ static int pavo_jzcodec_init(struct snd_soc_codec *codec) { int i, err; snd_soc_dapm_nc_pin(codec, "LLINEIN"); snd_soc_dapm_nc_pin(codec, "RLINEIN"); /* Add pavo specific controls */ for (i = 0; i < ARRAY_SIZE(jzcodec_pavo_controls); i++) { err = snd_ctl_add(codec->card, snd_soc_cnew(&jzcodec_pavo_controls[i],codec, NULL)); if (err < 0) return err; } /* Add pavo specific widgets */ for(i = 0; i < ARRAY_SIZE(jzcodec_dapm_widgets); i++) { snd_soc_dapm_new_control(codec, &jzcodec_dapm_widgets[i]); } // snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_sync(codec); return 0; }
static int rt5631_codec_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; //struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dapm_context *dapm = &codec->dapm; int ret = 0; printk(KERN_DEBUG "enter %s rt5631_snd_pdata: %p\n", __func__, rt5631_snd_pdata); /* Add specific widgets */ snd_soc_dapm_new_controls(dapm, rt5631_dapm_widgets, ARRAY_SIZE(rt5631_dapm_widgets)); /* Set up specific audio path interconnects */ snd_soc_dapm_add_routes(dapm, rt5631_dapm_intercon, ARRAY_SIZE(rt5631_dapm_intercon)); /* Setup spk/hp/mono output */ // rt5631_set_output(codec); /* Setuo mic input */ // rt5631_set_input(codec); /* not connected */ snd_soc_dapm_nc_pin(dapm, "MONO"); snd_soc_dapm_nc_pin(dapm, "AUXO2"); snd_soc_dapm_nc_pin(dapm, "DMIC"); snd_soc_dapm_nc_pin(dapm, "AXIL"); snd_soc_dapm_nc_pin(dapm, "AXIR"); /* always connected */ snd_soc_dapm_enable_pin(dapm, "Ext Spk"); snd_soc_dapm_enable_pin(dapm, "MAIN MIC"); /* disable connected */ snd_soc_dapm_disable_pin(dapm, "HP"); snd_soc_dapm_sync(dapm); #if HP_DET ret = snd_soc_jack_new(codec, "hp switch", SND_JACK_HEADPHONE, &rt5631_snd_priv->jack); if (ret) { printk(KERN_WARNING "Failed to alloc resource for hp switch\n"); } else { ret = snd_soc_jack_add_pins(&rt5631_snd_priv->jack, ARRAY_SIZE(jack_pins), jack_pins); if (ret) { printk(KERN_WARNING "Failed to setup hp pins\n"); } } rt5631_snd_priv->data= (void*)codec; init_timer(&rt5631_snd_priv->timer); rt5631_snd_priv->timer.function = rt5631_timer_func; rt5631_snd_priv->timer.data = (unsigned long)rt5631_snd_priv; INIT_WORK(&rt5631_snd_priv->work, rt5631_work_func); mutex_init(&rt5631_snd_priv->lock); #endif return 0; }
static void rt5631_set_output(struct snd_soc_codec *codec) { struct snd_soc_dapm_context *dapm = &codec->dapm; if (rt5631_snd_pdata->spk_output != RT5631_SPK_STEREO) { if (rt5631_snd_pdata->spk_output == RT5631_SPK_RIGHT) { snd_soc_dapm_nc_pin(dapm, "SPOL"); snd_soc_update_bits(codec, RT5631_SPK_MONO_OUT_CTRL, 0xf000, RT5631_M_SPKVOL_L_TO_SPOL_MIXER | RT5631_M_SPKVOL_R_TO_SPOL_MIXER); } else { snd_soc_dapm_nc_pin(dapm, "SPOR"); snd_soc_update_bits(codec, RT5631_SPK_MONO_OUT_CTRL, 0xf000, RT5631_M_SPKVOL_L_TO_SPOR_MIXER | RT5631_M_SPKVOL_R_TO_SPOR_MIXER); } snd_soc_update_bits(codec, RT5631_SPK_MONO_HP_OUT_CTRL, RT5631_SPK_L_MUX_SEL_MASK | RT5631_SPK_R_MUX_SEL_MASK | RT5631_HP_L_MUX_SEL_MASK | RT5631_HP_R_MUX_SEL_MASK, RT5631_SPK_L_MUX_SEL_SPKMIXER_L | RT5631_SPK_R_MUX_SEL_SPKMIXER_R | RT5631_HP_L_MUX_SEL_HPVOL_L | RT5631_HP_R_MUX_SEL_HPVOL_R); } else { snd_soc_update_bits(codec, RT5631_SPK_MONO_OUT_CTRL, 0xf000, RT5631_M_SPKVOL_R_TO_SPOL_MIXER | RT5631_M_SPKVOL_L_TO_SPOR_MIXER); snd_soc_update_bits(codec, RT5631_SPK_MONO_HP_OUT_CTRL, RT5631_SPK_L_MUX_SEL_MASK | RT5631_SPK_R_MUX_SEL_MASK | RT5631_HP_L_MUX_SEL_MASK | RT5631_HP_R_MUX_SEL_MASK, RT5631_SPK_L_MUX_SEL_SPKMIXER_L | RT5631_SPK_R_MUX_SEL_SPKMIXER_R | RT5631_HP_L_MUX_SEL_HPVOL_L | RT5631_HP_R_MUX_SEL_HPVOL_R); } }
static int smartq_wm8987_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; int err = 0; /* set endpoints to not connected */ snd_soc_dapm_nc_pin(dapm, "LINPUT1"); snd_soc_dapm_nc_pin(dapm, "RINPUT1"); snd_soc_dapm_nc_pin(dapm, "OUT3"); snd_soc_dapm_nc_pin(dapm, "ROUT1"); /* set endpoints to default off mode */ snd_soc_dapm_enable_pin(dapm, "Internal Speaker"); snd_soc_dapm_enable_pin(dapm, "Internal Mic"); snd_soc_dapm_disable_pin(dapm, "Headphone Jack"); /* Headphone jack detection */ err = snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE, 0, &smartq_jack); if (err) return err; err = snd_soc_jack_add_pins(&smartq_jack, ARRAY_SIZE(smartq_jack_pins), smartq_jack_pins); if (err) return err; err = snd_soc_jack_add_gpios(&smartq_jack, ARRAY_SIZE(smartq_jack_gpios), smartq_jack_gpios); return err; }
/* * Logic for a wm8731 as connected on a at91sam9g20ek board. */ static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dapm_context *dapm = &codec->dapm; int ret; printk(KERN_DEBUG "at91sam9g20ek_wm8731 " ": at91sam9g20ek_wm8731_init() called\n"); ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_MCLK, MCLK_RATE, SND_SOC_CLOCK_IN); if (ret < 0) { printk(KERN_ERR "Failed to set WM8731 SYSCLK: %d\n", ret); return ret; } /* not connected */ snd_soc_dapm_nc_pin(dapm, "RLINEIN"); snd_soc_dapm_nc_pin(dapm, "LLINEIN"); #ifndef ENABLE_MIC_INPUT snd_soc_dapm_nc_pin(&rtd->card->dapm, "Int Mic"); #endif return 0; }
static int tosa_ac97_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; int err; snd_soc_dapm_nc_pin(dapm, "OUT3"); snd_soc_dapm_nc_pin(dapm, "MONOOUT"); /* add tosa specific controls */ err = snd_soc_add_controls(codec, tosa_controls, ARRAY_SIZE(tosa_controls)); if (err < 0) return err; /* add tosa specific widgets */ snd_soc_dapm_new_controls(dapm, tosa_dapm_widgets, ARRAY_SIZE(tosa_dapm_widgets)); /* set up tosa specific audio path audio_map */ snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_sync(dapm); return 0; }
static int smdk4x12_wm8960_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; dprintk("+%s()\n", __FUNCTION__); snd_soc_dapm_nc_pin(dapm, "RINPUT1"); snd_soc_dapm_nc_pin(dapm, "LINPUT2"); snd_soc_dapm_nc_pin(dapm, "RINPUT2"); snd_soc_dapm_nc_pin(dapm, "OUT3"); snd_soc_dapm_new_controls(dapm, smdk4x12_dapm_capture_widgets, ARRAY_SIZE(smdk4x12_dapm_capture_widgets)); snd_soc_dapm_new_controls(dapm, smdk4x12_dapm_playback_widgets, ARRAY_SIZE(smdk4x12_dapm_playback_widgets)); snd_soc_dapm_add_routes(dapm, smdk4x12_audio_map, ARRAY_SIZE(smdk4x12_audio_map)); snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Mic Jack"); snd_soc_dapm_enable_pin(dapm, "Speaker_L"); snd_soc_dapm_enable_pin(dapm, "Speaker_R"); snd_soc_dapm_disable_pin(dapm, "Line Input 3 (FM)"); dprintk("*%s(): dapm sync start\n", __FUNCTION__); snd_soc_dapm_sync( dapm ); dprintk("*%s(): dapm sync end\n", __FUNCTION__); dprintk("-%s()\n", __FUNCTION__); return 0; }
static int smartq_wm8987_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_dapm_context *dapm = &rtd->card->dapm; int err = 0; /* set endpoints to not connected */ snd_soc_dapm_nc_pin(dapm, "LINPUT1"); snd_soc_dapm_nc_pin(dapm, "RINPUT1"); snd_soc_dapm_nc_pin(dapm, "OUT3"); snd_soc_dapm_nc_pin(dapm, "ROUT1"); /* Headphone jack detection */ err = snd_soc_card_jack_new(rtd->card, "Headphone Jack", SND_JACK_HEADPHONE, &smartq_jack, smartq_jack_pins, ARRAY_SIZE(smartq_jack_pins)); if (err) return err; err = snd_soc_jack_add_gpios(&smartq_jack, ARRAY_SIZE(smartq_jack_gpios), smartq_jack_gpios); return err; }
/* * Logic for a wm8988 as connected on a rockchip board. */ static int rk2818_wm8988_init(struct snd_soc_codec *codec) { struct snd_soc_dai *codec_dai = &codec->dai[0]; int ret; DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__); ret = snd_soc_dai_set_sysclk(codec_dai, 0, 12000000, SND_SOC_CLOCK_IN); if (ret < 0) { printk(KERN_ERR "Failed to set WM8988 SYSCLK: %d\n", ret); return ret; } /* Add specific widgets */ snd_soc_dapm_new_controls(codec, rk2818_dapm_widgets, ARRAY_SIZE(rk2818_dapm_widgets)); snd_soc_dapm_nc_pin(codec, "LOUT2"); snd_soc_dapm_nc_pin(codec, "ROUT2"); /* Set up specific audio path audio_mapnects */ snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_sync(codec); return 0; }
/* Logic for a aic3x as connected on a davinci-evm */ static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_card *card = rtd->card; struct device_node *np = card->dev->of_node; int ret; /* Add davinci-evm specific widgets */ snd_soc_dapm_new_controls(&card->dapm, aic3x_dapm_widgets, ARRAY_SIZE(aic3x_dapm_widgets)); if (np) { ret = snd_soc_of_parse_audio_routing(card, "ti,audio-routing"); if (ret) return ret; } else { /* Set up davinci-evm specific audio path audio_map */ snd_soc_dapm_add_routes(&card->dapm, audio_map, ARRAY_SIZE(audio_map)); } /* not connected */ snd_soc_dapm_nc_pin(&card->dapm, "MONO_LOUT"); snd_soc_dapm_nc_pin(&card->dapm, "HPLCOM"); snd_soc_dapm_nc_pin(&card->dapm, "HPRCOM"); return 0; }
/* * Logic for a wm8731 as connected on a Sharp SL-C7x0 Device */ static int poodle_wm8731_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; int err; snd_soc_dapm_nc_pin(codec, "LLINEIN"); snd_soc_dapm_nc_pin(codec, "RLINEIN"); snd_soc_dapm_enable_pin(codec, "MICIN"); /* Add poodle specific controls */ err = snd_soc_add_controls(codec, wm8731_poodle_controls, ARRAY_SIZE(wm8731_poodle_controls)); if (err < 0) return err; /* Add poodle specific widgets */ snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, ARRAY_SIZE(wm8731_dapm_widgets)); /* Set up poodle specific audio path audio_map */ snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_sync(codec); return 0; }
static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_card *card = rtd->card; /* set up NC codec pins */ snd_soc_dapm_nc_pin(&codec->dapm, "OUT3"); snd_soc_dapm_nc_pin(&codec->dapm, "OUT4"); snd_soc_dapm_nc_pin(&codec->dapm, "LINE1"); snd_soc_dapm_nc_pin(&codec->dapm, "LINE2"); /* set endpoints to default off mode */ snd_soc_dapm_disable_pin(&card->dapm, "GSM Line Out"); snd_soc_dapm_disable_pin(&card->dapm, "GSM Line In"); snd_soc_dapm_disable_pin(&card->dapm, "Headset Mic"); snd_soc_dapm_disable_pin(&card->dapm, "Handset Mic"); snd_soc_dapm_disable_pin(&card->dapm, "Stereo Out"); snd_soc_dapm_disable_pin(&card->dapm, "Handset Spk"); /* allow audio paths from the GSM modem to run during suspend */ snd_soc_dapm_ignore_suspend(&card->dapm, "GSM Line Out"); snd_soc_dapm_ignore_suspend(&card->dapm, "GSM Line In"); snd_soc_dapm_ignore_suspend(&card->dapm, "Headset Mic"); snd_soc_dapm_ignore_suspend(&card->dapm, "Handset Mic"); snd_soc_dapm_ignore_suspend(&card->dapm, "Stereo Out"); snd_soc_dapm_ignore_suspend(&card->dapm, "Handset Spk"); return 0; }
/* * Logic for a wm8731 as connected on a Sharp SL-C7x0 Device */ static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; int err; snd_soc_dapm_nc_pin(dapm, "LLINEIN"); snd_soc_dapm_nc_pin(dapm, "RLINEIN"); /* Add corgi specific controls */ err = snd_soc_add_controls(codec, wm8731_corgi_controls, ARRAY_SIZE(wm8731_corgi_controls)); if (err < 0) return err; /* Add corgi specific widgets */ snd_soc_dapm_new_controls(dapm, wm8731_dapm_widgets, ARRAY_SIZE(wm8731_dapm_widgets)); /* Set up corgi specific audio path audio_map */ snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_sync(dapm); return 0; }
static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; int ret; /* All TWL4030 output pins are floating */ snd_soc_dapm_nc_pin(dapm, "EARPIECE"); snd_soc_dapm_nc_pin(dapm, "PREDRIVEL"); snd_soc_dapm_nc_pin(dapm, "PREDRIVER"); snd_soc_dapm_nc_pin(dapm, "HSOL"); snd_soc_dapm_nc_pin(dapm, "HSOR"); snd_soc_dapm_nc_pin(dapm, "CARKITL"); snd_soc_dapm_nc_pin(dapm, "CARKITR"); snd_soc_dapm_nc_pin(dapm, "HFL"); snd_soc_dapm_nc_pin(dapm, "HFR"); snd_soc_dapm_nc_pin(dapm, "VIBRA"); ret = snd_soc_dapm_new_controls(dapm, omap3pandora_out_dapm_widgets, ARRAY_SIZE(omap3pandora_out_dapm_widgets)); if (ret < 0) return ret; return snd_soc_dapm_add_routes(dapm, omap3pandora_out_map, ARRAY_SIZE(omap3pandora_out_map)); }
static int aml_m1_codec_init(struct snd_soc_codec *codec) { struct snd_soc_card *card = codec->socdev->card; int err; //Add board specific DAPM widgets and routes err = snd_soc_dapm_new_controls(codec, aml_m1_dapm_widgets, ARRAY_SIZE(aml_m1_dapm_widgets)); if(err){ dev_warn(card->dev, "Failed to register DAPM widgets\n"); return 0; } err = snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); if(err){ dev_warn(card->dev, "Failed to setup dapm widgets routine\n"); return 0; } #if HP_DET if ((soc_cs42l52_dai.ac97_pdata) && ((struct cs42l52_platform_data *) (soc_cs42l52_dai.ac97_pdata))->is_hp_pluged) hp_detect_flag = ((struct cs42l52_platform_data *) (soc_cs42l52_dai.ac97_pdata))->is_hp_pluged() ? (0) : (1); else hp_detect_flag = 1; // If is_hp_pluged function is not registered in bsp, set speaker as default. err = snd_soc_jack_new(card, "hp_switch", SND_JACK_HEADSET, &hp_jack); if(err){ dev_warn(card->dev, "Failed to alloc resource for hook switch\n"); }else{ err = snd_soc_jack_add_pins(&hp_jack, ARRAY_SIZE(hp_jack_pins), hp_jack_pins); if(err){ dev_warn(card->dev, "Failed to setup hook hp jack pin\n"); } } // create a timer to poll the HP IN status spin_lock_init(&lock); timer.function = &cs42l52_hp_detect_timer; timer.data = (unsigned long)codec; timer.expires = jiffies + HZ*10; init_timer(&timer); INIT_WORK(&cs42l52_work.cs42l52_workqueue, cs42l52_hp_detect_queue); #endif snd_soc_dapm_nc_pin(codec,"LINPUT1"); snd_soc_dapm_nc_pin(codec,"RINPUT1"); snd_soc_dapm_enable_pin(codec, "Ext Spk"); snd_soc_dapm_disable_pin(codec, "HP"); snd_soc_dapm_enable_pin(codec, "MIC IN"); snd_soc_dapm_disable_pin(codec, "HP MIC"); snd_soc_dapm_disable_pin(codec, "FM IN"); snd_soc_dapm_sync(codec); return 0; }
/* * Logic for a wm8731 as connected on a Sharp SL-C7x0 Device */ static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; snd_soc_dapm_nc_pin(dapm, "LLINEIN"); snd_soc_dapm_nc_pin(dapm, "RLINEIN"); return 0; }
int omap4_wm8994_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; struct snd_soc_dai *aif1_dai = &rtd->codec_dai[0]; int ret; the_codec = codec; ret = snd_soc_add_controls(codec, omap4_controls, ARRAY_SIZE(omap4_controls)); ret = snd_soc_dapm_new_controls(dapm, omap4_dapm_widgets, ARRAY_SIZE(omap4_dapm_widgets)); if (ret != 0) dev_err(codec->dev, "Failed to add DAPM widgets: %d\n", ret); ret = snd_soc_dapm_add_routes(dapm, omap4_dapm_routes, ARRAY_SIZE(omap4_dapm_routes)); if (ret != 0) dev_err(codec->dev, "Failed to add DAPM routes: %d\n", ret); /* set up NC codec pins */ snd_soc_dapm_nc_pin(dapm, "IN2LP:VXRN"); snd_soc_dapm_nc_pin(dapm, "IN2LN"); #ifdef CONFIG_MACH_SAMSUNG_ESPRESSO_10 snd_soc_dapm_nc_pin(dapm, "IN2RP:VXRP"); snd_soc_dapm_nc_pin(dapm, "IN2RN"); #endif snd_soc_dapm_ignore_suspend(dapm, "RCV"); snd_soc_dapm_ignore_suspend(dapm, "SPK"); snd_soc_dapm_ignore_suspend(dapm, "LINEOUT"); snd_soc_dapm_ignore_suspend(dapm, "HP"); snd_soc_dapm_ignore_suspend(dapm, "Main Mic"); #if defined(CONFIG_MACH_SAMSUNG_ESPRESSO) \ || defined(CONFIG_MACH_SAMSUNG_ESPRESSO_CHN_CMCC) snd_soc_dapm_ignore_suspend(dapm, "Sub Mic"); #endif snd_soc_dapm_ignore_suspend(dapm, "Headset Mic"); snd_soc_dapm_ignore_suspend(dapm, "AIF1DACDAT"); snd_soc_dapm_ignore_suspend(dapm, "AIF2DACDAT"); snd_soc_dapm_ignore_suspend(dapm, "AIF3DACDAT"); snd_soc_dapm_ignore_suspend(dapm, "AIF1ADCDAT"); snd_soc_dapm_ignore_suspend(dapm, "AIF2ADCDAT"); snd_soc_dapm_ignore_suspend(dapm, "AIF3ADCDAT"); ret = snd_soc_dai_set_sysclk(aif1_dai, WM8994_SYSCLK_MCLK2, 32768, SND_SOC_CLOCK_IN); if (ret < 0) dev_err(codec->dev, "Failed to boot clocking\n"); return snd_soc_dapm_sync(dapm); }
static int zoom2_twl4030_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; int ret; unsigned short reg; g_rtd = rtd; /* Add ZOOM2 specific controls */ ret = snd_soc_add_controls(codec, zoom2_controls, ARRAY_SIZE(zoom2_controls)); if (ret) return ret; /* Add Zoom2 specific widgets */ ret = snd_soc_dapm_new_controls(codec->dapm, zoom2_twl4030_dapm_widgets, ARRAY_SIZE(zoom2_twl4030_dapm_widgets)); if (ret) return ret; /* Set up Zoom2 specific audio path audio_map */ snd_soc_dapm_add_routes(codec->dapm, audio_map, ARRAY_SIZE(audio_map)); reg = codec->driver->read(codec, TWL4030_REG_VOICE_IF); reg |= TWL4030_VIF_DIN_EN | TWL4030_VIF_DOUT_EN | TWL4030_VIF_EN; codec->driver->write(codec, TWL4030_REG_VOICE_IF, reg); /* Zoom2 connected pins */ snd_soc_dapm_enable_pin(codec->dapm, "Ext Mic"); snd_soc_dapm_enable_pin(codec->dapm, "Ext Spk"); snd_soc_dapm_enable_pin(codec->dapm, "Headset Mic"); snd_soc_dapm_enable_pin(codec->dapm, "Headset Stereophone"); snd_soc_dapm_enable_pin(codec->dapm, "Aux In"); /* TWL4030 not connected pins */ snd_soc_dapm_nc_pin(codec->dapm, "CARKITMIC"); snd_soc_dapm_nc_pin(codec->dapm, "DIGIMIC0"); snd_soc_dapm_nc_pin(codec->dapm, "DIGIMIC1"); snd_soc_dapm_nc_pin(codec->dapm, "OUTL"); snd_soc_dapm_nc_pin(codec->dapm, "OUTR"); snd_soc_dapm_nc_pin(codec->dapm, "EARPIECE"); snd_soc_dapm_nc_pin(codec->dapm, "PREDRIVEL"); snd_soc_dapm_nc_pin(codec->dapm, "PREDRIVER"); snd_soc_dapm_nc_pin(codec->dapm, "CARKITL"); snd_soc_dapm_nc_pin(codec->dapm, "CARKITR"); ret = snd_soc_dapm_sync(codec->dapm); return ret; }
/* * Logic for a wm8731 as connected on a at91sam9x5 based board. */ static int at91sam9x5ek_wm8731_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dapm_context *dapm = &codec->dapm; printk(KERN_DEBUG "ASoC: at91sam9x5_wm8731" ": at91sam9x5ek_wm8731_init() called\n"); /* remove some not supported rates in relation with clock * provided to the wm8731 codec */ switch (MCLK_RATE) { case 12288000: codec_dai->driver->playback.rates &= SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000; codec_dai->driver->capture.rates &= SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000; break; case 12000000: /* all wm8731 rates supported */ break; default: printk(KERN_ERR "ASoC: Codec Master clock rate not defined\n"); return -EINVAL; } /* set not connected pins */ snd_soc_dapm_nc_pin(dapm, "Mic Bias"); snd_soc_dapm_nc_pin(dapm, "MICIN"); snd_soc_dapm_nc_pin(dapm, "LOUT"); snd_soc_dapm_nc_pin(dapm, "ROUT"); /* add specific widgets */ snd_soc_dapm_new_controls(dapm, at91sam9x5ek_dapm_widgets, ARRAY_SIZE(at91sam9x5ek_dapm_widgets)); /* set up specific audio path interconnects */ snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon)); /* always connected */ snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Line In Jack"); /* signal a DAPM event */ snd_soc_dapm_sync(dapm); return 0; }
static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_card *card = rtd->card; struct rx51_audio_pdata *pdata = snd_soc_card_get_drvdata(card); struct snd_soc_dapm_context *dapm = &codec->dapm; int err; /* Set up NC codec pins */ snd_soc_dapm_nc_pin(dapm, "MIC3L"); snd_soc_dapm_nc_pin(dapm, "MIC3R"); snd_soc_dapm_nc_pin(dapm, "LINE1R"); err = tpa6130a2_add_controls(codec); if (err < 0) { dev_err(card->dev, "Failed to add TPA6130A2 controls\n"); return err; } snd_soc_limit_volume(codec, "TPA6130A2 Headphone Playback Volume", 42); err = omap_mcbsp_st_add_controls(rtd, 2); if (err < 0) { dev_err(card->dev, "Failed to add MCBSP controls\n"); return err; } /* AV jack detection */ err = snd_soc_jack_new(codec, "AV Jack", SND_JACK_HEADSET | SND_JACK_VIDEOOUT, &rx51_av_jack); if (err) { dev_err(card->dev, "Failed to add AV Jack\n"); return err; } /* prepare gpio for snd_soc_jack_add_gpios */ rx51_av_jack_gpios[0].gpio = desc_to_gpio(pdata->jack_detection_gpio); devm_gpiod_put(card->dev, pdata->jack_detection_gpio); err = snd_soc_jack_add_gpios(&rx51_av_jack, ARRAY_SIZE(rx51_av_jack_gpios), rx51_av_jack_gpios); if (err) { dev_err(card->dev, "Failed to add GPIOs\n"); return err; } return err; }
static int n810_aic33_init(struct snd_soc_codec *codec) { int err; snd_soc_dapm_nc_pin(codec, "MONO_LOUT"); snd_soc_dapm_nc_pin(codec, "HPLCOM"); snd_soc_dapm_nc_pin(codec, "HPRCOM"); snd_soc_dapm_nc_pin(codec, "MIC3L"); snd_soc_dapm_nc_pin(codec, "MIC3R"); snd_soc_dapm_nc_pin(codec, "LINE1R"); snd_soc_dapm_nc_pin(codec, "LINE2L"); snd_soc_dapm_nc_pin(codec, "LINE2R"); err = snd_soc_add_controls(codec, aic33_n810_controls, ARRAY_SIZE(aic33_n810_controls)); if (err < 0) return err; snd_soc_dapm_new_controls(codec, aic33_dapm_widgets, ARRAY_SIZE(aic33_dapm_widgets)); snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_sync(codec); return 0; }
static int zoom2_twl4030_init(struct snd_soc_codec *codec) { int ret; /* Add Zoom2 specific widgets */ ret = snd_soc_dapm_new_controls(codec, zoom2_twl4030_dapm_widgets, ARRAY_SIZE(zoom2_twl4030_dapm_widgets)); if (ret) return ret; /* Set up Zoom2 specific audio path audio_map */ snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); /* Zoom2 connected pins */ snd_soc_dapm_enable_pin(codec, "Ext Mic"); snd_soc_dapm_enable_pin(codec, "Ext Spk"); snd_soc_dapm_enable_pin(codec, "Headset Mic"); snd_soc_dapm_enable_pin(codec, "Headset Stereophone"); snd_soc_dapm_enable_pin(codec, "Aux In"); /* TWL4030 not connected pins */ snd_soc_dapm_nc_pin(codec, "CARKITMIC"); snd_soc_dapm_nc_pin(codec, "DIGIMIC0"); snd_soc_dapm_nc_pin(codec, "DIGIMIC1"); snd_soc_dapm_nc_pin(codec, "EARPIECE"); snd_soc_dapm_nc_pin(codec, "PREDRIVEL"); snd_soc_dapm_nc_pin(codec, "PREDRIVER"); snd_soc_dapm_nc_pin(codec, "CARKITL"); snd_soc_dapm_nc_pin(codec, "CARKITR"); ret = snd_soc_dapm_sync(codec); return ret; }
static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; int ret; /* */ snd_soc_dapm_nc_pin(dapm, "OUT3"); snd_soc_dapm_nc_pin(dapm, "OUT4"); snd_soc_dapm_nc_pin(dapm, "LINE1"); snd_soc_dapm_nc_pin(dapm, "LINE2"); /* */ ret = snd_soc_dapm_new_controls(dapm, neo1973_wm8753_dapm_widgets, ARRAY_SIZE(neo1973_wm8753_dapm_widgets)); if (ret) return ret; /* */ ret = snd_soc_add_card_controls(rtd->card, neo1973_wm8753_controls, ARRAY_SIZE(neo1973_wm8753_controls)); if (ret) return ret; /* */ ret = snd_soc_dapm_add_routes(dapm, neo1973_wm8753_routes, ARRAY_SIZE(neo1973_wm8753_routes)); if (ret) return ret; /* */ snd_soc_dapm_disable_pin(dapm, "GSM Line Out"); snd_soc_dapm_disable_pin(dapm, "GSM Line In"); snd_soc_dapm_disable_pin(dapm, "Headset Mic"); snd_soc_dapm_disable_pin(dapm, "Handset Mic"); /* */ snd_soc_dapm_ignore_suspend(dapm, "GSM Line Out"); snd_soc_dapm_ignore_suspend(dapm, "GSM Line In"); snd_soc_dapm_ignore_suspend(dapm, "Headset Mic"); snd_soc_dapm_ignore_suspend(dapm, "Handset Mic"); if (machine_is_neo1973_gta02()) { ret = neo1973_gta02_wm8753_init(codec); if (ret) return ret; } return 0; }
static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; int err; /* Not connected */ snd_soc_dapm_nc_pin(codec, "MONO_LOUT"); snd_soc_dapm_nc_pin(codec, "HPLCOM"); snd_soc_dapm_nc_pin(codec, "HPRCOM"); snd_soc_dapm_nc_pin(codec, "MIC3L"); snd_soc_dapm_nc_pin(codec, "MIC3R"); snd_soc_dapm_nc_pin(codec, "LINE1R"); snd_soc_dapm_nc_pin(codec, "LINE2L"); snd_soc_dapm_nc_pin(codec, "LINE2R"); /* Add N810 specific controls */ err = snd_soc_add_controls(codec, aic33_n810_controls, ARRAY_SIZE(aic33_n810_controls)); if (err < 0) return err; /* Add N810 specific widgets */ snd_soc_dapm_new_controls(codec, aic33_dapm_widgets, ARRAY_SIZE(aic33_dapm_widgets)); /* Set up N810 specific audio path audio_map */ snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_sync(codec); return 0; }
static int smartq_wm8987_init(struct snd_soc_codec *codec) { int err = 0; /* Add SmartQ specific widgets */ snd_soc_dapm_new_controls(codec, wm8987_dapm_widgets, ARRAY_SIZE(wm8987_dapm_widgets)); /* add SmartQ specific controls */ err = snd_soc_add_controls(codec, wm8987_smartq_controls, ARRAY_SIZE(wm8987_smartq_controls)); if (err < 0) return err; /* setup SmartQ specific audio path */ snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); /* set endpoints to not connected */ snd_soc_dapm_nc_pin(codec, "LINPUT1"); snd_soc_dapm_nc_pin(codec, "RINPUT1"); snd_soc_dapm_nc_pin(codec, "OUT3"); snd_soc_dapm_nc_pin(codec, "ROUT1"); /* set endpoints to default off mode */ snd_soc_dapm_enable_pin(codec, "Internal Speaker"); snd_soc_dapm_enable_pin(codec, "Internal Mic"); snd_soc_dapm_disable_pin(codec, "Headphone Jack"); err = snd_soc_dapm_sync(codec); if (err) return err; /* Headphone jack detection */ err = snd_soc_jack_new(&snd_soc_smartq, "Headphone Jack", SND_JACK_HEADPHONE, &smartq_jack); if (err) return err; err = snd_soc_jack_add_pins(&smartq_jack, ARRAY_SIZE(smartq_jack_pins), smartq_jack_pins); if (err) return err; err = snd_soc_jack_add_gpios(&smartq_jack, ARRAY_SIZE(smartq_jack_gpios), smartq_jack_gpios); return err; }