Skip to content

Commit

Permalink
Merge tag 'chrome-platform-for-6.12' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
torvalds committed Sep 18, 2024
2 parents f4960b0 + d1b35e6 commit 9f39757
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
7 changes: 3 additions & 4 deletions drivers/platform/chrome/chromeos_laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,10 +749,9 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop,
if (!src->num_i2c_peripherals)
return 0;

i2c_peripherals = kmemdup(src->i2c_peripherals,
src->num_i2c_peripherals *
sizeof(*src->i2c_peripherals),
GFP_KERNEL);
i2c_peripherals = kmemdup_array(src->i2c_peripherals,
src->num_i2c_peripherals,
sizeof(*i2c_peripherals), GFP_KERNEL);
if (!i2c_peripherals)
return -ENOMEM;

Expand Down
36 changes: 27 additions & 9 deletions drivers/platform/chrome/cros_ec_lpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,12 +631,12 @@ static const struct acpi_device_id cros_ec_lpc_acpi_device_ids[] = {
};
MODULE_DEVICE_TABLE(acpi, cros_ec_lpc_acpi_device_ids);

static const struct lpc_driver_data framework_laptop_amd_lpc_driver_data __initconst = {
static const struct lpc_driver_data framework_laptop_npcx_lpc_driver_data __initconst = {
.quirks = CROS_EC_LPC_QUIRK_REMAP_MEMORY,
.quirk_mmio_memory_base = 0xE00,
};

static const struct lpc_driver_data framework_laptop_11_lpc_driver_data __initconst = {
static const struct lpc_driver_data framework_laptop_mec_lpc_driver_data __initconst = {
.quirks = CROS_EC_LPC_QUIRK_ACPI_ID|CROS_EC_LPC_QUIRK_AML_MUTEX,
.quirk_acpi_id = "PNP0C09",
.quirk_aml_mutex_name = "ECMT",
Expand Down Expand Up @@ -696,21 +696,39 @@ static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = {
},
/* A small number of non-Chromebook/box machines also use the ChromeOS EC */
{
/* the Framework Laptop 13 (AMD Ryzen) and 16 (AMD Ryzen) */
/* Framework Laptop (11th Gen Intel Core) */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Framework"),
DMI_MATCH(DMI_PRODUCT_NAME, "AMD Ryzen"),
DMI_MATCH(DMI_PRODUCT_FAMILY, "Laptop"),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Laptop"),
},
.driver_data = (void *)&framework_laptop_mec_lpc_driver_data,
},
{
/* Framework Laptop (12th Gen Intel Core) */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Framework"),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "12th Gen Intel Core"),
},
.driver_data = (void *)&framework_laptop_mec_lpc_driver_data,
},
{
/* Framework Laptop (13th Gen Intel Core) */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Framework"),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "13th Gen Intel Core"),
},
.driver_data = (void *)&framework_laptop_amd_lpc_driver_data,
.driver_data = (void *)&framework_laptop_mec_lpc_driver_data,
},
{
/* the Framework Laptop (Intel 11th, 12th, 13th Generation) */
/*
* All remaining Framework Laptop models (13 AMD Ryzen, 16 AMD
* Ryzen, Intel Core Ultra)
*/
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Framework"),
DMI_MATCH(DMI_PRODUCT_NAME, "Laptop"),
DMI_MATCH(DMI_PRODUCT_FAMILY, "Laptop"),
},
.driver_data = (void *)&framework_laptop_11_lpc_driver_data,
.driver_data = (void *)&framework_laptop_npcx_lpc_driver_data,
},
{ /* sentinel */ }
};
Expand Down
10 changes: 10 additions & 0 deletions drivers/platform/chrome/cros_ec_typec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,15 @@ static int cros_typec_probe(struct platform_device *pdev)
return ret;
}

static void cros_typec_remove(struct platform_device *pdev)
{
struct cros_typec_data *typec = platform_get_drvdata(pdev);

cros_usbpd_unregister_notify(&typec->nb);
cancel_work_sync(&typec->port_work);
cros_unregister_ports(typec);
}

static int __maybe_unused cros_typec_suspend(struct device *dev)
{
struct cros_typec_data *typec = dev_get_drvdata(dev);
Expand Down Expand Up @@ -1316,6 +1325,7 @@ static struct platform_driver cros_typec_driver = {
.pm = &cros_typec_pm_ops,
},
.probe = cros_typec_probe,
.remove_new = cros_typec_remove,
};

module_platform_driver(cros_typec_driver);
Expand Down

0 comments on commit 9f39757

Please sign in to comment.