summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2019-09-09 19:44:03 -0400
committerScott Murray <scott.murray@konsulko.com>2019-09-09 19:48:07 -0400
commitc369b00e617f408e2a408b0c04dc44fe7e06b7a1 (patch)
treeef134d74b24823b59e928e1ecb7e9b3fcf1f5e01
parentf90cfed5e3bae0e65145328ac60e2595ab2d9a0f (diff)
meta-agl-bsp: meta-rcar-gen3-adas: Rework KF radio initialization
Add a systemd service unit and recipe to install it and a udev rules file so that the Kingfisher Si4689 radio will be initialized on boot if present, and the I2C device to access it will be accessible to applications with the "audio" permission. Note that an accompanying change to agl-service-radio is required to remove its now unworkable usage of the si_init script, which is replaced by this change. Bug-AGL: SPEC-2716 Change-Id: I81cf4b8c439598bdac1eb7910a0d693825141d7b Signed-off-by: Scott Murray <scott.murray@konsulko.com>
-rw-r--r--meta-agl-bsp/meta-rcar-gen3-adas/conf/layer.conf1
-rw-r--r--meta-agl-bsp/meta-rcar-gen3-adas/recipes-bsp/si-tools/files/si-init.service10
-rw-r--r--meta-agl-bsp/meta-rcar-gen3-adas/recipes-bsp/si-tools/si-init_1.0.bb28
3 files changed, 39 insertions, 0 deletions
diff --git a/meta-agl-bsp/meta-rcar-gen3-adas/conf/layer.conf b/meta-agl-bsp/meta-rcar-gen3-adas/conf/layer.conf
index c41fcf54a..796d92684 100644
--- a/meta-agl-bsp/meta-rcar-gen3-adas/conf/layer.conf
+++ b/meta-agl-bsp/meta-rcar-gen3-adas/conf/layer.conf
@@ -40,6 +40,7 @@ IMAGE_INSTALL_append_rcar-gen3 = " \
# Radio packages
IMAGE_INSTALL_append_rcar-gen3 += " \
si-tools \
+ si-init \
linux-firmware-wl18xx \
ti-bt \
ti-bt-firmware \
diff --git a/meta-agl-bsp/meta-rcar-gen3-adas/recipes-bsp/si-tools/files/si-init.service b/meta-agl-bsp/meta-rcar-gen3-adas/recipes-bsp/si-tools/files/si-init.service
new file mode 100644
index 000000000..d2204cb6a
--- /dev/null
+++ b/meta-agl-bsp/meta-rcar-gen3-adas/recipes-bsp/si-tools/files/si-init.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Initialize Si468x radio
+ConditionPathExists=/sys/firmware/devicetree/base/si468x@0/compatible
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/si_init
+
+[Install]
+WantedBy=sysinit.target
diff --git a/meta-agl-bsp/meta-rcar-gen3-adas/recipes-bsp/si-tools/si-init_1.0.bb b/meta-agl-bsp/meta-rcar-gen3-adas/recipes-bsp/si-tools/si-init_1.0.bb
new file mode 100644
index 000000000..7ab99e025
--- /dev/null
+++ b/meta-agl-bsp/meta-rcar-gen3-adas/recipes-bsp/si-tools/si-init_1.0.bb
@@ -0,0 +1,28 @@
+SUMMARY = "Systemd service unit for Si468x radio initialization"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+inherit systemd
+
+SRC_URI = "file://si-init.service"
+
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+do_install() {
+ install -d ${D}${systemd_system_unitdir}
+ install -m 0644 ${WORKDIR}/si-init.service ${D}${systemd_system_unitdir}
+
+ # Add symlink to sysinit.target.wants
+ install -d ${D}${sysconfdir}/systemd/system/sysinit.target.wants
+ ln -s ${systemd_system_unitdir}/si-init.service ${D}${sysconfdir}/systemd/system/sysinit.target.wants/
+
+ # Add a rule to ensure the 'audio' user has permission to access
+ # the Si468x device via i2c
+ install -d ${D}${sysconfdir}/udev/rules.d
+ cat >${D}${sysconfdir}/udev/rules.d/zz-radio-si.rules <<'EOF'
+KERNEL=="i2c-12", MODE="0660", GROUP="audio", SECLABEL{smack}="*"
+EOF
+}
+
+FILES_${PN} += "${systemd_system_unitdir}"