]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branches 'asoc/topic/wm9090', 'asoc/topic/wm9712' and 'asoc...
authorMark Brown <broonie@kernel.org>
Mon, 8 Dec 2014 13:12:36 +0000 (13:12 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 8 Dec 2014 13:12:36 +0000 (13:12 +0000)
1  2  3  4 
sound/soc/codecs/wm9712.c
sound/soc/codecs/wm9713.c

index 52a211be5b470f00bb2113fe502da79e3fb2a8bd,c5eb746087b4103394420fbdf42fff6602399297,30f4b1773070bf0b87d9032d16fb325797be2fdd,c5eb746087b4103394420fbdf42fff6602399297..7c45971bb4ecb0f4e77b37079e032d5f26ac0d57
        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;
    
    
    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;
        }
    
        /* 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:
index 6c95d98b0eb1e9cf09421c52a23e3e0630192123,bddee30a4bc7c7091039afbb17c4dab5e3d05f8c,bddee30a4bc7c7091039afbb17c4dab5e3d05f8c,e977b13bacfa567e77e31b5ae9dac2703d158333..5df7f6d12bef48219b899b04345488408c75d11c
@@@@@ -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);
        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));
    }