mb/google/octopus: Implement touchscreen/digitizer power sequencing

For octopus variants with a touchscreen/digitizer, drive the enable and
reset GPIOs high in romstage, then disable the reset GPIOs in ramstage.
Where available, only set the GPIOs for SKUs which have a touchscreen.
This will allow coreboot to detect the presence of i2c touchscreens
during ACPI SSDT generation (implemented in a subsequent commit).

TEST=tested with rest of patch train

Change-Id: Ia725b4054069c0a4f60afd7e0bca6e2fd5fdcbba
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63212
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Matt DeVillier 2022-03-28 22:40:47 -05:00 committed by Felix Held
parent 53bf72b131
commit 34ffa64ba8
20 changed files with 278 additions and 23 deletions

View File

@ -1,5 +1,7 @@
bootblock-y += gpio.c bootblock-y += gpio.c
romstage-y += gpio.c
ramstage-y += gpio.c ramstage-y += gpio.c
smm-y += gpio.c smm-y += gpio.c

View File

@ -53,13 +53,14 @@ static const struct pad_config variant_override_table[] = {
/* LPSS */ /* LPSS */
PAD_CFG_GPIO_HI_Z(GPIO_81, UP_20K, DEEP, HIZCRx0, DISPUPD), /* GPIO_81_DEBUG (Boot halt) -- MIPI60 DEBUG */ PAD_CFG_GPIO_HI_Z(GPIO_81, UP_20K, DEEP, HIZCRx0, DISPUPD), /* GPIO_81_DEBUG (Boot halt) -- MIPI60 DEBUG */
PAD_NC(GPIO_84, NONE), /* LPSS_SPI_2_CLK - unused */ PAD_NC(GPIO_84, NONE), /* LPSS_SPI_2_CLK - unused */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPI_APIC_IOS(GPIO_137, NONE, DEEP, EDGE_BOTH, INVERT, HIZCRx1, PAD_CFG_GPI_APIC_IOS(GPIO_137, NONE, DEEP, EDGE_BOTH, INVERT, HIZCRx1,
DISPUPD),/* GPIO_137 -- HP_INT_ODL */ DISPUPD),/* GPIO_137 -- HP_INT_ODL */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),/* GPIO_140 -- PEN_RESET */ PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),/* GPIO_140 -- PEN_RESET */
PAD_NC(GPIO_143, UP_20K), /* GPIO_143 - NC */ PAD_NC(GPIO_143, UP_20K), /* GPIO_143 - NC */
PAD_NC(GPIO_144, UP_20K), /* GPIO_144 - PEN_EJECT */ PAD_NC(GPIO_144, UP_20K), /* GPIO_144 - PEN_EJECT */
PAD_NC(GPIO_145, UP_20K), /* GPIO_145 - PEN_EJECT */ PAD_NC(GPIO_145, UP_20K), /* GPIO_145 - PEN_EJECT */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0, DISPUPD), /* EN_PP3300_TOUCHSCREEN */ PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD), /* EN_PP3300_TOUCHSCREEN */
/* AUDIO COMMUNITY GPIOS*/ /* AUDIO COMMUNITY GPIOS*/
PAD_NC(GPIO_157, DN_20K),/* AVS_I2S0_BCLK -- unused */ PAD_NC(GPIO_157, DN_20K),/* AVS_I2S0_BCLK -- unused */
@ -115,3 +116,20 @@ const struct pad_config *variant_early_gpio_table(size_t *num)
*num = ARRAY_SIZE(early_gpio_table); *num = ARRAY_SIZE(early_gpio_table);
return early_gpio_table; return early_gpio_table;
} }
/* GPIOs needed to be set in romstage. */
static const struct pad_config romstage_gpio_table[] = {
/* Enable touchscreen, hold in reset */
/* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
};
const struct pad_config *variant_romstage_gpio_table(size_t *num)
{
*num = ARRAY_SIZE(romstage_gpio_table);
return romstage_gpio_table;
}

View File

@ -1,5 +1,7 @@
bootblock-y += gpio.c bootblock-y += gpio.c
romstage-y += gpio.c
ramstage-y += gpio.c ramstage-y += gpio.c
ramstage-y += variant.c ramstage-y += variant.c

View File

@ -30,8 +30,10 @@ static const struct pad_config default_override_table[] = {
PAD_CFG_GPI_APIC_IOS(GPIO_137, NONE, DEEP, LEVEL, INVERT, HIZCRx1, PAD_CFG_GPI_APIC_IOS(GPIO_137, NONE, DEEP, LEVEL, INVERT, HIZCRx1,
DISPUPD), DISPUPD),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* EN_PP3300_TOUCHSCREEN */ /* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0, PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0,
DISPUPD), DISPUPD),
}; };
@ -40,3 +42,18 @@ const struct pad_config *variant_override_gpio_table(size_t *num)
*num = ARRAY_SIZE(default_override_table); *num = ARRAY_SIZE(default_override_table);
return default_override_table; return default_override_table;
} }
/* GPIOs needed to be set in romstage. */
static const struct pad_config romstage_gpio_table[] = {
/* Enable touchscreen, hold in reset */
/* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
};
const struct pad_config *variant_romstage_gpio_table(size_t *num)
{
*num = ARRAY_SIZE(romstage_gpio_table);
return romstage_gpio_table;
}

View File

@ -1,5 +1,7 @@
bootblock-y += gpio.c bootblock-y += gpio.c
romstage-y += gpio.c
ramstage-y += gpio.c ramstage-y += gpio.c
ramstage-y += variant.c ramstage-y += variant.c

View File

@ -21,8 +21,11 @@ static const struct pad_config default_override_table[] = {
DISPUPD), DISPUPD),
/* EN_PP3300_TOUCHSCREEN */ /* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0, PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
DISPUPD), /* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
PAD_NC(GPIO_213, DN_20K), PAD_NC(GPIO_213, DN_20K),
}; };
@ -36,8 +39,11 @@ static const struct pad_config lte_override_table[] = {
DISPUPD), DISPUPD),
/* EN_PP3300_TOUCHSCREEN */ /* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0, PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
DISPUPD), /* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
PAD_NC(GPIO_213, DN_20K), PAD_NC(GPIO_213, DN_20K),
@ -87,3 +93,20 @@ const struct pad_config *variant_early_override_gpio_table(size_t *num)
return lte_early_override_table; return lte_early_override_table;
} }
/* GPIOs needed to be set in romstage. */
static const struct pad_config romstage_gpio_table[] = {
/* Enable touchscreen, hold in reset */
/* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
};
const struct pad_config *variant_romstage_gpio_table(size_t *num)
{
*num = ARRAY_SIZE(romstage_gpio_table);
return romstage_gpio_table;
}

View File

@ -1,5 +1,7 @@
bootblock-y += gpio.c bootblock-y += gpio.c
romstage-y += gpio.c
ramstage-y += gpio.c ramstage-y += gpio.c
ramstage-y += variant.c ramstage-y += variant.c

View File

@ -16,8 +16,10 @@ enum {
static const struct pad_config default_override_table[] = { static const struct pad_config default_override_table[] = {
PAD_NC(GPIO_104, UP_20K), PAD_NC(GPIO_104, UP_20K),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* EN_PP3300_TOUCHSCREEN */ /* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0, PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0,
DISPUPD), DISPUPD),
PAD_NC(GPIO_213, DN_20K), PAD_NC(GPIO_213, DN_20K),
@ -27,8 +29,10 @@ static const struct pad_config lte_override_table[] = {
/* Default override table. */ /* Default override table. */
PAD_NC(GPIO_104, UP_20K), PAD_NC(GPIO_104, UP_20K),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* EN_PP3300_TOUCHSCREEN */ /* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0, PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0,
DISPUPD), DISPUPD),
PAD_NC(GPIO_213, DN_20K), PAD_NC(GPIO_213, DN_20K),
@ -77,3 +81,18 @@ const struct pad_config *variant_early_override_gpio_table(size_t *num)
return lte_early_override_table; return lte_early_override_table;
} }
/* GPIOs needed to be set in romstage. */
static const struct pad_config romstage_gpio_table[] = {
/* Enable touchscreen, hold in reset */
/* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
};
const struct pad_config *variant_romstage_gpio_table(size_t *num)
{
*num = ARRAY_SIZE(romstage_gpio_table);
return romstage_gpio_table;
}

View File

@ -1,5 +1,7 @@
bootblock-y += gpio.c bootblock-y += gpio.c
romstage-y += gpio.c
ramstage-y += gpio.c ramstage-y += gpio.c
ramstage-y += variant.c ramstage-y += variant.c

View File

@ -23,7 +23,11 @@ static const struct pad_config default_override_table[] = {
PAD_NC(GPIO_145, UP_20K), PAD_NC(GPIO_145, UP_20K),
/* EN_PP3300_TOUCHSCREEN */ /* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0, DISPUPD), PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* AVS_I2S1_MCLK -- PLT_RST_LTE_L */ /* AVS_I2S1_MCLK -- PLT_RST_LTE_L */
PAD_CFG_GPO(GPIO_161, 1, DEEP), PAD_CFG_GPO(GPIO_161, 1, DEEP),
@ -56,3 +60,20 @@ const struct pad_config *variant_early_override_gpio_table(size_t *num)
return lte_early_override_table; return lte_early_override_table;
} }
/* GPIOs needed to be set in romstage. */
static const struct pad_config romstage_gpio_table[] = {
/* Enable touchscreen, hold in reset */
/* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
};
const struct pad_config *variant_romstage_gpio_table(size_t *num)
{
*num = ARRAY_SIZE(romstage_gpio_table);
return romstage_gpio_table;
}

View File

@ -1,3 +1,4 @@
bootblock-y += gpio.c bootblock-y += gpio.c
romstage-y += gpio.c
ramstage-y += gpio.c ramstage-y += gpio.c
ramstage-y += variant.c ramstage-y += variant.c

View File

@ -14,8 +14,11 @@ static const struct pad_config default_override_table[] = {
PAD_NC(GPIO_143, UP_20K), PAD_NC(GPIO_143, UP_20K),
/* EN_PP3300_TOUCHSCREEN */ /* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0, PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
DISPUPD), /* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
PAD_NC(GPIO_161, DN_20K), PAD_NC(GPIO_161, DN_20K),
@ -67,3 +70,31 @@ const struct pad_config *variant_override_gpio_table(size_t *num)
return c; return c;
} }
/* Touchscreen GPIOs needed to be set in romstage. */
static const struct pad_config romstage_touch_gpio_table[] = {
/* Enable touchscreen, hold in reset */
/* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
};
const struct pad_config *variant_romstage_gpio_table(size_t *num)
{
const struct pad_config *c;
uint32_t sku_id;
sku_id = google_chromeec_get_board_sku();
if (no_touchscreen_sku(sku_id)) {
c = NULL;
*num = 0;
} else {
c = romstage_touch_gpio_table;
*num = ARRAY_SIZE(romstage_touch_gpio_table);
}
return c;
}

View File

@ -1,5 +1,7 @@
bootblock-y += gpio.c bootblock-y += gpio.c
romstage-y += gpio.c
ramstage-y += gpio.c ramstage-y += gpio.c
ramstage-y += variant.c ramstage-y += variant.c

View File

@ -14,9 +14,10 @@ static const struct pad_config default_override_table[] = {
PAD_CFG_GPI_APIC_IOS(GPIO_137, NONE, DEEP, LEVEL, INVERT, HIZCRx1, PAD_CFG_GPI_APIC_IOS(GPIO_137, NONE, DEEP, LEVEL, INVERT, HIZCRx1,
DISPUPD), DISPUPD),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* EN_PP3300_TOUCHSCREEN */ /* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0, PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
DISPUPD),
PAD_NC(GPIO_213, DN_20K), PAD_NC(GPIO_213, DN_20K),
}; };
@ -35,9 +36,10 @@ static const struct pad_config hdmi_override_table[] = {
PAD_CFG_GPI_APIC_IOS(GPIO_137, NONE, DEEP, LEVEL, INVERT, HIZCRx1, PAD_CFG_GPI_APIC_IOS(GPIO_137, NONE, DEEP, LEVEL, INVERT, HIZCRx1,
DISPUPD), DISPUPD),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* EN_PP3300_TOUCHSCREEN */ /* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0, PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
DISPUPD),
PAD_NC(GPIO_213, DN_20K), PAD_NC(GPIO_213, DN_20K),
@ -52,8 +54,11 @@ static const struct pad_config lte_override_table[] = {
DISPUPD), DISPUPD),
/* EN_PP3300_TOUCHSCREEN */ /* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0, PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
DISPUPD), /* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
PAD_NC(GPIO_213, DN_20K), PAD_NC(GPIO_213, DN_20K),
@ -108,3 +113,20 @@ const struct pad_config *variant_early_override_gpio_table(size_t *num)
return lte_early_override_table; return lte_early_override_table;
} }
/* GPIOs needed to be set in romstage. */
static const struct pad_config romstage_gpio_table[] = {
/* Enable touchscreen, hold in reset */
/* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
};
const struct pad_config *variant_romstage_gpio_table(size_t *num)
{
*num = ARRAY_SIZE(romstage_gpio_table);
return romstage_gpio_table;
}

View File

@ -1,5 +1,7 @@
bootblock-y += gpio.c bootblock-y += gpio.c
romstage-y += gpio.c
ramstage-y += gpio.c ramstage-y += gpio.c
ramstage-y += variant.c ramstage-y += variant.c

View File

@ -15,8 +15,11 @@ static const struct pad_config default_override_table[] = {
DISPUPD), DISPUPD),
/* EN_PP3300_TOUCHSCREEN */ /* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0, PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
DISPUPD), /* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
}; };
static const struct pad_config hdmi_sku_override_table[] = { static const struct pad_config hdmi_sku_override_table[] = {
@ -34,8 +37,11 @@ static const struct pad_config hdmi_sku_override_table[] = {
DISPUPD), DISPUPD),
/* EN_PP3300_TOUCHSCREEN */ /* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0, PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
DISPUPD), /* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
}; };
const struct pad_config *variant_override_gpio_table(size_t *num) const struct pad_config *variant_override_gpio_table(size_t *num)
@ -55,3 +61,20 @@ const struct pad_config *variant_override_gpio_table(size_t *num)
return default_override_table; return default_override_table;
} }
} }
/* GPIOs needed to be set in romstage. */
static const struct pad_config romstage_gpio_table[] = {
/* Enable touchscreen, hold in reset */
/* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
};
const struct pad_config *variant_romstage_gpio_table(size_t *num)
{
*num = ARRAY_SIZE(romstage_gpio_table);
return romstage_gpio_table;
}

View File

@ -1,5 +1,6 @@
bootblock-y += gpio.c bootblock-y += gpio.c
romstage-y += gpio.c
romstage-y += memory.c romstage-y += memory.c
ramstage-y += variant.c ramstage-y += variant.c

View File

@ -19,8 +19,11 @@ static const struct pad_config default_override_table[] = {
PAD_NC(GPIO_143, UP_20K), PAD_NC(GPIO_143, UP_20K),
/* EN_PP3300_TOUCHSCREEN */ /* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0, PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
DISPUPD), /* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
PAD_NC(GPIO_161, DN_20K), PAD_NC(GPIO_161, DN_20K),
@ -79,3 +82,32 @@ const struct pad_config *variant_override_gpio_table(size_t *num)
return c; return c;
} }
/* Touchscreen GPIOs needed to be set in romstage. */
static const struct pad_config romstage_touch_gpio_table[] = {
/* Enable touchscreen, hold in reset */
/* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
};
const struct pad_config *variant_romstage_gpio_table(size_t *num)
{
const struct pad_config *c;
uint32_t sku_id = SKU_UNKNOWN;
google_chromeec_cbi_get_sku_id(&sku_id);
if (no_touchscreen_sku(sku_id)) {
c = NULL;
*num = 0;
} else {
c = romstage_touch_gpio_table;
*num = ARRAY_SIZE(romstage_touch_gpio_table);
}
return c;
}

View File

@ -1 +1,2 @@
bootblock-y += gpio.c bootblock-y += gpio.c
romstage-y += gpio.c

View File

@ -38,3 +38,35 @@ const struct pad_config *variant_early_gpio_table(size_t *num)
*num = ARRAY_SIZE(early_gpio_table); *num = ARRAY_SIZE(early_gpio_table);
return early_gpio_table; return early_gpio_table;
} }
static const struct pad_config default_override_table[] = {
/* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
};
const struct pad_config *variant_override_gpio_table(size_t *num)
{
*num = ARRAY_SIZE(default_override_table);
return default_override_table;
}
/* GPIOs needed to be set in romstage. */
static const struct pad_config romstage_gpio_table[] = {
/* Enable touchscreen, hold in reset */
/* EN_PP3300_TOUCHSCREEN */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
/* GPIO_105 -- TOUCHSCREEN_RST */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
/* GPIO_140 -- PEN_RESET */
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
};
const struct pad_config *variant_romstage_gpio_table(size_t *num)
{
*num = ARRAY_SIZE(romstage_gpio_table);
return romstage_gpio_table;
}