Skip to content

Commit d83c45a

Browse files
JohnAZoidbergTzung-Bi Shih
authored andcommitted
platform/chrome: cros_ec_lpc: Match on Framework ACPI device
Load the cros_ec_lpc driver based on a Framework FRMWC004 ACPI device, which mirrors GOOG0004, but also applies npcx quirks for Framework systems. Matching on ACPI will let us avoid having to change the SMBIOS match rules again and again. Cc: Tzung-Bi Shih <tzungbi@kernel.org> Cc: linux@frame.work Cc: Dustin L. Howett <dustin@howett.net> Signed-off-by: Daniel Schaefer <dhs@frame.work> Link: https://lore.kernel.org/r/20250128181329.8070-1-dhs@frame.work Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
1 parent 57b38c3 commit d83c45a

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

drivers/platform/chrome/cros_ec_lpc.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#define DRV_NAME "cros_ec_lpcs"
3232
#define ACPI_DRV_NAME "GOOG0004"
33+
#define FRMW_ACPI_DRV_NAME "FRMWC004"
3334

3435
/* True if ACPI device is present */
3536
static bool cros_ec_lpc_acpi_device_found;
@@ -514,7 +515,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
514515
acpi_status status;
515516
struct cros_ec_device *ec_dev;
516517
struct cros_ec_lpc *ec_lpc;
517-
struct lpc_driver_data *driver_data;
518+
const struct lpc_driver_data *driver_data;
518519
u8 buf[2] = {};
519520
int irq, ret;
520521
u32 quirks;
@@ -526,6 +527,9 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
526527
ec_lpc->mmio_memory_base = EC_LPC_ADDR_MEMMAP;
527528

528529
driver_data = platform_get_drvdata(pdev);
530+
if (!driver_data)
531+
driver_data = acpi_device_get_match_data(dev);
532+
529533
if (driver_data) {
530534
quirks = driver_data->quirks;
531535

@@ -696,12 +700,6 @@ static void cros_ec_lpc_remove(struct platform_device *pdev)
696700
cros_ec_unregister(ec_dev);
697701
}
698702

699-
static const struct acpi_device_id cros_ec_lpc_acpi_device_ids[] = {
700-
{ ACPI_DRV_NAME, 0 },
701-
{ }
702-
};
703-
MODULE_DEVICE_TABLE(acpi, cros_ec_lpc_acpi_device_ids);
704-
705703
static const struct lpc_driver_data framework_laptop_npcx_lpc_driver_data __initconst = {
706704
.quirks = CROS_EC_LPC_QUIRK_REMAP_MEMORY,
707705
.quirk_mmio_memory_base = 0xE00,
@@ -713,6 +711,13 @@ static const struct lpc_driver_data framework_laptop_mec_lpc_driver_data __initc
713711
.quirk_aml_mutex_name = "ECMT",
714712
};
715713

714+
static const struct acpi_device_id cros_ec_lpc_acpi_device_ids[] = {
715+
{ ACPI_DRV_NAME, 0 },
716+
{ FRMW_ACPI_DRV_NAME, (kernel_ulong_t)&framework_laptop_npcx_lpc_driver_data },
717+
{ }
718+
};
719+
MODULE_DEVICE_TABLE(acpi, cros_ec_lpc_acpi_device_ids);
720+
716721
static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = {
717722
{
718723
/*
@@ -866,7 +871,8 @@ static int __init cros_ec_lpc_init(void)
866871
int ret;
867872
const struct dmi_system_id *dmi_match;
868873

869-
cros_ec_lpc_acpi_device_found = !!cros_ec_lpc_get_device(ACPI_DRV_NAME);
874+
cros_ec_lpc_acpi_device_found = !!cros_ec_lpc_get_device(ACPI_DRV_NAME) ||
875+
!!cros_ec_lpc_get_device(FRMW_ACPI_DRV_NAME);
870876

871877
dmi_match = dmi_first_match(cros_ec_lpc_dmi_table);
872878

0 commit comments

Comments
 (0)