Commit Graph

173 Commits

Author SHA1 Message Date
Shawn Nematbakhsh
fee1bde58d pd: Add pd_capable() to check PD capability of partner port
It's undesirable to do BC1.2 detection on power swap, so add a function
to check if the partner port is known to be PD-capable.

BUG=chromium:780905
BRANCH=gru
TEST=With subsequent CL, attach USB-PD phone capable of role swap.
Verify USB 2.0 device is enumerated on plug, and not re-enumerated
through a series of "pd # swap power" commands on the EC console. Also
verify BC1.2 charging and PD charging are still functional on kevin.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ifa75c94e9758d3e407492bbda6fc52ed7bc378fa
Reviewed-on: https://chromium-review.googlesource.com/755877
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-11-07 12:17:44 -08:00
Sam Hurst
c91dbb26d8 PD: Make current USB PD Stack REV 3 compliant
Implement the following required features in the USB PD Rev. 3.0
specification.

Not_supported control message: Inform a port partner that a
particular message is not supported.
Battery capabilities extended message: Report battery design
capacity and last full charge capacity.
Battery status data message: Report battery state of charge
Collision avoidance: New scheme to avoid collisions caused when both
source and sink want to send messages.

Cable communication: Only the VCONN source can communicate with the
cable plug. This is NOT implemented because although the drivers have
the capability of communicating with a cable plug, the PD stack doesn't
currently need to talk to a cable plug. This is okay since the current
PD design doesn't source or sink more than 3 amps and all Type-C cables
are required to be 3 amp capable.

BUG=b:64411727
BRANCH=None
TEST=`make -j buildall`
Passed relevant PD Rev 2.0 compliance tests
Successful PD negotiation with PD Rev 2.0 and 3.0 chargers
Tested with low power none PD charger.
Modified a Kevin to operate as a PD 3.0 charger and sent
all required messages and verified the return messages.
Also tested collision avoidance by verifying that a sink only
transmits when the source indicates it's okay.
Used Twinkie to verify that PD was operating as v3.0.
Signed-off-by: Sam Hurst <shurst@chromium.org>

Change-Id: Ifd77e92ec4e9106236f9221393d2bfb97263d979
Reviewed-on: https://chromium-review.googlesource.com/603003
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-24 15:30:15 -07:00
Shawn Nematbakhsh
9f10ffc653 cleanup: pd: Make PDO find / extract functions non-static
Allow other modules to call pd_find_pdo_index() / pd_extract_pdo_power()
in order to get information about current PDOs.

BUG=chromium:775542
TEST=Manual on kevin, verify 20V negotiation with zinger still works.
BRANCH=servo

Change-Id: I1861a0226501bda13e7d576d0971d841da9d2b74
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/724682
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-19 14:56:07 -07:00
Shawn Nematbakhsh
165f7d6f3b charge_ramp: Ramp USB-C DTS sources
suzy-qable advertises 1.5A, but its actual capability depends on the
host USB port it is attached to. Since suzy-qable is ubiquitous and
other DTS sources may behave in the same way, ramp the input current
limit in order to find a reasonable maximum.

BUG=chromium:770296
BRANCH=None
TEST=Attach suzy-qable to kevin and reef, verify that neither OCs and EC
console via cr50 is available on reef. Also verify donette chargers
kevin at 3A and does not ramp.

Change-Id: Idd0683ede3a44111a01da6b4faab52f388ee82fd
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/693295
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-19 12:56:42 -07:00
Shawn Nematbakhsh
251212fb9d pd: Remove ACCESSORY states
According to the USB-C spec, when a debug accessory is identified, we may
optionally establish USB PD communication over CC. Some DTS partners
(eg. servo_v4) expect us to speak PD, so let's make it so. There is no
need for special ACCESSORY states, these do not exist in the PD spec.

BRANCH=servo
BUG=chromium:737755,b:65837068
TEST=On scarlet, attach servo_v4 and verify scarlet charges. Also verify
EC and cr50 consoles are available through servo_v4.

Change-Id: I59d1ca50b4766509eccf38562cdf926578138585
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/693294
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-19 12:56:42 -07:00
Shawn Nematbakhsh
7c2c5a9dc3 pd: Add "freeze" dual-role policy
Add a new DRP policy to "freeze" the power role of each port, never
toggling automatically, though manual role swaps may still occur.

BUG=chromium:769895
BRANCH=servo
TEST=On servo_v4, verify DUT port stays in SRC role and POWER port
stays in SNK role while disconnected.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ibff3cd1ffaf0e884b030c231003763a57acbe02e
Reviewed-on: https://chromium-review.googlesource.com/715276
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-19 12:56:42 -07:00
Shawn Nematbakhsh
33ec4ae3bc charge_manager: Support no-battery / no-host boards
Boards without batteries and/or without host command support may wish to
use charge_manager.

BUG=chromium:769895
BRANCH=None
TEST=`make buildall -j`

Change-Id: I2455528de3300a0651791752a05409c888b5f2a3
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/713943
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-17 11:07:44 -07:00
Aseda Aboagye
79ae73477c charge_manager: Consider port in source PDO.
When CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT is defined for a board, as
its name implies, the board can source a higher current if there is
only one port acting as a source.

