From 031bbb3a1a19c5c0bcdf2b371439bd1aeca41158 Mon Sep 17 00:00:00 2001 From: "Peter.Yang" Date: Fri, 30 Mar 2018 02:37:57 +0000 Subject: [PATCH] Fix: simple-card adapt to kernel version 4.9 & 4.14 --- README.md | 10 +++++----- simple-card.c | 9 +++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 62b111b..0bd57c0 100644 --- a/README.md +++ b/README.md @@ -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. #Doing capture && playback the same time -arecord -D hw:1,0 -f S32_LE -r 16000 -c 8 toberecord.wav & -#mono_toplay.wav is a mono channel wave file to play -aplay -D plughw:1,0 -r 16000 mono_toplay.wav +arecord -D hw:1,0 -f S32_LE -r 16000 -c 8 to_be_record.wav & +#mono_to_play.wav is a mono channel wave file to play +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: -1. capture must be start first, or else the capture channels will miss order randomly. -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.** +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 stereo channels data, or else the speaker or headphone will output nothing possily.** ### Coherence diff --git a/simple-card.c b/simple-card.c index 0730216..188539b 100644 --- a/simple-card.c +++ b/simple-card.c @@ -9,6 +9,7 @@ * published by the Free Software Foundation. */ /* #undef DEBUG */ +#include #include #include #include @@ -361,11 +362,19 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, if (ret < 0) 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); + #else + ret = asoc_simple_card_parse_clk_cpu(dev, cpu, dai_link, cpu_dai); + #endif if (ret < 0) 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); + #else + ret = asoc_simple_card_parse_clk_codec(dev, codec, dai_link, codec_dai); + #endif if (ret < 0) goto dai_link_of_err;