Skip to content

Commit 1398ae0

Browse files
authored
Merge pull request #726 from FrameworkComputer/lotus.modified_panel_sequence
Lotus: modified panel sequence
2 parents 2c57fdc + e9a5a9e commit 1398ae0

File tree

6 files changed

+46
-6
lines changed

6 files changed

+46
-6
lines changed

include/espi.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,8 @@ int espi_signal_is_vw(int signal);
101101
void espi_wait_vw_not_dirty(enum espi_vw_signal signal,
102102
unsigned int timeout_us);
103103

104+
#ifdef CONFIG_CUSTOMIZED_DESIGN
105+
__override_proto void platform_reset_handler(int plt_rst_status);
106+
#endif
107+
104108
#endif /* __CROS_EC_ESPI_H */

zephyr/program/lotus/azalea/src/power_sequence.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "keyboard_protocol.h"
1919
#include "lpc.h"
2020
#include "power.h"
21+
#include "port80.h"
2122
#include "power_sequence.h"
2223
#include "task.h"
2324
#include "util.h"
@@ -560,7 +561,6 @@ enum power_state power_handle_state(enum power_state state)
560561
return state;
561562
}
562563

563-
/* Peripheral power control */
564564
static void peripheral_power_startup(void)
565565
{
566566
gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_wlan_en), 1);

zephyr/program/lotus/lotus/gpio.dtsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
gpio_f_beam_open_l: f_beam_open_l {
237237
gpios = <&gpiof 0 GPIO_INPUT>;
238238
};
239-
enbkl_apu {
239+
gpio_enblk_apu: enbkl_apu {
240240
gpios = <&gpioe 0 GPIO_INPUT>; /* monitor APU EDP BKL */
241241
};
242242
dgpu_pwr_en {

zephyr/program/lotus/lotus/interrupts.dtsi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,10 @@
7777
flags = <GPIO_INT_EDGE_RISING>;
7878
handler = "dp_hot_plug_interrupt";
7979
};
80+
int_enblk_apu_interrupt: enable_apu_interrupt {
81+
irq-pin = <&gpio_enblk_apu>;
82+
flags = <GPIO_INT_EDGE_BOTH>;
83+
handler = "panel_interrupt_handler";
84+
};
8085
};
8186
};

zephyr/program/lotus/lotus/src/power_sequence.c

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
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+
539562
static 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);
548571
static 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
}
557578
DECLARE_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
569590
static 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
}
578597
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, peripheral_power_suspend, HOOK_PRIO_DEFAULT);

zephyr/shim/src/espi.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ static void espi_chipset_reset(void)
169169
DECLARE_DEFERRED(espi_chipset_reset);
170170
#endif /* CONFIG_PLATFORM_EC_CHIPSET_RESET_HOOK */
171171

172+
#ifdef CONFIG_PLATFORM_EC_CUSTOMIZED_DESIGN
173+
__overridable void platform_reset_handler(int plt_rst_status)
174+
{
175+
}
176+
#endif
177+
172178
/*
173179
* Callback for vwire received.
174180
* PLTRST (platform reset) is handled specially by
@@ -192,9 +198,15 @@ static void espi_vwire_handler(const struct device *dev,
192198
if (event.evt_details == ESPI_VWIRE_SIGNAL_PLTRST &&
193199
event.evt_data == 0) {
194200
hook_call_deferred(&espi_chipset_reset_data, MSEC);
201+
#ifdef CONFIG_PLATFORM_EC_CUSTOMIZED_DESIGN
202+
platform_reset_handler(0);
203+
#endif
195204
update_ap_boot_time(PLTRST_LOW);
196205
} else if (event.evt_details == ESPI_VWIRE_SIGNAL_PLTRST &&
197206
event.evt_data == 1) {
207+
#ifdef CONFIG_PLATFORM_EC_CUSTOMIZED_DESIGN
208+
platform_reset_handler(1);
209+
#endif
198210
update_ap_boot_time(PLTRST_HIGH);
199211
}
200212
#endif

0 commit comments

Comments
 (0)