UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor nightwind
Visitor
1,037 Views
Registered: ‎09-18-2018

axi-i2s:using AXI-DMA instead of pl330 to play sound by adau1761 on the zedboard

 I want to use AXI-DMA instead of pl330 to play sound on the zedboard.I use pl330, it works well. But I use AXI-DMA , it appeared abnormal. Thanks for taking time to read. Any help will be highly appreciated.

My vivado project is as follows:

QQ截图20180918182409.png

The device tree file is as follows:

/ {
	amba_pl: amba_pl {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "simple-bus";
		ranges ;
		axi_dma: dma@40400000 {
			#dma-cells = <1>;
                        clock-names = "s_axi_lite_aclk", "m_axi_sg_aclk", "m_axi_mm2s_aclk", "m_axi_s2mm_aclk";
                        clocks = <&clkc 15>, <&clkc 15>, <&clkc 15>, <&clkc 15>;
			compatible = "xlnx,axi-dma-1.00.a";
			interrupt-parent = <&intc>;
			interrupts = <0 30 4 0 31 4>;
			reg = <0x40400000 0x40000>;
			xlnx,addrwidth = <0x20>;
			dma-channel@40400000 {
				compatible = "xlnx,axi-dma-mm2s-channel";
				dma-channels = <0x1>;
				interrupts = <0 30 4>;
				xlnx,datawidth = <0x20>;
				xlnx,device-id = <0x0>;
			};
			dma-channel@40400030 {
				compatible = "xlnx,axi-dma-s2mm-channel";
				dma-channels = <0x1>;
				interrupts = <0 31 4>;
				xlnx,datawidth = <0x20>;
				xlnx,device-id = <0x0>;
			};
		};
		axi_i2s_adi_2: axi_i2s_adi@43c00000 {
			compatible = "adi,axi-i2s-1.00.a";
			reg = <0x43c00000 0x10000>;
			dmas = <&axi_dma 0 &axi_dma 1 >;
			dma-names = "tx","rx";       
			clocks = <&clkc 15>, <&audio_clock>;
			clock-names = "axi", "ref";
			#sound-dai-cells = <0>;
		};
		axi_iic_2: i2c@41600000 {
			#address-cells = <1>;
			#size-cells = <0>;
			compatible = "xlnx,xps-iic-2.00.a";
			interrupt-parent = <&intc>;
			interrupts = <0 29 4>;
			reg = <0x41600000 0x10000>;
			clocks = <&clkc 15>;
			clock-names = "pclk";
			adau1761_2: adau1761_2@3b {
				compatible = "adi,adau1761";
				reg = <0x3b>;
				clocks = <&audio_clock>;
				clock-names = "mclk";
				#sound-dai-cells = <0>;
			};
		};
	};
	audio_clock: audio_clock {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <12288000>;
	};
	
	zed_sound_2 {
		compatible = "simple-audio-card";
		simple-audio-card,name = "ZED ADAU1761";
		simple-audio-card,widgets =
			"Microphone", "Mic In",
			"Headphone", "Headphone Out",
			"Line", "Line In",
			"Line", "Line Out";
		simple-audio-card,routing =
			"Line Out", "LOUT",
			"Line Out", "ROUT",
			"Headphone Out", "LHP",
			"Headphone Out", "RHP",
			"Mic In", "MICBIAS",
			"LINN", "Mic In",
			"RINN", "Mic In",
			"LAUX", "Line In",
			"RAUX", "Line In";

		simple-audio-card,dai-link@0 {
			format = "i2s";
			cpu {
				sound-dai = <&axi_i2s_adi_2>;
				frame-master;
				bitclock-master;
			};
			codec {
				sound-dai = <&adau1761_2>;
			};
		};
	};   
	
};

Loading information is as follows:

