Lines Matching +full:simple +full:- +full:pm +full:- +full:bus

1 // SPDX-License-Identifier: GPL-2.0
3 * Simple Power-Managed Bus Driver
5 * Copyright (C) 2014-2015 Glider bvba
27 const struct device *dev = &pdev->dev; in simple_pm_bus_probe()
29 struct device_node *np = dev->of_node; in simple_pm_bus_probe()
31 struct simple_pm_bus *bus; in simple_pm_bus_probe() local
35 * transparent bus device which has a different compatible string in simple_pm_bus_probe()
37 * of the simple-pm-bus tasks for these devices, so return early. in simple_pm_bus_probe()
39 if (pdev->driver_override) in simple_pm_bus_probe()
42 match = of_match_device(dev->driver->of_match_table, dev); in simple_pm_bus_probe()
44 * These are transparent bus devices (not simple-pm-bus matches) that in simple_pm_bus_probe()
50 if (match && match->data) { in simple_pm_bus_probe()
51 if (of_property_match_string(np, "compatible", match->compatible) == 0) in simple_pm_bus_probe()
54 return -ENODEV; in simple_pm_bus_probe()
57 bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); in simple_pm_bus_probe()
58 if (!bus) in simple_pm_bus_probe()
59 return -ENOMEM; in simple_pm_bus_probe()
61 bus->num_clks = devm_clk_bulk_get_all(&pdev->dev, &bus->clks); in simple_pm_bus_probe()
62 if (bus->num_clks < 0) in simple_pm_bus_probe()
63 return dev_err_probe(&pdev->dev, bus->num_clks, "failed to get clocks\n"); in simple_pm_bus_probe()
65 dev_set_drvdata(&pdev->dev, bus); in simple_pm_bus_probe()
67 dev_dbg(&pdev->dev, "%s\n", __func__); in simple_pm_bus_probe()
69 pm_runtime_enable(&pdev->dev); in simple_pm_bus_probe()
72 of_platform_populate(np, NULL, lookup, &pdev->dev); in simple_pm_bus_probe()
79 const void *data = of_device_get_match_data(&pdev->dev); in simple_pm_bus_remove()
81 if (pdev->driver_override || data) in simple_pm_bus_remove()
84 dev_dbg(&pdev->dev, "%s\n", __func__); in simple_pm_bus_remove()
86 pm_runtime_disable(&pdev->dev); in simple_pm_bus_remove()
91 struct simple_pm_bus *bus = dev_get_drvdata(dev); in simple_pm_bus_runtime_suspend() local
93 clk_bulk_disable_unprepare(bus->num_clks, bus->clks); in simple_pm_bus_runtime_suspend()
100 struct simple_pm_bus *bus = dev_get_drvdata(dev); in simple_pm_bus_runtime_resume() local
103 ret = clk_bulk_prepare_enable(bus->num_clks, bus->clks); in simple_pm_bus_runtime_resume()
117 #define ONLY_BUS ((void *) 1) /* Match if the device is only a bus. */
120 { .compatible = "simple-pm-bus", },
121 { .compatible = "simple-bus", .data = ONLY_BUS },
122 { .compatible = "simple-mfd", .data = ONLY_BUS },
124 { .compatible = "arm,amba-bus", .data = ONLY_BUS },
133 .name = "simple-pm-bus",
135 .pm = pm_ptr(&simple_pm_bus_pm_ops),
141 MODULE_DESCRIPTION("Simple Power-Managed Bus Driver");