User cold reset and long press to turn off spring and daisy
This change gets power_state:on, off, rec working for daisy and spring.
BUG=chromium:366399
TEST=dut-control power_state:on, off, and rec for daisy and spring
Change-Id: Ib4026c4a3f2808af7e9025f855a87a0598ef40ea
Reviewed-on: https://chromium-review.googlesource.com/197123
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
diff --git a/servo/data/servo_daisy_overlay.xml b/servo/data/servo_daisy_overlay.xml
index 3997122..e19d7f7 100644
--- a/servo/data/servo_daisy_overlay.xml
+++ b/servo/data/servo_daisy_overlay.xml
@@ -11,6 +11,7 @@
<control>
<name>power_state</name>
<doc>Used to turn the DUT off and on</doc>
- <params clobber_ok="" cmd="set" shutdown_ec_command="power off"/>
+ <params clobber_ok="" cmd="set" interface="servo" drv="daisy_power"
+ reset_recovery="0.4" input_type="str"/>
</control>
</root>
diff --git a/servo/data/servo_spring_overlay.xml b/servo/data/servo_spring_overlay.xml
index 68e9dae..918b7b7 100644
--- a/servo/data/servo_spring_overlay.xml
+++ b/servo/data/servo_spring_overlay.xml
@@ -9,6 +9,7 @@
<control>
<name>power_state</name>
<doc>Used to turn the DUT off and on</doc>
- <params clobber_ok="" cmd="set" shutdown_ec_command="power off"/>
+ <params clobber_ok="" cmd="set" interface="servo" drv="daisy_power"
+ reset_recovery="5" input_type="str"/>
</control>
</root>
diff --git a/servo/drv/__init__.py b/servo/drv/__init__.py
index 2edca75..9ee93b2 100644
--- a/servo/drv/__init__.py
+++ b/servo/drv/__init__.py
@@ -12,6 +12,7 @@
import cros_ec_power_arm
import cros_ec_power_x86
import daisy_ec
+import daisy_power
import ec
import gpio
import hw_driver
diff --git a/servo/drv/daisy_power.py b/servo/drv/daisy_power.py
index b89066c..f0f5e0a 100644
--- a/servo/drv/daisy_power.py
+++ b/servo/drv/daisy_power.py
@@ -1,32 +1,20 @@
# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Driver for power_state for daisy boards.
+"""Driver for power_state for daisy.
"""
import time
-import power_state
+import cros_ec_power_arm
-HOSTEVENT_KEYBOARD_RECOVERY = 0x00004000
-
-class daisyPower(power_state.PowerStateDriver):
- _EC_CONSOLE_DELAY = 0.4
+class daisyPower(cros_ec_power_arm.crosEcPowerArm):
+ """Driver for power_state for daisy and spring."""
def _power_off(self):
- self._cold_reset()
- time.sleep(self._EC_CONSOLE_DELAY)
- self._interface.power_long_press()
+ """Power off DUT.
- def _power_on(self, rec_mode):
- if rec_mode == self.REC_ON:
- # Reset the EC to force it back into RO code; this clears
- # the EC_IN_RW signal, so the system CPU will trust the
- # upcoming recovery mode request.
- self._cold_reset()
- # Restart the EC, but leave the system CPU off...
- self._interface.set('ec_uart_cmd', 'reboot ap-off')
- time.sleep(self._EC_CONSOLE_DELAY)
- # ... and tell the EC to tell the CPU we're in recovery mode.
- self._interface.set('ec_uart_cmd',
- 'hostevent set %#x' % HOSTEVENT_KEYBOARD_RECOVERY)
- self._interface.power_short_press()
\ No newline at end of file
+ ec_uart_cmd power off does not work for daisy and spring. Try to power DUT
+ off with cold reset and long press on power button.
+ """
+ self._cold_reset()
+ self._interface.power_long_press()