google/beltino, tidus: simplify led_power_on() function
Simplify set_power_led() by consolidating switch and setting values as needed inline based on LED state. Remove unnecesary function param, includes for Tidus. Change-Id: I28e6fac5f8d7e2ff419002db714ce88697895faf Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-on: https://review.coreboot.org/17744 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
committed by
Nico Huber
parent
f5dd23f954
commit
7c6951b059
@@ -19,29 +19,13 @@
|
|||||||
|
|
||||||
void set_power_led(int state)
|
void set_power_led(int state)
|
||||||
{
|
{
|
||||||
switch (state) {
|
it8772f_gpio_led(IT8772F_GPIO_DEV,
|
||||||
case LED_ON:
|
1, /* set */
|
||||||
case LED_OFF:
|
0x01, /* select */
|
||||||
it8772f_gpio_led(IT8772F_GPIO_DEV,
|
state == LED_OFF ? 0x00 : 0x01, /* polarity */
|
||||||
1 /* set */,
|
state == LED_BLINK ? 0x01 : 0x00, /* pullup/pulldown */
|
||||||
0x01 /* select */,
|
0x01, /* output */
|
||||||
state /* polarity: state dependent */,
|
state == LED_BLINK ? 0x00 : 0x01, /* I/O function */
|
||||||
0x00 /* 0=pulldown */,
|
SIO_GPIO_BLINK_GPIO10,
|
||||||
0x01 /* output */,
|
IT8772F_GPIO_BLINK_FREQUENCY_1_HZ);
|
||||||
0x01 /* 1=Simple IO function */,
|
|
||||||
SIO_GPIO_BLINK_GPIO10,
|
|
||||||
IT8772F_GPIO_BLINK_FREQUENCY_1_HZ);
|
|
||||||
break;
|
|
||||||
case LED_BLINK:
|
|
||||||
it8772f_gpio_led(IT8772F_GPIO_DEV,
|
|
||||||
1 /* set */,
|
|
||||||
0x01 /* select */,
|
|
||||||
0x01 /* polarity */,
|
|
||||||
0x01 /* 1=pullup */,
|
|
||||||
0x01 /* output */,
|
|
||||||
0x00, /* 0=Alternate function */
|
|
||||||
SIO_GPIO_BLINK_GPIO10,
|
|
||||||
IT8772F_GPIO_BLINK_FREQUENCY_1_HZ);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -14,35 +14,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <arch/io.h>
|
|
||||||
#include <superio/ite/it8772f/it8772f.h>
|
#include <superio/ite/it8772f/it8772f.h>
|
||||||
#include "onboard.h"
|
#include "onboard.h"
|
||||||
|
|
||||||
void set_power_led(u8 led_pin_map, int state)
|
void set_power_led(int state)
|
||||||
{
|
{
|
||||||
switch (state) {
|
it8772f_gpio_led(IT8772F_GPIO_DEV,
|
||||||
case LED_ON:
|
1, /* set */
|
||||||
case LED_OFF:
|
0x01, /* select */
|
||||||
it8772f_gpio_led(IT8772F_GPIO_DEV,
|
state == LED_OFF ? 0x00 : 0x01, /* polarity */
|
||||||
1 /* set */,
|
state == LED_BLINK ? 0x01 : 0x00, /* pullup/pulldown */
|
||||||
0x01 /* select */,
|
0x01, /* output */
|
||||||
state /* polarity: non-inverting */,
|
state == LED_BLINK ? 0x00 : 0x01, /* I/O function */
|
||||||
0x00 /* 0=pulldown */,
|
SIO_GPIO_BLINK_GPIO10,
|
||||||
0x01 /* output */,
|
IT8772F_GPIO_BLINK_FREQUENCY_1_HZ);
|
||||||
0x01 /* 1=Simple IO function */,
|
|
||||||
led_pin_map,
|
|
||||||
IT8772F_GPIO_BLINK_FREQUENCY_1_HZ);
|
|
||||||
break;
|
|
||||||
case LED_BLINK:
|
|
||||||
it8772f_gpio_led(IT8772F_GPIO_DEV,
|
|
||||||
1 /* set */,
|
|
||||||
0x01 /* select */,
|
|
||||||
0x01 /* polarity */,
|
|
||||||
0x01 /* 1=pullup */,
|
|
||||||
0x01 /* output */,
|
|
||||||
0x00, /* 0=Alternate function */
|
|
||||||
led_pin_map,
|
|
||||||
IT8772F_GPIO_BLINK_FREQUENCY_1_HZ);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
#ifndef __ACPI__
|
#ifndef __ACPI__
|
||||||
void lan_init(void);
|
void lan_init(void);
|
||||||
|
|
||||||
void set_power_led(u8 led_pin_map, int state);
|
void set_power_led(int state);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
LED_OFF = 0,
|
LED_OFF = 0,
|
||||||
|
@@ -56,6 +56,6 @@ void mainboard_pre_console_init(void)
|
|||||||
ite_enable_serial(IT8772F_SERIAL_DEV, CONFIG_TTYS0_BASE);
|
ite_enable_serial(IT8772F_SERIAL_DEV, CONFIG_TTYS0_BASE);
|
||||||
|
|
||||||
/* Turn On GPIO10.LED */
|
/* Turn On GPIO10.LED */
|
||||||
set_power_led(SIO_GPIO_BLINK_GPIO10, LED_ON);
|
set_power_led(LED_ON);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,6 @@
|
|||||||
#include <soc/nvs.h>
|
#include <soc/nvs.h>
|
||||||
#include <soc/pm.h>
|
#include <soc/pm.h>
|
||||||
#include <soc/smm.h>
|
#include <soc/smm.h>
|
||||||
#include <superio/ite/it8772f/it8772f.h>
|
|
||||||
#include "onboard.h"
|
#include "onboard.h"
|
||||||
|
|
||||||
/* USB Charger Control: GPIO26 */
|
/* USB Charger Control: GPIO26 */
|
||||||
@@ -63,13 +62,13 @@ void mainboard_smi_sleep(u8 slp_typ)
|
|||||||
/* Disable USB charging if required */
|
/* Disable USB charging if required */
|
||||||
switch (slp_typ) {
|
switch (slp_typ) {
|
||||||
case ACPI_S3:
|
case ACPI_S3:
|
||||||
set_power_led(SIO_GPIO_BLINK_GPIO10, LED_BLINK);
|
set_power_led(LED_BLINK);
|
||||||
|
|
||||||
/* Enable DCP mode */
|
/* Enable DCP mode */
|
||||||
set_gpio(GPIO_USB_CTL_1, 0);
|
set_gpio(GPIO_USB_CTL_1, 0);
|
||||||
break;
|
break;
|
||||||
case ACPI_S5:
|
case ACPI_S5:
|
||||||
set_power_led(SIO_GPIO_BLINK_GPIO10, LED_OFF);
|
set_power_led(LED_OFF);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user