summaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorKelly Anderson <kelly@xilka.com>2021-09-25 22:39:00 -0600
committerHans de Goede <hdegoede@redhat.com>2021-09-28 16:59:36 +0200
commit599482c58ebd007f24f8eba99fbda5d957e773e5 (patch)
tree690f36dfdd6c9cd9a75d00cc3692883549ad2666 /drivers/platform
parent6a684635478c03db92727c9fa217c660f6c3abc3 (diff)
downloadlinux-stable-599482c58ebd007f24f8eba99fbda5d957e773e5.tar.gz
linux-stable-599482c58ebd007f24f8eba99fbda5d957e773e5.tar.bz2
linux-stable-599482c58ebd007f24f8eba99fbda5d957e773e5.zip
platform/x86: ideapad-laptop: Add platform support for Ideapad 5 Pro 16ACH6-82L5
Adding support specifically for Ideapad 5 Pro 16ACH6-82L5 by adding a allow list that can validate notebooks for which dytc_version is less than 5, and seem to work fine at dytc_version 4. This code has been tested to work properly on the specified system. Signed-off-by: Kelly Anderson <kelly@xilka.com> Link: https://lore.kernel.org/r/11840239.O9o76ZdvQC@comer.internal Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/ideapad-laptop.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index e7a1299e3776..2771a05ea5e2 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -868,6 +868,18 @@ static void dytc_profile_refresh(struct ideapad_private *priv)
}
}
+static const struct dmi_system_id ideapad_dytc_v4_allow_table[] = {
+ {
+ /* Ideapad 5 Pro 16ACH6 */
+ .ident = "LENOVO 82L5",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "82L5")
+ }
+ },
+ {}
+};
+
static int ideapad_dytc_profile_init(struct ideapad_private *priv)
{
int err, dytc_version;
@@ -882,12 +894,21 @@ static int ideapad_dytc_profile_init(struct ideapad_private *priv)
return err;
/* Check DYTC is enabled and supports mode setting */
- if (!test_bit(DYTC_QUERY_ENABLE_BIT, &output))
+ if (!test_bit(DYTC_QUERY_ENABLE_BIT, &output)) {
+ dev_info(&priv->platform_device->dev, "DYTC_QUERY_ENABLE_BIT returned false\n");
return -ENODEV;
+ }
dytc_version = (output >> DYTC_QUERY_REV_BIT) & 0xF;
- if (dytc_version < 5)
- return -ENODEV;
+
+ if (dytc_version < 5) {
+ if (dytc_version < 4 || !dmi_check_system(ideapad_dytc_v4_allow_table)) {
+ dev_info(&priv->platform_device->dev,
+ "DYTC_VERSION is less than 4 or is not allowed: %d\n",
+ dytc_version);
+ return -ENODEV;
+ }
+ }
priv->dytc = kzalloc(sizeof(*priv->dytc), GFP_KERNEL);
if (!priv->dytc)