Playback Error from Speaker I2S (tinyplay)



I am using MediaTek-X20 board.
I am trying to get audio out of pin 20 (with 16 and 18 as clocks).

But when I run tinyplay /data/song.wav -d 31, I am getting below error
Unable to open PCM device 31 (cannot set sw params: Invalid argument)

d 31 corresponds to the below speaker device
00-31: Speaker_PLayback snd-soc-dummy-dai-31 : : playback 1 : capture 1

Any help to solve this issue will be really appreciated.

Also please let me know if above question is not clear or need more details.

There was a problem in tinyplay, now after hardcoding device = 31, in tinyplay source code I am getting below error

Error playing sample

dmesg logs:
[ 687.889711] .(5)[28599:tinyplay]WARNING: CPU: 5 PID: 28599 at /home/ pcm_sanity_check+0x70/0x78()
[ 687.898958] .(5)[28599:tinyplay][] pcm_sanity_check+0x6c/0x78
[ 687.899975] .(5)[28599:tinyplay][] snd_pcm_lib_write+0x18/0x80
[ 687.900927] .(5)[28599:tinyplay][] snd_pcm_playback_ioctl1+0x370/0x38c
[ 687.902019] .(5)[28599:tinyplay][] snd_pcm_playback_ioctl+0x28/0x44

If I use default device 0 instead of 31, I am able to play in tinyplay without error message.
But If I capture 16,18,20 GPIO, I see bit clock errors in 18.

Please suggest on identifying the problem and fix in proper way