Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182785
b: refs/heads/master
c: 0fe6922
h: refs/heads/master
i:
  182783: 67f1d11
v: v3
  • Loading branch information
Jassi Brar authored and Mark Brown committed Dec 16, 2009
1 parent 191a4f3 commit beaa1bd
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 74 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: 168db50d967e09133feda8247d4dcb3c73437766
refs/heads/master: 0fe692292a26f57b6522fe859cc8b2549ec0cd97
114 changes: 41 additions & 73 deletions trunk/sound/soc/s3c24xx/s3c64xx-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
#include "s3c-dma.h"
#include "s3c64xx-i2s.h"

/* The value should be set to maximum of the total number
* of I2Sv3 controllers that any supported SoC has.
*/
#define MAX_I2SV3 2

static struct s3c2410_dma_client s3c64xx_dma_client_out = {
.name = "I2S PCM Stereo out"
};
Expand All @@ -40,37 +45,12 @@ static struct s3c2410_dma_client s3c64xx_dma_client_in = {
.name = "I2S PCM Stereo in"
};

static struct s3c_dma_params s3c64xx_i2s_pcm_stereo_out[2] = {
[0] = {
.channel = DMACH_I2S0_OUT,
.client = &s3c64xx_dma_client_out,
.dma_addr = S3C64XX_PA_IIS0 + S3C2412_IISTXD,
.dma_size = 4,
},
[1] = {
.channel = DMACH_I2S1_OUT,
.client = &s3c64xx_dma_client_out,
.dma_addr = S3C64XX_PA_IIS1 + S3C2412_IISTXD,
.dma_size = 4,
},
};

static struct s3c_dma_params s3c64xx_i2s_pcm_stereo_in[2] = {
[0] = {
.channel = DMACH_I2S0_IN,
.client = &s3c64xx_dma_client_in,
.dma_addr = S3C64XX_PA_IIS0 + S3C2412_IISRXD,
.dma_size = 4,
},
[1] = {
.channel = DMACH_I2S1_IN,
.client = &s3c64xx_dma_client_in,
.dma_addr = S3C64XX_PA_IIS1 + S3C2412_IISRXD,
.dma_size = 4,
},
};
static struct s3c_dma_params s3c64xx_i2s_pcm_stereo_out[MAX_I2SV3];
static struct s3c_dma_params s3c64xx_i2s_pcm_stereo_in[MAX_I2SV3];
static struct s3c_i2sv2_info s3c64xx_i2s[MAX_I2SV3];

static struct s3c_i2sv2_info s3c64xx_i2s[2];
struct snd_soc_dai s3c64xx_i2s_dai[MAX_I2SV3];
EXPORT_SYMBOL_GPL(s3c64xx_i2s_dai);

static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai)
{
Expand Down Expand Up @@ -163,66 +143,54 @@ static struct snd_soc_dai_ops s3c64xx_i2s_dai_ops = {
.set_sysclk = s3c64xx_i2s_set_sysclk,
};

struct snd_soc_dai s3c64xx_i2s_dai[] = {
{
.name = "s3c64xx-i2s",
.id = 0,
.probe = s3c64xx_i2s_probe,
.playback = {
.channels_min = 2,
.channels_max = 2,
.rates = S3C64XX_I2S_RATES,
.formats = S3C64XX_I2S_FMTS,
},
.capture = {
.channels_min = 2,
.channels_max = 2,
.rates = S3C64XX_I2S_RATES,
.formats = S3C64XX_I2S_FMTS,
},
.ops = &s3c64xx_i2s_dai_ops,
.symmetric_rates = 1,
},
{
.name = "s3c64xx-i2s",
.id = 1,
.probe = s3c64xx_i2s_probe,
.playback = {
.channels_min = 2,
.channels_max = 2,
.rates = S3C64XX_I2S_RATES,
.formats = S3C64XX_I2S_FMTS,
},
.capture = {
.channels_min = 2,
.channels_max = 2,
.rates = S3C64XX_I2S_RATES,
.formats = S3C64XX_I2S_FMTS,
},
.ops = &s3c64xx_i2s_dai_ops,
.symmetric_rates = 1,
},
};
EXPORT_SYMBOL_GPL(s3c64xx_i2s_dai);

static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev)
{
struct s3c_i2sv2_info *i2s;
struct snd_soc_dai *dai;
int ret;

if (pdev->id >= ARRAY_SIZE(s3c64xx_i2s)) {
if (pdev->id >= MAX_I2SV3) {
dev_err(&pdev->dev, "id %d out of range\n", pdev->id);
return -EINVAL;
}

i2s = &s3c64xx_i2s[pdev->id];
dai = &s3c64xx_i2s_dai[pdev->id];
dai->dev = &pdev->dev;
dai->name = "s3c64xx-i2s";
dai->id = pdev->id;
dai->symmetric_rates = 1;
dai->playback.channels_min = 2;
dai->playback.channels_max = 2;
dai->playback.rates = S3C64XX_I2S_RATES;
dai->playback.formats = S3C64XX_I2S_FMTS;
dai->capture.channels_min = 2;
dai->capture.channels_max = 2;
dai->capture.rates = S3C64XX_I2S_RATES;
dai->capture.formats = S3C64XX_I2S_FMTS;
dai->probe = s3c64xx_i2s_probe;
dai->ops = &s3c64xx_i2s_dai_ops;

i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id];
i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id];

if (pdev->id == 0) {
i2s->dma_capture->channel = DMACH_I2S0_IN;
i2s->dma_capture->dma_addr = S3C64XX_PA_IIS0 + S3C2412_IISRXD;
i2s->dma_playback->channel = DMACH_I2S0_OUT;
i2s->dma_playback->dma_addr = S3C64XX_PA_IIS0 + S3C2412_IISTXD;
} else {
i2s->dma_capture->channel = DMACH_I2S1_IN;
i2s->dma_capture->dma_addr = S3C64XX_PA_IIS1 + S3C2412_IISRXD;
i2s->dma_playback->channel = DMACH_I2S1_OUT;
i2s->dma_playback->dma_addr = S3C64XX_PA_IIS1 + S3C2412_IISTXD;
}

i2s->dma_capture->client = &s3c64xx_dma_client_in;
i2s->dma_capture->dma_size = 4;
i2s->dma_playback->client = &s3c64xx_dma_client_out;
i2s->dma_playback->dma_size = 4;

i2s->iis_cclk = clk_get(&pdev->dev, "audio-bus");
if (IS_ERR(i2s->iis_cclk)) {
dev_err(&pdev->dev, "failed to get audio-bus\n");
Expand Down

0 comments on commit beaa1bd

Please sign in to comment.