Skip to contentSkip to conversation

pxa: modify the pxa2xx-ac97 file for pxa168

PATCH In review Wan ZongShun 3 participants 4 messages Jun 8, 2010

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 pxa: modify the pxa2xx-ac97 file for pxa168

In order to allow the sharing of the pxa2xx-ac97 driver file with pxa168, we have to do a little change to pxa2xx-ac97 file.

All private register addresses were located in mach/include/ac97.h.

---
 arch/arm/mach-pxa/include/mach/ac97.h      |   27 ++++++++++++++++++
 arch/arm/plat-pxa/include/plat/regs-ac97.h |   42 ++++++++++++++--------------
 sound/arm/pxa2xx-ac97.c                    |    4 +-
 sound/soc/pxa/pxa2xx-ac97.c                |   10 +++---
 4 files changed, 55 insertions(+), 28 deletions(-)
 create mode 100644 arch/arm/mach-pxa/include/mach/ac97.h
arch/arm/mach-pxa/include/mach/ac97.h new file +27 -0
new file mode 100644
index 0000000..c8db278
@@ -0,0 +1,27 @@
+/*
+ * arch/arm/mach-pxa/include/mach/ac97.h
+ *
+ * PXA AC97 header file
+ *
+ * Written by Wan ZongShun <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ */
+
+#ifndef __ASM_ARCH_PXA_AC97_H
+#define __ASM_ARCH_PXA_AC97_H
+
+#include <mach/hardware.h>
+
+# define AC97_REG(x)		__REG((x) + 0x40500000)
+
+#define AC97_AUDIO_TX		12
+#define AC97_AUDIO_RX		11
+#define AC97_MODEM_TX		10
+#define AC97_MODEM_RX		9
+#define AC97_MIC		8
+
+#endif /* __ASM_ARCH_PXA_AC97_H */
arch/arm/plat-pxa/include/plat/regs-ac97.h +21 -21

101 lines not on this page · raw message

