Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: phy: tegra: Use generic stub for a missing VBUS regulator

Regulator core provides dummy regulator if device-tree doesn't define VBUS
regulator.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20200106013416.9604-10-digetx@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Dmitry Osipenko and committed by
Greg Kroah-Hartman
9df3adca b07e5f86

+9 -19
+9 -19
drivers/usb/phy/phy-tegra-usb.c
··· 836 836 if (!phy->is_ulpi_phy) 837 837 utmip_pad_close(phy); 838 838 839 - if (!IS_ERR(phy->vbus)) 840 - regulator_disable(phy->vbus); 841 - 839 + regulator_disable(phy->vbus); 842 840 clk_disable_unprepare(phy->pll_u); 843 841 844 842 phy->freq = NULL; ··· 898 900 goto fail; 899 901 } 900 902 901 - if (!IS_ERR(phy->vbus)) { 902 - err = regulator_enable(phy->vbus); 903 - if (err) { 904 - dev_err(phy->u_phy.dev, 905 - "Failed to enable USB VBUS regulator: %d\n", 906 - err); 907 - goto fail; 908 - } 903 + err = regulator_enable(phy->vbus); 904 + if (err) { 905 + dev_err(phy->u_phy.dev, 906 + "Failed to enable USB VBUS regulator: %d\n", err); 907 + goto fail; 909 908 } 910 909 911 910 if (phy->is_ulpi_phy) ··· 1135 1140 } 1136 1141 1137 1142 /* On some boards, the VBUS regulator doesn't need to be controlled */ 1138 - if (of_find_property(np, "vbus-supply", NULL)) { 1139 - tegra_phy->vbus = devm_regulator_get(&pdev->dev, "vbus"); 1140 - if (IS_ERR(tegra_phy->vbus)) 1141 - return PTR_ERR(tegra_phy->vbus); 1142 - } else { 1143 - dev_notice(&pdev->dev, "no vbus regulator"); 1144 - tegra_phy->vbus = ERR_PTR(-ENODEV); 1145 - } 1143 + tegra_phy->vbus = devm_regulator_get(&pdev->dev, "vbus"); 1144 + if (IS_ERR(tegra_phy->vbus)) 1145 + return PTR_ERR(tegra_phy->vbus); 1146 1146 1147 1147 tegra_phy->pll_u = devm_clk_get(&pdev->dev, "pll_u"); 1148 1148 err = PTR_ERR_OR_ZERO(tegra_phy->pll_u);