Example #1
0
static int lm4857_probe(struct snd_soc_codec *codec)
{
	struct lm4857 *lm4857 = snd_soc_codec_get_drvdata(codec);
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	int ret;

	codec->control_data = lm4857->i2c;

	ret = snd_soc_add_controls(codec, lm4857_controls,
			ARRAY_SIZE(lm4857_controls));
	if (ret)
		return ret;

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

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

	snd_soc_dapm_new_widgets(dapm);

	return 0;
}
Example #2
0
static int s5m8751_add_widgets(struct snd_soc_codec *codec)
{
	snd_soc_dapm_new_controls(codec, s5m8751_dapm_widgets,
				  ARRAY_SIZE(s5m8751_dapm_widgets));
	snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
	snd_soc_dapm_new_widgets(codec);

	return 0;
}
Example #3
0
static int ak4671_add_widgets(struct snd_soc_codec *codec)
{
	snd_soc_dapm_new_controls(codec, ak4671_dapm_widgets,
				  ARRAY_SIZE(ak4671_dapm_widgets));

	snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon));

	snd_soc_dapm_new_widgets(codec);
	return 0;
}
Example #4
0
static int wm8960_add_widgets(struct snd_soc_codec *codec)
{
	snd_soc_dapm_new_controls(codec, wm8960_dapm_widgets,
				  ARRAY_SIZE(wm8960_dapm_widgets));

	snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths));

	snd_soc_dapm_new_widgets(codec);
	return 0;
}
Example #5
0
static int ca42888_add_widgets(struct snd_soc_codec *codec)
{
	snd_soc_dapm_new_controls(codec, cs42888_dapm_widgets,
				  ARRAY_SIZE(cs42888_dapm_widgets));

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

	snd_soc_dapm_new_widgets(codec);
	return 0;
}
Example #6
0
static int dmic_probe(struct snd_soc_codec *codec)
{
	struct snd_soc_dapm_context *dapm = &codec->dapm;

	snd_soc_dapm_new_controls(dapm, dmic_dapm_widgets,
				  ARRAY_SIZE(dmic_dapm_widgets));
        snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
	snd_soc_dapm_new_widgets(dapm);

	return 0;
}
Example #7
0
static int aic32x4_add_widgets(struct snd_soc_codec *codec)
{
	snd_soc_dapm_new_controls(&codec->dapm, aic32x4_dapm_widgets,
				  ARRAY_SIZE(aic32x4_dapm_widgets));

	snd_soc_dapm_add_routes(&codec->dapm, aic32x4_dapm_routes,
				ARRAY_SIZE(aic32x4_dapm_routes));

	snd_soc_dapm_new_widgets(&codec->dapm);
	return 0;
}
Example #8
0
static int wm8990_add_widgets(struct snd_soc_codec *codec)
{
	snd_soc_dapm_new_controls(codec, wm8990_dapm_widgets,
				  ARRAY_SIZE(wm8990_dapm_widgets));

	/* set up the WM8990 audio map */
	snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));

	snd_soc_dapm_new_widgets(codec);
	return 0;
}
Example #9
0
static int ak4647_add_widgets(struct snd_soc_codec *codec)
{
	snd_soc_dapm_new_controls(codec, ak4647_dapm_widgets,
				  ARRAY_SIZE(ak4647_dapm_widgets));

	/* set up audio path audio_mapnects */
	snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));

	snd_soc_dapm_new_widgets(codec);
	return 0;
}
Example #10
0
static int twl6040_add_widgets(struct snd_soc_codec *codec)
{
	snd_soc_dapm_new_controls(codec->dapm, twl6040_dapm_widgets,
				 ARRAY_SIZE(twl6040_dapm_widgets));

	snd_soc_dapm_add_routes(codec->dapm, intercon, ARRAY_SIZE(intercon));

	snd_soc_dapm_new_widgets(codec->dapm);

	return 0;
}
Example #11
0
static int cx20442_add_widgets(struct snd_soc_codec *codec)
{
	snd_soc_dapm_new_controls(codec, cx20442_dapm_widgets,
				  ARRAY_SIZE(cx20442_dapm_widgets));

	snd_soc_dapm_add_routes(codec, cx20442_audio_map,
				ARRAY_SIZE(cx20442_audio_map));

	snd_soc_dapm_new_widgets(codec);
	return 0;
}
Example #12
0
static int jzcodec_add_widgets(struct snd_soc_codec *codec)
{
	int i,cnt;
	
	cnt = ARRAY_SIZE(jzcodec_dapm_widgets);
	for(i = 0; i < ARRAY_SIZE(jzcodec_dapm_widgets); i++) {
		snd_soc_dapm_new_control(codec, &jzcodec_dapm_widgets[i]);
	}

	/* set up audio path interconnects */
	snd_soc_dapm_add_routes(codec, intercon_routes, ARRAY_SIZE(intercon_routes));
	snd_soc_dapm_new_widgets(codec);
	return 0;
}
Example #13
0
static int tfa_dummy_probe(struct snd_soc_codec *codec)
{

#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
	snd_soc_dapm_new_controls(&codec->dapm, tfa_dummy_dapm_widgets,
				  ARRAY_SIZE(tfa_dummy_dapm_widgets));

	snd_soc_dapm_add_routes(&codec->dapm, tfa_dummy_dapm_routes,
				ARRAY_SIZE(tfa_dummy_dapm_routes));

	snd_soc_dapm_new_widgets(&codec->dapm);
	snd_soc_dapm_sync(&codec->dapm);
#endif

	dev_info(codec->dev, "tfa_dummy codec registered");

	return 0;
}
Example #14
0
static int jzcodec_add_widgets(struct snd_soc_codec *codec)
{
	int i,cnt;
	
	cnt = ARRAY_SIZE(jzcodec_dapm_widgets);
	for(i = 0; i < ARRAY_SIZE(jzcodec_dapm_widgets); i++) {
		snd_soc_dapm_new_control(codec, &jzcodec_dapm_widgets[i]);
	}

	/* set up audio path interconnects */
	for(i = 0; intercon[i][0] != NULL; i++) {
		snd_soc_dapm_connect_input(codec, intercon[i][0],
			intercon[i][1], intercon[i][2]);
	}

	snd_soc_dapm_new_widgets(codec);
	return 0;
}
int abe_mixer_add_widgets(struct snd_soc_platform *platform)
{
	struct omap_abe *abe = snd_soc_platform_get_drvdata(platform);
	struct fw_header *hdr = &abe->hdr;
	int i, j;

	/* create equalizer controls */
	for (i = 0; i < hdr->num_equ; i++) {
		struct soc_enum *equ_enum = &abe->equ.senum[i];
		struct snd_kcontrol_new *equ_kcontrol = &abe->equ.kcontrol[i];

		equ_enum->reg = i;
		equ_enum->max = abe->equ.texts[i].count;
		for (j = 0; j < abe->equ.texts[i].count; j++)
			equ_enum->dtexts[j] = abe->equ.texts[i].texts[j];

		equ_kcontrol->name = abe->equ.texts[i].name;
		equ_kcontrol->private_value = (unsigned long)equ_enum;
		equ_kcontrol->get = abe_get_equalizer;
		equ_kcontrol->put = abe_put_equalizer;
		equ_kcontrol->info = snd_soc_info_enum_ext1;
		equ_kcontrol->iface = SNDRV_CTL_ELEM_IFACE_MIXER;

		dev_dbg(platform->dev, "added EQU mixer: %s profiles %d\n",
				abe->equ.texts[i].name, abe->equ.texts[i].count);

		for (j = 0; j < abe->equ.texts[i].count; j++)
			dev_dbg(platform->dev, " %s\n", equ_enum->dtexts[j]);
	}

	snd_soc_add_platform_controls(platform, abe->equ.kcontrol, hdr->num_equ);

	snd_soc_add_platform_controls(platform, abe_controls,
			ARRAY_SIZE(abe_controls));

	snd_soc_dapm_new_controls(&platform->dapm, abe_dapm_widgets,
				 ARRAY_SIZE(abe_dapm_widgets));

	snd_soc_dapm_add_routes(&platform->dapm, intercon, ARRAY_SIZE(intercon));

	snd_soc_dapm_new_widgets(&platform->dapm);

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

	for(i = 0; i < ARRAY_SIZE(es8328_dapm_widgets); i++) {
		snd_soc_dapm_new_control(codec, &es8328_dapm_widgets[i]);
	}
#if 1
	/* set up audio path audio_mapnects */
	for(i = 0; audio_map[i][0] != NULL; i++) {
		snd_soc_dapm_connect_input(codec, audio_map[i][0],
			audio_map[i][1], audio_map[i][2]);
	}
#endif

//	snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
	snd_soc_dapm_new_widgets(codec);
	return 0;
}
Example #17
0
static int wm8350_add_widgets(struct snd_soc_codec *codec, 
	struct snd_soc_machine *machine)
{
	int i;

