From ff541f4b2a7546ffa8edf123f4b3b49bb24574e2 Mon Sep 17 00:00:00 2001 From: Chuansheng Liu Date: Fri, 21 Dec 2012 18:17:12 +0800 Subject: ASoC: core: giving WARN when device starting from non-off bias with idle_bias_off Just found some cases that some codec drivers set the bias to _STANDBY and set idle_bias_off to 1 during probing. It will cause unpaired runtime_get_sync/put() issue. Also as Mark suggested, there is no reason to start from _STANDBY bias with idle_bias_off == 1. So here giving one warning when detected (dapm.idle_bias_off == 1) and (dapm.bias_level != SND_SOC_BIAS_OFF) just after driver->probe(). Signed-off-by: liu chuansheng Signed-off-by: Mark Brown diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 91d592f..e0e8ce0 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -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 */ -- cgit v0.10.2 From fffc0ca29fdf3a786e74082c698c701d6ebdf720 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 10 Jan 2013 11:59:57 +0300 Subject: ASoC: pcm: delete some dead code I've removed several unreachable returns. Signed-off-by: Dan Carpenter Signed-off-by: Mark Brown diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index d7711fc..6006b37 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1728,20 +1728,16 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) /* startup must always be called for new BEs */ ret = dpcm_be_dai_startup(fe, stream); - if (ret < 0) { + if (ret < 0) goto disconnect; - return ret; - } /* keep going if FE state is > open */ if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_OPEN) return 0; ret = dpcm_be_dai_hw_params(fe, stream); - if (ret < 0) { + if (ret < 0) goto close; - return ret; - } /* keep going if FE state is > hw_params */ if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS) @@ -1749,10 +1745,8 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) ret = dpcm_be_dai_prepare(fe, stream); - if (ret < 0) { + if (ret < 0) goto hw_free; - return ret; - } /* run the stream event for each BE */ dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); -- cgit v0.10.2 From 13aec722f3c14aa6019c800465aa3ddd3638d305 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Thu, 10 Jan 2013 17:06:15 +0100 Subject: ASoC: Constify ops and compr_ops fields of snd_soc_dai_link The core does not modify these fields, so they can be made const. This allows drivers to declare their op tables as const. Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown diff --git a/include/sound/soc.h b/include/sound/soc.h index 769e27c..bedf3da 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -904,8 +904,8 @@ struct snd_soc_dai_link { struct snd_pcm_hw_params *params); /* machine stream operations */ - struct snd_soc_ops *ops; - struct snd_soc_compr_ops *compr_ops; + const struct snd_soc_ops *ops; + const struct snd_soc_compr_ops *compr_ops; }; struct snd_soc_codec_conf { -- cgit v0.10.2 From 5d163336a77af9c1b4d6d08cbc8b1279df5f579e Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 15 Jan 2013 20:18:23 -0800 Subject: ASoC: SND_SOC_DAIFMT_NB_NF become 0 as default settings Current soc-dai.h defines SND_SOC_DAIFMT_NB_NF as (1 << 8), but normal bit clock / normal frame should be default settings (= 0). This patch fixup SND_SOC_DAIFMT_NB_NF as (0 << 8). Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 3953cea..90dc004 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -53,7 +53,7 @@ struct snd_compr_stream; * Specifies whether the DAI can also support inverted clocks for the specified * format. */ -#define SND_SOC_DAIFMT_NB_NF (1 << 8) /* normal bit clock + frame */ +#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */ #define SND_SOC_DAIFMT_NB_IF (2 << 8) /* normal BCLK + inv FRM */ #define SND_SOC_DAIFMT_IB_NF (3 << 8) /* invert BCLK + nor FRM */ #define SND_SOC_DAIFMT_IB_IF (4 << 8) /* invert BCLK + FRM */ -- cgit v0.10.2 From b5a8fe439ab343631d905a51438db3de54ba94df Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 20 Jan 2013 21:42:22 +0900 Subject: ASoC: core: Ensure SND_SOC_BYTES writes are from DMA safe memory With some buses the transfers may DMAed, especially for larger blocks. Signed-off-by: Mark Brown diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e0e8ce0..02d826e 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3097,9 +3097,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 @@ -3112,10 +3115,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; @@ -3137,8 +3136,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; } -- cgit v0.10.2