This commit fixes an issue with selecting the right source capability
message to advertise.  charge_manager_get_source_pdo() was simply
checking if there was more than one sink connected, instead of checking
if there were any *other* sinks connected.  In the event that a sink
was connected to a different port, we would advertise the max source
PDO.

BUG=b:64037926, b:35577509
BRANCH=gru,eve,reef
TEST=Connect sink to port 1.  Connect a AMA to port 0 that claims that
VBUS isn't necessary.  Start sending source caps, verify that the max
PDO is not being advertised in the source caps.

Change-Id: Ie4145ecaf98d5b9070ad3e8b139e5653685fa801
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/610479
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-08-11 20:10:20 -07:00
Caveh Jalali
4a8b509020 usb_pd: only service interrupts on enabled ports.
as it turns out, we're pretty aggressive in iterating over all TCPCs
checking for alerts when any of them generate an interrupt or their
interrupt line is low.  this can cause unfortunate behavior if the
driver hasn't initialized itself (and the chip) yet for interrupts to
be handled or we've released (disconnected) the driver so we can do a
TCPC firmware update.  so, check the PD task state to see if it makes
sense to service the port's interrupt.

note: there seems to be a quirk with the ps8751 in that it holds its
ALERT# (interrupt) line low during firmware update.  this line is
supposed to be falling edge triggered, so it's technically not
interrupting, but since we also poll the line level, we think there's
a continuous interrupt that isn't acutally there.  we get away with
this because pd_exchange_status() has a 5ms delay in its polling loop
to avoid spinning.

the particular test case was to unplug the PD power brick during TCPC
firmware update (over i2c).  the interrupt handler would be called,
accessing the TCPC over i2c and causing all sorts of havoc.

TEST=tested with follow-up CLs and verified ps8751 firmware update
	works on electro.

BRANCH=none

BUG=b:35586896

Change-Id: I880cff49e0e9637256efa9003bcc46274536e631
Signed-off-by: Caveh Jalali <caveh@google.com>
Reviewed-on: https://chromium-review.googlesource.com/544661
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-06-30 16:02:50 -07:00
Daisuke Nojiri
e42acfe200 vboot: Add vboot for EC by EC
This patch adds vboot for EC by EC (vboot EC) for x86 systems.
When ec is transitioning s5->s3, it checks the power supply is
enough to boot AP or not. If not, it runs other checks and may
finally validate and jump to a RW image.

BUG=b:38462249
BRANCH=none
TEST=Boot Fizz on barrel jack and type-c charger.

Change-Id: I5988b0595976370c5303c45541702ae89d86fc97
Reviewed-on: https://chromium-review.googlesource.com/518254
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2017-06-28 21:50:51 -07:00
Kevin K Wong
03a665939f pd: ensure tighter timings for IRQ_HPD pulse
In order to ensure we are always meeting the deadlines for the IRQ_HPD
pulse, increase the priority of the processing by moving the rising edge
from the low-priority HOOK task (in a deferred function) to the caller
task (which is the high-priority PD task).
The downside is we are now sleeping in the PD task blocking the
processing of the PD messages during this time.

Changed HPD_DSTREAM_DEBOUNCE_IRQ to 500us instead of 750us. According
to DP spec, the IRQ_HPD pulse width is between 500us and 1000us.

Ensure there is a minimum of 2ms delay in between each IRQ_HPD as specified
by the DP spec, by sleeping before sending the next pulse if needed.
(in practice, this should not wait if we are not too off processing the
messages)

BUG=chromium:711334
BRANCH=glados strago reef oak
TEST=manual, on SKL platform with kernel 3.18 and MST, verify display is
functional on USB-C dock.

Change-Id: Ib2e9dd608c5f1c671cc5a0fd979a5742101375ff
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/508629
Reviewed-by: Todd Broch <tbroch@chromium.org>
2017-05-29 03:28:25 -07:00
Todd Broch
49c776b5b7 pd: Ignore Augmented PDOs when choosing PDO to request.
Augmented PDOs are part of the PD3.0 specification.  As present USB PD
sinks can't support these PDO types we need to ignore them.

BRANCH=samus,glados,oak,gru,reef
BUG=b:37476637
TEST=manual,

On samus, plug-in blackcat (EVT) charger and see it ignore these
Augmented PDOs when making its PDO request.

Change-Id: I28a0377e1486368f25f37cad640af71244a4c30b
Reviewed-on: https://chromium-review.googlesource.com/484687
Commit-Ready: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-02 20:24:17 -07:00
Daisuke Nojiri
ad089de4b0 pdcontrol: Suspend port individually
pdcontrol suspend command will be used to prevent tcpm from putting
the chip into sleep while firmware update is taking place. Currently
the command suspends or resumes port 0. This patch makes the command
apply to ports individually.

pd enable console command now takes a port number:
pd <port> enable/disable.

This patch also replaces CONFIG_USB_PD_COMM_ENABLED with _DISABLED.
When it's defined, PD communication is disabled at startup.

Plankton undefines CONFIG_USB_PD_COMM_ENABLED enable, intending to
disable PD communication at startup. Therefore, this patch defines
CONFIG_USB_PD_COMM_DISABLED in its board.h.

BUG=b:35586859
BRANCH=none
TEST=From AP console:
localhost # /tmp/ectool pdcontrol suspend 1
[600.188013 TCPC p1 suspended!]
> pd 1 state
Port C1 CC1, Dis - Role: SNK-UFP State: SUSPENDED, Flags: 0x0020
localhost # /tmp/ectool pdcontrol resume 1
[678.516613 TCPC p1 resumed!]
> pd 1 state
Port C1 CC1, Ena - Role: SNK-UFP State: DRP_AUTO_TOGGLE, Flags: 0x0020
From ec console:
> pd 1 disable
Port C1 disable
> pd 1 state
Port C1 CC1, Dis - Role: SNK-UFP State: DRP_AUTO_TOGGLE, Flags: 0x0020
> pd 1 enable
Port C1 enabled
> pd 1 state
Port C1 CC1, Ena - Role: SNK-UFP State: DRP_AUTO_TOGGLE, Flags: 0x0020

Change-Id: Ia0cc4904ac52adc4b89de20918968c8df78b9c80
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/447968
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-03-07 14:15:56 -08:00
Sam Hurst
275cdfa556 usb pd:Correct the USB PD SinkWaitCap and PSHardReset timer values
Values should be as follows:
tTypeCSinkWaitCap: 310 to 620ms
tPSHardReset: 25 to 35ms
Current values are:
tTypeCSinkWaitCap (PD_T_SINK_WAIT_CAP): 240ms
tPSHardReset (PD_T_PS_HARD_RESET): 15ms

BUG=chromium:686122
TEST=manual testing on kevin along with make -j buildall
	- used a kevin to send a hard reset to uut
		> pd 0 hard
		C0 st36
		C0 st37
		34725 ms <-- time it took hard reset to execute
		C0 HARD RST TX

	- used a kevin, operating as source, that does not send
	  source caps to test a uut operating as a sink.
		C0 st6
		C0 st36
		613266 ms <-- time sink waited for source cap

	- plugged in charger and logged pd negotiation
		[1510.574091 event set 0x00200000]
		C0 st15
		C0 st3
		[1510.845115 event set 0x08000000]
		C0 st6
		Req C0 [1] 5000mV 3000mA
		[1510.945827 New chg p0]
		C0 st7
		[1510.949953 CL: pC0 st8
		0 s0 i500 v15000]
		[1510.954055 event set 0x00200000]
		[C0 st9
		1511.061285 event set 0x00400000]
		[1511.064752 CL: p0 s0 i3000 v5000]
		[Req C0 [3] 15000mV 3000mA
		1511.067538 event set 0x00200000]
		C0 st7
		C0 st8
		[1511.077896 CL: p0 s0 i500 v5000]
		[1511.079048 event set 0x00200000]
		C0 st9
		[1511.275448 CL: p0 s0 i3000 v15000]
		[1511.276913 event set 0x00200000]
		Req C0 [3] 15000mV 3000mA
		[1511.445719 CL: p0 s0 i500 v15000]
		[1511.446117 event set 0x00200000]
		C0 st7
		C0 st8
		C0 st9
		[1511.565730 CL: p0 s0 i3000 v15000]
		[1511.566566 event set 0x00200000]
		[1511.812205 event set 0x00400000]
		[1513.274941 event set 0x00200000]
		[1529.324670 Battery 90% / 0h:29 to full]
BRANCH=none

Change-Id: I6e80637cfc50dcfc431feb0e473ec22f408d6f1a
Reviewed-on: https://chromium-review.googlesource.com/434103
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-02-01 14:29:23 -08:00
Scott
58e18da39f servo_v4: pd: Added Device Test System support
- Modified src attach state to enable vbus when debug accessory is
detected.

- servo_v4 has two pd ports, but each port requires a different default
power role. Port 0 can only ever be a SNK, but port 1 which acts is
intended to be a DTS port should default to a SRC so it can be be a
source debug accessory. It may also act as a sink debug accessory, but
is not intended to toggle automatically but will swap roles if
necessary via pd role swap messaging.

- Add hook for ccd enable/disable for DTS mode

BUG=chrome-os-partner:61878
BRANCH=servo
TEST=Manual Verfied that can still build servo_v4 project. All changes
in this CL are contingent on config option CONFIG_USB_PD_DTS being enabled.

Change-Id: Iab968b6fbdfc8f2d155c4f8618921b32f313b9ec
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/428308
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-01-26 23:16:40 -08:00
Sam Hurst
17515de32c pd: support gotoMin and giveBack
In Sink mode, on the receipt of a GotoMin message,
reduce the current consumption to some minimum level.

