| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Intel Low Power Subsystem PWM controller driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2014, Intel Corporation |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * 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 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | #include <linux/acpi.h> |
|---|
| .. | .. |
|---|
| 30 | 27 | .clk_rate = 19200000, |
|---|
| 31 | 28 | .npwm = 1, |
|---|
| 32 | 29 | .base_unit_bits = 16, |
|---|
| 30 | + .other_devices_aml_touches_pwm_regs = true, |
|---|
| 33 | 31 | }; |
|---|
| 34 | 32 | |
|---|
| 35 | 33 | /* Broxton */ |
|---|
| .. | .. |
|---|
| 60 | 58 | |
|---|
| 61 | 59 | platform_set_drvdata(pdev, lpwm); |
|---|
| 62 | 60 | |
|---|
| 61 | + dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_SMART_PREPARE); |
|---|
| 63 | 62 | pm_runtime_set_active(&pdev->dev); |
|---|
| 64 | 63 | pm_runtime_enable(&pdev->dev); |
|---|
| 65 | 64 | |
|---|
| .. | .. |
|---|
| 74 | 73 | return pwm_lpss_remove(lpwm); |
|---|
| 75 | 74 | } |
|---|
| 76 | 75 | |
|---|
| 77 | | -static SIMPLE_DEV_PM_OPS(pwm_lpss_platform_pm_ops, |
|---|
| 78 | | - pwm_lpss_suspend, |
|---|
| 79 | | - pwm_lpss_resume); |
|---|
| 76 | +static int pwm_lpss_prepare(struct device *dev) |
|---|
| 77 | +{ |
|---|
| 78 | + struct pwm_lpss_chip *lpwm = dev_get_drvdata(dev); |
|---|
| 79 | + |
|---|
| 80 | + /* |
|---|
| 81 | + * If other device's AML code touches the PWM regs on suspend/resume |
|---|
| 82 | + * force runtime-resume the PWM controller to allow this. |
|---|
| 83 | + */ |
|---|
| 84 | + if (lpwm->info->other_devices_aml_touches_pwm_regs) |
|---|
| 85 | + return 0; /* Force runtime-resume */ |
|---|
| 86 | + |
|---|
| 87 | + return 1; /* If runtime-suspended leave as is */ |
|---|
| 88 | +} |
|---|
| 89 | + |
|---|
| 90 | +static const struct dev_pm_ops pwm_lpss_platform_pm_ops = { |
|---|
| 91 | + .prepare = pwm_lpss_prepare, |
|---|
| 92 | +}; |
|---|
| 80 | 93 | |
|---|
| 81 | 94 | static const struct acpi_device_id pwm_lpss_acpi_match[] = { |
|---|
| 82 | 95 | { "80860F09", (unsigned long)&pwm_lpss_byt_info }, |
|---|
| 83 | 96 | { "80862288", (unsigned long)&pwm_lpss_bsw_info }, |
|---|
| 97 | + { "80862289", (unsigned long)&pwm_lpss_bsw_info }, |
|---|
| 84 | 98 | { "80865AC8", (unsigned long)&pwm_lpss_bxt_info }, |
|---|
| 85 | 99 | { }, |
|---|
| 86 | 100 | }; |
|---|