Patch "platform/x86/amd/pmf: Fix to Update HPD Data When ALS is Disabled" has been added to the 6.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    platform/x86/amd/pmf: Fix to Update HPD Data When ALS is Disabled

to the 6.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     platform-x86-amd-pmf-fix-to-update-hpd-data-when-als.patch
and it can be found in the queue-6.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 51a857f342d92fef3fdf3f43e0c302985c82c24d
Author: Shyam Sundar S K <Shyam-sundar.S-k@xxxxxxx>
Date:   Tue Jul 30 19:53:16 2024 +0530

    platform/x86/amd/pmf: Fix to Update HPD Data When ALS is Disabled
    
    [ Upstream commit 78296429e20052b029211b0aca64aadc5052d581 ]
    
    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.
    
    Since user_present is a boolean, modify the current code to return true if
    the user is present and false if the user is away or if the sensor is not
    detected, and report this status to the PMF TA firmware accordingly.
    
    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@xxxxxxx>
    Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@xxxxxxx>
    Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@xxxxxxx>
    Link: https://lore.kernel.org/r/20240730142316.3846259-1-Shyam-sundar.S-k@xxxxxxx
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/platform/x86/amd/pmf/spc.c b/drivers/platform/x86/amd/pmf/spc.c
index a3dec14c30043..3c153fb1425e9 100644
--- a/drivers/platform/x86/amd/pmf/spc.c
+++ b/drivers/platform/x86/amd/pmf/spc.c
@@ -150,36 +150,26 @@ 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;
+
+	/* Get the latest information from SFH */
+	in->ev_info.user_present = false;
 
 	/* Get ALS data */
-	ret = amd_get_sfh_info(&sfh_info, MT_ALS);
-	if (!ret)
+	if (!amd_get_sfh_info(&sfh_info, MT_ALS))
 		in->ev_info.ambient_light = sfh_info.ambient_light;
 	else
-		return ret;
+		dev_dbg(dev->dev, "ALS is not enabled/detected\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 (!amd_get_sfh_info(&sfh_info, MT_HPD)) {
+		if (sfh_info.user_present == SFH_USER_PRESENT)
+			in->ev_info.user_present = true;
+	} else {
+		dev_dbg(dev->dev, "HPD is not enabled/detected\n");
 	}
-
-	return 0;
 }
 
 void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in)




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux