summaryrefslogtreecommitdiff
path: root/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-unbind-bind.sh
blob: 5c100eb4f8bae6a68ae6c43489e4921c92ec81a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# #########################################################
# Script to run on witherspoon BMC to unbind/bind the ir35221
# driver's devices

if [ "$1" = "unbind" ]
then
    if [ -e /sys/bus/i2c/drivers/ir35221/4-0070 ]
    then
        echo 4-0070 > /sys/bus/i2c/drivers/ir35221/$1
    fi

    if [ -e /sys/bus/i2c/drivers/ir35221/4-0071 ]
    then
        echo 4-0071 > /sys/bus/i2c/drivers/ir35221/$1
    fi

    if [ -e /sys/bus/i2c/drivers/ir35221/5-0070 ]
    then
        echo 5-0070 > /sys/bus/i2c/drivers/ir35221/$1
    fi

    if [ -e /sys/bus/i2c/drivers/ir35221/5-0071 ]
    then
        echo 5-0071 > /sys/bus/i2c/drivers/ir35221/$1
    fi
elif [ "$1" = "bind" ]
then
    if [ -e /sys/devices/platform/ahb/ahb:apb/ahb:apb:i2c@1e78a000/1e78a140.i2c-bus/i2c-4/4-0070 ]
    then
        echo 4-0070 > /sys/bus/i2c/drivers/ir35221/$1
    fi

    if [ -e /sys/devices/platform/ahb/ahb:apb/ahb:apb:i2c@1e78a000/1e78a140.i2c-bus/i2c-4/4-0071 ]
    then
        echo 4-0071 > /sys/bus/i2c/drivers/ir35221/$1
    fi

    if [ -e /sys/devices/platform/ahb/ahb:apb/ahb:apb:i2c@1e78a000/1e78a180.i2c-bus/i2c-5/5-0070 ]
    then
        echo 5-0070 > /sys/bus/i2c/drivers/ir35221/$1
    fi

    if [ -e /sys/devices/platform/ahb/ahb:apb/ahb:apb:i2c@1e78a000/1e78a180.i2c-bus/i2c-5/5-0071 ]
    then
        echo 5-0071 > /sys/bus/i2c/drivers/ir35221/$1
    fi
fi