From 4a0948d0184e35770ca24cd591e9a29fd5ff44a6 Mon Sep 17 00:00:00 2001 From: "Allen.Wang" Date: Wed, 15 Dec 2021 13:41:18 +0800 Subject: meta-bletchley: Add services to control step motor For Bletchley platform, we can only power on system by step motor to press power key. Add tools and service to initialize step motor and control system power by motor. Signed-off-by: Allen.Wang Change-Id: Ic75352a037566d701b2e362743c527c370b0c2e5 Signed-off-by: Patrick Williams --- .../recipes-bletchley/motor-ctrl/motor-ctrl_0.1.bb | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/motor-ctrl_0.1.bb (limited to 'meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/motor-ctrl_0.1.bb') diff --git a/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/motor-ctrl_0.1.bb b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/motor-ctrl_0.1.bb new file mode 100644 index 000000000..2705eb850 --- /dev/null +++ b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/motor-ctrl_0.1.bb @@ -0,0 +1,37 @@ +SUMMARY = "Bletchley Motor control" +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit obmc-phosphor-systemd + +RDEPENDS:${PN} += "bash" +RDEPENDS:${PN} += "libgpiod-tools" +RDEPENDS:${PN} += "i2c-tools" + +S = "${WORKDIR}" +SRC_URI += "file://motor-init \ + file://motor-ctrl \ + file://power-ctrl " + +do_install() { + install -d ${D}${sbindir} + install -m 0755 ${WORKDIR}/power-ctrl ${D}${sbindir} + + install -d ${D}${libexecdir} + install -m 0755 ${WORKDIR}/motor-init ${D}${libexecdir} + install -m 0755 ${WORKDIR}/motor-ctrl ${D}${libexecdir} +} + +MOTOR_INIT_INSTFMT= "motor-init-calibration@{0}.service" +PWR_ON_INSTFMT="host-poweron@.service:host-poweron@{0}.service" +PWR_OFF_INSTFMT="host-poweroff@.service:host-poweroff@{0}.service" + +SYSTEMD_SERVICE:${PN} ="${@compose_list(d, 'MOTOR_INIT_INSTFMT', 'OBMC_HOST_INSTANCES')}" +FILES:${PN} += "${systemd_system_unitdir}/motor-init-calibration@.service" + +SYSTEMD_SERVICE:${PN} +="host-poweron@.service" +SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_ON_INSTFMT', 'OBMC_HOST_INSTANCES')}" + +SYSTEMD_SERVICE:${PN} +="host-poweroff@.service" +SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_OFF_INSTFMT', 'OBMC_HOST_INSTANCES')}" -- cgit v1.2.3