## Loading kernel from FIT Image at 01000000 ...
   Using 'conf@1' configurationay -l                                                                                                
   Verifying Hash Integrity ... OKices ****
   Trying 'kernel@1' kernel subimageice 0: 43c00000.axi_i2s_adi-adau-hifi adau-hifi-0 []
     Description:  PetaLinux Kernel
     Type:         Kernel Image
     Compression:  gzip compressedFront_Center.wav                                                                                  
     Data Start:   0x010000f0artup
     Data Size:    6608050 Bytes = 6.3 MiB
     Architecture: ARMnter.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
     OS:           Linuxs_hw_params
     Load Address: 0x00008000 ASoC: 43c00000.axi_i2s_adi hw params failed: -38
     Entry Point:  0x00008000e to install hw params:
     Hash algo:    crc32i2s.c: 131 axi_i2s_shutdown
     Hash value:   b62ca1d1
   Verifying Hash Integrity ... crc32+ OK
## Loading fdt from FIT Image at 01000000 ...
   Using 'conf@1' configuration
   Trying 'fdt@1' fdt subimage
     Description:  Flattened Device Tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x0164d688
     Data Size:    15302 Bytes = 14.9 KiB
     Architecture: ARM
     Hash algo:    crc32
     Hash value:   9b979742
   Verifying Hash Integrity ... crc32+ OK
   Booting using the fdt blob at 0x164d688
   Uncompressing Kernel Image ... OKont_Center.wav                                                                                  
   Loading Device Tree to 07ff9000, end 07fffbc5 ... OK
12device->directions=0
Starting kernel ..._Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
----axi-i2s.c: 92 axi_i2s_hw_params
Booting Linux on physical CPU 0x0C: 43c00000.axi_i2s_adi hw params failed: -38
Linux version 4.6.0-xilinx (root@ubuntu) (gcc version 4.9.2 (Sourcery CodeBench Lite 2015.05-17) ) #17 SMP PREEMPT Tue Sep 18 16:33:
47 CST 2018_INTE----axi-i2s.c: 131 axi_i2s_shutdown
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: zed_axi_dma_project
bootconsole [earlycon0] enabled
cma: Reserved 16 MiB at 0x3f000000
Memory policy: Data cache writealloc
percpu: Embedded 12 pages/cpu @ef7d2000 s19968 r8192 d20992 u49152
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260608
Kernel command line: console=ttyPS0,115200 earlyprintk
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 1010808K/1048576K available (5299K kernel code, 225K rwdata, 1840K rodata, 4096K init, 212K bss, 21384K reserved, 16384K cma-reserved, 245760K highmem)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)
    lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .text : 0xc0008000 - 0xc07f8cac   (8132 kB)     sys
      .init : 0xc0800000 - 0xc0c00000   (4096 kB)     tmp
      .data : 0xc0c00000 - 0xc0c387e0   ( 226 kB)     usr
       .bss : 0xc0c387e0 - 0xc0c6d804   ( 213 kB)     var
