psu-ng: Change detection of brownout errors

Brownout errors can occur such that the power supplies are able to
recover but the chassis power good is lost and the system powers down.
In these cases the power supply application should continue to process
the brownout condition so that the brownout error is logged and the auto
power restart happens correctly. Use the power state and the chassis
pgood properties from the power control service to allow this to happen.

The power supply driver or device may not latch the AC fault. Set an
expiring indication that the AC fault occurred.

A power supply may not indicate the loss of AC and may only indicate the
loss of power good. As long as at least one power supply indicates the
AC loss, tolerate the pgood failure indications.

The net of the changes is that a brownout error will be issued when the
chassis power good is lost, and all present power supplies indicate an
AC failure or a power good failure, and at least one power supply
indicates an AC failure.

Signed-off-by: Jim Wright <jlwright@us.ibm.com>
Change-Id: I5a11746a036d0a66b11c76ec12784b8870fa306f
diff --git a/phosphor-power-supply/power_supply.cpp b/phosphor-power-supply/power_supply.cpp
index 6908260..c68e9be 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -506,6 +506,8 @@
             }
             vinUVFault++;
         }
+        // Remember that this PSU has seen an AC fault
+        acFault = AC_FAULT_LIMIT;
     }
 
     if (vinUVFault &&
@@ -518,6 +520,11 @@
                         shortName, statusWord, statusMFR, statusInput)
                 .c_str());
         vinUVFault = 0;
+        // No AC fail, decrement counter
+        if (acFault)
+        {
+            --acFault;
+        }
     }
 }
 
@@ -607,6 +614,11 @@
                 }
 
                 clearFaultFlags();
+                // No AC fail, decrement counter
+                if (acFault)
+                {
+                    --acFault;
+                }
             }
 
             // Save off old inputVoltage value.
@@ -635,8 +647,8 @@
                         shortName, vinUVFault, actualInputVoltage)
                         .c_str());
                 // Do we have a VIN_UV fault latched that can now be cleared
-                // due to voltage back in range? Attempt to clear the fault(s),
-                // re-check faults on next call.
+                // due to voltage back in range? Attempt to clear the
+                // fault(s), re-check faults on next call.
                 clearVinUVFault();
             }
             else if (std::abs(actualInputVoltageOld - actualInputVoltage) >