Skip to contentSkip to conversation

ARM: mmp: add audio sram support

PATCH Superseded Leo Yan 2 participants 6 messages Aug 1, 2011 – Sep 18, 2011

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Leo Yan

author
#0 lore raw

v2 cover ARM: mmp: add audio sram support

On mmp platform, there have sram buffer dedicated to audio island. It can be to dynamically allocated for versatile pcm devices. So add the audio sram allocator for managing it.

Leo Yan (2):
ARM: mmp: register audio sram device
ARM: mmp: add audio sram allocator

 arch/arm/Kconfig                            |    1 +
 arch/arm/mach-mmp/Makefile                  |    2 +-
 arch/arm/mach-mmp/audio_sram.c              |   99 +++++++++++++++++++++++++++
 arch/arm/mach-mmp/brownstone.c              |    1 +
 arch/arm/mach-mmp/include/mach/audio_sram.h |   24 +++++++
 arch/arm/mach-mmp/include/mach/mmp2.h       |    6 ++
 arch/arm/mach-mmp/mmp2.c                    |    1 +
 7 files changed, 133 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-mmp/audio_sram.c
 create mode 100644 arch/arm/mach-mmp/include/mach/audio_sram.h
Signature · 1 line
1.7.4.1
author
#1 lore raw

PATCH v2 1/2 ARM: mmp: register audio sram device

MMP platform has sram for the audio island;
Add the device structure for the audio sram,
and register the audio sram device at init phase.

---
 arch/arm/mach-mmp/brownstone.c        |    1 +
 arch/arm/mach-mmp/include/mach/mmp2.h |    6 ++++++
 arch/arm/mach-mmp/mmp2.c              |    1 +
 3 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/brownstone.c +1 -0
index 7bb78fd..c172910 100644
@@ -189,6 +189,7 @@ static void __init brownstone_init(void)
 	mmp2_add_uart(3);
 	mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info));
 	mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
+	mmp2_add_audio_sram();
 
 	/* enable 5v regulator */
 	platform_device_register(&brownstone_v_5vp_device);
arch/arm/mach-mmp/include/mach/mmp2.h +6 -0
index 2cbf6df..bd1bbb4 100644
@@ -28,6 +28,7 @@ extern struct pxa_device_desc mmp2_device_sdh0;
 extern struct pxa_device_desc mmp2_device_sdh1;
 extern struct pxa_device_desc mmp2_device_sdh2;
 extern struct pxa_device_desc mmp2_device_sdh3;
+extern struct pxa_device_desc mmp2_device_audio_sram;
 
 static inline int mmp2_add_uart(int id)
 {
@@ -85,5 +86,10 @@ static inline int mmp2_add_sdhost(int id, struct sdhci_pxa_platdata *data)
 	return pxa_register_device(d, data, sizeof(*data));
 }
 
+static inline int mmp2_add_audio_sram(void)
+{
+	return pxa_register_device(&mmp2_device_audio_sram, NULL, 0);
+}
+
 #endif /* __ASM_MACH_MMP2_H */
 
arch/arm/mach-mmp/mmp2.c +1 -0
index 8e6c3ac..885dced 100644
@@ -226,4 +226,5 @@ MMP2_DEVICE(sdh0, "sdhci-pxa", 0, MMC, 0xd4280000, 0x120);
 MMP2_DEVICE(sdh1, "sdhci-pxa", 1, MMC2, 0xd4280800, 0x120);
 MMP2_DEVICE(sdh2, "sdhci-pxa", 2, MMC3, 0xd4281000, 0x120);
 MMP2_DEVICE(sdh3, "sdhci-pxa", 3, MMC4, 0xd4281800, 0x120);
+MMP2_DEVICE(audio_sram, "mmp-audio-sram", -1, NONE, 0xe0000000, 0x4000);
 
Signature · 1 line
1.7.4.1
author
#2 lore raw

PATCH v2 2/2 ARM: mmp: add audio sram allocator

In reply to Leo Yan

Implement the audio sram allocator with genalloc,
so that can dynamically allocate the buffer
to pcm devices as need.

