phy: qcom-qmp-combo: add clock registration helper
authorJohan Hovold <johan+linaro@kernel.org>
Mon, 21 Nov 2022 08:50:51 +0000 (09:50 +0100)
committerVinod Koul <vkoul@kernel.org>
Thu, 24 Nov 2022 17:21:51 +0000 (22:51 +0530)
In preparation for supporting devicetree bindings which do not use child
nodes, add a clock registration helper to handle the registration of
both the USB and DP clocks.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20221121085058.31213-9-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/qualcomm/phy-qcom-qmp-combo.c

index 9b945a7..1079a16 100644 (file)
@@ -2447,6 +2447,22 @@ static int phy_dp_clks_register(struct qmp_combo *qmp, struct device_node *np)
        return devm_add_action_or_reset(qmp->dev, phy_clk_release_provider, np);
 }
 
+static int qmp_combo_register_clocks(struct qmp_combo *qmp, struct device_node *usb_np,
+                                       struct device_node *dp_np)
+{
+       int ret;
+
+       ret = phy_pipe_clk_register(qmp, usb_np);
+       if (ret)
+               return ret;
+
+       ret = phy_dp_clks_register(qmp, dp_np);
+       if (ret)
+               return ret;
+
+       return 0;
+}
+
 static int qmp_combo_parse_dt_lecacy_dp(struct qmp_combo *qmp, struct device_node *np)
 {
        struct device *dev = qmp->dev;
@@ -2606,11 +2622,7 @@ static int qmp_combo_probe(struct platform_device *pdev)
         */
        pm_runtime_forbid(dev);
 
-       ret = phy_pipe_clk_register(qmp, usb_np);
-       if (ret)
-               goto err_node_put;
-
-       ret = phy_dp_clks_register(qmp, dp_np);
+       ret = qmp_combo_register_clocks(qmp, usb_np, dp_np);
        if (ret)
                goto err_node_put;