Example #1
0
static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	int ret;

	/* Add SDP4430 specific widgets */
	ret = snd_soc_dapm_new_controls(dapm, sdp4430_twl6040_dapm_widgets,
				ARRAY_SIZE(sdp4430_twl6040_dapm_widgets));
	if (ret)
		return ret;

	/* Set up SDP4430 specific audio path audio_map */
	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));

	/* SDP4430 connected pins */
	snd_soc_dapm_enable_pin(dapm, "Ext Mic");
	snd_soc_dapm_enable_pin(dapm, "Ext Spk");
	snd_soc_dapm_enable_pin(dapm, "AFML");
	snd_soc_dapm_enable_pin(dapm, "AFMR");
	snd_soc_dapm_enable_pin(dapm, "Headset Mic");
	snd_soc_dapm_enable_pin(dapm, "Headset Stereophone");

	ret = snd_soc_dapm_sync(dapm);
	if (ret)
		return ret;

	/* Headset jack detection */
	ret = snd_soc_jack_new(codec, "Headset Jack",
				SND_JACK_HEADSET, &hs_jack);
	if (ret)
		return ret;

	ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
				hs_jack_pins);

	if (machine_is_omap_4430sdp())
		twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET);
	else
		snd_soc_jack_report(&hs_jack, SND_JACK_HEADSET, SND_JACK_HEADSET);

	return ret;
}
Example #2
0
/*
 * Logic for a wm8750 as connected on a Z2 Device
 */
static int z2_wm8750_init(struct snd_soc_pcm_runtime *rtd)
{
    struct snd_soc_codec *codec = rtd->codec;
    int ret;

    /* NC codec pins */
    snd_soc_dapm_disable_pin(codec, "LINPUT3");
    snd_soc_dapm_disable_pin(codec, "RINPUT3");
    snd_soc_dapm_disable_pin(codec, "OUT3");
    snd_soc_dapm_disable_pin(codec, "MONO");

    /* Add z2 specific widgets */
    snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets,
                              ARRAY_SIZE(wm8750_dapm_widgets));

    /* Set up z2 specific audio paths */
    snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));

    ret = snd_soc_dapm_sync(codec);
    if (ret)
        goto err;

    /* Jack detection API stuff */
    ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET,
                           &hs_jack);
    if (ret)
        goto err;

    ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
                                hs_jack_pins);
    if (ret)
        goto err;

    ret = snd_soc_jack_add_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios),
                                 hs_jack_gpios);
    if (ret)
        goto err;

    return 0;

err:
    return ret;
}
static int smdk64xx_wm8580_init_paiftx(struct snd_soc_codec *codec)
{
	/* Add smdk64xx specific Capture widgets */
	snd_soc_dapm_new_controls(codec, wm8580_dapm_widgets_cpt,
				  ARRAY_SIZE(wm8580_dapm_widgets_cpt));

	/* Set up PAIFTX audio path */
	snd_soc_dapm_add_routes(codec, audio_map_tx, ARRAY_SIZE(audio_map_tx));

	/* Enabling the microphone requires the fitting of a 0R
	 * resistor to connect the line from the microphone jack.
	 */
	snd_soc_dapm_disable_pin(codec, "MicIn");

	/* signal a DAPM event */
	snd_soc_dapm_sync(codec);

	return 0;
}
Example #4
0
static int smdk6440_wm8580_init(struct snd_soc_codec *codec)
{
	int i;

	/* Add smdk6440 specific widgets */
	snd_soc_dapm_new_controls(codec, wm8580_dapm_widgets,ARRAY_SIZE(wm8580_dapm_widgets));

	/* set up smdk6440 specific audio paths */
	snd_soc_dapm_add_routes(codec, audio_map,ARRAY_SIZE(audio_map));

	/* No jack detect - mark all jacks as enabled */
	for (i = 0; i < ARRAY_SIZE(wm8580_dapm_widgets); i++)
		snd_soc_dapm_set_endpoint(codec,
					  wm8580_dapm_widgets[i].name, 1);

	snd_soc_dapm_sync_endpoints(codec);

	return 0;
}
Example #5
0
static int msm_audrx_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 *cpu_dai = rtd->cpu_dai;
	int ret = 0;

	pr_debug("%s(),dev_name%s\n", __func__, dev_name(cpu_dai->dev));
	msm8x10_ext_spk_power_amp_init();

	mbhc_cfg.calibration = def_msm8x10_wcd_mbhc_cal();
	if (mbhc_cfg.calibration) {
		ret = msm8x10_wcd_hs_detect(codec, &mbhc_cfg);
		if (ret) {
			pr_err("%s: msm8x10_wcd_hs_detect failed\n", __func__);
			goto exit;
		}
	} else {
		ret = -ENOMEM;
		goto exit;
	}

	snd_soc_dapm_new_controls(dapm, msm8x10_dapm_widgets,
				ARRAY_SIZE(msm8x10_dapm_widgets));

	snd_soc_dapm_enable_pin(dapm, "Lineout amp");
	snd_soc_dapm_sync(dapm);

	ret = snd_soc_add_codec_controls(codec, msm_snd_controls,
					 ARRAY_SIZE(msm_snd_controls));
	if (ret < 0)
		return ret;

	msm_vibrator_amp_control_init();

