ASoC: Add indirection for CODEC private data
[deliverable/linux.git] / sound / soc / codecs / ak4104.c
index 3a14c6fc4f5ee45ece90bbf092bf4ba9e30cfc09..962d74682122bd2f2a4e800a84d03505890156d2 100644 (file)
@@ -90,12 +90,10 @@ static int ak4104_spi_write(struct snd_soc_codec *codec, unsigned int reg,
        if (reg >= codec->reg_cache_size)
                return -EINVAL;
 
-       reg &= AK4104_REG_MASK;
-       reg |= AK4104_WRITE;
-
        /* only write to the hardware if value has changed */
        if (cache[reg] != value) {
-               u8 tmp[2] = { reg, value };
+               u8 tmp[2] = { (reg & AK4104_REG_MASK) | AK4104_WRITE, value };
+
                if (spi_write(spi, tmp, sizeof(tmp))) {
                        dev_err(&spi->dev, "SPI write failed\n");
                        return -EIO;
@@ -185,9 +183,7 @@ struct snd_soc_dai ak4104_dai = {
                .stream_name = "Playback",
                .channels_min = 2,
                .channels_max = 2,
-               .rates = SNDRV_PCM_RATE_44100 |
-                        SNDRV_PCM_RATE_48000 |
-                        SNDRV_PCM_RATE_32000,
+               .rates = SNDRV_PCM_RATE_8000_192000,
                .formats = SNDRV_PCM_FMTBIT_S16_LE  |
                           SNDRV_PCM_FMTBIT_S24_3LE |
                           SNDRV_PCM_FMTBIT_S24_LE
@@ -225,7 +221,7 @@ static int ak4104_spi_probe(struct spi_device *spi)
        codec->owner = THIS_MODULE;
        codec->dai = &ak4104_dai;
        codec->num_dai = 1;
-       codec->private_data = ak4104;
+       snd_soc_codec_set_drvdata(codec, ak4104);
        codec->control_data = spi;
        codec->reg_cache = ak4104->reg_cache;
        codec->reg_cache_size = AK4104_NUM_REGS;
This page took 0.02707 seconds and 5 git commands to generate.