Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193448
b: refs/heads/master
c: 3057876
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed May 7, 2010
1 parent 95be0f4 commit e4dc0b0
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 137 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: aeb29a82de7c80d4d0253b042f17eb1f725b08f1
refs/heads/master: 305787649826d6c84a6f9f71bc3318460610aba4
3 changes: 0 additions & 3 deletions trunk/arch/arm/mach-s3c2412/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <mach/regs-mem.h>
#include <mach/regs-lcd.h>
#include <mach/regs-sdi.h>
#include <plat/regs-s3c2412-iis.h>
#include <plat/regs-iis.h>
#include <plat/regs-spi.h>

Expand Down Expand Up @@ -119,13 +118,11 @@ static struct s3c24xx_dma_map __initdata s3c2412_dma_mappings[] = {
.name = "i2s-sdi",
.channels = MAP(S3C2412_DMAREQSEL_I2SRX),
.channels_rx = MAP(S3C2412_DMAREQSEL_I2SRX),
.hw_addr.from = S3C2410_PA_IIS + S3C2412_IISRXD,
},
[DMACH_I2S_OUT] = {
.name = "i2s-sdo",
.channels = MAP(S3C2412_DMAREQSEL_I2STX),
.channels_rx = MAP(S3C2412_DMAREQSEL_I2STX),
.hw_addr.to = S3C2410_PA_IIS + S3C2412_IISTXD,
},
[DMACH_USB_EP1] = {
.name = "usb-ep1",
Expand Down
2 changes: 1 addition & 1 deletion trunk/sound/soc/s3c24xx/jive_wm8750.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static int jive_hw_params(struct snd_pcm_substream *substream,
}

s3c_i2sv2_iis_calc_rate(&div, NULL, params_rate(params),
s3c2412_get_iisclk());
s3c_i2sv2_get_clock(cpu_dai));

/* set codec DAI configuration */
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@
#define S3C2412_IISTXD (0x10)
#define S3C2412_IISRXD (0x14)

#define S5PC1XX_IISFICS 0x18
#define S5PC1XX_IISTXDS 0x1C

#define S5PC1XX_IISCON_SW_RST (1 << 31)
#define S5PC1XX_IISCON_FRXOFSTATUS (1 << 26)
#define S5PC1XX_IISCON_FRXORINTEN (1 << 25)
#define S5PC1XX_IISCON_FTXSURSTAT (1 << 24)
#define S5PC1XX_IISCON_FTXSURINTEN (1 << 23)
#define S5PC1XX_IISCON_TXSDMAPAUSE (1 << 20)
#define S5PC1XX_IISCON_TXSDMACTIVE (1 << 18)

#define S3C64XX_IISCON_FTXURSTATUS (1 << 17)
#define S3C64XX_IISCON_FTXURINTEN (1 << 16)
#define S3C64XX_IISCON_TXFIFO2_EMPTY (1 << 15)
#define S3C64XX_IISCON_TXFIFO1_EMPTY (1 << 14)
#define S3C64XX_IISCON_TXFIFO2_FULL (1 << 13)
#define S3C64XX_IISCON_TXFIFO1_FULL (1 << 12)

#define S3C2412_IISCON_LRINDEX (1 << 11)
#define S3C2412_IISCON_TXFIFO_EMPTY (1 << 10)
#define S3C2412_IISCON_RXFIFO_EMPTY (1 << 9)
Expand All @@ -33,18 +51,30 @@
#define S3C2412_IISCON_RXDMA_ACTIVE (1 << 1)
#define S3C2412_IISCON_IIS_ACTIVE (1 << 0)

