1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/* SPDX-License-Identifier: GPL-2.0-only */
#include <delay.h>
#include <pc80/i8254.h>
#include <gpio.h>
#include <mainboard/beep.h>
#define LED_GPIO_PAD GPP_E8
#define SPKR_GPIO_PAD GPP_B14
static const struct pad_config spkr_led_cfg_tbl[] = {
PAD_CFG_GPO(LED_GPIO_PAD, 0, PLTRST), /* GPIO */
PAD_CFG_NF(SPKR_GPIO_PAD, DN_20K, PLTRST, NF1), /* SPKR */
};
static const struct pad_config sata_led_cfg_tbl[] = {
PAD_CFG_NF(LED_GPIO_PAD, UP_5K, PLTRST, NF1), /* SATALED# */
};
static void config_gpio_spkr_led(void)
{
gpio_configure_pads(spkr_led_cfg_tbl, ARRAY_SIZE(spkr_led_cfg_tbl));
}
static void config_gpio_sata_led(void)
{
gpio_configure_pads(sata_led_cfg_tbl, ARRAY_SIZE(sata_led_cfg_tbl));
}
static void blink_sata_led(unsigned int on)
{
gpio_set(LED_GPIO_PAD, on ^ 1);
}
void mainboard_beep_and_blink_on_panic_once(void)
{
const unsigned int duration_msec = 300;
static bool once = false;
if (!once) {
config_gpio_spkr_led();
once = true;
}
blink_sata_led(1);
if (CONFIG(BEEP_ON_PANIC))
beep(800, duration_msec);
else
mdelay(duration_msec);
blink_sata_led(0);
}
void mainboard_beep_and_blink_on_boot_once(void)
{
const unsigned int duration_msec = 500;
if (CONFIG(BEEP_ON_BOOT)) {
config_gpio_spkr_led();
blink_sata_led(1);
beep(600, duration_msec);
blink_sata_led(0);
config_gpio_sata_led();
}
}
|