Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/chrome: cros_ec_lpc: Add a new quirk for AML mutex

Add a new quirk "CROS_EC_LPC_QUIRK_AML_MUTEX" which provides the name
of an AML mutex to protect MEC memory access.

Tested-by: Dustin L. Howett <dustin@howett.net>
Signed-off-by: Ben Walsh <ben@jubnut.com>
Link: https://lore.kernel.org/r/20240605063351.14836-5-ben@jubnut.com
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>

authored by

Ben Walsh and committed by
Tzung-Bi Shih
38c31b1d 040159e0

+19
+19
drivers/platform/chrome/cros_ec_lpc.c
··· 44 44 * the ACPI device. 45 45 */ 46 46 #define CROS_EC_LPC_QUIRK_ACPI_ID BIT(1) 47 + /* 48 + * Indicates that lpc_driver_data.quirk_aml_mutex_name should be used 49 + * to find an AML mutex to protect access to Microchip EC. 50 + */ 51 + #define CROS_EC_LPC_QUIRK_AML_MUTEX BIT(2) 47 52 48 53 /** 49 54 * struct lpc_driver_data - driver data attached to a DMI device ID to indicate ··· 57 52 * @quirk_mmio_memory_base: The first I/O port addressing EC mapped memory (used 58 53 * when quirk ...REMAP_MEMORY is set.) 59 54 * @quirk_acpi_id: An ACPI HID to be used to find the ACPI device. 55 + * @quirk_aml_mutex_name: The name of an AML mutex to be used to protect access 56 + * to Microchip EC. 60 57 */ 61 58 struct lpc_driver_data { 62 59 u32 quirks; 63 60 u16 quirk_mmio_memory_base; 64 61 const char *quirk_acpi_id; 62 + const char *quirk_aml_mutex_name; 65 63 }; 66 64 67 65 /** ··· 489 481 return -ENODEV; 490 482 } 491 483 ACPI_COMPANION_SET(dev, adev); 484 + } 485 + 486 + if (quirks & CROS_EC_LPC_QUIRK_AML_MUTEX) { 487 + const char *name 488 + = driver_data->quirk_aml_mutex_name; 489 + ret = cros_ec_lpc_mec_acpi_mutex(ACPI_COMPANION(dev), name); 490 + if (ret) { 491 + dev_err(dev, "failed to get AML mutex '%s'", name); 492 + return ret; 493 + } 494 + dev_info(dev, "got AML mutex '%s'", name); 492 495 } 493 496 } 494 497