BUG=chrome-os-partner:33688
TEST=Manual testing
	Used a Kevin, with test routine, to test GotoMin feature
	on another Kevin unit.

	Test routine:
		 if (!strcasecmp(argv[2], "gm")) {
		    ccprintf("send goto min\n");
		    send_control(port, PD_CTRL_GOTO_MIN);
		    send_control(port, PD_CTRL_PS_RDY);
		}

	Kevin with GotoMin feature:
		# ectool usbpdpower 0
		Port 0: SNK DRP PD 4277mV / 3000mA, max 5000mV / 3000mA / 15000mW
		Port 1: Disconnected

		After Test routine is executed:

		# ectool usbpdpower 0
		Port 0: SNK DRP PD 4906mV / 500mA, max 5000mV / 500mA / 2500mW
		Port 1: Disconnected
BRANCH=none

Change-Id: Iaac6e19706ceb10ccaff4d602d63fc086c808c8f
Reviewed-on: https://chromium-review.googlesource.com/425728
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-01-26 18:43:52 -08:00
Scott
44676699b0 pd: Move PD_DEFAULT_STATE to a common define in usb_pd.h
Servo_v4 requires the ability to have a different default state per
port. In previous devices, the assumption was that each supported port
had the same default usb pd state and power role. This CL moves the
by the default power role which in turn is derived from
CONFIG_USB_PD_DUAL_ROLE. In addiiton to moving the location, it now
uses 'port' as argument so it can be port specific if required.

PD_DEFAULT_STATE was a board.h specific config, but in practice each
instance used to date was set to PD_STATE_SNK_DISCONNECTED if
CONFIG_USB_PD_DUAL_ROLE was defined and set to
PD_STATE_SRC_DISCONNECTED otherwise.

BUG=chrome-os-partner:61878
BRANCH=servo
TEST=Manual run 'make -j buildall' to verify that all instances of
PD_DEFAULT_STATE were removed.

Change-Id: Iaf40718668732f525485ed7942ee7fc246d3f75d
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/431787
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-01-26 16:10:30 +00:00
Nicolas Boichat
87e8cd6103 usb_pd_policy: Automatically swap vconn if adapter requests it
During discovery, if adapter requests vconn power in the AMA flags,
make sure that we provide vconn.

This, for example, is necessary for the Apple HDMI adapter to work
on boot, when connected in S5. In that case, adapter does request
vconn swap, but we reject that as the system is off, and, therefore
5V supply is off. On boot, we send another discovery request, which
will detect this case and swap the power.

BRANCH=none
BUG=chromium:644663
TEST=On elm, S5. Plug adapter with power+HDMI. Switch on elm,
     type "pd 0 vdm ident" in console, display works.

Change-Id: I55b6658c2bc0574b8427ae086f61daf03730a725
Reviewed-on: https://chromium-review.googlesource.com/415697
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-12-14 06:02:54 -08:00
Nicolas Boichat
a573d17be9 usb_pd_protocol: Rename PD_FLAGS_DATA_SWAPPED to _CHECK_IDENTITY
Rename the variable to actually tell us what it does (it sends a
Discover Identity command), instead of littering the code with
comments explaining why we set DATA_SWAPPED when the data roles
have not really been swapped.

BRANCH=none
BUG=chromium:644663
TEST=make buildall -j

Change-Id: Idbad38e48a55d6518ef82b32a4d96fee65264aae
Reviewed-on: https://chromium-review.googlesource.com/415696
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-12-14 06:02:53 -08:00
Sam Hurst
22858a07a5 usb pd: Resend request after receiving a WAIT in response to a request
When a WAIT is received in response to a request, wait SinkRequestTime
before resending the request.

BUG=chrome-os-partner:34984
TEST=make -j buildall
BRANCH=none

Change-Id: I5c8429c4a7b9cf06609996f924b8d9d535ab6b5f
Reviewed-on: https://chromium-review.googlesource.com/414533
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-12-02 16:52:52 -08:00
Kevin K Wong
180ac77e16 reef: enable tcpc-controlled drp toggle
BUG=chrome-os-partner:54668
BRANCH=none
TEST=Verified SNK is detected in S0 (toggle on), S3 (toggle off),
and S5 (force sink). SRC is detect in S0 only, stays detected when
entered S3, but unplug/plug while in S3 will not re-detect until
system back in S0. When go to S5, SRC will get disconnected until
back in S0, and hotplug SRC in S5 will not get detected. Checked
power role swap with another chromebook in the above scenario also.

Change-Id: I2a487fca5cb04c45524aa3efde84fcd10ff0579e
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/396918
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-02 06:42:04 -07:00
Vincent Palatin
cf7ff32b92 kevin: set accurate current limit on USB load switch
When sourcing current on the type-C port, set the OCP limit on the VBUS
load switch according to current dynamic capability.
(3.0A when only one port is a power source, 1.5A else)

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=gru
BUG=chrome-os-partner:56110
TEST=manual: connect Caroline to Kevin with Twinkie in between,
ask Caroline to sink current through the UI.
without anything else connected on Kevin, see 3A flowing when measuring
with Twinkie ('tw vbus'), plug a dangling C-to-A receptacle dongle on
the other Kevin port and see 1.5A flowing through Twinkie.
Force the input current limit on Caroline to 3.0A and see Kevin cutting
VBUS.

Change-Id: Ib879b1ed720b20aa702c5f3643948ba0575d1193
Reviewed-on: https://chromium-review.googlesource.com/403869
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-31 03:27:49 -07:00
Vincent Palatin
fffea303b4 pd: fix contract negotiation with dynamic PDOs
When the board is using dynamic source PDOs, we need to ensure that we
are checking the incoming sink power request against the right set of
PDOs else we might reject a valid request (e.g. with high-power source,
we need to check against the 3.0A limit if we only have one port
connected).

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=gru
BUG=chrome-os-partner:56110
TEST=Connect Kevin to Caroline, ask Caroline to charge from the other
side and see it negotiating successfully a 5V/3A contract.

Change-Id: Ie1aa5746776be5946422bf07c08ae0f22faddd8c
Reviewed-on: https://chromium-review.googlesource.com/403088
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-26 01:45:17 -07:00
Shawn Nematbakhsh
08498eab99 pd: Initialize pd comms and dual role state from PD task
Don't call into tcpm_*() functions from HOOKs since these functions may
manipulate common sets of TCPC registers.

BUG=chrome-os-partner:57691
BRANCH=gru
TEST=On kevin, boot to S0, verify 5V is sourced to legacy peripheral.
Drop to G3, verify role is back to sink and charging is functional. Back
to S0, verify 5V is sourced.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I9ade9de068589dce6995cda6b106217aa85aa793
Reviewed-on: https://chromium-review.googlesource.com/394809
(cherry picked from commit 18e9e3870722d57efd232bd7f0a0300003b46ad6)
Reviewed-on: https://chromium-review.googlesource.com/396137
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-10-14 18:49:38 -07:00
Shawn Nematbakhsh
9229c795b0 charger: bd99955: Enable VBUS discharge when appropriate
Use a custom VBUS threshold of 3.9V for enable / disable of our VBUS
discharge circuit.

BUG=chrome-os-partner:55584
BRANCH=None
TEST=Plug Apple charge-thru accessory into kevin, plug zinger into
accessory, verify charging occurs at PD-negotiated current / voltage.

Change-Id: I25f6f68cfe55e8bae2071cda39618b2bfadcb355
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/379475
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-09-13 22:21:31 -07:00
Vincent Palatin
02b80c49f4 pd: manage total source current available
Add a policy to handle the case where the device can source the
`CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT` over one of its type-C port if
there is no sink connected on the other ones.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=chrome-os-partner:56110
TEST=manual: on Kevin, plug and unplug various devices on the 2 ports,
while measuring the type-C pull-up with Twinkie.

Change-Id: Id5961f04d0a1b1073f5ab340068efd9079918209
Reviewed-on: https://chromium-review.googlesource.com/373818
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-01 19:52:35 -07:00
Vincent Palatin
1b9096116c pd: support Rp/Rp debug accessories
Support Rp/Rp debug accessories in the USB PD state machine
including detecting the polarity and the available type-C current.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=chrome-os-partner:52592
TEST=manual, plug a Suzy-Q reworked with Rp3A0/Rp1A5 resistors
on a Kevin, and see the PD state machine is going to
PD_STATE_SNK_ACCESSORY (and leaving it on unplug).
Re-verify a few existing accessories (Rd/Rd SuzyQ, legacy RpUSB cable,
Rp3A0 power supply).

Change-Id: Icef6c90027105d7c633f2785210ab9dae74fc33c
Reviewed-on: https://chromium-review.googlesource.com/368700
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-08-22 05:03:26 -07:00
Anton Staaf
068cd08506 Deferred: Use deferred_data instead of function pointer
Previously calls to hook_call_deferred were passed the function to call,
which was then looked up in the .rodata.deferred section with a linear
search.  This linear search can be replaced with a subtract by passing
the pointer to the deferred_data object created when DECLARE_DEFERRED
was invoked.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
CQ-DEPEND=CL:*255812
TEST=make buildall -j

Change-Id: I951dd1541302875b102dd086154cf05591694440
Reviewed-on: https://chromium-review.googlesource.com/334315
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-04-18 17:32:40 -07:00
Shawn Nematbakhsh
b234b9ecc7 pd: Cleanup PD port-to-task macros
Cleanup our port-to-task and task-to-port macros to allow cleanly adding
a third port.

BUG=chromium:554243
BRANCH=None
TEST=Manual on glados / glados_pd. Verify that both USB-C ports are
functional for charging.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ib833de0dfaa9490f4de8efb08d2cdddd86d57896
Reviewed-on: https://chromium-review.googlesource.com/311785
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-11-11 08:05:40 -08:00
Alec Berg
847978564a pd: send soft reset on boot if VBUS is present
On boot, if VBUS is present, then when PD protocol gets to
SNK_DISCOVERY state, if it times out waiting for source cap,
then send attempt to send a soft reset first instead of
directly sending a hard reset. This allows us to not lose
VBUS in the case that we were in a stable contract as a sink
before this boot (for example a sysjump or EC reboot).

BUG=chrome-os-partner:44085, chrome-os-partner:44952
BRANCH=none
TEST=test on glados and samus. test by sysjumping between
RO and RW with zinger plugged in and no battery, and verify
that we don't lose power. also test rebooting with a battery
and verify we don't lose power. also tested with a third
party PD charger.

Change-Id: Ib7ce46d8b9843db66805ba3237d8919d611324e0
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/308201
Reviewed-by: Rong Chang <rongchang@chromium.org>
2015-10-23 10:10:56 -07:00
Alec Berg
7e81bebb48 tcpc: re-initialize tcpc if it reboots while tcpm is running
On TCPC startup, set an alert to notify TCPM that we have been
reset. When TCPM gets this notification, it should re-send
initial TCPC parameters. If we were in a stable contract as
a sink, make sure we don't reset connection. If not, then
reset PD protocol state machine to the default state.

This fixes a bug where if the TCPC reboots while the TCPM is
still running, then the TCPC would not get re-initialized and
therefore no PD communication would not work. This also fixes
it such that if we are in a stable contract as a sink and the
TCPC reboots, then we don't lose power.

BUG=chrome-os-partner:46676
BRANCH=none
TEST=tested on glados. reboot PD MCU with and without a charger
plugged in and verify that PD communication works after the
reboot. verify that with a charger, we don't lose power.
also tested with a hoho plugged in during reboot.

Change-Id: I84fec4577b0daf5891bd8461d3f3d925014a5ecf
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/307187
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-10-22 17:40:31 -07:00
Alec Berg
89067fc458 cleanup: pd: remove duplicate code for checking request msg
Remove duplicate code for checking request message, but keep
a board specific check of the request message for custom checks
needed on zinger and plankton.

BUG=chrome-os-partner:42490
BRANCH=none
TEST=make -j buildall. run on samus and connect a hoho, make
sure we successfully negotiate a contract.

Change-Id: I7398953a158d340e3e113f5a816b55445a857711
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/305374
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-10-13 18:44:01 -07:00
Alec Berg
c7eaa0a81c pd: add more flags to USB_PD_CONTROL host command
Add more flags to EC_CMD_USB_PD_CONTROL including whether
the port partner is PD capable, and if the port partner has
any of the following flags set in its capabilities: dual-role
power, dual-role data, USB comms capable, and externally
powered.

BUG=none
BRANCH=smaug
TEST=tested on samus using 'ectool --dev=1 usbpd 0'. Tested
with zinger, guppy, another samus, and other third party
devices to verify the flags are set as advertised in src/snk
capabilities packet

Change-Id: I4d78d1880073fdacce57516111ac6cab37b93f27
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/300953
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-09-18 20:57:38 -07:00
Alec Berg
f44f02e865 pd: send soft reset before an EC reset
Send soft reset to all connected USB PD ports before a user
initiated reset (via console or host command). This fixes a problem
where EC will send PD hard reset to a charger after an EC reboot, which
will cause another reboot if battery is not present.

BUG=chrome-os-partner:44085
BRANCH=none
TEST=tested on glados without a battery. with zinger attached, issue
'reboot' from console and verify that we only reboot once.

Change-Id: Id6c56cda33c289e3425cb433f7fcbe76669d2dff
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295889
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-09-01 16:10:43 -07:00
Shawn Nematbakhsh
ad8ce3f806 usb_pd: Add host command to limit external charger voltage / current
PD charger voltage + current can now be limited with
EC_CMD_EXTERNAL_POWER_LIMIT. The limit is automatically cleared when the
AP transitions out of S0 into S3 / suspend.

BUG=chrome-os-partner:43285
TEST=Manual on Samus w/ zinger.
- Plug zinger, verify charging at 20V/3A.
- `ectool extpwrlimit 3000 12000 --dev=1`, verify charging at 12V/3A
- `ectool extpwrlimit 1000 5000 --dev=1`, verify charging at 5V/1A
- Plug zinger into other port, verify still charging at 5V/1A
- `powerd_dbus_suspend`, verify charging at 20V/3A
- `chglim 2000 12000`, verify charging at 12V/2A
- `ectool extpwrlimit 0xffff 0xffff --dev=1`, verify charging at 20V/3A
- `chglim 1000 20000`, verify charging at 20V/1A
- `chglim`, verify charging at 20V/3A
BRANCH=ryu

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I6cd5377be91b3df75f99cb414fd3fa5a463b56cb
Reviewed-on: https://chromium-review.googlesource.com/293954
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-08-22 01:37:38 +00:00
Alec Berg
d804e8fdbd usb_charger: cleanup: move setting usb 2 switches to usb_charger
Move function to set D+/D- switches from board directory to
usb_charger module.

BUG=none
BRANCH=strago
TEST=make -j buildall

Change-Id: I5c5997c799cecea90448444863167af860a8f3e1
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/290421
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-08-04 19:22:07 +00:00
Alec Berg
642fa3f3bc ryu: plankton: allow plankton to send VDM to enter CCD
Create new custom VDM to notify DUT to enter case closed
debugging mode. Send this VDM from Plankton when the case
closed debugging enable button is pressed. Once DUT
receives the CCD enable VDM, CCD remains enabled until
a reboot. Note, this is polarity dependent, so cable
might need to be flipped.

