Skip to content

Commit 9f39757

Browse files
committed
Merge tag 'chrome-platform-for-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux
Pull chrome platform updates from Tzung-Bi Shih: - Adjust DMI match table for Framework Laptop for improving maintainabilities for both legacy and new models - Add .remove driver callback for cros_ec_typec in order to allow the driver to be rebound - Use kmemdup_array() for taking care possible overflows * tag 'chrome-platform-for-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: platform/chrome: chromeos_laptop: Use kmemdup_array platform/chrome: cros_ec_typec: add remove driver hook platform/chrome: cros_ec_lpc: switch primary DMI data for Framework Laptop
2 parents f4960b0 + d1b35e6 commit 9f39757

File tree

3 files changed

+40
-13
lines changed

3 files changed

+40
-13
lines changed

drivers/platform/chrome/chromeos_laptop.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -749,10 +749,9 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop,
749749
if (!src->num_i2c_peripherals)
750750
return 0;
751751

752-
i2c_peripherals = kmemdup(src->i2c_peripherals,
753-
src->num_i2c_peripherals *
754-
sizeof(*src->i2c_peripherals),
755-
GFP_KERNEL);
752+
i2c_peripherals = kmemdup_array(src->i2c_peripherals,
753+
src->num_i2c_peripherals,
754+
sizeof(*i2c_peripherals), GFP_KERNEL);
756755
if (!i2c_peripherals)
757756
return -ENOMEM;
758757

drivers/platform/chrome/cros_ec_lpc.c

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -631,12 +631,12 @@ static const struct acpi_device_id cros_ec_lpc_acpi_device_ids[] = {
631631
};
632632
MODULE_DEVICE_TABLE(acpi, cros_ec_lpc_acpi_device_ids);
633633

634-
static const struct lpc_driver_data framework_laptop_amd_lpc_driver_data __initconst = {
634+
static const struct lpc_driver_data framework_laptop_npcx_lpc_driver_data __initconst = {
635635
.quirks = CROS_EC_LPC_QUIRK_REMAP_MEMORY,
636636
.quirk_mmio_memory_base = 0xE00,
637637
};
638638

639-
static const struct lpc_driver_data framework_laptop_11_lpc_driver_data __initconst = {
639+
static const struct lpc_driver_data framework_laptop_mec_lpc_driver_data __initconst = {
640640
.quirks = CROS_EC_LPC_QUIRK_ACPI_ID|CROS_EC_LPC_QUIRK_AML_MUTEX,
641641
.quirk_acpi_id = "PNP0C09",
642642
.quirk_aml_mutex_name = "ECMT",
@@ -696,21 +696,39 @@ static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = {
696696
},
697697
/* A small number of non-Chromebook/box machines also use the ChromeOS EC */
698698
{
699-
/* the Framework Laptop 13 (AMD Ryzen) and 16 (AMD Ryzen) */
699+
/* Framework Laptop (11th Gen Intel Core) */
700700
.matches = {
701701
DMI_MATCH(DMI_SYS_VENDOR, "Framework"),
702-
DMI_MATCH(DMI_PRODUCT_NAME, "AMD Ryzen"),
703-
DMI_MATCH(DMI_PRODUCT_FAMILY, "Laptop"),
702+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Laptop"),
703+
},
704+
.driver_data = (void *)&framework_laptop_mec_lpc_driver_data,
705+
},
706+
{
707+
/* Framework Laptop (12th Gen Intel Core) */
708+
.matches = {
709+
DMI_MATCH(DMI_SYS_VENDOR, "Framework"),
710+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "12th Gen Intel Core"),
711+
},
712+
.driver_data = (void *)&framework_laptop_mec_lpc_driver_data,
713+
},
714+
{
715+
/* Framework Laptop (13th Gen Intel Core) */
716+
.matches = {
717+
DMI_MATCH(DMI_SYS_VENDOR, "Framework"),
718+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "13th Gen Intel Core"),
704719
},
705-
.driver_data = (void *)&framework_laptop_amd_lpc_driver_data,
720+
.driver_data = (void *)&framework_laptop_mec_lpc_driver_data,
706721
},
707722
{
708-
/* the Framework Laptop (Intel 11th, 12th, 13th Generation) */
723+
/*
724+
* All remaining Framework Laptop models (13 AMD Ryzen, 16 AMD
725+
* Ryzen, Intel Core Ultra)
726+
*/
709727
.matches = {
710728
DMI_MATCH(DMI_SYS_VENDOR, "Framework"),
711-
DMI_MATCH(DMI_PRODUCT_NAME, "Laptop"),
729+
DMI_MATCH(DMI_PRODUCT_FAMILY, "Laptop"),
712730
},
713-
.driver_data = (void *)&framework_laptop_11_lpc_driver_data,
731+
.driver_data = (void *)&framework_laptop_npcx_lpc_driver_data,
714732
},
715733
{ /* sentinel */ }
716734
};

drivers/platform/chrome/cros_ec_typec.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,6 +1285,15 @@ static int cros_typec_probe(struct platform_device *pdev)
12851285
return ret;
12861286
}
12871287

1288+
static void cros_typec_remove(struct platform_device *pdev)
1289+
{
1290+
struct cros_typec_data *typec = platform_get_drvdata(pdev);
1291+
1292+
cros_usbpd_unregister_notify(&typec->nb);
1293+
cancel_work_sync(&typec->port_work);
1294+
cros_unregister_ports(typec);
1295+
}
1296+
12881297
static int __maybe_unused cros_typec_suspend(struct device *dev)
12891298
{
12901299
struct cros_typec_data *typec = dev_get_drvdata(dev);
@@ -1316,6 +1325,7 @@ static struct platform_driver cros_typec_driver = {
13161325
.pm = &cros_typec_pm_ops,
13171326
},
13181327
.probe = cros_typec_probe,
1328+
.remove_new = cros_typec_remove,
13191329
};
13201330

13211331
module_platform_driver(cros_typec_driver);

0 commit comments

Comments
 (0)