aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-bsp/lt9611uxc-upgrade/lt9611uxc-upgrade.bb19
-rw-r--r--recipes-bsp/lt9611uxc-upgrade/lt9611uxc-upgrade/lt9611uxc-upgrade.sh21
-rw-r--r--recipes-bsp/lt9611uxc-upgrade/lt9611uxc-upgrade/lt9611uxc.service11
3 files changed, 51 insertions, 0 deletions
diff --git a/recipes-bsp/lt9611uxc-upgrade/lt9611uxc-upgrade.bb b/recipes-bsp/lt9611uxc-upgrade/lt9611uxc-upgrade.bb
new file mode 100644
index 0000000..e6ae271
--- /dev/null
+++ b/recipes-bsp/lt9611uxc-upgrade/lt9611uxc-upgrade.bb
@@ -0,0 +1,19 @@
+SUMMARY = "Upgrade Lontium LT9611UXC firmware to the latest image"
+
+SRC_URI = "file://lt9611uxc.service file://lt9611uxc-upgrade.sh"
+LICENSE = "MIT"
+
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+inherit systemd
+
+RDEPENDS_${PN} += "linux-firmware-lt9611uxc"
+
+do_install() {
+ install -d ${D}${bindir}
+ install -m 0755 ${WORKDIR}/lt9611uxc-upgrade.sh ${D}${bindir}
+ install -d ${D}${systemd_system_unitdir}
+ install -m 0644 ${WORKDIR}/lt9611uxc.service ${D}${systemd_system_unitdir}
+}
+
+SYSTEMD_SERVICE_${PN} = "lt9611uxc.service"
diff --git a/recipes-bsp/lt9611uxc-upgrade/lt9611uxc-upgrade/lt9611uxc-upgrade.sh b/recipes-bsp/lt9611uxc-upgrade/lt9611uxc-upgrade/lt9611uxc-upgrade.sh
new file mode 100644
index 0000000..0886980
--- /dev/null
+++ b/recipes-bsp/lt9611uxc-upgrade/lt9611uxc-upgrade/lt9611uxc-upgrade.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -e
+
+if [ ! -r /lib/firmware/lt9611uxc_fw.bin ] ; then
+ echo "LT9611UXC firmware not found"
+ exit 1
+fi
+
+if [ ! -d /sys/bus/i2c/drivers/lt9611uxc ] ; then
+ modprobe lontium-lt9611uxc
+ sleep 1
+fi
+
+for f in /sys/bus/i2c/drivers/lt9611uxc/* ; do
+ [ -L $f ] || continue
+ version=`cat $f/lt9611uxc_firmware`
+ if [ "$version" -lt "43" ] ; then
+ echo > $f/lt9611uxc_firmware
+ fi
+done
diff --git a/recipes-bsp/lt9611uxc-upgrade/lt9611uxc-upgrade/lt9611uxc.service b/recipes-bsp/lt9611uxc-upgrade/lt9611uxc-upgrade/lt9611uxc.service
new file mode 100644
index 0000000..c55e8ff
--- /dev/null
+++ b/recipes-bsp/lt9611uxc-upgrade/lt9611uxc-upgrade/lt9611uxc.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Update LT9611UXC Firmware
+ConditionOnFirstBoot=true
+After=systemd-udev-settle.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/lt9611uxc-upgrade.sh
+
+[Install]
+WantedBy=getty.target