intel-lpss.c (24ee97a9e816a333688141eed2fbbb2d5e60b5d1) | intel-lpss.c (fd58bb8c7da3c2d4314d7ab76402ca18e9cc0afa) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Intel Sunrisepoint LPSS core support. 4 * 5 * Copyright (C) 2015, Intel Corporation 6 * 7 * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 8 * Mika Westerberg <mika.westerberg@linux.intel.com> --- 10 unchanged lines hidden (view full) --- 19#include <linux/device.h> 20#include <linux/err.h> 21#include <linux/gfp_types.h> 22#include <linux/idr.h> 23#include <linux/io.h> 24#include <linux/ioport.h> 25#include <linux/mfd/core.h> 26#include <linux/module.h> | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Intel Sunrisepoint LPSS core support. 4 * 5 * Copyright (C) 2015, Intel Corporation 6 * 7 * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 8 * Mika Westerberg <mika.westerberg@linux.intel.com> --- 10 unchanged lines hidden (view full) --- 19#include <linux/device.h> 20#include <linux/err.h> 21#include <linux/gfp_types.h> 22#include <linux/idr.h> 23#include <linux/io.h> 24#include <linux/ioport.h> 25#include <linux/mfd/core.h> 26#include <linux/module.h> |
27#include <linux/pm.h> |
|
27#include <linux/pm_qos.h> 28#include <linux/pm_runtime.h> 29#include <linux/sprintf.h> 30#include <linux/types.h> 31 32#include <linux/io-64-nonatomic-lo-hi.h> 33 34#include <linux/dma/idma64.h> --- 430 unchanged lines hidden (view full) --- 465 mfd_remove_devices(dev); 466 intel_lpss_debugfs_remove(lpss); 467 intel_lpss_ltr_hide(lpss); 468 intel_lpss_unregister_clock(lpss); 469 ida_free(&intel_lpss_devid_ida, lpss->devid); 470} 471EXPORT_SYMBOL_NS_GPL(intel_lpss_remove, INTEL_LPSS); 472 | 28#include <linux/pm_qos.h> 29#include <linux/pm_runtime.h> 30#include <linux/sprintf.h> 31#include <linux/types.h> 32 33#include <linux/io-64-nonatomic-lo-hi.h> 34 35#include <linux/dma/idma64.h> --- 430 unchanged lines hidden (view full) --- 466 mfd_remove_devices(dev); 467 intel_lpss_debugfs_remove(lpss); 468 intel_lpss_ltr_hide(lpss); 469 intel_lpss_unregister_clock(lpss); 470 ida_free(&intel_lpss_devid_ida, lpss->devid); 471} 472EXPORT_SYMBOL_NS_GPL(intel_lpss_remove, INTEL_LPSS); 473 |
473#ifdef CONFIG_PM | |
474static int resume_lpss_device(struct device *dev, void *data) 475{ 476 if (!dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND)) 477 pm_runtime_resume(dev); 478 479 return 0; 480} 481 | 474static int resume_lpss_device(struct device *dev, void *data) 475{ 476 if (!dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND)) 477 pm_runtime_resume(dev); 478 479 return 0; 480} 481 |
482int intel_lpss_prepare(struct device *dev) | 482static int intel_lpss_prepare(struct device *dev) |
483{ 484 /* 485 * Resume both child devices before entering system sleep. This 486 * ensures that they are in proper state before they get suspended. 487 */ 488 device_for_each_child_reverse(dev, NULL, resume_lpss_device); 489 return 0; 490} | 483{ 484 /* 485 * Resume both child devices before entering system sleep. This 486 * ensures that they are in proper state before they get suspended. 487 */ 488 device_for_each_child_reverse(dev, NULL, resume_lpss_device); 489 return 0; 490} |
491EXPORT_SYMBOL_NS_GPL(intel_lpss_prepare, INTEL_LPSS); | |
492 | 491 |
493int intel_lpss_suspend(struct device *dev) | 492static int intel_lpss_suspend(struct device *dev) |
494{ 495 struct intel_lpss *lpss = dev_get_drvdata(dev); 496 unsigned int i; 497 498 /* Save device context */ 499 for (i = 0; i < LPSS_PRIV_REG_COUNT; i++) 500 lpss->priv_ctx[i] = readl(lpss->priv + i * 4); 501 502 /* 503 * If the device type is not UART, then put the controller into 504 * reset. UART cannot be put into reset since S3/S0ix fail when 505 * no_console_suspend flag is enabled. 506 */ 507 if (lpss->type != LPSS_DEV_UART) 508 writel(0, lpss->priv + LPSS_PRIV_RESETS); 509 510 return 0; 511} | 493{ 494 struct intel_lpss *lpss = dev_get_drvdata(dev); 495 unsigned int i; 496 497 /* Save device context */ 498 for (i = 0; i < LPSS_PRIV_REG_COUNT; i++) 499 lpss->priv_ctx[i] = readl(lpss->priv + i * 4); 500 501 /* 502 * If the device type is not UART, then put the controller into 503 * reset. UART cannot be put into reset since S3/S0ix fail when 504 * no_console_suspend flag is enabled. 505 */ 506 if (lpss->type != LPSS_DEV_UART) 507 writel(0, lpss->priv + LPSS_PRIV_RESETS); 508 509 return 0; 510} |
512EXPORT_SYMBOL_NS_GPL(intel_lpss_suspend, INTEL_LPSS); | |
513 | 511 |
514int intel_lpss_resume(struct device *dev) | 512static int intel_lpss_resume(struct device *dev) |
515{ 516 struct intel_lpss *lpss = dev_get_drvdata(dev); 517 unsigned int i; 518 519 intel_lpss_deassert_reset(lpss); 520 521 /* Restore device context */ 522 for (i = 0; i < LPSS_PRIV_REG_COUNT; i++) 523 writel(lpss->priv_ctx[i], lpss->priv + i * 4); 524 525 return 0; 526} | 513{ 514 struct intel_lpss *lpss = dev_get_drvdata(dev); 515 unsigned int i; 516 517 intel_lpss_deassert_reset(lpss); 518 519 /* Restore device context */ 520 for (i = 0; i < LPSS_PRIV_REG_COUNT; i++) 521 writel(lpss->priv_ctx[i], lpss->priv + i * 4); 522 523 return 0; 524} |
527EXPORT_SYMBOL_NS_GPL(intel_lpss_resume, INTEL_LPSS); 528#endif | |
529 | 525 |
526EXPORT_NS_GPL_DEV_PM_OPS(intel_lpss_pm_ops, INTEL_LPSS) = { 527 .prepare = pm_sleep_ptr(&intel_lpss_prepare), 528 LATE_SYSTEM_SLEEP_PM_OPS(intel_lpss_suspend, intel_lpss_resume) 529 RUNTIME_PM_OPS(intel_lpss_suspend, intel_lpss_resume, NULL) 530}; 531 |
|
530static int __init intel_lpss_init(void) 531{ 532 intel_lpss_debugfs = debugfs_create_dir("intel_lpss", NULL); 533 return 0; 534} 535module_init(intel_lpss_init); 536 537static void __exit intel_lpss_exit(void) --- 20 unchanged lines hidden --- | 532static int __init intel_lpss_init(void) 533{ 534 intel_lpss_debugfs = debugfs_create_dir("intel_lpss", NULL); 535 return 0; 536} 537module_init(intel_lpss_init); 538 539static void __exit intel_lpss_exit(void) --- 20 unchanged lines hidden --- |