Lines Matching refs:dev

52 static int stm32_dac_core_hw_start(struct device *dev)  in stm32_dac_core_hw_start()  argument
54 struct stm32_dac_common *common = dev_get_drvdata(dev); in stm32_dac_core_hw_start()
60 dev_err(dev, "vref enable failed: %d\n", ret); in stm32_dac_core_hw_start()
66 dev_err(dev, "pclk enable failed: %d\n", ret); in stm32_dac_core_hw_start()
78 static void stm32_dac_core_hw_stop(struct device *dev) in stm32_dac_core_hw_stop() argument
80 struct stm32_dac_common *common = dev_get_drvdata(dev); in stm32_dac_core_hw_stop()
89 struct device *dev = &pdev->dev; in stm32_dac_probe() local
97 if (!dev->of_node) in stm32_dac_probe()
100 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); in stm32_dac_probe()
106 of_match_device(dev->driver->of_match_table, dev)->data; in stm32_dac_probe()
112 regmap = devm_regmap_init_mmio_clk(dev, "pclk", mmio, in stm32_dac_probe()
118 priv->pclk = devm_clk_get(dev, "pclk"); in stm32_dac_probe()
120 return dev_err_probe(dev, PTR_ERR(priv->pclk), "pclk get failed\n"); in stm32_dac_probe()
122 priv->vref = devm_regulator_get(dev, "vref"); in stm32_dac_probe()
124 return dev_err_probe(dev, PTR_ERR(priv->vref), "vref get failed\n"); in stm32_dac_probe()
126 pm_runtime_get_noresume(dev); in stm32_dac_probe()
127 pm_runtime_set_active(dev); in stm32_dac_probe()
128 pm_runtime_enable(dev); in stm32_dac_probe()
130 ret = stm32_dac_core_hw_start(dev); in stm32_dac_probe()
136 dev_err(dev, "vref get voltage failed, %d\n", ret); in stm32_dac_probe()
140 dev_dbg(dev, "vref+=%dmV\n", priv->common.vref_mv); in stm32_dac_probe()
142 rst = devm_reset_control_get_optional_exclusive(dev, NULL); in stm32_dac_probe()
145 ret = dev_err_probe(dev, PTR_ERR(rst), "reset get failed\n"); in stm32_dac_probe()
166 ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, dev); in stm32_dac_probe()
168 dev_err(dev, "failed to populate DT children\n"); in stm32_dac_probe()
172 pm_runtime_put(dev); in stm32_dac_probe()
177 stm32_dac_core_hw_stop(dev); in stm32_dac_probe()
179 pm_runtime_disable(dev); in stm32_dac_probe()
180 pm_runtime_set_suspended(dev); in stm32_dac_probe()
181 pm_runtime_put_noidle(dev); in stm32_dac_probe()
188 pm_runtime_get_sync(&pdev->dev); in stm32_dac_remove()
189 of_platform_depopulate(&pdev->dev); in stm32_dac_remove()
190 stm32_dac_core_hw_stop(&pdev->dev); in stm32_dac_remove()
191 pm_runtime_disable(&pdev->dev); in stm32_dac_remove()
192 pm_runtime_set_suspended(&pdev->dev); in stm32_dac_remove()
193 pm_runtime_put_noidle(&pdev->dev); in stm32_dac_remove()
198 static int stm32_dac_core_resume(struct device *dev) in stm32_dac_core_resume() argument
200 struct stm32_dac_common *common = dev_get_drvdata(dev); in stm32_dac_core_resume()
213 return pm_runtime_force_resume(dev); in stm32_dac_core_resume()
216 static int stm32_dac_core_runtime_suspend(struct device *dev) in stm32_dac_core_runtime_suspend() argument
218 stm32_dac_core_hw_stop(dev); in stm32_dac_core_runtime_suspend()
223 static int stm32_dac_core_runtime_resume(struct device *dev) in stm32_dac_core_runtime_resume() argument
225 return stm32_dac_core_hw_start(dev); in stm32_dac_core_runtime_resume()