aboutsummaryrefslogtreecommitdiffstats
path: root/tcpm.h
blob: 862dfffed67f21980693119e62f7e34b499e989f (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
/* Copyright 2015 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.
 */

/* USB Power delivery port management - common header for TCPM drivers */

#ifndef __CROS_EC_USB_PD_TCPM_TCPM_H
#define __CROS_EC_USB_PD_TCPM_TCPM_H

#ifdef __cplusplus
extern "C" {
#endif

#include "tcpm_driver.h"
#include "usb_pd_tcpm.h"

#if defined(CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE) && \
	!defined(CONFIG_USB_PD_DUAL_ROLE)
#error "DRP auto toggle requires board to have DRP support"
#error "Please upgrade your board configuration"
#endif

#ifndef CONFIG_USB_PD_TCPC
extern const struct tcpc_config_t tcpc_config[];

/* I2C wrapper functions - get I2C port / slave addr from config struct. */
int16_t tcpc_write(int16_t port, int16_t reg, int16_t val);
int16_t tcpc_write16(int16_t port, int16_t reg, int16_t val);
int16_t tcpc_read(int16_t port, int16_t reg, int16_t *val);
int16_t tcpc_read16(int16_t port, int16_t reg, int16_t *val);
int16_t tcpc_xfer(int16_t port,
		const uint8_t *out, int16_t out_size,
		uint8_t *in, int16_t in_size,
		int16_t flags);

#endif

#ifdef __cplusplus
}
#endif

#endif