diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mainboard/dell/xps_8300/smihandler.c | 16 | ||||
-rw-r--r-- | src/mainboard/google/beltino/variants/mccloud/led.c | 19 | ||||
-rw-r--r-- | src/mainboard/google/beltino/variants/tricky/led.c | 19 | ||||
-rw-r--r-- | src/mainboard/google/jecht/led.c | 25 | ||||
-rw-r--r-- | src/mainboard/hp/pro_3500_series/led.c | 18 | ||||
-rw-r--r-- | src/mainboard/samsung/stumpy/early_init.c | 35 | ||||
-rw-r--r-- | src/mainboard/samsung/stumpy/smihandler.c | 17 |
7 files changed, 78 insertions, 71 deletions
diff --git a/src/mainboard/dell/xps_8300/smihandler.c b/src/mainboard/dell/xps_8300/smihandler.c index f126468fa5..279295b822 100644 --- a/src/mainboard/dell/xps_8300/smihandler.c +++ b/src/mainboard/dell/xps_8300/smihandler.c @@ -4,6 +4,7 @@ #include <acpi/acpi.h> #include <cpu/x86/smm.h> #include <superio/ite/common/ite.h> +#include <superio/ite/common/ite_gpio.h> #include <superio/ite/it8772f/it8772f.h> #define GPIO_DEV PNP_DEV(0x2e, IT8772F_GPIO) @@ -14,16 +15,11 @@ void mainboard_smi_sleep(u8 slp_typ) case ACPI_S3: ite_set_3vsbsw(GPIO_DEV, true); ite_delay_pwrgd3(GPIO_DEV); - it8772f_gpio_led( - GPIO_DEV, - 2 /* set */, - 0x02 /* select */, - 0x01 /* polarity */, - 0x01 /* 1 = pullup */, - 0x01 /* output */, - 0x00 /* 1 = Simple IO function */, - SIO_GPIO_BLINK_GPIO22, - IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); + ite_reg_write(GPIO_DEV, ITE_GPIO_REG_SELECT(1), 0x02); + ite_gpio_setup(GPIO_DEV, 22, ITE_GPIO_OUTPUT, ITE_GPIO_ALT_FN_MODE, + ITE_GPIO_POL_INVERT | ITE_GPIO_PULLUP_ENABLE); + ite_gpio_setup_led(GPIO_DEV, 22, ITE_GPIO_LED_1, ITE_LED_FREQ_1HZ, + ITE_LED_CONTROL_DEFAULT); break; default: break; diff --git a/src/mainboard/google/beltino/variants/mccloud/led.c b/src/mainboard/google/beltino/variants/mccloud/led.c index da5002f4fd..04e17ece5e 100644 --- a/src/mainboard/google/beltino/variants/mccloud/led.c +++ b/src/mainboard/google/beltino/variants/mccloud/led.c @@ -1,17 +1,18 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <superio/ite/common/ite.h> +#include <superio/ite/common/ite_gpio.h> #include <superio/ite/it8772f/it8772f.h> #include "../../onboard.h" void set_power_led(int state) { - it8772f_gpio_led(IT8772F_GPIO_DEV, - 1, /* set */ - 0x01, /* select */ - state == LED_BLINK ? 0x01 : 0x00, /* polarity */ - state == LED_BLINK ? 0x01 : 0x00, /* pullup/pulldown */ - 0x01, /* output */ - state == LED_BLINK ? 0x00 : 0x01, /* I/O function */ - SIO_GPIO_BLINK_GPIO10, - IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); + /* Configure GPIO10 as power LED */ + ite_reg_write(IT8772F_GPIO_DEV, ITE_GPIO_REG_SELECT(0), 0x01); + ite_gpio_setup(IT8772F_GPIO_DEV, 10, ITE_GPIO_OUTPUT, + state == LED_BLINK ? ITE_GPIO_ALT_FN_MODE : ITE_GPIO_SIMPLE_IO_MODE, + state == LED_BLINK ? ITE_GPIO_POL_INVERT | ITE_GPIO_PULLUP_ENABLE + : ITE_GPIO_CONTROL_DEFAULT); + ite_gpio_setup_led(IT8772F_GPIO_DEV, 10, ITE_GPIO_LED_1, + ITE_LED_FREQ_1HZ, ITE_LED_CONTROL_DEFAULT); } diff --git a/src/mainboard/google/beltino/variants/tricky/led.c b/src/mainboard/google/beltino/variants/tricky/led.c index 49d7918952..b21e18e8e4 100644 --- a/src/mainboard/google/beltino/variants/tricky/led.c +++ b/src/mainboard/google/beltino/variants/tricky/led.c @@ -1,17 +1,18 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <superio/ite/common/ite.h> +#include <superio/ite/common/ite_gpio.h> #include <superio/ite/it8772f/it8772f.h> #include "../../onboard.h" void set_power_led(int state) { - it8772f_gpio_led(IT8772F_GPIO_DEV, - 2, /* set */ - 0xF7, /* select */ - state == LED_OFF ? 0x00 : 0x04, /* polarity */ - state == LED_BLINK ? 0x04 : 0x00, /* pullup/pulldown */ - 0x04, /* output */ - state == LED_BLINK ? 0x00 : 0x04, /* I/O function */ - SIO_GPIO_BLINK_GPIO22, - IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); + /* Configure GPIO22 as power LED */ + ite_reg_write(IT8772F_GPIO_DEV, ITE_GPIO_REG_SELECT(1), 0xf7); + ite_gpio_setup(IT8772F_GPIO_DEV, 22, ITE_GPIO_OUTPUT, + state == LED_BLINK ? ITE_GPIO_ALT_FN_MODE : ITE_GPIO_SIMPLE_IO_MODE, + (state != LED_OFF ? ITE_GPIO_POL_INVERT : 0) | + (state == LED_BLINK ? ITE_GPIO_PULLUP_ENABLE : 0)); + ite_gpio_setup_led(IT8772F_GPIO_DEV, 22, ITE_GPIO_LED_1, + ITE_LED_FREQ_1HZ, ITE_LED_CONTROL_DEFAULT); } diff --git a/src/mainboard/google/jecht/led.c b/src/mainboard/google/jecht/led.c index 8a6a30465b..811521eea7 100644 --- a/src/mainboard/google/jecht/led.c +++ b/src/mainboard/google/jecht/led.c @@ -1,25 +1,26 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <superio/ite/common/ite.h> +#include <superio/ite/common/ite_gpio.h> #include <superio/ite/it8772f/it8772f.h> #include "onboard.h" void set_power_led(int state) { - int polarity; + u8 polarity; if (CONFIG(BOARD_GOOGLE_TIDUS)) { - polarity = state == LED_OFF ? 0x00 : 0x01; + polarity = state == LED_OFF ? ITE_GPIO_POL_INVERT : 0; } else { - polarity = state == LED_BLINK ? 0x01 : 0x00; + polarity = state == LED_BLINK ? ITE_GPIO_POL_INVERT : 0; } - it8772f_gpio_led(IT8772F_GPIO_DEV, - 1, /* set */ - 0x01, /* select */ - polarity, /* polarity */ - state == LED_BLINK ? 0x01 : 0x00, /* pullup/pulldown */ - 0x01, /* output */ - state == LED_BLINK ? 0x00 : 0x01, /* I/O function */ - SIO_GPIO_BLINK_GPIO10, - IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); + /* Configure GPIO10 as power LED */ + ite_reg_write(IT8772F_GPIO_DEV, ITE_GPIO_REG_SELECT(0), 0x01); + ite_gpio_setup(IT8772F_GPIO_DEV, 10, ITE_GPIO_OUTPUT, + state == LED_BLINK ? ITE_GPIO_ALT_FN_MODE : ITE_GPIO_SIMPLE_IO_MODE, + (state == LED_BLINK ? ITE_GPIO_PULLUP_ENABLE : ITE_GPIO_CONTROL_DEFAULT) | + polarity); + ite_gpio_setup_led(IT8772F_GPIO_DEV, 10, ITE_GPIO_LED_1, ITE_LED_FREQ_1HZ, + ITE_LED_CONTROL_DEFAULT); } diff --git a/src/mainboard/hp/pro_3500_series/led.c b/src/mainboard/hp/pro_3500_series/led.c index 073f5f501f..103763fae2 100644 --- a/src/mainboard/hp/pro_3500_series/led.c +++ b/src/mainboard/hp/pro_3500_series/led.c @@ -1,17 +1,17 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <superio/ite/common/ite.h> +#include <superio/ite/common/ite_gpio.h> + #include "common_defines.h" #include "led.h" void set_power_led(int state) { - // Board has a dual color LED - it8772f_gpio_setup( - GPIO_DEV, - 2, /* set */ - 0xf3 | LED_BOTH, /* select, 0xf3 is default */ - state, /* polarity */ - 0x00, /* pullup */ - LED_BOTH, /* output */ - 0x00); /* enable */ + // Board has a dual color LED: GPIO22 and GPIO23 + ite_reg_write(GPIO_DEV, ITE_GPIO_REG_SELECT(1), 0xf3 | LED_BOTH); + ite_gpio_setup(GPIO_DEV, 22, ITE_GPIO_OUTPUT, ITE_GPIO_ALT_FN_MODE, + state & LED_WHITE ? ITE_GPIO_POL_INVERT : ITE_GPIO_CONTROL_DEFAULT); + ite_gpio_setup(GPIO_DEV, 23, ITE_GPIO_OUTPUT, ITE_GPIO_ALT_FN_MODE, + state & LED_YELLOW ? ITE_GPIO_POL_INVERT : ITE_GPIO_CONTROL_DEFAULT); } diff --git a/src/mainboard/samsung/stumpy/early_init.c b/src/mainboard/samsung/stumpy/early_init.c index 852759ead9..e4b402027e 100644 --- a/src/mainboard/samsung/stumpy/early_init.c +++ b/src/mainboard/samsung/stumpy/early_init.c @@ -5,6 +5,7 @@ #include <pc80/mc146818rtc.h> #include <bootmode.h> #include <superio/ite/common/ite.h> +#include <superio/ite/common/ite_gpio.h> #include <superio/ite/it8772f/it8772f.h> #include <northbridge/intel/sandybridge/sandybridge.h> #include <northbridge/intel/sandybridge/raminit.h> @@ -58,32 +59,40 @@ static void setup_sio_gpios(void) * GPIO10 as USBPWRON12# * GPIO12 as USBPWRON13# */ - it8772f_gpio_setup(GPIO_DEV, 1, 0x05, 0x05, 0x00, 0x05, 0x05); - + ite_reg_write(GPIO_DEV, ITE_GPIO_REG_SELECT(0), 0x05); + ite_gpio_setup(GPIO_DEV, 10, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_POL_INVERT); + ite_gpio_setup(GPIO_DEV, 12, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_POL_INVERT); /* * GPIO22 as wake SCI# */ - it8772f_gpio_setup(GPIO_DEV, 2, 0x04, 0x04, 0x00, 0x04, 0x04); - + ite_reg_write(GPIO_DEV, ITE_GPIO_REG_SELECT(1), 0x04); + ite_gpio_setup(GPIO_DEV, 22, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_POL_INVERT); /* * GPIO32 as EXTSMI# */ - it8772f_gpio_setup(GPIO_DEV, 3, 0x04, 0x04, 0x00, 0x04, 0x04); - + ite_reg_write(GPIO_DEV, ITE_GPIO_REG_SELECT(2), 0x04); + ite_gpio_setup(GPIO_DEV, 32, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_POL_INVERT); /* * GPIO45 as LED_POWER# */ - it8772f_gpio_led(GPIO_DEV, 4 /* set */, (0x1 << 5) /* select */, - (0x1 << 5) /* polarity */, (0x1 << 5) /* 1 = pullup */, - (0x1 << 5) /* output */, (0x1 << 5) /* 1 = Simple IO function */, - SIO_GPIO_BLINK_GPIO45, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); - + ite_reg_write(GPIO_DEV, ITE_GPIO_REG_SELECT(3), 0x20); + ite_gpio_setup(GPIO_DEV, 45, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_POL_INVERT | ITE_GPIO_PULLUP_ENABLE); + ite_gpio_setup_led(GPIO_DEV, 45, ITE_GPIO_LED_1, ITE_LED_FREQ_1HZ, + ITE_LED_CONTROL_DEFAULT); /* * GPIO51 as USBPWRON8# * GPIO52 as USBPWRON1# */ - it8772f_gpio_setup(GPIO_DEV, 5, 0x06, 0x06, 0x00, 0x06, 0x06); - it8772f_gpio_setup(GPIO_DEV, 6, 0x00, 0x00, 0x00, 0x00, 0x00); + ite_reg_write(GPIO_DEV, ITE_GPIO_REG_SELECT(4), 0x06); + ite_gpio_setup(GPIO_DEV, 51, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_POL_INVERT); + ite_gpio_setup(GPIO_DEV, 52, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_POL_INVERT); } void mainboard_fill_pei_data(struct pei_data *pei_data) diff --git a/src/mainboard/samsung/stumpy/smihandler.c b/src/mainboard/samsung/stumpy/smihandler.c index f9b9d3b8db..0b6e133558 100644 --- a/src/mainboard/samsung/stumpy/smihandler.c +++ b/src/mainboard/samsung/stumpy/smihandler.c @@ -8,6 +8,8 @@ #include <northbridge/intel/sandybridge/sandybridge.h> /* Include for SIO helper functions */ +#include <superio/ite/common/ite.h> +#include <superio/ite/common/ite_gpio.h> #include <superio/ite/it8772f/it8772f.h> #define GPIO_DEV PNP_DEV(0x2e, IT8772F_GPIO) @@ -20,17 +22,14 @@ void mainboard_smi_sleep(u8 slp_typ) switch (slp_typ) { case ACPI_S3: case ACPI_S4: - it8772f_gpio_led(GPIO_DEV, 4 /* set */, (0x1 << 5) /* select */, - (0x1 << 5) /* polarity */, (0x1 << 5) /* 1 = pullup */, - (0x1 << 5) /* output */, 0x00, /* 0 = Alternate function */ - SIO_GPIO_BLINK_GPIO45, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); + ite_gpio_setup(GPIO_DEV, 45, ITE_GPIO_OUTPUT, ITE_GPIO_ALT_FN_MODE, + ITE_GPIO_POL_INVERT | ITE_GPIO_PULLUP_ENABLE); + ite_gpio_setup_led(GPIO_DEV, 45, ITE_GPIO_LED_1, ITE_LED_FREQ_1HZ, + ITE_LED_CONTROL_DEFAULT); break; - case ACPI_S5: - it8772f_gpio_led(GPIO_DEV, 4 /* set */, (0x1 << 5) /* select */, - 0x00 /* polarity: non-inverting */, 0x00 /* 0 = pulldown */, - (0x1 << 5) /* output */, (0x1 << 5) /* 1 = Simple IO function */, - SIO_GPIO_BLINK_GPIO45, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); + ite_gpio_setup(GPIO_DEV, 45, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_CONTROL_DEFAULT); break; default: break; |