x86-power-control

Vijay Khemka vijaykhemka at fb.com
Fri Oct 18 09:32:16 AEDT 2019


On 10/17/19, 9:03 AM, "openbmc on behalf of Bills, Jason M" <openbmc-bounces+vijaykhemka=fb.com at lists.ozlabs.org on behalf of jason.m.bills at linux.intel.com> wrote:

    Hi Vijay
    
    On 10/16/2019 6:13 PM, Vijay Khemka wrote:
    > One more question on code, I see following code requires powerButtonMask 
    > to be set before aquiring GPIO line. Please let me know who sets this 
    > powerButtonMask to true. I know this is related to GPIO passthrough but 
    > still couldn’t understand where in code it gets set until someone call 
    > set-property of dbus.
    
    powerButtonMask is a gpiod::line object that returns true if it 
    references a GPIO line and false otherwise.

I understood code but my point here is there will not be any 
gpiod::line object if powerButtonMask is defined as false. And 
initially it is defined as false means tehre will not be any line 
object created until someone sets it to true. And I don't see it 
any way to set it true other than set-property through dbus.
    
    > 
    > power_control::powerButtonIface->register_property(
    > 
    > "ButtonMasked", false, [](constboolrequested, bool& current) {
    > 
    > if(requested)
    > 
    > {
    > 
    > if(power_control::powerButtonMask)
    > 
    > {
    This will return if powerButtonMask already references a GPIO.
    
    > 
    > return1;
    > 
    > }
    > 
    > if(!power_control::setGPIOOutput(
    > 
    > "POWER_OUT", 1, power_control::powerButtonMask))
    Otherwise, this will request the "POWER_OUT" GPIO and assign it to 
    powerButtonMask (which will make it return true).
    
    > 
    > {
    > 
    > throwstd::runtime_error("Failed to request GPIO");
    > 
    > return0;
    > 
    > }
    > 
    > std::cerr << "Power Button Masked.\n";
    > 
    > }
    > 
    > else
    > 
    > {
    > 
    > if(!power_control::powerButtonMask)
    > 
    > {
    This will return if powerButtonMask does not reference a GPIO line.
    
    > 
    > return1;
    > 
    > }
    > 
    > std::cerr << "Power Button Un-masked\n";
    > 
    > power_control::powerButtonMask.reset();
    Otherwise this will reset powerButtonMask to release the "POWER_OUT" 
    GPIO (which will make it return false).
    
    > 
    > }
    > 
    > Regards
    > 
    > -Vijay
    > 
    



More information about the openbmc mailing list