diff options
author | Jan Dabros <jsd@semihalf.com> | 2021-01-12 09:18:37 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-14 14:40:24 +0000 |
commit | a0417d4cdac14a5e091aecf095027d136a968939 (patch) | |
tree | d668a9d741ff250ce0b96100a6ca806f7c389ba3 /driver/gl3590.h | |
parent | 4f8c2db072fb4a8a99ccdc9fa557f122582f8173 (diff) | |
download | chrome-ec-a0417d4cdac14a5e091aecf095027d136a968939.tar.gz |
gl3590: Add API for per-port power management
GL3590 USB3.0 hub has support for enabling/disabling power to its
downstream facing ports via I2C interface. New API allows to enable or
disable bunch of ports at a time in order to limit number of issued I2C
transactions.
BUG=b:177295270
BRANCH=main
TEST=With consecutive patch applied, one may verify new API with usage
of `gl3590` command on servo_v4p1 and enabling/disabling ports.
Signed-off-by: Jan Dabros <jsd@semihalf.com>
Change-Id: I979fb2034e176f1603407be5ba46a528a14ec53c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2624470
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'driver/gl3590.h')
-rw-r--r-- | driver/gl3590.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/driver/gl3590.h b/driver/gl3590.h index 991796c306..089bcd7b7b 100644 --- a/driver/gl3590.h +++ b/driver/gl3590.h @@ -4,6 +4,7 @@ */ #include "pwr_defs.h" +#include "stdbool.h" /* Registers definitions */ #define GL3590_HUB_MODE_REG 0x0 @@ -14,6 +15,7 @@ #define GL3590_INT_CLEAR 0x1 #define GL3590_RESPONSE_REG 0x2 #define GL3590_RESPONSE_REG_SYNC_MASK 0x80 +#define GL3590_PORT_DISABLED_REG 0x4 #define GL3590_HUB_STS_REG 0xA #define GL3590_HUB_STS_HOST_PWR_MASK 0x30 #define GL3590_HUB_STS_HOST_PWR_SHIFT 4 @@ -35,6 +37,18 @@ void gl3590_irq_handler(int hub); /* Get power capabilities of UFP host connection */ enum ec_error_list gl3590_ufp_pwr(int hub, struct pwr_con_t *pwr); +#define GL3590_DFP1 BIT(0) +#define GL3590_DFP2 BIT(1) +#define GL3590_DFP3 BIT(2) +#define GL3590_DFP4 BIT(3) +#define GL3590_DFP5 BIT(4) +#define GL3590_DFP6 BIT(5) +#define GL3590_DFP7 BIT(6) +#define GL3590_DFP8 BIT(7) + +/* Enable/disable power to particular downstream facing ports */ +int gl3590_enable_ports(int hub, uint8_t port_mask, bool enable); + /* Generic USB HUB I2C interface */ struct uhub_i2c_iface_t { int i2c_host_port; |