diff options
-rw-r--r-- | arch/arm/mach-s3c2412/dma.c | 3 | ||||
-rw-r--r-- | sound/soc/s3c24xx/jive_wm8750.c | 2 | ||||
-rw-r--r-- | sound/soc/s3c24xx/regs-i2s-v2.h (renamed from arch/arm/plat-samsung/include/plat/regs-s3c2412-iis.h) | 51 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c-i2s-v2.c | 87 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c-i2s-v2.h | 11 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c2412-i2s.c | 41 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c2412-i2s.h | 2 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c64xx-i2s.c | 57 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c64xx-i2s.h | 2 | ||||
-rw-r--r-- | sound/soc/soc-cache.c | 12 |
10 files changed, 132 insertions, 136 deletions
diff --git a/arch/arm/mach-s3c2412/dma.c b/arch/arm/mach-s3c2412/dma.c index e880524904eb..7abecfca0b7e 100644 --- a/arch/arm/mach-s3c2412/dma.c +++ b/arch/arm/mach-s3c2412/dma.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <mach/regs-mem.h> | 30 | #include <mach/regs-mem.h> |
31 | #include <mach/regs-lcd.h> | 31 | #include <mach/regs-lcd.h> |
32 | #include <mach/regs-sdi.h> | 32 | #include <mach/regs-sdi.h> |
33 | #include <plat/regs-s3c2412-iis.h> | ||
34 | #include <plat/regs-iis.h> | 33 | #include <plat/regs-iis.h> |
35 | #include <plat/regs-spi.h> | 34 | #include <plat/regs-spi.h> |
36 | 35 | ||
@@ -119,13 +118,11 @@ static struct s3c24xx_dma_map __initdata s3c2412_dma_mappings[] = { | |||
119 | .name = "i2s-sdi", | 118 | .name = "i2s-sdi", |
120 | .channels = MAP(S3C2412_DMAREQSEL_I2SRX), | 119 | .channels = MAP(S3C2412_DMAREQSEL_I2SRX), |
121 | .channels_rx = MAP(S3C2412_DMAREQSEL_I2SRX), | 120 | .channels_rx = MAP(S3C2412_DMAREQSEL_I2SRX), |
122 | .hw_addr.from = S3C2410_PA_IIS + S3C2412_IISRXD, | ||
123 | }, | 121 | }, |
124 | [DMACH_I2S_OUT] = { | 122 | [DMACH_I2S_OUT] = { |
125 | .name = "i2s-sdo", | 123 | .name = "i2s-sdo", |
126 | .channels = MAP(S3C2412_DMAREQSEL_I2STX), | 124 | .channels = MAP(S3C2412_DMAREQSEL_I2STX), |
127 | .channels_rx = MAP(S3C2412_DMAREQSEL_I2STX), | 125 | .channels_rx = MAP(S3C2412_DMAREQSEL_I2STX), |
128 | .hw_addr.to = S3C2410_PA_IIS + S3C2412_IISTXD, | ||
129 | }, | 126 | }, |
130 | [DMACH_USB_EP1] = { | 127 | [DMACH_USB_EP1] = { |
131 | .name = "usb-ep1", | 128 | .name = "usb-ep1", |
diff --git a/sound/soc/s3c24xx/jive_wm8750.c b/sound/soc/s3c24xx/jive_wm8750.c index 97d8ff3196be..8c108b121c10 100644 --- a/sound/soc/s3c24xx/jive_wm8750.c +++ b/sound/soc/s3c24xx/jive_wm8750.c | |||
@@ -70,7 +70,7 @@ static int jive_hw_params(struct snd_pcm_substream *substream, | |||
70 | } | 70 | } |
71 | 71 | ||
72 | s3c_i2sv2_iis_calc_rate(&div, NULL, params_rate(params), | 72 | s3c_i2sv2_iis_calc_rate(&div, NULL, params_rate(params), |
73 | s3c2412_get_iisclk()); | 73 | s3c_i2sv2_get_clock(cpu_dai)); |
74 | 74 | ||
75 | /* set codec DAI configuration */ | 75 | /* set codec DAI configuration */ |
76 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | | 76 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | |
diff --git a/arch/arm/plat-samsung/include/plat/regs-s3c2412-iis.h b/sound/soc/s3c24xx/regs-i2s-v2.h index abf2fbc2eb2f..5e5e5680580b 100644 --- a/arch/arm/plat-samsung/include/plat/regs-s3c2412-iis.h +++ b/sound/soc/s3c24xx/regs-i2s-v2.h | |||
@@ -20,6 +20,24 @@ | |||
20 | #define S3C2412_IISTXD (0x10) | 20 | #define S3C2412_IISTXD (0x10) |
21 | #define S3C2412_IISRXD (0x14) | 21 | #define S3C2412_IISRXD (0x14) |
22 | 22 | ||
23 | #define S5PC1XX_IISFICS 0x18 | ||
24 | #define S5PC1XX_IISTXDS 0x1C | ||
25 | |||
26 | #define S5PC1XX_IISCON_SW_RST (1 << 31) | ||
27 | #define S5PC1XX_IISCON_FRXOFSTATUS (1 << 26) | ||
28 | #define S5PC1XX_IISCON_FRXORINTEN (1 << 25) | ||
29 | #define S5PC1XX_IISCON_FTXSURSTAT (1 << 24) | ||
30 | #define S5PC1XX_IISCON_FTXSURINTEN (1 << 23) | ||
31 | #define S5PC1XX_IISCON_TXSDMAPAUSE (1 << 20) | ||
32 | #define S5PC1XX_IISCON_TXSDMACTIVE (1 << 18) | ||
33 | |||
34 | #define S3C64XX_IISCON_FTXURSTATUS (1 << 17) | ||
35 | #define S3C64XX_IISCON_FTXURINTEN (1 << 16) | ||
36 | #define S3C64XX_IISCON_TXFIFO2_EMPTY (1 << 15) | ||
37 | #define S3C64XX_IISCON_TXFIFO1_EMPTY (1 << 14) | ||
38 | #define S3C64XX_IISCON_TXFIFO2_FULL (1 << 13) | ||
39 | #define S3C64XX_IISCON_TXFIFO1_FULL (1 << 12) | ||
40 | |||
23 | #define S3C2412_IISCON_LRINDEX (1 << 11) | 41 | #define S3C2412_IISCON_LRINDEX (1 << 11) |
24 | #define S3C2412_IISCON_TXFIFO_EMPTY (1 << 10) | 42 | #define S3C2412_IISCON_TXFIFO_EMPTY (1 << 10) |
25 | #define S3C2412_IISCON_RXFIFO_EMPTY (1 << 9) | 43 | #define S3C2412_IISCON_RXFIFO_EMPTY (1 << 9) |
@@ -33,18 +51,30 @@ | |||
33 | #define S3C2412_IISCON_RXDMA_ACTIVE (1 << 1) | 51 | #define S3C2412_IISCON_RXDMA_ACTIVE (1 << 1) |
34 | #define S3C2412_IISCON_IIS_ACTIVE (1 << 0) | 52 | #define S3C2412_IISCON_IIS_ACTIVE (1 << 0) |
35 | 53 | ||
54 | #define S5PC1XX_IISMOD_OPCLK_CDCLK_OUT (0 << 30) | ||
55 | #define S5PC1XX_IISMOD_OPCLK_CDCLK_IN (1 << 30) | ||
56 | #define S5PC1XX_IISMOD_OPCLK_BCLK_OUT (2 << 30) | ||
57 | #define S5PC1XX_IISMOD_OPCLK_PCLK (3 << 30) | ||
58 | #define S5PC1XX_IISMOD_OPCLK_MASK (3 << 30) | ||
59 | #define S5PC1XX_IISMOD_TXS_IDMA (1 << 28) /* Sec_TXFIFO use I-DMA */ | ||
60 | #define S5PC1XX_IISMOD_BLCS_MASK 0x3 | ||
61 | #define S5PC1XX_IISMOD_BLCS_SHIFT 26 | ||
62 | #define S5PC1XX_IISMOD_BLCP_MASK 0x3 | ||
63 | #define S5PC1XX_IISMOD_BLCP_SHIFT 24 | ||
64 | |||
65 | #define S3C64XX_IISMOD_C2DD_HHALF (1 << 21) /* Discard Higher-half */ | ||
66 | #define S3C64XX_IISMOD_C2DD_LHALF (1 << 20) /* Discard Lower-half */ | ||
67 | #define S3C64XX_IISMOD_C1DD_HHALF (1 << 19) | ||
68 | #define S3C64XX_IISMOD_C1DD_LHALF (1 << 18) | ||
69 | #define S3C64XX_IISMOD_DC2_EN (1 << 17) | ||
70 | #define S3C64XX_IISMOD_DC1_EN (1 << 16) | ||
36 | #define S3C64XX_IISMOD_BLC_16BIT (0 << 13) | 71 | #define S3C64XX_IISMOD_BLC_16BIT (0 << 13) |
37 | #define S3C64XX_IISMOD_BLC_8BIT (1 << 13) | 72 | #define S3C64XX_IISMOD_BLC_8BIT (1 << 13) |
38 | #define S3C64XX_IISMOD_BLC_24BIT (2 << 13) | 73 | #define S3C64XX_IISMOD_BLC_24BIT (2 << 13) |
39 | #define S3C64XX_IISMOD_BLC_MASK (3 << 13) | 74 | #define S3C64XX_IISMOD_BLC_MASK (3 << 13) |
40 | 75 | ||
41 | #define S3C64XX_IISMOD_IMS_PCLK (0 << 10) | 76 | #define S3C2412_IISMOD_IMS_SYSMUX (1 << 10) |
42 | #define S3C64XX_IISMOD_IMS_SYSMUX (1 << 10) | 77 | #define S3C2412_IISMOD_SLAVE (1 << 11) |
43 | |||
44 | #define S3C2412_IISMOD_MASTER_INTERNAL (0 << 10) | ||
45 | #define S3C2412_IISMOD_MASTER_EXTERNAL (1 << 10) | ||
46 | #define S3C2412_IISMOD_SLAVE (2 << 10) | ||
47 | #define S3C2412_IISMOD_MASTER_MASK (3 << 10) | ||
48 | #define S3C2412_IISMOD_MODE_TXONLY (0 << 8) | 78 | #define S3C2412_IISMOD_MODE_TXONLY (0 << 8) |
49 | #define S3C2412_IISMOD_MODE_RXONLY (1 << 8) | 79 | #define S3C2412_IISMOD_MODE_RXONLY (1 << 8) |
50 | #define S3C2412_IISMOD_MODE_TXRX (2 << 8) | 80 | #define S3C2412_IISMOD_MODE_TXRX (2 << 8) |
@@ -71,12 +101,15 @@ | |||
71 | 101 | ||
72 | #define S3C2412_IISPSR_PSREN (1 << 15) | 102 | #define S3C2412_IISPSR_PSREN (1 << 15) |
73 | 103 | ||
104 | #define S3C64XX_IISFIC_TX2COUNT(x) (((x) >> 24) & 0xf) | ||
105 | #define S3C64XX_IISFIC_TX1COUNT(x) (((x) >> 16) & 0xf) | ||
106 | |||
74 | #define S3C2412_IISFIC_TXFLUSH (1 << 15) | 107 | #define S3C2412_IISFIC_TXFLUSH (1 << 15) |
75 | #define S3C2412_IISFIC_RXFLUSH (1 << 7) | 108 | #define S3C2412_IISFIC_RXFLUSH (1 << 7) |
76 | #define S3C2412_IISFIC_TXCOUNT(x) (((x) >> 8) & 0xf) | 109 | #define S3C2412_IISFIC_TXCOUNT(x) (((x) >> 8) & 0xf) |
77 | #define S3C2412_IISFIC_RXCOUNT(x) (((x) >> 0) & 0xf) | 110 | #define S3C2412_IISFIC_RXCOUNT(x) (((x) >> 0) & 0xf) |
78 | 111 | ||
79 | 112 | #define S5PC1XX_IISFICS_TXFLUSH (1 << 15) | |
113 | #define S5PC1XX_IISFICS_TXCOUNT(x) (((x) >> 8) & 0x7f) | ||
80 | 114 | ||
81 | #endif /* __ASM_ARCH_REGS_S3C2412_IIS_H */ | 115 | #endif /* __ASM_ARCH_REGS_S3C2412_IIS_H */ |
82 | |||
diff --git a/sound/soc/s3c24xx/s3c-i2s-v2.c b/sound/soc/s3c24xx/s3c-i2s-v2.c index 865f93143bf1..13311c8cf965 100644 --- a/sound/soc/s3c24xx/s3c-i2s-v2.c +++ b/sound/soc/s3c24xx/s3c-i2s-v2.c | |||
@@ -24,10 +24,9 @@ | |||
24 | #include <sound/pcm_params.h> | 24 | #include <sound/pcm_params.h> |
25 | #include <sound/soc.h> | 25 | #include <sound/soc.h> |
26 | 26 | ||
27 | #include <plat/regs-s3c2412-iis.h> | ||
28 | |||
29 | #include <mach/dma.h> | 27 | #include <mach/dma.h> |
30 | 28 | ||
29 | #include "regs-i2s-v2.h" | ||
31 | #include "s3c-i2s-v2.h" | 30 | #include "s3c-i2s-v2.h" |
32 | #include "s3c-dma.h" | 31 | #include "s3c-dma.h" |
33 | 32 | ||
@@ -266,35 +265,14 @@ static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai, | |||
266 | iismod = readl(i2s->regs + S3C2412_IISMOD); | 265 | iismod = readl(i2s->regs + S3C2412_IISMOD); |
267 | pr_debug("hw_params r: IISMOD: %x \n", iismod); | 266 | pr_debug("hw_params r: IISMOD: %x \n", iismod); |
268 | 267 | ||
269 | #if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413) | ||
270 | #define IISMOD_MASTER_MASK S3C2412_IISMOD_MASTER_MASK | ||
271 | #define IISMOD_SLAVE S3C2412_IISMOD_SLAVE | ||
272 | #define IISMOD_MASTER S3C2412_IISMOD_MASTER_INTERNAL | ||
273 | #endif | ||
274 | |||
275 | #if defined(CONFIG_PLAT_S3C64XX) | ||
276 | /* From Rev1.1 datasheet, we have two master and two slave modes: | ||
277 | * IMS[11:10]: | ||
278 | * 00 = master mode, fed from PCLK | ||
279 | * 01 = master mode, fed from CLKAUDIO | ||
280 | * 10 = slave mode, using PCLK | ||
281 | * 11 = slave mode, using I2SCLK | ||
282 | */ | ||
283 | #define IISMOD_MASTER_MASK (1 << 11) | ||
284 | #define IISMOD_SLAVE (1 << 11) | ||
285 | #define IISMOD_MASTER (0 << 11) | ||
286 | #endif | ||
287 | |||
288 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 268 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
289 | case SND_SOC_DAIFMT_CBM_CFM: | 269 | case SND_SOC_DAIFMT_CBM_CFM: |
290 | i2s->master = 0; | 270 | i2s->master = 0; |
291 | iismod &= ~IISMOD_MASTER_MASK; | 271 | iismod |= S3C2412_IISMOD_SLAVE; |
292 | iismod |= IISMOD_SLAVE; | ||
293 | break; | 272 | break; |
294 | case SND_SOC_DAIFMT_CBS_CFS: | 273 | case SND_SOC_DAIFMT_CBS_CFS: |
295 | i2s->master = 1; | 274 | i2s->master = 1; |
296 | iismod &= ~IISMOD_MASTER_MASK; | 275 | iismod &= ~S3C2412_IISMOD_SLAVE; |
297 | iismod |= IISMOD_MASTER; | ||
298 | break; | 276 | break; |
299 | default: | 277 | default: |
300 | pr_err("unknwon master/slave format\n"); | 278 | pr_err("unknwon master/slave format\n"); |
@@ -364,6 +342,52 @@ static int s3c_i2sv2_hw_params(struct snd_pcm_substream *substream, | |||
364 | 342 | ||
365 | writel(iismod, i2s->regs + S3C2412_IISMOD); | 343 | writel(iismod, i2s->regs + S3C2412_IISMOD); |
366 | pr_debug("%s: w: IISMOD: %x\n", __func__, iismod); | 344 | pr_debug("%s: w: IISMOD: %x\n", __func__, iismod); |
345 | |||
346 | return 0; | ||
347 | } | ||
348 | |||
349 | static int s3c_i2sv2_set_sysclk(struct snd_soc_dai *cpu_dai, | ||
350 | int clk_id, unsigned int freq, int dir) | ||
351 | { | ||
352 | struct s3c_i2sv2_info *i2s = to_info(cpu_dai); | ||
353 | u32 iismod = readl(i2s->regs + S3C2412_IISMOD); | ||
354 | |||
355 | pr_debug("Entered %s\n", __func__); | ||
356 | pr_debug("%s r: IISMOD: %x\n", __func__, iismod); | ||
357 | |||
358 | switch (clk_id) { | ||
359 | case S3C_I2SV2_CLKSRC_PCLK: | ||
360 | iismod &= ~S3C2412_IISMOD_IMS_SYSMUX; | ||
361 | break; | ||
362 | |||
363 | case S3C_I2SV2_CLKSRC_AUDIOBUS: | ||
364 | iismod |= S3C2412_IISMOD_IMS_SYSMUX; | ||
365 | break; | ||
366 | |||
367 | case S3C_I2SV2_CLKSRC_CDCLK: | ||
368 | /* Error if controller doesn't have the CDCLKCON bit */ | ||
369 | if (!(i2s->feature & S3C_FEATURE_CDCLKCON)) | ||
370 | return -EINVAL; | ||
371 | |||
372 | switch (dir) { | ||
373 | case SND_SOC_CLOCK_IN: | ||
374 | iismod |= S3C64XX_IISMOD_CDCLKCON; | ||
375 | break; | ||
376 | case SND_SOC_CLOCK_OUT: | ||
377 | iismod &= ~S3C64XX_IISMOD_CDCLKCON; | ||
378 | break; | ||
379 | default: | ||
380 | return -EINVAL; | ||
381 | } | ||
382 | break; | ||
383 | |||
384 | default: | ||
385 | return -EINVAL; | ||
386 | } | ||
387 | |||
388 | writel(iismod, i2s->regs + S3C2412_IISMOD); | ||
389 | pr_debug("%s w: IISMOD: %x\n", __func__, iismod); | ||
390 | |||
367 | return 0; | 391 | return 0; |
368 | } | 392 | } |
369 | 393 | ||
@@ -538,6 +562,18 @@ static snd_pcm_sframes_t s3c2412_i2s_delay(struct snd_pcm_substream *substream, | |||
538 | return delay; | 562 | return delay; |
539 | } | 563 | } |
540 | 564 | ||
565 | struct clk *s3c_i2sv2_get_clock(struct snd_soc_dai *cpu_dai) | ||
566 | { | ||
567 | struct s3c_i2sv2_info *i2s = to_info(cpu_dai); | ||
568 | u32 iismod = readl(i2s->regs + S3C2412_IISMOD); | ||
569 | |||
570 | if (iismod & S3C2412_IISMOD_IMS_SYSMUX) | ||
571 | return i2s->iis_cclk; | ||
572 | else | ||
573 | return i2s->iis_pclk; | ||
574 | } | ||
575 | EXPORT_SYMBOL_GPL(s3c_i2sv2_get_clock); | ||
576 | |||
541 | /* default table of all avaialable root fs divisors */ | 577 | /* default table of all avaialable root fs divisors */ |
542 | static unsigned int iis_fs_tab[] = { 256, 512, 384, 768 }; | 578 | static unsigned int iis_fs_tab[] = { 256, 512, 384, 768 }; |
543 | 579 | ||
@@ -724,6 +760,7 @@ int s3c_i2sv2_register_dai(struct snd_soc_dai *dai) | |||
724 | ops->hw_params = s3c_i2sv2_hw_params; | 760 | ops->hw_params = s3c_i2sv2_hw_params; |
725 | ops->set_fmt = s3c2412_i2s_set_fmt; | 761 | ops->set_fmt = s3c2412_i2s_set_fmt; |
726 | ops->set_clkdiv = s3c2412_i2s_set_clkdiv; | 762 | ops->set_clkdiv = s3c2412_i2s_set_clkdiv; |
763 | ops->set_sysclk = s3c_i2sv2_set_sysclk; | ||
727 | 764 | ||
728 | /* Allow overriding by (for example) IISv4 */ | 765 | /* Allow overriding by (for example) IISv4 */ |
729 | if (!ops->delay) | 766 | if (!ops->delay) |
diff --git a/sound/soc/s3c24xx/s3c-i2s-v2.h b/sound/soc/s3c24xx/s3c-i2s-v2.h index b094d3c23cbe..766f43a13d8b 100644 --- a/sound/soc/s3c24xx/s3c-i2s-v2.h +++ b/sound/soc/s3c24xx/s3c-i2s-v2.h | |||
@@ -29,10 +29,16 @@ | |||
29 | #define S3C_I2SV2_CLKSRC_AUDIOBUS 1 | 29 | #define S3C_I2SV2_CLKSRC_AUDIOBUS 1 |
30 | #define S3C_I2SV2_CLKSRC_CDCLK 2 | 30 | #define S3C_I2SV2_CLKSRC_CDCLK 2 |
31 | 31 | ||
32 | /* Set this flag for I2S controllers that have the bit IISMOD[12] | ||
33 | * bridge/break RCLK signal and external Xi2sCDCLK pin. | ||
34 | */ | ||
35 | #define S3C_FEATURE_CDCLKCON (1 << 0) | ||
36 | |||
32 | /** | 37 | /** |
33 | * struct s3c_i2sv2_info - S3C I2S-V2 information | 38 | * struct s3c_i2sv2_info - S3C I2S-V2 information |
34 | * @dev: The parent device passed to use from the probe. | 39 | * @dev: The parent device passed to use from the probe. |
35 | * @regs: The pointer to the device registe block. | 40 | * @regs: The pointer to the device registe block. |
41 | * @feature: Set of bit-flags indicating features of the controller. | ||
36 | * @master: True if the I2S core is the I2S bit clock master. | 42 | * @master: True if the I2S core is the I2S bit clock master. |
37 | * @dma_playback: DMA information for playback channel. | 43 | * @dma_playback: DMA information for playback channel. |
38 | * @dma_capture: DMA information for capture channel. | 44 | * @dma_capture: DMA information for capture channel. |
@@ -47,9 +53,10 @@ struct s3c_i2sv2_info { | |||
47 | struct device *dev; | 53 | struct device *dev; |
48 | void __iomem *regs; | 54 | void __iomem *regs; |
49 | 55 | ||
56 | u32 feature; | ||
57 | |||
50 | struct clk *iis_pclk; | 58 | struct clk *iis_pclk; |
51 | struct clk *iis_cclk; | 59 | struct clk *iis_cclk; |
52 | struct clk *iis_clk; | ||
53 | 60 | ||
54 | unsigned char master; | 61 | unsigned char master; |
55 | 62 | ||
@@ -61,6 +68,8 @@ struct s3c_i2sv2_info { | |||
61 | u32 suspend_iispsr; | 68 | u32 suspend_iispsr; |
62 | }; | 69 | }; |
63 | 70 | ||
71 | extern struct clk *s3c_i2sv2_get_clock(struct snd_soc_dai *cpu_dai); | ||
72 | |||
64 | struct s3c_i2sv2_rate_calc { | 73 | struct s3c_i2sv2_rate_calc { |
65 | unsigned int clk_div; /* for prescaler */ | 74 | unsigned int clk_div; /* for prescaler */ |
66 | unsigned int fs_div; /* for root frame clock */ | 75 | unsigned int fs_div; /* for root frame clock */ |
diff --git a/sound/soc/s3c24xx/s3c2412-i2s.c b/sound/soc/s3c24xx/s3c2412-i2s.c index f3148f98b419..709adef9d043 100644 --- a/sound/soc/s3c24xx/s3c2412-i2s.c +++ b/sound/soc/s3c24xx/s3c2412-i2s.c | |||
@@ -32,12 +32,11 @@ | |||
32 | #include <sound/soc.h> | 32 | #include <sound/soc.h> |
33 | #include <mach/hardware.h> | 33 | #include <mach/hardware.h> |
34 | 34 | ||
35 | #include <plat/regs-s3c2412-iis.h> | ||
36 | |||
37 | #include <mach/regs-gpio.h> | 35 | #include <mach/regs-gpio.h> |
38 | #include <mach/dma.h> | 36 | #include <mach/dma.h> |
39 | 37 | ||
40 | #include "s3c-dma.h" | 38 | #include "s3c-dma.h" |
39 | #include "regs-i2s-v2.h" | ||
41 | #include "s3c2412-i2s.h" | 40 | #include "s3c2412-i2s.h" |
42 | 41 | ||
43 | #define S3C2412_I2S_DEBUG 0 | 42 | #define S3C2412_I2S_DEBUG 0 |
@@ -66,43 +65,6 @@ static struct s3c_dma_params s3c2412_i2s_pcm_stereo_in = { | |||
66 | 65 | ||
67 | static struct s3c_i2sv2_info s3c2412_i2s; | 66 | static struct s3c_i2sv2_info s3c2412_i2s; |
68 | 67 | ||
69 | /* | ||
70 | * Set S3C2412 Clock source | ||
71 | */ | ||
72 | static int s3c2412_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, | ||
73 | int clk_id, unsigned int freq, int dir) | ||
74 | { | ||
75 | u32 iismod = readl(s3c2412_i2s.regs + S3C2412_IISMOD); | ||
76 | |||
77 | pr_debug("%s(%p, %d, %u, %d)\n", __func__, cpu_dai, clk_id, | ||
78 | freq, dir); | ||
79 | |||
80 | switch (clk_id) { | ||
81 | case S3C2412_CLKSRC_PCLK: | ||
82 | s3c2412_i2s.master = 1; | ||
83 | iismod &= ~S3C2412_IISMOD_MASTER_MASK; | ||
84 | iismod |= S3C2412_IISMOD_MASTER_INTERNAL; | ||
85 | break; | ||
86 | case S3C2412_CLKSRC_I2SCLK: | ||
87 | s3c2412_i2s.master = 0; | ||
88 | iismod &= ~S3C2412_IISMOD_MASTER_MASK; | ||
89 | iismod |= S3C2412_IISMOD_MASTER_EXTERNAL; | ||
90 | break; | ||
91 | default: | ||
92 | return -EINVAL; | ||
93 | } | ||
94 | |||
95 | writel(iismod, s3c2412_i2s.regs + S3C2412_IISMOD); | ||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | |||
100 | struct clk *s3c2412_get_iisclk(void) | ||
101 | { | ||
102 | return s3c2412_i2s.iis_clk; | ||
103 | } | ||
104 | EXPORT_SYMBOL_GPL(s3c2412_get_iisclk); | ||
105 | |||
106 | static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai) | 68 | static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai) |
107 | { | 69 | { |
108 | return cpu_dai->private_data; | 70 | return cpu_dai->private_data; |
@@ -187,7 +149,6 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream, | |||
187 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) | 149 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) |
188 | 150 | ||
189 | static struct snd_soc_dai_ops s3c2412_i2s_dai_ops = { | 151 | static struct snd_soc_dai_ops s3c2412_i2s_dai_ops = { |
190 | .set_sysclk = s3c2412_i2s_set_sysclk, | ||
191 | .hw_params = s3c2412_i2s_hw_params, | 152 | .hw_params = s3c2412_i2s_hw_params, |
192 | }; | 153 | }; |
193 | 154 | ||
diff --git a/sound/soc/s3c24xx/s3c2412-i2s.h b/sound/soc/s3c24xx/s3c2412-i2s.h index 60cac002a830..0b5686b4d5c3 100644 --- a/sound/soc/s3c24xx/s3c2412-i2s.h +++ b/sound/soc/s3c24xx/s3c2412-i2s.h | |||
@@ -24,8 +24,6 @@ | |||
24 | #define S3C2412_CLKSRC_PCLK S3C_I2SV2_CLKSRC_PCLK | 24 | #define S3C2412_CLKSRC_PCLK S3C_I2SV2_CLKSRC_PCLK |
25 | #define S3C2412_CLKSRC_I2SCLK S3C_I2SV2_CLKSRC_AUDIOBUS | 25 | #define S3C2412_CLKSRC_I2SCLK S3C_I2SV2_CLKSRC_AUDIOBUS |
26 | 26 | ||
27 | extern struct clk *s3c2412_get_iisclk(void); | ||
28 | |||
29 | extern struct snd_soc_dai s3c2412_i2s_dai; | 27 | extern struct snd_soc_dai s3c2412_i2s_dai; |
30 | 28 | ||
31 | #endif /* __SND_SOC_S3C24XX_S3C2412_I2S_H */ | 29 | #endif /* __SND_SOC_S3C24XX_S3C2412_I2S_H */ |
diff --git a/sound/soc/s3c24xx/s3c64xx-i2s.c b/sound/soc/s3c24xx/s3c64xx-i2s.c index ab1fa159d3ae..1d85cb85a7d2 100644 --- a/sound/soc/s3c24xx/s3c64xx-i2s.c +++ b/sound/soc/s3c24xx/s3c64xx-i2s.c | |||
@@ -18,7 +18,6 @@ | |||
18 | 18 | ||
19 | #include <sound/soc.h> | 19 | #include <sound/soc.h> |
20 | 20 | ||
21 | #include <plat/regs-s3c2412-iis.h> | ||
22 | #include <mach/gpio-bank-d.h> | 21 | #include <mach/gpio-bank-d.h> |
23 | #include <mach/gpio-bank-e.h> | 22 | #include <mach/gpio-bank-e.h> |
24 | #include <plat/gpio-cfg.h> | 23 | #include <plat/gpio-cfg.h> |
@@ -27,6 +26,7 @@ | |||
27 | #include <mach/dma.h> | 26 | #include <mach/dma.h> |
28 | 27 | ||
29 | #include "s3c-dma.h" | 28 | #include "s3c-dma.h" |
29 | #include "regs-i2s-v2.h" | ||
30 | #include "s3c64xx-i2s.h" | 30 | #include "s3c64xx-i2s.h" |
31 | 31 | ||
32 | /* The value should be set to maximum of the total number | 32 | /* The value should be set to maximum of the total number |
@@ -54,55 +54,6 @@ static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai) | |||
54 | return cpu_dai->private_data; | 54 | return cpu_dai->private_data; |
55 | } | 55 | } |
56 | 56 | ||
57 | static int s3c64xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, | ||
58 | int clk_id, unsigned int freq, int dir) | ||
59 | { | ||
60 | struct s3c_i2sv2_info *i2s = to_info(cpu_dai); | ||
61 | u32 iismod = readl(i2s->regs + S3C2412_IISMOD); | ||
62 | |||
63 | switch (clk_id) { | ||
64 | case S3C64XX_CLKSRC_PCLK: | ||
65 | iismod &= ~S3C64XX_IISMOD_IMS_SYSMUX; | ||
66 | break; | ||
67 | |||
68 | case S3C64XX_CLKSRC_MUX: | ||
69 | iismod |= S3C64XX_IISMOD_IMS_SYSMUX; | ||
70 | break; | ||
71 | |||
72 | case S3C64XX_CLKSRC_CDCLK: | ||
73 | switch (dir) { | ||
74 | case SND_SOC_CLOCK_IN: | ||
75 | iismod |= S3C64XX_IISMOD_CDCLKCON; | ||
76 | break; | ||
77 | case SND_SOC_CLOCK_OUT: | ||
78 | iismod &= ~S3C64XX_IISMOD_CDCLKCON; | ||
79 | break; | ||
80 | default: | ||
81 | return -EINVAL; | ||
82 | } | ||
83 | break; | ||
84 | |||
85 | default: | ||
86 | return -EINVAL; | ||
87 | } | ||
88 | |||
89 | writel(iismod, i2s->regs + S3C2412_IISMOD); | ||
90 | |||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | struct clk *s3c64xx_i2s_get_clock(struct snd_soc_dai *dai) | ||
95 | { | ||
96 | struct s3c_i2sv2_info *i2s = to_info(dai); | ||
97 | u32 iismod = readl(i2s->regs + S3C2412_IISMOD); | ||
98 | |||
99 | if (iismod & S3C64XX_IISMOD_IMS_SYSMUX) | ||
100 | return i2s->iis_cclk; | ||
101 | else | ||
102 | return i2s->iis_pclk; | ||
103 | } | ||
104 | EXPORT_SYMBOL_GPL(s3c64xx_i2s_get_clock); | ||
105 | |||
106 | static int s3c64xx_i2s_probe(struct platform_device *pdev, | 57 | static int s3c64xx_i2s_probe(struct platform_device *pdev, |
107 | struct snd_soc_dai *dai) | 58 | struct snd_soc_dai *dai) |
108 | { | 59 | { |
@@ -127,9 +78,7 @@ static int s3c64xx_i2s_probe(struct platform_device *pdev, | |||
127 | } | 78 | } |
128 | 79 | ||
129 | 80 | ||
130 | static struct snd_soc_dai_ops s3c64xx_i2s_dai_ops = { | 81 | static struct snd_soc_dai_ops s3c64xx_i2s_dai_ops; |
131 | .set_sysclk = s3c64xx_i2s_set_sysclk, | ||
132 | }; | ||
133 | 82 | ||
134 | static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev) | 83 | static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev) |
135 | { | 84 | { |
@@ -159,6 +108,8 @@ static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev) | |||
159 | dai->probe = s3c64xx_i2s_probe; | 108 | dai->probe = s3c64xx_i2s_probe; |
160 | dai->ops = &s3c64xx_i2s_dai_ops; | 109 | dai->ops = &s3c64xx_i2s_dai_ops; |
161 | 110 | ||
111 | i2s->feature |= S3C_FEATURE_CDCLKCON; | ||
112 | |||
162 | i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id]; | 113 | i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id]; |
163 | i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id]; | 114 | i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id]; |
164 | 115 | ||
diff --git a/sound/soc/s3c24xx/s3c64xx-i2s.h b/sound/soc/s3c24xx/s3c64xx-i2s.h index 53d2a0a0df36..f27ed50e4d82 100644 --- a/sound/soc/s3c24xx/s3c64xx-i2s.h +++ b/sound/soc/s3c24xx/s3c64xx-i2s.h | |||
@@ -38,6 +38,4 @@ struct clk; | |||
38 | 38 | ||
39 | extern struct snd_soc_dai s3c64xx_i2s_dai[]; | 39 | extern struct snd_soc_dai s3c64xx_i2s_dai[]; |
40 | 40 | ||
41 | extern struct clk *s3c64xx_i2s_get_clock(struct snd_soc_dai *dai); | ||
42 | |||
43 | #endif /* __SND_SOC_S3C24XX_S3C64XX_I2S_H */ | 41 | #endif /* __SND_SOC_S3C24XX_S3C64XX_I2S_H */ |
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index 9dfe9a58a314..472af38188c1 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
@@ -44,6 +44,8 @@ static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg, | |||
44 | return 0; | 44 | return 0; |
45 | } | 45 | } |
46 | 46 | ||
47 | dev_dbg(codec->dev, "0x%x = 0x%x\n", reg, value); | ||
48 | |||
47 | ret = codec->hw_write(codec->control_data, data, 2); | 49 | ret = codec->hw_write(codec->control_data, data, 2); |
48 | if (ret == 2) | 50 | if (ret == 2) |
49 | return 0; | 51 | return 0; |
@@ -112,6 +114,8 @@ static int snd_soc_7_9_write(struct snd_soc_codec *codec, unsigned int reg, | |||
112 | return 0; | 114 | return 0; |
113 | } | 115 | } |
114 | 116 | ||
117 | dev_dbg(codec->dev, "0x%x = 0x%x\n", reg, value); | ||
118 | |||
115 | ret = codec->hw_write(codec->control_data, data, 2); | 119 | ret = codec->hw_write(codec->control_data, data, 2); |
116 | if (ret == 2) | 120 | if (ret == 2) |
117 | return 0; | 121 | return 0; |
@@ -171,6 +175,8 @@ static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg, | |||
171 | return 0; | 175 | return 0; |
172 | } | 176 | } |
173 | 177 | ||
178 | dev_dbg(codec->dev, "0x%x = 0x%x\n", reg, value); | ||
179 | |||
174 | if (codec->hw_write(codec->control_data, data, 2) == 2) | 180 | if (codec->hw_write(codec->control_data, data, 2) == 2) |
175 | return 0; | 181 | return 0; |
176 | else | 182 | else |
@@ -205,6 +211,8 @@ static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg, | |||
205 | return 0; | 211 | return 0; |
206 | } | 212 | } |
207 | 213 | ||
214 | dev_dbg(codec->dev, "0x%x = 0x%x\n", reg, value); | ||
215 | |||
208 | if (codec->hw_write(codec->control_data, data, 3) == 3) | 216 | if (codec->hw_write(codec->control_data, data, 3) == 3) |
209 | return 0; | 217 | return 0; |
210 | else | 218 | else |
@@ -362,6 +370,8 @@ static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg, | |||
362 | return 0; | 370 | return 0; |
363 | } | 371 | } |
364 | 372 | ||
373 | dev_dbg(codec->dev, "0x%x = 0x%x\n", reg, value); | ||
374 | |||
365 | ret = codec->hw_write(codec->control_data, data, 3); | 375 | ret = codec->hw_write(codec->control_data, data, 3); |
366 | if (ret == 3) | 376 | if (ret == 3) |
367 | return 0; | 377 | return 0; |
@@ -472,6 +482,8 @@ static int snd_soc_16_16_write(struct snd_soc_codec *codec, unsigned int reg, | |||
472 | return 0; | 482 | return 0; |
473 | } | 483 | } |
474 | 484 | ||
485 | dev_dbg(codec->dev, "0x%x = 0x%x\n", reg, value); | ||
486 | |||
475 | ret = codec->hw_write(codec->control_data, data, 4); | 487 | ret = codec->hw_write(codec->control_data, data, 4); |
476 | if (ret == 4) | 488 | if (ret == 4) |
477 | return 0; | 489 | return 0; |