	for(i = 0; i < ARRAY_SIZE(wm8350_dapm_widgets); i++) {
		snd_soc_dapm_new_control(machine, codec, 
			&wm8350_dapm_widgets[i]);
	}

	/* set up audio path audio_mapnects */
	for(i = 0; audio_map[i][0] != NULL; i++) {
		snd_soc_dapm_connect_input(machine, audio_map[i][0],
			audio_map[i][1], audio_map[i][2]);
	}

	snd_soc_dapm_new_widgets(machine);
	return 0;
}
Example #18
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 #19
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;
}
Example #20
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 snd_soc_dapm_new_widgets(codec);
}
static int smdkc110_spdif_init(struct snd_soc_codec *codec)
{
	int i;

	//printk("\n Enter the smdkc110_spdif_init \n");
	/* Add smdkc110 specific widgets */
	snd_soc_dapm_new_controls(codec, spdif_dapm_widgets,ARRAY_SIZE(spdif_dapm_widgets));

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

	snd_soc_dapm_new_widgets(codec);
	/* No jack detect - mark all jacks as enabled */
	for (i = 0; i < ARRAY_SIZE(spdif_dapm_widgets); i++){
		//Modified as per 2.6.29
		snd_soc_dapm_enable_pin(codec, spdif_dapm_widgets[i].name);
	}

	//Modified as per 2.6.29
	snd_soc_dapm_sync(codec);

	return 0;
}
Example #22
0
static int tegra_codec_init(struct snd_soc_codec *codec)
{
	struct adam_audio_priv* ctx = codec->socdev->codec_data;
	int ret = 0;

	if (!ctx->init_done) {
		
		/* Get and enable the DAP clock */
		ctx->dap_mclk = tegra_das_get_dap_mclk();
		if (!ctx->dap_mclk) {
			pr_err("Failed to get dap mclk \n");
			return -ENODEV;
		}
		clk_enable(ctx->dap_mclk);

		/* Add the controls used to route audio to bluetooth/voice */
		tegra_das_controls_init(codec);
		
		/* Store the GPIO used to detect headphone */
		tegra_jack_gpios[0].gpio = ctx->gpio_hp_det;

		/* Add tegra specific widgets */
		snd_soc_dapm_new_controls(codec, tegra_dapm_widgets,
					ARRAY_SIZE(tegra_dapm_widgets));

#ifdef ADAM_MANUAL_CONTROL_OF_OUTPUTDEVICE
		/* Add specific adam controls */
		ret = snd_soc_add_controls(codec, tegra_controls,
					ARRAY_SIZE(tegra_controls));
		if (ret < 0) {
			pr_err("Failed to register controls\n");
			return ret;
		}
#endif
					
		/* Set up tegra specific audio path audio_map */
		snd_soc_dapm_add_routes(codec, audio_map,
					ARRAY_SIZE(audio_map));

		/* make sure to register the dapm widgets */
		snd_soc_dapm_new_widgets(codec);
					
		/* Set endpoints to not connected */
		snd_soc_dapm_nc_pin(codec, "LINEL");
		snd_soc_dapm_nc_pin(codec, "LINER");
		snd_soc_dapm_nc_pin(codec, "PHONEIN");
		snd_soc_dapm_nc_pin(codec, "MIC2");
		snd_soc_dapm_nc_pin(codec, "MONO");

		/* 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");
	
		ret = snd_soc_dapm_sync(codec);
		if (ret) {
			pr_err("Failed to sync\n");
			return ret;
		}

#ifndef ADAM_MANUAL_CONTROL_OF_OUTPUTDEVICE
		/* Headphone jack detection */		
		ret = snd_soc_jack_new(codec->socdev->card, "Headphone Jack", SND_JACK_HEADPHONE,
				 &ctx->tegra_jack);
		if (ret)
			return ret;
			 
		ret = snd_soc_jack_add_pins(&ctx->tegra_jack,
			      ARRAY_SIZE(tegra_jack_pins),
			      tegra_jack_pins);
		if (ret)
			return ret;
				  
		ret = snd_soc_jack_add_gpios(&ctx->tegra_jack,
			       ARRAY_SIZE(tegra_jack_gpios),
			       tegra_jack_gpios);
		if (ret)
			return ret;
#endif

		ctx->init_done = 1;
	}

	return ret;
}