15aa57db6SNaveen Moses# Multi-host front panel phosphor buttons interface 25aa57db6SNaveen Moses 3*f4febd00SPatrick WilliamsAuthor: Velumani T(velu), [velumanit@hcl](mailto:velumanit@hcl.com) Naveen Moses 4*f4febd00SPatrick WilliamsS(naveen.moses), [naveen.mosess@hcl.com](mailto:naveen.mosess@hcl.com) 55aa57db6SNaveen Moses 65aa57db6SNaveen MosesOther contributors: 75aa57db6SNaveen Moses 8*f4febd00SPatrick WilliamsCreated: August 3, 2021 95aa57db6SNaveen Moses 105aa57db6SNaveen Moses## Problem Description 115aa57db6SNaveen Moses 12*f4febd00SPatrick WilliamsPhosphor buttons module has currently option to monitor gpio events of power and 13*f4febd00SPatrick Williamsreset buttons and trigger power event handlers. 145aa57db6SNaveen Moses 15*f4febd00SPatrick Williamsphosphor-buttons currently only support push type buttons.support for different 16*f4febd00SPatrick Williamsform factor inputs such as switches/MUX other than push type buttons are needed 17*f4febd00SPatrick Williamsfor some hardwares. It will be helpful if we could add option to support 18*f4febd00SPatrick Williamsadditional input types in phosphor button interfaces and event handling. 19*f4febd00SPatrick Williams 20*f4febd00SPatrick WilliamsCurrently handler events are only based on monitoring gpio events as input 21*f4febd00SPatrick Williams(power and reset).There may be cases where we need to create button interface 22*f4febd00SPatrick Williamswhich monitors non gpio events and triggers button actions for example events 23*f4febd00SPatrick Williamsbased on dbus property changes. 245aa57db6SNaveen Moses 255aa57db6SNaveen Moses## Requirements 26*f4febd00SPatrick Williams 27fd991943SGeorge KeishingThis feature is needed to support additional phosphor button interfaces 285aa57db6SNaveen Mosescorresponding to platform specific hardware buttons/MUX/Switches which are 295aa57db6SNaveen Mosesavailable in the front panel apart from existing power and reset button 305aa57db6SNaveen Mosesinterfaces. 315aa57db6SNaveen Moses 325aa57db6SNaveen Moses## Background and References 33*f4febd00SPatrick Williams 34*f4febd00SPatrick WilliamsThe front panel of bmc has buttons like power button, reset button in general 35*f4febd00SPatrick Williamsthe code for monitoring these buttons and triggering actions are supported. 365aa57db6SNaveen Moses 375aa57db6SNaveen Moses``` 385aa57db6SNaveen Moses +----------------------------------------------+ 395aa57db6SNaveen Moses | | 405aa57db6SNaveen Moses | Front panel | 415aa57db6SNaveen Moses | | 425aa57db6SNaveen Moses | +--------------+ +--------------+ | 435aa57db6SNaveen Moses | | | | | | 445aa57db6SNaveen Moses | | power button | | reset button | | 455aa57db6SNaveen Moses | | | | | | 465aa57db6SNaveen Moses | +--------------+ +--------------+ | 475aa57db6SNaveen Moses | | 485aa57db6SNaveen Moses | | 495aa57db6SNaveen Moses | | 505aa57db6SNaveen Moses | | 515aa57db6SNaveen Moses +----------------------------------------------+ 525aa57db6SNaveen Moses``` 535aa57db6SNaveen Moses 54*f4febd00SPatrick Williamsplatform specific front panel may contain additional hardware buttons or mux 55*f4febd00SPatrick Williamsswitch 565aa57db6SNaveen Moses 57*f4febd00SPatrick Williamsexample for a multihost platform yosemite-V2 it has host selector switch mux as 58*f4febd00SPatrick Williamsadditional button in front panel. 595aa57db6SNaveen Moses 605aa57db6SNaveen Moses``` 615aa57db6SNaveen Moses+---------------------------+ +------------+ 625aa57db6SNaveen Moses| | | | 635aa57db6SNaveen Moses| yv2 front panel | power/ ---------+| host 1 | 645aa57db6SNaveen Moses| | reset/serial mux | | | 655aa57db6SNaveen Moses| +----------------+ | control | +------------+ 665aa57db6SNaveen Moses| | | | | 675aa57db6SNaveen Moses| | power button |-+ | | +------------+ 685aa57db6SNaveen Moses| | | | | | | | 695aa57db6SNaveen Moses| +----------------+ | | |--------+| host 2 | 705aa57db6SNaveen Moses| | | | | | 715aa57db6SNaveen Moses| | | | +------------+ 725aa57db6SNaveen Moses| | | +---------------+ | 735aa57db6SNaveen Moses| +----------------+ | | | host | | +-------------+ 745aa57db6SNaveen Moses| | | | | | selector |------+ | | 755aa57db6SNaveen Moses| | reset button --|--------+ switch | |---------+ host 3 | 765aa57db6SNaveen Moses| | | | +---------------+ | | | 775aa57db6SNaveen Moses| +----------------+ | | +-------------+ 785aa57db6SNaveen Moses| | | 795aa57db6SNaveen Moses| | | +------------+ 805aa57db6SNaveen Moses| | | | | 815aa57db6SNaveen Moses| +----------------+ | |----------+ host 4 | 825aa57db6SNaveen Moses| | serial console +---------------------------------| | | 835aa57db6SNaveen Moses| | mux switch | | | +------------+ 845aa57db6SNaveen Moses| | | | | 855aa57db6SNaveen Moses| +----------------+ | | +-----------+ 865aa57db6SNaveen Moses| | +-----------| BMC | 875aa57db6SNaveen Moses| | | | 885aa57db6SNaveen Moses+---------------------------+ +-----------+ 895aa57db6SNaveen Moses 905aa57db6SNaveen Moses``` 915aa57db6SNaveen Moses 92*f4febd00SPatrick WilliamsThere are two additional hardware buttons/switch available in the frontpanel for 93*f4febd00SPatrick Williamsyv2. 945aa57db6SNaveen Moses 955aa57db6SNaveen Moses## 1.Host selector switch (selector switch) 96*f4febd00SPatrick Williams 975aa57db6SNaveen MosesThis host selector switch/selector switch has 4 gpio connected as input and 98*f4febd00SPatrick Williamsbased on the gpio state values the host selector switch value is derived. The 99*f4febd00SPatrick Williamspossible switch values can vary from 0 to 10. The specific mapping between gpio 100*f4febd00SPatrick Williamsvalues and host selector values can be stored as part of gpio json config. 1015aa57db6SNaveen Moses 102*f4febd00SPatrick WilliamsyosemiteV2 platform has 1 bmc and 4 hosts and only one power button and reset 103*f4febd00SPatrick Williamsbutton. 1045aa57db6SNaveen Moses 105*f4febd00SPatrick WilliamsFor example, when the power button is pressed, The value of the host selector 106*f4febd00SPatrick Williamsswitch position(1 to 10) decides whether the power button action is needs to be 107*f4febd00SPatrick Williamstriggered for bmc or any one of the hosts. 1085aa57db6SNaveen Moses 1095aa57db6SNaveen MosesThis option is to use same power button and reset button for multiple hosts. 1105aa57db6SNaveen Moses 111*f4febd00SPatrick WilliamsThe power/reset button press events are triggered based on the value of host 112*f4febd00SPatrick Williamsselector switch position. 1135aa57db6SNaveen Moses 1145aa57db6SNaveen Moses### Example : 115*f4febd00SPatrick Williams 116*f4febd00SPatrick Williamshost selector position value = 0,bmc is mapped to power and reset buttons host 117*f4febd00SPatrick Williamsselector position value = 1,host 1 is mapped to power and reset buttons host 118*f4febd00SPatrick Williamsselector position value = 2,host 2 is mapped to power and reset buttons host 119*f4febd00SPatrick Williamsselector position value = 3,host 3 is mapped to power and reset buttons host 120*f4febd00SPatrick Williamsselector position value = 4,host 4 is mapped to power and reset buttons 1215aa57db6SNaveen Moses 1225aa57db6SNaveen Moses## 2.Serial console MUX switch 1235aa57db6SNaveen Moses 124*f4febd00SPatrick WilliamsThere is also uart console for each host and bmc which is connected via a MUX 125*f4febd00SPatrick Williamsswitch. 1265aa57db6SNaveen Moses 127*f4febd00SPatrick WilliamsAt a time any one of the device (either bmc or any one host) can be accessed via 128*f4febd00SPatrick Williamsthe console which is based on the UART MUX switch configuration. 1295aa57db6SNaveen Moses 1305aa57db6SNaveen MosesBased on the position of the host selector switch, a separate handler interface 1315aa57db6SNaveen Mosescan configure the respective serial console device is selected. 1325aa57db6SNaveen Moses 1335aa57db6SNaveen Moses## 3.OCP debug card host selector button 1345aa57db6SNaveen Moses 1355aa57db6SNaveen MosesAn OCP debug card can be connected to yosemitev2 via usb for debugging purpose. 1365aa57db6SNaveen Moses 137*f4febd00SPatrick WilliamsThis is a extension which has three buttons : 1.Power button 2.reset button 1385aa57db6SNaveen Moses3.host selector button 1395aa57db6SNaveen Moses 140*f4febd00SPatrick WilliamsPower and reset buttons are mapped to the same gpio of frontpanel so no separate 141*f4febd00SPatrick Williamsevent handling is required. 1425aa57db6SNaveen Moses 143*f4febd00SPatrick WilliamsThe host selector button purpose is same as that of the front panel host 144*f4febd00SPatrick Williamsselector switch in yosemitev2 front panel. The debug card host selector button 145*f4febd00SPatrick Williams(push button) has different gpio lines than that of front panel host selector 146*f4febd00SPatrick Williamsswitch gpios. Whenever the debug host selector button is pressed the host 147*f4febd00SPatrick Williamsselector switch position value should be increased up to MaxPosition. If the 148*f4febd00SPatrick Williamshost selector switch value is more than MaxPosition then it should be reset to 149*f4febd00SPatrick Williamszero. 1505aa57db6SNaveen Moses 1515aa57db6SNaveen Moses# Proposed Design 152*f4febd00SPatrick Williams 1535aa57db6SNaveen MosesThree high level changes are required in the phosphor button interface class 1545aa57db6SNaveen Moses 155*f4febd00SPatrick Williams1. Add support for adding button interfaces which are monitoring more than one 156*f4febd00SPatrick Williams gpio event and process with single event handler. 1575aa57db6SNaveen Moses 158*f4febd00SPatrick Williams2. Add support to monitor button / switch interface event based on dbus property 159*f4febd00SPatrick Williams changes (needed for serial console MUX). 1605aa57db6SNaveen Moses 1615aa57db6SNaveen Moses3. Each button interface class can be extended with the following overridable 1625aa57db6SNaveen Moses methods to allow platform specific logic if needed in a derived class. 1635aa57db6SNaveen Moses 164*f4febd00SPatrick Williams- init() - This method may have gpio configuration and event handler 165*f4febd00SPatrick Williams initialization. 1665aa57db6SNaveen Moses 167*f4febd00SPatrick Williams- handleEvent() - This method may have custom event handling routines for the 168*f4febd00SPatrick Williams respective button interface.This should be be called from the main even 169*f4febd00SPatrick Williams handler function. 1705aa57db6SNaveen Moses 1715aa57db6SNaveen Moses## The host selector switch interface 1725aa57db6SNaveen Moses 173*f4febd00SPatrick WilliamsThe host selector switch has 4 gpios associated with it. host selector switch 174*f4febd00SPatrick Williamsbutton interface monitors these 4 gpio io events as sd-event based event loop 175*f4febd00SPatrick Williamsand a single event handler function is called for all 4 gpio events. 1765aa57db6SNaveen Moses 177*f4febd00SPatrick WilliamsBased on the 4 gpio state values, the host selector switch position value is 178*f4febd00SPatrick Williamsderived and stored as a dbus property with name "Position". 1795aa57db6SNaveen Moses 1805aa57db6SNaveen Moses### Host selector dbus interface details 1815aa57db6SNaveen Moses 182*f4febd00SPatrick Williams1. Position(property) - This is the property which holds the current value of 183*f4febd00SPatrick Williams the host selector switch based on the GPIO state. 184*f4febd00SPatrick Williams 185*f4febd00SPatrick Williams2. MaxPosition(property) - This is the property which keeps the maximum number 186*f4febd00SPatrick Williams of Position the Position property can hold.(This value is based on the number 187*f4febd00SPatrick Williams of hosts available in the platform) 1885aa57db6SNaveen Moses 1895aa57db6SNaveen Moses## OCP Debug card host selector button interface 190*f4febd00SPatrick Williams 1915aa57db6SNaveen MosesA separate interface for debug card host selector button is created. 1925aa57db6SNaveen Moses 193*f4febd00SPatrick WilliamsThis button interface monitors the corresponding gpio lines for debug card host 194*f4febd00SPatrick Williamsselection button press and release event via sd-event based loop. 1955aa57db6SNaveen Moses 196fd991943SGeorge Keishing### OCP Debug card host selector button dbus interface details : 197*f4febd00SPatrick Williams 1985aa57db6SNaveen Moses1. Released(signal) - This is signal is triggered in the ocp debug card event 1995aa57db6SNaveen Moses handler when the ocp debug card button is pressed and released. 2005aa57db6SNaveen Moses 201*f4febd00SPatrick WilliamsWhen the event handler is called once the button is released, then the host 202*f4febd00SPatrick Williamsselector switch dbus property "Position" is increased by 1. The host selector 203*f4febd00SPatrick Williamsswitch dbus property value is rollover to zero after Position value exceeds 204*f4febd00SPatrick WilliamsMaxPosition Value. 2055aa57db6SNaveen Moses 206*f4febd00SPatrick WilliamsThis way when power and reset button press events are handled, the Host selector 207*f4febd00SPatrick WilliamsPosition property is referred and based on the Position respective power events 208*f4febd00SPatrick Williamsare called. 2095aa57db6SNaveen Moses 2105aa57db6SNaveen Moses## serial console MUX interface 211*f4febd00SPatrick Williams 2125aa57db6SNaveen MosesThis button interface monitors for change in host selector switch Position dbus 2135aa57db6SNaveen Mosesproperty and based on the dbus property value change, corresponding serial 2145aa57db6SNaveen Mosesconsole is selected.mux value can be set as configuring 4 gpio lines dedicated 2155aa57db6SNaveen Mosesfor the serial console mux. 216*f4febd00SPatrick Williams 2175aa57db6SNaveen Moses### Example 218*f4febd00SPatrick Williams 219*f4febd00SPatrick Williams0 - bmc serial console 1 - host 1 serial console 2 - host 2 serial console 3 - 220*f4febd00SPatrick Williamshost 3 serial console 4 - host 4 serial console 2215aa57db6SNaveen Moses 2225aa57db6SNaveen Moses### Change in power button and reset button interface event handler 223*f4febd00SPatrick Williams 224*f4febd00SPatrick WilliamsIf selector button instance is available,then the power button and reset button 225*f4febd00SPatrick Williamspressed events must route to appropriate multihost dbus service name 2265aa57db6SNaveen Moses 2275aa57db6SNaveen Moses## Impacts 228*f4febd00SPatrick Williams 229*f4febd00SPatrick WilliamsThe change impacts are under phosphor buttons repo,the existing power and reset 230*f4febd00SPatrick Williamsbutton handlers are calling dbus calls for single host power events. This calls 231*f4febd00SPatrick Williamsshould be modified to adapt corresponding multi host power events and the 232*f4febd00SPatrick Williamsrespective host dbus object is based on host selector position. 2335aa57db6SNaveen Moses 2345aa57db6SNaveen Moses## Testing 235*f4febd00SPatrick Williams 236*f4febd00SPatrick WilliamsThe proposed design can be tested in a platform in which the multiple hosts are 237*f4febd00SPatrick Williamsconnected. 238