Skip to content

Commit 9b85ad1

Browse files
Ting ShenCommit Bot
Ting Shen
authored and
Commit Bot
committed
asurada: remove board_get_version() == 0 check
Since hayato firmware is ready now, we can now replace board_get_version() calls by compile time macros to make the code simpler. BUG=b:163098341 TEST=make BOARD=asurada/hayato BRANCH=none Signed-off-by: Ting Shen <[email protected]> Change-Id: I5d40e29d097f0cf0cbc6d58b6154832e928445fb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2437237 Reviewed-by: Eric Yilun Lin <[email protected]> Commit-Queue: Ting Shen <[email protected]> Tested-by: Ting Shen <[email protected]>
1 parent 0444eb3 commit 9b85ad1

File tree

3 files changed

+22
-43
lines changed

3 files changed

+22
-43
lines changed

board/asurada/board.c

+17-36
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
9696

9797
/* Wake-up pins for hibernate */
9898
enum gpio_signal hibernate_wake_pins[] = {
99-
GPIO_AC_PRESENT_PLACEHOLDER,
99+
GPIO_AC_PRESENT,
100100
GPIO_LID_OPEN,
101101
GPIO_POWER_BUTTON_L,
102102
};
@@ -144,6 +144,8 @@ static void board_init(void)
144144
/* For Rev0 only. Set GPM0~6 1.8V input. */
145145
IT83XX_GPIO_GCR30 |= BIT(4);
146146

147+
gpio_enable_interrupt(GPIO_AC_PRESENT);
148+
147149
gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_ODL);
148150

149151
/* Enable motion sensor interrupt */
@@ -605,42 +607,13 @@ int board_regulator_get_voltage(uint32_t index, uint32_t *voltage_mv)
605607
return mt6360_regulator_get_voltage(id, voltage_mv);
606608
}
607609

608-
/* gpio */
609-
610-
/* TODO(b/163098341): Remove these after rev0 deprecated. */
611-
enum gpio_signal GPIO_AC_PRESENT = GPIO_AC_PRESENT_PLACEHOLDER;
612-
613-
static void board_gpio_init(void)
614-
{
615-
if (board_get_version() == 0)
616-
GPIO_AC_PRESENT = GPIO_EC_GPM2;
617-
else
618-
GPIO_AC_PRESENT = GPIO_EC_GPE5;
619-
620-
/* Set wake pins to the correct one */
621-
hibernate_wake_pins[0] = GPIO_AC_PRESENT;
622-
623-
/* Manually run extpower_init() again */
624-
gpio_enable_interrupt(GPIO_AC_PRESENT);
625-
extpower_interrupt(GPIO_AC_PRESENT);
626-
}
627-
DECLARE_HOOK(HOOK_INIT, board_gpio_init, HOOK_PRIO_INIT_ADC + 1);
628-
629610
/* Sensor */
630611
static struct mutex g_base_mutex;
631612
static struct mutex g_lid_mutex;
632613

633614
static struct bmi_drv_data_t g_bmi160_data;
634615
static struct stprivate_data g_lis2dwl_data;
635616

636-
/* Matrix to rotate accelerometer into standard reference frame */
637-
/* for rev 0 */
638-
static const mat33_fp_t base_standard_ref_rev0 = {
639-
{FLOAT_TO_FP(-1), 0, 0},
640-
{0, FLOAT_TO_FP(1), 0},
641-
{0, 0, FLOAT_TO_FP(-1)},
642-
};
643-
644617
/* Matrix to rotate accelrator into standard reference frame */
645618
/* TODO: update the matrix after we have assembled unit */
646619
static const mat33_fp_t mag_standard_ref = {
@@ -660,16 +633,24 @@ static struct als_drv_data_t g_tcs3400_data = {
660633
},
661634
};
662635

636+
#ifdef BOARD_ASURADA
637+
/* Matrix to rotate accelerometer into standard reference frame */
638+
/* for rev 0 */
639+
static const mat33_fp_t base_standard_ref_rev0 = {
640+
{FLOAT_TO_FP(-1), 0, 0},
641+
{0, FLOAT_TO_FP(1), 0},
642+
{0, 0, FLOAT_TO_FP(-1)},
643+
};
644+
663645
static void update_rotation_matrix(void)
664646
{
665-
if (board_get_version() == 0) {
666-
motion_sensors[BASE_ACCEL].rot_standard_ref =
667-
&base_standard_ref_rev0;
668-
motion_sensors[BASE_GYRO].rot_standard_ref =
669-
&base_standard_ref_rev0;
670-
}
647+
motion_sensors[BASE_ACCEL].rot_standard_ref =
648+
&base_standard_ref_rev0;
649+
motion_sensors[BASE_GYRO].rot_standard_ref =
650+
&base_standard_ref_rev0;
671651
}
672652
DECLARE_HOOK(HOOK_INIT, update_rotation_matrix, HOOK_PRIO_INIT_ADC + 1);
653+
#endif
673654

674655
static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
675656
/*

board/asurada/board.h

-2
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,5 @@ enum sensor_id {
272272
void board_reset_pd_mcu(void);
273273
int board_get_version(void);
274274

275-
extern enum gpio_signal GPIO_AC_PRESENT;
276-
277275
#endif /* !__ASSEMBLER__ */
278276
#endif /* __CROS_EC_BOARD_H */

board/asurada/gpio.inc

+5-5
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,13 @@ GPIO_INT(VOLUME_UP_L, PIN(D, 6), GPIO_INT_BOTH | GPIO_PULL_UP,
4949
button_interrupt) /* EC_VOLUP_BTN_ODL */
5050

5151
/* Other interrupts */
52-
GPIO_INT(EC_GPM2, PIN(M, 2), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH,
52+
#ifdef BOARD_ASURADA
53+
GPIO_INT(AC_PRESENT, PIN(M, 2), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH,
5354
extpower_interrupt) /* AC_OK / AC_PRESENT in rev0 */
54-
GPIO_INT(EC_GPE5, PIN(E, 5), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH,
55+
#else /* HAYATO */
56+
GPIO_INT(AC_PRESENT, PIN(E, 5), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH,
5557
extpower_interrupt) /* AC_OK / AC_PRESENT in rev1+ */
58+
#endif
5659
GPIO_INT(UART1_RX, PIN(B, 0), GPIO_INT_FALLING,
5760
uart_deepsleep_interrupt) /* UART_DEBUG_TX_EC_RX */
5861
GPIO_INT(WP, PIN(I, 4), GPIO_INT_BOTH,
@@ -135,9 +138,6 @@ UNIMPLEMENTED(PCH_SCI_L)
135138
UNIMPLEMENTED(PCH_WAKE_L)
136139
UNIMPLEMENTED(PCH_PLTRST_L)
137140

138-
/* Fake AC_PRESENT pin before board rev is determined */
139-
UNIMPLEMENTED(AC_PRESENT_PLACEHOLDER)
140-
141141
#define UNIMPLEMENTED_GPIO(name, pin) UNIMPLEMENTED(name)
142142

143143
UNIMPLEMENTED_GPIO(SET_VMC_VOLT_AT_1V8, PIN(D, 4))

0 commit comments

Comments
 (0)