Skip to contentSkip to conversation

ARM: MMP: add pxa-squ header file

PATCH Haojian Zhuang 2 participants 2 messages May 22, 2012 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 54 lines · Qiao Zhou

add pxa-squ header file to support SQU DMA.

---
 arch/arm/mach-mmp/include/mach/pxa-squ.h |   39 ++++++++++++++++++++++++++++++

 1 files changed, 39 insertions(+), 0 deletions(-)

 create mode 100644 arch/arm/mach-mmp/include/mach/pxa-squ.h

arch/arm/mach-mmp/include/mach/pxa-squ.h new file +39 -1
new file mode 100644
index 0000000..3ee187f
@@ -0,0 +1,39 @@
+#ifndef __MACH_SQU_H
+#define __MACH_SQU_H
+
+#include <mach/addr-map.h>
+
+#define SQU_REGS_VIRT  (AXI_VIRT_BASE + 0xA0000)
+#define SQU_REG(x)     (*((__iomem u32 *)(SQU_REGS_VIRT + (x))))
+
+ /*SQU*/
+#define SDSAR(x)               SQU_REG(0x810 + ((x) << 2))
+#define SDDAR(x)               SQU_REG(0x820 + ((x) << 2))
+#define SDNDPR(x)              SQU_REG(0x830 + ((x) << 2))
+#define SDCR(x)                        SQU_REG(0x840 + ((x) << 2))
+#define SDIMR(x)               SQU_REG(0x880 + ((x) << 2))
+#define SDISR(x)               SQU_REG(0x8a0 + ((x) << 2))
+#define SDCR_SSPMOD            (1 << 21)       /* SSPMod */
+#define SDCR_FETCHND   (1 << 13)
+#define SDCR_CHANEN            (1 << 12)       /* Channel Enable */
+#define SDCR_DST_ADDR_INC      (0 << 4)
+#define SDCR_DST_ADDR_HOLD     (0x2 << 4)
+#define SDCR_SRC_ADDR_INC      (0 << 2)
+#define SDCR_SRC_ADDR_HOLD     (0x2 << 2)
+#define SDCR_DMA_BURST_4B      (0x0 << 6)
+#define SDCR_DMA_BURST_8B      (0x1 << 6)
+#define SDCR_DMA_BURST_16B     (0x3 << 6)
+#define SDCR_DMA_BURST_1B      (0x5 << 6)
+#define SDCR_DMA_BURST_2B      (0x6 << 6)
+#define SDCR_DMA_BURST_32B     (0x7 << 6)
+#define SDIMR_COMP                     (1 << 0)
+
+struct pxa_squ_platdata {
+       char *pool_name;
+       int irq;
+       int period_max_out;             /* max period size for playback */
+       int period_max_in;              /* max period size for capture */
+       int buffer_max_out;             /* max buffer size for playback */
+       int buffer_max_in;              /* max buffer size for capture */
+};
+#endif /* __MACH_SQU_H */
--
Quoted 2 lines

1.7.4.1

Acked all.

Mark,

Would you mind to apply this patch series?

Thanks
Haojian

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Re: [PATCH 2/2] ASoC: add pxa-squ dma support

Quoted 1 line · Qiao Zhou

Is there any suggestion/comment for this patch? Thanks!

Don't top post.

Review

Quoted 4 lines
(quoted diff) +4 -0
+config SND_PXA_SOC_SQU
+       tristate
+       select GENERIC_ALLOCATOR
+

The main reason I've left this is that I'm trying to decide what to say about the fact that it's not using dmaengine - why is it not doing so?

There's also a few smaller issues below:

Review

Quoted 10 lines
(quoted diff) +10 -0
+       for (i = 0; i < 2; i++) {
+               dint = SDISR(i);
+               if (dint) {
+                       substream = squ_data->stream[i];
+                       prtd = substream->runtime->private_data;
+                       if (SDISR(i) & 0x1)
+                               snd_pcm_period_elapsed(substream);
+                       else
+                               pr_debug("%s: SQU error on channel %d\n",
+                                        prtd->params->name, i);

Should be dev_err().

Review

Quoted 5 lines
(quoted diff) +5 -0
+                       SDISR(i) = 0;
+               }
+       }
+
+       return IRQ_HANDLED;

This interrupt handler unconditionally returns IRQ_HANDLED even if there were no interrupts reported. It should probably only do this if one of the tests in the loop returned true.

Review

Quoted 4 lines
(quoted diff) +4 -0
+       /* return if this is a bufferless transfer e.g.
+        * codec <--> BT codec or GSM modem -- lg FIXME */
+       if (!dma)
+               return 0;

Remove this, systems should use the framework features for this (and I don't think you're Liam...).

Review

Quoted 5 lines
(quoted diff) +5 -0
+       prtd = kzalloc(sizeof(struct pxa_runtime_data), GFP_KERNEL);
+       if (prtd == NULL) {
+               ret = -ENOMEM;
+               goto out;
+       }

devm_kzalloc().

Review

Quoted 6 lines
(quoted diff) +6 -0
+struct snd_soc_platform_driver pxa_squ_soc_platform = {
+       .ops = &pxa_squ_pcm_ops,
+       .pcm_new = pxa_squ_pcm_new,
+       .pcm_free = pxa_squ_pcm_free,
+};
+EXPORT_SYMBOL_GPL(pxa_squ_soc_platform);

This should never need to be exported.

Review

Quoted 3 lines
(quoted diff) +3 -0
+       squ_data = kzalloc(sizeof(struct pxa_squ_priv), GFP_KERNEL);
+       if (!squ_data)
+               return -ENOMEM;

devm_kzalloc().

Quoted 1 line

+ squ_data->irq = pdata->irq;

Shouldn't the interrupt be supplied via a resource?

Review

Quoted 5 lines
(quoted diff) +5 -0
+       ret =
+           request_irq(squ_data->irq, pxa_squ_dma_irq, IRQF_DISABLED,
+                       "pxa-squ", pdev);
+       if (ret) {
+               pr_err("Wow!  Can't register IRQ for SQU\n");

dev_err() and print the error code.

Review

Quoted 6 lines
(quoted diff) +6 -0
+static int __init pxa_squ_pcm_modinit(void)
+{
+       return platform_driver_register(&pxa_squ_driver);
+}
+
+module_init(pxa_squ_pcm_modinit);

module_platform_driver().