exit:
	if (gpio_is_valid(ext_spk_amp_gpio))
		gpio_free(ext_spk_amp_gpio);

	return ret;
}
Example #6
0
static int ad1836_probe(struct platform_device *pdev)
{
	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
	struct snd_soc_codec *codec;
	int ret = 0;

	if (ad1836_codec == NULL) {
		dev_err(&pdev->dev, "Codec device not registered\n");
		return -ENODEV;
	}

	socdev->card->codec = ad1836_codec;
	codec = ad1836_codec;

	/* register pcms */
	ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
	if (ret < 0) {
		dev_err(codec->dev, "failed to create pcms: %d\n", ret);
		goto pcm_err;
	}

	snd_soc_add_controls(codec, ad1836_snd_controls,
			     ARRAY_SIZE(ad1836_snd_controls));
	snd_soc_dapm_new_controls(codec, ad1836_dapm_widgets,
				  ARRAY_SIZE(ad1836_dapm_widgets));
	snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths));
	snd_soc_dapm_new_widgets(codec);

	ret = snd_soc_init_card(socdev);
	if (ret < 0) {
		dev_err(codec->dev, "failed to register card: %d\n", ret);
		goto card_err;
	}

	return ret;

card_err:
	snd_soc_free_pcms(socdev);
	snd_soc_dapm_free(socdev);
