/** * iio_read_acpi_mount_matrix() - Read accelerometer mount matrix info from ACPI * @dev: Device structure * @orientation: iio_mount_matrix struct to fill * @acpi_method: ACPI method name to read the matrix from, usually "ROTM" * * Try to read the mount-matrix by calling the specified method on the device's * ACPI firmware-node. If the device has no ACPI firmware-node; or the method * does not exist then this will fail silently. This expects the method to * return data in the ACPI "ROTM" format defined by Microsoft: * https://learn.microsoft.com/en-us/windows-hardware/drivers/sensors/sensors-acpi-entries * This is a Microsoft extension and not part of the official ACPI spec. * The method name is configurable because some dual-accel setups define 2 mount * matrices in a single ACPI device using separate "ROMK" and "ROMS" methods. * * Returns: true if the matrix was successfully, false otherwise.
*/ bool iio_read_acpi_mount_matrix(struct device *dev, struct iio_mount_matrix *orientation, char *acpi_method)
{ struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; char *str; union acpi_object *obj, *elements;
acpi_handle handle;
acpi_status status; int i, j, val[3]; bool ret = false;
handle = ACPI_HANDLE(dev); if (!handle) returnfalse;
if (!acpi_has_method(handle, acpi_method)) returnfalse;
status = acpi_evaluate_object(handle, acpi_method, NULL, &buffer); if (ACPI_FAILURE(status)) {
dev_err(dev, "Failed to get ACPI mount matrix: %d\n", status); returnfalse;
}
elements = obj->package.elements; for (i = 0; i < 3; i++) { if (elements[i].type != ACPI_TYPE_STRING) {
dev_err(dev, "Unknown ACPI mount matrix element format\n"); goto out_free_buffer;
}
/** * iio_get_acpi_device_name_and_data() - Return ACPI device instance name and driver data * @dev: Device structure * @data: Optional pointer to return driver data * * When device was enumerated by ACPI ID matching, the user might * want to set description for the physical chip. In such cases * the ACPI device instance name might be used. This call may be * performed to retrieve this information. * * NOTE: This helper function exists only for backward compatibility, * do not use in a new code! * * Returns: ACPI device instance name or %NULL.
*/ constchar *iio_get_acpi_device_name_and_data(struct device *dev, constvoid **data)
{ conststruct acpi_device_id *id;
acpi_handle handle;
handle = ACPI_HANDLE(dev); if (!handle) return NULL;
id = acpi_match_device(dev->driver->acpi_match_table, dev); if (!id) return NULL;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.