From patchwork Thu Jan 20 13:44:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil R X-Patchwork-Id: 533616 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64801C433F5 for ; Thu, 20 Jan 2022 13:45:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243901AbiATNpX (ORCPT ); Thu, 20 Jan 2022 08:45:23 -0500 Received: from mail-dm6nam10on2080.outbound.protection.outlook.com ([40.107.93.80]:36287 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S244616AbiATNpD (ORCPT ); Thu, 20 Jan 2022 08:45:03 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Do5KuYn30UlQ+y7mVhDJ/m7LeXv9uGr7YW95v7OCWcUB1rcxJC0cTlcsmuDlWh8QyyGcmKHXwGkDpfkuebK+xY+zYe7ADHAxplgKIu4q/TRStk2cGZmQKyV9ZigdXAg7zuhyyMflZFdWYjbtKXmMET0p3eWini1OfHpLJHX9qYKx1elIhQa+HN+7g4bXuk8aZBjJ6Jc8Rj0PEUhcVzXWCnlgXIdrQCmY3lAtN37TBZsbrUeZ6I+5K5mnhLNTkT7Ri0wJPExkFTqcPDskzVhEnkadSKNMlyp/BgH9f+YLaySpNQmFV/wcvQkinmHhGLKudwYyT28EHsrKN2FZRvYa0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rroq+rsrmX/YlTjtXsPZqI++N/QU2HLd9kAmXQDrD5E=; b=ZndS1hAy+ZUePeT687VLKAPg3Rx3QXynHO37tqgbCiQIWtgE/J2nGfxlRMDhmbUUWXFMuR3Q2gQMRSN+f3Hqg3R7zkRvnTYmYx/TzypPLd/3dV7AC+yK7c3BQkAiPwN8WoDPdngm3F0K3Nfud6SzgG6ur6bKbmKmfg5GfHRZWegZ0QoIVnTfmntLWoEG18M3FVNiWY07bIddUqgx7/HfSi99lMLZsGBjGdowC1z7cXJSa46jzamu6Fjx3i41JQdIJgHfn1M9Siw8yafCamP1StN4ZR98zu6RfZL5qIvNFhqvqTdVydVApMinVl8z5r/4MIGDtsenYhY9dnQetTze1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rroq+rsrmX/YlTjtXsPZqI++N/QU2HLd9kAmXQDrD5E=; b=MwdAOXp0UibWIb9wl00tKKjHDefTpE0CSyiVq/ohiRIklMQ65w2c2CimllwwXUQn6KrsgfsG7MZHvnGixvs/nD9T7b9PBii7xdEofkcV+fVcvKO61EdXkMMpKVk81nnEGBSLsIeuI6zV1G6kTViFTCWG3xUAbcaxdFZs8xw4KtEUHCXSYcdYQsVjpnB3WxHXB11i28wFf7m5b3ckOKqhZIBA0aywxb2O1NCyzdMVLygOXQE40zemABdoN2QSvltoPlO/3nG6kAfneow+9rRreG1bTiwAIAaFMOYnp0fb29/WFFvQ+LeN8Obi2RSuHItvEMX28nGvf1x0Ttnuc+h9nA== Received: from DS7P222CA0029.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::28) by BN7PR12MB2627.namprd12.prod.outlook.com (2603:10b6:408:25::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.10; Thu, 20 Jan 2022 13:45:01 +0000 Received: from DM6NAM11FT067.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2e:cafe::52) by DS7P222CA0029.outlook.office365.com (2603:10b6:8:2e::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.7 via Frontend Transport; Thu, 20 Jan 2022 13:45:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by DM6NAM11FT067.mail.protection.outlook.com (10.13.172.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4909.7 via Frontend Transport; Thu, 20 Jan 2022 13:45:00 +0000 Received: from HQMAIL109.nvidia.com (172.20.187.15) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 20 Jan 2022 13:45:00 +0000 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 20 Jan 2022 05:44:59 -0800 Received: from kyarlagadda-linux.nvidia.com (10.127.8.10) by mail.nvidia.com (172.20.187.15) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 20 Jan 2022 05:44:51 -0800 From: Akhil R To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v3 1/3] device property: Add device_irq_get_byname Date: Thu, 20 Jan 2022 19:14:13 +0530 Message-ID: <1642686255-25951-2-git-send-email-akhilrajeev@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1642686255-25951-1-git-send-email-akhilrajeev@nvidia.com> References: <1642686255-25951-1-git-send-email-akhilrajeev@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ca838049-da7b-48f8-38a8-08d9dc1b0e22 X-MS-TrafficTypeDiagnostic: BN7PR12MB2627:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5HGGPfhU0CcuXd8pQ9DrKyT+obuc6zil6ugze5RkRDd5fuMTTkmTdY73ZulEUthZwXar2XLvfbNDur90J0ZIX5gs/MQWrwoDOk1RaSRNiGpuuLduIhMsf+O/Rdsrw0G2CrUPU4f4KqYVETkjMPA3DNDB4SUkwC1mvv3cS+i5buH8XYBTMhDHLfvdv4s7nikARiA1PkrJd1klyUkMrQ2py0lAbcqrWy5UTxlnU+KU8MUv+YIy6udRChEwcqGBA1luk87CX2DlN6BAY6yIfDLc7LxJvykGLW4a1jlsbznqU9w3xzm1KyxC2KCwP9jGXABFALXV129DjE9PCULnm1SW7+MdH3GNgyV2f5SB7oKQpQfXzCOfBiGt3uwwDXCZwzXsyp87rgDRoAGAcVueA2Lh3TtAeJF20PFrD+qIjJh+bcAyyj6oNxmLGtHxj5WyD1fFhUVP+OkY9z7o4Fxp+EDcS8vUCEwTPLCH710HbOCXJPLbj9PVKGkAh1e0GiBYdH7pnc303fXuNtZE5i/gsORd/FxD4bSkAf5ll0nGVGfey/YKvHw+CF5TpYH65mKm+dN+2ofOEXvgNHFsWchNnmScmEJrMZasK3iNkJQ+atfigDS0AWPKLKbNBGSyEGgaoH/P2bbKcggG482kokOgVTV3rCv5RcKx7Nhw7mhX4mM/Ok1GzXmc2JX0AWkju1wKuGIho3TvrKzqeeZ344Q3IDFLWHKE6tEcXWyl9Dox3r005mPx7tnhe5PD6I4kaDLIKPw7X0JVZTbBEJxc4FLezfBL8qIN7TnXO5ayE1RZsk+ltZXMLa3Q1OpDsq/O3pWGY3ZOGE/xHMjF9yQ50Bs/cibD+mKNfkWi4BY9AL5SGwpTkwk= X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700002)(8936002)(186003)(82310400004)(36860700001)(8676002)(316002)(336012)(47076005)(70586007)(110136005)(4326008)(921005)(26005)(6666004)(86362001)(36756003)(5660300002)(508600001)(7416002)(81166007)(356005)(7696005)(107886003)(426003)(40460700001)(2616005)(70206006)(2906002)(83996005)(36900700001)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2022 13:45:00.7737 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ca838049-da7b-48f8-38a8-08d9dc1b0e22 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT067.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR12MB2627 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Add device_irq_get_byname() to get an interrupt by name from both the ACPI table and the Device Tree. This will allow to use 'interrupt-names' in _DSD which can be mapped to Interrupt() resource by index. The implementation is similar to 'interrupt-names' in the Device Tree. Signed-off-by: Akhil R --- drivers/base/property.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/property.h | 3 +++ 2 files changed, 54 insertions(+) diff --git a/drivers/base/property.c b/drivers/base/property.c index e6497f6..962a645 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -936,6 +936,57 @@ void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index) EXPORT_SYMBOL(fwnode_iomap); /** + * fwnode_irq_get_byname - Get IRQ from a fwnode using its name + * @fwnode: Pointer to the firmware node + * @name: IRQ name + * + * Description: + * Find a match to the string 'name' in the 'interrupt-names' string array + * in _DSD for ACPI, or of_node for device tree. Then get the Linux IRQ + * number of the IRQ resource corresponding to the index of the matched + * string. + * + * Return: + * Linux IRQ number on success + * Negative errno otherwise. + */ +int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name) +{ + int index; + + if (!name) + return -EINVAL; + + index = fwnode_property_match_string(fwnode, "interrupt-names", name); + if (index < 0) + return index; + + return fwnode_irq_get(fwnode, index); +} +EXPORT_SYMBOL(fwnode_irq_get_byname); + +/** + * device_irq_get_byname - Get IRQ of a device using interrupt name + * @dev: Device to get the interrupt + * @name: IRQ name + * + * Description: + * Find a match to the string 'name' in the 'interrupt-names' string array + * in _DSD for ACPI, or of_node for device tree. Then get the Linux IRQ + * number of the IRQ resource corresponding to the index of the matched + * string. + * + * Return: + * Linux IRQ number on success + * Negative errno otherwise. + */ +int device_irq_get_byname(struct device *dev, const char *name) +{ + return fwnode_irq_get_byname(dev_fwnode(dev), name); +} +EXPORT_SYMBOL_GPL(device_irq_get_byname); + +/** * fwnode_graph_get_next_endpoint - Get next endpoint firmware node * @fwnode: Pointer to the parent firmware node * @prev: Previous endpoint node or %NULL to get the first diff --git a/include/linux/property.h b/include/linux/property.h index 7399a0b..3123b75 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -121,6 +121,9 @@ struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode); void fwnode_handle_put(struct fwnode_handle *fwnode); int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index); +int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name); + +int device_irq_get_byname(struct device *dev, const char *name); void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index); From patchwork Thu Jan 20 13:44:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil R X-Patchwork-Id: 533863 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D726C433EF for ; Thu, 20 Jan 2022 13:45:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241423AbiATNpe (ORCPT ); Thu, 20 Jan 2022 08:45:34 -0500 Received: from mail-bn8nam12on2051.outbound.protection.outlook.com ([40.107.237.51]:19617 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S242923AbiATNpT (ORCPT ); Thu, 20 Jan 2022 08:45:19 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CpKuKM6y6AmmsPjvHXHU6pfdIOASXnMfq4xd6mZCDv0iSnxsGRtvX8tKCToVa+AnIADHo26sKph35Z/2Vy4lyDs73XaBG9BcQ/w44jVBcZiHBg5ZzdFvn8hbrufhjC3mjLGPYz/xp06HJPMuFe35Tef5CLXToM4Z/lxBKAHq3ffaddVYMicXYEgdPcW2wueRRDojBxh2ew6wVFzGHwXov28l0URW8hNfGgWNzyug3r7T0jwr9hV8HTYkL92YqPnxUq3vG/yD8PRznUKLWP4lkXFu/XCixbl3uzobvKZhaVGmA/F7WD4BQ60HDfUv3lGKn3SnYIorswmPxO1USnf5Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GDFr1KZG2DKyzTQF94hEl/n3i3K9Irn3zeL0hGNEI1g=; b=CpgmnPHJsXImuJF57IG+gvgm9Otw4t2pV1mdH+e+yVb+Q1PwC/yQFGexAhlnRcLnBq7jjKP6ZN8MYV9mt/2iKr+SyHBOk9/TA8WE9YZ9ycXXN2anOxy/hDLnxAXRIxuJng/+pnUzvIQDj8A1C0PpwE+5wlkQENx5ac0Rw65i7YC+wJfgNPzykkVPQHB+BcFuF1UJZKb6laflCHTIgeXKq6XLYStbm1KqP/oNJfkCPruqxB2+VeEDUL10s7iY4JyJw7SEHPKYRoT46tpxSNhMPg2OubtPUQcF+DRyuoBNXLTlR+yIcSnIaobbq+rhO1WKTEFvRH7+RNsV896bm0iDoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GDFr1KZG2DKyzTQF94hEl/n3i3K9Irn3zeL0hGNEI1g=; b=peEU7E9fjtcH+qfOfu7uV3JZKOT2PWZKoJz4eofU2wtsAPEv7UPL8gU/klwqXOqzjRVtwWpZ4elkrr/SkGYOoAgHTkbDiO+IzJgse9f72bSpkvcLSqTxt8tvP1HnCjPc15bJ/wlRXiY5pXkDCE1G29IV9QNN+G/PlA76ymLg6vA54HZo5S6jmt2tomIux3lO5Xh7O4J58UdaKVpVsEZOeevv8ULQvpMiWT9unSwfpZNrDi+YaHzE3RVroGHC7RuwMRkvDP+tiqa13D26aD0UkfJ4JsP2BfA7IBdBHHe/+Nz6UXtQ0UBjutqm/+HYWlSilbKL6y6eN5JPNZsfA+aZxQ== Received: from BN6PR2001CA0047.namprd20.prod.outlook.com (2603:10b6:405:16::33) by MN2PR12MB4160.namprd12.prod.outlook.com (2603:10b6:208:19a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Thu, 20 Jan 2022 13:45:17 +0000 Received: from BN8NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:405:16:cafe::73) by BN6PR2001CA0047.outlook.office365.com (2603:10b6:405:16::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.10 via Frontend Transport; Thu, 20 Jan 2022 13:45:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.236) by BN8NAM11FT039.mail.protection.outlook.com (10.13.177.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4909.7 via Frontend Transport; Thu, 20 Jan 2022 13:45:17 +0000 Received: from HQMAIL109.nvidia.com (172.20.187.15) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 20 Jan 2022 13:45:13 +0000 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 20 Jan 2022 05:45:13 -0800 Received: from kyarlagadda-linux.nvidia.com (10.127.8.10) by mail.nvidia.com (172.20.187.15) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 20 Jan 2022 05:45:05 -0800 From: Akhil R To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v3 2/3] docs: firmware-guide: ACPI: Add named interrupt doc Date: Thu, 20 Jan 2022 19:14:14 +0530 Message-ID: <1642686255-25951-3-git-send-email-akhilrajeev@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1642686255-25951-1-git-send-email-akhilrajeev@nvidia.com> References: <1642686255-25951-1-git-send-email-akhilrajeev@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0f2f489f-d783-429f-361e-08d9dc1b180c X-MS-TrafficTypeDiagnostic: MN2PR12MB4160:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: my/sLrE01o/DUFMR4r+LGaGOw5AIK07Ml01dnOuk6Ege997vzzXFEc5hMba/JMGxBSLrWbG9FlED0DFVncpjhRFZjSZ7NBYKOo0iVnPzT/fo3vJOFNd5krd6rwZBc4vmTLXzMjhuVHnVV3oXflTfrTf6NRZNPqDtbMqEtaHGs/eLeMLPcYi1x0a88RvI1Kqlpc9qntFqbWW1DAhwOhVcr6o69jwH8ckW9jA8LwPDZSJnePvH2bXXnkAS/6wiOxUqTA+NyzYOg19u2PpXNCpczWqwspXNSnkad1SbNHRs3WRdS5HdzprhVFkn2D6B1laomqOyNR76b9s/7RMmZyvtQEcmyCNcMvfbL8nPkLKgYnqwj6DL20dk8U8DMv9rHjMPJHlF+Y1cQS2HWZYaaUtS0snfrrY+yPeR2Rkmayf6feNA+nrYTOr+EEY54KV8h7l1JcQGa6nCAVr5Z6nnZHXbAz5L/st8/pzuvg94QhJUg6hBilfK1avmuAp+o+eSYpFvNTBrtomZAq+FReWjoUNKs8ZKdkQ3f2Sn9jZUttINYuEsFLiYFd0PR/ILeDvmkTnuQ/K4O71OVcQL44lwWMf5GoAmP/URFMWe/jVhBXhpXDGzkQo+QE3WYH5uTR9QLSTNqb4YHdobAcxoW0Nb5r1qiEePDoO4nm2HZ1FZo/epiMDvF0TDZpNPTON2ll2TMaKHjrpMTLOPhx2VOI6qKZms85UZNpEARe9UttRbXp/jgKibpVWK6D43lcjyXwmKLEJzk21fP1EfanGaoQiOLa83AAW66N1CaTSlw9AO+HN+ijUYbx2/0UaSQfTG3UEW4dD8bXaB0thZCmeTJ2FquZs/JHdoFdBNexsRmAUCqY0XzZA= X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(40470700002)(36840700001)(46966006)(40460700001)(36756003)(47076005)(8936002)(81166007)(4326008)(186003)(2616005)(86362001)(336012)(921005)(426003)(82310400004)(110136005)(508600001)(6666004)(5660300002)(316002)(83380400001)(107886003)(7696005)(70206006)(8676002)(356005)(26005)(2906002)(7416002)(36860700001)(70586007)(36900700001)(83996005)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2022 13:45:17.3754 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f2f489f-d783-429f-361e-08d9dc1b180c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4160 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Added details and example for named interrupts in the ACPI table. Signed-off-by: Akhil R --- Documentation/firmware-guide/acpi/enumeration.rst | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Documentation/firmware-guide/acpi/enumeration.rst b/Documentation/firmware-guide/acpi/enumeration.rst index 74b830b2..595deba 100644 --- a/Documentation/firmware-guide/acpi/enumeration.rst +++ b/Documentation/firmware-guide/acpi/enumeration.rst @@ -143,6 +143,44 @@ In robust cases the client unfortunately needs to call acpi_dma_request_slave_chan_by_index() directly and therefore choose the specific FixedDMA resource by its index. +Named Interrupts +================ + +Drivers enumerated via ACPI can have names to interrupts in the ACPI table +which can be used to get the IRQ number in the driver. + +The interrupt name can be listed in _DSD as 'interrupt-names'. The names +should be listed as an array of strings which will map to the Interrupt() +resource in the ACPI table corresponding to its index. + +The table below shows an example of its usage:: + + Device (DEV0) { + ... + Name (_CRS, ResourceTemplate() { + ... + Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { + 0x20, + 0x24 + } + }) + + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () {"interrupt-names", + Package (2) {"default", "alert"}}, + } + ... + }) + } + +The interrupt name 'default' will correspond to 0x20 in Interrupt() +resource and 'alert' to 0x24. + +The driver can call the function - device_irq_get_byname() with the device +and interrupt name as arguments to get the corresponding IRQ number. + SPI serial bus support ====================== From patchwork Thu Jan 20 13:44:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil R X-Patchwork-Id: 533615 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A66CBC433EF for ; Thu, 20 Jan 2022 13:45:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242066AbiATNpk (ORCPT ); Thu, 20 Jan 2022 08:45:40 -0500 Received: from mail-mw2nam12on2072.outbound.protection.outlook.com ([40.107.244.72]:56928 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1344623AbiATNpb (ORCPT ); Thu, 20 Jan 2022 08:45:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jutFCYa/L3fT79UqmhEYiUpa4GjdtMEKs5WeeE9H4xVy1MV2Dmxr3s9wukPztc0MaKcrvP3b7/5MLUSdkvgTwzZNQ47g3dj43XzsGD6CIP4OY7JZOA+5+Zz2R0Bj9fIEEndNOxM5mID5bCOlDsTq3ojWUA98Kabftt0pkBoMC8JC2w18x282hPiWM4L2VGxsSOyhGJP0jO13yeUIm2yiCIlAh4fttmKFmxDd9eLlkBXpOhtlE6osdD1b7JZynRqH6aDzBFYuMv06Qe4ZI31RFNJkYxQW19fQMgMUY301PqscgVMg32k+0T3Js+QDqG7tSuCw6tnvm/xfkiucaflLKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OoI1OPC/ws7wVgztxSprWtJddK7zK4qQ4iqfztlA5pM=; b=Ncssv4kKnC3J54i/7PwspYzEBtSaW7cWiaxkM6Cpf2sf31DzHDWDfi4LwVMczW1mFZG+HAAlg8VirLikMx/iP+AgZY4bNFSt2Bx7CqKFTFntjiFnUJchdlaX29Pdz046qa2IKLGa5759d+EhNCaEsy5bisMAz7oiesjWVHitWPo1QOlPrrD9+bdBzZVy7DnT0OKPFtR9O87ucfEIWgUL/YY7rdRin58LfCPgWgYrtlSQ7kx31e1IpFXi8pTNlHkfY39ZQeKnUf7+efbb4GXx4MkijiN/KUl5DXFSfBsjGgTYV4AdTAaqQLz/MNoxT9AXvxY1mrj5dzuawKD3SBeVig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OoI1OPC/ws7wVgztxSprWtJddK7zK4qQ4iqfztlA5pM=; b=bE6kDc/rB75WN+Vk/4SZJ+inLlsUmyrde4VQ9VeTdGGTHwvcE2FYn51GTdviTKEgH3H+AFm8RrpISMzmQBV1rr7m2WG0edY7v/10yE40QAIZ6Lnh3lMYLBBJLMml2gQVVuQXp+2SHWtRKmlWTziMXlwfT8nXDZnvHinwJPcMSVBSVSrMPNxdHV5xdzGQzKl6N0jC0Pk4xvZTwK4wzmkPbhiRuBJ7LoMlmhT00GkE4sA0zbKozbWypQAAGHCoDA5iRC/xwzyFrOw7uE7EXTPpKMuYuHt6cwofKdVFgeE4uxNUOR8sL9i06xFrent74yF2nKs3zeMcHAnF3ic3pUYtUg== Received: from DM5PR18CA0083.namprd18.prod.outlook.com (2603:10b6:3:3::21) by BYAPR12MB2997.namprd12.prod.outlook.com (2603:10b6:a03:db::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.10; Thu, 20 Jan 2022 13:45:29 +0000 Received: from DM6NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:3:3:cafe::e6) by DM5PR18CA0083.outlook.office365.com (2603:10b6:3:3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.8 via Frontend Transport; Thu, 20 Jan 2022 13:45:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by DM6NAM11FT025.mail.protection.outlook.com (10.13.172.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4909.7 via Frontend Transport; Thu, 20 Jan 2022 13:45:28 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 20 Jan 2022 13:45:25 +0000 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 20 Jan 2022 13:45:25 +0000 Received: from kyarlagadda-linux.nvidia.com (10.127.8.10) by mail.nvidia.com (172.20.187.15) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 20 Jan 2022 05:45:17 -0800 From: Akhil R To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v3 3/3] i2c: smbus: Use device_*() functions instead of of_*() Date: Thu, 20 Jan 2022 19:14:15 +0530 Message-ID: <1642686255-25951-4-git-send-email-akhilrajeev@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1642686255-25951-1-git-send-email-akhilrajeev@nvidia.com> References: <1642686255-25951-1-git-send-email-akhilrajeev@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 12c72dca-212f-4fb4-26ce-08d9dc1b1eae X-MS-TrafficTypeDiagnostic: BYAPR12MB2997:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9/uW1W32WtkeAsgSJuhACedTrmNAHv3UlG1QYVtI5HyOb2HYrpNLKdDQcyoPl3vEcyXUsCLQ0lX7Zxj4tBl2gDWe6aZC4B0cY+7NQzxd9pd5uAx7zMi2A7CL87ZzxNh3mak7B026O1t5/zm8RR78RuSORscOaAwZMJCA1IT9bqBWlFXDvzD8SNEDS5S/BboLl3LDqftxLQpKYiVp20LRqAKaI56HAbLSYAa4U9ksN9GRF7fA0D/JN2ZoooxlOyUjV9n1hi2TOAmnjWcTg2b3IVLngxkZyEdaym6yWE3eB542wmvHOnqoPC+3cfHtusEqK6VsxJe1HRXgekVF/fGGTEh9p8NrFPbuXsZaHpXgf7xNu6ffEr8Ny8zfqmUjgz6Us4bWl4PGr9myvjqJkrO0mmsnqaMFLyMEDIth/Xsv5bZdG+fAyyMAG1qw5rEyRWmJPaiBQqXIKkV0KKMdZrSXsmxC0zG1Ej1Ib1SoXDsfJSQvcfmzDPicro6W6GENMS6L1596heZKA5j3C3isoXdh9p9v3v+Vanb5PXV59x2Wgx6xdgsyuSUcuR1jyw//X378yuhOYm2D2h17t5Oan+O9+SwJK9h82vV9Yj+GEuCNCwab9/K3mEn4yIrEWng0tasagkVBVgKPzcn5Cj1Tghufm03tchvVG2xFA8ms/oXx4iaGb2svdVwRz3jD0j5kOEbUCDBmJD812xSMQwf0I8gkkHh1d/516JwUbDpQErc9jKiFZA0SXjbwLKjypX035D0WwU1xl3i9pME9a2x/v0qiO7WaQXpGmc0NAqqGju1ThNX9pQfEWssKQEatQ3ivQOOq/uzWxqeZIDQJAkqOq8i/qaxPWPsrdrODcvus5FxWKDM= X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(40470700002)(46966006)(36840700001)(7416002)(47076005)(2616005)(426003)(7696005)(356005)(107886003)(316002)(5660300002)(4326008)(110136005)(81166007)(86362001)(70206006)(70586007)(921005)(40460700001)(2906002)(508600001)(36860700001)(8936002)(36756003)(336012)(82310400004)(8676002)(26005)(186003)(83380400001)(83996005)(2101003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2022 13:45:28.5030 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 12c72dca-212f-4fb4-26ce-08d9dc1b1eae X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2997 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Change of_*() functions to device_*() for firmware agnostic usage. This allows to have the smbus_alert interrupt without any changes in the controller drivers using the ACPI table. Signed-off-by: Akhil R Reviewed-by: Andy Shevchenko --- drivers/i2c/i2c-core-base.c | 2 +- drivers/i2c/i2c-core-smbus.c | 10 +++++----- drivers/i2c/i2c-smbus.c | 2 +- include/linux/i2c-smbus.h | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 2c59dd7..32a4526 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -1479,7 +1479,7 @@ static int i2c_register_adapter(struct i2c_adapter *adap) goto out_list; } - res = of_i2c_setup_smbus_alert(adap); + res = i2c_setup_smbus_alert(adap); if (res) goto out_reg; diff --git a/drivers/i2c/i2c-core-smbus.c b/drivers/i2c/i2c-core-smbus.c index e5b2d14..4c24c84 100644 --- a/drivers/i2c/i2c-core-smbus.c +++ b/drivers/i2c/i2c-core-smbus.c @@ -701,13 +701,13 @@ struct i2c_client *i2c_new_smbus_alert_device(struct i2c_adapter *adapter, } EXPORT_SYMBOL_GPL(i2c_new_smbus_alert_device); -#if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_OF) -int of_i2c_setup_smbus_alert(struct i2c_adapter *adapter) +#if IS_ENABLED(CONFIG_I2C_SMBUS) +int i2c_setup_smbus_alert(struct i2c_adapter *adapter) { int irq; - irq = of_property_match_string(adapter->dev.of_node, "interrupt-names", - "smbus_alert"); + irq = device_property_match_string(adapter->dev.parent, "interrupt-names", + "smbus_alert"); if (irq == -EINVAL || irq == -ENODATA) return 0; else if (irq < 0) @@ -715,5 +715,5 @@ int of_i2c_setup_smbus_alert(struct i2c_adapter *adapter) return PTR_ERR_OR_ZERO(i2c_new_smbus_alert_device(adapter, NULL)); } -EXPORT_SYMBOL_GPL(of_i2c_setup_smbus_alert); +EXPORT_SYMBOL_GPL(i2c_setup_smbus_alert); #endif diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c index d3d06e3..fdd6d97 100644 --- a/drivers/i2c/i2c-smbus.c +++ b/drivers/i2c/i2c-smbus.c @@ -128,7 +128,7 @@ static int smbalert_probe(struct i2c_client *ara, if (setup) { irq = setup->irq; } else { - irq = of_irq_get_byname(adapter->dev.of_node, "smbus_alert"); + irq = device_irq_get_byname(adapter->dev.parent, "smbus_alert"); if (irq <= 0) return irq; } diff --git a/include/linux/i2c-smbus.h b/include/linux/i2c-smbus.h index 1ef4218..95cf902 100644 --- a/include/linux/i2c-smbus.h +++ b/include/linux/i2c-smbus.h @@ -30,10 +30,10 @@ struct i2c_client *i2c_new_smbus_alert_device(struct i2c_adapter *adapter, struct i2c_smbus_alert_setup *setup); int i2c_handle_smbus_alert(struct i2c_client *ara); -#if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_OF) -int of_i2c_setup_smbus_alert(struct i2c_adapter *adap); +#if IS_ENABLED(CONFIG_I2C_SMBUS) +int i2c_setup_smbus_alert(struct i2c_adapter *adap); #else -static inline int of_i2c_setup_smbus_alert(struct i2c_adapter *adap) +static inline int i2c_setup_smbus_alert(struct i2c_adapter *adap) { return 0; }