pid/zone: Restore PWM when fans returned to auto

This makes use of the improved write() interface, to allow the
PID-loop-determined PWM to be restored, when the fan is returned to
automatic mode.

Without this fix, a fan set to manual mode, then manually set to a
different speed, would not properly return to the correct speed, when
transitioning back to automatic from manual.

This patch also adds a stub to allow the caller to learn the raw PWM
value written as output, another useful write() interface improvement.
Although not the topic of this change, it is included here, to avoid
later patch conflicts.

Tested: I can now correctly toggle between automatic, and manual, fan
control. Upon resuming automatic control, after a few seconds, the fan
PWM is now properly restored, to what the PID loop wanted it to be at.

Signed-off-by: Josh Lehan <krellan@google.com>
Signed-off-by: Jason Ling <jasonling@google.com>
Change-Id: I46fc65d6b931755d51093ea475c64cf5e3e6bacb
diff --git a/pid/zone_interface.hpp b/pid/zone_interface.hpp
index a024c0e..b8da048 100644
--- a/pid/zone_interface.hpp
+++ b/pid/zone_interface.hpp
@@ -41,6 +41,7 @@
      * starts processing values to control fans.
      */
     virtual void initializeCache(void) = 0;
+
     /** Return cached value for sensor by name. */
     virtual double getCachedValue(const std::string& name) = 0;
 
@@ -76,6 +77,11 @@
      */
     virtual bool getManualMode(void) const = 0;
 
+    /** Returns true if a redundant fan PWM write is needed. Redundant write
+     * is used when returning the fan to automatic mode from manual mode.
+     */
+    virtual bool getRedundantWrite(void) const = 0;
+
     /** For each fan pid, do processing. */
     virtual void processFans(void) = 0;
     /** For each thermal pid, do processing. */