Skip to content

Commit bb99c94

Browse files
authored
Merge pull request #554 from FrameworkComputer/hx20-hx30
Merge pull request from FrameworkComputer/hx20-hx30
2 parents cc0918a + 6f309b8 commit bb99c94

4 files changed

Lines changed: 36 additions & 2 deletions

File tree

board/hx20/gpio.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ GPIO(FAN_SPEED, PIN(050), GPIO_INPUT)
118118

119119

120120
/* Miscellaneous */
121-
GPIO(TYPEC_G_DRV2_EN, PIN(0101), GPIO_OUT_HIGH) /* LED drv */
121+
GPIO(TYPEC_G_DRV2_EN, PIN(0101), GPIO_OUT_LOW) /* LED drv */
122122
GPIO(ME_EN, PIN(060), GPIO_OUT_LOW) /* DVT ME control use VTR1(3.3v) */
123123
GPIO(ME_EN_PVT, PIN(064), GPIO_OUT_LOW) /* PVT ME control use VTR3(1.8v) */
124124
GPIO(EC_BKOFF_L, PIN(0102), GPIO_OUT_LOW) /* Panel backlight control */

board/hx30/board.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,12 @@ int ac_boot_status(void)
519519
return (*host_get_customer_memmap(0x48) & BIT(0)) ? true : false;
520520
}
521521

522+
/* counter for chassis open while ec no power, only rtc power */
522523
static uint8_t chassis_vtr_open_count;
524+
/* counter for chassis open while ec has power */
523525
static uint8_t chassis_open_count;
526+
/* counter for chassis press while ec has power, clear when enter S0 */
527+
static uint8_t chassis_press_counter;
524528

525529
static void check_chassis_open(int init)
526530
{
@@ -543,6 +547,11 @@ static void check_chassis_open(int init)
543547
++chassis_open_count);
544548
}
545549

550+
/* counter for chasis pin */
551+
if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
552+
if (chassis_press_counter < 0xFF)
553+
chassis_press_counter++;
554+
546555
CPRINTF("Chassis was open");
547556
}
548557
}
@@ -1335,3 +1344,21 @@ static enum ec_status host_chassis_intrusion_control(struct host_cmd_handler_arg
13351344
}
13361345
DECLARE_HOST_COMMAND(EC_CMD_CHASSIS_INTRUSION, host_chassis_intrusion_control,
13371346
EC_VER_MASK(0));
1347+
1348+
static enum ec_status chassis_counter(struct host_cmd_handler_args *args)
1349+
{
1350+
struct ec_response_chassis_counter *r = args->response;
1351+
1352+
1353+
CPRINTS("Read chassis counter: %d", chassis_press_counter);
1354+
r->press_counter = chassis_press_counter;
1355+
1356+
/* clear when bios get, bios will get this data while post */
1357+
chassis_press_counter = 0;
1358+
1359+
args->response_size = sizeof(*r);
1360+
1361+
return EC_RES_SUCCESS;
1362+
1363+
}
1364+
DECLARE_HOST_COMMAND(EC_CMD_CHASSIS_COUNTER, chassis_counter, EC_VER_MASK(0));

board/hx30/gpio.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ GPIO(FAN_SPEED, PIN(050), GPIO_INPUT)
110110
GPIO(FP_CTRL, PIN(0245), GPIO_INPUT) /* Fingerprint control */
111111
GPIO(SOC_EC_INT_L, PIN(0246), GPIO_INPUT | GPIO_ODR_HIGH) /* HID interrupt, notify host to read data */
112112

113-
GPIO(TYPEC_G_DRV2_EN, PIN(0101), GPIO_OUT_HIGH) /* LED drv */
113+
GPIO(TYPEC_G_DRV2_EN, PIN(0101), GPIO_OUT_LOW) /* LED drv */
114114
GPIO(ME_EN, PIN(064), GPIO_OUT_LOW) /* PVT ME control use VTR3(1.8v) */
115115
GPIO(EC_BKOFF_L, PIN(0102), GPIO_OUT_LOW) /* Panel backlight control */
116116
GPIO(CAM_EN, PIN(0171), GPIO_OUT_LOW) /* Open camera power */

board/hx30/host_command_customization.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,11 @@ struct ec_params_standalone_mode {
222222
uint8_t enable;
223223
} __ec_align1;
224224

225+
/* how many times did chassis(sw3) pressed */
226+
#define EC_CMD_CHASSIS_COUNTER 0x3E15
227+
228+
struct ec_response_chassis_counter {
229+
uint8_t press_counter;
230+
} __ec_align1;
231+
225232
#endif /* __HOST_COMMAND_CUSTOMIZATION_H */

0 commit comments

Comments
 (0)