summaryrefslogtreecommitdiffstats
path: root/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl
diff options
context:
space:
mode:
Diffstat (limited to 'meta-facebook/meta-wedge/recipes-wedge/fan-ctrl')
-rwxr-xr-xmeta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/get_fan_speed.sh59
-rwxr-xr-xmeta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/init_pwm.sh71
-rwxr-xr-xmeta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/set_fan_speed.sh85
-rw-r--r--meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/setup-fan.sh39
-rw-r--r--meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl_0.1.bbappend64
5 files changed, 0 insertions, 318 deletions
diff --git a/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/get_fan_speed.sh b/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/get_fan_speed.sh
deleted file mode 100755
index 4e36a7c..0000000
--- a/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/get_fan_speed.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2004-present Facebook. All Rights Reserved.
-#
-# This program file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program in a file named COPYING; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301 USA
-#
-usage() {
- echo "Usage: $0 [Fan Unit (0..3)]" >&2
-}
-
-PWM_DIR=/sys/devices/platform/ast_pwm_tacho.0
-set -e
-
-# refer to the comments in init_pwn.sh regarding
-# the fan unit and tacho mapping
-if [ "$#" -eq 0 ]; then
- TACHOS="0:3 1:2 2:0 3:1"
-elif [ "$#" -eq 1 ]; then
- case "$1" in
- "0")
- TACHOS="0:3"
- ;;
- "1")
- TACHOS="1:2"
- ;;
- "2")
- TACHOS="2:0"
- ;;
- "3")
- TACHOS="3:1"
- ;;
- *)
- usage
- exit 1
- ;;
- esac
-else
- usage
- exit 1
-fi
-
-for fan_tacho in $TACHOS; do
- fan=${fan_tacho%%:*}
- tacho=${fan_tacho##*:}
- echo "Fan $fan RPMs: $(cat $PWM_DIR/tacho${tacho}_rpm), $(cat $PWM_DIR/tacho$((tacho+4))_rpm)"
-done
diff --git a/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/init_pwm.sh b/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/init_pwm.sh
deleted file mode 100755
index cf545be..0000000
--- a/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/init_pwm.sh
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2004-present Facebook. All Rights Reserved.
-#
-# This program file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program in a file named COPYING; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301 USA
-#
-PWM_DIR=/sys/devices/platform/ast_pwm_tacho.0
-
-set -e
-
-# The PWM frequency is
-
-# clk_source / ((2 ^ division_) * (2 * division_l) * (unit + 1))
-#
-# Our clk_source is 24Mhz. 4-pin fans are generally supposed to be driven with
-# a 25Khz PWM control signal. Therefore we want the divisor to equal 960.
-#
-# We also want the unit to be as large as possible, since this controls the
-# granularity with which we can modulate the PWM signal. The following
-# settings allow us to set the fan from 0 to 100% in increments of 1/96th.
-#
-# The AST chip supports 3 different PWM clock configurations, but we only use
-# type M for now.
-echo 0 > $PWM_DIR/pwm_type_m_division_h
-echo 5 > $PWM_DIR/pwm_type_m_division_l
-echo 95 > $PWM_DIR/pwm_type_m_unit
-
-# On wedge, there are 4 fans connected.
-# Each fan has one PWM input and 2 tacho outputs.
-# Here is the mapping between the fan and PWN/Tacho,
-# staring from the one from the edge
-# Fan 0: PWM 7, Tacho3, Tacho7
-# Fan 1: PWM 6, Tacho2, Tacho6
-# Fan 2: PWM 0, Tacho0, Tacho4
-# Fan 3: PWM 1, Tacho1, Tacho5
-
-# For each fan, setting the type, and 100% initially
-for pwm in 0 1 6 7; do
- echo 0 > $PWM_DIR/pwm${pwm}_type
- echo 0 > $PWM_DIR/pwm${pwm}_rising
- echo 0 > $PWM_DIR/pwm${pwm}_falling
- echo 1 > $PWM_DIR/pwm${pwm}_en
-done
-
-# Enable Tach 0..7
-echo 0 > $PWM_DIR/tacho0_source
-echo 0 > $PWM_DIR/tacho4_source
-echo 1 > $PWM_DIR/tacho1_source
-echo 1 > $PWM_DIR/tacho5_source
-echo 6 > $PWM_DIR/tacho2_source
-echo 6 > $PWM_DIR/tacho6_source
-echo 7 > $PWM_DIR/tacho3_source
-echo 7 > $PWM_DIR/tacho7_source
-t=0
-while [ $t -le 7 ]; do
- echo 1 > $PWM_DIR/tacho${t}_en
- t=$((t+1))
-done
diff --git a/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/set_fan_speed.sh b/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/set_fan_speed.sh
deleted file mode 100755
index a71850f..0000000
--- a/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/set_fan_speed.sh
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2004-present Facebook. All Rights Reserved.
-#
-# This program file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program in a file named COPYING; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301 USA
-#
-usage() {
- echo "Usage: $0 <PERCENT (0..100)> <Fan Unit (0..3)> " >&2
-}
-
-PWM_DIR=/sys/devices/platform/ast_pwm_tacho.0
-
-# The maximum unit setting.
-# This should be the value in pwm_type_m_unit plus 1
-PWM_UNIT_MAX=96
-
-set -e
-
-if [ "$#" -ne 2 ] && [ "$#" -ne 1 ]; then
- usage
- exit 1
-fi
-
-# refer to the comments in init_pwn.sh regarding
-# the fan unit and PWM mapping
-if [ "$#" -eq 1 ]; then
- PWMS="0:7 1:6 2:0 3:1"
-else
- case "$2" in
- "0")
- PWMS="0:7"
- ;;
- "1")
- PWMS="1:6"
- ;;
- "2")
- PWMS="2:0"
- ;;
- "3")
- PWMS="3:1"
- ;;
- *)
- usage
- exit 1
- ;;
- esac
-fi
-
-# Convert the percentage to our 1/96th unit.
-unit=$(( ( $1 * $PWM_UNIT_MAX ) / 100 ))
-
-for FAN_PWM in $PWMS; do
- FAN_N=${FAN_PWM%%:*}
- PWM_N=${FAN_PWM##*:}
- if [ "$unit" -eq 0 ]; then
- # For 0%, turn off the PWM entirely
- echo 0 > $PWM_DIR/pwm${PWM_N}_en
- else
- if [ "$unit" -eq $PWM_UNIT_MAX ]; then
- # For 100%, set falling and rising to the same value
- unit=0
- fi
-
- # always use type M. refer to the comments in init_pwm.sh
- echo 0 > $PWM_DIR/pwm${PWM_N}_type
- echo 0 > $PWM_DIR/pwm${PWM_N}_rising
- echo "$unit" > $PWM_DIR/pwm${PWM_N}_falling
- echo 1 > $PWM_DIR/pwm${PWM_N}_en
- fi
-
- echo "Successfully set fan ${FAN_N} (PWM: $PWM_N) speed to $1%"
-done
diff --git a/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/setup-fan.sh b/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/setup-fan.sh
deleted file mode 100644
index 146a787..0000000
--- a/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl/setup-fan.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2014-present Facebook. All Rights Reserved.
-#
-# This program file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program in a file named COPYING; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301 USA
-#
-
-### BEGIN INIT INFO
-# Provides: setup-fan
-# Required-Start: board-id
-# Required-Stop:
-# Default-Start: S
-# Default-Stop:
-# Short-Description: Set fan speed
-### END INIT INFO
-
-. /usr/local/bin/openbmc-utils.sh
-
-# Enable the isolation buffer
-wedge_iso_buf_enable
-
-echo -n "Setup fan speed... "
-/usr/local/bin/init_pwm.sh
-/usr/local/bin/set_fan_speed.sh 50
-/usr/local/bin/fand
-echo "done."
diff --git a/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl_0.1.bbappend b/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl_0.1.bbappend
deleted file mode 100644
index ef2932e..0000000
--- a/meta-facebook/meta-wedge/recipes-wedge/fan-ctrl/fan-ctrl_0.1.bbappend
+++ /dev/null
@@ -1,64 +0,0 @@
-# Copyright 2014-present Facebook. All Rights Reserved.
-#
-# This program file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program in a file named COPYING; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301 USA
-
-DEPENDS_append = "libwedge-eeprom update-rc.d-native"
-
-FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-SRC_URI += "file://get_fan_speed.sh \
- file://init_pwm.sh \
- file://set_fan_speed.sh \
- file://setup-fan.sh \
- "
-
-S = "${WORKDIR}"
-
-binfiles += "get_fan_speed.sh \
- init_pwm.sh \
- set_fan_speed.sh \
- "
-
-LDFLAGS_append = " -lwedge_eeprom"
-CXXFLAGS_prepend = "-DCONFIG_WEDGE "
-
-pkgdir = "fan_ctrl"
-
-do_install() {
- dst="${D}/usr/local/fbpackages/${pkgdir}"
- bin="${D}/usr/local/bin"
- install -d $dst
- install -d $bin
- for f in ${binfiles}; do
- install -m 755 $f ${dst}/$f
- ln -snf ../fbpackages/${pkgdir}/$f ${bin}/$f
- done
- for f in ${otherfiles}; do
- install -m 644 $f ${dst}/$f
- done
- install -d ${D}${sysconfdir}/init.d
- install -d ${D}${sysconfdir}/rcS.d
- install -m 755 setup-fan.sh ${D}${sysconfdir}/init.d/setup-fan.sh
- update-rc.d -r ${D} setup-fan.sh start 91 S .
-}
-
-FBPACKAGEDIR = "${prefix}/local/fbpackages"
-
-FILES_${PN} = "${FBPACKAGEDIR}/fan_ctrl ${prefix}/local/bin ${sysconfdir} "
-
-# Inhibit complaints about .debug directories for the fand binary:
-
-INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
-INHIBIT_PACKAGE_STRIP = "1"
OpenPOWER on IntegriCloud