pcm_err:
	return ret;
}
Example #7
0
static int am3517evm_aic23_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;

	/* Add am3517-evm specific widgets */
	snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets,
				  ARRAY_SIZE(tlv320aic23_dapm_widgets));

	/* Set up davinci-evm specific audio path audio_map */
	snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));

	/* always connected */
	snd_soc_dapm_enable_pin(codec, "Line Out");
	snd_soc_dapm_enable_pin(codec, "Line In");
	snd_soc_dapm_enable_pin(codec, "Mic In");

	snd_soc_dapm_sync(codec);

	return 0;
}
Example #8
0
static int mini6410_ac97_init(struct snd_soc_codec *codec) {
	unsigned short val;

	/* add board specific widgets */
	snd_soc_dapm_new_controls(codec, mini6410_dapm_widgets,
			ARRAY_SIZE(mini6410_dapm_widgets));

	/* setup board specific audio path audio_map */
	snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));

	/* Prepare MIC input */
	val = codec->read(codec, AC97_3D_CONTROL);
	codec->write(codec, AC97_3D_CONTROL, val | 0xc000);

	/* Static setup for now */
	snd_soc_dapm_enable_pin(codec, "Mic (on-board)");
	snd_soc_dapm_sync(codec);

	return 0;
}
/**
 * simtec_tlv320aic23_init - initialise and add controls
 * @codec; The codec instance to attach to.
 *
 * Attach our controls and configure the necessary codec
 * mappings for our sound card instance.
*/
static int simtec_tlv320aic23_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_new_controls(dapm, dapm_widgets,
				  ARRAY_SIZE(dapm_widgets));

	snd_soc_dapm_add_routes(dapm, base_map, ARRAY_SIZE(base_map));

	snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
	snd_soc_dapm_enable_pin(dapm, "Line In");
	snd_soc_dapm_enable_pin(dapm, "Line Out");
	snd_soc_dapm_enable_pin(dapm, "Mic Jack");

	simtec_audio_init(rtd);
	snd_soc_dapm_sync(dapm);

	return 0;
}
Example #10
0
static int jz4740_codec_dev_probe(struct snd_soc_codec *codec)
{
	snd_soc_update_bits(codec, JZ4740_REG_CODEC_1,
			JZ4740_CODEC_1_SW2_ENABLE, JZ4740_CODEC_1_SW2_ENABLE);

	snd_soc_add_controls(codec, jz4740_codec_controls,
		ARRAY_SIZE(jz4740_codec_controls));

	snd_soc_dapm_new_controls(codec, jz4740_codec_dapm_widgets,
		ARRAY_SIZE(jz4740_codec_dapm_widgets));

	snd_soc_dapm_add_routes(codec, jz4740_codec_dapm_routes,
		ARRAY_SIZE(jz4740_codec_dapm_routes));

	snd_soc_dapm_new_widgets(codec);

	jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

	return 0;
}
static int omap3pandora_in_init(struct snd_soc_codec *codec)
{
	int ret;

	/* Not comnnected */
	snd_soc_dapm_nc_pin(codec, "HSMIC");
	snd_soc_dapm_nc_pin(codec, "CARKITMIC");
	snd_soc_dapm_nc_pin(codec, "DIGIMIC0");
	snd_soc_dapm_nc_pin(codec, "DIGIMIC1");

	ret = snd_soc_dapm_new_controls(codec, omap3pandora_in_dapm_widgets,
				ARRAY_SIZE(omap3pandora_in_dapm_widgets));
	if (ret < 0)
		return ret;

	snd_soc_dapm_add_routes(codec, omap3pandora_in_map,
		ARRAY_SIZE(omap3pandora_in_map));

	return snd_soc_dapm_sync(codec);
}
Example #12
0
static int zylonite_wm9713_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;

	if (clk_pout)
		snd_soc_dai_set_pll(rtd->codec_dai, 0, 0,
				    clk_get_rate(pout), 0);

	snd_soc_dapm_new_controls(codec, zylonite_dapm_widgets,
				  ARRAY_SIZE(zylonite_dapm_widgets));

	snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));

	/* Static setup for now */
	snd_soc_dapm_enable_pin(codec, "Headphone");
	snd_soc_dapm_enable_pin(codec, "Headset Earpiece");

	snd_soc_dapm_sync(codec);
	return 0;
}
Example #13
0
static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	int ret;

	/* Not comnnected */
	snd_soc_dapm_nc_pin(dapm, "HSMIC");
	snd_soc_dapm_nc_pin(dapm, "CARKITMIC");
	snd_soc_dapm_nc_pin(dapm, "DIGIMIC0");
	snd_soc_dapm_nc_pin(dapm, "DIGIMIC1");

	ret = snd_soc_dapm_new_controls(dapm, omap3pandora_in_dapm_widgets,
				ARRAY_SIZE(omap3pandora_in_dapm_widgets));
	if (ret < 0)
		return ret;

	return snd_soc_dapm_add_routes(dapm, omap3pandora_in_map,
		ARRAY_SIZE(omap3pandora_in_map));
}
Example #14
0
static int neo1973_lm4857_init(struct snd_soc_dapm_context *dapm)
{
	int ret;

	ret = snd_soc_dapm_new_controls(dapm, neo1973_lm4857_dapm_widgets,
			ARRAY_SIZE(neo1973_lm4857_dapm_widgets));
	if (ret)
		return ret;

	ret = snd_soc_dapm_add_routes(dapm, neo1973_lm4857_routes,
			ARRAY_SIZE(neo1973_lm4857_routes));
	if (ret)
		return ret;

	snd_soc_dapm_ignore_suspend(dapm, "Stereo Out");
	snd_soc_dapm_ignore_suspend(dapm, "Handset Spk");
	snd_soc_dapm_ignore_suspend(dapm, "Headphone");

	return 0;
}
Example #15
0
static int osk_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;

	/* Add osk5912 specific widgets */
	snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
				  ARRAY_SIZE(tlv320aic23_dapm_widgets));

	/* Set up osk5912 specific audio path audio_map */
	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));

	snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
	snd_soc_dapm_enable_pin(dapm, "Line In");
	snd_soc_dapm_enable_pin(dapm, "Mic Jack");

	snd_soc_dapm_sync(dapm);

	return 0;
}
static int imx_3stack_ak4647_init(struct snd_soc_codec *codec)
{
	int i, ret;
	for (i = 0; i < ARRAY_SIZE(ak4647_card_controls); i++) {
		ret = snd_ctl_add(codec->card,
				  snd_soc_cnew(&ak4647_card_controls[i],
					       codec, NULL));
		if (ret < 0)
			return ret;
	}

	snd_soc_dapm_new_controls(codec, imx_3stack_dapm_widgets,
				  ARRAY_SIZE(imx_3stack_dapm_widgets));

	snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));

	snd_soc_dapm_sync(codec);

	return 0;
}
Example #17
0
static int adau1977_codec_probe(struct snd_soc_codec *codec)
{
	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
	struct adau1977 *adau1977 = snd_soc_codec_get_drvdata(codec);
	int ret;

	switch (adau1977->type) {
	case ADAU1977:
		ret = snd_soc_dapm_new_controls(dapm,
			adau1977_micbias_dapm_widgets,
			ARRAY_SIZE(adau1977_micbias_dapm_widgets));
		if (ret < 0)
			return ret;
		break;
	default:
		break;
	}

	return 0;
}
Example #18
0
static int ad1836_probe(struct snd_soc_codec *codec)
{
	struct ad1836_priv *ad1836 = snd_soc_codec_get_drvdata(codec);
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	int ret = 0;

	codec->control_data = ad1836->control_data;
	ret = snd_soc_codec_set_cache_io(codec, 4, 12, SND_SOC_SPI);
	if (ret < 0) {
		dev_err(codec->dev, "failed to set cache I/O: %d\n",
				ret);
		return ret;
	}

	/* default setting for ad1836 */
	/* de-emphasis: 48kHz, power-on dac */
	snd_soc_write(codec, AD1836_DAC_CTRL1, 0x300);
	/* unmute dac channels */
	snd_soc_write(codec, AD1836_DAC_CTRL2, 0x0);
	/* high-pass filter enable, power-on adc */
	snd_soc_write(codec, AD1836_ADC_CTRL1, 0x100);
	/* unmute adc channles, adc aux mode */
	snd_soc_write(codec, AD1836_ADC_CTRL2, 0x180);
	/* left/right diff:PGA/MUX */
	snd_soc_write(codec, AD1836_ADC_CTRL3, 0x3A);
	/* volume */
	snd_soc_write(codec, AD1836_DAC_L1_VOL, 0x3FF);
	snd_soc_write(codec, AD1836_DAC_R1_VOL, 0x3FF);
	snd_soc_write(codec, AD1836_DAC_L2_VOL, 0x3FF);
	snd_soc_write(codec, AD1836_DAC_R2_VOL, 0x3FF);
	snd_soc_write(codec, AD1836_DAC_L3_VOL, 0x3FF);
	snd_soc_write(codec, AD1836_DAC_R3_VOL, 0x3FF);

	snd_soc_add_controls(codec, ad1836_snd_controls,
			     ARRAY_SIZE(ad1836_snd_controls));
	snd_soc_dapm_new_controls(dapm, ad1836_dapm_widgets,
				  ARRAY_SIZE(ad1836_dapm_widgets));
	snd_soc_dapm_add_routes(dapm, audio_paths, ARRAY_SIZE(audio_paths));

	return ret;
}
static int mango210_wm8960_init_paifrx(struct snd_soc_codec *codec)
{
	int ret;

	/* Add mango210 specific Playback widgets */
	snd_soc_dapm_new_controls(codec, wm8960_dapm_widgets_pbk,
				  ARRAY_SIZE(wm8960_dapm_widgets_pbk));

	/* add iDMA controls */
	ret = snd_soc_add_controls(codec, &s5p_idma_control, 1);
	if (ret < 0)
		return ret;

	/* Set up PAIFRX audio path */
	snd_soc_dapm_add_routes(codec, audio_map_rx, ARRAY_SIZE(audio_map_rx));

	/* signal a DAPM event */
	snd_soc_dapm_sync(codec);

	/* Set the Codec DAI configuration */
	ret = snd_soc_dai_set_fmt(&wm8960_dai, SND_SOC_DAIFMT_I2S
					 | SND_SOC_DAIFMT_NB_NF
					 | SND_SOC_DAIFMT_CBS_CFS);
	if (ret < 0)
		return ret;

	/* Set the AP DAI configuration */
	ret = snd_soc_dai_set_fmt(&s3c64xx_i2s_dai[I2S_NUM], SND_SOC_DAIFMT_I2S
					 | SND_SOC_DAIFMT_NB_NF
					 | SND_SOC_DAIFMT_CBS_CFS);
	if (ret < 0)
		return ret;

	/* Set WM8960 to drive MCLK from its MCLK-pin */
	ret = snd_soc_dai_set_clkdiv(&wm8960_dai, WM8960_SYSCLKSEL,
					WM8960_SYSCLK_MCLK);
	if (ret < 0)
		return ret;

	return 0;
}
Example #20
0
/*
 * 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;
	}

	/* Add specific widgets */
	snd_soc_dapm_new_controls(dapm, at91sam9g20ek_dapm_widgets,
				  ARRAY_SIZE(at91sam9g20ek_dapm_widgets));
	/* Set up specific audio path interconnects */
	snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));

	/* not connected */
	snd_soc_dapm_nc_pin(dapm, "RLINEIN");
	snd_soc_dapm_nc_pin(dapm, "LLINEIN");

