1818#include "lpc.h"
1919#include "power.h"
2020#include "power_sequence.h"
21+ #include "port80.h"
2122#include "task.h"
23+ #include "timer.h"
2224#include "util.h"
2325#include "gpu.h"
2426
@@ -535,7 +537,28 @@ enum power_state power_handle_state(enum power_state state)
535537 return state ;
536538}
537539
540+ static void panel_power_control (void )
541+ {
542+ gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_sm_panel_bken_ec ), 1 );
543+ }
544+ DECLARE_DEFERRED (panel_power_control );
545+
538546/* Peripheral power control */
547+ void panel_interrupt_handler (enum gpio_signal signal )
548+ {
549+ int panel_status = gpio_pin_get_dt (GPIO_DT_FROM_NODELABEL (gpio_enblk_apu ));
550+
551+ if (panel_status == 0 )
552+ gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_sm_panel_bken_ec ), 0 );
553+ else
554+ hook_call_deferred (& panel_power_control_data , 50 * MSEC );
555+ }
556+
557+ void platform_reset_handler (int plt_rst_status )
558+ {
559+ gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_ec_edp_reset ), plt_rst_status );
560+ }
561+
539562static void peripheral_power_startup (void )
540563{
541564 gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_wlan_en ), 1 );
@@ -548,10 +571,8 @@ DECLARE_HOOK(HOOK_CHIPSET_STARTUP, peripheral_power_startup, HOOK_PRIO_DEFAULT);
548571static void peripheral_power_resume (void )
549572{
550573 gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_ec_mute_l ), 1 );
551- gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_ec_edp_reset ), 1 );
552574 gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_en_invpwr ), 1 );
553575 gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_sleep_l ), 1 );
554- gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_sm_panel_bken_ec ), 1 );
555576 gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_ssd2_pwr_en ), 1 );
556577}
557578DECLARE_HOOK (HOOK_CHIPSET_RESUME , peripheral_power_resume , HOOK_PRIO_DEFAULT );
@@ -569,10 +590,8 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, peripheral_power_shutdown, HOOK_PRIO_DEFAULT
569590static void peripheral_power_suspend (void )
570591{
571592 gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_ec_mute_l ), 0 );
572- gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_ec_edp_reset ), 0 );
573593 gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_en_invpwr ), 0 );
574594 gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_sleep_l ), 0 );
575- gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_sm_panel_bken_ec ), 0 );
576595 gpio_pin_set_dt (GPIO_DT_FROM_NODELABEL (gpio_ssd2_pwr_en ), 0 );
577596}
578597DECLARE_HOOK (HOOK_CHIPSET_SUSPEND , peripheral_power_suspend , HOOK_PRIO_DEFAULT );
0 commit comments