summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/lm4857.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-07-28 20:45:28 +0400
committerMark Brown <broonie@linaro.org>2013-07-28 22:09:16 +0400
commit07ccc0f4f190070aaba8fb587307f7fefad97981 (patch)
tree0eb7dbfa1d150e3ccb5a1b822f2e7c10a88d0278 /sound/soc/codecs/lm4857.c
parent3b2f64d00c46e1e4e9bd0bb9bb12619adac27a4b (diff)
downloadlinux-07ccc0f4f190070aaba8fb587307f7fefad97981.tar.xz
ASoC: lm4857: Use table based setup for DAPM and controls
Let the ASoC core take care of registering the DAPM widget and routes as well as the controls. This makes the code a bit shorter. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/codecs/lm4857.c')
-rw-r--r--sound/soc/codecs/lm4857.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/sound/soc/codecs/lm4857.c b/sound/soc/codecs/lm4857.c
index 9f9f59573f72..5ea2ed053eb7 100644
--- a/sound/soc/codecs/lm4857.c
+++ b/sound/soc/codecs/lm4857.c
@@ -174,28 +174,9 @@ static const struct snd_soc_dapm_route lm4857_routes[] = {
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_codec_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;
}
@@ -207,6 +188,13 @@ static struct snd_soc_codec_driver soc_codec_dev_lm4857 = {
.reg_word_size = sizeof(uint8_t),
.reg_cache_default = lm4857_default_regs,
.set_bias_level = lm4857_set_bias_level,
+
+ .controls = lm4857_controls,
+ .num_controls = ARRAY_SIZE(lm4857_controls),
+ .dapm_widgets = lm4857_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(lm4857_dapm_widgets),
+ .dapm_routes = lm4857_routes,
+ .num_dapm_routes = ARRAY_SIZE(lm4857_routes),
};
static int lm4857_i2c_probe(struct i2c_client *i2c,