diff options
Diffstat (limited to 'drivers/platform/x86/ideapad-laptop.c')
-rw-r--r-- | drivers/platform/x86/ideapad-laptop.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index e7a1299e3776..3ccb7b71dfb1 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) @@ -1534,17 +1555,13 @@ static void ideapad_check_features(struct ideapad_private *priv) static int ideapad_acpi_add(struct platform_device *pdev) { + struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); struct ideapad_private *priv; - struct acpi_device *adev; acpi_status status; unsigned long cfg; int err, i; - err = acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev); - if (err) - return -ENODEV; - - if (eval_int(adev->handle, "_CFG", &cfg)) + if (!adev || eval_int(adev->handle, "_CFG", &cfg)) return -ENODEV; priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |