diff options
author | Todd Broch <tbroch@chromium.org> | 2014-10-10 11:16:02 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-10-21 22:44:45 +0000 |
commit | cefb58066d2a706ad34726aff977be3a584fc001 (patch) | |
tree | 8c1eb1efaac6beb6ae9bca6507ba79a45d580686 /board/hoho | |
parent | 3e2f1329abfa729fe6786ff64d9545e6ce94f042 (diff) | |
download | chrome-ec-cefb58066d2a706ad34726aff977be3a584fc001.tar.gz |
pd: Add DisplayPort status and configure SVDMs.
Per revisements to the DisplayPort Alternate mode specification there
are two additional SVDMs for DPout support: status & configure.
This CL adds those SVDMs and calls them (status then config) after
finding a device that supports DP Alternate mode.
Future CLs will use these SVDMs to complete providing HPD over CC
support.
BRANCH=none
BUG=chrome-os-partner:31192,chrome-os-partner:31193
TEST=manual, plug hoho/dingdong into samus and see:
1. Additional DP status [16] & DP configure [17]
2. Drives DPout properly
Change-Id: I52b373085ddc330e4afb1d1883d2621bc2e4ee95
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/223260
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/hoho')
-rw-r--r-- | board/hoho/usb_pd_policy.c | 51 |
1 files changed, 40 insertions, 11 deletions
diff --git a/board/hoho/usb_pd_policy.c b/board/hoho/usb_pd_policy.c index dd94ed1413..7560821c1d 100644 --- a/board/hoho/usb_pd_policy.c +++ b/board/hoho/usb_pd_policy.c @@ -143,35 +143,64 @@ static int svdm_response_modes(int port, uint32_t *payload) return mode_cnt + 1; } -static int svdm_enter_mode(int port, uint32_t *payload) +static int hpd_get_irq(int port) { - /* SID & mode request is valid */ - if ((PD_VDO_VID(payload[0]) != USB_SID_DISPLAYPORT) || - (PD_VDO_OPOS(payload[0]) != 1)) - return 1; /* will generate a NAK */ + /* TODO(tbroch) FIXME */ + return 0; +} + +static enum hpd_level hpd_get_level(int port) +{ + return gpio_get_level(GPIO_DP_HPD); +} + +static int dp_status(int port, uint32_t *payload) +{ + uint32_t ufp_dp_sts = payload[1] & 0x3; + payload[1] = VDO_DP_STATUS(hpd_get_irq(port), /* IRQ_HPD */ + hpd_get_level(port), /* HPD_HI|LOW */ + 0, /* request exit DP */ + 0, /* request exit USB */ + 0, /* MF pref */ + gpio_get_level(GPIO_PD_SBU_ENABLE), + 0, /* power low */ + (ufp_dp_sts | 0x2)); + return 2; +} - gpio_set_level(GPIO_PD_SBU_ENABLE, 1); - payload[1] = 0; +static int dp_config(int port, uint32_t *payload) +{ + if (PD_DP_CFG_DPON(payload[1])) + gpio_set_level(GPIO_PD_SBU_ENABLE, 1); return 1; } -static int svdm_exit_mode(int port, uint32_t *payload) +static int svdm_enter_mode(int port, uint32_t *payload) { /* SID & mode request is valid */ if ((PD_VDO_VID(payload[0]) != USB_SID_DISPLAYPORT) || (PD_VDO_OPOS(payload[0]) != 1)) - return 1; /* will generate a NAK */ + return 0; /* will generate a NAK */ + return 1; +} +static int svdm_exit_mode(int port, uint32_t *payload) +{ gpio_set_level(GPIO_PD_SBU_ENABLE, 0); - payload[1] = 0; - return 1; + return 1; /* Must return ACK */ } +static struct amode_fx dp_fx = { + .status = &dp_status, + .config = &dp_config, +}; + const struct svdm_response svdm_rsp = { .identity = &svdm_response_identity, .svids = &svdm_response_svids, .modes = &svdm_response_modes, .enter_mode = &svdm_enter_mode, + .amode = &dp_fx, .exit_mode = &svdm_exit_mode, }; |