Skip to content

Commit 38c31b1

Browse files
walshbTzung-Bi Shih
authored andcommitted
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 <[email protected]> Signed-off-by: Ben Walsh <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Tzung-Bi Shih <[email protected]>
1 parent 040159e commit 38c31b1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

drivers/platform/chrome/cros_ec_lpc.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ static bool cros_ec_lpc_acpi_device_found;
4444
* the ACPI device.
4545
*/
4646
#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)
4752

4853
/**
4954
* struct lpc_driver_data - driver data attached to a DMI device ID to indicate
@@ -52,11 +57,14 @@ static bool cros_ec_lpc_acpi_device_found;
5257
* @quirk_mmio_memory_base: The first I/O port addressing EC mapped memory (used
5358
* when quirk ...REMAP_MEMORY is set.)
5459
* @quirk_acpi_id: An ACPI HID to be used to find the ACPI device.
60+
* @quirk_aml_mutex_name: The name of an AML mutex to be used to protect access
61+
* to Microchip EC.
5562
*/
5663
struct lpc_driver_data {
5764
u32 quirks;
5865
u16 quirk_mmio_memory_base;
5966
const char *quirk_acpi_id;
67+
const char *quirk_aml_mutex_name;
6068
};
6169

6270
/**
@@ -482,6 +490,17 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
482490
}
483491
ACPI_COMPANION_SET(dev, adev);
484492
}
493+
494+
if (quirks & CROS_EC_LPC_QUIRK_AML_MUTEX) {
495+
const char *name
496+
= driver_data->quirk_aml_mutex_name;
497+
ret = cros_ec_lpc_mec_acpi_mutex(ACPI_COMPANION(dev), name);
498+
if (ret) {
499+
dev_err(dev, "failed to get AML mutex '%s'", name);
500+
return ret;
501+
}
502+
dev_info(dev, "got AML mutex '%s'", name);
503+
}
485504
}
486505

487506
/*

0 commit comments

Comments
 (0)