BUG=chrome-os-partner:42569
BRANCH=smaug
TEST=load on plankton and ryu. attach full feature C to C
cable (must have USB3.0 wires). make sure plankton is in
USB mode (USB_SS_USB_MODE light should be set, which can be
done by pressing DP_USB_TOGGLE button). Press CASE_CLOSE_EN
button to send VDM, and then attach micro-B to debug port
CN14 on plankton. See that VID/PID for Ryu show up in lsusb
on host, and EC console works. If device does not show up,
flip polarity of cable.

Change-Id: Ifa469e4a43e32089becd75fe6cdfe0ed462d950b
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/287441
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-22 18:04:36 +00:00
Bernard Shyu
c08e3b2113 pd: finitely sending of SNK_CAP in SRC_READY
Even a decent type-C device SHALL respond SNK_CAP query message when we are in
SRC_READY state, but in the case its mal implementation shouldn't get us being
trapped in an infinite loop of SRC_READY / SRC_GET_SNK_CAP states.

Introduce a counter to give up sending of SNK_CAP and just print a ERR
indication log when the partner device ignores SNK_CAP query.

BUG=none
BRANCH=samus
TEST=make buildall
     manual testing against the failing USB-C device

Change-Id: I4c4251b2264230d7dd30bd2b9fc2b56027ff0d5a
Signed-off-by: Bernard Shyu <bernard_shyu@bizlinktech.com>
Reviewed-on: https://chromium-review.googlesource.com/284035
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Alec Berg <alecaberg@chromium.org>
2015-07-15 20:29:30 +00:00
Alec Berg
79195818ca pd: for one PD port, allow task to be named PD or PD_C0
BUG=none
BRANCH=none
TEST=make -j buildall

Change-Id: If8442a0a2d0a26c4e2cd4e23cbb93f689258bf21
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/284913
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-11 09:32:56 +00:00
Scott
e9cd229216 pd: Add Try.SRC functionality to the pd_protocol state machine
1. Added new config option CONFIG_USB_PD_TRY_SRC
	2. Added pd_try_source_enable global flag with console command
	3. Added bit to pd.flags to indicate Try.SRC states are active

BUG=chrome-os-partner:39724
TEST=Manual samus to samus with the Try.SRC enabled on both and just
     one samus. Tested Samus to Honeybuns and Samus to Zinger connections.
BRANCH=TOT

Change-Id: Ifa5d5d82e443f376e546aaf852ff24d92ef04d72
Signed-off-by: Scott Collyer <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/282052
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Alec Berg <alecaberg@chromium.org>
2015-07-08 19:34:14 +00:00
Todd Broch
943e9292f1 pd: Change which DP pin config DP source uses for sink capabilities.
DP Alternate mode specification defines two bytes in the DP
capabilities payload with respect to pin configs.  One that governs
the DFP and the other the UFP.  The one that the DP source needs to
examine depends upon whether the UFP is a receptacle or a plug.

Previously we just examined the DFP pin config which was correct for
all UFP plugs but not UFP receptacles.  This change fixes that by
examining bit <6> of capability message to determe plug vs receptacle
and in case of receptacle choosing the UFP ping config instead.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=samus
BUG=chromium:505652
TEST=manual, hoho & apple (UFP_D plugs) still work.

While I don't have a test for UFP_D receptacle partner device reports
following for its DP caps which should now decode correctly.

  <31:24> 00 Reserved/SBZ
  <23:16> 1C UFP pin config == C, D, E
  <15:08> 00 DFP pin config zero
  <07:00> C5 <6> == 1 == receptacle

Change-Id: Ib9e3a808828ff6b8c062baf0fc3c23b3da33c2c3
Reviewed-on: https://chromium-review.googlesource.com/282621
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2015-07-01 03:49:10 +00:00
Shawn Nematbakhsh
1ef8c7dc20 usb_mux: Add driver interface for USB-C muxes
In preparation for adding support for additional USB-C mux chips, add a
new high-level USB-C mux interface usb_mux.c. usb_mux functions are now
called from pd code instead of board-level functions. usb_mux calls down
into a mux chip-specific driver (currently pi3usb30532) or
board-specific drivers which toggle GPIOs (for legacy boards).

BUG=chrome-os-partner:41696
TEST=Manual on Glados in subsequent commit. Verify set() and get()
functions set and return consistent values. Verify that USB SS device
functions when muxes are set to dock or USB. Also, verify that DP
dongle and USB SS device are functional on both PD ports on samus_pd.
BRANCH=None

Change-Id: Ib6477f489310f3be1430585ea09fea26f57e3752
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/281435
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-30 17:18:37 +00:00
Alec Berg
82ec2510a3 pd: refactor tcpm and move alert function to tcpm driver
Refactor the tcpm/tcpc split such that the tcpm driver implements
the alert functionality since it may be unique for different tcpc
chips.

BUG=chrome-os-partner:41842
BRANCH=none
TEST=make -j buildall. run on samus and glados.

