Skip to content

Commit f533e43

Browse files
Sakari Ailusrafaeljw
authored andcommitted
ACPI: property: Dig "rotation" property for devices with CSI2 _CRS
Find the "rotation" property value for devices with _CRS CSI-2 resource descriptors and use it to add the "rotation" property to the software nodes representing the CSI-2 connection graph. That value typically comes from the _PLD (Physical Location of Device) object if it is present for the given device. This way, camera sensor drivers that know the "rotation" property do not need to care about _PLD on systems using ACPI. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> [ rjw: Changelog edits, file rename ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
1 parent a6cb0a6 commit f533e43

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

drivers/acpi/mipi-disco-img.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ static void init_crs_csi2_swnodes(struct crs_csi2 *csi2)
595595
struct acpi_buffer buffer = { .length = ACPI_ALLOCATE_BUFFER };
596596
struct acpi_device_software_nodes *swnodes = csi2->swnodes;
597597
acpi_handle handle = csi2->handle;
598+
unsigned int prop_index = 0;
598599
struct fwnode_handle *adev_fwnode;
599600
struct acpi_device *adev;
600601
acpi_status status;
@@ -614,6 +615,22 @@ static void init_crs_csi2_swnodes(struct crs_csi2 *csi2)
614615

615616
adev_fwnode = acpi_fwnode_handle(adev);
616617

618+
/*
619+
* If the "rotation" property is not present, but _PLD is there,
620+
* evaluate it to get the "rotation" value.
621+
*/
622+
if (!fwnode_property_present(adev_fwnode, "rotation")) {
623+
struct acpi_pld_info *pld;
624+
625+
status = acpi_get_physical_device_location(handle, &pld);
626+
if (ACPI_SUCCESS(status)) {
627+
swnodes->dev_props[NEXT_PROPERTY(prop_index, DEV_ROTATION)] =
628+
PROPERTY_ENTRY_U32("rotation",
629+
pld->rotation * 45U);
630+
kfree(pld);
631+
}
632+
}
633+
617634
status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
618635
if (ACPI_FAILURE(status)) {
619636
acpi_handle_info(handle, "Unable to get the path name\n");

include/acpi/acpi_bus.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ struct acpi_gpio_mapping;
380380
#define ACPI_DEVICE_SWNODE_PORT_NAME_LENGTH 8
381381

382382
enum acpi_device_swnode_dev_props {
383+
ACPI_DEVICE_SWNODE_DEV_ROTATION,
383384
ACPI_DEVICE_SWNODE_DEV_NUM_OF,
384385
ACPI_DEVICE_SWNODE_DEV_NUM_ENTRIES
385386
};

0 commit comments

Comments
 (0)