Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193374
b: refs/heads/master
c: 4b6316b
h: refs/heads/master
v: v3
  • Loading branch information
Kuninori Morimoto authored and Mark Brown committed Mar 23, 2010
1 parent da1286e commit 9764b4c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 8 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: 778a76e2dbdb896d005849e9e74518d6aba85671
refs/heads/master: 4b6316b4b16c7fb5d51df43f0371416e054e7102
40 changes: 33 additions & 7 deletions trunk/sound/soc/codecs/ak4642.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,18 @@

#define AK4642_CACHEREGNUM 0x25

/* MD_CTL1 */
#define PLL3 (1 << 7)
#define PLL2 (1 << 6)
#define PLL1 (1 << 5)
#define PLL0 (1 << 4)
#define PLL_MASK (PLL3 | PLL2 | PLL1 | PLL0)

struct snd_soc_codec_device soc_codec_dev_ak4642;

/* codec private data */
struct ak4642_priv {
struct snd_soc_codec codec;
unsigned int sysclk;
};

static struct snd_soc_codec *ak4642_codec;
Expand Down Expand Up @@ -249,9 +255,32 @@ static int ak4642_dai_set_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{
struct snd_soc_codec *codec = codec_dai->codec;
struct ak4642_priv *ak4642 = codec->private_data;
u8 pll;

switch (freq) {
case 11289600:
pll = PLL2;
break;
case 12288000:
pll = PLL2 | PLL0;
break;
case 12000000:
pll = PLL2 | PLL1;
break;
case 24000000:
pll = PLL2 | PLL1 | PLL0;
break;
case 13500000:
pll = PLL3 | PLL2;
break;
case 27000000:
pll = PLL3 | PLL2 | PLL0;
break;
default:
return -EINVAL;
}
snd_soc_update_bits(codec, MD_CTL1, PLL_MASK, pll);

ak4642->sysclk = freq;
return 0;
}

Expand Down Expand Up @@ -342,7 +371,6 @@ static int ak4642_init(struct ak4642_priv *ak4642)
*
* Audio I/F Format: MSB justified (ADC & DAC)
* BICK frequency at Master Mode: 64fs
* Input Master Clock Select at PLL Mode: 11.2896MHz
* MCKO: Enable
* Sampling Frequency: 44.1kHz
*
Expand All @@ -352,10 +380,8 @@ static int ak4642_init(struct ak4642_priv *ak4642)
* please fix-me
*/
ak4642_write(codec, 0x01, 0x08);
ak4642_write(codec, 0x04, 0x4a);
ak4642_write(codec, 0x05, 0x27);
ak4642_write(codec, 0x00, 0x40);
ak4642_write(codec, 0x01, 0x0b);
ak4642_write(codec, 0x04, 0x0a);

return ret;

Expand Down
10 changes: 10 additions & 0 deletions trunk/sound/soc/sh/fsi-ak4642.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,21 @@
#include <sound/sh_fsi.h>
#include <../sound/soc/codecs/ak4642.h>

static int fsi_ak4642_dai_init(struct snd_soc_codec *codec)
{
int ret;

ret = snd_soc_dai_set_sysclk(&ak4642_dai, 0, 11289600, 0);

return ret;
}

static struct snd_soc_dai_link fsi_dai_link = {
.name = "AK4642",
.stream_name = "AK4642",
.cpu_dai = &fsi_soc_dai[0], /* fsi */
.codec_dai = &ak4642_dai,
.init = fsi_ak4642_dai_init,
.ops = NULL,
};

Expand Down

0 comments on commit 9764b4c

Please sign in to comment.