From patchwork Tue Feb 13 13:46:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13555129 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3CEC56466 for ; Tue, 13 Feb 2024 13:46:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707831975; cv=none; b=bPlyuYpK09i6SjMtKKZ9JkMYWUWlS3LhkPhtVet0YY2HDYZ9sMloMf51vpJqM1HDPH/j9dVnD42lM2mnUtikvxo+FzF012C+a7OVLIZ6Lj7fNTwW/P0Tla0ND7CbfpzChIEFMKCXOb5rX7UFBwFwqa0oZrKC7/0I6nbGoZkDmhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707831975; c=relaxed/simple; bh=lhJp13aKccQVnVMitYg8BP4PHIHmRaUxm0qo0/2x0IA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Y4fTGGZQ7DpLBRWFvNsq996Xr5cscvZd4kKIaL0L+jlA25TpOPS+q2U15guWtmuasU7lVUvW/RByAfPzFGrQ2YBBraxN/Kp4/y0lLcx1+Qkg558fST+bfwJatgGxhQiPJcrxx2jOYSosvlzqujg0HgRvT09vqj1bq5VR3i9CMyI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=dkktxk/J; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dkktxk/J" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707831974; x=1739367974; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lhJp13aKccQVnVMitYg8BP4PHIHmRaUxm0qo0/2x0IA=; b=dkktxk/JnBMxF1oTKCiy4zcsdkbVwUY1q0WHXH2UzQWalxF1BE4JmkLS rWH+Q6d4/vjHcLVdWwwKWqf4NnpyNW4Qiixrrm+/0v7BYuxci1ZqFKji8 sT3OzWfumuHvJEiuOXtWcpANkd2OWHyZNzrSwyQeaXVK/R53VPnno6vYz b7ntaTmw1nOSaaD1dW4zASI9ypa7YBkaFqqhJfV9KmfQo+jP4x57inym7 boVaYsImptclPDRvpprVtrhsQwFfx8MKgdGKeq3ZWh+XqE532hx8vGECs m7PUiTbh/Mwf4gLuzThLgiwhE9zdWNy/q9EAbHJJMK3RBVExWuJ+HekxY w==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="1743673" X-IronPort-AV: E=Sophos;i="6.06,157,1705392000"; d="scan'208";a="1743673" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Feb 2024 05:46:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,157,1705392000"; d="scan'208";a="3207228" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Feb 2024 05:46:11 -0800 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 74C0C11F871; Tue, 13 Feb 2024 15:46:07 +0200 (EET) From: Sakari Ailus To: linux-acpi@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown Subject: [PATCH v2 1/2] ACPI: utils: Make acpi_handle_path() not static Date: Tue, 13 Feb 2024 15:46:05 +0200 Message-Id: <20240213134606.383817-2-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213134606.383817-1-sakari.ailus@linux.intel.com> References: <20240213134606.383817-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 acpi_handle_path() will soon be required for node name comparison elsewhere in ACPI framework. Remove the static keyword and add the prototype to include/linux/acpi.h. Signed-off-by: Sakari Ailus --- drivers/acpi/utils.c | 2 +- include/linux/acpi.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index abac5cc25477..202234ba54bd 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -559,7 +559,7 @@ EXPORT_SYMBOL(acpi_evaluate_ost); * * Caller must free the returned buffer */ -static char *acpi_handle_path(acpi_handle handle) +char *acpi_handle_path(acpi_handle handle) { struct acpi_buffer buffer = { .length = ACPI_ALLOCATE_BUFFER, diff --git a/include/linux/acpi.h b/include/linux/acpi.h index b7165e52b3c6..a170c389dd74 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1170,6 +1170,7 @@ static inline void acpi_ec_set_gpe_wake_mask(u8 action) {} #endif #ifdef CONFIG_ACPI +char *acpi_handle_path(acpi_handle handle); __printf(3, 4) void acpi_handle_printk(const char *level, acpi_handle handle, const char *fmt, ...); From patchwork Tue Feb 13 13:46:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13555130 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8985655C1D for ; Tue, 13 Feb 2024 13:46:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707831976; cv=none; b=gSeJ9HFRGvvwpIEo2+vyCDPQ0EZ1mZMbN3ti29fASWULjIFUDirrHtIxOzIGqd7gtFMQ94pg03Iwr/ilsUCDP5CZool6uZ0qx/OX9BeSPKqnrGbqLv3h+lePkC3xAw4IU81lese5Jj0Q4LUTDzxiSI7eb51+hmSwdvAcem9HeH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707831976; c=relaxed/simple; bh=8rzeWomKjFDbpxN+10h1iEcLWtkTj9WveWna+xoInh8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VssCENQ8wPFLnnu+pZSZeM1ahb9F3rwDCs5j1xDGPJ5ojDjqhWDN3BmH1r17DUNj2SIGMub52uZvEYwTTxmRSqCjt9Knnn3lt75WZvawN/j0ptnWPimjEwOgIrEXTGUqsSYPNQhNiyBG/GCvy5FqKZmgi3zCXp9zDzADgN1sYxQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=nclP84Ux; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nclP84Ux" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707831975; x=1739367975; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8rzeWomKjFDbpxN+10h1iEcLWtkTj9WveWna+xoInh8=; b=nclP84UxoLapnaBLTXt2RQSza61tPTnK/sIgaMUYT5AE242FhQOe+mws kjtU7nMclPfQGDmJZxmXdzZu+wrmlhYhd8oPqIjynbs8qIORcg78dkzgf z9niucSVN+tqfaN2l+vFKem7tZoHKLVnG0C6ignZdjfxrNKLKLWcFGZg3 HsXO4bAbELR4LvX9xM0N+GGXZVDftY/MMQgjwO4Hu9T5H142tmUtwSs+B kdOT3PWxuyxS9ag4tKLh2UgPDlELfYlKZez/+YC2gsGjrXzNE5xqRDWWS qsCQMFZKGCRHyKcjLOV/4xzZRsRODfZvLaAgxiIwJikHH203lZ4ITu92x w==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="1743675" X-IronPort-AV: E=Sophos;i="6.06,157,1705392000"; d="scan'208";a="1743675" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Feb 2024 05:46:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,157,1705392000"; d="scan'208";a="3207230" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Feb 2024 05:46:11 -0800 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 5A7E211F9DB; Tue, 13 Feb 2024 15:46:08 +0200 (EET) From: Sakari Ailus To: linux-acpi@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown Subject: [PATCH v2 2/2] ACPI: property: Ignore bad graph port nodes on Dell XPS 9315 Date: Tue, 13 Feb 2024 15:46:06 +0200 Message-Id: <20240213134606.383817-3-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213134606.383817-1-sakari.ailus@linux.intel.com> References: <20240213134606.383817-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Some systems were shipped with both Windows and Linux camera descriptions. In general, if Linux description exist, they will be used and Windows description ignored. In this case the Linux descriptions were buggy so use Windows definition instead. This patch ignores the bad graph port nodes on Dell XPS 9315 and there are likely other such systems, too. The corresponding information has been added to ipu-bridge to cover the missing bits. Signed-off-by: Sakari Ailus --- drivers/acpi/internal.h | 1 + drivers/acpi/mipi-disco-img.c | 71 +++++++++++++++++++++++++++++++++++ drivers/acpi/property.c | 3 ++ 3 files changed, 75 insertions(+) diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 6588525c45ef..e0145df519bd 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -301,5 +301,6 @@ void acpi_mipi_check_crs_csi2(acpi_handle handle); void acpi_mipi_scan_crs_csi2(void); void acpi_mipi_init_crs_csi2_swnodes(void); void acpi_mipi_crs_csi2_cleanup(void); +bool acpi_graph_ignore_port(acpi_handle handle); #endif /* _ACPI_INTERNAL_H_ */ diff --git a/drivers/acpi/mipi-disco-img.c b/drivers/acpi/mipi-disco-img.c index 7286cf4579bc..da71eb4bf6a6 100644 --- a/drivers/acpi/mipi-disco-img.c +++ b/drivers/acpi/mipi-disco-img.c @@ -19,6 +19,7 @@ */ #include +#include #include #include #include @@ -723,3 +724,73 @@ void acpi_mipi_crs_csi2_cleanup(void) list_for_each_entry_safe(csi2, csi2_tmp, &acpi_mipi_crs_csi2_list, entry) acpi_mipi_del_crs_csi2(csi2); } + +static const struct dmi_system_id dmi_ignore_port_nodes[] = { + { + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "XPS 9315"), + }, + }, + { 0 } +}; + +static const char *strnext(const char *s1, const char *s2) +{ + s1 = strstr(s1, s2); + + if (!s1) + return NULL; + + return s1 + strlen(s2); +} + +/** + * acpi_graph_ignore_port - Tell whether a port node should be ignored + * @handle: The ACPI handle of the node (which may be a port node) + * + * Returns true if a port node should be ignored and the data to that should + * come from other sources instead (Windows ACPI definitions and + * ipu-bridge). This is currently used to ignore bad port nodes related to IPU6 + * ("IPU?") and camera sensor devices ("LNK?") in certain Dell systems with + * Intel VSC. + */ +bool acpi_graph_ignore_port(acpi_handle handle) +{ + const char *path = NULL, *orig_path; + static bool dmi_tested, ignore_port; + + if (!dmi_tested) { + ignore_port = dmi_first_match(dmi_ignore_port_nodes); + dmi_tested = true; + } + + if (!ignore_port) + return false; + + /* Check if the device is either "IPU" or "LNK" (sensor). */ + orig_path = acpi_handle_path(handle); + if (!orig_path) + return false; + path = strnext(orig_path, "IPU"); + if (!path) + path = strnext(orig_path, "LNK"); + if (!path) + goto out_free; + + if (!(path[0] >= '0' && path[0] <= '9' && path[1] == '.')) + goto out_free; + + /* Check if the node has a "PRT" prefix. */ + path = strnext(path, "PRT"); + if (path && path[0] >= '0' && path[0] <= '9' && !path[1]) { + acpi_handle_debug(handle, "ignoring data node\n"); + + kfree(orig_path); + return true; + } + +out_free: + kfree(orig_path); + return false; +} diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index a6ead5204046..2b73580c9f36 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -80,6 +80,9 @@ static bool acpi_nondev_subnode_extract(union acpi_object *desc, struct acpi_data_node *dn; bool result; + if (acpi_graph_ignore_port(handle)) + return false; + dn = kzalloc(sizeof(*dn), GFP_KERNEL); if (!dn) return false;