* [PATCHv4 01/20] OMAP: McBSP: Provide functions for ASoC frame syncronization
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 02/20] OMAP: McBSP: Add IRQEN, IRQSTATUS, THRESHOLD2 and THRESHOLD1 registers Eduardo Valentin
` (19 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eero Nurkkala
From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
ASoC has an annoying bug letting either L or R channel to be
played on L channel. In other words, L and R channels can
switch at random. This provides McBSP funtionality that may
be used to fix this feature.
Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
---
arch/arm/plat-omap/include/mach/mcbsp.h | 2 +
arch/arm/plat-omap/mcbsp.c | 52 +++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h
index 57249bb..b85e6e6 100644
--- a/arch/arm/plat-omap/include/mach/mcbsp.h
+++ b/arch/arm/plat-omap/include/mach/mcbsp.h
@@ -389,6 +389,8 @@ int omap_mcbsp_request(unsigned int id);
void omap_mcbsp_free(unsigned int id);
void omap_mcbsp_start(unsigned int id, int tx, int rx);
void omap_mcbsp_stop(unsigned int id, int tx, int rx);
+void omap_mcbsp_xmit_enable(unsigned int id, u8 enable);
+void omap_mcbsp_recv_enable(unsigned int id, u8 enable);
void omap_mcbsp_xmit_word(unsigned int id, u32 word);
u32 omap_mcbsp_recv_word(unsigned int id);
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index a3d2313..0aa2524 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -412,6 +412,58 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
}
EXPORT_SYMBOL(omap_mcbsp_stop);
+void omap_mcbsp_xmit_enable(unsigned int id, u8 enable)
+{
+ struct omap_mcbsp *mcbsp;
+ void __iomem *io_base;
+ u16 w;
+
+ if (!(cpu_is_omap2430() || cpu_is_omap34xx()))
+ return;
+
+ if (!omap_mcbsp_check_valid_id(id)) {
+ printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
+ return;
+ }
+
+ mcbsp = id_to_mcbsp_ptr(id);
+ io_base = mcbsp->io_base;
+
+ w = OMAP_MCBSP_READ(io_base, XCCR);
+
+ if (enable)
+ OMAP_MCBSP_WRITE(io_base, XCCR, w & ~(XDISABLE));
+ else
+ OMAP_MCBSP_WRITE(io_base, XCCR, w | XDISABLE);
+}
+EXPORT_SYMBOL(omap_mcbsp_xmit_enable);
+
+void omap_mcbsp_recv_enable(unsigned int id, u8 enable)
+{
+ struct omap_mcbsp *mcbsp;
+ void __iomem *io_base;
+ u16 w;
+
+ if (!(cpu_is_omap2430() || cpu_is_omap34xx()))
+ return;
+
+ if (!omap_mcbsp_check_valid_id(id)) {
+ printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
+ return;
+ }
+
+ mcbsp = id_to_mcbsp_ptr(id);
+ io_base = mcbsp->io_base;
+
+ w = OMAP_MCBSP_READ(io_base, RCCR);
+
+ if (enable)
+ OMAP_MCBSP_WRITE(io_base, RCCR, w & ~(RDISABLE));
+ else
+ OMAP_MCBSP_WRITE(io_base, RCCR, w | RDISABLE);
+}
+EXPORT_SYMBOL(omap_mcbsp_recv_enable);
+
/* polled mcbsp i/o operations */
int omap_mcbsp_pollwrite(unsigned int id, u16 buf)
{
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCHv4 02/20] OMAP: McBSP: Add IRQEN, IRQSTATUS, THRESHOLD2 and THRESHOLD1 registers.
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 01/20] OMAP: McBSP: Provide functions for ASoC frame syncronization Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 13:53 ` Tony Lindgren
2009-08-17 11:51 ` [PATCHv4 03/20] OMAP: McBSP: Use appropriate value for startup delay Eduardo Valentin
` (18 subsequent siblings)
20 siblings, 1 reply; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: alsa-devel
Cc: Eduardo Valentin, Mark Brown, Ujfalusi Peter (Nokia-D/Tampere),
Nurkkala Eero.An (EXT-Offcode/Oulu), Linux-OMAP, ALSA-Devel
From: Eduardo Valentin <eduardo.valentin@nokia.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
arch/arm/plat-omap/include/mach/mcbsp.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h
index b85e6e6..ceaf9ee 100644
--- a/arch/arm/plat-omap/include/mach/mcbsp.h
+++ b/arch/arm/plat-omap/include/mach/mcbsp.h
@@ -134,6 +134,10 @@
#define OMAP_MCBSP_REG_XCERG 0x74
#define OMAP_MCBSP_REG_XCERH 0x78
#define OMAP_MCBSP_REG_SYSCON 0x8C
+#define OMAP_MCBSP_REG_THRSH2 0x90
+#define OMAP_MCBSP_REG_THRSH1 0x94
+#define OMAP_MCBSP_REG_IRQST 0xA0
+#define OMAP_MCBSP_REG_IRQEN 0xA4
#define OMAP_MCBSP_REG_XCCR 0xAC
#define OMAP_MCBSP_REG_RCCR 0xB0
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCHv4 02/20] OMAP: McBSP: Add IRQEN, IRQSTATUS, THRESHOLD2 and THRESHOLD1 registers.
2009-08-17 11:51 ` [PATCHv4 02/20] OMAP: McBSP: Add IRQEN, IRQSTATUS, THRESHOLD2 and THRESHOLD1 registers Eduardo Valentin
@ 2009-08-17 13:53 ` Tony Lindgren
2009-08-17 14:13 ` Eduardo Valentin
0 siblings, 1 reply; 38+ messages in thread
From: Tony Lindgren @ 2009-08-17 13:53 UTC (permalink / raw)
To: Eduardo Valentin
Cc: Takashi Iwai, Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown
* Eduardo Valentin <eduardo.valentin@nokia.com> [090817 15:06]:
> From: Eduardo Valentin <eduardo.valentin@nokia.com>
Needs a description.
Tony
> Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> ---
> arch/arm/plat-omap/include/mach/mcbsp.h | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h
> index b85e6e6..ceaf9ee 100644
> --- a/arch/arm/plat-omap/include/mach/mcbsp.h
> +++ b/arch/arm/plat-omap/include/mach/mcbsp.h
> @@ -134,6 +134,10 @@
> #define OMAP_MCBSP_REG_XCERG 0x74
> #define OMAP_MCBSP_REG_XCERH 0x78
> #define OMAP_MCBSP_REG_SYSCON 0x8C
> +#define OMAP_MCBSP_REG_THRSH2 0x90
> +#define OMAP_MCBSP_REG_THRSH1 0x94
> +#define OMAP_MCBSP_REG_IRQST 0xA0
> +#define OMAP_MCBSP_REG_IRQEN 0xA4
> #define OMAP_MCBSP_REG_XCCR 0xAC
> #define OMAP_MCBSP_REG_RCCR 0xB0
>
> --
> 1.6.2.GIT
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCHv4 02/20] OMAP: McBSP: Add IRQEN, IRQSTATUS, THRESHOLD2 and THRESHOLD1 registers.
2009-08-17 13:53 ` Tony Lindgren
@ 2009-08-17 14:13 ` Eduardo Valentin
0 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 14:13 UTC (permalink / raw)
To: ext Tony Lindgren
Cc: Linux-OMAP, ALSA-Devel, Takashi Iwai, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eduardo Valentin
From: Eduardo Valentin <eduardo.valentin@nokia.com>
Adding McBSP register definition for IRQEN, IRQSTATUS, THRESHOLD2 and THRESHOLD1 registers.
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
arch/arm/plat-omap/include/mach/mcbsp.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h
index b85e6e6..ceaf9ee 100644
--- a/arch/arm/plat-omap/include/mach/mcbsp.h
+++ b/arch/arm/plat-omap/include/mach/mcbsp.h
@@ -134,6 +134,10 @@
#define OMAP_MCBSP_REG_XCERG 0x74
#define OMAP_MCBSP_REG_XCERH 0x78
#define OMAP_MCBSP_REG_SYSCON 0x8C
+#define OMAP_MCBSP_REG_THRSH2 0x90
+#define OMAP_MCBSP_REG_THRSH1 0x94
+#define OMAP_MCBSP_REG_IRQST 0xA0
+#define OMAP_MCBSP_REG_IRQEN 0xA4
#define OMAP_MCBSP_REG_XCCR 0xAC
#define OMAP_MCBSP_REG_RCCR 0xB0
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCHv4 03/20] OMAP: McBSP: Use appropriate value for startup delay
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 01/20] OMAP: McBSP: Provide functions for ASoC frame syncronization Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 02/20] OMAP: McBSP: Add IRQEN, IRQSTATUS, THRESHOLD2 and THRESHOLD1 registers Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 13:56 ` Tony Lindgren
2009-08-17 11:51 ` [PATCHv4 04/20] OMAP: McBSP: Add transmit/receive threshold handler Eduardo Valentin
` (17 subsequent siblings)
20 siblings, 1 reply; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eduardo Valentin
From: Eduardo Valentin <eduardo.valentin@nokia.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
arch/arm/plat-omap/mcbsp.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 0aa2524..e9dd703 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -365,7 +365,13 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
w = OMAP_MCBSP_READ(io_base, SPCR1);
OMAP_MCBSP_WRITE(io_base, SPCR1, w | (rx & 1));
- udelay(100);
+ /*
+ * Worst case: CLKSRG*2 = 8000khz: (1/8000) * 2 * 2 usec
+ * REVISIT: 100us may give enough time for two CLKSRG, however
+ * due to some unknown PM related, clock gating etc. reason it
+ * is now at 500us.
+ */
+ udelay(500);
if (idle) {
/* Start frame sync */
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCHv4 03/20] OMAP: McBSP: Use appropriate value for startup delay
2009-08-17 11:51 ` [PATCHv4 03/20] OMAP: McBSP: Use appropriate value for startup delay Eduardo Valentin
@ 2009-08-17 13:56 ` Tony Lindgren
2009-08-17 14:09 ` [PATCHv5 " Eduardo Valentin
0 siblings, 1 reply; 38+ messages in thread
From: Tony Lindgren @ 2009-08-17 13:56 UTC (permalink / raw)
To: Eduardo Valentin
Cc: Takashi Iwai, Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown
* Eduardo Valentin <eduardo.valentin@nokia.com> [090817 15:06]:
> From: Eduardo Valentin <eduardo.valentin@nokia.com>
This too is missing a description.
Tony
> Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> ---
> arch/arm/plat-omap/mcbsp.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
> index 0aa2524..e9dd703 100644
> --- a/arch/arm/plat-omap/mcbsp.c
> +++ b/arch/arm/plat-omap/mcbsp.c
> @@ -365,7 +365,13 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
> w = OMAP_MCBSP_READ(io_base, SPCR1);
> OMAP_MCBSP_WRITE(io_base, SPCR1, w | (rx & 1));
>
> - udelay(100);
> + /*
> + * Worst case: CLKSRG*2 = 8000khz: (1/8000) * 2 * 2 usec
> + * REVISIT: 100us may give enough time for two CLKSRG, however
> + * due to some unknown PM related, clock gating etc. reason it
> + * is now at 500us.
> + */
> + udelay(500);
>
> if (idle) {
> /* Start frame sync */
> --
> 1.6.2.GIT
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 38+ messages in thread* [PATCHv5 03/20] OMAP: McBSP: Use appropriate value for startup delay
2009-08-17 13:56 ` Tony Lindgren
@ 2009-08-17 14:09 ` Eduardo Valentin
0 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 14:09 UTC (permalink / raw)
To: alsa-devel
Cc: Takashi Iwai, Eduardo Valentin, Mark Brown,
Ujfalusi Peter (Nokia-D/Tampere),
Nurkkala Eero.An (EXT-Offcode/Oulu), Linux-OMAP, ALSA-Devel
From: Eduardo Valentin <eduardo.valentin@nokia.com>
Increasing startup delay value as worst case:
CLKSRG*2 = 8000khz: (1/8000) * 2 * 2 usec
Although, 100us may give enough time for two CLKSRG,
due to some unknown PM related, clock gating etc. reason,
this patch increases it to 500us.
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
arch/arm/plat-omap/mcbsp.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 0aa2524..e9dd703 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -365,7 +365,13 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
w = OMAP_MCBSP_READ(io_base, SPCR1);
OMAP_MCBSP_WRITE(io_base, SPCR1, w | (rx & 1));
- udelay(100);
+ /*
+ * Worst case: CLKSRG*2 = 8000khz: (1/8000) * 2 * 2 usec
+ * REVISIT: 100us may give enough time for two CLKSRG, however
+ * due to some unknown PM related, clock gating etc. reason it
+ * is now at 500us.
+ */
+ udelay(500);
if (idle) {
/* Start frame sync */
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCHv4 04/20] OMAP: McBSP: Add transmit/receive threshold handler
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (2 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 03/20] OMAP: McBSP: Use appropriate value for startup delay Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 05/20] OMAP: McBSP: Create and export max_(r|t)x_thres property Eduardo Valentin
` (16 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eduardo Valentin
From: Eduardo Valentin <eduardo.valentin@nokia.com>
This patch adds a way to handle transmit/receive threshold.
It export to mcbsp users a callback registration procedure.
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
arch/arm/plat-omap/include/mach/mcbsp.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h
index ceaf9ee..2544aa5 100644
--- a/arch/arm/plat-omap/include/mach/mcbsp.h
+++ b/arch/arm/plat-omap/include/mach/mcbsp.h
@@ -389,6 +389,15 @@ int omap_mcbsp_init(void);
void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
int size);
void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config);
+#ifdef CONFIG_ARCH_OMAP34XX
+void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold);
+void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold);
+#else
+static inline void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
+{ }
+static inline void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
+{ }
+#endif
int omap_mcbsp_request(unsigned int id);
void omap_mcbsp_free(unsigned int id);
void omap_mcbsp_start(unsigned int id, int tx, int rx);
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCHv4 05/20] OMAP: McBSP: Create and export max_(r|t)x_thres property
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (3 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 04/20] OMAP: McBSP: Add transmit/receive threshold handler Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 06/20] OMAP3: McBSP: Lower the maximum buffersize for McBSP1,3,4,5 Eduardo Valentin
` (15 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eduardo Valentin
From: Eduardo Valentin <eduardo.valentin@nokia.com>
This patch export through sysfs two properties to configure
maximum threshold for transmission and reception on each
mcbsp instance. Also, it exports two helper functions to
allow mcbsp users to read this values.
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
arch/arm/mach-omap2/mcbsp.c | 5 +
arch/arm/plat-omap/include/mach/mcbsp.h | 11 ++
arch/arm/plat-omap/mcbsp.c | 172 +++++++++++++++++++++++++++++++
3 files changed, 188 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index a5c0f04..f837114 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -129,6 +129,7 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
.rx_irq = INT_24XX_MCBSP1_IRQ_RX,
.tx_irq = INT_24XX_MCBSP1_IRQ_TX,
.ops = &omap2_mcbsp_ops,
+ .buffer_size = 0x7F,
},
{
.phys_base = OMAP34XX_MCBSP2_BASE,
@@ -137,6 +138,7 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
.rx_irq = INT_24XX_MCBSP2_IRQ_RX,
.tx_irq = INT_24XX_MCBSP2_IRQ_TX,
.ops = &omap2_mcbsp_ops,
+ .buffer_size = 0x3FF,
},
{
.phys_base = OMAP34XX_MCBSP3_BASE,
@@ -145,6 +147,7 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
.rx_irq = INT_24XX_MCBSP3_IRQ_RX,
.tx_irq = INT_24XX_MCBSP3_IRQ_TX,
.ops = &omap2_mcbsp_ops,
+ .buffer_size = 0x7F,
},
{
.phys_base = OMAP34XX_MCBSP4_BASE,
@@ -153,6 +156,7 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
.rx_irq = INT_24XX_MCBSP4_IRQ_RX,
.tx_irq = INT_24XX_MCBSP4_IRQ_TX,
.ops = &omap2_mcbsp_ops,
+ .buffer_size = 0x7F,
},
{
.phys_base = OMAP34XX_MCBSP5_BASE,
@@ -161,6 +165,7 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
.rx_irq = INT_24XX_MCBSP5_IRQ_RX,
.tx_irq = INT_24XX_MCBSP5_IRQ_TX,
.ops = &omap2_mcbsp_ops,
+ .buffer_size = 0x7F,
},
};
#define OMAP34XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap34xx_mcbsp_pdata)
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h
index 2544aa5..832330d 100644
--- a/arch/arm/plat-omap/include/mach/mcbsp.h
+++ b/arch/arm/plat-omap/include/mach/mcbsp.h
@@ -348,6 +348,9 @@ struct omap_mcbsp_platform_data {
u8 dma_rx_sync, dma_tx_sync;
u16 rx_irq, tx_irq;
struct omap_mcbsp_ops *ops;
+#ifdef CONFIG_ARCH_OMAP34XX
+ u16 buffer_size;
+#endif
};
struct omap_mcbsp {
@@ -381,6 +384,10 @@ struct omap_mcbsp {
struct omap_mcbsp_platform_data *pdata;
struct clk *iclk;
struct clk *fclk;
+#ifdef CONFIG_ARCH_OMAP34XX
+ u16 max_tx_thres;
+ u16 max_rx_thres;
+#endif
};
extern struct omap_mcbsp **mcbsp_ptr;
extern int omap_mcbsp_count;
@@ -392,11 +399,15 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config
#ifdef CONFIG_ARCH_OMAP34XX
void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold);
void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold);
+u16 omap_mcbsp_get_max_tx_threshold(unsigned int id);
+u16 omap_mcbsp_get_max_rx_threshold(unsigned int id);
#else
static inline void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
{ }
static inline void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
{ }
+static inline u16 omap_mcbsp_get_max_tx_threshold(unsigned int id) { return 0; }
+static inline u16 omap_mcbsp_get_max_rx_threshold(unsigned int id) { return 0; }
#endif
int omap_mcbsp_request(unsigned int id);
void omap_mcbsp_free(unsigned int id);
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index e9dd703..0bbc912 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -198,6 +198,92 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
}
EXPORT_SYMBOL(omap_mcbsp_config);
+#ifdef CONFIG_ARCH_OMAP34XX
+/*
+ * omap_mcbsp_set_tx_threshold configures how to deal
+ * with transmit threshold. the threshold value and handler can be
+ * configure in here.
+ */
+void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
+{
+ struct omap_mcbsp *mcbsp;
+ void __iomem *io_base;
+
+ if (!cpu_is_omap34xx())
+ return;
+
+ if (!omap_mcbsp_check_valid_id(id)) {
+ printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
+ return;
+ }
+ mcbsp = id_to_mcbsp_ptr(id);
+ io_base = mcbsp->io_base;
+
+ OMAP_MCBSP_WRITE(io_base, THRSH2, threshold);
+}
+EXPORT_SYMBOL(omap_mcbsp_set_tx_threshold);
+
+/*
+ * omap_mcbsp_set_rx_threshold configures how to deal
+ * with receive threshold. the threshold value and handler can be
+ * configure in here.
+ */
+void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
+{
+ struct omap_mcbsp *mcbsp;
+ void __iomem *io_base;
+
+ if (!cpu_is_omap34xx())
+ return;
+
+ if (!omap_mcbsp_check_valid_id(id)) {
+ printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
+ return;
+ }
+ mcbsp = id_to_mcbsp_ptr(id);
+ io_base = mcbsp->io_base;
+
+ OMAP_MCBSP_WRITE(io_base, THRSH1, threshold);
+}
+EXPORT_SYMBOL(omap_mcbsp_set_rx_threshold);
+
+/*
+ * omap_mcbsp_get_max_tx_thres just return the current configured
+ * maximum threshold for transmission
+ */
+u16 omap_mcbsp_get_max_tx_threshold(unsigned int id)
+{
+ struct omap_mcbsp *mcbsp;
+
+ if (!omap_mcbsp_check_valid_id(id)) {
+ printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
+ return -ENODEV;
+ }
+ mcbsp = id_to_mcbsp_ptr(id);
+
+ return mcbsp->max_tx_thres;
+}
+EXPORT_SYMBOL(omap_mcbsp_get_max_tx_threshold);
+
+/*
+ * omap_mcbsp_get_max_rx_thres just return the current configured
+ * maximum threshold for reception
+ */
+u16 omap_mcbsp_get_max_rx_threshold(unsigned int id)
+{
+ struct omap_mcbsp *mcbsp;
+
+ if (!omap_mcbsp_check_valid_id(id)) {
+ printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
+ return -ENODEV;
+ }
+ mcbsp = id_to_mcbsp_ptr(id);
+
+ return mcbsp->max_rx_thres;
+}
+EXPORT_SYMBOL(omap_mcbsp_get_max_rx_threshold);
+#endif
+
/*
* We can choose between IRQ based or polled IO.
* This needs to be called before omap_mcbsp_request().
@@ -955,6 +1041,86 @@ void omap_mcbsp_set_spi_mode(unsigned int id,
}
EXPORT_SYMBOL(omap_mcbsp_set_spi_mode);
+#ifdef CONFIG_ARCH_OMAP34XX
+#define max_thres(m) (mcbsp->pdata->buffer_size)
+#define valid_threshold(m, val) ((val) <= max_thres(m))
+#define THRESHOLD_PROP_BUILDER(prop) \
+static ssize_t prop##_show(struct device *dev, \
+ struct device_attribute *attr, char *buf) \
+{ \
+ struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); \
+ \
+ return sprintf(buf, "%u\n", mcbsp->prop); \
+} \
+ \
+static ssize_t prop##_store(struct device *dev, \
+ struct device_attribute *attr, \
+ const char *buf, size_t size) \
+{ \
+ struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); \
+ unsigned long val; \
+ int status; \
+ \
+ status = strict_strtoul(buf, 0, &val); \
+ if (status) \
+ return status; \
+ \
+ if (!valid_threshold(mcbsp, val)) \
+ return -EDOM; \
+ \
+ mcbsp->prop = val; \
+ return size; \
+} \
+ \
+static DEVICE_ATTR(prop, 0644, prop##_show, prop##_store);
+
+THRESHOLD_PROP_BUILDER(max_tx_thres);
+THRESHOLD_PROP_BUILDER(max_rx_thres);
+
+static const struct attribute *threshold_attrs[] = {
+ &dev_attr_max_tx_thres.attr,
+ &dev_attr_max_rx_thres.attr,
+ NULL,
+};
+
+static const struct attribute_group threshold_attr_group = {
+ .attrs = (struct attribute **)threshold_attrs,
+};
+
+static inline int __devinit omap_thres_add(struct device *dev)
+{
+ return sysfs_create_group(&dev->kobj, &threshold_attr_group);
+}
+
+static inline void __devexit omap_thres_remove(struct device *dev)
+{
+ sysfs_remove_group(&dev->kobj, &threshold_attr_group);
+}
+
+static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp)
+{
+ if (cpu_is_omap34xx()) {
+ mcbsp->max_tx_thres = max_thres(mcbsp);
+ mcbsp->max_rx_thres = max_thres(mcbsp);
+ if (omap_thres_add(mcbsp->dev))
+ dev_warn(mcbsp->dev,
+ "Unable to create threshold controls\n");
+ } else {
+ mcbsp->max_tx_thres = -EINVAL;
+ mcbsp->max_rx_thres = -EINVAL;
+ }
+}
+
+static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp)
+{
+ if (cpu_is_omap34xx())
+ omap_thres_remove(mcbsp->dev);
+}
+#else
+static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp) {}
+static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp) {}
+#endif /* CONFIG_ARCH_OMAP34XX */
+
/*
* McBSP1 and McBSP3 are directly mapped on 1610 and 1510.
* 730 has only 2 McBSP, and both of them are MPU peripherals.
@@ -1025,6 +1191,10 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
mcbsp->dev = &pdev->dev;
mcbsp_ptr[id] = mcbsp;
platform_set_drvdata(pdev, mcbsp);
+
+ /* Initialize mcbsp properties for OMAP34XX if needed / applicable */
+ omap34xx_device_init(mcbsp);
+
return 0;
err_fclk:
@@ -1048,6 +1218,8 @@ static int __devexit omap_mcbsp_remove(struct platform_device *pdev)
mcbsp->pdata->ops->free)
mcbsp->pdata->ops->free(mcbsp->id);
+ omap34xx_device_exit(mcbsp);
+
clk_disable(mcbsp->fclk);
clk_disable(mcbsp->iclk);
clk_put(mcbsp->fclk);
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCHv4 06/20] OMAP3: McBSP: Lower the maximum buffersize for McBSP1,3,4,5
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (4 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 05/20] OMAP: McBSP: Create and export max_(r|t)x_thres property Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 07/20] OMAP: McBSP: Rename thres sysfs symbols Eduardo Valentin
` (14 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown
From: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Do not allow applications to use the full buffer found on
McBSP1,3,4,5. Using the full buffer in threshold mode causes
the McBSP buffer to run dry, which can be observed as channels
are switching (in reality the channels are shifting).
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
---
arch/arm/mach-omap2/mcbsp.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index f837114..7d22caf 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -129,7 +129,7 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
.rx_irq = INT_24XX_MCBSP1_IRQ_RX,
.tx_irq = INT_24XX_MCBSP1_IRQ_TX,
.ops = &omap2_mcbsp_ops,
- .buffer_size = 0x7F,
+ .buffer_size = 0x6F,
},
{
.phys_base = OMAP34XX_MCBSP2_BASE,
@@ -147,7 +147,7 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
.rx_irq = INT_24XX_MCBSP3_IRQ_RX,
.tx_irq = INT_24XX_MCBSP3_IRQ_TX,
.ops = &omap2_mcbsp_ops,
- .buffer_size = 0x7F,
+ .buffer_size = 0x6F,
},
{
.phys_base = OMAP34XX_MCBSP4_BASE,
@@ -156,7 +156,7 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
.rx_irq = INT_24XX_MCBSP4_IRQ_RX,
.tx_irq = INT_24XX_MCBSP4_IRQ_TX,
.ops = &omap2_mcbsp_ops,
- .buffer_size = 0x7F,
+ .buffer_size = 0x6F,
},
{
.phys_base = OMAP34XX_MCBSP5_BASE,
@@ -165,7 +165,7 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
.rx_irq = INT_24XX_MCBSP5_IRQ_RX,
.tx_irq = INT_24XX_MCBSP5_IRQ_TX,
.ops = &omap2_mcbsp_ops,
- .buffer_size = 0x7F,
+ .buffer_size = 0x6F,
},
};
#define OMAP34XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap34xx_mcbsp_pdata)
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCHv4 07/20] OMAP: McBSP: Rename thres sysfs symbols
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (5 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 06/20] OMAP3: McBSP: Lower the maximum buffersize for McBSP1,3,4,5 Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 08/20] OMAP: McBSP: Add link DMA mode selection Eduardo Valentin
` (13 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eduardo Valentin
From: Eduardo Valentin <eduardo.valentin@nokia.com>
This patch renames the symbols that handles threshold
sysfs properties. This way we can add more sysfs properties
to them.
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
arch/arm/plat-omap/mcbsp.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 0bbc912..ccaa9ae 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -1077,24 +1077,24 @@ static DEVICE_ATTR(prop, 0644, prop##_show, prop##_store);
THRESHOLD_PROP_BUILDER(max_tx_thres);
THRESHOLD_PROP_BUILDER(max_rx_thres);
-static const struct attribute *threshold_attrs[] = {
+static const struct attribute *additional_attrs[] = {
&dev_attr_max_tx_thres.attr,
&dev_attr_max_rx_thres.attr,
NULL,
};
-static const struct attribute_group threshold_attr_group = {
- .attrs = (struct attribute **)threshold_attrs,
+static const struct attribute_group additional_attr_group = {
+ .attrs = (struct attribute **)additional_attrs,
};
-static inline int __devinit omap_thres_add(struct device *dev)
+static inline int __devinit omap_additional_add(struct device *dev)
{
- return sysfs_create_group(&dev->kobj, &threshold_attr_group);
+ return sysfs_create_group(&dev->kobj, &additional_attr_group);
}
-static inline void __devexit omap_thres_remove(struct device *dev)
+static inline void __devexit omap_additional_remove(struct device *dev)
{
- sysfs_remove_group(&dev->kobj, &threshold_attr_group);
+ sysfs_remove_group(&dev->kobj, &additional_attr_group);
}
static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp)
@@ -1102,9 +1102,9 @@ static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp)
if (cpu_is_omap34xx()) {
mcbsp->max_tx_thres = max_thres(mcbsp);
mcbsp->max_rx_thres = max_thres(mcbsp);
- if (omap_thres_add(mcbsp->dev))
+ if (omap_additional_add(mcbsp->dev))
dev_warn(mcbsp->dev,
- "Unable to create threshold controls\n");
+ "Unable to create additional controls\n");
} else {
mcbsp->max_tx_thres = -EINVAL;
mcbsp->max_rx_thres = -EINVAL;
@@ -1114,7 +1114,7 @@ static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp)
static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp)
{
if (cpu_is_omap34xx())
- omap_thres_remove(mcbsp->dev);
+ omap_additional_remove(mcbsp->dev);
}
#else
static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp) {}
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCHv4 08/20] OMAP: McBSP: Add link DMA mode selection
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (6 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 07/20] OMAP: McBSP: Rename thres sysfs symbols Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 09/20] OMAP: McBSP: Wakeups utilized Eduardo Valentin
` (12 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eduardo Valentin
From: Peter Ujfalusi <peter.ujfalusi@nokia.com>
It adds a new sysfs file, where the user can configure the mcbsp mode to use.
If the mcbsp channel is in use, it does not allow the change.
Than in omap_pcm_open we can call the omap_mcbsp_get_opmode to get the mode,
store it, than use it to implement the different modes.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
arch/arm/plat-omap/include/mach/mcbsp.h | 8 +++
arch/arm/plat-omap/mcbsp.c | 84 +++++++++++++++++++++++++++++++
2 files changed, 92 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h
index 832330d..bd5b759 100644
--- a/arch/arm/plat-omap/include/mach/mcbsp.h
+++ b/arch/arm/plat-omap/include/mach/mcbsp.h
@@ -255,6 +255,11 @@
/********************** McBSP SYSCONFIG bit definitions ********************/
#define SOFTRST 0x0002
+/********************** McBSP DMA operating modes **************************/
+#define MCBSP_DMA_MODE_ELEMENT 0
+#define MCBSP_DMA_MODE_THRESHOLD 1
+#define MCBSP_DMA_MODE_FRAME 2
+
/* we don't do multichannel for now */
struct omap_mcbsp_reg_cfg {
u16 spcr2;
@@ -385,6 +390,7 @@ struct omap_mcbsp {
struct clk *iclk;
struct clk *fclk;
#ifdef CONFIG_ARCH_OMAP34XX
+ int dma_op_mode;
u16 max_tx_thres;
u16 max_rx_thres;
#endif
@@ -401,6 +407,7 @@ void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold);
void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold);
u16 omap_mcbsp_get_max_tx_threshold(unsigned int id);
u16 omap_mcbsp_get_max_rx_threshold(unsigned int id);
+int omap_mcbsp_get_dma_op_mode(unsigned int id);
#else
static inline void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
{ }
@@ -408,6 +415,7 @@ static inline void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
{ }
static inline u16 omap_mcbsp_get_max_tx_threshold(unsigned int id) { return 0; }
static inline u16 omap_mcbsp_get_max_rx_threshold(unsigned int id) { return 0; }
+static inline int omap_mcbsp_get_dma_op_mode(unsigned int id) { return 0; }
#endif
int omap_mcbsp_request(unsigned int id);
void omap_mcbsp_free(unsigned int id);
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index ccaa9ae..9e69994 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -282,6 +282,29 @@ u16 omap_mcbsp_get_max_rx_threshold(unsigned int id)
return mcbsp->max_rx_thres;
}
EXPORT_SYMBOL(omap_mcbsp_get_max_rx_threshold);
+
+/*
+ * omap_mcbsp_get_dma_op_mode just return the current configured
+ * operating mode for the mcbsp channel
+ */
+int omap_mcbsp_get_dma_op_mode(unsigned int id)
+{
+ struct omap_mcbsp *mcbsp;
+ int dma_op_mode;
+
+ if (!omap_mcbsp_check_valid_id(id)) {
+ printk(KERN_ERR "%s: Invalid id (%u)\n", __func__, id + 1);
+ return -ENODEV;
+ }
+ mcbsp = id_to_mcbsp_ptr(id);
+
+ spin_lock_irq(&mcbsp->lock);
+ dma_op_mode = mcbsp->dma_op_mode;
+ spin_unlock_irq(&mcbsp->lock);
+
+ return dma_op_mode;
+}
+EXPORT_SYMBOL(omap_mcbsp_get_dma_op_mode);
#endif
/*
@@ -1077,9 +1100,65 @@ static DEVICE_ATTR(prop, 0644, prop##_show, prop##_store);
THRESHOLD_PROP_BUILDER(max_tx_thres);
THRESHOLD_PROP_BUILDER(max_rx_thres);
+static ssize_t dma_op_mode_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct omap_mcbsp *mcbsp = dev_get_drvdata(dev);
+ int dma_op_mode;
+
+ spin_lock_irq(&mcbsp->lock);
+ dma_op_mode = mcbsp->dma_op_mode;
+ spin_unlock_irq(&mcbsp->lock);
+
+ return sprintf(buf, "current mode: %d\n"
+ "possible mode values are:\n"
+ "%d - %s\n"
+ "%d - %s\n"
+ "%d - %s\n",
+ dma_op_mode,
+ MCBSP_DMA_MODE_ELEMENT, "element mode",
+ MCBSP_DMA_MODE_THRESHOLD, "threshold mode",
+ MCBSP_DMA_MODE_FRAME, "frame mode");
+}
+
+static ssize_t dma_op_mode_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t size)
+{
+ struct omap_mcbsp *mcbsp = dev_get_drvdata(dev);
+ unsigned long val;
+ int status;
+
+ status = strict_strtoul(buf, 0, &val);
+ if (status)
+ return status;
+
+ spin_lock_irq(&mcbsp->lock);
+
+ if (!mcbsp->free) {
+ size = -EBUSY;
+ goto unlock;
+ }
+
+ if (val > MCBSP_DMA_MODE_FRAME || val < MCBSP_DMA_MODE_ELEMENT) {
+ size = -EINVAL;
+ goto unlock;
+ }
+
+ mcbsp->dma_op_mode = val;
+
+unlock:
+ spin_unlock_irq(&mcbsp->lock);
+
+ return size;
+}
+
+static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
+
static const struct attribute *additional_attrs[] = {
&dev_attr_max_tx_thres.attr,
&dev_attr_max_rx_thres.attr,
+ &dev_attr_dma_op_mode.attr,
NULL,
};
@@ -1099,9 +1178,14 @@ static inline void __devexit omap_additional_remove(struct device *dev)
static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp)
{
+ mcbsp->dma_op_mode = MCBSP_DMA_MODE_ELEMENT;
if (cpu_is_omap34xx()) {
mcbsp->max_tx_thres = max_thres(mcbsp);
mcbsp->max_rx_thres = max_thres(mcbsp);
+ /*
+ * REVISIT: Set dmap_op_mode to THRESHOLD as default
+ * for mcbsp2 instances.
+ */
if (omap_additional_add(mcbsp->dev))
dev_warn(mcbsp->dev,
"Unable to create additional controls\n");
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCHv4 09/20] OMAP: McBSP: Wakeups utilized
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (7 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 08/20] OMAP: McBSP: Add link DMA mode selection Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 10/20] OMAP: McBSP: Change wakeup signals Eduardo Valentin
` (11 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eero Nurkkala,
Eduardo Valentin
From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
This patch enables the smart idle mode while
McBPS is being utilized. Once it's done,
force idle mode is taken instead. Apart of it,
it also configures what signals will wake mcbsp up.
Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
arch/arm/plat-omap/include/mach/mcbsp.h | 17 +++++++++++
arch/arm/plat-omap/mcbsp.c | 46 +++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h
index bd5b759..333061d 100644
--- a/arch/arm/plat-omap/include/mach/mcbsp.h
+++ b/arch/arm/plat-omap/include/mach/mcbsp.h
@@ -138,6 +138,7 @@
#define OMAP_MCBSP_REG_THRSH1 0x94
#define OMAP_MCBSP_REG_IRQST 0xA0
#define OMAP_MCBSP_REG_IRQEN 0xA4
+#define OMAP_MCBSP_REG_WAKEUPEN 0xA8
#define OMAP_MCBSP_REG_XCCR 0xAC
#define OMAP_MCBSP_REG_RCCR 0xB0
@@ -253,6 +254,8 @@
#define RDISABLE 0x0001
/********************** McBSP SYSCONFIG bit definitions ********************/
+#define SIDLEMODE(value) ((value)<<3)
+#define ENAWAKEUP 0x0004
#define SOFTRST 0x0002
/********************** McBSP DMA operating modes **************************/
@@ -260,6 +263,20 @@
#define MCBSP_DMA_MODE_THRESHOLD 1
#define MCBSP_DMA_MODE_FRAME 2
+/********************** McBSP WAKEUPEN bit definitions *********************/
+#define XEMPTYEOFEN 0x4000
+#define XRDYEN 0x0400
+#define XEOFEN 0x0200
+#define XFSXEN 0x0100
+#define XSYNCERREN 0x0080
+#define RRDYEN 0x0008
+#define REOFEN 0x0004
+#define RFSREN 0x0002
+#define RSYNCERREN 0x0001
+#define WAKEUPEN_ALL (XEMPTYEOFEN | XRDYEN | XEOFEN | XFSXEN | \
+ XSYNCERREN | RRDYEN | REOFEN | RFSREN | \
+ RSYNCERREN)
+
/* we don't do multichannel for now */
struct omap_mcbsp_reg_cfg {
u16 spcr2;
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 9e69994..136f8c5 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -305,6 +305,46 @@ int omap_mcbsp_get_dma_op_mode(unsigned int id)
return dma_op_mode;
}
EXPORT_SYMBOL(omap_mcbsp_get_dma_op_mode);
+
+static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp)
+{
+ /*
+ * Enable wakup behavior, smart idle and all wakeups
+ * REVISIT: some wakeups may be unnecessary
+ */
+ if (cpu_is_omap34xx()) {
+ u16 syscon;
+
+ syscon = OMAP_MCBSP_READ(mcbsp->io_base, SYSCON);
+ syscon &= ~(ENAWAKEUP | SIDLEMODE(0x03));
+ syscon |= (ENAWAKEUP | SIDLEMODE(0x02));
+ OMAP_MCBSP_WRITE(mcbsp->io_base, SYSCON, syscon);
+
+ OMAP_MCBSP_WRITE(mcbsp->io_base, WAKEUPEN, WAKEUPEN_ALL);
+ }
+}
+
+static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp)
+{
+ /*
+ * Disable wakup behavior, smart idle and all wakeups
+ */
+ if (cpu_is_omap34xx()) {
+ u16 syscon;
+ u16 wakeupen;
+
+ syscon = OMAP_MCBSP_READ(mcbsp->io_base, SYSCON);
+ syscon &= ~(ENAWAKEUP | SIDLEMODE(0x03));
+ OMAP_MCBSP_WRITE(mcbsp->io_base, SYSCON, syscon);
+
+ wakeupen = OMAP_MCBSP_READ(mcbsp->io_base, WAKEUPEN);
+ wakeupen &= ~WAKEUPEN_ALL;
+ OMAP_MCBSP_WRITE(mcbsp->io_base, WAKEUPEN, wakeupen);
+ }
+}
+#else
+static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp) {}
+static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp) {}
#endif
/*
@@ -366,6 +406,9 @@ int omap_mcbsp_request(unsigned int id)
clk_enable(mcbsp->iclk);
clk_enable(mcbsp->fclk);
+ /* Do procedure specific to omap34xx arch, if applicable */
+ omap34xx_mcbsp_request(mcbsp);
+
/*
* Make sure that transmitter, receiver and sample-rate generator are
* not running before activating IRQs.
@@ -414,6 +457,9 @@ void omap_mcbsp_free(unsigned int id)
if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
mcbsp->pdata->ops->free(id);
+ /* Do procedure specific to omap34xx arch, if applicable */
+ omap34xx_mcbsp_free(mcbsp);
+
clk_disable(mcbsp->fclk);
clk_disable(mcbsp->iclk);
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCHv4 10/20] OMAP: McBSP: Change wakeup signals
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (8 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 09/20] OMAP: McBSP: Wakeups utilized Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 11/20] OMAP: McBSP: Retain McBSP FCLK clockactivity Eduardo Valentin
` (10 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eduardo Valentin
From: Eduardo Valentin <eduardo.valentin@nokia.com>
Configure only XRDYEN and RRDYEN wakeup signals
in order to get better power consumption.
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
arch/arm/plat-omap/include/mach/mcbsp.h | 3 ---
arch/arm/plat-omap/mcbsp.c | 7 ++-----
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h
index 333061d..fe10ae8 100644
--- a/arch/arm/plat-omap/include/mach/mcbsp.h
+++ b/arch/arm/plat-omap/include/mach/mcbsp.h
@@ -273,9 +273,6 @@
#define REOFEN 0x0004
#define RFSREN 0x0002
#define RSYNCERREN 0x0001
-#define WAKEUPEN_ALL (XEMPTYEOFEN | XRDYEN | XEOFEN | XFSXEN | \
- XSYNCERREN | RRDYEN | REOFEN | RFSREN | \
- RSYNCERREN)
/* we don't do multichannel for now */
struct omap_mcbsp_reg_cfg {
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 136f8c5..86bfad8 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -320,7 +320,7 @@ static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp)
syscon |= (ENAWAKEUP | SIDLEMODE(0x02));
OMAP_MCBSP_WRITE(mcbsp->io_base, SYSCON, syscon);
- OMAP_MCBSP_WRITE(mcbsp->io_base, WAKEUPEN, WAKEUPEN_ALL);
+ OMAP_MCBSP_WRITE(mcbsp->io_base, WAKEUPEN, XRDYEN | RRDYEN);
}
}
@@ -331,15 +331,12 @@ static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp)
*/
if (cpu_is_omap34xx()) {
u16 syscon;
- u16 wakeupen;
syscon = OMAP_MCBSP_READ(mcbsp->io_base, SYSCON);
syscon &= ~(ENAWAKEUP | SIDLEMODE(0x03));
OMAP_MCBSP_WRITE(mcbsp->io_base, SYSCON, syscon);
- wakeupen = OMAP_MCBSP_READ(mcbsp->io_base, WAKEUPEN);
- wakeupen &= ~WAKEUPEN_ALL;
- OMAP_MCBSP_WRITE(mcbsp->io_base, WAKEUPEN, wakeupen);
+ OMAP_MCBSP_WRITE(mcbsp->io_base, WAKEUPEN, 0);
}
}
#else
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCHv4 11/20] OMAP: McBSP: Retain McBSP FCLK clockactivity
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (9 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 10/20] OMAP: McBSP: Change wakeup signals Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 12/20] OMAP: McBSP: Configure NO IDLE mode for DMA mode different of threshold Eduardo Valentin
` (9 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eero Nurkkala,
Eduardo Valentin
From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
FCLK may get autogated so that it prevents the McBSP
to work properly. It is the bit 9 that must be set
for maintaining the McBSP FCLK.
Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
Acked-by: Jarkko Nikula <jarkko.nikula@nokia.com>
---
arch/arm/plat-omap/include/mach/mcbsp.h | 1 +
arch/arm/plat-omap/mcbsp.c | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h
index fe10ae8..70e950e 100644
--- a/arch/arm/plat-omap/include/mach/mcbsp.h
+++ b/arch/arm/plat-omap/include/mach/mcbsp.h
@@ -254,6 +254,7 @@
#define RDISABLE 0x0001
/********************** McBSP SYSCONFIG bit definitions ********************/
+#define CLOCKACTIVITY(value) ((value)<<8)
#define SIDLEMODE(value) ((value)<<3)
#define ENAWAKEUP 0x0004
#define SOFTRST 0x0002
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 86bfad8..2c274e6 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -316,8 +316,8 @@ static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp)
u16 syscon;
syscon = OMAP_MCBSP_READ(mcbsp->io_base, SYSCON);
- syscon &= ~(ENAWAKEUP | SIDLEMODE(0x03));
- syscon |= (ENAWAKEUP | SIDLEMODE(0x02));
+ syscon &= ~(ENAWAKEUP | SIDLEMODE(0x03) | CLOCKACTIVITY(0x03));
+ syscon |= (ENAWAKEUP | SIDLEMODE(0x02) | CLOCKACTIVITY(0x02));
OMAP_MCBSP_WRITE(mcbsp->io_base, SYSCON, syscon);
OMAP_MCBSP_WRITE(mcbsp->io_base, WAKEUPEN, XRDYEN | RRDYEN);
@@ -333,7 +333,7 @@ static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp)
u16 syscon;
syscon = OMAP_MCBSP_READ(mcbsp->io_base, SYSCON);
- syscon &= ~(ENAWAKEUP | SIDLEMODE(0x03));
+ syscon &= ~(ENAWAKEUP | SIDLEMODE(0x03) | CLOCKACTIVITY(0x03));
OMAP_MCBSP_WRITE(mcbsp->io_base, SYSCON, syscon);
OMAP_MCBSP_WRITE(mcbsp->io_base, WAKEUPEN, 0);
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCHv4 12/20] OMAP: McBSP: Configure NO IDLE mode for DMA mode different of threshold
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (10 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 11/20] OMAP: McBSP: Retain McBSP FCLK clockactivity Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 13/20] OMAP: McBSP: Do not enable wakeups for no-idle mode Eduardo Valentin
` (8 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eduardo Valentin
From: Eduardo Valentin <eduardo.valentin@nokia.com>
Use dma mode property to configure NO IDLE or SMART IDLE of McBSPs.
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
arch/arm/plat-omap/mcbsp.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 2c274e6..85176a5 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -317,7 +317,15 @@ static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp)
syscon = OMAP_MCBSP_READ(mcbsp->io_base, SYSCON);
syscon &= ~(ENAWAKEUP | SIDLEMODE(0x03) | CLOCKACTIVITY(0x03));
- syscon |= (ENAWAKEUP | SIDLEMODE(0x02) | CLOCKACTIVITY(0x02));
+
+ spin_lock_irq(&mcbsp->lock);
+ if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD)
+ syscon |= SIDLEMODE(0x02);
+ else
+ syscon |= SIDLEMODE(0x01);
+ spin_unlock_irq(&mcbsp->lock);
+
+ syscon |= (ENAWAKEUP | CLOCKACTIVITY(0x02));
OMAP_MCBSP_WRITE(mcbsp->io_base, SYSCON, syscon);
OMAP_MCBSP_WRITE(mcbsp->io_base, WAKEUPEN, XRDYEN | RRDYEN);
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCHv4 13/20] OMAP: McBSP: Do not enable wakeups for no-idle mode
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (11 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 12/20] OMAP: McBSP: Configure NO IDLE mode for DMA mode different of threshold Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 14/20] OMAP: McBSP: Let element DMA mode hit retention also Eduardo Valentin
` (7 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eero Nurkkala
From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
When no-idle mode is taken, wakeups need not to be enabled.
Moreover, CLOCKACTIVITY bits are unnecessary with this mode
also.
Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
Acked-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
arch/arm/plat-omap/mcbsp.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 85176a5..56a5688 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -319,16 +319,17 @@ static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp)
syscon &= ~(ENAWAKEUP | SIDLEMODE(0x03) | CLOCKACTIVITY(0x03));
spin_lock_irq(&mcbsp->lock);
- if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD)
- syscon |= SIDLEMODE(0x02);
- else
+ if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) {
+ syscon |= (ENAWAKEUP | SIDLEMODE(0x02) |
+ CLOCKACTIVITY(0x02));
+ OMAP_MCBSP_WRITE(mcbsp->io_base, WAKEUPEN,
+ XRDYEN | RRDYEN);
+ } else {
syscon |= SIDLEMODE(0x01);
+ }
spin_unlock_irq(&mcbsp->lock);
- syscon |= (ENAWAKEUP | CLOCKACTIVITY(0x02));
OMAP_MCBSP_WRITE(mcbsp->io_base, SYSCON, syscon);
-
- OMAP_MCBSP_WRITE(mcbsp->io_base, WAKEUPEN, XRDYEN | RRDYEN);
}
}
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCHv4 14/20] OMAP: McBSP: Let element DMA mode hit retention also
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (12 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 13/20] OMAP: McBSP: Do not enable wakeups for no-idle mode Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 15/20] ASoC: OMAP: Make DMA 64 aligned Eduardo Valentin
` (6 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eero Nurkkala
From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
The device no longer hits retention if element DMA
mode is taken for at least the duration of the
serial console timeout. Force element DMA mode to
shut down through smartidle.
Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
Acked-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
arch/arm/plat-omap/mcbsp.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 56a5688..b63a720 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -343,6 +343,15 @@ static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp)
syscon = OMAP_MCBSP_READ(mcbsp->io_base, SYSCON);
syscon &= ~(ENAWAKEUP | SIDLEMODE(0x03) | CLOCKACTIVITY(0x03));
+ /*
+ * HW bug workaround - If no_idle mode is taken, we need to
+ * go to smart_idle before going to always_idle, or the
+ * device will not hit retention anymore.
+ */
+ syscon |= SIDLEMODE(0x02);
+ OMAP_MCBSP_WRITE(mcbsp->io_base, SYSCON, syscon);
+
+ syscon &= ~(SIDLEMODE(0x03));
OMAP_MCBSP_WRITE(mcbsp->io_base, SYSCON, syscon);
OMAP_MCBSP_WRITE(mcbsp->io_base, WAKEUPEN, 0);
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCHv4 15/20] ASoC: OMAP: Make DMA 64 aligned
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (13 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 14/20] OMAP: McBSP: Let element DMA mode hit retention also Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 14:00 ` Tony Lindgren
2009-08-17 11:51 ` [PATCHv4 16/20] ASoC: OMAP: Enable DMA burst mode Eduardo Valentin
` (5 subsequent siblings)
20 siblings, 1 reply; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eduardo Valentin
From: Eduardo Valentin <eduardo.valentin@nokia.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
sound/soc/omap/omap-pcm.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index dd9e728..f769a52 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -305,7 +305,7 @@ static struct snd_pcm_ops omap_pcm_ops = {
.mmap = omap_pcm_mmap,
};
-static u64 omap_pcm_dmamask = DMA_BIT_MASK(32);
+static u64 omap_pcm_dmamask = DMA_BIT_MASK(64);
static int omap_pcm_preallocate_dma_buffer(struct snd_pcm *pcm,
int stream)
@@ -355,7 +355,7 @@ static int omap_pcm_new(struct snd_card *card, struct snd_soc_dai *dai,
if (!card->dev->dma_mask)
card->dev->dma_mask = &omap_pcm_dmamask;
if (!card->dev->coherent_dma_mask)
- card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
+ card->dev->coherent_dma_mask = DMA_BIT_MASK(64);
if (dai->playback.channels_min) {
ret = omap_pcm_preallocate_dma_buffer(pcm,
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCHv4 15/20] ASoC: OMAP: Make DMA 64 aligned
2009-08-17 11:51 ` [PATCHv4 15/20] ASoC: OMAP: Make DMA 64 aligned Eduardo Valentin
@ 2009-08-17 14:00 ` Tony Lindgren
2009-08-17 14:35 ` Eduardo Valentin
0 siblings, 1 reply; 38+ messages in thread
From: Tony Lindgren @ 2009-08-17 14:00 UTC (permalink / raw)
To: Eduardo Valentin
Cc: Takashi Iwai, Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown
* Eduardo Valentin <eduardo.valentin@nokia.com> [090817 15:06]:
> From: Eduardo Valentin <eduardo.valentin@nokia.com>
Description?
> Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> ---
> sound/soc/omap/omap-pcm.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
> index dd9e728..f769a52 100644
> --- a/sound/soc/omap/omap-pcm.c
> +++ b/sound/soc/omap/omap-pcm.c
> @@ -305,7 +305,7 @@ static struct snd_pcm_ops omap_pcm_ops = {
> .mmap = omap_pcm_mmap,
> };
>
> -static u64 omap_pcm_dmamask = DMA_BIT_MASK(32);
> +static u64 omap_pcm_dmamask = DMA_BIT_MASK(64);
>
> static int omap_pcm_preallocate_dma_buffer(struct snd_pcm *pcm,
> int stream)
> @@ -355,7 +355,7 @@ static int omap_pcm_new(struct snd_card *card, struct snd_soc_dai *dai,
> if (!card->dev->dma_mask)
> card->dev->dma_mask = &omap_pcm_dmamask;
> if (!card->dev->coherent_dma_mask)
> - card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
> + card->dev->coherent_dma_mask = DMA_BIT_MASK(64);
>
> if (dai->playback.channels_min) {
> ret = omap_pcm_preallocate_dma_buffer(pcm,
> --
> 1.6.2.GIT
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 38+ messages in thread* [PATCHv4 15/20] ASoC: OMAP: Make DMA 64 aligned
2009-08-17 14:00 ` Tony Lindgren
@ 2009-08-17 14:35 ` Eduardo Valentin
0 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 14:35 UTC (permalink / raw)
To: alsa-devel
Cc: Takashi Iwai, Eduardo Valentin, Mark Brown,
Ujfalusi Peter (Nokia-D/Tampere),
Nurkkala Eero.An (EXT-Offcode/Oulu), Linux-OMAP, ALSA-Devel
From: Eduardo Valentin <eduardo.valentin@nokia.com>
Align DMA address to DMA burst transaction sizes.
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
sound/soc/omap/omap-pcm.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index dd9e728..f769a52 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -305,7 +305,7 @@ static struct snd_pcm_ops omap_pcm_ops = {
.mmap = omap_pcm_mmap,
};
-static u64 omap_pcm_dmamask = DMA_BIT_MASK(32);
+static u64 omap_pcm_dmamask = DMA_BIT_MASK(64);
static int omap_pcm_preallocate_dma_buffer(struct snd_pcm *pcm,
int stream)
@@ -355,7 +355,7 @@ static int omap_pcm_new(struct snd_card *card, struct snd_soc_dai *dai,
if (!card->dev->dma_mask)
card->dev->dma_mask = &omap_pcm_dmamask;
if (!card->dev->coherent_dma_mask)
- card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
+ card->dev->coherent_dma_mask = DMA_BIT_MASK(64);
if (dai->playback.channels_min) {
ret = omap_pcm_preallocate_dma_buffer(pcm,
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCHv4 16/20] ASoC: OMAP: Enable DMA burst mode
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (14 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 15/20] ASoC: OMAP: Make DMA 64 aligned Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 13:25 ` Jarkko Nikula
2009-08-17 11:51 ` [PATCHv4 17/20] ASoC: Add runtime check for RFIG and XFIG Eduardo Valentin
` (4 subsequent siblings)
20 siblings, 1 reply; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eduardo Valentin
From: Eduardo Valentin <eduardo.valentin@nokia.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
sound/soc/omap/omap-pcm.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index f769a52..f037db0 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -193,6 +193,9 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream)
omap_enable_dma_irq(prtd->dma_ch, OMAP_DMA_FRAME_IRQ |
(cpu_is_omap1510() ? OMAP_DMA_LAST_IRQ : 0));
+ omap_set_dma_src_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
+ omap_set_dma_dest_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
+
return 0;
}
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCHv4 16/20] ASoC: OMAP: Enable DMA burst mode
2009-08-17 11:51 ` [PATCHv4 16/20] ASoC: OMAP: Enable DMA burst mode Eduardo Valentin
@ 2009-08-17 13:25 ` Jarkko Nikula
2009-08-17 14:01 ` Tony Lindgren
0 siblings, 1 reply; 38+ messages in thread
From: Jarkko Nikula @ 2009-08-17 13:25 UTC (permalink / raw)
To: Eduardo Valentin
Cc: Takashi Iwai, Linux-OMAP, ALSA-Devel,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown
[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]
On Mon, 17 Aug 2009 14:51:15 +0300
Eduardo Valentin <eduardo.valentin@nokia.com> wrote:
> From: Eduardo Valentin <eduardo.valentin@nokia.com>
>
> Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> ---
> sound/soc/omap/omap-pcm.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
> index f769a52..f037db0 100644
> --- a/sound/soc/omap/omap-pcm.c
> +++ b/sound/soc/omap/omap-pcm.c
> @@ -193,6 +193,9 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream)
> omap_enable_dma_irq(prtd->dma_ch, OMAP_DMA_FRAME_IRQ |
> (cpu_is_omap1510() ? OMAP_DMA_LAST_IRQ : 0));
>
> + omap_set_dma_src_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
> + omap_set_dma_dest_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
> +
> return 0;
This seems to be based on first version of Janusz's "[RFC] [PATCH 3/3]
ASoC: OMAP: Enhance OMAP1510 DMA progress software counter".
I Attached a version which is based on "[PATCH 3/3 v3] ASoC: OMAP:
Enhance OMAP1510 DMA progress software counter.
--
Jarkko
[-- Attachment #2: 0001-ASoC-OMAP-Enable-DMA-burst-mode.patch --]
[-- Type: text/x-diff, Size: 852 bytes --]
>From a5eb199316c4731c11c7f5f8d02612ede4de7199 Mon Sep 17 00:00:00 2001
From: Eduardo Valentin <eduardo.valentin@nokia.com>
Date: Mon, 17 Aug 2009 14:51:15 +0300
Subject: [PATCH] ASoC: OMAP: Enable DMA burst mode
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
sound/soc/omap/omap-pcm.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index eab4533..b9633d5 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -195,6 +195,9 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream)
else
omap_enable_dma_irq(prtd->dma_ch, OMAP_DMA_FRAME_IRQ);
+ omap_set_dma_src_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
+ omap_set_dma_dest_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
+
return 0;
}
--
1.6.3.3
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCHv4 16/20] ASoC: OMAP: Enable DMA burst mode
2009-08-17 13:25 ` Jarkko Nikula
@ 2009-08-17 14:01 ` Tony Lindgren
2009-08-17 14:29 ` [PATCH] " Eduardo Valentin
2009-08-17 14:39 ` [PATCHv4 16/20] " Eduardo Valentin
0 siblings, 2 replies; 38+ messages in thread
From: Tony Lindgren @ 2009-08-17 14:01 UTC (permalink / raw)
To: Jarkko Nikula
Cc: Eduardo Valentin, Takashi Iwai, Linux-OMAP, ALSA-Devel,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown
* Jarkko Nikula <jhnikula@gmail.com> [090817 16:23]:
> On Mon, 17 Aug 2009 14:51:15 +0300
> Eduardo Valentin <eduardo.valentin@nokia.com> wrote:
>
> > From: Eduardo Valentin <eduardo.valentin@nokia.com>
> >
> > Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> > ---
> > sound/soc/omap/omap-pcm.c | 3 +++
> > 1 files changed, 3 insertions(+), 0 deletions(-)
> >
> > diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
> > index f769a52..f037db0 100644
> > --- a/sound/soc/omap/omap-pcm.c
> > +++ b/sound/soc/omap/omap-pcm.c
> > @@ -193,6 +193,9 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream)
> > omap_enable_dma_irq(prtd->dma_ch, OMAP_DMA_FRAME_IRQ |
> > (cpu_is_omap1510() ? OMAP_DMA_LAST_IRQ : 0));
> >
> > + omap_set_dma_src_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
> > + omap_set_dma_dest_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
> > +
> > return 0;
>
> This seems to be based on first version of Janusz's "[RFC] [PATCH 3/3]
> ASoC: OMAP: Enhance OMAP1510 DMA progress software counter".
>
> I Attached a version which is based on "[PATCH 3/3 v3] ASoC: OMAP:
> Enhance OMAP1510 DMA progress software counter.
Needs also a patch description.
Tony
>
>
> --
> Jarkko
> From a5eb199316c4731c11c7f5f8d02612ede4de7199 Mon Sep 17 00:00:00 2001
> From: Eduardo Valentin <eduardo.valentin@nokia.com>
> Date: Mon, 17 Aug 2009 14:51:15 +0300
> Subject: [PATCH] ASoC: OMAP: Enable DMA burst mode
>
> Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> ---
> sound/soc/omap/omap-pcm.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
> index eab4533..b9633d5 100644
> --- a/sound/soc/omap/omap-pcm.c
> +++ b/sound/soc/omap/omap-pcm.c
> @@ -195,6 +195,9 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream)
> else
> omap_enable_dma_irq(prtd->dma_ch, OMAP_DMA_FRAME_IRQ);
>
> + omap_set_dma_src_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
> + omap_set_dma_dest_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
> +
> return 0;
> }
>
> --
> 1.6.3.3
>
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH] ASoC: OMAP: Enable DMA burst mode
2009-08-17 14:01 ` Tony Lindgren
@ 2009-08-17 14:29 ` Eduardo Valentin
2009-08-17 14:39 ` [PATCHv4 16/20] " Eduardo Valentin
1 sibling, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 14:29 UTC (permalink / raw)
To: alsa-devel
Cc: Takashi Iwai, Eduardo Valentin, Mark Brown,
Ujfalusi Peter (Nokia-D/Tampere),
Nurkkala Eero.An (EXT-Offcode/Oulu), Linux-OMAP, ALSA-Devel
From: Eduardo Valentin <eduardo.valentin@nokia.com>
Improve DMA transfers by enabling Burst transaction.
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
sound/soc/omap/omap-pcm.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index eab4533..b9633d5 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -195,6 +195,9 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream)
else
omap_enable_dma_irq(prtd->dma_ch, OMAP_DMA_FRAME_IRQ);
+ omap_set_dma_src_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
+ omap_set_dma_dest_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
+
return 0;
}
--
1.6.3.3
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCHv4 16/20] ASoC: OMAP: Enable DMA burst mode
2009-08-17 14:01 ` Tony Lindgren
2009-08-17 14:29 ` [PATCH] " Eduardo Valentin
@ 2009-08-17 14:39 ` Eduardo Valentin
1 sibling, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 14:39 UTC (permalink / raw)
To: ext Tony Lindgren
Cc: Jarkko Nikula, Valentin Eduardo (Nokia-D/Helsinki), Takashi Iwai,
Linux-OMAP, ALSA-Devel, Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown
Hi Tony
On Mon, Aug 17, 2009 at 04:01:29PM +0200, ext Tony Lindgren wrote:
> * Jarkko Nikula <jhnikula@gmail.com> [090817 16:23]:
> > On Mon, 17 Aug 2009 14:51:15 +0300
> > Eduardo Valentin <eduardo.valentin@nokia.com> wrote:
> >
> > > From: Eduardo Valentin <eduardo.valentin@nokia.com>
> > >
> > > Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> > > ---
> > > sound/soc/omap/omap-pcm.c | 3 +++
> > > 1 files changed, 3 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
> > > index f769a52..f037db0 100644
> > > --- a/sound/soc/omap/omap-pcm.c
> > > +++ b/sound/soc/omap/omap-pcm.c
> > > @@ -193,6 +193,9 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream)
> > > omap_enable_dma_irq(prtd->dma_ch, OMAP_DMA_FRAME_IRQ |
> > > (cpu_is_omap1510() ? OMAP_DMA_LAST_IRQ : 0));
> > >
> > > + omap_set_dma_src_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
> > > + omap_set_dma_dest_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
> > > +
> > > return 0;
> >
> > This seems to be based on first version of Janusz's "[RFC] [PATCH 3/3]
> > ASoC: OMAP: Enhance OMAP1510 DMA progress software counter".
> >
> > I Attached a version which is based on "[PATCH 3/3 v3] ASoC: OMAP:
> > Enhance OMAP1510 DMA progress software counter.
>
> Needs also a patch description.
I've added patch description for those which were missing and sent them
in reply to your commented reply. If you prefer I can send version 5 of this series.
BR,
>
> Tony
>
> >
> >
> > --
> > Jarkko
>
> > From a5eb199316c4731c11c7f5f8d02612ede4de7199 Mon Sep 17 00:00:00 2001
> > From: Eduardo Valentin <eduardo.valentin@nokia.com>
> > Date: Mon, 17 Aug 2009 14:51:15 +0300
> > Subject: [PATCH] ASoC: OMAP: Enable DMA burst mode
> >
> > Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> > ---
> > sound/soc/omap/omap-pcm.c | 3 +++
> > 1 files changed, 3 insertions(+), 0 deletions(-)
> >
> > diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
> > index eab4533..b9633d5 100644
> > --- a/sound/soc/omap/omap-pcm.c
> > +++ b/sound/soc/omap/omap-pcm.c
> > @@ -195,6 +195,9 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream)
> > else
> > omap_enable_dma_irq(prtd->dma_ch, OMAP_DMA_FRAME_IRQ);
> >
> > + omap_set_dma_src_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
> > + omap_set_dma_dest_burst_mode(prtd->dma_ch, OMAP_DMA_DATA_BURST_16);
> > +
> > return 0;
> > }
> >
> > --
> > 1.6.3.3
> >
>
> --
> To unsubscribe from this list: send the line "unsubscribe alsa-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Eduardo Valentin
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCHv4 17/20] ASoC: Add runtime check for RFIG and XFIG
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (15 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 16/20] ASoC: OMAP: Enable DMA burst mode Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 18/20] ASoC: Always syncronize audio transfers on frames Eduardo Valentin
` (3 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eero Nurkkala
From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
This is, no RFIG or XFIG (Not defined in 34xx), correct
initiliazation of rccr and xccr.
Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
---
sound/soc/omap/omap-mcbsp.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 6a837ff..a7b0961 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -321,8 +321,11 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai,
/* Generic McBSP register settings */
regs->spcr2 |= XINTM(3) | FREE;
regs->spcr1 |= RINTM(3);
- regs->rcr2 |= RFIG;
- regs->xcr2 |= XFIG;
+ /* RFIG and XFIG are not defined in 34xx */
+ if (!cpu_is_omap34xx()) {
+ regs->rcr2 |= RFIG;
+ regs->xcr2 |= XFIG;
+ }
if (cpu_is_omap2430() || cpu_is_omap34xx()) {
regs->xccr = DXENDLY(1) | XDMAEN;
regs->rccr = RFULL_CYCLE | RDMAEN;
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCHv4 18/20] ASoC: Always syncronize audio transfers on frames
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (16 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 17/20] ASoC: Add runtime check for RFIG and XFIG Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 19/20] ASoC: OMAP: Use McBSP threshold to playback and capture Eduardo Valentin
` (2 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eero Nurkkala
From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
All these steps are required for ASoC to behave correctly.
rccr and xccr are format dependent, for example TDM audio
has different values than I2S or DSP_A. Also the
omap_mcbsp_xmit_enable and/or omap_mcbsp_recv_enable must
be called right after the DMA has started.
This provides no longer L and R channels switching at random.
Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
---
sound/soc/omap/omap-mcbsp.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index a7b0961..76c32f8 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -189,8 +189,12 @@ static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- mcbsp_data->active++;
omap_mcbsp_start(mcbsp_data->bus_id, play, !play);
+ /* Make sure data transfer is frame synchronized */
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ omap_mcbsp_xmit_enable(mcbsp_data->bus_id, 1);
+ else
+ omap_mcbsp_recv_enable(mcbsp_data->bus_id, 1);
break;
case SNDRV_PCM_TRIGGER_STOP:
@@ -336,11 +340,15 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai,
/* 1-bit data delay */
regs->rcr2 |= RDATDLY(1);
regs->xcr2 |= XDATDLY(1);
+ regs->rccr |= RFULL_CYCLE | RDMAEN | RDISABLE;
+ regs->xccr |= (DXENDLY(1) | XDMAEN | XDISABLE);
break;
case SND_SOC_DAIFMT_DSP_A:
/* 1-bit data delay */
regs->rcr2 |= RDATDLY(1);
regs->xcr2 |= XDATDLY(1);
+ regs->rccr |= RFULL_CYCLE | RDMAEN | RDISABLE;
+ regs->xccr |= (DXENDLY(1) | XDMAEN | XDISABLE);
/* Invert FS polarity configuration */
temp_fmt ^= SND_SOC_DAIFMT_NB_IF;
break;
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCHv4 19/20] ASoC: OMAP: Use McBSP threshold to playback and capture
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (17 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 18/20] ASoC: Always syncronize audio transfers on frames Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 11:51 ` [PATCHv4 20/20] ASoC: OMAP: Use DMA operating mode of McBSP Eduardo Valentin
2009-08-17 14:05 ` [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Jarkko Nikula
20 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eduardo Valentin
From: Eduardo Valentin <eduardo.valentin@nokia.com>
This patch changes the way DMA is done in omap-pcm.c
in order to reduce power consumption. There is no need
to have so much SW control in order to have DMA in idle
state during audio streaming. Configuring McBSP threshold value
and DMA to FRAME_SYNC are sufficient.
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
sound/soc/omap/omap-mcbsp.c | 47 +++++++++++++++++++++++++++++++++++++-----
sound/soc/omap/omap-pcm.c | 7 +++++-
sound/soc/omap/omap-pcm.h | 2 +
3 files changed, 49 insertions(+), 7 deletions(-)
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 76c32f8..2aec7a6 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -139,28 +139,59 @@ static const unsigned long omap34xx_mcbsp_port[][2] = {
static const unsigned long omap34xx_mcbsp_port[][2] = {};
#endif
+static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+ struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
+ int samples = snd_pcm_lib_period_bytes(substream) >> 1;
+
+ /* Configure McBSP internal buffer usage */
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ omap_mcbsp_set_tx_threshold(mcbsp_data->bus_id, samples - 1);
+ else
+ omap_mcbsp_set_rx_threshold(mcbsp_data->bus_id, samples - 1);
+}
+
static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
+ int bus_id = mcbsp_data->bus_id;
int err = 0;
- if (cpu_is_omap343x() && mcbsp_data->bus_id == 1) {
+ if (!cpu_dai->active)
+ err = omap_mcbsp_request(bus_id);
+
+ if (cpu_is_omap343x()) {
+ int max_period;
+
/*
* McBSP2 in OMAP3 has 1024 * 32-bit internal audio buffer.
* Set constraint for minimum buffer size to the same than FIFO
* size in order to avoid underruns in playback startup because
* HW is keeping the DMA request active until FIFO is filled.
*/
+ if (bus_id == 1)
+ snd_pcm_hw_constraint_minmax(substream->runtime,
+ SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
+ 4096, UINT_MAX);
+
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ max_period = omap_mcbsp_get_max_tx_threshold(bus_id);
+ else
+ max_period = omap_mcbsp_get_max_rx_threshold(bus_id);
+
+ max_period++;
+ max_period <<= 1;
+
snd_pcm_hw_constraint_minmax(substream->runtime,
- SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 4096, UINT_MAX);
+ SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
+ 32, max_period);
}
- if (!cpu_dai->active)
- err = omap_mcbsp_request(mcbsp_data->bus_id);
-
return err;
}
@@ -219,7 +250,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
int dma, bus_id = mcbsp_data->bus_id, id = cpu_dai->id;
- int wlen, channels, wpf;
+ int wlen, channels, wpf, sync_mode = OMAP_DMA_SYNC_ELEMENT;
unsigned long port;
unsigned int format;
@@ -235,6 +266,9 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
} else if (cpu_is_omap343x()) {
dma = omap24xx_dma_reqs[bus_id][substream->stream];
port = omap34xx_mcbsp_port[bus_id][substream->stream];
+ omap_mcbsp_dai_dma_params[id][substream->stream].set_threshold =
+ omap_mcbsp_set_threshold;
+ sync_mode = OMAP_DMA_SYNC_FRAME;
} else {
return -ENODEV;
}
@@ -242,6 +276,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
substream->stream ? "Audio Capture" : "Audio Playback";
omap_mcbsp_dai_dma_params[id][substream->stream].dma_req = dma;
omap_mcbsp_dai_dma_params[id][substream->stream].port_addr = port;
+ omap_mcbsp_dai_dma_params[id][substream->stream].sync_mode = sync_mode;
cpu_dai->dma_data = &omap_mcbsp_dai_dma_params[id][substream->stream];
if (mcbsp_data->configured) {
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index f037db0..7ebd169 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -164,7 +164,7 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream)
*/
dma_params.data_type = OMAP_DMA_DATA_TYPE_S16;
dma_params.trigger = dma_data->dma_req;
- dma_params.sync_mode = OMAP_DMA_SYNC_ELEMENT;
+ dma_params.sync_mode = dma_data->sync_mode;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
dma_params.src_amode = OMAP_DMA_AMODE_POST_INC;
dma_params.dst_amode = OMAP_DMA_AMODE_CONSTANT;
@@ -203,6 +203,7 @@ static int omap_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct omap_runtime_data *prtd = runtime->private_data;
+ struct omap_pcm_dma_data *dma_data = prtd->dma_data;
unsigned long flags;
int ret = 0;
@@ -212,6 +213,10 @@ static int omap_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
prtd->period_index = 0;
+ /* Configure McBSP internal buffer usage */
+ if (dma_data->set_threshold)
+ dma_data->set_threshold(substream);
+
omap_start_dma(prtd->dma_ch);
break;
diff --git a/sound/soc/omap/omap-pcm.h b/sound/soc/omap/omap-pcm.h
index 8d9d269..38a821d 100644
--- a/sound/soc/omap/omap-pcm.h
+++ b/sound/soc/omap/omap-pcm.h
@@ -29,6 +29,8 @@ struct omap_pcm_dma_data {
char *name; /* stream identifier */
int dma_req; /* DMA request line */
unsigned long port_addr; /* transmit/receive register */
+ int sync_mode; /* DMA sync mode */
+ void (*set_threshold)(struct snd_pcm_substream *substream);
};
extern struct snd_soc_platform omap_soc_platform;
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCHv4 20/20] ASoC: OMAP: Use DMA operating mode of McBSP
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (18 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 19/20] ASoC: OMAP: Use McBSP threshold to playback and capture Eduardo Valentin
@ 2009-08-17 11:51 ` Eduardo Valentin
2009-08-17 14:02 ` Tony Lindgren
2009-08-17 14:05 ` [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Jarkko Nikula
20 siblings, 1 reply; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 11:51 UTC (permalink / raw)
To: Takashi Iwai
Cc: Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eduardo Valentin
From: Eduardo Valentin <eduardo.valentin@nokia.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
sound/soc/omap/omap-mcbsp.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 2aec7a6..60c360b 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -144,7 +144,14 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
- int samples = snd_pcm_lib_period_bytes(substream) >> 1;
+ int dma_op_mode = omap_mcbsp_get_dma_op_mode(mcbsp_data->bus_id);
+ int samples;
+
+ /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */
+ if (dma_op_mode == MCBSP_DMA_MODE_THRESHOLD)
+ samples = snd_pcm_lib_period_bytes(substream) >> 1;
+ else
+ samples = 1;
/* Configure McBSP internal buffer usage */
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
@@ -166,6 +173,7 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
err = omap_mcbsp_request(bus_id);
if (cpu_is_omap343x()) {
+ int dma_op_mode = omap_mcbsp_get_dma_op_mode(bus_id);
int max_period;
/*
@@ -187,7 +195,8 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
max_period++;
max_period <<= 1;
- snd_pcm_hw_constraint_minmax(substream->runtime,
+ if (dma_op_mode == MCBSP_DMA_MODE_THRESHOLD)
+ snd_pcm_hw_constraint_minmax(substream->runtime,
SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
32, max_period);
}
@@ -268,7 +277,10 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
port = omap34xx_mcbsp_port[bus_id][substream->stream];
omap_mcbsp_dai_dma_params[id][substream->stream].set_threshold =
omap_mcbsp_set_threshold;
- sync_mode = OMAP_DMA_SYNC_FRAME;
+ /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */
+ if (omap_mcbsp_get_dma_op_mode(bus_id) ==
+ MCBSP_DMA_MODE_THRESHOLD)
+ sync_mode = OMAP_DMA_SYNC_FRAME;
} else {
return -ENODEV;
}
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCHv4 20/20] ASoC: OMAP: Use DMA operating mode of McBSP
2009-08-17 11:51 ` [PATCHv4 20/20] ASoC: OMAP: Use DMA operating mode of McBSP Eduardo Valentin
@ 2009-08-17 14:02 ` Tony Lindgren
2009-08-17 14:19 ` Eduardo Valentin
0 siblings, 1 reply; 38+ messages in thread
From: Tony Lindgren @ 2009-08-17 14:02 UTC (permalink / raw)
To: Eduardo Valentin
Cc: Takashi Iwai, Linux-OMAP, ALSA-Devel, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown
* Eduardo Valentin <eduardo.valentin@nokia.com> [090817 15:06]:
> From: Eduardo Valentin <eduardo.valentin@nokia.com>
And this one too.
> Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> ---
> sound/soc/omap/omap-mcbsp.c | 18 +++++++++++++++---
> 1 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
> index 2aec7a6..60c360b 100644
> --- a/sound/soc/omap/omap-mcbsp.c
> +++ b/sound/soc/omap/omap-mcbsp.c
> @@ -144,7 +144,14 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream)
> struct snd_soc_pcm_runtime *rtd = substream->private_data;
> struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
> struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
> - int samples = snd_pcm_lib_period_bytes(substream) >> 1;
> + int dma_op_mode = omap_mcbsp_get_dma_op_mode(mcbsp_data->bus_id);
> + int samples;
> +
> + /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */
> + if (dma_op_mode == MCBSP_DMA_MODE_THRESHOLD)
> + samples = snd_pcm_lib_period_bytes(substream) >> 1;
> + else
> + samples = 1;
>
> /* Configure McBSP internal buffer usage */
> if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> @@ -166,6 +173,7 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
> err = omap_mcbsp_request(bus_id);
>
> if (cpu_is_omap343x()) {
> + int dma_op_mode = omap_mcbsp_get_dma_op_mode(bus_id);
> int max_period;
>
> /*
> @@ -187,7 +195,8 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
> max_period++;
> max_period <<= 1;
>
> - snd_pcm_hw_constraint_minmax(substream->runtime,
> + if (dma_op_mode == MCBSP_DMA_MODE_THRESHOLD)
> + snd_pcm_hw_constraint_minmax(substream->runtime,
> SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
> 32, max_period);
> }
> @@ -268,7 +277,10 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
> port = omap34xx_mcbsp_port[bus_id][substream->stream];
> omap_mcbsp_dai_dma_params[id][substream->stream].set_threshold =
> omap_mcbsp_set_threshold;
> - sync_mode = OMAP_DMA_SYNC_FRAME;
> + /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */
> + if (omap_mcbsp_get_dma_op_mode(bus_id) ==
> + MCBSP_DMA_MODE_THRESHOLD)
> + sync_mode = OMAP_DMA_SYNC_FRAME;
> } else {
> return -ENODEV;
> }
> --
> 1.6.2.GIT
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 38+ messages in thread* [PATCHv4 20/20] ASoC: OMAP: Use DMA operating mode of McBSP
2009-08-17 14:02 ` Tony Lindgren
@ 2009-08-17 14:19 ` Eduardo Valentin
0 siblings, 0 replies; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-17 14:19 UTC (permalink / raw)
To: ext Tony Lindgren
Cc: Linux-OMAP, ALSA-Devel, Takashi Iwai, Jarkko Nikula,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown, Eduardo Valentin
From: Eduardo Valentin <eduardo.valentin@nokia.com>
Configures DMA sync mode depending on McBSP operating mode value.
The value is configurable by McBSP instance. So, depending
on McBSP operating mode, the DMA sync mode is passed from
omap-mcbsp to omap-pcm. Besides that, it also configures
McBSP threshold value depending on which McBSP mode is activated.
Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
sound/soc/omap/omap-mcbsp.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 2aec7a6..60c360b 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -144,7 +144,14 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
- int samples = snd_pcm_lib_period_bytes(substream) >> 1;
+ int dma_op_mode = omap_mcbsp_get_dma_op_mode(mcbsp_data->bus_id);
+ int samples;
+
+ /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */
+ if (dma_op_mode == MCBSP_DMA_MODE_THRESHOLD)
+ samples = snd_pcm_lib_period_bytes(substream) >> 1;
+ else
+ samples = 1;
/* Configure McBSP internal buffer usage */
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
@@ -166,6 +173,7 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
err = omap_mcbsp_request(bus_id);
if (cpu_is_omap343x()) {
+ int dma_op_mode = omap_mcbsp_get_dma_op_mode(bus_id);
int max_period;
/*
@@ -187,7 +195,8 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
max_period++;
max_period <<= 1;
- snd_pcm_hw_constraint_minmax(substream->runtime,
+ if (dma_op_mode == MCBSP_DMA_MODE_THRESHOLD)
+ snd_pcm_hw_constraint_minmax(substream->runtime,
SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
32, max_period);
}
@@ -268,7 +277,10 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
port = omap34xx_mcbsp_port[bus_id][substream->stream];
omap_mcbsp_dai_dma_params[id][substream->stream].set_threshold =
omap_mcbsp_set_threshold;
- sync_mode = OMAP_DMA_SYNC_FRAME;
+ /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */
+ if (omap_mcbsp_get_dma_op_mode(bus_id) ==
+ MCBSP_DMA_MODE_THRESHOLD)
+ sync_mode = OMAP_DMA_SYNC_FRAME;
} else {
return -ENODEV;
}
--
1.6.2.GIT
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCHv4 00/20] OMAP ASoC changes in DMA utilization
2009-08-17 11:50 [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Eduardo Valentin
` (19 preceding siblings ...)
2009-08-17 11:51 ` [PATCHv4 20/20] ASoC: OMAP: Use DMA operating mode of McBSP Eduardo Valentin
@ 2009-08-17 14:05 ` Jarkko Nikula
2009-08-19 7:40 ` Eduardo Valentin
20 siblings, 1 reply; 38+ messages in thread
From: Jarkko Nikula @ 2009-08-17 14:05 UTC (permalink / raw)
To: alsa-devel
Cc: Takashi Iwai, Mark Brown, Ujfalusi Peter (Nokia-D/Tampere),
Nurkkala Eero.An (EXT-Offcode/Oulu), Linux-OMAP, ALSA-Devel
On Mon, 17 Aug 2009 14:50:59 +0300
Eduardo Valentin <eduardo.valentin@nokia.com> wrote:
> Hello again guys,
>
> Here is version 4 of these changes. No real changes from previous versions.
> The only thing is that now I've rebased on top of Takashi's tree:
> http://git.kernel.org/?p=linux/kernel/git/tiwai/sound-2.6.git;a=summary
>
> as there are pending things there which Jarkko has pointed on previous series.
>
Here's my ack to the ASoC part. I tested the set on top of these
Janusz's patches:
http://mailman.alsa-project.org/pipermail/alsa-devel/2009-August/020170.html
http://mailman.alsa-project.org/pipermail/alsa-devel/2009-August/020171.html
http://mailman.alsa-project.org/pipermail/alsa-devel/2009-August/020262.html
Note, that I posted modified version for the patch 16 based on Janusz's
[PATCH 3/3 v3].
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
>
> arch/arm/mach-omap2/mcbsp.c | 5 +
> arch/arm/plat-omap/include/mach/mcbsp.h | 49 ++++
> arch/arm/plat-omap/mcbsp.c | 377 ++++++++++++++++++++++++++++++-
> sound/soc/omap/omap-mcbsp.c | 78 ++++++-
> sound/soc/omap/omap-pcm.c | 14 +-
> sound/soc/omap/omap-pcm.h | 2 +
> 6 files changed, 511 insertions(+), 14 deletions(-)
>
Tony, if you are ok with the OMAP McBSP changes, how it would be best
get these merged? Via ASoC, LKML or separately from both
subsystems during the merge window?
--
Jarkko
^ permalink raw reply [flat|nested] 38+ messages in thread* Re: [PATCHv4 00/20] OMAP ASoC changes in DMA utilization
2009-08-17 14:05 ` [PATCHv4 00/20] OMAP ASoC changes in DMA utilization Jarkko Nikula
@ 2009-08-19 7:40 ` Eduardo Valentin
2009-08-19 7:48 ` Eduardo Valentin
0 siblings, 1 reply; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-19 7:40 UTC (permalink / raw)
To: ext Jarkko Nikula
Cc: Valentin Eduardo (Nokia-D/Helsinki), Takashi Iwai, Linux-OMAP,
ALSA-Devel, Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown
Hello guys,
On Mon, Aug 17, 2009 at 04:05:49PM +0200, Jarkko Nikula wrote:
> On Mon, 17 Aug 2009 14:50:59 +0300
> Eduardo Valentin <eduardo.valentin@nokia.com> wrote:
>
> > Hello again guys,
> >
> > Here is version 4 of these changes. No real changes from previous versions.
> > The only thing is that now I've rebased on top of Takashi's tree:
> > http://git.kernel.org/?p=linux/kernel/git/tiwai/sound-2.6.git;a=summary
> >
> > as there are pending things there which Jarkko has pointed on previous series.
> >
> Here's my ack to the ASoC part. I tested the set on top of these
> Janusz's patches:
>
> http://mailman.alsa-project.org/pipermail/alsa-devel/2009-August/020170.html
> http://mailman.alsa-project.org/pipermail/alsa-devel/2009-August/020171.html
> http://mailman.alsa-project.org/pipermail/alsa-devel/2009-August/020262.html
>
> Note, that I posted modified version for the patch 16 based on Janusz's
> [PATCH 3/3 v3].
>
> Acked-by: Jarkko Nikula <jhnikula@gmail.com>
>
> >
> > arch/arm/mach-omap2/mcbsp.c | 5 +
> > arch/arm/plat-omap/include/mach/mcbsp.h | 49 ++++
> > arch/arm/plat-omap/mcbsp.c | 377 ++++++++++++++++++++++++++++++-
> > sound/soc/omap/omap-mcbsp.c | 78 ++++++-
> > sound/soc/omap/omap-pcm.c | 14 +-
> > sound/soc/omap/omap-pcm.h | 2 +
> > 6 files changed, 511 insertions(+), 14 deletions(-)
> >
> Tony, if you are ok with the OMAP McBSP changes, how it would be best
> get these merged? Via ASoC, LKML or separately from both
> subsystems during the merge window?
Tony, Takashi,
About these changes. I have one doubt. What is the correct tree to base them?
There are changes under arch/arm/plat-omap/ and under sound/soc/omap/.
Should I base them:
- all 20 patches against sound-2.6.git tree (Takashi's tree),
- all 20 patches against linux-omap.git tree (Tony's tree),
- make mcbsp part against Tony's tree and asoc part against Takashi's tree
Please do not apply this version. Let's define this first, then I send
the correct version.
BR,
>
>
> --
> Jarkko
--
Eduardo Valentin
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCHv4 00/20] OMAP ASoC changes in DMA utilization
2009-08-19 7:40 ` Eduardo Valentin
@ 2009-08-19 7:48 ` Eduardo Valentin
2009-08-19 8:26 ` Mark Brown
0 siblings, 1 reply; 38+ messages in thread
From: Eduardo Valentin @ 2009-08-19 7:48 UTC (permalink / raw)
To: Valentin Eduardo (Nokia-D/Helsinki)
Cc: ext Jarkko Nikula, Takashi Iwai, Linux-OMAP, ALSA-Devel,
Nurkkala Eero.An (EXT-Offcode/Oulu),
Ujfalusi Peter (Nokia-D/Tampere), Mark Brown
On Wed, Aug 19, 2009 at 09:40:12AM +0200, Valentin Eduardo (Nokia-D/Helsinki) wrote:
> Hello guys,
>
> On Mon, Aug 17, 2009 at 04:05:49PM +0200, Jarkko Nikula wrote:
> > On Mon, 17 Aug 2009 14:50:59 +0300
> > Eduardo Valentin <eduardo.valentin@nokia.com> wrote:
> >
> > > Hello again guys,
> > >
> > > Here is version 4 of these changes. No real changes from previous versions.
> > > The only thing is that now I've rebased on top of Takashi's tree:
> > > http://git.kernel.org/?p=linux/kernel/git/tiwai/sound-2.6.git;a=summary
> > >
> > > as there are pending things there which Jarkko has pointed on previous series.
> > >
> > Here's my ack to the ASoC part. I tested the set on top of these
> > Janusz's patches:
> >
> > http://mailman.alsa-project.org/pipermail/alsa-devel/2009-August/020170.html
> > http://mailman.alsa-project.org/pipermail/alsa-devel/2009-August/020171.html
> > http://mailman.alsa-project.org/pipermail/alsa-devel/2009-August/020262.html
> >
> > Note, that I posted modified version for the patch 16 based on Janusz's
> > [PATCH 3/3 v3].
> >
> > Acked-by: Jarkko Nikula <jhnikula@gmail.com>
> >
> > >
> > > arch/arm/mach-omap2/mcbsp.c | 5 +
> > > arch/arm/plat-omap/include/mach/mcbsp.h | 49 ++++
> > > arch/arm/plat-omap/mcbsp.c | 377 ++++++++++++++++++++++++++++++-
> > > sound/soc/omap/omap-mcbsp.c | 78 ++++++-
> > > sound/soc/omap/omap-pcm.c | 14 +-
> > > sound/soc/omap/omap-pcm.h | 2 +
> > > 6 files changed, 511 insertions(+), 14 deletions(-)
> > >
> > Tony, if you are ok with the OMAP McBSP changes, how it would be best
> > get these merged? Via ASoC, LKML or separately from both
> > subsystems during the merge window?
>
> Tony, Takashi,
>
> About these changes. I have one doubt. What is the correct tree to base them?
> There are changes under arch/arm/plat-omap/ and under sound/soc/omap/.
>
> Should I base them:
> - all 20 patches against sound-2.6.git tree (Takashi's tree),
> - all 20 patches against linux-omap.git tree (Tony's tree),
> - make mcbsp part against Tony's tree and asoc part against Takashi's tree
>
> Please do not apply this version. Let's define this first, then I send
> the correct version.
There is 1 Jarkko's patch which changes arch/arm/plat-omap/ which is already
in Takashi's tree, IIRC.
>
> BR,
>
> >
> >
> > --
> > Jarkko
>
> --
> Eduardo Valentin
--
Eduardo Valentin
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCHv4 00/20] OMAP ASoC changes in DMA utilization
2009-08-19 7:48 ` Eduardo Valentin
@ 2009-08-19 8:26 ` Mark Brown
2009-08-24 14:00 ` [alsa-devel] " Tony Lindgren
0 siblings, 1 reply; 38+ messages in thread
From: Mark Brown @ 2009-08-19 8:26 UTC (permalink / raw)
To: Eduardo Valentin
Cc: alsa-devel, Takashi Iwai, Ujfalusi Peter (Nokia-D/Tampere),
Nurkkala Eero.An (EXT-Offcode/Oulu), Linux-OMAP, ALSA-Devel
On Wed, Aug 19, 2009 at 10:48:35AM +0300, Eduardo Valentin wrote:
> On Wed, Aug 19, 2009 at 09:40:12AM +0200, Valentin Eduardo (Nokia-D/Helsinki) wrote:
> > About these changes. I have one doubt. What is the correct tree to base them?
> > There are changes under arch/arm/plat-omap/ and under sound/soc/omap/.
...
> > Please do not apply this version. Let's define this first, then I send
> > the correct version.
> There is 1 Jarkko's patch which changes arch/arm/plat-omap/ which is already
> in Takashi's tree, IIRC.
I believe there's colisons with the OMAP1 stuff too. Might be worth
applying these on a branch and then providing merges into both the ASoC
and OMAP trees?
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [alsa-devel] [PATCHv4 00/20] OMAP ASoC changes in DMA utilization
2009-08-19 8:26 ` Mark Brown
@ 2009-08-24 14:00 ` Tony Lindgren
0 siblings, 0 replies; 38+ messages in thread
From: Tony Lindgren @ 2009-08-24 14:00 UTC (permalink / raw)
To: Mark Brown
Cc: Eduardo Valentin, alsa-devel, Takashi Iwai,
Ujfalusi Peter (Nokia-D/Tampere),
Nurkkala Eero.An (EXT-Offcode/Oulu), Linux-OMAP, ALSA-Devel
* Mark Brown <broonie@opensource.wolfsonmicro.com> [090819 11:27]:
> On Wed, Aug 19, 2009 at 10:48:35AM +0300, Eduardo Valentin wrote:
> > On Wed, Aug 19, 2009 at 09:40:12AM +0200, Valentin Eduardo (Nokia-D/Helsinki) wrote:
>
> > > About these changes. I have one doubt. What is the correct tree to base them?
> > > There are changes under arch/arm/plat-omap/ and under sound/soc/omap/.
>
> ...
>
> > > Please do not apply this version. Let's define this first, then I send
> > > the correct version.
>
> > There is 1 Jarkko's patch which changes arch/arm/plat-omap/ which is already
> > in Takashi's tree, IIRC.
>
> I believe there's colisons with the OMAP1 stuff too. Might be worth
> applying these on a branch and then providing merges into both the ASoC
> and OMAP trees?
I'm fine with these all going in via the alsa tree. If there are conflicts,
let's get those parts into the omap for-next branch first.
Tony
^ permalink raw reply [flat|nested] 38+ messages in thread