ASoC: make ops a pointer in 'struct snd_soc_dai'
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / sound / soc / codecs / wm8971.c
index c8bd9b06f330f02dd645dc2f17944824117bff8e..032dca22dbd3dce34746a3e3bc65717c051c7501 100644 (file)
@@ -531,7 +531,7 @@ static int wm8971_pcm_hw_params(struct snd_pcm_substream *substream,
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
-       struct snd_soc_codec *codec = socdev->codec;
+       struct snd_soc_codec *codec = socdev->card->codec;
        struct wm8971_priv *wm8971 = codec->private_data;
        u16 iface = wm8971_read_reg_cache(codec, WM8971_IFACE) & 0x1f3;
        u16 srate = wm8971_read_reg_cache(codec, WM8971_SRATE) & 0x1c0;
@@ -604,6 +604,13 @@ static int wm8971_set_bias_level(struct snd_soc_codec *codec,
 #define WM8971_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
        SNDRV_PCM_FMTBIT_S24_LE)
 
+static struct snd_soc_dai_ops wm8971_dai_ops = {
+       .hw_params      = wm8971_pcm_hw_params,
+       .digital_mute   = wm8971_mute,
+       .set_fmt        = wm8971_set_dai_fmt,
+       .set_sysclk     = wm8971_set_dai_sysclk,
+};
+
 struct snd_soc_dai wm8971_dai = {
        .name = "WM8971",
        .playback = {
@@ -618,12 +625,7 @@ struct snd_soc_dai wm8971_dai = {
                .channels_max = 2,
                .rates = WM8971_RATES,
                .formats = WM8971_FORMATS,},
-       .ops = {
-               .hw_params = wm8971_pcm_hw_params,
-               .digital_mute = wm8971_mute,
-               .set_fmt = wm8971_set_dai_fmt,
-               .set_sysclk = wm8971_set_dai_sysclk,
-       },
+       .ops = &wm8971_dai_ops,
 };
 EXPORT_SYMBOL_GPL(wm8971_dai);
 
@@ -637,7 +639,7 @@ static void wm8971_work(struct work_struct *work)
 static int wm8971_suspend(struct platform_device *pdev, pm_message_t state)
 {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
-       struct snd_soc_codec *codec = socdev->codec;
+       struct snd_soc_codec *codec = socdev->card->codec;
 
        wm8971_set_bias_level(codec, SND_SOC_BIAS_OFF);
        return 0;
@@ -646,7 +648,7 @@ static int wm8971_suspend(struct platform_device *pdev, pm_message_t state)
 static int wm8971_resume(struct platform_device *pdev)
 {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
-       struct snd_soc_codec *codec = socdev->codec;
+       struct snd_soc_codec *codec = socdev->card->codec;
        int i;
        u8 data[2];
        u16 *cache = codec->reg_cache;
@@ -677,7 +679,7 @@ static int wm8971_resume(struct platform_device *pdev)
 
 static int wm8971_init(struct snd_soc_device *socdev)
 {
-       struct snd_soc_codec *codec = socdev->codec;
+       struct snd_soc_codec *codec = socdev->card->codec;
        int reg, ret = 0;
 
        codec->name = "WM8971";
@@ -758,7 +760,7 @@ static int wm8971_i2c_probe(struct i2c_client *i2c,
                            const struct i2c_device_id *id)
 {
        struct snd_soc_device *socdev = wm8971_socdev;
-       struct snd_soc_codec *codec = socdev->codec;
+       struct snd_soc_codec *codec = socdev->card->codec;
        int ret;
 
        i2c_set_clientdata(i2c, codec);
@@ -859,7 +861,7 @@ static int wm8971_probe(struct platform_device *pdev)
        }
 
        codec->private_data = wm8971;
-       socdev->codec = codec;
+       socdev->card->codec = codec;
        mutex_init(&codec->mutex);
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
@@ -894,7 +896,7 @@ static int wm8971_probe(struct platform_device *pdev)
 static int wm8971_remove(struct platform_device *pdev)
 {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
-       struct snd_soc_codec *codec = socdev->codec;
+       struct snd_soc_codec *codec = socdev->card->codec;
 
        if (codec->control_data)
                wm8971_set_bias_level(codec, SND_SOC_BIAS_OFF);