Loading Documentation/devicetree/bindings/usb/msm-ssusb.txt +3 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ Optional properties : - qcom,no-suspend-resume: If present, the device will not perform any activity during suspend/resume - qcom,usb-dbm : phandle for the DBM device - qcom,usbin-vadc: Corresponding vadc device's phandle to read usbin voltage using VADC. This will be used to get value of usb power supply's VOLTAGE_NOW property, Sub nodes: - Sub node for "DWC3- USB3 controller". Loading @@ -69,6 +71,7 @@ Example MSM USB3.0 controller device node : qcom,dwc-usb3-msm-tx-fifo-size = <29696>; qcom,dwc-usb3-msm-qdss-tx-fifo-size = <16384>; qcom,usb-dbm = <&dbm_1p4>; qcom,usbin-vadc = <&pm8941_vadc>; qcom,msm_bus,name = "usb3"; qcom,msm_bus,num_cases = <2>; Loading drivers/usb/dwc3/dwc3-msm.c +26 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,7 @@ struct dwc3_msm { struct qpnp_adc_tm_chip *adc_tm_dev; struct delayed_work init_adc_work; bool id_adc_detect; struct qpnp_vadc_chip *vadc_dev; u8 dcd_retries; u32 bus_perf_client; struct msm_bus_scale_pdata *bus_scale_table; Loading Loading @@ -1638,6 +1639,27 @@ static irqreturn_t msm_dwc3_irq(int irq, void *data) return IRQ_HANDLED; } static int get_prop_usbin_voltage_now(struct dwc3_msm *mdwc) { int rc = 0; struct qpnp_vadc_result results; if (IS_ERR_OR_NULL(mdwc->vadc_dev)) { mdwc->vadc_dev = qpnp_get_vadc(mdwc->dev, "usbin"); if (IS_ERR(mdwc->vadc_dev)) return PTR_ERR(mdwc->vadc_dev); } rc = qpnp_vadc_read(mdwc->vadc_dev, USBIN, &results); if (rc) { pr_err("Unable to read usbin rc=%d\n", rc); return 0; } else { return results.physical; } } static int dwc3_msm_power_get_property_usb(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) Loading @@ -1663,6 +1685,9 @@ static int dwc3_msm_power_get_property_usb(struct power_supply *psy, case POWER_SUPPLY_PROP_TYPE: val->intval = psy->type; break; case POWER_SUPPLY_PROP_VOLTAGE_NOW: val->intval = get_prop_usbin_voltage_now(mdwc); break; default: return -EINVAL; } Loading Loading @@ -1799,6 +1824,7 @@ static enum power_supply_property dwc3_msm_pm_power_props_usb[] = { POWER_SUPPLY_PROP_CURRENT_MAX, POWER_SUPPLY_PROP_TYPE, POWER_SUPPLY_PROP_SCOPE, POWER_SUPPLY_PROP_VOLTAGE_NOW, }; static void dwc3_init_adc_work(struct work_struct *w); Loading Loading
Documentation/devicetree/bindings/usb/msm-ssusb.txt +3 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ Optional properties : - qcom,no-suspend-resume: If present, the device will not perform any activity during suspend/resume - qcom,usb-dbm : phandle for the DBM device - qcom,usbin-vadc: Corresponding vadc device's phandle to read usbin voltage using VADC. This will be used to get value of usb power supply's VOLTAGE_NOW property, Sub nodes: - Sub node for "DWC3- USB3 controller". Loading @@ -69,6 +71,7 @@ Example MSM USB3.0 controller device node : qcom,dwc-usb3-msm-tx-fifo-size = <29696>; qcom,dwc-usb3-msm-qdss-tx-fifo-size = <16384>; qcom,usb-dbm = <&dbm_1p4>; qcom,usbin-vadc = <&pm8941_vadc>; qcom,msm_bus,name = "usb3"; qcom,msm_bus,num_cases = <2>; Loading
drivers/usb/dwc3/dwc3-msm.c +26 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,7 @@ struct dwc3_msm { struct qpnp_adc_tm_chip *adc_tm_dev; struct delayed_work init_adc_work; bool id_adc_detect; struct qpnp_vadc_chip *vadc_dev; u8 dcd_retries; u32 bus_perf_client; struct msm_bus_scale_pdata *bus_scale_table; Loading Loading @@ -1638,6 +1639,27 @@ static irqreturn_t msm_dwc3_irq(int irq, void *data) return IRQ_HANDLED; } static int get_prop_usbin_voltage_now(struct dwc3_msm *mdwc) { int rc = 0; struct qpnp_vadc_result results; if (IS_ERR_OR_NULL(mdwc->vadc_dev)) { mdwc->vadc_dev = qpnp_get_vadc(mdwc->dev, "usbin"); if (IS_ERR(mdwc->vadc_dev)) return PTR_ERR(mdwc->vadc_dev); } rc = qpnp_vadc_read(mdwc->vadc_dev, USBIN, &results); if (rc) { pr_err("Unable to read usbin rc=%d\n", rc); return 0; } else { return results.physical; } } static int dwc3_msm_power_get_property_usb(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) Loading @@ -1663,6 +1685,9 @@ static int dwc3_msm_power_get_property_usb(struct power_supply *psy, case POWER_SUPPLY_PROP_TYPE: val->intval = psy->type; break; case POWER_SUPPLY_PROP_VOLTAGE_NOW: val->intval = get_prop_usbin_voltage_now(mdwc); break; default: return -EINVAL; } Loading Loading @@ -1799,6 +1824,7 @@ static enum power_supply_property dwc3_msm_pm_power_props_usb[] = { POWER_SUPPLY_PROP_CURRENT_MAX, POWER_SUPPLY_PROP_TYPE, POWER_SUPPLY_PROP_SCOPE, POWER_SUPPLY_PROP_VOLTAGE_NOW, }; static void dwc3_init_adc_work(struct work_struct *w); Loading