Initial commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
SUMMARY = "Initialize PWM sensors"
|
||||
DESCRIPTION = "Initialize PWM sensors"
|
||||
LICENSE = "CLOSED"
|
||||
PR = "r1"
|
||||
|
||||
inherit systemd
|
||||
|
||||
DEPENDS = "systemd"
|
||||
RDEPENDS:${PN} = "bash"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
SRC_URI += " \
|
||||
file://pwm_init.service \
|
||||
file://bin/pwm_init.sh \
|
||||
"
|
||||
|
||||
SYSTEMD_PACKAGES = "${PN}"
|
||||
SYSTEMD_AUTO_ENABLE = "enable"
|
||||
SYSTEMD_SERVICE:${PN} += "pwm_init.service"
|
||||
|
||||
FILES:${PN} += "${bindir}/* ${systemd_system_unitdir}/*"
|
||||
|
||||
do_install:append() {
|
||||
install -d ${D}${libexecdir}/${PN}
|
||||
install -m 0755 ${S}/bin/* ${D}${libexecdir}/${PN}/
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${S}/*.service ${D}${systemd_system_unitdir}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Set all fans to pwm mode.
|
||||
|
||||
# Provide source directive to shellcheck.
|
||||
# shellcheck source=meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-lib.sh
|
||||
source /usr/libexec/kudo-fw/kudo-lib.sh
|
||||
|
||||
# Set all pwm_enable to 1
|
||||
find /sys/class/hwmon/hwmon*/ -name 'pwm*_enable' -exec bash -c 'echo "$1" && echo 1 > "$1" && cat "$1"' -- {} \;
|
||||
|
||||
for i in {0..5}
|
||||
do
|
||||
fan_pwm_rate_of_change=0x$(printf '%02x' $((8 + i)) | \
|
||||
awk '{print $1}')
|
||||
# Set Fan PWM Rate-of-Change Bits(bits 4:2) to 000b
|
||||
# Register 08h to 0Dh
|
||||
oriRegVal=$(i2cget -y -f "${I2C_FANCTRL[0]}" 0x"${I2C_FANCTRL[1]}" \
|
||||
"${fan_pwm_rate_of_change}")
|
||||
updateVal=$((oriRegVal & 0xe3))
|
||||
updateVal=0x$(printf "%x" ${updateVal})
|
||||
i2cset -y -f "${I2C_FANCTRL[0]}" 0x"${I2C_FANCTRL[1]}" \
|
||||
"${fan_pwm_rate_of_change}" "${updateVal}"
|
||||
done
|
||||
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Init PWM sensors
|
||||
Before=xyz.openbmc_project.fansensor.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/pwm-init/pwm_init.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=xyz.openbmc_project.fansensor.service
|
||||
Reference in New Issue
Block a user