Lines Matching refs:dev
97 static inline void mei_me_set_pm_domain(struct mei_device *dev);
98 static inline void mei_me_unset_pm_domain(struct mei_device *dev);
100 static inline void mei_me_set_pm_domain(struct mei_device *dev) {} in mei_me_set_pm_domain() argument
101 static inline void mei_me_unset_pm_domain(struct mei_device *dev) {} in mei_me_unset_pm_domain() argument
116 dev_info(&pdev->dev, "Device doesn't have valid ME Interface\n"); in mei_me_quirk_probe()
134 struct mei_device *dev; in mei_me_probe() local
146 dev_err(&pdev->dev, "failed to enable pci device.\n"); in mei_me_probe()
154 dev_err(&pdev->dev, "failed to get pci regions.\n"); in mei_me_probe()
158 if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) || in mei_me_probe()
159 dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) { in mei_me_probe()
161 err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); in mei_me_probe()
163 err = dma_set_coherent_mask(&pdev->dev, in mei_me_probe()
167 dev_err(&pdev->dev, "No usable DMA configuration, aborting\n"); in mei_me_probe()
173 dev = mei_me_dev_init(pdev, cfg); in mei_me_probe()
174 if (!dev) { in mei_me_probe()
178 hw = to_me_hw(dev); in mei_me_probe()
182 dev_err(&pdev->dev, "mapping I/O device memory failure.\n"); in mei_me_probe()
194 irqflags, KBUILD_MODNAME, dev); in mei_me_probe()
196 dev_err(&pdev->dev, "request_threaded_irq failure. irq = %d\n", in mei_me_probe()
201 if (mei_start(dev)) { in mei_me_probe()
202 dev_err(&pdev->dev, "init hw failure.\n"); in mei_me_probe()
207 pm_runtime_set_autosuspend_delay(&pdev->dev, MEI_ME_RPM_TIMEOUT); in mei_me_probe()
208 pm_runtime_use_autosuspend(&pdev->dev); in mei_me_probe()
210 err = mei_register(dev, &pdev->dev); in mei_me_probe()
214 pci_set_drvdata(pdev, dev); in mei_me_probe()
216 schedule_delayed_work(&dev->timer_work, HZ); in mei_me_probe()
224 mei_me_set_pm_domain(dev); in mei_me_probe()
226 if (mei_pg_is_enabled(dev)) in mei_me_probe()
227 pm_runtime_put_noidle(&pdev->dev); in mei_me_probe()
229 dev_dbg(&pdev->dev, "initialization successful.\n"); in mei_me_probe()
234 mei_cancel_work(dev); in mei_me_probe()
235 mei_disable_interrupts(dev); in mei_me_probe()
236 free_irq(pdev->irq, dev); in mei_me_probe()
241 kfree(dev); in mei_me_probe()
247 dev_err(&pdev->dev, "initialization failed.\n"); in mei_me_probe()
261 struct mei_device *dev; in mei_me_remove() local
264 dev = pci_get_drvdata(pdev); in mei_me_remove()
265 if (!dev) in mei_me_remove()
268 if (mei_pg_is_enabled(dev)) in mei_me_remove()
269 pm_runtime_get_noresume(&pdev->dev); in mei_me_remove()
271 hw = to_me_hw(dev); in mei_me_remove()
274 dev_dbg(&pdev->dev, "stop\n"); in mei_me_remove()
275 mei_stop(dev); in mei_me_remove()
278 mei_me_unset_pm_domain(dev); in mei_me_remove()
281 mei_disable_interrupts(dev); in mei_me_remove()
283 free_irq(pdev->irq, dev); in mei_me_remove()
289 mei_deregister(dev); in mei_me_remove()
291 kfree(dev); in mei_me_remove()
302 struct mei_device *dev = pci_get_drvdata(pdev); in mei_me_pci_suspend() local
304 if (!dev) in mei_me_pci_suspend()
307 dev_dbg(&pdev->dev, "suspend\n"); in mei_me_pci_suspend()
309 mei_stop(dev); in mei_me_pci_suspend()
311 mei_disable_interrupts(dev); in mei_me_pci_suspend()
313 free_irq(pdev->irq, dev); in mei_me_pci_suspend()
322 struct mei_device *dev; in mei_me_pci_resume() local
326 dev = pci_get_drvdata(pdev); in mei_me_pci_resume()
327 if (!dev) in mei_me_pci_resume()
338 irqflags, KBUILD_MODNAME, dev); in mei_me_pci_resume()
341 dev_err(&pdev->dev, "request_threaded_irq failed: irq = %d.\n", in mei_me_pci_resume()
346 err = mei_restart(dev); in mei_me_pci_resume()
351 schedule_delayed_work(&dev->timer_work, HZ); in mei_me_pci_resume()
361 struct mei_device *dev; in mei_me_pm_runtime_idle() local
363 dev_dbg(&pdev->dev, "rpm: me: runtime_idle\n"); in mei_me_pm_runtime_idle()
365 dev = pci_get_drvdata(pdev); in mei_me_pm_runtime_idle()
366 if (!dev) in mei_me_pm_runtime_idle()
368 if (mei_write_is_idle(dev)) in mei_me_pm_runtime_idle()
377 struct mei_device *dev; in mei_me_pm_runtime_suspend() local
380 dev_dbg(&pdev->dev, "rpm: me: runtime suspend\n"); in mei_me_pm_runtime_suspend()
382 dev = pci_get_drvdata(pdev); in mei_me_pm_runtime_suspend()
383 if (!dev) in mei_me_pm_runtime_suspend()
386 mutex_lock(&dev->device_lock); in mei_me_pm_runtime_suspend()
388 if (mei_write_is_idle(dev)) in mei_me_pm_runtime_suspend()
389 ret = mei_me_pg_enter_sync(dev); in mei_me_pm_runtime_suspend()
393 mutex_unlock(&dev->device_lock); in mei_me_pm_runtime_suspend()
395 dev_dbg(&pdev->dev, "rpm: me: runtime suspend ret=%d\n", ret); in mei_me_pm_runtime_suspend()
403 struct mei_device *dev; in mei_me_pm_runtime_resume() local
406 dev_dbg(&pdev->dev, "rpm: me: runtime resume\n"); in mei_me_pm_runtime_resume()
408 dev = pci_get_drvdata(pdev); in mei_me_pm_runtime_resume()
409 if (!dev) in mei_me_pm_runtime_resume()
412 mutex_lock(&dev->device_lock); in mei_me_pm_runtime_resume()
414 ret = mei_me_pg_exit_sync(dev); in mei_me_pm_runtime_resume()
416 mutex_unlock(&dev->device_lock); in mei_me_pm_runtime_resume()
418 dev_dbg(&pdev->dev, "rpm: me: runtime resume ret = %d\n", ret); in mei_me_pm_runtime_resume()
428 static inline void mei_me_set_pm_domain(struct mei_device *dev) in mei_me_set_pm_domain() argument
430 struct pci_dev *pdev = to_pci_dev(dev->dev); in mei_me_set_pm_domain()
432 if (pdev->dev.bus && pdev->dev.bus->pm) { in mei_me_set_pm_domain()
433 dev->pg_domain.ops = *pdev->dev.bus->pm; in mei_me_set_pm_domain()
435 dev->pg_domain.ops.runtime_suspend = mei_me_pm_runtime_suspend; in mei_me_set_pm_domain()
436 dev->pg_domain.ops.runtime_resume = mei_me_pm_runtime_resume; in mei_me_set_pm_domain()
437 dev->pg_domain.ops.runtime_idle = mei_me_pm_runtime_idle; in mei_me_set_pm_domain()
439 pdev->dev.pm_domain = &dev->pg_domain; in mei_me_set_pm_domain()
448 static inline void mei_me_unset_pm_domain(struct mei_device *dev) in mei_me_unset_pm_domain() argument
451 dev->dev->pm_domain = NULL; in mei_me_unset_pm_domain()