From: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
platform-driver-x86@vger.kernel.org, Patil.Reddy@amd.com
Subject: Re: [PATCH 2/2] platform/x86/amd/pmf: Fix to Update HPD Data When ALS is Disabled
Date: Tue, 30 Jul 2024 19:57:49 +0530 [thread overview]
Message-ID: <5c246bad-dd27-48fd-bfdd-422e633b4288@amd.com> (raw)
In-Reply-To: <cdbf07d3-1d9c-f1bc-d548-c3509d5586dd@linux.intel.com>
On 7/29/2024 17:25, Ilpo Järvinen wrote:
> On Tue, 23 Jul 2024, Shyam Sundar S K wrote:
>
>> If the Ambient Light Sensor (ALS) is disabled, the current code in the PMF
>> driver does not query for Human Presence Detection (HPD) data in
>> amd_pmf_get_sensor_info(). As a result, stale HPD data is used by PMF-TA
>> to evaluate policy conditions, leading to unexpected behavior in the policy
>> output actions.
>>
>> To resolve this issue, modify the PMF driver to query HPD data
>> independently of ALS.
>>
>> With this change, amd_pmf_get_sensor_info() now returns void instead of
>> int.
>>
>> Fixes: cedecdba60f4 ("platform/x86/amd/pmf: Get ambient light information from AMD SFH driver")
>> Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
>> Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
>> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
>> ---
>> drivers/platform/x86/amd/pmf/spc.c | 33 +++++++++++++++---------------
>> 1 file changed, 16 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/platform/x86/amd/pmf/spc.c b/drivers/platform/x86/amd/pmf/spc.c
>> index a3dec14c3004..d9e60d63553c 100644
>> --- a/drivers/platform/x86/amd/pmf/spc.c
>> +++ b/drivers/platform/x86/amd/pmf/spc.c
>> @@ -150,7 +150,7 @@ static int amd_pmf_get_slider_info(struct amd_pmf_dev *dev, struct ta_pmf_enact_
>> return 0;
>> }
>>
>> -static int amd_pmf_get_sensor_info(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in)
>> +static void amd_pmf_get_sensor_info(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in)
>> {
>> struct amd_sfh_info sfh_info;
>> int ret;
>> @@ -160,26 +160,25 @@ static int amd_pmf_get_sensor_info(struct amd_pmf_dev *dev, struct ta_pmf_enact_
>> if (!ret)
>> in->ev_info.ambient_light = sfh_info.ambient_light;
>> else
>> - return ret;
>> + dev_dbg(dev->dev, "ALS is not enabled\n");
>>
>> /* get HPD data */
>> ret = amd_get_sfh_info(&sfh_info, MT_HPD);
>> - if (ret)
>> - return ret;
>> -
>> - switch (sfh_info.user_present) {
>> - case SFH_NOT_DETECTED:
>> - in->ev_info.user_present = 0xff; /* assume no sensors connected */
>> - break;
>> - case SFH_USER_PRESENT:
>> - in->ev_info.user_present = 1;
>> - break;
>> - case SFH_USER_AWAY:
>> - in->ev_info.user_present = 0;
>> - break;
>> + if (!ret) {
>> + switch (sfh_info.user_present) {
>> + case SFH_NOT_DETECTED:
>> + in->ev_info.user_present = 0xff; /* assume no sensors connected */
>> + break;
>> + case SFH_USER_PRESENT:
>> + in->ev_info.user_present = 1;
>> + break;
>> + case SFH_USER_AWAY:
>> + in->ev_info.user_present = 0;
>> + break;
>> + }
>> + } else {
>> + dev_dbg(dev->dev, "HPD is not enabled\n");
>
> Is it okay to leave in->ev_info.user_present as 0 this case? Should it be
> set to same as with SFH_NOT_DETECTED?
>
Valid point. Realized that the PMF TA only accepts a boolean and it
only looks for information on if the user is present or not.
I have adjusted this behavior in v2. Please take a look.
> ...I now realize your print out doesn't cover that case at all and
> user_present is not used for anything else than debug printing.
>
entire populated "ev_info" is passed to the PMF TA to evaluate the
policy conditions. So, its just not limited to debug message.
Thanks,
Shyam
next prev parent reply other threads:[~2024-07-30 14:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-23 13:24 [PATCH 1/2] platform/x86/amd/pmf: Add new ACPI ID AMDI0107 Shyam Sundar S K
2024-07-23 13:24 ` [PATCH 2/2] platform/x86/amd/pmf: Fix to Update HPD Data When ALS is Disabled Shyam Sundar S K
2024-07-29 11:55 ` Ilpo Järvinen
2024-07-30 14:27 ` Shyam Sundar S K [this message]
2024-07-30 12:38 ` [PATCH 1/2] platform/x86/amd/pmf: Add new ACPI ID AMDI0107 Ilpo Järvinen
2024-07-30 12:47 ` Shyam Sundar S K
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=5c246bad-dd27-48fd-bfdd-422e633b4288@amd.com \
--to=shyam-sundar.s-k@amd.com \
--cc=Patil.Reddy@amd.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
/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