MLK-23942-3 phy: freescale: phy-fsl-imx8mp-lvds: Add runtime PM support

This patch adds runtime PM support for the i.MX8mp LVDS PHY driver.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
This commit is contained in:
Liu Ying 2020-05-07 11:29:19 +08:00
parent 83eae80bd0
commit dbbd312e31
1 changed files with 16 additions and 1 deletions

View File

@ -187,6 +187,8 @@ static int imx8mp_lvds_phy_probe(struct platform_device *pdev)
mutex_init(&priv->lock);
dev_set_drvdata(dev, priv);
pm_runtime_enable(dev);
for_each_available_child_of_node(np, child) {
if (of_property_read_u32(child, "reg", &phy_id)) {
dev_err(dev, "missing reg property in node %s\n",
@ -228,14 +230,26 @@ static int imx8mp_lvds_phy_probe(struct platform_device *pdev)
}
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
if (IS_ERR(phy_provider)) {
pm_runtime_disable(dev);
return PTR_ERR(phy_provider);
}
return PTR_ERR_OR_ZERO(phy_provider);
return 0;
put_child:
of_node_put(child);
pm_runtime_disable(dev);
return ret;
}
static int imx8mp_lvds_phy_remove(struct platform_device *pdev)
{
pm_runtime_disable(&pdev->dev);
return 0;
}
static const struct of_device_id imx8mp_lvds_phy_of_match[] = {
{ .compatible = "fsl,imx8mp-lvds-phy" },
{}
@ -244,6 +258,7 @@ MODULE_DEVICE_TABLE(of, imx8mp_lvds_phy_of_match);
static struct platform_driver imx8mp_lvds_phy_driver = {
.probe = imx8mp_lvds_phy_probe,
.remove = imx8mp_lvds_phy_remove,
.driver = {
.name = "imx8mp-lvds-phy",
.of_match_table = imx8mp_lvds_phy_of_match,