Loading Documentation/devicetree/bindings/usb/msm-hsusb.txt +2 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,8 @@ Optional properties : devicetree/bindings/usb/android-dev.txt for details about "streaming-func" property. - qcom,axi-prefetch-enable: If present, AXI64 interface will be used for transferring data to/from DDR by controller. - qcom,enable-sdp-typec-current-limit: Indicates whether type-c current for SDP CHARGER to be limited. Example HSUSB OTG controller device node : usb@f9690000 { Loading drivers/usb/phy/phy-msm-usb.c +26 −1 Original line number Diff line number Diff line Loading @@ -1746,6 +1746,7 @@ static void msm_otg_set_online_status(struct msm_otg *motg) static void msm_otg_notify_charger(struct msm_otg *motg, unsigned mA) { struct usb_gadget *g = motg->phy.otg->gadget; struct msm_otg_platform_data *pdata = motg->pdata; if (g && g->is_a_peripheral) return; Loading @@ -1755,6 +1756,16 @@ static void msm_otg_notify_charger(struct msm_otg *motg, unsigned mA) /* Save bc1.2 max_curr if type-c charger later moves to diff mode */ motg->bc1p2_current_max = mA; /* * Limit type-c charger current to 500 for SDP charger to avoid more * current drawn than 500 with Hosts that don't support type C due to * non compliant type-c to standard A cables. */ if (pdata->enable_sdp_typec_current_limit && (motg->chg_type == USB_SDP_CHARGER) && motg->typec_current_max > 500) motg->typec_current_max = 500; /* Override mA if type-c charger used (use hvdcp/bc1.2 if it is 500) */ if (motg->typec_current_max > 500 && mA < motg->typec_current_max) mA = motg->typec_current_max; Loading Loading @@ -3379,6 +3390,7 @@ static int otg_power_set_property_usb(struct power_supply *psy, const union power_supply_propval *val) { struct msm_otg *motg = container_of(psy, struct msm_otg, usb_psy); struct msm_otg_platform_data *pdata = motg->pdata; msm_otg_dbg_log_event(&motg->phy, "SET PWR PROPERTY", psp, psy->type); switch (psp) { Loading @@ -3405,7 +3417,17 @@ static int otg_power_set_property_usb(struct power_supply *psy, motg->current_max = val->intval; break; case POWER_SUPPLY_PROP_INPUT_CURRENT_MAX: /* * Limit type-c charger current to 500 for SDP charger * to avoid more current drawn than 500 with legacy Hosts. */ if (pdata->enable_sdp_typec_current_limit && (motg->chg_type == USB_SDP_CHARGER) && val->intval > 500) motg->typec_current_max = 500; else motg->typec_current_max = val->intval; msm_otg_dbg_log_event(&motg->phy, "type-c charger", val->intval, motg->bc1p2_current_max); /* Update chg_current as per type-c charger detection on VBUS */ Loading Loading @@ -4076,6 +4098,9 @@ struct msm_otg_platform_data *msm_otg_dt_to_pdata(struct platform_device *pdev) pdata->enable_axi_prefetch = of_property_read_bool(node, "qcom,axi-prefetch-enable"); pdata->enable_sdp_typec_current_limit = of_property_read_bool(node, "qcom,enable-sdp-typec-current-limit"); return pdata; } Loading include/linux/usb/msm_hsusb.h +3 −0 Original line number Diff line number Diff line Loading @@ -268,6 +268,8 @@ enum usb_id_state { * @bool enable_streaming: Indicates whether streaming to be enabled by default. * @bool enable_axi_prefetch: Indicates whether AXI Prefetch interface is used for improving data performance. * @bool enable_sdp_typec_current_limit: Indicates whether type-c current for sdp charger to be limited. */ struct msm_otg_platform_data { int *phy_init_seq; Loading Loading @@ -308,6 +310,7 @@ struct msm_otg_platform_data { bool emulation; bool enable_streaming; bool enable_axi_prefetch; bool enable_sdp_typec_current_limit; struct clk *system_clk; }; Loading Loading
Documentation/devicetree/bindings/usb/msm-hsusb.txt +2 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,8 @@ Optional properties : devicetree/bindings/usb/android-dev.txt for details about "streaming-func" property. - qcom,axi-prefetch-enable: If present, AXI64 interface will be used for transferring data to/from DDR by controller. - qcom,enable-sdp-typec-current-limit: Indicates whether type-c current for SDP CHARGER to be limited. Example HSUSB OTG controller device node : usb@f9690000 { Loading
drivers/usb/phy/phy-msm-usb.c +26 −1 Original line number Diff line number Diff line Loading @@ -1746,6 +1746,7 @@ static void msm_otg_set_online_status(struct msm_otg *motg) static void msm_otg_notify_charger(struct msm_otg *motg, unsigned mA) { struct usb_gadget *g = motg->phy.otg->gadget; struct msm_otg_platform_data *pdata = motg->pdata; if (g && g->is_a_peripheral) return; Loading @@ -1755,6 +1756,16 @@ static void msm_otg_notify_charger(struct msm_otg *motg, unsigned mA) /* Save bc1.2 max_curr if type-c charger later moves to diff mode */ motg->bc1p2_current_max = mA; /* * Limit type-c charger current to 500 for SDP charger to avoid more * current drawn than 500 with Hosts that don't support type C due to * non compliant type-c to standard A cables. */ if (pdata->enable_sdp_typec_current_limit && (motg->chg_type == USB_SDP_CHARGER) && motg->typec_current_max > 500) motg->typec_current_max = 500; /* Override mA if type-c charger used (use hvdcp/bc1.2 if it is 500) */ if (motg->typec_current_max > 500 && mA < motg->typec_current_max) mA = motg->typec_current_max; Loading Loading @@ -3379,6 +3390,7 @@ static int otg_power_set_property_usb(struct power_supply *psy, const union power_supply_propval *val) { struct msm_otg *motg = container_of(psy, struct msm_otg, usb_psy); struct msm_otg_platform_data *pdata = motg->pdata; msm_otg_dbg_log_event(&motg->phy, "SET PWR PROPERTY", psp, psy->type); switch (psp) { Loading @@ -3405,7 +3417,17 @@ static int otg_power_set_property_usb(struct power_supply *psy, motg->current_max = val->intval; break; case POWER_SUPPLY_PROP_INPUT_CURRENT_MAX: /* * Limit type-c charger current to 500 for SDP charger * to avoid more current drawn than 500 with legacy Hosts. */ if (pdata->enable_sdp_typec_current_limit && (motg->chg_type == USB_SDP_CHARGER) && val->intval > 500) motg->typec_current_max = 500; else motg->typec_current_max = val->intval; msm_otg_dbg_log_event(&motg->phy, "type-c charger", val->intval, motg->bc1p2_current_max); /* Update chg_current as per type-c charger detection on VBUS */ Loading Loading @@ -4076,6 +4098,9 @@ struct msm_otg_platform_data *msm_otg_dt_to_pdata(struct platform_device *pdev) pdata->enable_axi_prefetch = of_property_read_bool(node, "qcom,axi-prefetch-enable"); pdata->enable_sdp_typec_current_limit = of_property_read_bool(node, "qcom,enable-sdp-typec-current-limit"); return pdata; } Loading
include/linux/usb/msm_hsusb.h +3 −0 Original line number Diff line number Diff line Loading @@ -268,6 +268,8 @@ enum usb_id_state { * @bool enable_streaming: Indicates whether streaming to be enabled by default. * @bool enable_axi_prefetch: Indicates whether AXI Prefetch interface is used for improving data performance. * @bool enable_sdp_typec_current_limit: Indicates whether type-c current for sdp charger to be limited. */ struct msm_otg_platform_data { int *phy_init_seq; Loading Loading @@ -308,6 +310,7 @@ struct msm_otg_platform_data { bool emulation; bool enable_streaming; bool enable_axi_prefetch; bool enable_sdp_typec_current_limit; struct clk *system_clk; }; Loading