Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4505ab1 authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: Convert WM8400 to table based DAPM and control init

parent e6c94e9f
Loading
Loading
Loading
Loading
+8 −21
Original line number Diff line number Diff line
@@ -353,13 +353,6 @@ SOC_SINGLE("RIN34 Mute Switch", WM8400_RIGHT_LINE_INPUT_3_4_VOLUME,

};

/* add non dapm controls */
static int wm8400_add_controls(struct snd_soc_codec *codec)
{
	return snd_soc_add_controls(codec, wm8400_snd_controls,
				ARRAY_SIZE(wm8400_snd_controls));
}

/*
 * _DAPM_ Controls
 */
@@ -783,7 +776,7 @@ SND_SOC_DAPM_OUTPUT("RON"),
SND_SOC_DAPM_OUTPUT("Internal DAC Sink"),
};

static const struct snd_soc_dapm_route audio_map[] = {
static const struct snd_soc_dapm_route wm8400_dapm_routes[] = {
	/* Make DACs turn on when playing even if not mixed into any outputs */
	{"Internal DAC Sink", NULL, "Left DAC"},
	{"Internal DAC Sink", NULL, "Right DAC"},
@@ -909,17 +902,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
	{"RON", NULL, "RONMIX"},
};

static int wm8400_add_widgets(struct snd_soc_codec *codec)
{
	struct snd_soc_dapm_context *dapm = &codec->dapm;

	snd_soc_dapm_new_controls(dapm, wm8400_dapm_widgets,
				  ARRAY_SIZE(wm8400_dapm_widgets));
	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));

	return 0;
}

/*
 * Clock after FLL and dividers
 */
@@ -1421,8 +1403,6 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
		ret = -EINVAL;
		goto err_regulator;
	}
	wm8400_add_controls(codec);
	wm8400_add_widgets(codec);
	return 0;

err_regulator:
@@ -1451,6 +1431,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8400 = {
	.read = wm8400_read,
	.write = wm8400_write,
	.set_bias_level = wm8400_set_bias_level,

	.controls = wm8400_snd_controls,
	.num_controls = ARRAY_SIZE(wm8400_snd_controls),
	.dapm_widgets = wm8400_dapm_widgets,
	.num_dapm_widgets = ARRAY_SIZE(wm8400_dapm_widgets),
	.dapm_routes = wm8400_dapm_routes,
	.num_dapm_routes = ARRAY_SIZE(wm8400_dapm_routes),
};

static int __devinit wm8400_probe(struct platform_device *pdev)