---
 arch/arm/Kconfig                            |    1 +
 arch/arm/mach-mmp/Makefile                  |    2 +-
 arch/arm/mach-mmp/audio_sram.c              |   99 +++++++++++++++++++++++++++
 arch/arm/mach-mmp/include/mach/audio_sram.h |   24 +++++++
 4 files changed, 125 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-mmp/audio_sram.c
 create mode 100644 arch/arm/mach-mmp/include/mach/audio_sram.h
arch/arm/Kconfig +1 -0
index 3eacf57..480e1524 100644
@@ -546,6 +546,7 @@ config ARCH_MMP
 	select TICK_ONESHOT
 	select PLAT_PXA
 	select SPARSE_IRQ
+	select GENERIC_ALLOCATOR
 	help
 	  Support for Marvell's PXA168/PXA910(MMP) and MMP2 processor line.
 
arch/arm/mach-mmp/Makefile +1 -1
index b0ac942..290182b 100644
@@ -7,7 +7,7 @@ obj-y				+= common.o clock.o devices.o time.o
 # SoC support
 obj-$(CONFIG_CPU_PXA168)	+= pxa168.o irq-pxa168.o
 obj-$(CONFIG_CPU_PXA910)	+= pxa910.o irq-pxa168.o
-obj-$(CONFIG_CPU_MMP2)		+= mmp2.o irq-mmp2.o
+obj-$(CONFIG_CPU_MMP2)		+= mmp2.o irq-mmp2.o audio_sram.o
 
 # board support
 obj-$(CONFIG_MACH_ASPENITE)	+= aspenite.o
arch/arm/mach-mmp/audio_sram.c new file +99 -0

99 lines not on this page · raw message

arch/arm/mach-mmp/include/mach/audio_sram.h new file +24 -0
new file mode 100644
index 0000000..27124d5
@@ -0,0 +1,24 @@
+/*
+ *  linux/arch/arm/mach-mmp/include/mach/audio_sram.h
+ *
+ *  Audio SRAM Memory Management
+ *
+ *  Copyright (c) 2011 Marvell Semiconductors Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ */
+
+#ifndef __ASM_ARCH_AUDIO_SRAM_H
+#define __ASM_ARCH_AUDIO_SRAM_H
+
+#include <linux/genalloc.h>
+
+/* ARBITRARY:  SRAM allocations are multiples of this 2^N size */
+#define AUDIO_SRAM_GRANULARITY	512
+
+extern struct gen_pool *mmp_audio_sram_gpool;
+
+#endif /* __ASM_ARCH_AUDIO_SRAM_H */
Signature · 1 line
1.7.4.1
#3 lore raw

Re: [PATCH 2/2] ARM: mmp: add audio sram allocator

Quoted 5 lines · Leo Yan

Implement the audio sram allocator with genalloc,
so that can dynamically allocate the buffer
to pcm devices as need.

this can be more generic nad move to lib/genalloc.c

Best Regards,
J.

author
#4 lore raw

Re: [PATCH 2/2] ARM: mmp: add audio sram allocator

Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Leo Yan

Implement the audio sram allocator with genalloc,
so that can dynamically allocate the buffer
to pcm devices as need.

this can be more generic nad move to lib/genalloc.c

This is an older version, i have updated the patch same as you said. pls see below link for the latest patch:
http://lists.arm.linux.org.uk/lurker/message/20110815.030920.2ad4227b.en.html

Thx,
Leo Yan

#5 lore raw

Re: [PATCH 2/2] ARM: mmp: add audio sram allocator

Quoted 8 lines · Leo Yan
Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 4 lines · Leo Yan

Implement the audio sram allocator with genalloc,
so that can dynamically allocate the buffer
to pcm devices as need.

Quoted 6 lines
Quoted 2 lines
Quoted 1 line

this can be more generic nad move to lib/genalloc.c

This is an older version, i have updated the patch same as you said. pls see below link for the latest patch:
http://lists.arm.linux.org.uk/lurker/message/20110815.030920.2ad4227b.en.html

I take a look on it it's the same issue this is not mach specific

Best Regards,
J.