Linux ACPI
 help / color / mirror / Atom feed
From: Julian Sikorski <belegdol@gmail.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org
Cc: teohhanhui@gmail.com, Shyam-sundar.S-k@amd.com,
	Pratik Vishwakarma <Pratik.Vishwakarma@amd.com>
Subject: Re: [PATCH 4/5] ACPI: PM: s2idle: Add support for new Microsoft UUID
Date: Thu, 17 Jun 2021 20:28:39 +0200	[thread overview]
Message-ID: <be247cfb-c3d5-b91a-6db5-d69b7255f4c1@gmail.com> (raw)
In-Reply-To: <20210617164212.584-4-mario.limonciello@amd.com>

W dniu 17.06.2021 o 18:42, Mario Limonciello pisze:
> From: Pratik Vishwakarma <Pratik.Vishwakarma@amd.com>
> 
> This adds supports for _DSM notifications to the Microsoft UUID
> described by Microsoft documentation for s2idle.
> 
> Link: https://docs.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby-firmware-notifications
> Co-developed-by: Mario Limonciello <mario.limonciello@amd.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> Signed-off-by: Pratik Vishwakarma <Pratik.Vishwakarma@amd.com>
> ---
>   drivers/acpi/x86/s2idle.c | 34 ++++++++++++++++++++++++++++++----
>   1 file changed, 30 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
> index 0d19669ac7ad..3f2a90648ec9 100644
> --- a/drivers/acpi/x86/s2idle.c
> +++ b/drivers/acpi/x86/s2idle.c
> @@ -32,6 +32,9 @@ static const struct acpi_device_id lps0_device_ids[] = {
>   	{"", },
>   };
>   
> +/* Microsoft platform agnostic UUID */
> +#define ACPI_LPS0_DSM_UUID_MICROSOFT      "11e00d56-ce64-47ce-837b-1f898f9aa461"
> +
>   #define ACPI_LPS0_DSM_UUID	"c4eb40a0-6cd2-11e2-bcfd-0800200c9a66"
>   
>   #define ACPI_LPS0_GET_DEVICE_CONSTRAINTS	1
> @@ -39,6 +42,8 @@ static const struct acpi_device_id lps0_device_ids[] = {
>   #define ACPI_LPS0_SCREEN_ON	4
>   #define ACPI_LPS0_ENTRY		5
>   #define ACPI_LPS0_EXIT		6
> +#define ACPI_LPS0_MS_ENTRY      7
> +#define ACPI_LPS0_MS_EXIT       8
>   
>   /* AMD */
>   #define ACPI_LPS0_DSM_UUID_AMD      "e3f32452-febc-43ce-9039-932122d37721"
> @@ -51,6 +56,9 @@ static acpi_handle lps0_device_handle;
>   static guid_t lps0_dsm_guid;
>   static int lps0_dsm_func_mask;
>   
> +static guid_t lps0_dsm_guid_microsoft;
> +static int lps0_dsm_func_mask_microsoft;
> +
>   /* Device constraint entry structure */
>   struct lpi_device_info {
>   	char *name;
> @@ -366,14 +374,18 @@ static int lps0_device_attach(struct acpi_device *adev,
>   		rev_id = 0;
>   		lps0_dsm_func_mask = validate_dsm(adev->handle,
>   					ACPI_LPS0_DSM_UUID_AMD, rev_id, &lps0_dsm_guid);
> +		lps0_dsm_func_mask_microsoft = validate_dsm(adev->handle,
> +					ACPI_LPS0_DSM_UUID_MICROSOFT, rev_id,
> +					&lps0_dsm_guid_microsoft);
>   	} else {
>   		rev_id = 1;
>   		lps0_dsm_func_mask = validate_dsm(adev->handle,
>   					ACPI_LPS0_DSM_UUID, rev_id, &lps0_dsm_guid);
> +		lps0_dsm_func_mask_microsoft = -EINVAL;
>   	}
>   
> -	if (lps0_dsm_func_mask < 0)
> -		return 0;//function eval failed
> +	if (lps0_dsm_func_mask < 0 && lps0_dsm_func_mask_microsoft < 0)
> +		return 0; //function evaluation failed
>   
>   	lps0_device_handle = adev->handle;
>   
> @@ -412,7 +424,14 @@ int acpi_s2idle_prepare_late(void)
>   	if (pm_debug_messages_on)
>   		lpi_check_constraints();
>   
> -	if (acpi_s2idle_vendor_amd()) {
> +	if (lps0_dsm_func_mask_microsoft > 0) {
> +		acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF,
> +				lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
> +		acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT,
> +				lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
> +		acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY,
> +				lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
> +	} else if (acpi_s2idle_vendor_amd()) {
>   		acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF_AMD,
>   				lps0_dsm_func_mask, lps0_dsm_guid);
>   		acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY_AMD,
> @@ -432,7 +451,14 @@ void acpi_s2idle_restore_early(void)
>   	if (!lps0_device_handle || sleep_no_lps0)
>   		return;
>   
> -	if (acpi_s2idle_vendor_amd()) {
> +	if (lps0_dsm_func_mask_microsoft > 0) {
> +		acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT,
> +				lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
> +		acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_ENTRY,
> +				lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
> +		acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON,
> +				lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
> +	} else if (acpi_s2idle_vendor_amd()) {
>   		acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT_AMD,
>   				lps0_dsm_func_mask, lps0_dsm_guid);
>   		acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON_AMD,
> 
Tested-by: Julian Sikorski <belegdol@gmail.com>

  reply	other threads:[~2021-06-17 18:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 16:42 [PATCH 1/5] ACPI: PM: s2idle: Use correct revision id Mario Limonciello
2021-06-17 16:42 ` [PATCH 2/5] ACPI: PM: s2idle: Refactor common code Mario Limonciello
2021-06-17 18:28   ` Julian Sikorski
2021-06-17 16:42 ` [PATCH 3/5] ACPI: PM: s2idle: Add support for multiple func mask Mario Limonciello
2021-06-17 18:28   ` Julian Sikorski
2021-06-18 16:30   ` Rafael J. Wysocki
2021-06-18 16:34     ` Limonciello, Mario
2021-06-18 16:41       ` Rafael J. Wysocki
2021-06-17 16:42 ` [PATCH 4/5] ACPI: PM: s2idle: Add support for new Microsoft UUID Mario Limonciello
2021-06-17 18:28   ` Julian Sikorski [this message]
2021-06-17 16:42 ` [PATCH 5/5] ACPI: PM: Adjust behavior for field problems on AMD systems Mario Limonciello
2021-06-17 18:28   ` Julian Sikorski
2021-06-18  8:05   ` Kai-Heng Feng
2021-06-17 18:28 ` [PATCH 1/5] ACPI: PM: s2idle: Use correct revision id Julian Sikorski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be247cfb-c3d5-b91a-6db5-d69b7255f4c1@gmail.com \
    --to=belegdol@gmail.com \
    --cc=Pratik.Vishwakarma@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=rjw@rjwysocki.net \
    --cc=teohhanhui@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox