diff options
-rw-r--r-- | Documentation/devicetree/bindings/mfd/stm32-timers.txt | 20 | ||||
-rw-r--r-- | drivers/acpi/acpi_lpss.c | 2 | ||||
-rw-r--r-- | drivers/pwm/Kconfig | 2 | ||||
-rw-r--r-- | drivers/pwm/pwm-atmel-tcb.c | 6 | ||||
-rw-r--r-- | drivers/pwm/pwm-lpss-platform.c | 5 | ||||
-rw-r--r-- | drivers/pwm/pwm-lpss.c | 30 | ||||
-rw-r--r-- | drivers/pwm/pwm-lpss.h | 2 | ||||
-rw-r--r-- | drivers/pwm/pwm-meson.c | 4 | ||||
-rw-r--r-- | drivers/pwm/pwm-rcar.c | 3 | ||||
-rw-r--r-- | drivers/pwm/pwm-stm32.c | 4 |
10 files changed, 66 insertions, 12 deletions
diff --git a/Documentation/devicetree/bindings/mfd/stm32-timers.txt b/Documentation/devicetree/bindings/mfd/stm32-timers.txt index 1db6e0057a63..0e900b52e895 100644 --- a/Documentation/devicetree/bindings/mfd/stm32-timers.txt +++ b/Documentation/devicetree/bindings/mfd/stm32-timers.txt | |||
@@ -19,6 +19,11 @@ Required parameters: | |||
19 | Optional parameters: | 19 | Optional parameters: |
20 | - resets: Phandle to the parent reset controller. | 20 | - resets: Phandle to the parent reset controller. |
21 | See ../reset/st,stm32-rcc.txt | 21 | See ../reset/st,stm32-rcc.txt |
22 | - dmas: List of phandle to dma channels that can be used for | ||
23 | this timer instance. There may be up to 7 dma channels. | ||
24 | - dma-names: List of dma names. Must match 'dmas' property. Valid | ||
25 | names are: "ch1", "ch2", "ch3", "ch4", "up", "trig", | ||
26 | "com". | ||
22 | 27 | ||
23 | Optional subnodes: | 28 | Optional subnodes: |
24 | - pwm: See ../pwm/pwm-stm32.txt | 29 | - pwm: See ../pwm/pwm-stm32.txt |
@@ -44,3 +49,18 @@ Example: | |||
44 | reg = <0>; | 49 | reg = <0>; |
45 | }; | 50 | }; |
46 | }; | 51 | }; |
52 | |||
53 | Example with all dmas: | ||
54 | timer@40010000 { | ||
55 | ... | ||
56 | dmas = <&dmamux1 11 0x400 0x0>, | ||
57 | <&dmamux1 12 0x400 0x0>, | ||
58 | <&dmamux1 13 0x400 0x0>, | ||
59 | <&dmamux1 14 0x400 0x0>, | ||
60 | <&dmamux1 15 0x400 0x0>, | ||
61 | <&dmamux1 16 0x400 0x0>, | ||
62 | <&dmamux1 17 0x400 0x0>; | ||
63 | dma-names = "ch1", "ch2", "ch3", "ch4", "up", "trig", "com"; | ||
64 | ... | ||
65 | child nodes... | ||
66 | }; | ||
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index cb6ac5c65c2e..38a286975c31 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -233,11 +233,13 @@ static const struct lpss_device_desc lpt_sdio_dev_desc = { | |||
233 | 233 | ||
234 | static const struct lpss_device_desc byt_pwm_dev_desc = { | 234 | static const struct lpss_device_desc byt_pwm_dev_desc = { |
235 | .flags = LPSS_SAVE_CTX, | 235 | .flags = LPSS_SAVE_CTX, |
236 | .prv_offset = 0x800, | ||
236 | .setup = byt_pwm_setup, | 237 | .setup = byt_pwm_setup, |
237 | }; | 238 | }; |
238 | 239 | ||
239 | static const struct lpss_device_desc bsw_pwm_dev_desc = { | 240 | static const struct lpss_device_desc bsw_pwm_dev_desc = { |
240 | .flags = LPSS_SAVE_CTX | LPSS_NO_D3_DELAY, | 241 | .flags = LPSS_SAVE_CTX | LPSS_NO_D3_DELAY, |
242 | .prv_offset = 0x800, | ||
241 | .setup = bsw_pwm_setup, | 243 | .setup = bsw_pwm_setup, |
242 | }; | 244 | }; |
243 | 245 | ||
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index 4635cb35008c..a4d262db9945 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig | |||
@@ -401,7 +401,7 @@ config PWM_STI | |||
401 | 401 | ||
402 | config PWM_STM32 | 402 | config PWM_STM32 |
403 | tristate "STMicroelectronics STM32 PWM" | 403 | tristate "STMicroelectronics STM32 PWM" |
404 | depends on MFD_STM32_TIMERS || COMPILE_TEST | 404 | depends on MFD_STM32_TIMERS |
405 | help | 405 | help |
406 | Generic PWM framework driver for STM32 SoCs. | 406 | Generic PWM framework driver for STM32 SoCs. |
407 | 407 | ||
diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c index 4fb1be246c44..0d0f8376bc35 100644 --- a/drivers/pwm/pwm-atmel-tcb.c +++ b/drivers/pwm/pwm-atmel-tcb.c | |||
@@ -460,8 +460,7 @@ MODULE_DEVICE_TABLE(of, atmel_tcb_pwm_dt_ids); | |||
460 | #ifdef CONFIG_PM_SLEEP | 460 | #ifdef CONFIG_PM_SLEEP |
461 | static int atmel_tcb_pwm_suspend(struct device *dev) | 461 | static int atmel_tcb_pwm_suspend(struct device *dev) |
462 | { | 462 | { |
463 | struct platform_device *pdev = to_platform_device(dev); | 463 | struct atmel_tcb_pwm_chip *tcbpwm = dev_get_drvdata(dev); |
464 | struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev); | ||
465 | void __iomem *base = tcbpwm->tc->regs; | 464 | void __iomem *base = tcbpwm->tc->regs; |
466 | int i; | 465 | int i; |
467 | 466 | ||
@@ -478,8 +477,7 @@ static int atmel_tcb_pwm_suspend(struct device *dev) | |||
478 | 477 | ||
479 | static int atmel_tcb_pwm_resume(struct device *dev) | 478 | static int atmel_tcb_pwm_resume(struct device *dev) |
480 | { | 479 | { |
481 | struct platform_device *pdev = to_platform_device(dev); | 480 | struct atmel_tcb_pwm_chip *tcbpwm = dev_get_drvdata(dev); |
482 | struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev); | ||
483 | void __iomem *base = tcbpwm->tc->regs; | 481 | void __iomem *base = tcbpwm->tc->regs; |
484 | int i; | 482 | int i; |
485 | 483 | ||
diff --git a/drivers/pwm/pwm-lpss-platform.c b/drivers/pwm/pwm-lpss-platform.c index 5d6ed1507d29..5561b9e190f8 100644 --- a/drivers/pwm/pwm-lpss-platform.c +++ b/drivers/pwm/pwm-lpss-platform.c | |||
@@ -74,6 +74,10 @@ static int pwm_lpss_remove_platform(struct platform_device *pdev) | |||
74 | return pwm_lpss_remove(lpwm); | 74 | return pwm_lpss_remove(lpwm); |
75 | } | 75 | } |
76 | 76 | ||
77 | static SIMPLE_DEV_PM_OPS(pwm_lpss_platform_pm_ops, | ||
78 | pwm_lpss_suspend, | ||
79 | pwm_lpss_resume); | ||
80 | |||
77 | static const struct acpi_device_id pwm_lpss_acpi_match[] = { | 81 | static const struct acpi_device_id pwm_lpss_acpi_match[] = { |
78 | { "80860F09", (unsigned long)&pwm_lpss_byt_info }, | 82 | { "80860F09", (unsigned long)&pwm_lpss_byt_info }, |
79 | { "80862288", (unsigned long)&pwm_lpss_bsw_info }, | 83 | { "80862288", (unsigned long)&pwm_lpss_bsw_info }, |
@@ -86,6 +90,7 @@ static struct platform_driver pwm_lpss_driver_platform = { | |||
86 | .driver = { | 90 | .driver = { |
87 | .name = "pwm-lpss", | 91 | .name = "pwm-lpss", |
88 | .acpi_match_table = pwm_lpss_acpi_match, | 92 | .acpi_match_table = pwm_lpss_acpi_match, |
93 | .pm = &pwm_lpss_platform_pm_ops, | ||
89 | }, | 94 | }, |
90 | .probe = pwm_lpss_probe_platform, | 95 | .probe = pwm_lpss_probe_platform, |
91 | .remove = pwm_lpss_remove_platform, | 96 | .remove = pwm_lpss_remove_platform, |
diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c index 8db0d40ccacd..4721a264bac2 100644 --- a/drivers/pwm/pwm-lpss.c +++ b/drivers/pwm/pwm-lpss.c | |||
@@ -32,10 +32,13 @@ | |||
32 | /* Size of each PWM register space if multiple */ | 32 | /* Size of each PWM register space if multiple */ |
33 | #define PWM_SIZE 0x400 | 33 | #define PWM_SIZE 0x400 |
34 | 34 | ||
35 | #define MAX_PWMS 4 | ||
36 | |||
35 | struct pwm_lpss_chip { | 37 | struct pwm_lpss_chip { |
36 | struct pwm_chip chip; | 38 | struct pwm_chip chip; |
37 | void __iomem *regs; | 39 | void __iomem *regs; |
38 | const struct pwm_lpss_boardinfo *info; | 40 | const struct pwm_lpss_boardinfo *info; |
41 | u32 saved_ctrl[MAX_PWMS]; | ||
39 | }; | 42 | }; |
40 | 43 | ||
41 | static inline struct pwm_lpss_chip *to_lpwm(struct pwm_chip *chip) | 44 | static inline struct pwm_lpss_chip *to_lpwm(struct pwm_chip *chip) |
@@ -177,6 +180,9 @@ struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r, | |||
177 | unsigned long c; | 180 | unsigned long c; |
178 | int ret; | 181 | int ret; |
179 | 182 | ||
183 | if (WARN_ON(info->npwm > MAX_PWMS)) | ||
184 | return ERR_PTR(-ENODEV); | ||
185 | |||
180 | lpwm = devm_kzalloc(dev, sizeof(*lpwm), GFP_KERNEL); | 186 | lpwm = devm_kzalloc(dev, sizeof(*lpwm), GFP_KERNEL); |
181 | if (!lpwm) | 187 | if (!lpwm) |
182 | return ERR_PTR(-ENOMEM); | 188 | return ERR_PTR(-ENOMEM); |
@@ -212,6 +218,30 @@ int pwm_lpss_remove(struct pwm_lpss_chip *lpwm) | |||
212 | } | 218 | } |
213 | EXPORT_SYMBOL_GPL(pwm_lpss_remove); | 219 | EXPORT_SYMBOL_GPL(pwm_lpss_remove); |
214 | 220 | ||
221 | int pwm_lpss_suspend(struct device *dev) | ||
222 | { | ||
223 | struct pwm_lpss_chip *lpwm = dev_get_drvdata(dev); | ||
224 | int i; | ||
225 | |||
226 | for (i = 0; i < lpwm->info->npwm; i++) | ||
227 | lpwm->saved_ctrl[i] = readl(lpwm->regs + i * PWM_SIZE + PWM); | ||
228 | |||
229 | return 0; | ||
230 | } | ||
231 | EXPORT_SYMBOL_GPL(pwm_lpss_suspend); | ||
232 | |||
233 | int pwm_lpss_resume(struct device *dev) | ||
234 | { | ||
235 | struct pwm_lpss_chip *lpwm = dev_get_drvdata(dev); | ||
236 | int i; | ||
237 | |||
238 | for (i = 0; i < lpwm->info->npwm; i++) | ||
239 | writel(lpwm->saved_ctrl[i], lpwm->regs + i * PWM_SIZE + PWM); | ||
240 | |||
241 | return 0; | ||
242 | } | ||
243 | EXPORT_SYMBOL_GPL(pwm_lpss_resume); | ||
244 | |||
215 | MODULE_DESCRIPTION("PWM driver for Intel LPSS"); | 245 | MODULE_DESCRIPTION("PWM driver for Intel LPSS"); |
216 | MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>"); | 246 | MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>"); |
217 | MODULE_LICENSE("GPL v2"); | 247 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/pwm/pwm-lpss.h b/drivers/pwm/pwm-lpss.h index 98306bb02cfe..7a4238ad1fcb 100644 --- a/drivers/pwm/pwm-lpss.h +++ b/drivers/pwm/pwm-lpss.h | |||
@@ -28,5 +28,7 @@ struct pwm_lpss_boardinfo { | |||
28 | struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r, | 28 | struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r, |
29 | const struct pwm_lpss_boardinfo *info); | 29 | const struct pwm_lpss_boardinfo *info); |
30 | int pwm_lpss_remove(struct pwm_lpss_chip *lpwm); | 30 | int pwm_lpss_remove(struct pwm_lpss_chip *lpwm); |
31 | int pwm_lpss_suspend(struct device *dev); | ||
32 | int pwm_lpss_resume(struct device *dev); | ||
31 | 33 | ||
32 | #endif /* __PWM_LPSS_H */ | 34 | #endif /* __PWM_LPSS_H */ |
diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 0767deba8e62..822860b4801a 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c | |||
@@ -541,8 +541,8 @@ static int meson_pwm_probe(struct platform_device *pdev) | |||
541 | meson->data = of_device_get_match_data(&pdev->dev); | 541 | meson->data = of_device_get_match_data(&pdev->dev); |
542 | meson->inverter_mask = BIT(meson->chip.npwm) - 1; | 542 | meson->inverter_mask = BIT(meson->chip.npwm) - 1; |
543 | 543 | ||
544 | channels = devm_kcalloc(&pdev->dev, meson->chip.npwm, sizeof(*meson), | 544 | channels = devm_kcalloc(&pdev->dev, meson->chip.npwm, |
545 | GFP_KERNEL); | 545 | sizeof(*channels), GFP_KERNEL); |
546 | if (!channels) | 546 | if (!channels) |
547 | return -ENOMEM; | 547 | return -ENOMEM; |
548 | 548 | ||
diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c index 91d11f2e2fef..748f614d5375 100644 --- a/drivers/pwm/pwm-rcar.c +++ b/drivers/pwm/pwm-rcar.c | |||
@@ -261,8 +261,7 @@ MODULE_DEVICE_TABLE(of, rcar_pwm_of_table); | |||
261 | #ifdef CONFIG_PM_SLEEP | 261 | #ifdef CONFIG_PM_SLEEP |
262 | static struct pwm_device *rcar_pwm_dev_to_pwm_dev(struct device *dev) | 262 | static struct pwm_device *rcar_pwm_dev_to_pwm_dev(struct device *dev) |
263 | { | 263 | { |
264 | struct platform_device *pdev = to_platform_device(dev); | 264 | struct rcar_pwm_chip *rcar_pwm = dev_get_drvdata(dev); |
265 | struct rcar_pwm_chip *rcar_pwm = platform_get_drvdata(pdev); | ||
266 | struct pwm_chip *chip = &rcar_pwm->chip; | 265 | struct pwm_chip *chip = &rcar_pwm->chip; |
267 | 266 | ||
268 | return &chip->pwms[0]; | 267 | return &chip->pwms[0]; |
diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c index 09383c6720fb..4f842550fbd1 100644 --- a/drivers/pwm/pwm-stm32.c +++ b/drivers/pwm/pwm-stm32.c | |||
@@ -484,9 +484,7 @@ static int stm32_pwm_apply_locked(struct pwm_chip *chip, struct pwm_device *pwm, | |||
484 | static const struct pwm_ops stm32pwm_ops = { | 484 | static const struct pwm_ops stm32pwm_ops = { |
485 | .owner = THIS_MODULE, | 485 | .owner = THIS_MODULE, |
486 | .apply = stm32_pwm_apply_locked, | 486 | .apply = stm32_pwm_apply_locked, |
487 | #if IS_ENABLED(CONFIG_DMA_ENGINE) | 487 | .capture = IS_ENABLED(CONFIG_DMA_ENGINE) ? stm32_pwm_capture : NULL, |
488 | .capture = stm32_pwm_capture, | ||
489 | #endif | ||
490 | }; | 488 | }; |
491 | 489 | ||
492 | static int stm32_pwm_set_breakinput(struct stm32_pwm *priv, | 490 | static int stm32_pwm_set_breakinput(struct stm32_pwm *priv, |