Skip to contentSkip to conversation

lg-laptop: Recognize more models

PATCH In review Matan Ziv-Av 3 participants 3 messages Nov 23, 2021 – Nov 25, 2021

Subsystems (2)
lore
Share & tools
lore

Matan Ziv-Av

author maintainer
#0 lore raw

PATCH 1/1 lg-laptop: Recognize more models

LG uses 5 instead of 0 in the third digit (second digit after 2019) of the year string to indicate newer models in the same year. Handle this case as well.

---
 drivers/platform/x86/lg-laptop.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/platform/x86/lg-laptop.c +12 -0
index ae9293024c77..a91847a551a7 100644
@@ -657,6 +657,18 @@ static int acpi_add(struct acpi_device *device)
 	if (product && strlen(product) > 4)
 		switch (product[4]) {
 		case '5':
+			if (strlen(product) > 5)
+				switch (product[5]) {
+				case 'N':
+					year = 2021;
+					break;
+				case '0':
+					year = 2016;
+					break;
+				default:
+					year = 2022;
+				}
+			break;
 		case '6':
 			year = 2016;
 			break;
Signature · 1 line
Matan.
#1 lore raw
Quoted 12 lines · Matan Ziv-Av

LG uses 5 instead of 0 in the third digit (second digit after 2019) of the year string to indicate newer models in the same year. Handle this case as well.

        if (product && strlen(product) > 4)
                switch (product[4]) {
                case '5':
drivers/platform/x86/lg-laptop.c +5 -0
+                       if (strlen(product) > 5)
+                               switch (product[5]) {
+                               case 'N':
+                                       year = 2021;
+                                       break;

drivers/platform/x86/lg-laptop.c static int acpi_add(struct acpi_device *device) · line 674

Quoted 10 lines
drivers/platform/x86/lg-laptop.c +7 -0
+                               case '0':
+                                       year = 2016;
+                                       break;
+                               default:
+                                       year = 2022;
+                               }
+                       break;
                case '6':
                        year = 2016;
                        break;

Actually you may replace all those if (strlen(product) > $X) {} and accompanied indentation level by adding corresponding
case '\0':

    break;

into the switches, but this is out of scope here as it should be a separate change, if any.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
In reply to Matan Ziv-Av

Hi,

Quoted 4 lines · Matan Ziv-Av

LG uses 5 instead of 0 in the third digit (second digit after 2019) of the year string to indicate newer models in the same year. Handle this case as well.

Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.

Regards,

Hans

Quoted 30 lines

---
 drivers/platform/x86/lg-laptop.c | 12 ++++++++++++

 1 file changed, 12 insertions(+)
drivers/platform/x86/lg-laptop.c +0 -0
index ae9293024c77..a91847a551a7 100644
@@ -657,6 +657,18 @@ static int acpi_add(struct acpi_device *device)
      if (product && strlen(product) > 4)
          switch (product[4]) {

         case '5':
+            if (strlen(product) > 5)
+                switch (product[5]) {
+                case 'N':
+                    year = 2021;
+                    break;
+                case '0':
+                    year = 2016;
+                    break;
+                default:
+                    year = 2022;
+                }
+            break;
         case '6':
             year = 2016;
             break;