#define S5PC1XX_IISMOD_OPCLK_CDCLK_OUT (0 << 30)
#define S5PC1XX_IISMOD_OPCLK_CDCLK_IN (1 << 30)
#define S5PC1XX_IISMOD_OPCLK_BCLK_OUT (2 << 30)
#define S5PC1XX_IISMOD_OPCLK_PCLK (3 << 30)
#define S5PC1XX_IISMOD_OPCLK_MASK (3 << 30)
#define S5PC1XX_IISMOD_TXS_IDMA (1 << 28) /* Sec_TXFIFO use I-DMA */
#define S5PC1XX_IISMOD_BLCS_MASK 0x3
#define S5PC1XX_IISMOD_BLCS_SHIFT 26
#define S5PC1XX_IISMOD_BLCP_MASK 0x3
#define S5PC1XX_IISMOD_BLCP_SHIFT 24

#define S3C64XX_IISMOD_C2DD_HHALF (1 << 21) /* Discard Higher-half */
#define S3C64XX_IISMOD_C2DD_LHALF (1 << 20) /* Discard Lower-half */
#define S3C64XX_IISMOD_C1DD_HHALF (1 << 19)
#define S3C64XX_IISMOD_C1DD_LHALF (1 << 18)
#define S3C64XX_IISMOD_DC2_EN (1 << 17)
#define S3C64XX_IISMOD_DC1_EN (1 << 16)
#define S3C64XX_IISMOD_BLC_16BIT (0 << 13)
#define S3C64XX_IISMOD_BLC_8BIT (1 << 13)
#define S3C64XX_IISMOD_BLC_24BIT (2 << 13)
#define S3C64XX_IISMOD_BLC_MASK (3 << 13)

#define S3C64XX_IISMOD_IMS_PCLK (0 << 10)
#define S3C64XX_IISMOD_IMS_SYSMUX (1 << 10)

#define S3C2412_IISMOD_MASTER_INTERNAL (0 << 10)
#define S3C2412_IISMOD_MASTER_EXTERNAL (1 << 10)
#define S3C2412_IISMOD_SLAVE (2 << 10)
#define S3C2412_IISMOD_MASTER_MASK (3 << 10)
#define S3C2412_IISMOD_IMS_SYSMUX (1 << 10)
#define S3C2412_IISMOD_SLAVE (1 << 11)
#define S3C2412_IISMOD_MODE_TXONLY (0 << 8)
#define S3C2412_IISMOD_MODE_RXONLY (1 << 8)
#define S3C2412_IISMOD_MODE_TXRX (2 << 8)
Expand All @@ -71,12 +101,15 @@

#define S3C2412_IISPSR_PSREN (1 << 15)

#define S3C64XX_IISFIC_TX2COUNT(x) (((x) >> 24) & 0xf)
#define S3C64XX_IISFIC_TX1COUNT(x) (((x) >> 16) & 0xf)

#define S3C2412_IISFIC_TXFLUSH (1 << 15)
#define S3C2412_IISFIC_RXFLUSH (1 << 7)
#define S3C2412_IISFIC_TXCOUNT(x) (((x) >> 8) & 0xf)
#define S3C2412_IISFIC_RXCOUNT(x) (((x) >> 0) & 0xf)


#define S5PC1XX_IISFICS_TXFLUSH (1 << 15)
#define S5PC1XX_IISFICS_TXCOUNT(x) (((x) >> 8) & 0x7f)

#endif /* __ASM_ARCH_REGS_S3C2412_IIS_H */

87 changes: 62 additions & 25 deletions trunk/sound/soc/s3c24xx/s3c-i2s-v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@
#include <sound/pcm_params.h>
#include <sound/soc.h>

#include <plat/regs-s3c2412-iis.h>

#include <mach/dma.h>

#include "regs-i2s-v2.h"
#include "s3c-i2s-v2.h"
#include "s3c-dma.h"

Expand Down Expand Up @@ -266,35 +265,14 @@ static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
iismod = readl(i2s->regs + S3C2412_IISMOD);
pr_debug("hw_params r: IISMOD: %x \n", iismod);

#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
#define IISMOD_MASTER_MASK S3C2412_IISMOD_MASTER_MASK
#define IISMOD_SLAVE S3C2412_IISMOD_SLAVE
#define IISMOD_MASTER S3C2412_IISMOD_MASTER_INTERNAL
#endif

