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