]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - sound/soc/soc-core.c
Merge remote-tracking branch 'asoc/topic/core' into asoc-next
[karo-tx-linux.git] / sound / soc / soc-core.c
index 2370063b58245946f71adfa05f361097d3e53374..7365afbc5e18a04bec17d11ec85391aae01eafd4 100644 (file)
@@ -1107,6 +1107,10 @@ static int soc_probe_codec(struct snd_soc_card *card,
                                "ASoC: failed to probe CODEC %d\n", ret);
                        goto err_probe;
                }
+               WARN(codec->dapm.idle_bias_off &&
+                       codec->dapm.bias_level != SND_SOC_BIAS_OFF,
+                       "codec %s can not start from non-off bias"
+                       " with idle_bias_off==1\n", codec->name);
        }
 
        /* If the driver didn't set I/O up try regmap */
@@ -3122,9 +3126,12 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
        if (!codec->using_regmap)
                return -EINVAL;
 
-       data = ucontrol->value.bytes.data;
        len = params->num_regs * codec->val_bytes;
 
+       data = kmemdup(ucontrol->value.bytes.data, len, GFP_KERNEL | GFP_DMA);
+       if (!data)
+               return -ENOMEM;
+
        /*
         * If we've got a mask then we need to preserve the register
         * bits.  We shouldn't modify the incoming data so take a
@@ -3137,10 +3144,6 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
 
                val &= params->mask;
 
-               data = kmemdup(data, len, GFP_KERNEL);
-               if (!data)
-                       return -ENOMEM;
-
                switch (codec->val_bytes) {
                case 1:
                        ((u8 *)data)[0] &= ~params->mask;
@@ -3162,8 +3165,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
        ret = regmap_raw_write(codec->control_data, params->base,
                               data, len);
 
-       if (params->mask)
-               kfree(data);
+       kfree(data);
 
        return ret;
 }
@@ -3540,12 +3542,20 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_tristate);
  * snd_soc_dai_digital_mute - configure DAI system or master clock.
  * @dai: DAI
  * @mute: mute enable
+ * @direction: stream to mute
  *
  * Mutes the DAI DAC.
  */
-int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute)
+int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
+                            int direction)
 {
-       if (dai->driver && dai->driver->ops->digital_mute)
+       if (!dai->driver)
+               return -ENOTSUPP;
+
+       if (dai->driver->ops->mute_stream)
+               return dai->driver->ops->mute_stream(dai, mute, direction);
+       else if (direction == SNDRV_PCM_STREAM_PLAYBACK &&
+                dai->driver->ops->digital_mute)
                return dai->driver->ops->digital_mute(dai, mute);
        else
                return -ENOTSUPP;