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

This commit is contained in:
Hin-Tak Leung 2020-08-23 20:43:08 +01:00
commit df68ab22d6
4 changed files with 65 additions and 18 deletions

View file

@ -1436,8 +1436,8 @@ static int ac108_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *i
if (of_property_read_u32(np, "tdm-chips-count", &val)) val = 1; if (of_property_read_u32(np, "tdm-chips-count", &val)) val = 1;
ac10x->tdm_chips_cnt = val; ac10x->tdm_chips_cnt = val;
pr_err(" ac10x i2c_id number: %d\n", index); pr_info(" ac10x i2c_id number: %d\n", index);
pr_err(" ac10x data protocol: %d\n", ac10x->data_protocol); pr_info(" ac10x data protocol: %d\n", ac10x->data_protocol);
ac10x->i2c[index] = i2c; ac10x->i2c[index] = i2c;
ac10x->i2cmap[index] = devm_regmap_init_i2c(i2c, &ac108_regmap); ac10x->i2cmap[index] = devm_regmap_init_i2c(i2c, &ac108_regmap);
@ -1459,7 +1459,7 @@ static int ac108_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *i
ac10x_fill_regcache(&i2c->dev, ac10x->i2cmap[index]); ac10x_fill_regcache(&i2c->dev, ac10x->i2cmap[index]);
ac10x->codec_cnt++; ac10x->codec_cnt++;
pr_err(" ac10x codec count : %d\n", ac10x->codec_cnt); pr_info(" ac10x codec count : %d\n", ac10x->codec_cnt);
ret = sysfs_create_group(&i2c->dev.kobj, &ac108_debug_attr_group); ret = sysfs_create_group(&i2c->dev.kobj, &ac108_debug_attr_group);
if (ret) { if (ret) {

View file

@ -31,14 +31,19 @@ fi
# - check for /boot/overlays # - check for /boot/overlays
# - dtparam and dtoverlay is available # - dtparam and dtoverlay is available
errorFound=0 errorFound=0
if [ ! -d /boot/overlays ] ; then OVERLAYS=/boot/overlays
echo "/boot/overlays not found or not a directory" 1>&2 [ -d /boot/firmware/overlays ] && OVERLAYS=/boot/firmware/overlays
if [ ! -d $OVERLAYS ] ; then
echo "$OVERLAYS not found or not a directory" 1>&2
errorFound=1 errorFound=1
fi fi
# should we also check for alsactl and amixer used in seeed-voicecard? # should we also check for alsactl and amixer used in seeed-voicecard?
PATH=$PATH:/opt/vc/bin
for cmd in dtparam dtoverlay ; do for cmd in dtparam dtoverlay ; do
if ! which $cmd &>/dev/null ; then if ! which $cmd &>/dev/null ; then
echo "$cmd not found" 1>&2 echo "$cmd not found" 1>&2
echo "You may need to run ./ubuntu-prerequisite.sh"
errorFound=1 errorFound=1
fi fi
done done
@ -77,7 +82,7 @@ function check_kernel_headers() {
# echo RUN=$VER_RUN HDR=$VER_HDR # echo RUN=$VER_RUN HDR=$VER_HDR
echo " !!! Your kernel version is $VER_RUN" echo " !!! Your kernel version is $VER_RUN"
echo " Not found *** coressponding *** kernel headers with apt-get." echo " Not found *** corresponding *** kernel headers with apt-get."
echo " This may occur if you have ran 'rpi-update'." echo " This may occur if you have ran 'rpi-update'."
echo " Choose *** y *** will revert the kernel to version $VER_HDR then continue." echo " Choose *** y *** will revert the kernel to version $VER_HDR then continue."
echo " Choose *** N *** will exit without this driver support, by default." echo " Choose *** N *** will exit without this driver support, by default."
@ -110,7 +115,8 @@ fi
# it's just been updated) # it's just been updated)
base_ver=$(get_kernel_version) base_ver=$(get_kernel_version)
base_ver=${base_ver%%[-+]*} base_ver=${base_ver%%[-+]*}
kernels="${base_ver}+ ${base_ver}-v7+ ${base_ver}-v7l+" #kernels="${base_ver}+ ${base_ver}-v7+ ${base_ver}-v7l+"
kernels=$(uname -r)
function install_module { function install_module {
local _i local _i
@ -144,9 +150,9 @@ install_module "./" "seeed-voicecard"
# install dtbos # install dtbos
cp seeed-2mic-voicecard.dtbo /boot/overlays cp seeed-2mic-voicecard.dtbo $OVERLAYS
cp seeed-4mic-voicecard.dtbo /boot/overlays cp seeed-4mic-voicecard.dtbo $OVERLAYS
cp seeed-8mic-voicecard.dtbo /boot/overlays cp seeed-8mic-voicecard.dtbo $OVERLAYS
#install alsa plugins #install alsa plugins
# no need this plugin now # no need this plugin now
@ -162,13 +168,16 @@ grep -q "^snd-soc-wm8960$" /etc/modules || \
echo "snd-soc-wm8960" >> /etc/modules echo "snd-soc-wm8960" >> /etc/modules
#set dtoverlays #set dtoverlays
sed -i -e 's:#dtparam=i2c_arm=on:dtparam=i2c_arm=on:g' /boot/config.txt || true CONFIG=/boot/config.txt
grep -q "^dtoverlay=i2s-mmap$" /boot/config.txt || \ [ -f /boot/firmware/usercfg.txt ] && CONFIG=/boot/firmware/usercfg.txt
echo "dtoverlay=i2s-mmap" >> /boot/config.txt
sed -i -e 's:#dtparam=i2c_arm=on:dtparam=i2c_arm=on:g' $CONFIG || true
grep -q "^dtoverlay=i2s-mmap$" $CONFIG || \
echo "dtoverlay=i2s-mmap" >> $CONFIG
grep -q "^dtparam=i2s=on$" /boot/config.txt || \ grep -q "^dtparam=i2s=on$" $CONFIG || \
echo "dtparam=i2s=on" >> /boot/config.txt echo "dtparam=i2s=on" >> $CONFIG
#install config files #install config files
mkdir /etc/voicecard || true mkdir /etc/voicecard || true

View file

@ -127,7 +127,7 @@ if [ "$overlay" ]; then
# TODO: dynamic dtoverlay Bug of v4.19.x # TODO: dynamic dtoverlay Bug of v4.19.x
# no DT node phandle inserted. # no DT node phandle inserted.
if [[ "$kernel_ver" =~ ^4\.19.*$ ]]; then if [[ "$kernel_ver" =~ ^4\.19.*$ || "$kernel_ver" =~ ^5\.*$ ]]; then
for i in $RPI_HATS; do for i in $RPI_HATS; do
if [ "$i" == "$overlay" ]; then if [ "$i" == "$overlay" ]; then
do_overlay $overlay 0 do_overlay $overlay 0
@ -150,5 +150,6 @@ fi
alsactl restore alsactl restore
#Force 3.5mm ('headphone') jack #Force 3.5mm ('headphone') jack
amixer -c 1 cset numid=3 1 || true if [[ "$kernel_ver" =~ ^4\.*$ ]]; then
amixer cset numid=3 1 || true
fi

37
ubuntu-prerequisite.sh Executable file
View file

@ -0,0 +1,37 @@
#!/bin/bash
# Copyright (c) Hin-Tak Leung 2020
#
# Overview:
# This script compiles and install the Broadcom VideoCore tools,
# configure the dynamic loader for the non-standard library location,
# and update the loader cache.
#
# A few steps explicitly requires root privilege, which are
# marked with "sudo". The rest is just checking for duplicate/previous
# action.
#
# This derived from my command history on ubuntu 20.04.1 .YMMV
sudo apt install -y git gcc make alsa-utils cmake
git clone git://github.com/raspberrypi/userland.git
pushd userland/
arch=$(uname -m)
if [[ "$arch" =~ aarch64 ]]; then
./buildme --aarch64
else
./buildme
fi
# ./buildme already includes "sudo make install" at the end
popd
# matches Raspbian's location:
if [ ! -f /etc/ld.so.conf.d/00-vmcs.conf ] ; then
echo "/opt/vc/lib" | sudo tee -a /etc/ld.so.conf.d/00-vmcs.conf
sudo ldconfig -v
else
echo "/etc/ld.so.conf.d/00-vmcs.conf exists - no need to update ld.cache!"
fi