#if defined(CONFIG_PLAT_S3C64XX)
/* From Rev1.1 datasheet, we have two master and two slave modes:
* IMS[11:10]:
* 00 = master mode, fed from PCLK
* 01 = master mode, fed from CLKAUDIO
* 10 = slave mode, using PCLK
* 11 = slave mode, using I2SCLK
*/
#define IISMOD_MASTER_MASK (1 << 11)
#define IISMOD_SLAVE (1 << 11)
#define IISMOD_MASTER (0 << 11)
#endif

switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBM_CFM:
i2s->master = 0;
iismod &= ~IISMOD_MASTER_MASK;
iismod |= IISMOD_SLAVE;
iismod |= S3C2412_IISMOD_SLAVE;
break;
case SND_SOC_DAIFMT_CBS_CFS:
i2s->master = 1;
iismod &= ~IISMOD_MASTER_MASK;
iismod |= IISMOD_MASTER;
iismod &= ~S3C2412_IISMOD_SLAVE;
break;
default:
pr_err("unknwon master/slave format\n");
Expand Down Expand Up @@ -364,6 +342,52 @@ static int s3c_i2sv2_hw_params(struct snd_pcm_substream *substream,

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

return 0;
}

static int s3c_i2sv2_set_sysclk(struct snd_soc_dai *cpu_dai,
int clk_id, unsigned int freq, int dir)
{
struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
u32 iismod = readl(i2s->regs + S3C2412_IISMOD);

pr_debug("Entered %s\n", __func__);
pr_debug("%s r: IISMOD: %x\n", __func__, iismod);

switch (clk_id) {
case S3C_I2SV2_CLKSRC_PCLK:
iismod &= ~S3C2412_IISMOD_IMS_SYSMUX;
break;

case S3C_I2SV2_CLKSRC_AUDIOBUS:
iismod |= S3C2412_IISMOD_IMS_SYSMUX;
break;

case S3C_I2SV2_CLKSRC_CDCLK:
/* Error if controller doesn't have the CDCLKCON bit */
if (!(i2s->feature & S3C_FEATURE_CDCLKCON))
return -EINVAL;

switch (dir) {
case SND_SOC_CLOCK_IN:
iismod |= S3C64XX_IISMOD_CDCLKCON;
break;
case SND_SOC_CLOCK_OUT:
iismod &= ~S3C64XX_IISMOD_CDCLKCON;
break;
default:
return -EINVAL;
}
break;

default:
return -EINVAL;
}

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

return 0;
}

Expand Down Expand Up @@ -538,6 +562,18 @@ static snd_pcm_sframes_t s3c2412_i2s_delay(struct snd_pcm_substream *substream,
return delay;
}

struct clk *s3c_i2sv2_get_clock(struct snd_soc_dai *cpu_dai)
{
struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
u32 iismod = readl(i2s->regs + S3C2412_IISMOD);

if (iismod & S3C2412_IISMOD_IMS_SYSMUX)
return i2s->iis_cclk;
else
return i2s->iis_pclk;
}
EXPORT_SYMBOL_GPL(s3c_i2sv2_get_clock);

/* default table of all avaialable root fs divisors */
static unsigned int iis_fs_tab[] = { 256, 512, 384, 768 };

Expand Down Expand Up @@ -724,6 +760,7 @@ int s3c_i2sv2_register_dai(struct snd_soc_dai *dai)
ops->hw_params = s3c_i2sv2_hw_params;
ops->set_fmt = s3c2412_i2s_set_fmt;
ops->set_clkdiv = s3c2412_i2s_set_clkdiv;
ops->set_sysclk = s3c_i2sv2_set_sysclk;

/* Allow overriding by (for example) IISv4 */
if (!ops->delay)
Expand Down
11 changes: 10 additions & 1 deletion trunk/sound/soc/s3c24xx/s3c-i2s-v2.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@
#define S3C_I2SV2_CLKSRC_AUDIOBUS 1
#define S3C_I2SV2_CLKSRC_CDCLK 2

