18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Intel LPSS core support.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2015, Intel Corporation
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
88c2ecf20Sopenharmony_ci *          Mika Westerberg <mika.westerberg@linux.intel.com>
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef __MFD_INTEL_LPSS_H
128c2ecf20Sopenharmony_ci#define __MFD_INTEL_LPSS_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <linux/pm.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cistruct device;
178c2ecf20Sopenharmony_cistruct resource;
188c2ecf20Sopenharmony_cistruct property_entry;
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistruct intel_lpss_platform_info {
218c2ecf20Sopenharmony_ci	struct resource *mem;
228c2ecf20Sopenharmony_ci	int irq;
238c2ecf20Sopenharmony_ci	unsigned long clk_rate;
248c2ecf20Sopenharmony_ci	const char *clk_con_id;
258c2ecf20Sopenharmony_ci	struct property_entry *properties;
268c2ecf20Sopenharmony_ci};
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciint intel_lpss_probe(struct device *dev,
298c2ecf20Sopenharmony_ci		     const struct intel_lpss_platform_info *info);
308c2ecf20Sopenharmony_civoid intel_lpss_remove(struct device *dev);
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#ifdef CONFIG_PM
338c2ecf20Sopenharmony_ciint intel_lpss_prepare(struct device *dev);
348c2ecf20Sopenharmony_ciint intel_lpss_suspend(struct device *dev);
358c2ecf20Sopenharmony_ciint intel_lpss_resume(struct device *dev);
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#ifdef CONFIG_PM_SLEEP
388c2ecf20Sopenharmony_ci#define INTEL_LPSS_SLEEP_PM_OPS			\
398c2ecf20Sopenharmony_ci	.prepare = intel_lpss_prepare,		\
408c2ecf20Sopenharmony_ci	SET_LATE_SYSTEM_SLEEP_PM_OPS(intel_lpss_suspend, intel_lpss_resume)
418c2ecf20Sopenharmony_ci#else
428c2ecf20Sopenharmony_ci#define INTEL_LPSS_SLEEP_PM_OPS
438c2ecf20Sopenharmony_ci#endif
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define INTEL_LPSS_RUNTIME_PM_OPS		\
468c2ecf20Sopenharmony_ci	.runtime_suspend = intel_lpss_suspend,	\
478c2ecf20Sopenharmony_ci	.runtime_resume = intel_lpss_resume,
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#else /* !CONFIG_PM */
508c2ecf20Sopenharmony_ci#define INTEL_LPSS_SLEEP_PM_OPS
518c2ecf20Sopenharmony_ci#define INTEL_LPSS_RUNTIME_PM_OPS
528c2ecf20Sopenharmony_ci#endif /* CONFIG_PM */
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define INTEL_LPSS_PM_OPS(name)			\
558c2ecf20Sopenharmony_ciconst struct dev_pm_ops name = {		\
568c2ecf20Sopenharmony_ci	INTEL_LPSS_SLEEP_PM_OPS			\
578c2ecf20Sopenharmony_ci	INTEL_LPSS_RUNTIME_PM_OPS		\
588c2ecf20Sopenharmony_ci}
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#endif /* __MFD_INTEL_LPSS_H */
61