Preemptible hierarchical RCU implementation.
alsa.tarBuild-time adjustment of leaf fanout to 32.
arm-alsaRCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2                                                                        
NR_IRQS:16 nr_irqs:16 16    433/          496/          asound/
slcr mapped to f0802000     434/          5/            bus/
L2C: platform modifies aux control register: 0x72360000 -> 0x72760000
L2C: DT/platform modifies aux control register: 0x72360000 -> 0x72760000
L2C-310 erratum 769419 enabled7/          570/          driver/
L2C-310 enabling early BRESP for Cortex-A9575/          fs/
L2C-310 full line of zeros enabled for Cortex-A9        irq/
L2C-310 ID prefetch enabled, offset 1 lines01/          net/
L2C-310 dynamic clock gating enabled, standby mode enabledsi/
L2C-310 cache controller enabled, 8 ways, 512 kB        self/
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x76760001       sys/
zynq_clock_init: clkc starts at f0802100  847/          sysvipc/
Zynq clock init29/          484/          883/          thread-self/
sched_clock: 64 bits at 333MHz, resolution 3ns, wraps every 4398046511103ns
clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4ce07af025, max_idle_ns: 440795209040 ns
Switching to timer-based delay loop, resolution 3ns
clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 537538477 ns                                            
timer #0 at f080a000, irq=17433/          496/          asound/
Console: colour dummy device 80x30        5/            bus/
Calibrating delay loop (skipped), value calculated using timer frequency.. 666.66 BogoMIPS (lpj=3333333)
pid_max: default: 32768 minimum: 301      52/           device-tree/
Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)ver/
Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
CPU: Testing write buffer coherency: ok   6/            irq/
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000        net/
Setting up static identity map for 0x100000 - 0x100058  scsi/
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001        self/
Brought up 2 CPUs/          478/          8/            sys/
SMP: Total of 2 processors activated (1333.33 BogoMIPS).sysvipc/
CPU: All CPU(s) started in SVC mode.      883/          thread-self/
devtmpfs: initialized       487/          9/            tty/
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
pinctrl core: initialized pinctrl subsystem                                                                                         
NET: Registered protocol family 16ver# ls
DMA: preallocated 256 KiB pool for atomic coherent allocations                                                                      
cpuidle: using governor ladder# cd ..
cpuidle: using governor menucd dev/                                                                                                 
hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
hw-breakpoint: maximum watchpoint size is 4 bytes.                                                                                  
zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0xf0880000
zynq-pinctrl 700.pinctrl: zynq pinctrl initialized                                                                                  
vgaarb: loaded
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
media: Linux media interface: v0.10
Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
EDAC MC: Ver: 3.0.0
Advanced Linux Sound Architecture Driver Initialized.
clocksource: Switched to clocksource arm_global_timer
NET: Registered protocol family 2
TCP established hash table entries: 8192 (order: 3, 32768 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
UDP hash table entries: 512 (order: 2, 16384 bytes)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
futex hash table entries: 512 (order: 3, 32768 bytes)
workingset: timestamp_bits=28 max_order=18 bucket_order=0
jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
bounce: pool size: 64 pages
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330
dma-pl330 f8003000.dmac:        DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
xdev->dma_config->dmatype ==0
xilinx-vdma 40400000.dma: Xilinx AXI VDMA Engine Driver Probed!!
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 143, base_baud = 3125000) is a xuartps
nsole [ttyPS0] enabled
console [ttyPS0] enabled
bootconsole [earlycon0] disabled
bootconsole [earlycon0] disabled
xdevcfg f8007000.devcfg: ioremap 0xf8007000 to f086c000
[drm] Initialized drm 1.1.0 20060810
brd: module loaded
loop: module loaded
CAN device driver interface
libphy: MACB_mii_bus: probed
macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 145 (00:0a:35:00:1e:53)
Marvell 88E1510 e000b000.etherne:00: attached PHY driver [Marvell 88E1510] (mii_bus:phy_addr=e000b000.etherne:00, irq=-1)
e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
usbcore: registered new interface driver usb-storage
e0002000.usb supply vbus not found, using dummy regulator
ULPI transceiver vendor/product ID 0x0451/0x1507
Found TI TUSB1210 ULPI transceiver.
ULPI integrity check: passed.
ci_hdrc ci_hdrc.0: EHCI Host Controller
ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1
ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
Xilinx Zynq CpuIdle Driver started
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using ADMA
ledtrig-cpu: registered to indicate activity on CPUs
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
----axi-i2s.c: 187 axi_i2s_probe
NET: Registered protocol family 17
can: controller area network core (rev 20120528 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20120528 t)
can: netlink gateway (rev 20130117) max_hops=1
Registering SWP/SWPB emulation handler
----axi-i2s.c: 138 axi_i2s_dai_probe
pcm ef0ed300
pcm->chan[0] ef218b38
pcm->chan[1] ef218d38
device->directions=0
axi-i2s 43c00000.axi_i2s_adi: Failed to get DMA channel capabilities, falling back to period counting: -6
device->directions=0
axi-i2s 43c00000.axi_i2s_adi: Failed to get DMA channel capabilities, falling back to period counting: -6
asoc-simple-card zed_sound_2: adau-hifi <-> 43c00000.axi_i2s_adi mapping ok
hctosys: unable to open rtc device (rtc0)
ALSA device list:
  #0: ZED ADAU1761
