1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <baseboard/gpio.h>
4 #include <baseboard/variants.h>
6 #include <variant/sku.h>
7 #include <ec/google/chromeec/ec.h>
9 static const struct pad_config default_override_table
[] = {
10 PAD_NC(GPIO_104
, UP_20K
),
12 /* GPIO_137 -- HP_INT_ODL and would be amend by SSFC. */
13 PAD_CFG_GPI_APIC_IOS(GPIO_137
, NONE
, DEEP
, LEVEL
, INVERT
, HIZCRx1
,
16 /* EN_PP3300_TOUCHSCREEN */
17 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146
, 1, DEEP
, NONE
, Tx0RxDCRx0
, DISPUPD
),
18 /* GPIO_105 -- TOUCHSCREEN_RST */
19 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105
, 0, DEEP
, NONE
, Tx1RxDCRx0
, DISPUPD
),
20 /* GPIO_140 -- PEN_RESET */
21 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140
, 0, DEEP
, NONE
, Tx1RxDCRx0
, DISPUPD
),
24 static const struct pad_config hdmi_sku_override_table
[] = {
25 PAD_NC(GPIO_104
, UP_20K
),
28 PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_126
, NONE
, DEEP
, NF1
, HIZCRx1
,
31 PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_127
, NONE
, DEEP
, NF1
, HIZCRx1
,
34 /* GPIO_137 -- HP_INT_ODL and would be amend by SSFC. */
35 PAD_CFG_GPI_APIC_IOS(GPIO_137
, NONE
, DEEP
, LEVEL
, INVERT
, HIZCRx1
,
38 /* EN_PP3300_TOUCHSCREEN */
39 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146
, 1, DEEP
, NONE
, Tx0RxDCRx0
, DISPUPD
),
40 /* GPIO_105 -- TOUCHSCREEN_RST */
41 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105
, 0, DEEP
, NONE
, Tx1RxDCRx0
, DISPUPD
),
42 /* GPIO_140 -- PEN_RESET */
43 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140
, 0, DEEP
, NONE
, Tx1RxDCRx0
, DISPUPD
),
46 const struct pad_config
*variant_override_gpio_table(size_t *num
)
49 sku_id
= google_chromeec_get_board_sku();
56 *num
= ARRAY_SIZE(hdmi_sku_override_table
);
57 return hdmi_sku_override_table
;
59 *num
= ARRAY_SIZE(default_override_table
);
60 return default_override_table
;
64 /* GPIOs needed to be set in romstage. */
65 static const struct pad_config romstage_gpio_table
[] = {
66 /* Enable touchscreen, hold in reset */
67 /* EN_PP3300_TOUCHSCREEN */
68 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146
, 1, DEEP
, NONE
, Tx0RxDCRx0
, DISPUPD
),
69 /* GPIO_105 -- TOUCHSCREEN_RST */
70 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105
, 1, DEEP
, NONE
, Tx1RxDCRx0
, DISPUPD
),
71 /* GPIO_140 -- PEN_RESET */
72 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140
, 1, DEEP
, NONE
, Tx1RxDCRx0
, DISPUPD
),
75 const struct pad_config
*variant_romstage_gpio_table(size_t *num
)
77 *num
= ARRAY_SIZE(romstage_gpio_table
);
78 return romstage_gpio_table
;