sound/arm/pxa2xx-ac97.c +2 -2
index 246d0a1..4b66545 100644
@@ -43,7 +43,7 @@ static struct snd_ac97_bus_ops pxa2xx_ac97_ops = {
 static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = {
 	.name			= "AC97 PCM out",
 	.dev_addr		= __PREG(PCDR),
-	.drcmr			= &DRCMR(12),
+	.drcmr			= &DRCMR(AC97_AUDIO_TX),
 	.dcmd			= DCMD_INCSRCADDR | DCMD_FLOWTRG |
 				  DCMD_BURST32 | DCMD_WIDTH4,
 };
@@ -51,7 +51,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = {
 static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_in = {
 	.name			= "AC97 PCM in",
 	.dev_addr		= __PREG(PCDR),
-	.drcmr			= &DRCMR(11),
+	.drcmr			= &DRCMR(AC97_AUDIO_RX),
 	.dcmd			= DCMD_INCTRGADDR | DCMD_FLOWSRC |
 				  DCMD_BURST32 | DCMD_WIDTH4,
 };
sound/soc/pxa/pxa2xx-ac97.c +5 -5
index 173c476..abb735c 100644
@@ -51,7 +51,7 @@ struct snd_ac97_bus_ops soc_ac97_ops = {
 static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_out = {
 	.name			= "AC97 PCM Stereo out",
 	.dev_addr		= __PREG(PCDR),
-	.drcmr			= &DRCMR(12),
+	.drcmr			= &DRCMR(AC97_AUDIO_TX),
 	.dcmd			= DCMD_INCSRCADDR | DCMD_FLOWTRG |
 				  DCMD_BURST32 | DCMD_WIDTH4,
 };
@@ -59,7 +59,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_out = {
 static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_in = {
 	.name			= "AC97 PCM Stereo in",
 	.dev_addr		= __PREG(PCDR),
-	.drcmr			= &DRCMR(11),
+	.drcmr			= &DRCMR(AC97_AUDIO_RX),
 	.dcmd			= DCMD_INCTRGADDR | DCMD_FLOWSRC |
 				  DCMD_BURST32 | DCMD_WIDTH4,
 };
@@ -67,7 +67,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_in = {
 static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_out = {
 	.name			= "AC97 Aux PCM (Slot 5) Mono out",
 	.dev_addr		= __PREG(MODR),
-	.drcmr			= &DRCMR(10),
+	.drcmr			= &DRCMR(AC97_MODEM_TX),
 	.dcmd			= DCMD_INCSRCADDR | DCMD_FLOWTRG |
 				  DCMD_BURST16 | DCMD_WIDTH2,
 };
@@ -75,7 +75,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_out = {
 static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_in = {
 	.name			= "AC97 Aux PCM (Slot 5) Mono in",
 	.dev_addr		= __PREG(MODR),
-	.drcmr			= &DRCMR(9),
+	.drcmr			= &DRCMR(AC97_MODEM_RX),
 	.dcmd			= DCMD_INCTRGADDR | DCMD_FLOWSRC |
 				  DCMD_BURST16 | DCMD_WIDTH2,
 };
@@ -83,7 +83,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_in = {
 static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_mic_mono_in = {
 	.name			= "AC97 Mic PCM (Slot 6) Mono in",
 	.dev_addr		= __PREG(MCDR),
-	.drcmr			= &DRCMR(8),
+	.drcmr			= &DRCMR(AC97_MIC),
 	.dcmd			= DCMD_INCTRGADDR | DCMD_FLOWSRC |
 				  DCMD_BURST16 | DCMD_WIDTH2,
 };
Signature · 1 line
1.6.3.3
#1 lore raw

2010/6/8 Wan ZongShun <[email protected]>:

Quoted 4 lines

In order to allow the sharing of the pxa2xx-ac97 driver file with pxa168, we have to do a little change to pxa2xx-ac97 file.

All private register addresses were located in mach/include/ac97.h.

This is not the right way to go, as suggested already. I hope the ac97 driver is more self-contained. i.e. having a platform device for:

- where the registers are mapped from
- drcmr channel numbers can be encoded within dma resource
- ac97 register definitions are not exposed everywhere

#2 lore raw

2010/6/8 Eric Miao <[email protected]>:

Quoted 4 lines

2010/6/8 Wan ZongShun <[email protected]>:

Quoted 3 lines

In order to allow the sharing of the pxa2xx-ac97 driver file with pxa168, we have to do a little change to pxa2xx-ac97 file.

Quoted 9 lines
Quoted 1 line

All private register addresses were located in mach/include/ac97.h.

This is not the right way to go, as suggested already. I hope the ac97 driver is more self-contained. i.e. having a platform device for:

?- where the registers are mapped from
?- drcmr channel numbers can be encoded within dma resource ?- ac97 register definitions are not exposed everywhere

Got it, so I should put above to platform_device and remove regs-ac97.h, any private bit definition should be removed to driver directory as driver _only_.

Signature · 10 lines
*linux-arm-kernel mailing list
mail addr:linux-arm-kernel at lists.infradead.org
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:NUC900 at googlegroups.com
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
mcuos.com at gmail.com
#3 lore raw
Quoted 10 lines · Wan ZongShun

2010/6/8 Eric Miao <[email protected]>:

Quoted 9 lines

2010/6/8 Wan ZongShun <[email protected]>:

Quoted 4 lines

In order to allow the sharing of the pxa2xx-ac97 driver file with pxa168, we have to do a little change to pxa2xx-ac97 file.

All private register addresses were located in mach/include/ac97.h.

This is not the right way to go, as suggested already. I hope the ac97 driver is more self-contained. i.e. having a platform device for:

Quoted 9 lines
Quoted 4 lines

- where the registers are mapped from
- drcmr channel numbers can be encoded within dma resource
- ac97 register definitions are not exposed everywhere

Got it, so I should put above to platform_device and remove regs-ac97.h, any private bit definition should be removed to driver directory as driver _only_.

...and could you also CC Mark on any ASoC related changes too.

Thanks

Liam

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk