OK, enabled CONFIG_USB_MSM_ACA=y, and made the diffs as per previous post, and echo enabled > /sys/kernel/debug/msm_otg/aca
now the device recognises (and starts charging) when I plug in the Y cable and to the power. And it recognises it is not charging when I unplug the power.
However, the OTG function itself is not powered unless the external power is in. Hmm.. Drat.
Its not clear the ‘echo …. aca’ matters. But for sure the CONFIG_USB_MSM_ACA does. However, it modifies almost no code… so it must pull in some other pre-req in the .config file (it seems to be CONFIG_USB_MSM_STANDARD_ACA, which changes the evaluation
The cable type shows up as PROPRIETARY_CHARGER / CHARGER_OTHER. Since I’m not setting the mA, this is leading to a 500mA charging (which is fine for my purpose).
from ACA, we want ID_A: “Configure device to act as host and don’t supply VBUS. In this state the device can charge as well.”. but i seem to end up in ID_B (idle + charge).
What happens is that it briefly comes up, applies power from the tablet out to the peripheral, then removes power, causing the device to be removed.
The an7808 is used to detect cable presence etc.
The only difference in the MSM_STANDARD_ACA is:
/* RID_B and RID_C states does not exist with standard ACA */ #ifdef CONFIG_USB_MSM_STANDARD_ACA #define phy_id_state_b(ints) 0 #define phy_id_state_c(ints) 0 #else #define phy_id_state_b(ints) (phy_id_state((ints)) == PHY_ID_B) #define phy_id_state_c(ints) (phy_id_state((ints)) == PHY_ID_C) #endif
so what is happening is that, on boot, plug in the otg cable (w/ nothing in it), it ends in state b_idle (should be a_wait_bcon). All goes great until it hits my:
ret = smb345_charger_enable(motg->chg_type == USB_INVALID_CHARGER ? false : true);
line (which is being passed false in this case). This somehow causes it to be thinking it should go to b_idle state.
it can charge from OTG.
It can drive peripherals on OTG.
Its confused about doing both together, and something is wrong in the state machine in msm_otg.c driving this.
It needs ACA enabled to try to charge.
Leave a Reply