diff options
author | li feng <li1.feng@intel.com> | 2016-06-09 18:22:15 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-06-14 22:00:50 -0700 |
commit | a800ecfec6a293522c12fad1003dff71b0eaec80 (patch) | |
tree | 444c584d67316e3a9c016d6df830cbb23c850a18 /driver | |
parent | 77ef6189299a6ac752bd45ee77ca810f86ef2fb1 (diff) | |
download | chrome-ec-a800ecfec6a293522c12fad1003dff71b0eaec80.tar.gz |
driver/tcpm: add Type-C controller ps8751 DP alt mode API
BUG=chrome-os-partner:49431
BRANCH=none
TEST=On Amenia TR1.2, verified display port outptu is enabled on
exteneded display. Seperate patches are needed for testing.
Change-Id: I5ca54c91c566725c612a01a51f1af32e2a819e2d
Signed-off-by: li feng <li1.feng@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/351319
Commit-Ready: Li1 Feng <li1.feng@intel.com>
Tested-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/build.mk | 1 | ||||
-rw-r--r-- | driver/tcpm/ps8751.c | 62 | ||||
-rw-r--r-- | driver/tcpm/ps8751.h | 18 |
3 files changed, 81 insertions, 0 deletions
diff --git a/driver/build.mk b/driver/build.mk index 6145bfbd22..cd4f377e28 100644 --- a/driver/build.mk +++ b/driver/build.mk @@ -80,6 +80,7 @@ driver-$(CONFIG_USB_PD_TCPM_TCPCI)+=tcpm/tcpci.o driver-$(CONFIG_USB_PD_TCPM_FUSB302)+=tcpm/fusb302.o driver-$(CONFIG_USB_PD_TCPM_ITE83XX)+=tcpm/it83xx.o driver-$(CONFIG_USB_PD_TCPM_ANX74XX)+=tcpm/anx74xx.o +driver-$(CONFIG_USB_PD_TCPM_PS8751)+=tcpm/ps8751.o # USB switches driver-$(CONFIG_USB_SWITCH_PI3USB9281)+=usb_switch_pi3usb9281.o diff --git a/driver/tcpm/ps8751.c b/driver/tcpm/ps8751.c new file mode 100644 index 0000000000..fdcb6416cf --- /dev/null +++ b/driver/tcpm/ps8751.c @@ -0,0 +1,62 @@ +/* Copyright 2016 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. + */ + +/* Type-C port manager for Parade PS8751 with integrated superspeed muxes */ + +#include "common.h" +#include "ps8751.h" +#include "tcpm.h" +#include "timer.h" + +#if !defined(CONFIG_USB_PD_TCPM_TCPCI) || \ + !defined(CONFIG_USB_PD_TCPM_MUX) || \ + !defined(CONFIG_USBC_SS_MUX) + +#error "PS8751 is using a standard TCPCI interface with integrated mux control" +#error "Please upgrade your board configuration" + +#endif + +static int dp_set_hpd(int port, int enable) +{ + int reg; + int rv; + + rv = tcpc_read(port, PS8751_REG_CTRL_1, ®); + if (rv) + return rv; + if (enable) + reg |= PS8751_REG_CTRL_1_HPD; + else + reg &= ~PS8751_REG_CTRL_1_HPD; + return tcpc_write(port, PS8751_REG_CTRL_1, reg); +} + +static int dp_set_irq(int port, int enable) +{ + + int reg; + int rv; + + rv = tcpc_read(port, PS8751_REG_CTRL_1, ®); + if (rv) + return rv; + if (enable) + reg |= PS8751_REG_CTRL_1_IRQ; + else + reg &= ~PS8751_REG_CTRL_1_IRQ; + return tcpc_write(port, PS8751_REG_CTRL_1, reg); +} + +void ps8751_tcpc_update_hpd_status(int port, int hpd_lvl, int hpd_irq) +{ + dp_set_hpd(port, hpd_lvl); + + if (hpd_irq) { + dp_set_irq(port, 0); + msleep(1); + dp_set_irq(port, hpd_irq); + } +} diff --git a/driver/tcpm/ps8751.h b/driver/tcpm/ps8751.h new file mode 100644 index 0000000000..765cc5c4f3 --- /dev/null +++ b/driver/tcpm/ps8751.h @@ -0,0 +1,18 @@ +/* Copyright 2016 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.. + */ + +/* Parade Tech Type-C controller vendor specific APIs*/ + +#ifndef __CROS_EC_USB_PD_TCPM_PS8751_H +#define __CROS_EC_USB_PD_TCPM_PS8751_H + +/* Vendor defined registers */ +#define PS8751_REG_CTRL_1 0xD0 +#define PS8751_REG_CTRL_1_HPD (1 << 0) +#define PS8751_REG_CTRL_1_IRQ (1 << 1) + +void ps8751_tcpc_update_hpd_status(int port, int hpd_lvl, int hpd_irq); +#endif /* __CROS_EC_USB_PD_TCPM_PS8751_H */ + |