i2c/drivers/generic: Add support for including a CDM
Chip Direct Mapping is exclusive to Windows; it allows specifying the position where a chip is mounted. There are 8 positions and a _CDM method should return 0xabcd0X, where X is the position. Tested by booting Windows 11 on the StarLite Mk V, rotating the device and checking the orientation is correct, where previously, it was inverted. Change-Id: If70c25288d835df7064b4051c43abeb2d6531f3b Signed-off-by: Sean Rhodes <sean@starlabs.systems> Reviewed-on: https://review.coreboot.org/c/coreboot/+/81409 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
@@ -81,6 +81,31 @@ struct drivers_i2c_generic_config {
|
||||
bool has_rotation_matrix;
|
||||
int rotation_matrix[9];
|
||||
|
||||
/*
|
||||
* Chip Direct Mapping is exclusive to Windows, a allows specifying the
|
||||
* position where a chip is mounted. There are 8 positions:
|
||||
* 1: 90 Degrees
|
||||
* 2: 270 Degrees
|
||||
* 3: 180 Degrees
|
||||
* 4: 0 Degrees
|
||||
* 5: 90 Degrees (Inverted)
|
||||
* 6: 270 Degrees (Inverted)
|
||||
* 7: 180 Degrees (Inverted)
|
||||
* 8: 0 Degrees (Inverted)
|
||||
*
|
||||
* The _CDM method should return 0xabcd0X, where X is the position.
|
||||
*/
|
||||
enum {
|
||||
CDM_NOT_PRESENT = 0,
|
||||
CDM_ROT_90,
|
||||
CDM_ROT_180,
|
||||
CDM_ROT_270,
|
||||
CDM_ROT_0,
|
||||
CDM_ROT_90_INVERT,
|
||||
CDM_ROT_180_INVERT,
|
||||
CDM_ROT_270_INVERT,
|
||||
CDM_ROT_0_INVERT,
|
||||
} cdm_index;
|
||||
|
||||
/* Generic properties for exporting device-specific data to the OS */
|
||||
struct acpi_dp property_list[MAX_GENERIC_PROPERTY_LIST];
|
||||
|
@@ -165,6 +165,13 @@ void i2c_generic_fill_ssdt(const struct device *dev,
|
||||
acpigen_pop_len();
|
||||
}
|
||||
|
||||
/* Chip Direct Mapping */
|
||||
if (config->cdm_index != CDM_NOT_PRESENT) {
|
||||
acpigen_write_method("_CDM", 1);
|
||||
acpigen_write_return_integer(0xabcd00 | config->cdm_index);
|
||||
acpigen_pop_len();
|
||||
}
|
||||
|
||||
/* Callback if any. */
|
||||
if (callback)
|
||||
callback(dev);
|
||||
|
Reference in New Issue
Block a user