[PATCH 7/8] ACPI: property: Skip MIPI property table without "mipi-img" prefix

Sakari Ailus
2023-01-17T12:22:28Z

For all _DSD properties, skip going through the MIPI DisCo for Imaging
property name substitution table if the property doesn't have "mipi-img-"
prefix.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/acpi/mipi.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/mipi.c b/drivers/acpi/mipi.c
index 2174e03a2eafd..840f565b1906f 100644
--- a/drivers/acpi/mipi.c
+++ b/drivers/acpi/mipi.c
@@ -688,16 +688,18 @@ void acpi_init_swnodes(struct acpi_device *device)
device->fwnode.secondary = software_node_fwnode(ads->nodes);
}

+#define MIPI_IMG_PREFIX "mipi-img-"
+
static const struct mipi_disco_prop {
const char *mipi_prop;
const char *dt_prop;
} mipi_disco_props[] = {
- { "mipi-img-lens-focus", "lens-focus" },
- { "mipi-img-flash-leds", "flash-leds" },
- { "mipi-img-clock-frequency", "clock-frequency" },
- { "mipi-img-led-max-current", "led-max-microamp" },
- { "mipi-img-flash-max-current", "flash-max-microamp" },
- { "mipi-img-flash-max-timeout", "flash-max-timeout-us" },
+ { MIPI_IMG_PREFIX "lens-focus", "lens-focus" },
+ { MIPI_IMG_PREFIX "flash-leds", "flash-leds" },
+ { MIPI_IMG_PREFIX "clock-frequency", "clock-frequency" },
+ { MIPI_IMG_PREFIX "led-max-current", "led-max-microamp" },
+ { MIPI_IMG_PREFIX "flash-max-current", "flash-max-microamp" },
+ { MIPI_IMG_PREFIX "flash-max-timeout", "flash-max-timeout-us" },
};

/**
@@ -713,6 +715,10 @@ void acpi_properties_prepare_mipi(union acpi_object *elements)
{
unsigned int i;

+ if (memcmp(elements[0].string.pointer, MIPI_IMG_PREFIX,
+ sizeof(MIPI_IMG_PREFIX) - 1))
+ return;
+
/* Replace MIPI DisCo for Imaging property names with DT equivalents. */
for (i = 0; i < ARRAY_SIZE(mipi_disco_props); i++) {
if (!strcmp(mipi_disco_props[i].mipi_prop,
--
2.30.2