Freeing unused kernel memory: 4096K (c0800000 - c0c00000)
INIT: version 2.88 booting
Creating /dev/flash/* device nodes
random: dd urandom read with 1 bits of entropy available
Starting internet superserver: inetd.
update-rc.d: /etc/init.d/run-postinsts exists during rc.d purge (continuing)
 Removing any system startup links for run-postinsts ...
INIT: Entering runlevel: 5st
Configuring network interfaces... udhcpc (v1.23.1) started
Sending discover...
Sending discover...
macb e000b000.ethernet eth0: link up (1000/Full)
Sending discover...
No lease, forking to background
done.

Built with PetaLinux v2015.4 (Yocto 1.8) zed_axi_dma_project /dev/ttyPS0
zed_axi_dma_project login:

the error:

axi-i2s 43c00000.axi_i2s_adi: Failed to get DMA channel capabilities, falling back to period counting: -6

I printed some information, such as:

pcm->chan[0] ef218b38

pcm->chan[1] ef218d38

device->directions=0

An exception occurs in this function(dmaengine_pcm_can_report_residue),the device->directions is always 0,so return  --ENXIO;

static bool dmaengine_pcm_can_report_residue(struct device *dev,
	struct dma_chan *chan)
{
	struct dma_slave_caps dma_caps;
	int ret;

	ret = dma_get_slave_caps(chan, &dma_caps);
	if (ret != 0) {
		dev_warn(dev, "Failed to get DMA channel capabilities, falling back to period counting: %d\n",
			 ret);
		return false;
	}

	if (dma_caps.residue_granularity == DMA_RESIDUE_GRANULARITY_DESCRIPTOR)
		return false;

	return true;
}
int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
{
	struct dma_device *device;

	if (!chan || !caps)
		return -EINVAL;

	device = chan->device;

	/* check if the channel supports slave transactions */
	if (!test_bit(DMA_SLAVE, device->cap_mask.bits))
		return -ENXIO;

	/*
	 * Check whether it reports it uses the generic slave
	 * capabilities, if not, that means it doesn't support any
	 * kind of slave capabilities reporting.
	 */


	if (!device->directions)
		return -ENXIO;

	caps->src_addr_widths = device->src_addr_widths;
	caps->dst_addr_widths = device->dst_addr_widths;
	caps->directions = device->directions;
	caps->max_burst = device->max_burst;
	caps->residue_granularity = device->residue_granularity;
	caps->descriptor_reuse = device->descriptor_reuse;

	/*
	 * Some devices implement only pause (e.g. to get residuum) but no
	 * resume. However cmd_pause is advertised as pause AND resume.
	 */
	caps->cmd_pause = !!(device->device_pause && device->device_resume);
	caps->cmd_terminate = !!device->device_terminate_all;

	return 0;
}

The board is still the original zedboard, just replacing the default pl330 DMA with axi-dma, and the adau1761 audio driver loads the error .It cannot play the audio.  

 

Is anyone able to help here? Thanks~

 

0 Kudos
1 Reply
Xilinx Employee
Xilinx Employee
933 Views
Registered: ‎10-04-2016

Re: axi-i2s:using AXI-DMA instead of pl330 to play sound by adau1761 on the zedboard

Hi @nightwind,

Are you still trying to get this to work?

 

I think the way AXI DMA exposes the direction it supports is not compatible with how the I2S driver looks at this field. 

 

Looking at the source for the AXI DMA driver, the field that shows the directions the AXI DMA supports is set in line 2546 and 2564. Line 2546 looks like this:

 

xdev -> common.directions = BIT(DMA_MEM_TO_DEV)

 

In get_dma_slave_caps, the i2s driver is looking in a different part of the DMA device structure:

 

device -> directions

 

I think you'll need to compare the definitions of the xilinx_dma_device and dma_device structures and see if you can resolve this field. 

 

The source for the AXI DMA driver is here:

https://github.com/Xilinx/linux-xlnx/blob/master/drivers/dma/xilinx/xilinx_dma.c

 

I'm guessing that the i2s driver is using the Linux dmaengine driver. That driver wraps around the AXI DMA driver.

 

Regards,

 

Deanna

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos