Merge remote-tracking branch 'origin/v5.5' into v5.7

This commit is contained in:
Hin-Tak Leung 2020-07-30 10:09:42 +01:00
commit 67f7942cfd
2 changed files with 36 additions and 7 deletions

View file

@ -21,13 +21,18 @@
# THE SOFTWARE. # THE SOFTWARE.
set -x set -x
exec 1>/var/log/$(basename $0).log 2>&1 #exec 1>/var/log/$(basename $0).log 2>&1
export PATH=$PATH:/opt/vc/bin
OVERLAYS=/boot/overlays
[ -d /boot/firmware/overlays ] && OVERLAYS=/boot/firmware/overlays
#enable i2c interface #enable i2c interface
dtparam i2c_arm=on dtparam -d $OVERLAYS i2c_arm=on
modprobe i2c-dev modprobe i2c-dev
#enable spi interface #enable spi interface
dtparam spi=on dtparam -d $OVERLAYS spi=on
_VER_RUN= _VER_RUN=
function get_kernel_version() { function get_kernel_version() {
@ -44,6 +49,8 @@ function get_kernel_version() {
} }
CONFIG=/boot/config.txt CONFIG=/boot/config.txt
[ -f /boot/firmware/usercfg.txt ] && CONFIG=/boot/firmware/usercfg.txt
get_overlay() { get_overlay() {
ov=$1 ov=$1
if grep -q -E "^dtoverlay=$ov" $CONFIG; then if grep -q -E "^dtoverlay=$ov" $CONFIG; then
@ -115,7 +122,7 @@ if [ "$overlay" ]; then
rm /etc/asound.conf rm /etc/asound.conf
rm /var/lib/alsa/asound.state rm /var/lib/alsa/asound.state
kernel_ver=$(get_kernel_version) kernel_ver=$(uname -r) # get_kernel_version)
# echo kernel_ver=$kernel_ver # echo kernel_ver=$kernel_ver
# TODO: dynamic dtoverlay Bug of v4.19.x # TODO: dynamic dtoverlay Bug of v4.19.x
@ -131,7 +138,7 @@ if [ "$overlay" ]; then
done done
fi fi
#make sure the driver loads correctly #make sure the driver loads correctly
dtoverlay $overlay || true dtoverlay -d $OVERLAYS $overlay || true
echo "create $overlay asound configure file" echo "create $overlay asound configure file"
@ -143,5 +150,5 @@ fi
alsactl restore alsactl restore
#Force 3.5mm ('headphone') jack #Force 3.5mm ('headphone') jack
amixer cset numid=3 1 amixer -c 1 cset numid=3 1

View file

@ -42,6 +42,9 @@ struct seeed_card_data {
struct seeed_dai_props { struct seeed_dai_props {
struct asoc_simple_dai cpu_dai; struct asoc_simple_dai cpu_dai;
struct asoc_simple_dai codec_dai; struct asoc_simple_dai codec_dai;
struct snd_soc_dai_link_component cpus; /* single cpu */
struct snd_soc_dai_link_component codecs; /* single codec */
struct snd_soc_dai_link_component platforms;
unsigned int mclk_fs; unsigned int mclk_fs;
} *dai_props; } *dai_props;
unsigned int mclk_fs; unsigned int mclk_fs;
@ -561,7 +564,7 @@ static int seeed_voice_card_probe(struct platform_device *pdev)
struct seeed_dai_props *dai_props; struct seeed_dai_props *dai_props;
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int num, ret; int num, ret, i;
/* Get the number of DAI links */ /* Get the number of DAI links */
if (np && of_get_child_by_name(np, PREFIX "dai-link")) if (np && of_get_child_by_name(np, PREFIX "dai-link"))
@ -579,6 +582,25 @@ static int seeed_voice_card_probe(struct platform_device *pdev)
if (!dai_props || !dai_link) if (!dai_props || !dai_link)
return -ENOMEM; return -ENOMEM;
/*
* Use snd_soc_dai_link_component instead of legacy style
* It is codec only. but cpu/platform will be supported in the future.
* see
* soc-core.c :: snd_soc_init_multicodec()
*
* "platform" might be removed
* see
* simple-card-utils.c :: asoc_simple_canonicalize_platform()
*/
for (i = 0; i < num; i++) {
printk(KERN_INFO "linking cpus, codecs and platforms");
dai_link[i].cpus = &dai_props[i].cpus;
dai_link[i].num_cpus = 1;
dai_link[i].codecs = &dai_props[i].codecs;
dai_link[i].num_codecs = 1;
dai_link[i].platforms = &dai_props[i].platforms;
dai_link[i].num_platforms = 1;
}
priv->dai_props = dai_props; priv->dai_props = dai_props;
priv->dai_link = dai_link; priv->dai_link = dai_link;