pwm: lpss: Move struct pwm_lpss_chip definition to the header file
Subsystems (2)
PATCH 1/2 pwm: lpss: Move struct pwm_lpss_chip definition to the header file
Move struct pwm_lpss_chip definition from pwm-lpss.c to pwm-lpss.h, so that the pci/platform drivers can access the info member (struct pwm_lpss_boardinfo *).
This is a preparation patch for adding platform specific quirks, which the drivers need access to, to pwm_lpss_boardinfo.
--- drivers/pwm/pwm-lpss.c | 9 --------- drivers/pwm/pwm-lpss.h | 9 ++++++++- 2 files changed, 8 insertions(+), 10 deletions(-)
drivers/pwm/pwm-lpss.c +0 -9
@@ -32,15 +32,6 @@/* Size of each PWM register space if multiple */ #define PWM_SIZE 0x400 -#define MAX_PWMS 4 - -struct pwm_lpss_chip { -struct pwm_chip chip; -void __iomem *regs; -const struct pwm_lpss_boardinfo *info; -u32 saved_ctrl[MAX_PWMS ]; -}; -static inline struct pwm_lpss_chip *to_lpwm (struct pwm_chip *chip) { return container_of(chip, struct pwm_lpss_chip, chip);
drivers/pwm/pwm-lpss.h +8 -1
@@ -16,7 +16,14 @@#include <linux/device.h> #include <linux/pwm.h> -struct pwm_lpss_chip ; +#define MAX_PWMS 4 + +struct pwm_lpss_chip { +struct pwm_chip chip; +void __iomem *regs; +const struct pwm_lpss_boardinfo *info; +u32 saved_ctrl[MAX_PWMS ]; +};struct pwm_lpss_boardinfo {unsigned long clk_rate;
Signature · 1 line
2.19.0.rc0
PATCH 2/2 pwm: lpss: Check PWM powerstate after resume on Cherry Trail devices
The _PS0 method for the integrated graphics on some Cherry Trail devices (observed on a HP Pavilion X2 10-p0XX) turns on the PWM chip (puts it in D0), causing an inconsistency between the state the pm-core thinks it is in (left runtime suspended as it was before the suspend/resume) and the state it actually is in.
Interestingly enough this is done on a device where the pwm controller is not used for the backlight at all, since it uses an eDP panel. On devices where the PWM is used this is not a problem since we will resume it ourselves anyways.
This inconsistency causes us to never suspend the pwm controller again, which causes the device to not be able to reach S0ix states when suspended.
This commit adds a resume-complete handler, which when we think the device is still run-time suspended checks the actual power-state and if necessary updates the rpm-core's internal state.
This fixes the Pavilion X2 10-p0XX not reaching S0ix states when suspended.
--- drivers/pwm/pwm-lpss-platform.c | 26 +++++++++++++++++++++++--- drivers/pwm/pwm-lpss.h | 2 ++ 2 files changed, 25 insertions(+), 3 deletions(-)
drivers/pwm/pwm-lpss-platform.c +23 -3
@@ -30,6 +30,7 @@ static const struct pwm_lpss_boardinfo pwm_lpss_bsw_info = { .clk_rate = 19200000, .npwm = 1, .base_unit_bits = 16, + .check_power_on_resume = true, };/* Broxton */
@@ -74,9 +75,28 @@ static int pwm_lpss_remove_platform(struct platform_device *pdev)return pwm_lpss_remove (lpwm); } -static SIMPLE_DEV_PM_OPS(pwm_lpss_platform_pm_ops, - pwm_lpss_suspend, - pwm_lpss_resume); +static void pwm_lpss_complete (struct device *dev) +{ +struct pwm_lpss_chip *lpwm =dev_get_drvdata (dev); +unsigned long long psc; +acpi_status status; + +/* The PWM may be turned on by AML code, update our state to match */ +if (pm_runtime_suspended (dev) && lpwm->info->check_power_on_resume) { + status =acpi_evaluate_integer (ACPI_HANDLE (dev),"_PSC" , +NULL , &psc); +if (ACPI_SUCCESS (status) && psc ==ACPI_STATE_D0 ) { +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev); + } + } +} + +static const struct dev_pm_ops pwm_lpss_platform_pm_ops = { + .complete = pwm_lpss_complete, +SET_SYSTEM_SLEEP_PM_OPS (pwm_lpss_suspend, pwm_lpss_resume) +};static const struct acpi_device_id pwm_lpss_acpi_match[] = { {"80860F09" , (unsigned long )&pwm_lpss_byt_info },
drivers/pwm/pwm-lpss.h +2 -0
@@ -30,6 +30,8 @@ struct pwm_lpss_boardinfo {unsigned int npwm;unsigned long base_unit_bits;bool bypass; +/* Some devices have AML code messing with the state underneath us */ +bool check_power_on_resume; }; struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r,
Signature · 1 line
2.19.0.rc0
Andy Shevchenko
reviewerRe: [PATCH 2/2] pwm: lpss: Check PWM powerstate after resume on Cherry Trail devices
Quoted 11 lines · Hans de Goede
The
_PS0method for the integrated graphics on some Cherry Trail devices (observed on a HP Pavilion X2 10-p0XX) turns on the PWM chip (puts it in D0), causing an inconsistency between the state the pm-core thinks it is in (left runtime suspended as it was before the suspend/resume) and the state it actually is in.Interestingly enough this is done on a device where the pwm controller is not used for the backlight at all, since it uses an eDP panel. On devices where the PWM is used this is not a problem since we will resume it ourselves anyways.
Quoted 9 lines
This inconsistency causes us to never suspend the pwm controller again, which causes the device to not be able to reach S0ix states when suspended.
This commit adds a resume-complete handler, which when we think the device is still run-time suspended checks the actual power-state and if necessary updates the rpm-core's internal state.
This fixes the Pavilion X2 10-p0XX not reaching S0ix states when suspended.
I also Cc Rafael.
Quoted 26 lines
Signed-off-by Hans de Goede <[email protected]>--- drivers/pwm/pwm-lpss-platform.c | 26 +++++++++++++++++++++++--- drivers/pwm/pwm-lpss.h | 2 ++ 2 files changed, 25 insertions(+), 3 deletions(-)drivers/pwm/pwm-lpss-platform.c +2
-3@@ -30,6 +30,7 @@ static const struct pwm_lpss_boardinfo pwm_lpss_bsw_info = { .clk_rate = 19200000, .npwm = 1, .base_unit_bits = 16, + .check_power_on_resume = true, };/* Broxton */ @@ -74,9 +75,28 @@ static int pwm_lpss_remove_platform(struct platform_device *pdev)return pwm_lpss_remove (lpwm); } -static SIMPLE_DEV_PM_OPS(pwm_lpss_platform_pm_ops, - pwm_lpss_suspend, - pwm_lpss_resume); +static void pwm_lpss_complete (struct device *dev)
drivers/pwm/pwm-lpss-platform.c static int pwm_lpss_remove_platform(struct platform_device *pdev) · line 88
Quoted 10 lines
drivers/pwm/pwm-lpss-platform.c +9
-0+{ +struct pwm_lpss_chip *lpwm =dev_get_drvdata (dev); +unsigned long long psc; +acpi_status status; + +/* The PWM may be turned on by AML code, update our state to match */ +if (pm_runtime_suspended (dev) && lpwm->info->check_power_on_resume) { + status =acpi_evaluate_integer (ACPI_HANDLE (dev),"_PSC" , +NULL , &psc);
AFAIU this is a standard power source method for ACPI, shouldn't ACPI core take care of being in sync?
Quoted 31 lines
drivers/pwm/pwm-lpss-platform.c +12
-0+if (ACPI_SUCCESS (status) && psc ==ACPI_STATE_D0 ) { +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev); + } + } +} + +static const struct dev_pm_ops pwm_lpss_platform_pm_ops = { + .complete = pwm_lpss_complete, +SET_SYSTEM_SLEEP_PM_OPS (pwm_lpss_suspend, pwm_lpss_resume) +};static const struct acpi_device_id pwm_lpss_acpi_match[] = {drivers/pwm/pwm-lpss-platform.c +0
-0{ "80860F09", (unsigned long)&pwm_lpss_byt_info },drivers/pwm/pwm-lpss.h +2
-0@@ -30,6 +30,8 @@ struct pwm_lpss_boardinfo {unsigned int npwm;unsigned long base_unit_bits;bool bypass; +/* Some devices have AML code messing with the state underneath us */ +bool check_power_on_resume; }; struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r,Signature · 1 line
2.19.0.rc0
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 2/2] pwm: lpss: Check PWM powerstate after resume on Cherry Trail devices
Hi,
Quoted 58 lines · Andy Shevchenko
Quoted 11 lines · Hans de Goede
The
_PS0method for the integrated graphics on some Cherry Trail devices (observed on a HP Pavilion X2 10-p0XX) turns on the PWM chip (puts it in D0), causing an inconsistency between the state the pm-core thinks it is in (left runtime suspended as it was before the suspend/resume) and the state it actually is in.Interestingly enough this is done on a device where the pwm controller is not used for the backlight at all, since it uses an eDP panel. On devices where the PWM is used this is not a problem since we will resume it ourselves anyways.
Quoted 9 lines
This inconsistency causes us to never suspend the pwm controller again, which causes the device to not be able to reach S0ix states when suspended.
This commit adds a resume-complete handler, which when we think the device is still run-time suspended checks the actual power-state and if necessary updates the rpm-core's internal state.
This fixes the Pavilion X2 10-p0XX not reaching S0ix states when suspended.
I also Cc Rafael.
Quoted 33 lines
Signed-off-by Hans de Goede <[email protected]>--- drivers/pwm/pwm-lpss-platform.c | 26 +++++++++++++++++++++++--- drivers/pwm/pwm-lpss.h | 2 ++ 2 files changed, 25 insertions(+), 3 deletions(-)drivers/pwm/pwm-lpss-platform.c +9
-3@@ -30,6 +30,7 @@ static const struct pwm_lpss_boardinfo pwm_lpss_bsw_info = { .clk_rate = 19200000, .npwm = 1, .base_unit_bits = 16, + .check_power_on_resume = true, };/* Broxton */ @@ -74,9 +75,28 @@ static int pwm_lpss_remove_platform(struct platform_device *pdev)return pwm_lpss_remove (lpwm); } -static SIMPLE_DEV_PM_OPS(pwm_lpss_platform_pm_ops, - pwm_lpss_suspend, - pwm_lpss_resume); +static void pwm_lpss_complete (struct device *dev) +{ +struct pwm_lpss_chip *lpwm =dev_get_drvdata (dev); +unsigned long long psc; +acpi_status status; + +/* The PWM may be turned on by AML code, update our state to match */ +if (pm_runtime_suspended (dev) && lpwm->info->check_power_on_resume) {
Quoted 5 lines
drivers/pwm/pwm-lpss-platform.c static int pwm_lpss_remove_platform(struct platform_device *pdev) · line 87
Quoted 2 lines
drivers/pwm/pwm-lpss-platform.c +2
-0+ status =acpi_evaluate_integer (ACPI_HANDLE (dev),"_PSC" , +NULL , &psc);AFAIU this is a standard power source method for ACPI, shouldn't ACPI core take care of being in sync?
This is not about ACPI power-resources, this is about the power state (D0 or D3) of the device itself. The ACPI core does not expect the state of devices to magically change underneath it when using s2idle, since then everything is under the kernel's control. But the _PS0 method of the GPU messing with the PWM controller (hurray for firmware) messes things up.
Regards,
Hans
Quoted 33 lines
Quoted 32 lines
drivers/pwm/pwm-lpss-platform.c +12
-0+if (ACPI_SUCCESS (status) && psc ==ACPI_STATE_D0 ) { +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev); + } + } +} + +static const struct dev_pm_ops pwm_lpss_platform_pm_ops = { + .complete = pwm_lpss_complete, +SET_SYSTEM_SLEEP_PM_OPS (pwm_lpss_suspend, pwm_lpss_resume) +};static const struct acpi_device_id pwm_lpss_acpi_match[] = { {"80860F09" , (unsigned long )&pwm_lpss_byt_info },drivers/pwm/pwm-lpss.h +2
-0@@ -30,6 +30,8 @@ struct pwm_lpss_boardinfo {unsigned int npwm;unsigned long base_unit_bits;bool bypass; +/* Some devices have AML code messing with the state underneath us */ +bool check_power_on_resume; }; struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r,Signature · 1 line
2.19.0.rc0
Andy Shevchenko
reviewerRe: [PATCH 2/2] pwm: lpss: Check PWM powerstate after resume on Cherry Trail devices
Quoted 9 lines · Hans de Goede
Quoted 8 lines
drivers/pwm/pwm-lpss-platform.c static int pwm_lpss_remove_platform(struct platform_device *pdev)
Quoted 5 lines
drivers/pwm/pwm-lpss-platform.c +4
-0+/* The PWM may be turned on by AML code, update our state to match */ +if (pm_runtime_suspended (dev) && lpwm->info->check_power_on_resume) { + status =acpi_evaluate_integer (ACPI_HANDLE (dev),"_PSC" , +NULL , &psc);AFAIU this is a standard power source method for ACPI, shouldn't ACPI core take care of being in sync?
Quoted 5 lines
This is not about ACPI power-resources, this is about the power state (D0 or D3) of the device itself. The ACPI core does not expect the state of devices to magically change underneath it when using s2idle, since then everything is under the kernel's control. But the
_PS0method of the GPU messing with the PWM controller (hurray for firmware) messes things up.
What I mean is shouldn't we care about this on a ACPI core level to be sure that states are kept in sync on OS level?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 2/2] pwm: lpss: Check PWM powerstate after resume on Cherry Trail devices
Hi,
Quoted 11 lines · Andy Shevchenko
Quoted 9 lines · Hans de Goede
Quoted 8 lines
drivers/pwm/pwm-lpss-platform.c static int pwm_lpss_remove_platform(struct platform_device *pdev)
Quoted 5 lines
drivers/pwm/pwm-lpss-platform.c +4
-0+/* The PWM may be turned on by AML code, update our state to match */ +if (pm_runtime_suspended (dev) && lpwm->info->check_power_on_resume) { + status =acpi_evaluate_integer (ACPI_HANDLE (dev),"_PSC" , +NULL , &psc);AFAIU this is a standard power source method for ACPI, shouldn't ACPI core take care of being in sync?
Quoted 8 lines
Quoted 5 lines
This is not about ACPI power-resources, this is about the power state (D0 or D3) of the device itself. The ACPI core does not expect the state of devices to magically change underneath it when using s2idle, since then everything is under the kernel's control. But the
_PS0method of the GPU messing with the PWM controller (hurray for firmware) messes things up.What I mean is shouldn't we care about this on a ACPI core level to be sure that states are kept in sync on OS level?
The ACPI / pm core does care about this when doing a firmware supported suspend/resume (so going to regular S3) because the firmware can then make all sort of changes to the device state.
But with s2idle the kernel is fully in control and we never hand control over to the firmware, so checking the device state then should not be necessary and is a somewhat expensive operation (esp. to do on all devices), while one of the advantages of s2idle is supposed to be shorter suspend/resume times.
IOW for s2idle it is undesirable for the core to check the power-state of all devices after a resume, since it simply should not have changed, with the PWM device being a nasty exception because of the _PS0 method for *another* device mucking with it.
Anyways lets see what Rafael has to say about this.
Regards,
Hans
Re: [PATCH 2/2] pwm: lpss: Check PWM powerstate after resume on Cherry Trail devices
Quoted 32 lines · CEST Hans de Goede
Hi,
Quoted 11 lines · Andy Shevchenko
Quoted 9 lines · Hans de Goede
Quoted 8 lines
drivers/pwm/pwm-lpss-platform.c static int pwm_lpss_remove_platform(struct platform_device *pdev)
Quoted 5 lines
drivers/pwm/pwm-lpss-platform.c +4
-0+/* The PWM may be turned on by AML code, update our state to match */ +if (pm_runtime_suspended (dev) && lpwm->info->check_power_on_resume) { + status =acpi_evaluate_integer (ACPI_HANDLE (dev),"_PSC" , +NULL , &psc);AFAIU this is a standard power source method for ACPI, shouldn't ACPI core take care of being in sync?
Quoted 8 lines
Quoted 5 lines
This is not about ACPI power-resources, this is about the power state (D0 or D3) of the device itself. The ACPI core does not expect the state of devices to magically change underneath it when using s2idle, since then everything is under the kernel's control. But the
_PS0method of the GPU messing with the PWM controller (hurray for firmware) messes things up.What I mean is shouldn't we care about this on a ACPI core level to be sure that states are kept in sync on OS level?
The ACPI / pm core does care about this when doing a firmware supported suspend/resume (so going to regular S3) because the firmware can then make all sort of changes to the device state.
But with s2idle the kernel is fully in control and we never hand control over to the firmware, so checking the device state then should not be necessary and is a somewhat expensive operation (esp. to do on all devices), while one of the advantages of s2idle is supposed to be shorter suspend/resume times.
Quoted 6 lines
IOW for s2idle it is undesirable for the core to check the power-state of all devices after a resume, since it simply should not have changed, with the PWM device being a nasty exception because of the
_PS0method for *another* device mucking with it.Anyways lets see what Rafael has to say about this.
It is OK to check the device power state in the driver in that case IMO, although I would add a comment explaining why it is needed to the code.
Also, why don't you use acpi_device_get_power() instead of evaluating _PSC directly? It should make no difference if there are no power resources, should it?
In addition, I would disable runtime PM before checking the power state, then check it, set the correct runtime PM status and re-enable runtime PM.
Thanks,
Rafael
Re: [PATCH 2/2] pwm: lpss: Check PWM powerstate after resume on Cherry Trail devices
Hi,
Quoted 38 lines · Rafael J. Wysocki
Quoted 37 lines · CEST Hans de Goede
Hi,
Quoted 11 lines · Andy Shevchenko
Quoted 9 lines · Hans de Goede
Quoted 8 lines
drivers/pwm/pwm-lpss-platform.c static int pwm_lpss_remove_platform(struct platform_device *pdev)
Quoted 5 lines
drivers/pwm/pwm-lpss-platform.c +4
-0+/* The PWM may be turned on by AML code, update our state to match */ +if (pm_runtime_suspended (dev) && lpwm->info->check_power_on_resume) { + status =acpi_evaluate_integer (ACPI_HANDLE (dev),"_PSC" , +NULL , &psc);AFAIU this is a standard power source method for ACPI, shouldn't ACPI core take care of being in sync?
Quoted 8 lines
Quoted 5 lines
This is not about ACPI power-resources, this is about the power state (D0 or D3) of the device itself. The ACPI core does not expect the state of devices to magically change underneath it when using s2idle, since then everything is under the kernel's control. But the
_PS0method of the GPU messing with the PWM controller (hurray for firmware) messes things up.What I mean is shouldn't we care about this on a ACPI core level to be sure that states are kept in sync on OS level?
The ACPI / pm core does care about this when doing a firmware supported suspend/resume (so going to regular S3) because the firmware can then make all sort of changes to the device state.
But with s2idle the kernel is fully in control and we never hand control over to the firmware, so checking the device state then should not be necessary and is a somewhat expensive operation (esp. to do on all devices), while one of the advantages of s2idle is supposed to be shorter suspend/resume times.
IOW for s2idle it is undesirable for the core to check the power-state of all devices after a resume, since it simply should not have changed, with the PWM device being a nasty exception because of the
_PS0method for *another* device mucking with it.
Quoted 4 lines
Quoted 1 line
Anyways lets see what Rafael has to say about this.
It is OK to check the device power state in the driver in that case IMO, although I would add a comment explaining why it is needed to the code.
There already are comments:
drivers/pwm/pwm-lpss.h
/* Some devices have AML code messing with the state underneath us */
bool check_power_on_resume;drivers/pwm/pwm-lpss-platform.c: pwm_lpss_complete():
/* The PWM may be turned on by AML code, update our state to match */
if (pm_runtime_suspended(dev) && lpwm->info->check_power_on_resume) {
status = acpi_evaluate_integer(ACPI_HANDLE(dev), "_PSC",
NULL, &psc);
if (ACPI_SUCCESS(status) && psc == ACPI_STATE_D0) {
pm_runtime_disable(dev);
pm_runtime_set_active(dev);
pm_runtime_enable(dev);
}
}Or do you want the comment to go into more detail ?
Quoted 3 lines
Also, why don't you use
acpi_device_get_power()instead of evaluating_PSCdirectly? It should make no difference if there are no power resources, should it?
2 reasons:
1) I really want to check the D3 enabled bit from the devices configs regs, as that is what block S0ix, this is exactly what the _PSC method does
2) acpi_device_get_power() is not exported to modules
Quoted 2 lines
In addition, I would disable runtime PM before checking the power state, then check it, set the correct runtime PM status and re-enable runtime PM.
Ok I will send a v2 with this changed.
Regards,
Hans
Andy Shevchenko
reviewerRe: [PATCH 2/2] pwm: lpss: Check PWM powerstate after resume on Cherry Trail devices
Quoted 8 lines · Hans de Goede
Quoted 5 lines · Rafael J. Wysocki
On Monday, September 24, 2018 11:40:14 AM CEST Hans de Goede wrote:
Also, why don't you use
acpi_device_get_power()instead of evaluating_PSCdirectly? It should make no difference if there are no power resources, should it?2)
acpi_device_get_power()is not exported to modules
Do we have any side effects if we just export it? I would think exporting is better than open coding.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 2/2] pwm: lpss: Check PWM powerstate after resume on Cherry Trail devices
Hi,
Quoted 4 lines · Andy Shevchenko
Quoted 2 lines · Hans de Goede
Quoted 1 line · Rafael J. Wysocki
On Monday, September 24, 2018 11:40:14 AM CEST Hans de Goede wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Also, why don't you use
acpi_device_get_power()instead of evaluating_PSCdirectly? It should make no difference if there are no power resources, should it?2)
acpi_device_get_power()is not exported to modulesDo we have any side effects if we just export it? I would think exporting is better than open coding.
acpi_device_get_power() does a lot more then just call the _PSC method, while as explained we really just want the _PSC method as that checks the actual D3 bit which we are interested in.
But as Rafael mentioned if the DSDT does not define power-resources (which in the 3 DSDTs I just checked it doesn't for the PWM node) then acpi_device_get_power() is equivalent.
So I guess I could change this, but I would prefer to stick with the direct _PSC call.
Regards,
Hans
Andy Shevchenko
reviewerRe: [PATCH 2/2] pwm: lpss: Check PWM powerstate after resume on Cherry Trail devices
Quoted 20 lines · Hans de Goede
Hi,
Quoted 4 lines · Andy Shevchenko
Quoted 2 lines · Hans de Goede
Quoted 1 line · Rafael J. Wysocki
On Monday, September 24, 2018 11:40:14 AM CEST Hans de Goede wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Also, why don't you use
acpi_device_get_power()instead of evaluating_PSCdirectly? It should make no difference if there are no power resources, should it?2)
acpi_device_get_power()is not exported to modulesDo we have any side effects if we just export it? I would think exporting is better than open coding.
acpi_device_get_power()does a lot more then just call the_PSCmethod, while as explained we really just want the_PSCmethod as that checks the actual D3 bit which we are interested in.
Quoted 6 lines
But as Rafael mentioned if the DSDT does not define power-resources (which in the 3 DSDTs I just checked it doesn't for the PWM node) then
acpi_device_get_power()is equivalent.So I guess I could change this, but I would prefer to stick with the direct
_PSCcall.
Up to Rafael, my personal point of view that acpi_device_get_power() is a good replacement here.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 2/2] pwm: lpss: Check PWM powerstate after resume on Cherry Trail devices
In reply to Hans de GoedeQuoted 21 lines · Hans de Goede
Hi,
Quoted 4 lines · Andy Shevchenko
Quoted 2 lines · Hans de Goede
Quoted 1 line · Rafael J. Wysocki
On Monday, September 24, 2018 11:40:14 AM CEST Hans de Goede wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Also, why don't you use
acpi_device_get_power()instead of evaluating_PSCdirectly? It should make no difference if there are no power resources, should it?2)
acpi_device_get_power()is not exported to modulesDo we have any side effects if we just export it? I would think exporting is better than open coding.
acpi_device_get_power()does a lot more then just call the_PSCmethod, while as explained we really just want the_PSCmethod as that checks the actual D3 bit which we are interested in.
Quoted 6 lines
But as Rafael mentioned if the DSDT does not define power-resources (which in the 3 DSDTs I just checked it doesn't for the PWM node) then
acpi_device_get_power()is equivalent.So I guess I could change this, but I would prefer to stick with the direct
_PSCcall.
And I would prefer acpi_device_get_power() to be used as long as it works in this case.
I really don't want every driver to evaluate ACPI methods directly at will.
Thanks,
Rafael
Re: [PATCH 2/2] pwm: lpss: Check PWM powerstate after resume on Cherry Trail devices
Hi,
Quoted 26 lines · Rafael J. Wysocki
Quoted 25 lines · Hans de Goede
Hi,
Quoted 4 lines · Andy Shevchenko
Quoted 2 lines · Hans de Goede
Quoted 1 line · Rafael J. Wysocki
On Monday, September 24, 2018 11:40:14 AM CEST Hans de Goede wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Also, why don't you use
acpi_device_get_power()instead of evaluating_PSCdirectly? It should make no difference if there are no power resources, should it?2)
acpi_device_get_power()is not exported to modulesDo we have any side effects if we just export it? I would think exporting is better than open coding.
acpi_device_get_power()does a lot more then just call the_PSCmethod, while as explained we really just want the_PSCmethod as that checks the actual D3 bit which we are interested in.But as Rafael mentioned if the DSDT does not define power-resources (which in the 3 DSDTs I just checked it doesn't for the PWM node) then
acpi_device_get_power()is equivalent.
Quoted 7 lines
Quoted 2 lines
So I guess I could change this, but I would prefer to stick with the direct
_PSCcall.And I would prefer
acpi_device_get_power()to be used as long as it works in this case.I really don't want every driver to evaluate ACPI methods directly at will.
Ok, I will prepare a v4 of this series using acpi_device_get_power()
Regards,
Hans