#ifdef ENABLE_MIC_INPUT
	snd_soc_dapm_enable_pin(dapm, "Int Mic");
#else
	snd_soc_dapm_nc_pin(dapm, "Int Mic");
#endif

	/* always connected */
	snd_soc_dapm_enable_pin(dapm, "Ext Spk");

	snd_soc_dapm_sync(dapm);

	return 0;
}
Example #21
0
static int cs42l51_probe(struct snd_soc_codec *codec)
{
	struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec);
	int ret, reg;

	codec->control_data = cs42l51->control_data;

	ret = cs42l51_fill_cache(codec);
	if (ret < 0) {
		dev_err(codec->dev, "failed to fill register cache\n");
		return ret;
	}

	ret = snd_soc_codec_set_cache_io(codec, 8, 8, cs42l51->control_type);
	if (ret < 0) {
		dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
		return ret;
	}

	/*
	 * DAC configuration
	 * - Use signal processor
	 * - auto mute
	 * - vol changes immediate
	 * - no de-emphasize
	 */
	reg = CS42L51_DAC_CTL_DATA_SEL(1)
		| CS42L51_DAC_CTL_AMUTE | CS42L51_DAC_CTL_DACSZ(0);
	ret = snd_soc_write(codec, CS42L51_DAC_CTL, reg);
	if (ret < 0)
		return ret;

	snd_soc_add_controls(codec, cs42l51_snd_controls,
		ARRAY_SIZE(cs42l51_snd_controls));
	snd_soc_dapm_new_controls(codec, cs42l51_dapm_widgets,
		ARRAY_SIZE(cs42l51_dapm_widgets));
	snd_soc_dapm_add_routes(codec, cs42l51_routes,
		ARRAY_SIZE(cs42l51_routes));

	return 0;
}
Example #22
0
static int e750_ac97_init(struct snd_soc_codec *codec)
{
    snd_soc_dapm_nc_pin(codec, "LOUT");
    snd_soc_dapm_nc_pin(codec, "ROUT");
    snd_soc_dapm_nc_pin(codec, "PHONE");
    snd_soc_dapm_nc_pin(codec, "LINEINL");
    snd_soc_dapm_nc_pin(codec, "LINEINR");
    snd_soc_dapm_nc_pin(codec, "CDINL");
    snd_soc_dapm_nc_pin(codec, "CDINR");
    snd_soc_dapm_nc_pin(codec, "PCBEEP");
    snd_soc_dapm_nc_pin(codec, "MIC2");

    snd_soc_dapm_new_controls(codec, e750_dapm_widgets,
                              ARRAY_SIZE(e750_dapm_widgets));

    snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));

    snd_soc_dapm_sync(codec);

    return 0;
}
Example #23
0
static int mixtile_rt5640_init_paiftx(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;

	printa("mixtile capture new control\n");
	snd_soc_dapm_new_controls(dapm, rt5640_dapm_widgets_cpt, ARRAY_SIZE(rt5640_dapm_widgets_cpt));

	printa("mixtile capture add_routes\n");
  if(dev_ver == 1)
    snd_soc_dapm_add_routes(dapm, audio_map_tx_htpc, ARRAY_SIZE(audio_map_tx_htpc));
  else
    snd_soc_dapm_add_routes(dapm, audio_map_tx, ARRAY_SIZE(audio_map_tx));
  
  	printa("mixtile capture snd_soc_dapm_sync\n");
	snd_soc_dapm_sync(dapm);

	

	return 0;
}
Example #24
0
static int smdk6410_ac97_init(struct snd_soc_pcm_runtime *rtd) {
	struct snd_soc_codec *codec = rtd->codec;
    struct snd_soc_dapm_context *dapm = &codec->dapm;
	unsigned short val;

	/* add board specific widgets */
	snd_soc_dapm_new_controls(dapm, ARRAY_AND_SIZE(smdk6410_dapm_widgets));

	/* setup board specific audio path audio_map */
	snd_soc_dapm_add_routes(dapm, ARRAY_AND_SIZE(audio_map));

	/* Prepare MIC input */
	val = codec->driver->read(codec, AC97_3D_CONTROL);
	codec->driver->write(codec, AC97_3D_CONTROL, val | 0xc000);

	/* Static setup for now */
	snd_soc_dapm_enable_pin(dapm, "Mic (on-board)");
	snd_soc_dapm_sync(dapm);

	return 0;
}
Example #25
0
static int wm8350_add_widgets(struct snd_soc_codec *codec)
{
	int ret;

	ret = snd_soc_dapm_new_controls(codec,
					wm8350_dapm_widgets,
					ARRAY_SIZE(wm8350_dapm_widgets));
	if (ret != 0) {
		dev_err(codec->dev, "dapm control register failed\n");
		return ret;
	}

	/* set up audio paths */
	ret = snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
	if (ret != 0) {
		dev_err(codec->dev, "DAPM route register failed\n");
		return ret;
	}

	return 0;
}
Example #26
0
static int qi_lb60_codec_init(struct snd_soc_pcm_runtime *rtd)
{
    struct snd_soc_codec *codec = rtd->codec;
    struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
    int ret;

    snd_soc_dapm_nc_pin(codec, "LIN");
    snd_soc_dapm_nc_pin(codec, "RIN");

    ret = snd_soc_dai_set_fmt(cpu_dai, QI_LB60_DAIFMT);
    if (ret < 0) {
        dev_err(codec->dev, "Failed to set cpu dai format: %d\n", ret);
        return ret;
    }

    snd_soc_dapm_new_controls(codec, qi_lb60_widgets, ARRAY_SIZE(qi_lb60_widgets));
    snd_soc_dapm_add_routes(codec, qi_lb60_routes, ARRAY_SIZE(qi_lb60_routes));
    snd_soc_dapm_sync(codec);

    return 0;
}
Example #27
0
static int mxs_evk_codec_init(struct snd_soc_codec *codec)
{
	int i, ret;
	/* Add mxs evk specific controls */
	snd_soc_add_controls(codec, mxs_evk_controls,
		ARRAY_SIZE(mxs_evk_controls));

	/* Add mxs evk specific widgets */
	snd_soc_dapm_new_controls(codec, mxs_evk_dapm_widgets,
				  ARRAY_SIZE(mxs_evk_dapm_widgets));

	/* Set up mxs evk specific audio path audio_map */
	snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));

	snd_soc_dapm_sync(codec);
	/* default on */
	mxs_evk_jack_func = 1;
	mxs_evk_spk_func = 1;

	return ret;
}
static int mango210_wm8960_init_paiftx(struct snd_soc_codec *codec)
{
	int ret;

	/* Add mango210 specific Capture widgets */
	snd_soc_dapm_new_controls(codec, wm8960_dapm_widgets_cpt,
				  ARRAY_SIZE(wm8960_dapm_widgets_cpt));

	/* Set up PAIFTX audio path */
	snd_soc_dapm_add_routes(codec, audio_map_tx, ARRAY_SIZE(audio_map_tx));

	/* Enabling the microphone requires the fitting of a 0R
	 * resistor to connect the line from the microphone jack.
	 */
//	snd_soc_dapm_disable_pin(codec, "MicIn");

	/* signal a DAPM event */
	snd_soc_dapm_sync(codec);

	/* Set the Codec DAI configuration */
	ret = snd_soc_dai_set_fmt(&wm8960_dai, SND_SOC_DAIFMT_I2S
					 | SND_SOC_DAIFMT_NB_NF
					 | SND_SOC_DAIFMT_CBS_CFS);
	if (ret < 0)
		return ret;
	/* Set the AP DAI configuration */
	ret = snd_soc_dai_set_fmt(&s3c64xx_i2s_dai[I2S_NUM], SND_SOC_DAIFMT_I2S
					 | SND_SOC_DAIFMT_NB_NF
					 | SND_SOC_DAIFMT_CBS_CFS);
	if (ret < 0)
		return ret;

	/* Set WM8960 to drive MCLK from its MCLK-pin */
	ret = snd_soc_dai_set_clkdiv(&wm8960_dai, WM8960_SYSCLKSEL,
					WM8960_SYSCLK_MCLK);
	if (ret < 0)
		return ret;

	return 0;
}
Example #29
0
int wm_hubs_add_analogue_controls(struct snd_soc_codec *codec)
{
	struct snd_soc_dapm_context *dapm = &codec->dapm;

	/* Latch volume update bits & default ZC on */
	snd_soc_update_bits(codec, WM8993_LEFT_LINE_INPUT_1_2_VOLUME,
			    WM8993_IN1_VU, WM8993_IN1_VU);
	snd_soc_update_bits(codec, WM8993_RIGHT_LINE_INPUT_1_2_VOLUME,
			    WM8993_IN1_VU, WM8993_IN1_VU);
	snd_soc_update_bits(codec, WM8993_LEFT_LINE_INPUT_3_4_VOLUME,
			    WM8993_IN2_VU, WM8993_IN2_VU);
	snd_soc_update_bits(codec, WM8993_RIGHT_LINE_INPUT_3_4_VOLUME,
			    WM8993_IN2_VU, WM8993_IN2_VU);

	snd_soc_update_bits(codec, WM8993_SPEAKER_VOLUME_LEFT,
			    WM8993_SPKOUT_VU, WM8993_SPKOUT_VU);
	snd_soc_update_bits(codec, WM8993_SPEAKER_VOLUME_RIGHT,
			    WM8993_SPKOUT_VU, WM8993_SPKOUT_VU);

	snd_soc_update_bits(codec, WM8993_LEFT_OUTPUT_VOLUME,
			    WM8993_HPOUT1_VU | WM8993_HPOUT1L_ZC,
			    WM8993_HPOUT1_VU | WM8993_HPOUT1L_ZC);
	snd_soc_update_bits(codec, WM8993_RIGHT_OUTPUT_VOLUME,
			    WM8993_HPOUT1_VU | WM8993_HPOUT1R_ZC,
			    WM8993_HPOUT1_VU | WM8993_HPOUT1R_ZC);

	snd_soc_update_bits(codec, WM8993_LEFT_OPGA_VOLUME,
			    WM8993_MIXOUTL_ZC | WM8993_MIXOUT_VU,
			    WM8993_MIXOUTL_ZC | WM8993_MIXOUT_VU);
	snd_soc_update_bits(codec, WM8993_RIGHT_OPGA_VOLUME,
			    WM8993_MIXOUTR_ZC | WM8993_MIXOUT_VU,
			    WM8993_MIXOUTR_ZC | WM8993_MIXOUT_VU);

	snd_soc_add_controls(codec, analogue_snd_controls,
			     ARRAY_SIZE(analogue_snd_controls));

	snd_soc_dapm_new_controls(dapm, analogue_dapm_widgets,
				  ARRAY_SIZE(analogue_dapm_widgets));
	return 0;
}
Example #30
0
static int sdp4430_dmic_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	int ret;

	ret = snd_soc_dapm_new_controls(dapm, sdp4430_dmic_dapm_widgets,
				ARRAY_SIZE(sdp4430_dmic_dapm_widgets));
	if (ret)
		return ret;

	ret = snd_soc_dapm_add_routes(dapm, dmic_audio_map,
				ARRAY_SIZE(dmic_audio_map));
	if (ret)
		return ret;

	snd_soc_dapm_enable_pin(dapm, "Digital Mic Legacy");

	ret = snd_soc_dapm_sync(dapm);

	return ret;
}