From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux ACPI <linux-acpi@vger.kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Hans de Goede <hdegoede@redhat.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 6/6] ACPI: property: Dig "rotation" property for devices with CSI2 _CRS
Date: Wed, 24 May 2023 13:48:22 +0200 [thread overview]
Message-ID: <1957117.usQuhbGJ8B@kreacher> (raw)
In-Reply-To: <13276375.uLZWGnKmhe@kreacher>
From: Sakari Ailus <sakari.ailus@linux.intel.com>
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 ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
Code changes same as in
https://patchwork.kernel.org/project/linux-acpi/patch/20230329100951.1522322-8-sakari.ailus@linux.intel.com
changelog edited.
---
drivers/acpi/mipi-disco-imaging.c | 17 +++++++++++++++++
include/acpi/acpi_bus.h | 1 +
2 files changed, 18 insertions(+)
Index: linux-pm/drivers/acpi/mipi-disco-imaging.c
===================================================================
--- linux-pm.orig/drivers/acpi/mipi-disco-imaging.c
+++ linux-pm/drivers/acpi/mipi-disco-imaging.c
@@ -529,6 +529,7 @@ static void init_crs_csi2_swnodes(struct
struct acpi_buffer buffer = { .length = ACPI_ALLOCATE_BUFFER };
struct acpi_device_software_nodes *swnodes = csi2->swnodes;
acpi_handle handle = csi2->handle;
+ unsigned int prop_index = 0;
struct fwnode_handle *adev_fwnode;
struct acpi_device *adev;
acpi_status status;
@@ -541,6 +542,22 @@ static void init_crs_csi2_swnodes(struct
adev_fwnode = acpi_fwnode_handle(adev);
+ /*
+ * If the "rotation" property is not present, but _PLD is there,
+ * evaluate it to get the "rotation" value.
+ */
+ if (!fwnode_property_present(adev_fwnode, "rotation")) {
+ struct acpi_pld_info *pld;
+
+ status = acpi_get_physical_device_location(handle, &pld);
+ if (ACPI_SUCCESS(status)) {
+ swnodes->dev_props[NEXT_PROPERTY(prop_index, DEV_ROTATION)] =
+ PROPERTY_ENTRY_U32("rotation",
+ pld->rotation * 45U);
+ kfree(pld);
+ }
+ }
+
status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
if (ACPI_FAILURE(status)) {
acpi_handle_info(handle, "Unable to get the path name\n");
Index: linux-pm/include/acpi/acpi_bus.h
===================================================================
--- linux-pm.orig/include/acpi/acpi_bus.h
+++ linux-pm/include/acpi/acpi_bus.h
@@ -369,6 +369,7 @@ struct acpi_gpio_mapping;
#define ACPI_DEVICE_SWNODE_PORT_NAME_LENGTH 8
enum acpi_device_swnode_dev_props {
+ ACPI_DEVICE_SWNODE_DEV_ROTATION,
ACPI_DEVICE_SWNODE_DEV_NUM_OF,
ACPI_DEVICE_SWNODE_DEV_NUM_ENTRIES
};
next prev parent reply other threads:[~2023-05-24 11:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-24 11:38 [PATCH v1 0/6] ACPI: scan: MIPI DiSco for Imaging support Rafael J. Wysocki
2023-05-24 11:41 ` [PATCH v1 1/6] ACPI: property: Support using strings in reference properties Rafael J. Wysocki
2023-05-24 11:43 ` [PATCH v1 2/6] ACPI: scan: Extract CSI-2 connection graph from _CRS Rafael J. Wysocki
2023-05-24 11:43 ` [PATCH v1 3/6] ACPI: scan: Extract _CRS CSI-2 connection information into swnodes Rafael J. Wysocki
2023-05-24 11:45 ` [PATCH v1 4/6] device property: Add SOFTWARE_NODE() macro for defining software nodes Rafael J. Wysocki
2023-05-24 11:46 ` [PATCH v1 5/6] ACPI: scan: Extract MIPI DiSco for Imaging data into swnodes Rafael J. Wysocki
2023-05-24 11:48 ` Rafael J. Wysocki [this message]
2023-05-24 11:56 ` [PATCH v1 0/6] ACPI: scan: MIPI DiSco for Imaging support Rafael J. Wysocki
2023-05-24 18:06 ` Rafael J. Wysocki
2023-06-09 9:51 ` Sakari Ailus
2023-06-09 17:31 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1957117.usQuhbGJ8B@kreacher \
--to=rjw@rjwysocki.net \
--cc=andriy.shevchenko@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox