Browse Source

starfive:add autoload bluetooth firmware function

add autoload bluetooth firmware function

Signed-off-by: ziv.xu <ziv.xu@starfive.com>
ziv.xu 1 year ago
parent
commit
1824bba224

+ 27 - 0
package/starfive/starfive-firmware/ap6256-bluetooth/S90bluetooth

@@ -0,0 +1,27 @@
+#! /bin/sh
+
+set -e
+
+DESC="bluetooth"
+NAME=bluetoothd
+DAEMON=/usr/sbin/$NAME
+
+echo 52 > /sys/class/gpio/export
+echo out > /sys/class/gpio/gpio52/direction
+echo 0 > /sys/class/gpio/gpio52/value
+sleep 1
+echo 1 > /sys/class/gpio/gpio52/value
+
+case "$1" in
+  start)
+	printf "Starting $DESC: "
+	start-stop-daemon -S -b -x $NAME
+	brcm_patchram_plus --enable_hci --no2bytes --tosleep 200000 --baudrate 115200 --patchram /lib/firmware/BCM4345C5.hcd /dev/ttyS1 &
+	echo "OK"
+	;;
+  *)
+	exit 1
+	;;
+esac
+
+exit 0

+ 2 - 0
package/starfive/starfive-firmware/starfive-firmware.mk

@@ -20,6 +20,8 @@ define STARFIVE_FIRMWARE_INSTALL_TARGET_CMDS
 	$(foreach f,$(STARFIVE_FIRMWARE_FILES), \
 		$(INSTALL) -m 0755 -D $(f) $(TARGET_DIR)/lib/firmware/; \
 	)
+	$(INSTALL) -D -m 755 package/starfive/starfive-firmware/ap6256-bluetooth/S90bluetooth $(TARGET_DIR)/etc/init.d/S90bluetooth
+
 endef
 
 $(eval $(generic-package))