/* Set this flag for I2S controllers that have the bit IISMOD[12]
* bridge/break RCLK signal and external Xi2sCDCLK pin.
*/
#define S3C_FEATURE_CDCLKCON (1 << 0)

/**
* struct s3c_i2sv2_info - S3C I2S-V2 information
* @dev: The parent device passed to use from the probe.
* @regs: The pointer to the device registe block.
* @feature: Set of bit-flags indicating features of the controller.
* @master: True if the I2S core is the I2S bit clock master.
* @dma_playback: DMA information for playback channel.
* @dma_capture: DMA information for capture channel.
Expand All @@ -47,9 +53,10 @@ struct s3c_i2sv2_info {
struct device *dev;
void __iomem *regs;

u32 feature;

struct clk *iis_pclk;
struct clk *iis_cclk;
struct clk *iis_clk;

unsigned char master;

Expand All @@ -61,6 +68,8 @@ struct s3c_i2sv2_info {
u32 suspend_iispsr;
};

extern struct clk *s3c_i2sv2_get_clock(struct snd_soc_dai *cpu_dai);

struct s3c_i2sv2_rate_calc {
unsigned int clk_div; /* for prescaler */
unsigned int fs_div; /* for root frame clock */
Expand Down
41 changes: 1 addition & 40 deletions trunk/sound/soc/s3c24xx/s3c2412-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@
#include <sound/soc.h>
#include <mach/hardware.h>

#include <plat/regs-s3c2412-iis.h>

#include <mach/regs-gpio.h>
#include <mach/dma.h>

#include "s3c-dma.h"
#include "regs-i2s-v2.h"
#include "s3c2412-i2s.h"

#define S3C2412_I2S_DEBUG 0
Expand Down Expand Up @@ -66,43 +65,6 @@ static struct s3c_dma_params s3c2412_i2s_pcm_stereo_in = {

static struct s3c_i2sv2_info s3c2412_i2s;

/*
* Set S3C2412 Clock source
*/
static int s3c2412_i2s_set_sysclk(struct snd_soc_dai *cpu_dai,
int clk_id, unsigned int freq, int dir)
{
u32 iismod = readl(s3c2412_i2s.regs + S3C2412_IISMOD);

pr_debug("%s(%p, %d, %u, %d)\n", __func__, cpu_dai, clk_id,
freq, dir);

switch (clk_id) {
case S3C2412_CLKSRC_PCLK:
s3c2412_i2s.master = 1;
iismod &= ~S3C2412_IISMOD_MASTER_MASK;
iismod |= S3C2412_IISMOD_MASTER_INTERNAL;
break;
case S3C2412_CLKSRC_I2SCLK:
s3c2412_i2s.master = 0;
iismod &= ~S3C2412_IISMOD_MASTER_MASK;
iismod |= S3C2412_IISMOD_MASTER_EXTERNAL;
break;
default:
return -EINVAL;
}

writel(iismod, s3c2412_i2s.regs + S3C2412_IISMOD);
return 0;
}


struct clk *s3c2412_get_iisclk(void)
{
return s3c2412_i2s.iis_clk;
}
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;
Expand Down Expand Up @@ -187,7 +149,6 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
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,
};

Expand Down
2 changes: 0 additions & 2 deletions trunk/sound/soc/s3c24xx/s3c2412-i2s.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#define S3C2412_CLKSRC_PCLK S3C_I2SV2_CLKSRC_PCLK
#define S3C2412_CLKSRC_I2SCLK S3C_I2SV2_CLKSRC_AUDIOBUS

extern struct clk *s3c2412_get_iisclk(void);

extern struct snd_soc_dai s3c2412_i2s_dai;

#endif /* __SND_SOC_S3C24XX_S3C2412_I2S_H */
Loading

0 comments on commit e4dc0b0

Please sign in to comment.