diff options
author | Vic Yang <victoryang@chromium.org> | 2014-09-19 11:15:45 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-09-23 06:28:38 +0000 |
commit | cc0843d2704cc0f2352f3ea207d0c59e42a6f934 (patch) | |
tree | 27c3a104447c6e6b0253310e8412fd764ff7bd86 /driver/ioexpander_pca9534.h | |
parent | 9ac7415b3cf459a7287babf995364d56afa70b81 (diff) | |
download | chrome-ec-cc0843d2704cc0f2352f3ea207d0c59e42a6f934.tar.gz |
Plankton: Add console command to reset USB hub
This command resets the USB hub through the IO expander.
BUG=None
TEST=Reset the hub on Plankton.
BRANCH=None
Change-Id: Ia77a1e326adc6aba65438534158a4c461479727a
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/218758
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'driver/ioexpander_pca9534.h')
-rw-r--r-- | driver/ioexpander_pca9534.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/driver/ioexpander_pca9534.h b/driver/ioexpander_pca9534.h new file mode 100644 index 0000000000..70b3e57662 --- /dev/null +++ b/driver/ioexpander_pca9534.h @@ -0,0 +1,56 @@ +/* Copyright (c) 2014 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. + * + * NXP PCA9534 I/O expander + */ + +#ifndef PCA9534_H +#define PCA9534_H + +#define PCA9534_REG_INPUT 0x0 +#define PCA9534_REG_OUTPUT 0x1 +#define PCA9534_REG_CONFIG 0x3 + +#define PCA9534_OUTPUT 0 +#define PCA9534_INPUT 1 + +/* + * Get input level. Note that this reflects the actual level on the + * pin, even if the pin is configured as output. + * + * @param port The I2C port of PCA9534. + * @param addr The address of PCA9534. + * @param pin The index of the pin to read. + * @param level The pointer to where the read level is stored. + * + * @return EC_SUCCESS, or EC_ERROR_* on error. + */ +int pca9534_get_level(int port, int addr, int pin, int *level); + +/* + * Set output level. This function has no effect if the pin is + * configured as input. + * + * @param port The I2C port of PCA9534. + * @param addr The address of PCA9534. + * @param pin The index of the pin to set. + * @param level The level to set. + * + * @return EC_SUCCESS, or EC_ERROR_* on error. + */ +int pca9534_set_level(int port, int addr, int pin, int level); + +/* + * Config a pin as input or output. + * + * @param port The I2C port of PCA9534. + * @param addr The address of PCA9534. + * @param pin The index of the pin to set. + * @param is_input PCA9534_INPUT or PCA9534_OUTPUT. + * + * @return EC_SUCCESS, or EC_ERROR_* on error. + */ +int pca9534_config_pin(int port, int addr, int pin, int is_input); + +#endif /* PCA9534_H */ |