Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230410
b: refs/heads/master
c: 4e624d0
h: refs/heads/master
v: v3
  • Loading branch information
Olaya, Margarita authored and Liam Girdwood committed Dec 14, 2010
1 parent 18300a1 commit 5a13fc9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6c311041c1d3d0b9d1fc6ddacd49e50d83ba158a
refs/heads/master: 4e624d0609081e4394695fba3d7c3b7ebb6171ce
55 changes: 22 additions & 33 deletions trunk/sound/soc/codecs/twl6040.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,23 +865,6 @@ static int twl6040_startup(struct snd_pcm_substream *substream,
struct snd_soc_codec *codec = rtd->codec;
struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);

if (!priv->sysclk) {
dev_err(codec->dev,
"no mclk configured, call set_sysclk() on init\n");
return -EINVAL;
}

/*
* capture is not supported at 17.64 MHz,
* it's reserved for headset low-power playback scenario
*/
if ((priv->sysclk == 17640000) && substream->stream) {
dev_err(codec->dev,
"capture mode is not supported at %dHz\n",
priv->sysclk);
return -EINVAL;
}

snd_pcm_hw_constraint_list(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_RATE,
priv->sysclk_constraints);
Expand Down Expand Up @@ -925,31 +908,37 @@ static int twl6040_hw_params(struct snd_pcm_substream *substream,
return 0;
}

static int twl6040_trigger(struct snd_pcm_substream *substream,
int cmd, struct snd_soc_dai *dai)
static int twl6040_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_codec *codec = rtd->codec;
struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);

switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
/*
* low-power playback mode is restricted
* for headset path only
*/
if ((priv->sysclk == 17640000) && priv->non_lp) {
if (!priv->sysclk) {
dev_err(codec->dev,
"no mclk configured, call set_sysclk() on init\n");
return -EINVAL;
}

/*
* capture is not supported at 17.64 MHz,
* it's reserved for headset low-power playback scenario
*/
if ((priv->sysclk == 17640000) &&
substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
dev_err(codec->dev,
"capture mode is not supported at %dHz\n",
priv->sysclk);
return -EINVAL;
}

if ((priv->sysclk == 17640000) && priv->non_lp) {
dev_err(codec->dev,
"some enabled paths aren't supported at %dHz\n",
priv->sysclk);
return -EPERM;
}
break;
default:
break;
}

return 0;
}

Expand Down Expand Up @@ -1063,7 +1052,7 @@ static int twl6040_set_dai_sysclk(struct snd_soc_dai *codec_dai,
static struct snd_soc_dai_ops twl6040_dai_ops = {
.startup = twl6040_startup,
.hw_params = twl6040_hw_params,
.trigger = twl6040_trigger,
.prepare = twl6040_prepare,
.set_sysclk = twl6040_set_dai_sysclk,
};

Expand Down

0 comments on commit 5a13fc9

Please sign in to comment.