Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Andy Shevchenko | c558e39 | 2014-08-19 19:17:35 +0300 | [diff] [blame] | 2 | /* |
| 3 | * Intel Low Power Subsystem PWM controller driver |
| 4 | * |
| 5 | * Copyright (C) 2014, Intel Corporation |
| 6 | * |
| 7 | * Derived from the original pwm-lpss.c |
Andy Shevchenko | c558e39 | 2014-08-19 19:17:35 +0300 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #ifndef __PWM_LPSS_H |
| 11 | #define __PWM_LPSS_H |
| 12 | |
| 13 | #include <linux/device.h> |
| 14 | #include <linux/pwm.h> |
| 15 | |
Hans de Goede | 9dc419b | 2018-10-12 12:12:26 +0200 | [diff] [blame] | 16 | #define MAX_PWMS 4 |
| 17 | |
| 18 | struct pwm_lpss_chip { |
| 19 | struct pwm_chip chip; |
| 20 | void __iomem *regs; |
| 21 | const struct pwm_lpss_boardinfo *info; |
| 22 | u32 saved_ctrl[MAX_PWMS]; |
| 23 | }; |
Andy Shevchenko | c558e39 | 2014-08-19 19:17:35 +0300 | [diff] [blame] | 24 | |
| 25 | struct pwm_lpss_boardinfo { |
| 26 | unsigned long clk_rate; |
Mika Westerberg | 4e11f5a | 2015-10-20 16:53:05 +0300 | [diff] [blame] | 27 | unsigned int npwm; |
qipeng.zha | 883e4d0 | 2015-11-17 17:20:15 +0800 | [diff] [blame] | 28 | unsigned long base_unit_bits; |
Hans de Goede | b997e3e | 2017-04-06 14:54:01 +0300 | [diff] [blame] | 29 | bool bypass; |
Hans de Goede | 4743765 | 2018-10-14 17:12:01 +0200 | [diff] [blame] | 30 | /* |
| 31 | * On some devices the _PS0/_PS3 AML code of the GPU (GFX0) device |
| 32 | * messes with the PWM0 controllers state, |
| 33 | */ |
| 34 | bool other_devices_aml_touches_pwm_regs; |
Andy Shevchenko | c558e39 | 2014-08-19 19:17:35 +0300 | [diff] [blame] | 35 | }; |
| 36 | |
Andy Shevchenko | c558e39 | 2014-08-19 19:17:35 +0300 | [diff] [blame] | 37 | struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r, |
| 38 | const struct pwm_lpss_boardinfo *info); |
| 39 | int pwm_lpss_remove(struct pwm_lpss_chip *lpwm); |
Hans de Goede | 1d375b5 | 2018-04-26 14:10:23 +0200 | [diff] [blame] | 40 | int pwm_lpss_suspend(struct device *dev); |
| 41 | int pwm_lpss_resume(struct device *dev); |
Andy Shevchenko | c558e39 | 2014-08-19 19:17:35 +0300 | [diff] [blame] | 42 | |
| 43 | #endif /* __PWM_LPSS_H */ |