summaryrefslogtreecommitdiff
path: root/zephyr/shim/include/usbc/tcpc_nct38xx.h
blob: 7a0752904eeb6d0ce3a996bc17d7c6d961988c0c (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
/* Copyright 2021 The ChromiumOS Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef __CROS_EC_TCPC_NCT38XX_H
#define __CROS_EC_TCPC_NCT38XX_H

#include "driver/tcpm/nct38xx.h"

#include <zephyr/devicetree.h>

#define NCT38XX_TCPC_COMPAT nuvoton_nct38xx

#define TCPC_CONFIG_NCT38XX(id) \
	{                                              \
		.bus_type = EC_BUS_TYPE_I2C,           \
		.i2c_info = {                          \
			.port = I2C_PORT_BY_DEV(id),   \
			.addr_flags = DT_REG_ADDR(id), \
		},                                     \
		.drv = &nct38xx_tcpm_drv,              \
		.flags = DT_PROP(id, tcpc_flags),      \
	},

/**
 * @brief Get the NCT38XX GPIO device from the TCPC port enumeration
 *
 * @param port The enumeration of TCPC port
 *
 * @return NULL if failed, otherwise a pointer to NCT38XX GPIO device
 */
const struct device *nct38xx_get_gpio_device_from_port(const int port);

#endif /* __CROS_EC_TCPC_NCT38XX_H */