Fix: simple-card adapt to kernel version 4.9 & 4.14

This commit is contained in:
Peter.Yang 2018-03-30 02:37:57 +00:00
parent 80e0478c91
commit 031bbb3a1a
2 changed files with 14 additions and 5 deletions

View file

@ -219,13 +219,13 @@ aplay -D ac101 a.wav
#Do not use -D plughw:1,0 directly except your wave file is single channel only. #Do not use -D plughw:1,0 directly except your wave file is single channel only.
#Doing capture && playback the same time #Doing capture && playback the same time
arecord -D hw:1,0 -f S32_LE -r 16000 -c 8 toberecord.wav & arecord -D hw:1,0 -f S32_LE -r 16000 -c 8 to_be_record.wav &
#mono_toplay.wav is a mono channel wave file to play #mono_to_play.wav is a mono channel wave file to play
aplay -D plughw:1,0 -r 16000 mono_toplay.wav aplay -D plughw:1,0 -r 16000 mono_to_play.wav
``` ```
**Note: Limit for developer using 6-Mics Circular Array Kit(or 4-Mics Linear Array Kit) doing capture & playback the same time: **Note: Limit for developer using 6-Mics Circular Array Kit(or 4-Mics Linear Array Kit) doing capture & playback the same time:
1. capture must be start first, or else the capture channels will miss order randomly. 1. capture must be start first, or else the capture channels will possibly be disorder.
2. playback output channels must fill with 8 same channels data or 4 same stero channels dat, or else the speaker or headphone will output nothing randomly.** 2. playback output channels must fill with 8 same channels data or 4 same stereo channels data, or else the speaker or headphone will output nothing possily.**
### Coherence ### Coherence

View file

@ -9,6 +9,7 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
/* #undef DEBUG */ /* #undef DEBUG */
#include <linux/version.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/gpio.h> #include <linux/gpio.h>
@ -361,11 +362,19 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
if (ret < 0) if (ret < 0)
goto dai_link_of_err; goto dai_link_of_err;
#if LINUX_VERSION_CODE <= KERNEL_VERSION(4,10,0)
ret = asoc_simple_card_parse_clk_cpu(cpu, dai_link, cpu_dai); ret = asoc_simple_card_parse_clk_cpu(cpu, dai_link, cpu_dai);
#else
ret = asoc_simple_card_parse_clk_cpu(dev, cpu, dai_link, cpu_dai);
#endif
if (ret < 0) if (ret < 0)
goto dai_link_of_err; goto dai_link_of_err;
#if LINUX_VERSION_CODE <= KERNEL_VERSION(4,10,0)
ret = asoc_simple_card_parse_clk_codec(codec, dai_link, codec_dai); ret = asoc_simple_card_parse_clk_codec(codec, dai_link, codec_dai);
#else
ret = asoc_simple_card_parse_clk_codec(dev, codec, dai_link, codec_dai);
#endif
if (ret < 0) if (ret < 0)
goto dai_link_of_err; goto dai_link_of_err;