blob: 185794f0bcd6d37b289e0e2ee8a073b80734e49e (
plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/* Copyright 2019 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Hatch board-specific configuration */
#include "common.h"
#include "driver/ppc/sn5s330.h"
#include "extpower.h"
#include "gpio.h"
#include "lid_switch.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
#include "pwm_chip.h"
#include "spi.h"
#include "switch.h"
#include "system.h"
#include "uart.h"
#include "usb_pd.h"
#include "usbc_ppc.h"
#include "util.h"
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
static void ppc_interrupt(enum gpio_signal signal)
{
switch (signal) {
case GPIO_USB_C0_PPC_INT_ODL:
sn5s330_interrupt(0);
break;
case GPIO_USB_C1_PPC_INT_ODL:
sn5s330_interrupt(1);
break;
default:
break;
}
}
static void tcpc_alert_event(enum gpio_signal signal)
{
int port = -1;
switch (signal) {
case GPIO_USB_C0_TCPC_INT_ODL:
port = 0;
break;
case GPIO_USB_C1_TCPC_INT_ODL:
port = 1;
break;
default:
return;
}
schedule_deferred_pd_interrupt(port);
}
#include "gpio_list.h" /* Must come after other header files. */
/******************************************************************************/
/* Wake up pins */
const enum gpio_signal hibernate_wake_pins[] = {
};
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/******************************************************************************/
/* SPI devices */
const struct spi_device_t spi_devices[] = {
};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
[PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 }
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
void board_overcurrent_event(int port, int is_overcurrented)
{
/* Sanity check the port. */
if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT))
return;
/* Note that the level is inverted because the pin is active low. */
gpio_set_level(GPIO_USB_C_OC_ODL, !is_overcurrented);
}
|