summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/superio/ite/it8720f/it8720f.h4
-rw-r--r--src/superio/ite/it8720f/superio.c24
2 files changed, 21 insertions, 7 deletions
diff --git a/src/superio/ite/it8720f/it8720f.h b/src/superio/ite/it8720f/it8720f.h
index f8b7efbc56..093e895821 100644
--- a/src/superio/ite/it8720f/it8720f.h
+++ b/src/superio/ite/it8720f/it8720f.h
@@ -30,4 +30,8 @@
#define IT8720F_GPIO 0x07 /* GPIO (including SPI flash interface) */
#define IT8720F_CIR 0x0a /* Consumer IR */
+/* Registers in LDNs */
+#define IT8720F_EC_PCR1 0xf2
+#define IT8720F_EC_PCR2 0xf4
+
#endif /* SUPERIO_ITE_IT8720F_H */
diff --git a/src/superio/ite/it8720f/superio.c b/src/superio/ite/it8720f/superio.c
index 142686e939..48bbfb2019 100644
--- a/src/superio/ite/it8720f/superio.c
+++ b/src/superio/ite/it8720f/superio.c
@@ -33,17 +33,27 @@
static void power_control_init(struct device *dev)
{
int power_on = MAINBOARD_POWER_OFF;
- u8 addr, value;
+ u8 value;
get_option(&power_on, "power_on_after_fail");
- if (power_on == MAINBOARD_POWER_OFF)
- return;
+
pnp_enter_conf_mode(dev);
pnp_set_logical_device(dev);
- addr = power_on == MAINBOARD_POWER_KEEP ? 0xf2 : 0xf4;
- value = pnp_read_config(dev, addr);
- value |= BIT(5);
- pnp_write_config(dev, addr, value);
+
+ value = pnp_read_config(dev, IT8720F_EC_PCR1);
+ if (power_on == MAINBOARD_POWER_KEEP)
+ value |= (1 << 5);
+ else
+ value &= ~(1 << 5);
+ pnp_write_config(dev, IT8720F_EC_PCR1, value);
+
+ value = pnp_read_config(dev, IT8720F_EC_PCR2);
+ if (power_on == MAINBOARD_POWER_ON)
+ value |= (1 << 5);
+ else
+ value &= ~(1 << 5);
+ pnp_write_config(dev, IT8720F_EC_PCR2, value);
+
pnp_exit_conf_mode(dev);
}