BLUETOOTH-SUSPEND: add bluetooth suspend as wifi suspend
Change-Id: I44123165c65308a1e076a1ac4a62b1fbd4c14f0a
This commit is contained in:
parent
4f1d165844
commit
9698c64aca
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Copyright (C) 2020, STMicroelectronics - All Rights Reserved
|
||||||
|
|
||||||
|
DESCRIPTION = "Systemd service to suspend/resume correctly bluetooth"
|
||||||
|
LICENSE = "MIT"
|
||||||
|
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
|
||||||
|
|
||||||
|
SRC_URI = " \
|
||||||
|
file://bluetooth_brcmfmac_driver.sh \
|
||||||
|
file://bluetooth-brcmfmac-sleep.service \
|
||||||
|
"
|
||||||
|
|
||||||
|
inherit systemd
|
||||||
|
SYSTEMD_PACKAGES += "${PN}"
|
||||||
|
SYSTEMD_SERVICE_${PN} = "bluetooth-brcmfmac-sleep.service"
|
||||||
|
|
||||||
|
do_install() {
|
||||||
|
install -d ${D}${bindir}
|
||||||
|
install -m 0755 ${WORKDIR}/bluetooth_brcmfmac_driver.sh ${D}${bindir}/
|
||||||
|
|
||||||
|
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
|
||||||
|
install -d ${D}${systemd_unitdir}/system/
|
||||||
|
|
||||||
|
install -m 0644 ${WORKDIR}/bluetooth-brcmfmac-sleep.service ${D}${systemd_unitdir}/system/
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
ALLOW_EMPTY_${PN} = "1"
|
||||||
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Bluetooth brcmfmac sleep hook
|
||||||
|
Before=sleep.target
|
||||||
|
StopWhenUnneeded=yes
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=-/usr/bin/bluetooth_brcmfmac_driver.sh unbind
|
||||||
|
ExecStop=-/usr/bin/bluetooth_brcmfmac_driver.sh bind
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=sleep.target
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
COMPATIBLE_BOARD=$(cat /proc/device-tree/compatible | sed "s|st,|,|g" | cut -d ',' -f2)
|
||||||
|
|
||||||
|
case $COMPATIBLE_BOARD in
|
||||||
|
stm32mp151a-dk2*)
|
||||||
|
# supported
|
||||||
|
;;
|
||||||
|
stm32mp151f-dk2*)
|
||||||
|
# supported
|
||||||
|
;;
|
||||||
|
stm32mp153a-dk2*)
|
||||||
|
# supported
|
||||||
|
;;
|
||||||
|
stm32mp153f-dk2*)
|
||||||
|
# supported
|
||||||
|
;;
|
||||||
|
stm32mp157c-dk2*)
|
||||||
|
# supported
|
||||||
|
;;
|
||||||
|
stm32mp157f-dk2*)
|
||||||
|
# supported
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exit 1;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
bind)
|
||||||
|
echo "bind driver hci_uart";
|
||||||
|
echo "bind driver hci_uart" > /dev/kmsg
|
||||||
|
modprobe -r hci_uart
|
||||||
|
modprobe hci_uart
|
||||||
|
;;
|
||||||
|
unbind)
|
||||||
|
echo "unbind driver hci_uart";
|
||||||
|
echo "unbind driver hci_uart" > /dev/kmsg
|
||||||
|
modprobe -r hci_uart
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$0 [bind|unbind]"
|
||||||
|
echo "Bind/Unbind bluetooth driver brcmfmac."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
Loading…
Reference in New Issue