Skip to content

Commit

Permalink
Merge remote-tracking branch 'asoc/fix/core' into asoc-linus
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Brown committed Dec 3, 2013
2 parents dc1ccc4 + ebff654 commit 1c4b578
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3212,11 +3212,11 @@ int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,
break;
case 2:
((u16 *)(&ucontrol->value.bytes.data))[0]
&= ~params->mask;
&= cpu_to_be16(~params->mask);
break;
case 4:
((u32 *)(&ucontrol->value.bytes.data))[0]
&= ~params->mask;
&= cpu_to_be32(~params->mask);
break;
default:
return -EINVAL;
Expand Down
4 changes: 2 additions & 2 deletions sound/soc/soc-devres.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static void devm_card_release(struct device *dev, void *res)
*/
int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card)
{
struct device **ptr;
struct snd_soc_card **ptr;
int ret;

ptr = devres_alloc(devm_card_release, sizeof(*ptr), GFP_KERNEL);
Expand All @@ -75,7 +75,7 @@ int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card)

ret = snd_soc_register_card(card);
if (ret == 0) {
*ptr = dev;
*ptr = card;
devres_add(dev, ptr);
} else {
devres_free(ptr);
Expand Down
18 changes: 12 additions & 6 deletions sound/soc/soc-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream,
}
}

static void soc_pcm_init_runtime_hw(struct snd_pcm_hardware *hw,
static void soc_pcm_init_runtime_hw(struct snd_pcm_runtime *runtime,
struct snd_soc_pcm_stream *codec_stream,
struct snd_soc_pcm_stream *cpu_stream)
{
hw->rate_min = max(codec_stream->rate_min, cpu_stream->rate_min);
hw->rate_max = max(codec_stream->rate_max, cpu_stream->rate_max);
struct snd_pcm_hardware *hw = &runtime->hw;

hw->channels_min = max(codec_stream->channels_min,
cpu_stream->channels_min);
hw->channels_max = min(codec_stream->channels_max,
Expand All @@ -166,6 +166,13 @@ static void soc_pcm_init_runtime_hw(struct snd_pcm_hardware *hw,
if (cpu_stream->rates
& (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))
hw->rates |= codec_stream->rates;

snd_pcm_limit_hw_rates(runtime);

hw->rate_min = max(hw->rate_min, cpu_stream->rate_min);
hw->rate_min = max(hw->rate_min, codec_stream->rate_min);
hw->rate_max = min_not_zero(hw->rate_max, cpu_stream->rate_max);
hw->rate_max = min_not_zero(hw->rate_max, codec_stream->rate_max);
}

/*
Expand Down Expand Up @@ -235,15 +242,14 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)

/* Check that the codec and cpu DAIs are compatible */
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
soc_pcm_init_runtime_hw(&runtime->hw, &codec_dai_drv->playback,
soc_pcm_init_runtime_hw(runtime, &codec_dai_drv->playback,
&cpu_dai_drv->playback);
} else {
soc_pcm_init_runtime_hw(&runtime->hw, &codec_dai_drv->capture,
soc_pcm_init_runtime_hw(runtime, &codec_dai_drv->capture,
&cpu_dai_drv->capture);
}

ret = -EINVAL;
snd_pcm_limit_hw_rates(runtime);
if (!runtime->hw.rates) {
printk(KERN_ERR "ASoC: %s <-> %s No matching rates\n",
codec_dai->name, cpu_dai->name);
Expand Down

0 comments on commit 1c4b578

Please sign in to comment.