xref: /linux/drivers/misc/mei/pci-txe.c (revision 09f8c33a4cad3623874766033544abf34e3e365d)
19fff0425STomas Winkler // SPDX-License-Identifier: GPL-2.0
2795536acSTomas Winkler /*
3a27ad0f7STomas Winkler  * Copyright (c) 2013-2020, Intel Corporation. All rights reserved.
4795536acSTomas Winkler  * Intel Management Engine Interface (Intel MEI) Linux driver
5795536acSTomas Winkler  */
6795536acSTomas Winkler 
7795536acSTomas Winkler #include <linux/module.h>
8795536acSTomas Winkler #include <linux/kernel.h>
9795536acSTomas Winkler #include <linux/device.h>
10795536acSTomas Winkler #include <linux/errno.h>
11795536acSTomas Winkler #include <linux/types.h>
12795536acSTomas Winkler #include <linux/pci.h>
13795536acSTomas Winkler #include <linux/init.h>
14795536acSTomas Winkler #include <linux/sched.h>
15795536acSTomas Winkler #include <linux/interrupt.h>
16795536acSTomas Winkler #include <linux/workqueue.h>
17989561deSTomeu Vizoso #include <linux/pm_domain.h>
18cfe5ab85SAlexander Usyskin #include <linux/pm_runtime.h>
19795536acSTomas Winkler 
20795536acSTomas Winkler #include <linux/mei.h>
21795536acSTomas Winkler 
22795536acSTomas Winkler 
23795536acSTomas Winkler #include "mei_dev.h"
24795536acSTomas Winkler #include "hw-txe.h"
25795536acSTomas Winkler 
26a05f8f86STomas Winkler static const struct pci_device_id mei_txe_pci_tbl[] = {
274ad96db6STomas Winkler 	{PCI_VDEVICE(INTEL, 0x0F18)}, /* Baytrail */
28e88281edSTomas Winkler 	{PCI_VDEVICE(INTEL, 0x2298)}, /* Cherrytrail */
294ad96db6STomas Winkler 
30795536acSTomas Winkler 	{0, }
31795536acSTomas Winkler };
32795536acSTomas Winkler MODULE_DEVICE_TABLE(pci, mei_txe_pci_tbl);
33795536acSTomas Winkler 
34bbd6d050SRafael J. Wysocki #ifdef CONFIG_PM
35d2d56faeSAlexander Usyskin static inline void mei_txe_set_pm_domain(struct mei_device *dev);
36d2d56faeSAlexander Usyskin static inline void mei_txe_unset_pm_domain(struct mei_device *dev);
37d2d56faeSAlexander Usyskin #else
38d2d56faeSAlexander Usyskin static inline void mei_txe_set_pm_domain(struct mei_device *dev) {}
39d2d56faeSAlexander Usyskin static inline void mei_txe_unset_pm_domain(struct mei_device *dev) {}
40bbd6d050SRafael J. Wysocki #endif /* CONFIG_PM */
41795536acSTomas Winkler 
42795536acSTomas Winkler /**
433908be6fSAlexander Usyskin  * mei_txe_probe - Device Initialization Routine
44795536acSTomas Winkler  *
45795536acSTomas Winkler  * @pdev: PCI device structure
46795536acSTomas Winkler  * @ent: entry in mei_txe_pci_tbl
47795536acSTomas Winkler  *
48a8605ea2SAlexander Usyskin  * Return: 0 on success, <0 on failure.
49795536acSTomas Winkler  */
50795536acSTomas Winkler static int mei_txe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
51795536acSTomas Winkler {
52795536acSTomas Winkler 	struct mei_device *dev;
53795536acSTomas Winkler 	struct mei_txe_hw *hw;
54f8a09605STomas Winkler 	const int mask = BIT(SEC_BAR) | BIT(BRIDGE_BAR);
55795536acSTomas Winkler 	int err;
56795536acSTomas Winkler 
57795536acSTomas Winkler 	/* enable pci dev */
58f8a09605STomas Winkler 	err = pcim_enable_device(pdev);
59795536acSTomas Winkler 	if (err) {
60795536acSTomas Winkler 		dev_err(&pdev->dev, "failed to enable pci device.\n");
61795536acSTomas Winkler 		goto end;
62795536acSTomas Winkler 	}
63795536acSTomas Winkler 	/* set PCI host mastering  */
64795536acSTomas Winkler 	pci_set_master(pdev);
65f8a09605STomas Winkler 	/* pci request regions and mapping IO device memory for mei driver */
66f8a09605STomas Winkler 	err = pcim_iomap_regions(pdev, mask, KBUILD_MODNAME);
67795536acSTomas Winkler 	if (err) {
68795536acSTomas Winkler 		dev_err(&pdev->dev, "failed to get pci regions.\n");
69f8a09605STomas Winkler 		goto end;
70795536acSTomas Winkler 	}
71795536acSTomas Winkler 
72795536acSTomas Winkler 	err = pci_set_dma_mask(pdev, DMA_BIT_MASK(36));
73795536acSTomas Winkler 	if (err) {
74795536acSTomas Winkler 		err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
75795536acSTomas Winkler 		if (err) {
76795536acSTomas Winkler 			dev_err(&pdev->dev, "No suitable DMA available.\n");
77f8a09605STomas Winkler 			goto end;
78795536acSTomas Winkler 		}
79795536acSTomas Winkler 	}
80795536acSTomas Winkler 
81795536acSTomas Winkler 	/* allocates and initializes the mei dev structure */
824ad96db6STomas Winkler 	dev = mei_txe_dev_init(pdev);
83795536acSTomas Winkler 	if (!dev) {
84795536acSTomas Winkler 		err = -ENOMEM;
85f8a09605STomas Winkler 		goto end;
86795536acSTomas Winkler 	}
87795536acSTomas Winkler 	hw = to_txe_hw(dev);
88f8a09605STomas Winkler 	hw->mem_addr = pcim_iomap_table(pdev);
89795536acSTomas Winkler 
90795536acSTomas Winkler 	pci_enable_msi(pdev);
91795536acSTomas Winkler 
92795536acSTomas Winkler 	/* clear spurious interrupts */
93795536acSTomas Winkler 	mei_clear_interrupts(dev);
94795536acSTomas Winkler 
95795536acSTomas Winkler 	/* request and enable interrupt  */
96795536acSTomas Winkler 	if (pci_dev_msi_enabled(pdev))
97795536acSTomas Winkler 		err = request_threaded_irq(pdev->irq,
98795536acSTomas Winkler 			NULL,
99795536acSTomas Winkler 			mei_txe_irq_thread_handler,
100795536acSTomas Winkler 			IRQF_ONESHOT, KBUILD_MODNAME, dev);
101795536acSTomas Winkler 	else
102795536acSTomas Winkler 		err = request_threaded_irq(pdev->irq,
103795536acSTomas Winkler 			mei_txe_irq_quick_handler,
104795536acSTomas Winkler 			mei_txe_irq_thread_handler,
105795536acSTomas Winkler 			IRQF_SHARED, KBUILD_MODNAME, dev);
106795536acSTomas Winkler 	if (err) {
107795536acSTomas Winkler 		dev_err(&pdev->dev, "mei: request_threaded_irq failure. irq = %d\n",
108795536acSTomas Winkler 			pdev->irq);
109f8a09605STomas Winkler 		goto end;
110795536acSTomas Winkler 	}
111795536acSTomas Winkler 
112795536acSTomas Winkler 	if (mei_start(dev)) {
113795536acSTomas Winkler 		dev_err(&pdev->dev, "init hw failure.\n");
114795536acSTomas Winkler 		err = -ENODEV;
115795536acSTomas Winkler 		goto release_irq;
116795536acSTomas Winkler 	}
117795536acSTomas Winkler 
118cfe5ab85SAlexander Usyskin 	pm_runtime_set_autosuspend_delay(&pdev->dev, MEI_TXI_RPM_TIMEOUT);
119cfe5ab85SAlexander Usyskin 	pm_runtime_use_autosuspend(&pdev->dev);
120cfe5ab85SAlexander Usyskin 
121f3d8e878SAlexander Usyskin 	err = mei_register(dev, &pdev->dev);
122795536acSTomas Winkler 	if (err)
1231f7e489aSAlexander Usyskin 		goto stop;
124795536acSTomas Winkler 
125795536acSTomas Winkler 	pci_set_drvdata(pdev, dev);
126795536acSTomas Winkler 
127d2d56faeSAlexander Usyskin 	/*
128557909e1SAlexander Usyskin 	 * MEI requires to resume from runtime suspend mode
129557909e1SAlexander Usyskin 	 * in order to perform link reset flow upon system suspend.
130557909e1SAlexander Usyskin 	 */
131e0751556SRafael J. Wysocki 	dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);
132557909e1SAlexander Usyskin 
133557909e1SAlexander Usyskin 	/*
134b42dc063SAlexander Usyskin 	 * TXE maps runtime suspend/resume to own power gating states,
135b42dc063SAlexander Usyskin 	 * hence we need to go around native PCI runtime service which
136b42dc063SAlexander Usyskin 	 * eventually brings the device into D3cold/hot state.
137b42dc063SAlexander Usyskin 	 * But the TXE device cannot wake up from D3 unlike from own
138b42dc063SAlexander Usyskin 	 * power gating. To get around PCI device native runtime pm,
139b42dc063SAlexander Usyskin 	 * TXE uses runtime pm domain handlers which take precedence.
140d2d56faeSAlexander Usyskin 	 */
141d2d56faeSAlexander Usyskin 	mei_txe_set_pm_domain(dev);
142d2d56faeSAlexander Usyskin 
143cfe5ab85SAlexander Usyskin 	pm_runtime_put_noidle(&pdev->dev);
144cfe5ab85SAlexander Usyskin 
145795536acSTomas Winkler 	return 0;
146795536acSTomas Winkler 
1471f7e489aSAlexander Usyskin stop:
1481f7e489aSAlexander Usyskin 	mei_stop(dev);
149795536acSTomas Winkler release_irq:
150795536acSTomas Winkler 	mei_cancel_work(dev);
151795536acSTomas Winkler 	mei_disable_interrupts(dev);
152795536acSTomas Winkler 	free_irq(pdev->irq, dev);
153795536acSTomas Winkler end:
154795536acSTomas Winkler 	dev_err(&pdev->dev, "initialization failed.\n");
155795536acSTomas Winkler 	return err;
156795536acSTomas Winkler }
157795536acSTomas Winkler 
158795536acSTomas Winkler /**
159*09f8c33aSTamar Mashiah  * mei_txe_shutdown- Device Shutdown Routine
1605c4c0106STomas Winkler  *
1615c4c0106STomas Winkler  * @pdev: PCI device structure
1625c4c0106STomas Winkler  *
1635c4c0106STomas Winkler  *  mei_txe_shutdown is called from the reboot notifier
1645c4c0106STomas Winkler  *  it's a simplified version of remove so we go down
1655c4c0106STomas Winkler  *  faster.
1665c4c0106STomas Winkler  */
1675c4c0106STomas Winkler static void mei_txe_shutdown(struct pci_dev *pdev)
1685c4c0106STomas Winkler {
1695c4c0106STomas Winkler 	struct mei_device *dev;
1705c4c0106STomas Winkler 
1715c4c0106STomas Winkler 	dev = pci_get_drvdata(pdev);
1725c4c0106STomas Winkler 	if (!dev)
1735c4c0106STomas Winkler 		return;
1745c4c0106STomas Winkler 
1755c4c0106STomas Winkler 	dev_dbg(&pdev->dev, "shutdown\n");
1765c4c0106STomas Winkler 	mei_stop(dev);
1775c4c0106STomas Winkler 
1785c4c0106STomas Winkler 	mei_txe_unset_pm_domain(dev);
1795c4c0106STomas Winkler 
1805c4c0106STomas Winkler 	mei_disable_interrupts(dev);
1815c4c0106STomas Winkler 	free_irq(pdev->irq, dev);
1825c4c0106STomas Winkler }
1835c4c0106STomas Winkler 
1845c4c0106STomas Winkler /**
1853908be6fSAlexander Usyskin  * mei_txe_remove - Device Removal Routine
186795536acSTomas Winkler  *
187795536acSTomas Winkler  * @pdev: PCI device structure
188795536acSTomas Winkler  *
189795536acSTomas Winkler  * mei_remove is called by the PCI subsystem to alert the driver
190795536acSTomas Winkler  * that it should release a PCI device.
191795536acSTomas Winkler  */
192795536acSTomas Winkler static void mei_txe_remove(struct pci_dev *pdev)
193795536acSTomas Winkler {
194795536acSTomas Winkler 	struct mei_device *dev;
195795536acSTomas Winkler 
196795536acSTomas Winkler 	dev = pci_get_drvdata(pdev);
197795536acSTomas Winkler 	if (!dev) {
198f8a09605STomas Winkler 		dev_err(&pdev->dev, "mei: dev == NULL\n");
199795536acSTomas Winkler 		return;
200795536acSTomas Winkler 	}
201795536acSTomas Winkler 
202cfe5ab85SAlexander Usyskin 	pm_runtime_get_noresume(&pdev->dev);
203cfe5ab85SAlexander Usyskin 
204795536acSTomas Winkler 	mei_stop(dev);
205795536acSTomas Winkler 
206d2d56faeSAlexander Usyskin 	mei_txe_unset_pm_domain(dev);
207d2d56faeSAlexander Usyskin 
208795536acSTomas Winkler 	mei_disable_interrupts(dev);
209795536acSTomas Winkler 	free_irq(pdev->irq, dev);
210795536acSTomas Winkler 
211795536acSTomas Winkler 	mei_deregister(dev);
212795536acSTomas Winkler }
213795536acSTomas Winkler 
214795536acSTomas Winkler 
215e0270addSTomas Winkler #ifdef CONFIG_PM_SLEEP
216795536acSTomas Winkler static int mei_txe_pci_suspend(struct device *device)
217795536acSTomas Winkler {
218795536acSTomas Winkler 	struct pci_dev *pdev = to_pci_dev(device);
219795536acSTomas Winkler 	struct mei_device *dev = pci_get_drvdata(pdev);
220795536acSTomas Winkler 
221795536acSTomas Winkler 	if (!dev)
222795536acSTomas Winkler 		return -ENODEV;
223795536acSTomas Winkler 
224795536acSTomas Winkler 	dev_dbg(&pdev->dev, "suspend\n");
225795536acSTomas Winkler 
226795536acSTomas Winkler 	mei_stop(dev);
227795536acSTomas Winkler 
228795536acSTomas Winkler 	mei_disable_interrupts(dev);
229795536acSTomas Winkler 
230795536acSTomas Winkler 	free_irq(pdev->irq, dev);
231795536acSTomas Winkler 	pci_disable_msi(pdev);
232795536acSTomas Winkler 
233795536acSTomas Winkler 	return 0;
234795536acSTomas Winkler }
235795536acSTomas Winkler 
236795536acSTomas Winkler static int mei_txe_pci_resume(struct device *device)
237795536acSTomas Winkler {
238795536acSTomas Winkler 	struct pci_dev *pdev = to_pci_dev(device);
239795536acSTomas Winkler 	struct mei_device *dev;
240795536acSTomas Winkler 	int err;
241795536acSTomas Winkler 
242795536acSTomas Winkler 	dev = pci_get_drvdata(pdev);
243795536acSTomas Winkler 	if (!dev)
244795536acSTomas Winkler 		return -ENODEV;
245795536acSTomas Winkler 
246795536acSTomas Winkler 	pci_enable_msi(pdev);
247795536acSTomas Winkler 
248795536acSTomas Winkler 	mei_clear_interrupts(dev);
249795536acSTomas Winkler 
250795536acSTomas Winkler 	/* request and enable interrupt */
251795536acSTomas Winkler 	if (pci_dev_msi_enabled(pdev))
252795536acSTomas Winkler 		err = request_threaded_irq(pdev->irq,
253795536acSTomas Winkler 			NULL,
254795536acSTomas Winkler 			mei_txe_irq_thread_handler,
255795536acSTomas Winkler 			IRQF_ONESHOT, KBUILD_MODNAME, dev);
256795536acSTomas Winkler 	else
257795536acSTomas Winkler 		err = request_threaded_irq(pdev->irq,
258795536acSTomas Winkler 			mei_txe_irq_quick_handler,
259795536acSTomas Winkler 			mei_txe_irq_thread_handler,
260795536acSTomas Winkler 			IRQF_SHARED, KBUILD_MODNAME, dev);
261795536acSTomas Winkler 	if (err) {
262795536acSTomas Winkler 		dev_err(&pdev->dev, "request_threaded_irq failed: irq = %d.\n",
263795536acSTomas Winkler 				pdev->irq);
264795536acSTomas Winkler 		return err;
265795536acSTomas Winkler 	}
266795536acSTomas Winkler 
267795536acSTomas Winkler 	err = mei_restart(dev);
268795536acSTomas Winkler 
269795536acSTomas Winkler 	return err;
270795536acSTomas Winkler }
271cfe5ab85SAlexander Usyskin #endif /* CONFIG_PM_SLEEP */
272795536acSTomas Winkler 
273bbd6d050SRafael J. Wysocki #ifdef CONFIG_PM
274cfe5ab85SAlexander Usyskin static int mei_txe_pm_runtime_idle(struct device *device)
275cfe5ab85SAlexander Usyskin {
276cfe5ab85SAlexander Usyskin 	struct mei_device *dev;
277cfe5ab85SAlexander Usyskin 
278ab81f3f3SChuhong Yuan 	dev_dbg(device, "rpm: txe: runtime_idle\n");
279cfe5ab85SAlexander Usyskin 
280ab81f3f3SChuhong Yuan 	dev = dev_get_drvdata(device);
281cfe5ab85SAlexander Usyskin 	if (!dev)
282cfe5ab85SAlexander Usyskin 		return -ENODEV;
283cfe5ab85SAlexander Usyskin 	if (mei_write_is_idle(dev))
284d5d83f8aSAlexander Usyskin 		pm_runtime_autosuspend(device);
285cfe5ab85SAlexander Usyskin 
286cfe5ab85SAlexander Usyskin 	return -EBUSY;
287cfe5ab85SAlexander Usyskin }
288cfe5ab85SAlexander Usyskin static int mei_txe_pm_runtime_suspend(struct device *device)
289cfe5ab85SAlexander Usyskin {
290cfe5ab85SAlexander Usyskin 	struct mei_device *dev;
291cfe5ab85SAlexander Usyskin 	int ret;
292cfe5ab85SAlexander Usyskin 
293ab81f3f3SChuhong Yuan 	dev_dbg(device, "rpm: txe: runtime suspend\n");
294cfe5ab85SAlexander Usyskin 
295ab81f3f3SChuhong Yuan 	dev = dev_get_drvdata(device);
296cfe5ab85SAlexander Usyskin 	if (!dev)
297cfe5ab85SAlexander Usyskin 		return -ENODEV;
298cfe5ab85SAlexander Usyskin 
299cfe5ab85SAlexander Usyskin 	mutex_lock(&dev->device_lock);
300cfe5ab85SAlexander Usyskin 
301cfe5ab85SAlexander Usyskin 	if (mei_write_is_idle(dev))
302cfe5ab85SAlexander Usyskin 		ret = mei_txe_aliveness_set_sync(dev, 0);
303cfe5ab85SAlexander Usyskin 	else
304cfe5ab85SAlexander Usyskin 		ret = -EAGAIN;
305cfe5ab85SAlexander Usyskin 
306b42dc063SAlexander Usyskin 	/* keep irq on we are staying in D0 */
307cfe5ab85SAlexander Usyskin 
308ab81f3f3SChuhong Yuan 	dev_dbg(device, "rpm: txe: runtime suspend ret=%d\n", ret);
309cfe5ab85SAlexander Usyskin 
310cfe5ab85SAlexander Usyskin 	mutex_unlock(&dev->device_lock);
31177537ad2SAlexander Usyskin 
31277537ad2SAlexander Usyskin 	if (ret && ret != -EAGAIN)
31377537ad2SAlexander Usyskin 		schedule_work(&dev->reset_work);
31477537ad2SAlexander Usyskin 
315cfe5ab85SAlexander Usyskin 	return ret;
316cfe5ab85SAlexander Usyskin }
317cfe5ab85SAlexander Usyskin 
318cfe5ab85SAlexander Usyskin static int mei_txe_pm_runtime_resume(struct device *device)
319cfe5ab85SAlexander Usyskin {
320cfe5ab85SAlexander Usyskin 	struct mei_device *dev;
321cfe5ab85SAlexander Usyskin 	int ret;
322cfe5ab85SAlexander Usyskin 
323ab81f3f3SChuhong Yuan 	dev_dbg(device, "rpm: txe: runtime resume\n");
324cfe5ab85SAlexander Usyskin 
325ab81f3f3SChuhong Yuan 	dev = dev_get_drvdata(device);
326cfe5ab85SAlexander Usyskin 	if (!dev)
327cfe5ab85SAlexander Usyskin 		return -ENODEV;
328cfe5ab85SAlexander Usyskin 
329cfe5ab85SAlexander Usyskin 	mutex_lock(&dev->device_lock);
330cfe5ab85SAlexander Usyskin 
331cfe5ab85SAlexander Usyskin 	mei_enable_interrupts(dev);
332cfe5ab85SAlexander Usyskin 
333cfe5ab85SAlexander Usyskin 	ret = mei_txe_aliveness_set_sync(dev, 1);
334cfe5ab85SAlexander Usyskin 
335cfe5ab85SAlexander Usyskin 	mutex_unlock(&dev->device_lock);
336cfe5ab85SAlexander Usyskin 
337ab81f3f3SChuhong Yuan 	dev_dbg(device, "rpm: txe: runtime resume ret = %d\n", ret);
338cfe5ab85SAlexander Usyskin 
33977537ad2SAlexander Usyskin 	if (ret)
34077537ad2SAlexander Usyskin 		schedule_work(&dev->reset_work);
34177537ad2SAlexander Usyskin 
342cfe5ab85SAlexander Usyskin 	return ret;
343cfe5ab85SAlexander Usyskin }
344d2d56faeSAlexander Usyskin 
345d2d56faeSAlexander Usyskin /**
3467efceb55SGeert Uytterhoeven  * mei_txe_set_pm_domain - fill and set pm domain structure for device
347d2d56faeSAlexander Usyskin  *
348d2d56faeSAlexander Usyskin  * @dev: mei_device
349d2d56faeSAlexander Usyskin  */
350d2d56faeSAlexander Usyskin static inline void mei_txe_set_pm_domain(struct mei_device *dev)
351d2d56faeSAlexander Usyskin {
352d08b8fc0STomas Winkler 	struct pci_dev *pdev  = to_pci_dev(dev->dev);
353d2d56faeSAlexander Usyskin 
354d2d56faeSAlexander Usyskin 	if (pdev->dev.bus && pdev->dev.bus->pm) {
355d2d56faeSAlexander Usyskin 		dev->pg_domain.ops = *pdev->dev.bus->pm;
356d2d56faeSAlexander Usyskin 
357d2d56faeSAlexander Usyskin 		dev->pg_domain.ops.runtime_suspend = mei_txe_pm_runtime_suspend;
358d2d56faeSAlexander Usyskin 		dev->pg_domain.ops.runtime_resume = mei_txe_pm_runtime_resume;
359d2d56faeSAlexander Usyskin 		dev->pg_domain.ops.runtime_idle = mei_txe_pm_runtime_idle;
360d2d56faeSAlexander Usyskin 
361989561deSTomeu Vizoso 		dev_pm_domain_set(&pdev->dev, &dev->pg_domain);
362d2d56faeSAlexander Usyskin 	}
363d2d56faeSAlexander Usyskin }
364d2d56faeSAlexander Usyskin 
365d2d56faeSAlexander Usyskin /**
3667efceb55SGeert Uytterhoeven  * mei_txe_unset_pm_domain - clean pm domain structure for device
367d2d56faeSAlexander Usyskin  *
368d2d56faeSAlexander Usyskin  * @dev: mei_device
369d2d56faeSAlexander Usyskin  */
370d2d56faeSAlexander Usyskin static inline void mei_txe_unset_pm_domain(struct mei_device *dev)
371d2d56faeSAlexander Usyskin {
372d2d56faeSAlexander Usyskin 	/* stop using pm callbacks if any */
373989561deSTomeu Vizoso 	dev_pm_domain_set(dev->dev, NULL);
374d2d56faeSAlexander Usyskin }
375cfe5ab85SAlexander Usyskin 
376cfe5ab85SAlexander Usyskin static const struct dev_pm_ops mei_txe_pm_ops = {
377cfe5ab85SAlexander Usyskin 	SET_SYSTEM_SLEEP_PM_OPS(mei_txe_pci_suspend,
378cfe5ab85SAlexander Usyskin 				mei_txe_pci_resume)
379cfe5ab85SAlexander Usyskin 	SET_RUNTIME_PM_OPS(
380cfe5ab85SAlexander Usyskin 		mei_txe_pm_runtime_suspend,
381cfe5ab85SAlexander Usyskin 		mei_txe_pm_runtime_resume,
382cfe5ab85SAlexander Usyskin 		mei_txe_pm_runtime_idle)
383cfe5ab85SAlexander Usyskin };
384795536acSTomas Winkler 
385795536acSTomas Winkler #define MEI_TXE_PM_OPS	(&mei_txe_pm_ops)
386795536acSTomas Winkler #else
387795536acSTomas Winkler #define MEI_TXE_PM_OPS	NULL
388cfe5ab85SAlexander Usyskin #endif /* CONFIG_PM */
389cfe5ab85SAlexander Usyskin 
390795536acSTomas Winkler /*
391795536acSTomas Winkler  *  PCI driver structure
392795536acSTomas Winkler  */
393795536acSTomas Winkler static struct pci_driver mei_txe_driver = {
394795536acSTomas Winkler 	.name = KBUILD_MODNAME,
395795536acSTomas Winkler 	.id_table = mei_txe_pci_tbl,
396795536acSTomas Winkler 	.probe = mei_txe_probe,
397795536acSTomas Winkler 	.remove = mei_txe_remove,
3985c4c0106STomas Winkler 	.shutdown = mei_txe_shutdown,
399795536acSTomas Winkler 	.driver.pm = MEI_TXE_PM_OPS,
400795536acSTomas Winkler };
401795536acSTomas Winkler 
402795536acSTomas Winkler module_pci_driver(mei_txe_driver);
403795536acSTomas Winkler 
404795536acSTomas Winkler MODULE_AUTHOR("Intel Corporation");
405795536acSTomas Winkler MODULE_DESCRIPTION("Intel(R) Trusted Execution Environment Interface");
406795536acSTomas Winkler MODULE_LICENSE("GPL v2");
407