mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 16:41:55 +00:00
When attaching a dump (not PD protocol) TypeC charger, the incorrect charger type was being selected and therefore it was not enabling 3A charging. I tracked this issue down to the anx74xx_tcpm_get_cc() function returning a incorrect value. The expected value was TYPEC_CC_VOLT_SNK_3_0, but instead it was returning TYPEC_CC_VOLT_SNK_DEF. The reason the incorrect cc type was being returned is because the if, else if, construct didn't work properly for the 3A case where the upper 2 bits are set. Modified this routine to use a case statement and consolidated the checks for both cc1 and cc2 into one helper function. BRANCH=none BUG=chrome-os-partner:58738 TEST=manual Connected zinger and guppy chargers and verified correct cc type was being returned. In addition tested hoho/dingdong adapters as well as suzyq. Tested both cable orientations to verify that cc1 and cc2 returned the correct values. With guppy connected, now see this output on ec console: C0 HARD RST TX C0 st5 C0 st36 C0 st37 C0 HARD RST TX C0 st5 [1921.980074 AC on] [1922.008140 charge_request(8688mV, 9280mA)] C0 st6 [1922.910539 Ramp p0 st5 3000mA 3000mA] Change-Id: I8b31c7ce366f383dfcc2f6e850b76a83340a02a1 Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/406642 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>