Lines Matching +full:irq +full:- +full:device
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2013-2020, Intel Corporation. All rights reserved.
9 #include <linux/device.h>
24 #include "hw-txe.h"
43 * mei_txe_probe - Device Initialization Routine
45 * @pdev: PCI device structure
60 dev_err(&pdev->dev, "failed to enable pci device.\n"); in mei_txe_probe()
65 /* pci request regions and mapping IO device memory for mei driver */ in mei_txe_probe()
68 dev_err(&pdev->dev, "failed to get pci regions.\n"); in mei_txe_probe()
72 err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(36)); in mei_txe_probe()
74 err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); in mei_txe_probe()
76 dev_err(&pdev->dev, "No suitable DMA available.\n"); in mei_txe_probe()
84 err = -ENOMEM; in mei_txe_probe()
88 hw->mem_addr = pcim_iomap_table(pdev); in mei_txe_probe()
97 err = request_threaded_irq(pdev->irq, in mei_txe_probe()
102 err = request_threaded_irq(pdev->irq, in mei_txe_probe()
107 dev_err(&pdev->dev, "mei: request_threaded_irq failure. irq = %d\n", in mei_txe_probe()
108 pdev->irq); in mei_txe_probe()
113 dev_err(&pdev->dev, "init hw failure.\n"); in mei_txe_probe()
114 err = -ENODEV; in mei_txe_probe()
118 pm_runtime_set_autosuspend_delay(&pdev->dev, MEI_TXI_RPM_TIMEOUT); in mei_txe_probe()
119 pm_runtime_use_autosuspend(&pdev->dev); in mei_txe_probe()
121 err = mei_register(dev, &pdev->dev); in mei_txe_probe()
131 dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NO_DIRECT_COMPLETE); in mei_txe_probe()
136 * eventually brings the device into D3cold/hot state. in mei_txe_probe()
137 * But the TXE device cannot wake up from D3 unlike from own in mei_txe_probe()
138 * power gating. To get around PCI device native runtime pm, in mei_txe_probe()
143 pm_runtime_put_noidle(&pdev->dev); in mei_txe_probe()
152 free_irq(pdev->irq, dev); in mei_txe_probe()
154 dev_err(&pdev->dev, "initialization failed.\n"); in mei_txe_probe()
159 * mei_txe_shutdown- Device Shutdown Routine
161 * @pdev: PCI device structure
171 dev_dbg(&pdev->dev, "shutdown\n"); in mei_txe_shutdown()
177 free_irq(pdev->irq, dev); in mei_txe_shutdown()
181 * mei_txe_remove - Device Removal Routine
183 * @pdev: PCI device structure
186 * that it should release a PCI device.
192 pm_runtime_get_noresume(&pdev->dev); in mei_txe_remove()
199 free_irq(pdev->irq, dev); in mei_txe_remove()
206 static int mei_txe_pci_suspend(struct device *device) in mei_txe_pci_suspend() argument
208 struct pci_dev *pdev = to_pci_dev(device); in mei_txe_pci_suspend()
211 dev_dbg(&pdev->dev, "suspend\n"); in mei_txe_pci_suspend()
217 free_irq(pdev->irq, dev); in mei_txe_pci_suspend()
223 static int mei_txe_pci_resume(struct device *device) in mei_txe_pci_resume() argument
225 struct pci_dev *pdev = to_pci_dev(device); in mei_txe_pci_resume()
235 err = request_threaded_irq(pdev->irq, in mei_txe_pci_resume()
240 err = request_threaded_irq(pdev->irq, in mei_txe_pci_resume()
245 dev_err(&pdev->dev, "request_threaded_irq failed: irq = %d.\n", in mei_txe_pci_resume()
246 pdev->irq); in mei_txe_pci_resume()
257 static int mei_txe_pm_runtime_idle(struct device *device) in mei_txe_pm_runtime_idle() argument
259 struct mei_device *dev = dev_get_drvdata(device); in mei_txe_pm_runtime_idle()
261 dev_dbg(device, "rpm: txe: runtime_idle\n"); in mei_txe_pm_runtime_idle()
264 pm_runtime_autosuspend(device); in mei_txe_pm_runtime_idle()
266 return -EBUSY; in mei_txe_pm_runtime_idle()
268 static int mei_txe_pm_runtime_suspend(struct device *device) in mei_txe_pm_runtime_suspend() argument
270 struct mei_device *dev = dev_get_drvdata(device); in mei_txe_pm_runtime_suspend()
273 dev_dbg(device, "rpm: txe: runtime suspend\n"); in mei_txe_pm_runtime_suspend()
275 mutex_lock(&dev->device_lock); in mei_txe_pm_runtime_suspend()
280 ret = -EAGAIN; in mei_txe_pm_runtime_suspend()
282 /* keep irq on we are staying in D0 */ in mei_txe_pm_runtime_suspend()
284 dev_dbg(device, "rpm: txe: runtime suspend ret=%d\n", ret); in mei_txe_pm_runtime_suspend()
286 mutex_unlock(&dev->device_lock); in mei_txe_pm_runtime_suspend()
288 if (ret && ret != -EAGAIN) in mei_txe_pm_runtime_suspend()
289 schedule_work(&dev->reset_work); in mei_txe_pm_runtime_suspend()
294 static int mei_txe_pm_runtime_resume(struct device *device) in mei_txe_pm_runtime_resume() argument
296 struct mei_device *dev = dev_get_drvdata(device); in mei_txe_pm_runtime_resume()
299 dev_dbg(device, "rpm: txe: runtime resume\n"); in mei_txe_pm_runtime_resume()
301 mutex_lock(&dev->device_lock); in mei_txe_pm_runtime_resume()
307 mutex_unlock(&dev->device_lock); in mei_txe_pm_runtime_resume()
309 dev_dbg(device, "rpm: txe: runtime resume ret = %d\n", ret); in mei_txe_pm_runtime_resume()
312 schedule_work(&dev->reset_work); in mei_txe_pm_runtime_resume()
318 * mei_txe_set_pm_domain - fill and set pm domain structure for device
324 struct pci_dev *pdev = to_pci_dev(dev->dev); in mei_txe_set_pm_domain()
326 if (pdev->dev.bus && pdev->dev.bus->pm) { in mei_txe_set_pm_domain()
327 dev->pg_domain.ops = *pdev->dev.bus->pm; in mei_txe_set_pm_domain()
329 dev->pg_domain.ops.runtime_suspend = mei_txe_pm_runtime_suspend; in mei_txe_set_pm_domain()
330 dev->pg_domain.ops.runtime_resume = mei_txe_pm_runtime_resume; in mei_txe_set_pm_domain()
331 dev->pg_domain.ops.runtime_idle = mei_txe_pm_runtime_idle; in mei_txe_set_pm_domain()
333 dev_pm_domain_set(&pdev->dev, &dev->pg_domain); in mei_txe_set_pm_domain()
338 * mei_txe_unset_pm_domain - clean pm domain structure for device
345 dev_pm_domain_set(dev->dev, NULL); in mei_txe_unset_pm_domain()