Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193328
b: refs/heads/master
c: 9c9b125
h: refs/heads/master
v: v3
  • Loading branch information
Jassi Brar authored and Mark Brown committed Mar 10, 2010
1 parent f0afaa0 commit 345a02d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 16 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: bf3288260288160e22f85bbf00b281523c14b587
refs/heads/master: 9c9b125736db934b98aa7e16b675767ed4fcf5ce
18 changes: 3 additions & 15 deletions trunk/sound/soc/s3c24xx/s3c-i2s-v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
return 0;
}

static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
static int s3c_i2sv2_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *socdai)
{
Expand All @@ -346,18 +346,6 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
iismod = readl(i2s->regs + S3C2412_IISMOD);
pr_debug("%s: r: IISMOD: %x\n", __func__, iismod);

#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S8:
iismod |= S3C2412_IISMOD_8BIT;
break;
case SNDRV_PCM_FORMAT_S16_LE:
iismod &= ~S3C2412_IISMOD_8BIT;
break;
}
#endif

#ifdef CONFIG_PLAT_S3C64XX
iismod &= ~S3C64XX_IISMOD_BLC_MASK;
/* Sample size */
switch (params_format(params)) {
Expand All @@ -370,7 +358,6 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
iismod |= S3C64XX_IISMOD_BLC_24BIT;
break;
}
#endif

writel(iismod, i2s->regs + S3C2412_IISMOD);
pr_debug("%s: w: IISMOD: %x\n", __func__, iismod);
Expand Down Expand Up @@ -730,7 +717,8 @@ int s3c_i2sv2_register_dai(struct snd_soc_dai *dai)
struct snd_soc_dai_ops *ops = dai->ops;

ops->trigger = s3c2412_i2s_trigger;
ops->hw_params = s3c2412_i2s_hw_params;
if (!ops->hw_params)
ops->hw_params = s3c_i2sv2_hw_params;
ops->set_fmt = s3c2412_i2s_set_fmt;
ops->set_clkdiv = s3c2412_i2s_set_clkdiv;

Expand Down
37 changes: 37 additions & 0 deletions trunk/sound/soc/s3c24xx/s3c2412-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ struct clk *s3c2412_get_iisclk(void)
}
EXPORT_SYMBOL_GPL(s3c2412_get_iisclk);

static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai)
{
return cpu_dai->private_data;
}

static int s3c2412_i2s_probe(struct platform_device *pdev,
struct snd_soc_dai *dai)
Expand Down Expand Up @@ -142,13 +146,46 @@ static int s3c2412_i2s_probe(struct platform_device *pdev,
return 0;
}

static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *cpu_dai)
{
struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
u32 iismod;

pr_debug("Entered %s\n", __func__);

if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
cpu_dai->dma_data = i2s->dma_playback;
else
cpu_dai->dma_data = i2s->dma_capture;

iismod = readl(i2s->regs + S3C2412_IISMOD);
pr_debug("%s: r: IISMOD: %x\n", __func__, iismod);

switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S8:
iismod |= S3C2412_IISMOD_8BIT;
break;
case SNDRV_PCM_FORMAT_S16_LE:
iismod &= ~S3C2412_IISMOD_8BIT;
break;
}

writel(iismod, i2s->regs + S3C2412_IISMOD);
pr_debug("%s: w: IISMOD: %x\n", __func__, iismod);

return 0;
}

#define S3C2412_I2S_RATES \
(SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)

static struct snd_soc_dai_ops s3c2412_i2s_dai_ops = {
.set_sysclk = s3c2412_i2s_set_sysclk,
.hw_params = s3c2412_i2s_hw_params,
};

struct snd_soc_dai s3c2412_i2s_dai = {
Expand Down

0 comments on commit 345a02d

Please sign in to comment.