There are small differences between different models. The DMI product name appears to be consistent enough for extracting the model year information. Signed-off-by: Matan Ziv-Av <matan@xxxxxxxxxxx> --- drivers/platform/x86/lg-laptop.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c index 467143394ca9..b8839fcfa4a8 100644 --- a/drivers/platform/x86/lg-laptop.c +++ b/drivers/platform/x86/lg-laptop.c @@ -8,6 +8,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/acpi.h> +#include <linux/dmi.h> #include <linux/input.h> #include <linux/input/sparse-keymap.h> #include <linux/kernel.h> @@ -606,6 +607,8 @@ static struct platform_driver pf_driver = { static int acpi_add(struct acpi_device *device) { int ret; + const char *product; + int year = 2017; if (pf_device) return 0; @@ -624,6 +627,27 @@ static int acpi_add(struct acpi_device *device) goto out_platform_registered; } + product = dmi_get_system_info(DMI_PRODUCT_NAME); + if (strlen(product) > 4) + switch (product[4]) { + case '5': + case '6': + year = 2016; + break; + case '7': + year = 2017; + break; + case '8': + year = 2018; + break; + case '9': + year = 2019; + break; + default: + year = 2019; + } + pr_info("product: %s year: %d debug v4\n", product, year); + ret = sysfs_create_group(&pf_device->dev.kobj, &dev_attribute_group); if (ret) goto out_platform_device; -- 2.21.0