Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 305657
b: refs/heads/master
c: 8b3f39d
h: refs/heads/master
i:
  305655: 207e643
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Apr 25, 2012
1 parent 68c5753 commit d347b8c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 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: d9ca8e76f3cdbd86032808aa1af237b8a3d99eac
refs/heads/master: 8b3f39dab5e126fe5215871fe6fc4ae358ca7680
38 changes: 34 additions & 4 deletions trunk/sound/soc/codecs/ssm2602.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ enum ssm2602_type {
/* codec private data */
struct ssm2602_priv {
unsigned int sysclk;
struct snd_pcm_hw_constraint_list *sysclk_constraints;
enum snd_soc_control_type control_type;
struct snd_pcm_substream *master_substream;
struct snd_pcm_substream *slave_substream;
Expand Down Expand Up @@ -195,6 +196,24 @@ static const struct snd_soc_dapm_route ssm2604_routes[] = {
{"ADC", NULL, "Line Input"},
};

static const unsigned int ssm2602_rates_12288000[] = {
8000, 32000, 48000, 96000,
};

static struct snd_pcm_hw_constraint_list ssm2602_constraints_12288000 = {
.list = ssm2602_rates_12288000,
.count = ARRAY_SIZE(ssm2602_rates_12288000),
};

static const unsigned int ssm2602_rates_11289600[] = {
8000, 44100, 88200,
};

static struct snd_pcm_hw_constraint_list ssm2602_constraints_11289600 = {
.list = ssm2602_rates_11289600,
.count = ARRAY_SIZE(ssm2602_rates_11289600),
};

struct ssm2602_coeff {
u32 mclk;
u32 rate;
Expand Down Expand Up @@ -320,6 +339,12 @@ static int ssm2602_startup(struct snd_pcm_substream *substream,
} else
ssm2602->master_substream = substream;

if (ssm2602->sysclk_constraints) {
snd_pcm_hw_constraint_list(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_RATE,
ssm2602->sysclk_constraints);
}

return 0;
}

Expand Down Expand Up @@ -361,16 +386,21 @@ static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai,
return -EINVAL;

switch (freq) {
case 11289600:
case 12000000:
case 12288000:
case 16934400:
case 18432000:
ssm2602->sysclk = freq;
ssm2602->sysclk_constraints = &ssm2602_constraints_12288000;
break;
case 11289600:
case 16934400:
ssm2602->sysclk_constraints = &ssm2602_constraints_11289600;
break;
case 12000000:
ssm2602->sysclk_constraints = NULL;
break;
default:
return -EINVAL;
}
ssm2602->sysclk = freq;
} else {
unsigned int mask;

Expand Down

0 comments on commit d347b8c

Please sign in to comment.