From: Mark Brown Date: Mon, 8 Dec 2014 13:12:36 +0000 (+0000) Subject: Merge remote-tracking branches 'asoc/topic/wm9090', 'asoc/topic/wm9712' and 'asoc... X-Git-Tag: v3.19-rc1~11^2~38^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1810afd3e1ded09c53d4e966dddce3c7d484521f;p=platform%2Fkernel%2Flinux-exynos.git Merge remote-tracking branches 'asoc/topic/wm9090', 'asoc/topic/wm9712' and 'asoc/topic/wm9713' into asoc-next --- 1810afd3e1ded09c53d4e966dddce3c7d484521f diff --cc sound/soc/codecs/wm9712.c index 52a211b,c5eb746,30f4b17,c5eb746..7c45971 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c @@@@@ -636,15 -599,14 -599,8 -599,14 +636,9 @@@@@ err return -EIO; } -- -static int wm9712_soc_suspend(struct snd_soc_codec *codec) -- -{ -- - wm9712_set_bias_level(codec, SND_SOC_BIAS_OFF); -- - return 0; -- -} -- - static int wm9712_soc_resume(struct snd_soc_codec *codec) { +++ struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); int i, ret; u16 *cache = codec->reg_cache; @@@@@ -669,13 -633,11 -625,11 -633,11 +663,13 @@@@@ static int wm9712_soc_probe(struct snd_soc_codec *codec) { +++ struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); int ret = 0; --- ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); --- if (ret < 0) { - - printk(KERN_ERR "wm9712: failed to register AC97 codec\n"); - dev_err(codec->dev, "Failed to register AC97 codec\n"); +++ wm9712->ac97 = snd_soc_new_ac97_codec(codec); +++ if (IS_ERR(wm9712->ac97)) { +++ ret = PTR_ERR(wm9712->ac97); +++ dev_err(codec->dev, "Failed to register AC97 codec: %d\n", ret); return ret; } @@@@@ -686,8 -650,10 -640,6 -650,10 +680,6 @@@@@ /* set alc mux to none */ ac97_write(codec, AC97_VIDEO, ac97_read(codec, AC97_VIDEO) | 0x3000); -- - wm9712_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - - snd_soc_add_codec_controls(codec, wm9712_snd_ac97_controls, - - ARRAY_SIZE(wm9712_snd_ac97_controls)); -- - return 0; reset_err: diff --cc sound/soc/codecs/wm9713.c index 6c95d98,bddee30,bddee30,e977b13..5df7f6d --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c @@@@@ -62,10 -59,13 -59,13 -59,12 +62,10 @@@@@ static const u16 wm9713_reg[] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0006, 0x0001, 0x0000, 0x574d, 0x4c13, -- 0x0000, 0x0000, 0x0000 - 0x0000, 0x0000 }; ---/* virtual HP mixers regs */ ---#define HPL_MIXER 0x80 ---#define HPR_MIXER 0x82 -- #define MICB_MUX 0x82 +++#define HPL_MIXER 0 +++#define HPR_MIXER 1 static const char *wm9713_mic_mixer[] = {"Stereo", "Mic 1", "Mic 2", "Mute"}; static const char *wm9713_rec_mux[] = {"Stereo", "Left", "Right", "Mute"}; @@@@@ -1133,14 -1101,11 -1101,11 -1101,14 +1133,14 @@@@@ int wm9713_reset(struct snd_soc_codec * return 1; } --- soc_ac97_ops->reset(codec->ac97); +++ soc_ac97_ops->reset(wm9713->ac97); if (soc_ac97_ops->warm_reset) --- soc_ac97_ops->warm_reset(codec->ac97); -- if (ac97_read(codec, 0) != wm9713_reg[0]) +++ soc_ac97_ops->warm_reset(wm9713->ac97); ++ if (ac97_read(codec, 0) != wm9713_reg[0]) { ++ dev_err(codec->dev, "Failed to reset: AC97 link error\n"); return -EIO; ++ } ++ return 0; } EXPORT_SYMBOL_GPL(wm9713_reset); @@@@@ -1222,22 -1189,29 -1189,29 -1190,19 +1222,20 @@@@@ static int wm9713_soc_resume(struct snd static int wm9713_soc_probe(struct snd_soc_codec *codec) { -- struct wm9713_priv *wm9713; +++ struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); int ret = 0, reg; -- wm9713 = kzalloc(sizeof(struct wm9713_priv), GFP_KERNEL); -- if (wm9713 == NULL) -- return -ENOMEM; -- snd_soc_codec_set_drvdata(codec, wm9713); -- --- ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); --- if (ret < 0) -- goto codec_err; - return ret; +++ wm9713->ac97 = snd_soc_new_ac97_codec(codec); +++ if (IS_ERR(wm9713->ac97)) +++ return PTR_ERR(wm9713->ac97); /* do a cold reset for the controller and then try * a warm reset followed by an optional cold reset for codec */ wm9713_reset(codec, 0); ret = wm9713_reset(codec, 1); -- if (ret < 0) { -- printk(KERN_ERR "Failed to reset WM9713: AC97 link error\n"); ++ if (ret < 0) goto reset_err; -- } -- -- wm9713_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - wm9713_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - /* unmute the adc - move to kcontrol */ reg = ac97_read(codec, AC97_CD) & 0x7fff; ac97_write(codec, AC97_CD, reg); @@@@@ -1245,15 -1219,20 -1219,20 -1210,13 +1243,15 @@@@@ return 0; reset_err: --- snd_soc_free_ac97_codec(codec); -- codec_err: -- kfree(wm9713); +++ snd_soc_free_ac97_codec(wm9713->ac97); return ret; } static int wm9713_soc_remove(struct snd_soc_codec *codec) { - snd_soc_free_ac97_codec(codec); + struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); -- snd_soc_free_ac97_codec(codec); -- kfree(wm9713); +++ +++ snd_soc_free_ac97_codec(wm9713->ac97); return 0; } @@@@@ -1280,16 -1256,6 -1256,6 -1243,14 +1278,16 @@@@@ static struct snd_soc_codec_driver soc_ static int wm9713_probe(struct platform_device *pdev) { ++ struct wm9713_priv *wm9713; ++ ++ wm9713 = devm_kzalloc(&pdev->dev, sizeof(*wm9713), GFP_KERNEL); ++ if (wm9713 == NULL) ++ return -ENOMEM; ++ +++ mutex_init(&wm9713->lock); +++ ++ platform_set_drvdata(pdev, wm9713); ++ return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm9713, wm9713_dai, ARRAY_SIZE(wm9713_dai)); }