Change-Id: I23f2d7f8627d5337b8d001a09bf27622be24fe33
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/281631
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-30 17:18:25 +00:00
Scott
590c76d910 honeybuns: Update VDM information for DisplayPort
Updated the VDM information to handle properly the DisplayPort alternate
mode.
Switch to 2+2 (DP+USB3.0) if mode D is entered else use 4 lanes of DP
for mode C.
Set the Multi-Function Preferred bit, so laptops select the mode D.

BUG=none
BRANCH=none
TEST=Tested with samus. Verified we get 36W of power + USB2.0 key +
USB3.0 key + external DP display.

Change-Id: I95e3b3640fd5952faeb24312e387468aed6266c7
Signed-off-by: Scott Collyer <scollyer@chromium.org>
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/267688
Reviewed-by: Todd Broch <tbroch@chromium.org>
2015-06-30 08:58:23 +00:00
Bill Richardson
104f811e67 cleanup: fix all the header guards
This unifies all the EC header files to use __CROS_EC_FILENAME_H
as the include guard. Well, except for test/ util/ and extra/
which use __TEST_ __UTIL_ and __EXTRA_ prefixes respectively.

BUG=chromium:496895
BRANCH=none
TEST=make buildall -j

Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Change-Id: Iea71b3a08bdec94a11239de810a2b2e152b15029
Reviewed-on: https://chromium-review.googlesource.com/278121
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-06-18 19:07:00 +00:00
Todd Broch
b33531e262 pd: Fix pin mode field in DP config VDM.
VESA SCR titled,
  'DP Alt Mode Plug Corrections & Protocol Clarif'

Simplified the DP config mode VDM to longer include two separate bytes
for UFP vs DFP pin modes since bits <1:0> designate the desired port
direction.

This change corrects our VDM accordingly so that <23:16> are now zero
(SBZ) and <15:8> carry the appropriate pin mode.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=samus_pd
BUG=chromium:501002
TEST=manual,

1. samus -> hoho, dingdong or apple hdmi dongles still drive DPout
2. twinkie console output samus -> hoho shows correct DP config VDM
  369.275296 SRC/2 [256f]VDM Vff01:DPCFG,INI:ff018111 00000406
    where:
    <31:16> = SBZ   == 0x0000
    <15:08> = PIN_C == 0x04

Change-Id: I1146045dd94458c82b7ed08940af6009658afa05
Reviewed-on: https://chromium-review.googlesource.com/278083
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-17 13:10:51 +00:00
Vincent Palatin
181913141d pd: do not glitch USB when going to S5 in debug mode
When we are going to S5 with a debug accessory plugged, we cannot
transition through the 'PD_DRP_FORCE_SINK' else we would
disable/re-enable the USB muxes triggering disconnections/glitches on
the USB debug console.
So, rework the management of the dual role toggling special case
(used to detect debug accessories) : remove the special DRP state and
re-write the conditions.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=smaug
BUG=chrome-os-partner:41399
TEST=on Ryu, connect to the EC console through Suzy-Q and issue
the "apshutdown" command, then see the EC USB console is randomly
disconnected/re-connected or acting up.

Change-Id: Id44a9360a836e7c10a30f5afb2971bc7c3d01a5c
Reviewed-on: https://chromium-review.googlesource.com/277275
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2015-06-13 01:25:13 +00:00
Shawn Nematbakhsh
e05ed041cf charger: Move USB charger / BC1.2 task to common code
Move the task responsible for detection of USB chargers to common code
to reduce code duplication.

BUG=chrome-os-partner:40920
TEST=Manual on samus_pd. Plug USB charger, verify detection is correct
on both charge ports.
BRANCH=None

Change-Id: I362f8b5b51741509e459c66928131f1f6d2a3b1d
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276210
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-10 19:48:08 +00:00
Alec Berg
d2c4781266 pd: enable charging through suzyQ debug accessory
Enable charging through debug accessory by setting input
current limit to 3A when debug accessory is detected.
Add new dual-role toggling state for stay sink unless VBUS
is detected, which allows us to detect debug accessory
when we are not normally dual-role toggling.

BUG=none
BRANCH=smaug
TEST=plug suzyQ into ryu in S0 and in S5 and make sure that
we go to the SRC_ACCESSORY state and set charger input
current limit appropriately.

Change-Id: I6262c9d6cd0ae7159f343d36e19d290c2f2e0181
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276368
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-06-10 03:33:33 +00:00
Todd Broch
14ba846eea pd: Refine HPD debounce values.
Change refines HPD debounce values into both upstream and downstream
values for packetizing across the type-C link.

For LVL, the upstream type-C device will packetize any HPD transition
>=2ms as either HIGH or LOW.  On the downstream side the value is
driven immediately.  Additional debouncing should be done by true
upstream device according to specification.

For IRQ, the upstream type-C device will packetize any HPD pulse
>250usec as an IRQ.  On the downstream side it will be de-packetized
to create 750usec pulse.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=samus
BUG=chrome-os-partner:39717
TEST=samus|macbook(2015) + hoho|dingdong|apple HDMI type-C dongles
still drive screens successfully.

Change-Id: Ide58f3b2d675a82c12ca6afc2be53ca6e2561ace
Reviewed-on: https://chromium-review.googlesource.com/273867
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2015-05-29 01:37:38 +00:00