diff options
Diffstat (limited to 'sound/soc/codecs/wm8990.c')
-rw-r--r-- | sound/soc/codecs/wm8990.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index 2d702db4131d..831f4730bfd5 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/slab.h> | ||
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
22 | #include <sound/pcm.h> | 23 | #include <sound/pcm.h> |
23 | #include <sound/pcm_params.h> | 24 | #include <sound/pcm_params.h> |
@@ -920,7 +921,6 @@ static int wm8990_add_widgets(struct snd_soc_codec *codec) | |||
920 | /* set up the WM8990 audio map */ | 921 | /* set up the WM8990 audio map */ |
921 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | 922 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); |
922 | 923 | ||
923 | snd_soc_dapm_new_widgets(codec); | ||
924 | return 0; | 924 | return 0; |
925 | } | 925 | } |
926 | 926 | ||
@@ -972,8 +972,8 @@ static void pll_factors(struct _pll_div *pll_div, unsigned int target, | |||
972 | pll_div->k = K; | 972 | pll_div->k = K; |
973 | } | 973 | } |
974 | 974 | ||
975 | static int wm8990_set_dai_pll(struct snd_soc_dai *codec_dai, | 975 | static int wm8990_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, |
976 | int pll_id, unsigned int freq_in, unsigned int freq_out) | 976 | int source, unsigned int freq_in, unsigned int freq_out) |
977 | { | 977 | { |
978 | u16 reg; | 978 | u16 reg; |
979 | struct snd_soc_codec *codec = codec_dai->codec; | 979 | struct snd_soc_codec *codec = codec_dai->codec; |
@@ -991,7 +991,7 @@ static int wm8990_set_dai_pll(struct snd_soc_dai *codec_dai, | |||
991 | reg = snd_soc_read(codec, WM8990_CLOCKING_2); | 991 | reg = snd_soc_read(codec, WM8990_CLOCKING_2); |
992 | snd_soc_write(codec, WM8990_CLOCKING_2, reg | WM8990_SYSCLK_SRC); | 992 | snd_soc_write(codec, WM8990_CLOCKING_2, reg | WM8990_SYSCLK_SRC); |
993 | 993 | ||
994 | /* set up N , fractional mode and pre-divisor if neccessary */ | 994 | /* set up N , fractional mode and pre-divisor if necessary */ |
995 | snd_soc_write(codec, WM8990_PLL1, pll_div.n | WM8990_SDM | | 995 | snd_soc_write(codec, WM8990_PLL1, pll_div.n | WM8990_SDM | |
996 | (pll_div.div2?WM8990_PRESCALE:0)); | 996 | (pll_div.div2?WM8990_PRESCALE:0)); |
997 | snd_soc_write(codec, WM8990_PLL2, (u8)(pll_div.k>>8)); | 997 | snd_soc_write(codec, WM8990_PLL2, (u8)(pll_div.k>>8)); |
@@ -1320,10 +1320,6 @@ static int wm8990_suspend(struct platform_device *pdev, pm_message_t state) | |||
1320 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 1320 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
1321 | struct snd_soc_codec *codec = socdev->card->codec; | 1321 | struct snd_soc_codec *codec = socdev->card->codec; |
1322 | 1322 | ||
1323 | /* we only need to suspend if we are a valid card */ | ||
1324 | if (!codec->card) | ||
1325 | return 0; | ||
1326 | |||
1327 | wm8990_set_bias_level(codec, SND_SOC_BIAS_OFF); | 1323 | wm8990_set_bias_level(codec, SND_SOC_BIAS_OFF); |
1328 | return 0; | 1324 | return 0; |
1329 | } | 1325 | } |
@@ -1336,10 +1332,6 @@ static int wm8990_resume(struct platform_device *pdev) | |||
1336 | u8 data[2]; | 1332 | u8 data[2]; |
1337 | u16 *cache = codec->reg_cache; | 1333 | u16 *cache = codec->reg_cache; |
1338 | 1334 | ||
1339 | /* we only need to resume if we are a valid card */ | ||
1340 | if (!codec->card) | ||
1341 | return 0; | ||
1342 | |||
1343 | /* Sync reg_cache with the hardware */ | 1335 | /* Sync reg_cache with the hardware */ |
1344 | for (i = 0; i < ARRAY_SIZE(wm8990_reg); i++) { | 1336 | for (i = 0; i < ARRAY_SIZE(wm8990_reg); i++) { |
1345 | if (i + 1 == WM8990_RESET) | 1337 | if (i + 1 == WM8990_RESET) |
@@ -1409,16 +1401,9 @@ static int wm8990_init(struct snd_soc_device *socdev) | |||
1409 | snd_soc_add_controls(codec, wm8990_snd_controls, | 1401 | snd_soc_add_controls(codec, wm8990_snd_controls, |
1410 | ARRAY_SIZE(wm8990_snd_controls)); | 1402 | ARRAY_SIZE(wm8990_snd_controls)); |
1411 | wm8990_add_widgets(codec); | 1403 | wm8990_add_widgets(codec); |
1412 | ret = snd_soc_init_card(socdev); | 1404 | |
1413 | if (ret < 0) { | ||
1414 | printk(KERN_ERR "wm8990: failed to register card\n"); | ||
1415 | goto card_err; | ||
1416 | } | ||
1417 | return ret; | 1405 | return ret; |
1418 | 1406 | ||
1419 | card_err: | ||
1420 | snd_soc_free_pcms(socdev); | ||
1421 | snd_soc_dapm_free(socdev); | ||
1422 | pcm_err: | 1407 | pcm_err: |
1423 | kfree(codec->reg_cache); | 1408 | kfree(codec->reg_cache); |
1424 | return ret; | 1409 | return ret; |