summaryrefslogtreecommitdiff
path: root/driver/gl3590.c
diff options
context:
space:
mode:
authorJan Dabros <jsd@semihalf.com>2021-01-12 09:18:37 +0100
committerCommit Bot <commit-bot@chromium.org>2021-01-14 14:40:24 +0000
commita0417d4cdac14a5e091aecf095027d136a968939 (patch)
treed668a9d741ff250ce0b96100a6ca806f7c389ba3 /driver/gl3590.c
parent4f8c2db072fb4a8a99ccdc9fa557f122582f8173 (diff)
downloadchrome-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.c')
-rw-r--r--driver/gl3590.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/driver/gl3590.c b/driver/gl3590.c
index 2faf69178a..40e4df2d05 100644
--- a/driver/gl3590.c
+++ b/driver/gl3590.c
@@ -193,3 +193,20 @@ enum ec_error_list gl3590_ufp_pwr(int hub, struct pwr_con_t *pwr)
return EC_ERROR_UNKNOWN;
}
}
+
+int gl3590_enable_ports(int hub, uint8_t port_mask, bool enable)
+{
+ uint8_t buf[4] = {0};
+ uint8_t en_mask = 0;
+ int rv;
+
+ if (!enable)
+ en_mask = port_mask;
+
+ buf[0] = en_mask;
+ buf[2] = port_mask;
+
+ rv = gl3590_write(hub, GL3590_PORT_DISABLED_REG, buf, sizeof(buf));
+
+ return rv;
+}