| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | | - * |
|---|
| 3 | + * Copyright (c) 2013-2020, Intel Corporation. All rights reserved. |
|---|
| 3 | 4 | * Intel Management Engine Interface (Intel MEI) Linux driver |
|---|
| 4 | | - * Copyright (c) 2013-2014, Intel Corporation. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 7 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 8 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 11 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 12 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 13 | | - * more details. |
|---|
| 14 | | - * |
|---|
| 15 | 5 | */ |
|---|
| 16 | 6 | |
|---|
| 17 | 7 | #include <linux/module.h> |
|---|
| 18 | 8 | #include <linux/kernel.h> |
|---|
| 19 | 9 | #include <linux/device.h> |
|---|
| 20 | | -#include <linux/fs.h> |
|---|
| 21 | 10 | #include <linux/errno.h> |
|---|
| 22 | 11 | #include <linux/types.h> |
|---|
| 23 | 12 | #include <linux/pci.h> |
|---|
| 24 | 13 | #include <linux/init.h> |
|---|
| 25 | 14 | #include <linux/sched.h> |
|---|
| 26 | | -#include <linux/uuid.h> |
|---|
| 27 | | -#include <linux/jiffies.h> |
|---|
| 28 | 15 | #include <linux/interrupt.h> |
|---|
| 29 | 16 | #include <linux/workqueue.h> |
|---|
| 30 | 17 | #include <linux/pm_domain.h> |
|---|
| .. | .. |
|---|
| 141 | 128 | * MEI requires to resume from runtime suspend mode |
|---|
| 142 | 129 | * in order to perform link reset flow upon system suspend. |
|---|
| 143 | 130 | */ |
|---|
| 144 | | - dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NEVER_SKIP); |
|---|
| 131 | + dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NO_DIRECT_COMPLETE); |
|---|
| 145 | 132 | |
|---|
| 146 | 133 | /* |
|---|
| 147 | 134 | * TXE maps runtime suspend/resume to own power gating states, |
|---|
| .. | .. |
|---|
| 286 | 273 | #ifdef CONFIG_PM |
|---|
| 287 | 274 | static int mei_txe_pm_runtime_idle(struct device *device) |
|---|
| 288 | 275 | { |
|---|
| 289 | | - struct pci_dev *pdev = to_pci_dev(device); |
|---|
| 290 | 276 | struct mei_device *dev; |
|---|
| 291 | 277 | |
|---|
| 292 | | - dev_dbg(&pdev->dev, "rpm: txe: runtime_idle\n"); |
|---|
| 278 | + dev_dbg(device, "rpm: txe: runtime_idle\n"); |
|---|
| 293 | 279 | |
|---|
| 294 | | - dev = pci_get_drvdata(pdev); |
|---|
| 280 | + dev = dev_get_drvdata(device); |
|---|
| 295 | 281 | if (!dev) |
|---|
| 296 | 282 | return -ENODEV; |
|---|
| 297 | 283 | if (mei_write_is_idle(dev)) |
|---|
| .. | .. |
|---|
| 301 | 287 | } |
|---|
| 302 | 288 | static int mei_txe_pm_runtime_suspend(struct device *device) |
|---|
| 303 | 289 | { |
|---|
| 304 | | - struct pci_dev *pdev = to_pci_dev(device); |
|---|
| 305 | 290 | struct mei_device *dev; |
|---|
| 306 | 291 | int ret; |
|---|
| 307 | 292 | |
|---|
| 308 | | - dev_dbg(&pdev->dev, "rpm: txe: runtime suspend\n"); |
|---|
| 293 | + dev_dbg(device, "rpm: txe: runtime suspend\n"); |
|---|
| 309 | 294 | |
|---|
| 310 | | - dev = pci_get_drvdata(pdev); |
|---|
| 295 | + dev = dev_get_drvdata(device); |
|---|
| 311 | 296 | if (!dev) |
|---|
| 312 | 297 | return -ENODEV; |
|---|
| 313 | 298 | |
|---|
| .. | .. |
|---|
| 320 | 305 | |
|---|
| 321 | 306 | /* keep irq on we are staying in D0 */ |
|---|
| 322 | 307 | |
|---|
| 323 | | - dev_dbg(&pdev->dev, "rpm: txe: runtime suspend ret=%d\n", ret); |
|---|
| 308 | + dev_dbg(device, "rpm: txe: runtime suspend ret=%d\n", ret); |
|---|
| 324 | 309 | |
|---|
| 325 | 310 | mutex_unlock(&dev->device_lock); |
|---|
| 326 | 311 | |
|---|
| .. | .. |
|---|
| 332 | 317 | |
|---|
| 333 | 318 | static int mei_txe_pm_runtime_resume(struct device *device) |
|---|
| 334 | 319 | { |
|---|
| 335 | | - struct pci_dev *pdev = to_pci_dev(device); |
|---|
| 336 | 320 | struct mei_device *dev; |
|---|
| 337 | 321 | int ret; |
|---|
| 338 | 322 | |
|---|
| 339 | | - dev_dbg(&pdev->dev, "rpm: txe: runtime resume\n"); |
|---|
| 323 | + dev_dbg(device, "rpm: txe: runtime resume\n"); |
|---|
| 340 | 324 | |
|---|
| 341 | | - dev = pci_get_drvdata(pdev); |
|---|
| 325 | + dev = dev_get_drvdata(device); |
|---|
| 342 | 326 | if (!dev) |
|---|
| 343 | 327 | return -ENODEV; |
|---|
| 344 | 328 | |
|---|
| .. | .. |
|---|
| 350 | 334 | |
|---|
| 351 | 335 | mutex_unlock(&dev->device_lock); |
|---|
| 352 | 336 | |
|---|
| 353 | | - dev_dbg(&pdev->dev, "rpm: txe: runtime resume ret = %d\n", ret); |
|---|
| 337 | + dev_dbg(device, "rpm: txe: runtime resume ret = %d\n", ret); |
|---|
| 354 | 338 | |
|---|
| 355 | 339 | if (ret) |
|---|
| 356 | 340 | schedule_work(&dev->reset_work); |
|---|