1b5bd8853SPatrick Williams# GPIO Monitoring 2939a6431SVijay Khemka 3b5bd8853SPatrick Williams## Implemented Daemons 4939a6431SVijay Khemka 5b5bd8853SPatrick Williams### `phosphor-gpio-monitor` 6939a6431SVijay Khemka 7b5bd8853SPatrick WilliamsThis daemon accepts a command line parameter for monitoring single gpio line and 8b5bd8853SPatrick Williamstake action if requested. This implementation uses GPIO keys and only supports 9b5bd8853SPatrick Williamsmonitoring single GPIO line, for multiple lines, user has to run this daemon 10b5bd8853SPatrick Williamsseperately for each gpio line. 11939a6431SVijay Khemka 12b5bd8853SPatrick Williams### `phosphor-multi-gpio-monitor` 13b5bd8853SPatrick Williams 14b5bd8853SPatrick WilliamsThis daemon accepts command line parameter as a well-defined GPIO configuration 15b5bd8853SPatrick Williamsfile in json format to monitor list of gpios from config file and take action 16b5bd8853SPatrick Williamsdefined in config based on gpio state change. It uses libgpiod library. 17b5bd8853SPatrick Williams 18*eb1e29faSGeorge Liu#### Difference 19b5bd8853SPatrick Williams 20b5bd8853SPatrick WilliamsNew implementation (phosphor-multi-gpio-monitor) provides multiple gpio line 21b5bd8853SPatrick Williamsmonitoring in single instance of phosphor-multi-gpio-monitor running. It is very 22b5bd8853SPatrick Williamseasy to add list of gpios into JSON config file and it also supports of GPIO 23b5bd8853SPatrick Williamsline by name defined in kernel. 24939a6431SVijay Khemka 25*eb1e29faSGeorge Liu#### Configuration 26939a6431SVijay Khemka 27b5bd8853SPatrick WilliamsThere is a phosphor-multi-gpio-monitor.json file that defines details of GPIOs 28b5bd8853SPatrick Williamswhich is required to be monitored. This file can be replaced with a platform 29b5bd8853SPatrick Williamsspecific configuration file via bbappend. 30939a6431SVijay Khemka 31939a6431SVijay KhemkaFollowing are fields in json file 32b5bd8853SPatrick Williams 33939a6431SVijay Khemka1. Name: Name of gpio for reference. 34939a6431SVijay Khemka2. LineName: this is the line name defined in device tree for specific gpio 35939a6431SVijay Khemka3. GpioNum: GPIO offset, this field is optional if LineName is defined. 36939a6431SVijay Khemka4. ChipId: This is device name either offset ("0") or complete gpio device 37939a6431SVijay Khemka ("gpiochip0"). This field is not required if LineName is defined. 38b5bd8853SPatrick Williams5. EventMon: Event of gpio to be monitored. This can be "FALLING", "RISING" OR 39b5bd8853SPatrick Williams "BOTH". Default value for this is "BOTH". 40939a6431SVijay Khemka6. Target: This is an optional systemd service which will get started after 41b5bd8853SPatrick Williams triggering event. A journal entry will be added for every event occurs 42b5bd8853SPatrick Williams irrespective of this definition. 43a66ac0fcSDelphine CC Chiu7. Targets: This is an optional systemd service which will get started after 44a66ac0fcSDelphine CC Chiu triggering corresponding event(RASING or FALLING). A journal entry will be 45a66ac0fcSDelphine CC Chiu added for every event occurs irrespective of this definition. 46a66ac0fcSDelphine CC Chiu8. Continue: This is a optional flag and if it is defined as true then this gpio 47b5bd8853SPatrick Williams will be monitored continously. If not defined then monitoring of this gpio 48b5bd8853SPatrick Williams will stop after first event. 49939a6431SVijay Khemka 50*eb1e29faSGeorge Liu#### Sample config file 51939a6431SVijay Khemka 52b5bd8853SPatrick Williams```json 53939a6431SVijay Khemka[ 54939a6431SVijay Khemka { 55939a6431SVijay Khemka "Name": "PowerButton", 56939a6431SVijay Khemka "LineName": "POWER_BUTTON", 57939a6431SVijay Khemka "GpioNum": 34, 58939a6431SVijay Khemka "ChipId": "gpiochip0", 59a66ac0fcSDelphine CC Chiu "EventMon": "FALLING", 60a66ac0fcSDelphine CC Chiu "Target": "PowerButtonDown.service", 61939a6431SVijay Khemka "Continue": true 62939a6431SVijay Khemka }, 63939a6431SVijay Khemka { 64939a6431SVijay Khemka "Name": "PowerGood", 65939a6431SVijay Khemka "LineName": "PS_PWROK", 66a66ac0fcSDelphine CC Chiu "EventMon": "BOTH", 67a66ac0fcSDelphine CC Chiu "Targets": { 68a66ac0fcSDelphine CC Chiu "FALLING": ["PowerGoodFalling.service", "PowerOff.service"], 69a66ac0fcSDelphine CC Chiu "RISING": ["PowerGoodRising.service", "PowerOn.service"] 70a66ac0fcSDelphine CC Chiu }, 71939a6431SVijay Khemka "Continue": false 72939a6431SVijay Khemka }, 73b5bd8853SPatrick Williams { "Name": "SystemReset", "GpioNum": 46, "ChipId": "0" } 74939a6431SVijay Khemka] 75b5bd8853SPatrick Williams``` 7646a9a5b9SPatrick Rudolph 7746a9a5b9SPatrick Rudolph### `phosphor-multi-gpio-presence` 7846a9a5b9SPatrick Rudolph 7946a9a5b9SPatrick RudolphThis daemon accepts command line parameter as a well-defined GPIO configuration 8046a9a5b9SPatrick Rudolphfile in json format to monitor list of gpios from config file and sets inventory 8146a9a5b9SPatrick Rudolphpresence as defined in config based on gpio state change. It uses libgpiod 8246a9a5b9SPatrick Rudolphlibrary. 8346a9a5b9SPatrick Rudolph 84*eb1e29faSGeorge Liu#### Difference 8546a9a5b9SPatrick Rudolph 8646a9a5b9SPatrick RudolphNew implementation (phosphor-multi-gpio-presence) provides multiple gpio line 8746a9a5b9SPatrick Rudolphmonitoring in single instance of phosphor-multi-gpio-presence running. It is 8846a9a5b9SPatrick Rudolphvery easy to add list of gpios into JSON config file and it also supports of 8946a9a5b9SPatrick RudolphGPIO line by name defined in kernel. 9046a9a5b9SPatrick Rudolph 91*eb1e29faSGeorge Liu#### Configuration 9246a9a5b9SPatrick Rudolph 9346a9a5b9SPatrick RudolphThere is a phosphor-multi-gpio-presence.json file that defines details of GPIOs 9446a9a5b9SPatrick Rudolphwhich is required to be monitored. This file can be replaced with a platform 9546a9a5b9SPatrick Rudolphspecific configuration file via bbappend. 9646a9a5b9SPatrick Rudolph 9746a9a5b9SPatrick RudolphFollowing are fields in json file 9846a9a5b9SPatrick Rudolph 9946a9a5b9SPatrick Rudolph1. Name: PrettyName of inventory item 10046a9a5b9SPatrick Rudolph2. LineName: this is the line name defined in device tree for specific gpio 10146a9a5b9SPatrick Rudolph3. GpioNum: GPIO offset, this field is optional if LineName is defined. 10246a9a5b9SPatrick Rudolph4. ChipId: This is device name either offset ("0") or complete gpio device 10346a9a5b9SPatrick Rudolph ("gpiochip0"). This field is not required if LineName is defined. 10446a9a5b9SPatrick Rudolph5. Inventory: Object path under inventory that will be created 10546a9a5b9SPatrick Rudolph6. ExtraInterfaces: [Optional] List of interfaces to associate to inventory item 10646a9a5b9SPatrick Rudolph7. ActiveLow: [Optional] Object is present on LOW level 10746a9a5b9SPatrick Rudolph8. Bias: [Optional] Configure a BIAS on the GPIO line, for example PULL_UP 10846a9a5b9SPatrick Rudolph 109*eb1e29faSGeorge Liu#### Sample config file 11046a9a5b9SPatrick Rudolph 11146a9a5b9SPatrick Rudolph```json 11246a9a5b9SPatrick Rudolph[ 11346a9a5b9SPatrick Rudolph { 11446a9a5b9SPatrick Rudolph "Name": "DIMM A0", 11546a9a5b9SPatrick Rudolph "LineName": "POWER_BUTTON", 11646a9a5b9SPatrick Rudolph "Inventory": "/system/chassis/motherboard/dimm_a0" 11746a9a5b9SPatrick Rudolph }, 11846a9a5b9SPatrick Rudolph { 11946a9a5b9SPatrick Rudolph "Name": "Powersupply 0", 12046a9a5b9SPatrick Rudolph "ChipId": "0", 12146a9a5b9SPatrick Rudolph "GpioNum": 14, 12246a9a5b9SPatrick Rudolph "Inventory": "/system/chassis/motherboard/powersupply0", 12346a9a5b9SPatrick Rudolph "ActiveLow": true, 12446a9a5b9SPatrick Rudolph "Bias": "PULL_UP", 12546a9a5b9SPatrick Rudolph "ExtraInterfaces": ["xyz.openbmc_project.Inventory.Item.PowerSupply"] 12646a9a5b9SPatrick Rudolph } 12746a9a5b9SPatrick Rudolph] 12846a9a5b9SPatrick Rudolph``` 129