From patchwork Fri Jan 28 11:44:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil R X-Patchwork-Id: 537640 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 7001FC433F5 for ; Fri, 28 Jan 2022 11:45:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244391AbiA1LpH (ORCPT ); Fri, 28 Jan 2022 06:45:07 -0500 Received: from mail-mw2nam12on2069.outbound.protection.outlook.com ([40.107.244.69]:59744 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S244361AbiA1LpG (ORCPT ); Fri, 28 Jan 2022 06:45:06 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=coyS1Imvodss8A0sXWrOP/5V6Bs7aGRpw8Q3U+6sipR94YU1DKbza6PcSraSaOq735ESFMUMtBf3fe61ZO2oGhnomo9WNfmp84ZhtvTaDm9vTTVJzuqq0is7DweH8qSlEJXeqS9G9SlrCvdmj5XHYtDGzhOHqErEl4/aB1C37KdQzGMm3eTzJEHDYaAjKZQxcJTFPyvm72yvjtmyXBklayqtSOuAu5buYMKtiBrVuoOOTUGiTjQeJrk3RuOWi04nRBoxq5xZIQIFx1BL0zw1vIN+0oXmxRdmHP9IfjkK1lZmM8/6cVmZRECZTLG1vmUQdup1z9F3Gs+4kfGtSklpYA== 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=2GLbKgWihjD5+WOrSEYy6jPjAmaaDcJ4cD5mFgqEwyY=; b=b5gdAH6OQqWmJe6v4j1EP3DLiCO3mhaCJIbEAtfcUSgwf21FRuSmWObzbyn8LERK/M1C3T2LtSeXYm9J8qTD1ijLRtfBCiE0vTCWrGKrAKpjPbPlJV4dXRwyKU4rS1+uj01cFQ+QZatS05sobv3mvmrRrDVmP1SY+IHk1gUbpMTfyII+Z/JlaU3SrHWbQ0Zx3h73ohdfaDL9cALxwK2IQe6hKlopey5nDamovzZLD7XrfmvqA/g2YgGw5UPpbJWLLtKbSIUmIlYV9ISE7a8YGk8a22W1PtaNSzzfgysm0WpQnDjvo/uQ93DffM5s2pCQTIDfwU+BVyWtF+AQMDHcqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=linuxfoundation.org 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=2GLbKgWihjD5+WOrSEYy6jPjAmaaDcJ4cD5mFgqEwyY=; b=KA9a+iZKhL2z+9917N0wWI0/YpGp1wXeVczGRgpm0iD4Tt2cX7/ihl9crYlSAxmfVAqxVU4BnkG5GwtbmUvOXDFwGqZ8Fcvk5kgw1s/ac/x7B5y/a/6AX6mCogvvIMhmFDj9OirBWG88rU3ZzI9+ar7oSHW+HkhScJ1HAzFKEP7fUqJqUAF618NjOTCIEsPRdRHUySAYIsdc1tZNYGl4I6s8v7FCrrY6NSBChqfiUD9zL9avrgQFiwWHQHNQb5n1YUOEGRp+oVYGH2nTEwqXbu3LVYCG3HLf1xjSRe1o8c7azmcbw5axFjFn1Uw8ZeeKVXY3/PvdZyGHzQseUUGhLQ== Received: from BN0PR02CA0028.namprd02.prod.outlook.com (2603:10b6:408:e4::33) by DM6PR12MB5551.namprd12.prod.outlook.com (2603:10b6:5:1bc::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.18; Fri, 28 Jan 2022 11:45:05 +0000 Received: from BN8NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e4:cafe::58) by BN0PR02CA0028.outlook.office365.com (2603:10b6:408:e4::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15 via Frontend Transport; Fri, 28 Jan 2022 11:45:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by BN8NAM11FT048.mail.protection.outlook.com (10.13.177.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4930.15 via Frontend Transport; Fri, 28 Jan 2022 11:45:04 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 28 Jan 2022 11:45:03 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Fri, 28 Jan 2022 03:45:02 -0800 Received: from kyarlagadda-linux.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.9 via Frontend Transport; Fri, 28 Jan 2022 03:44:58 -0800 From: Akhil R To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v5 1/3] device property: Add fwnode_irq_get_byname Date: Fri, 28 Jan 2022 17:14:25 +0530 Message-ID: <1643370267-31804-2-git-send-email-akhilrajeev@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1643370267-31804-1-git-send-email-akhilrajeev@nvidia.com> References: <1643370267-31804-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: 0ef56112-9f6a-471b-797a-08d9e2539ff3 X-MS-TrafficTypeDiagnostic: DM6PR12MB5551:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gHgSkN+MZ+LP9IrUi6VwGhAtTNYUFWlCAMlXHnbo9CXFyub9oq/ocOVOr2RAFzZ0n/C8EdIwsQC5HkTMFVrvDPGls3xJa3Kyhq7B3dwEL0tMGrqLTh7omC+8tMxwasQrGq2zuBftzj35O74c5/UzQ4FmIdQzN4o+9sjkn8DKt0lE1aTcbwt3lsESU5Ig+LCR6XOA9kgVdChEB66oIbpTdBcwDADp5r89XBRdgScXNj5al9b4IRnVIhnvIqPqzB+ThGlVQQCbLJGKKTBLP2Izs6HOFpRjDIZMTJuTJeWOn04buDY4xR+vgLlovOsJRXLsjuDICKTQSSxn49r1KYKHcVHUpNEfe7VVk0qWewcdUWIsgO3J7KnWOqEOk6+AvaywQjumAxE7DqTiIcyvKQKUwIDuJbk4A4Wmc/bYc82JL+YglADD34qE5fma3lwk4GJRGc2iVMWuW89EUvyN7kDEp5vCmfZ1GGKgqwWVD1vHEZSdDfyBUYu2ZJa4UKIj9AMtD33tUYaB1ONDHd2wIsxcRckxNegk4ox7WOKYDGXMrHHuWZJz9//IN9R/9ti18gibbn8TCznXHe0S/eVCLvWzJcPrlSuQcD051Jx0Q1yn4f4UKVcFoRvivXEzGkujd6gFvrW0ci5WMOztLjUK57570LKhjQw7GQMlAu3ruP92C313MRKYMNG+JIU+x3In7ZNPbdxtG/XTQoPjiOQbP9JmwNziDhaHoxb/vyVSl/C79Q01QYtNm/eeK7wB27gKJ+1JyygcXlwyAgFuFibNrnxCjw== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(70586007)(70206006)(336012)(8936002)(82310400004)(426003)(4326008)(8676002)(356005)(40460700003)(86362001)(7416002)(5660300002)(7696005)(107886003)(36860700001)(26005)(921005)(186003)(6666004)(2906002)(2616005)(508600001)(36756003)(47076005)(81166007)(110136005)(316002)(2101003)(36900700001)(83996005)(20210929001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jan 2022 11:45:04.1613 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0ef56112-9f6a-471b-797a-08d9e2539ff3 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.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5551 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Add fwnode_irq_get_byname() to get an interrupt by name from either ACPI table or Device Tree, whichever is used for enumeration. In the ACPI case, this allow us 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 Reviewed-by: Andy Shevchenko Acked-by: Rafael J. Wysocki --- drivers/base/property.c | 29 +++++++++++++++++++++++++++++ include/linux/property.h | 1 + 2 files changed, 30 insertions(+) diff --git a/drivers/base/property.c b/drivers/base/property.c index e6497f6..fc59e0f 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -936,6 +936,35 @@ 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, or 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); + +/** * 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..95d56a5 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -121,6 +121,7 @@ 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); void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index); From patchwork Fri Jan 28 11:44:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil R X-Patchwork-Id: 537639 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 610C3C4332F for ; Fri, 28 Jan 2022 11:45:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348195AbiA1Lpi (ORCPT ); Fri, 28 Jan 2022 06:45:38 -0500 Received: from mail-bn8nam11on2067.outbound.protection.outlook.com ([40.107.236.67]:41121 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1348197AbiA1Lpi (ORCPT ); Fri, 28 Jan 2022 06:45:38 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LrpyFs9N+3xCLMvXP752xy/+MXFygvLHMvIEV1is0X/nVEVaY2stjf5xO7OasWaKT8SprnRrOWYn7coNsdE0m3/HicHMmlvt1lDmPZmOpYk+3GfMuc+wQ48OY9OLof8WEl5MpaYietD13XFxPH4g6R7nPt1D8TjdgjPYqvkl+ToX6QR32a1pREt2TxUUf5/HOoKbadH+FR1zLJIgUSBS7SdaIPNMAIJ9tUY80sNCzzlvHw9c/b2tHchRo8cHg8GHV1JG7xZqKCoZTx8staAJFbk+yZvdWKN49RqNMfON74u8xQF8Cj0OY/sP52pktYf0KfOj6UDAnesEXtrzAhdEcg== 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=Il1onWCe45cu/Iq5BB2lH9BExeI6PjHra8tQyzlLeho=; b=C5cz9Ex/dYtAajl1deG5JYuYiD51fjCkhipraNhdNFSNvTQGgSPX9RZXGEkILXsdpR4SxEzmcmnxQ4VHWHq7BlZ17gAL+6a8C7t5L2AzyircBA6exD4H5s7+prHCA6IDAq+Bq3S6Em0y8w2YMlRPHOCkLdqsZE4sOuG9qtyajW02wQSMzIwApAeW/kRpLj8tbzQ3HE5fnBRFKkQpEDuNKB1NK30/FY5C/Z84Zsr45DFhDOirprciY/5dyaZ/yBh4ZissLVKfQ2IhshYS0/HH2VztiTQwQm0I4HubQfxgdvMw0VeoYDT2Uala2DdJD1SH2YiYEEuBW+lrGaRV7VcLqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=linuxfoundation.org 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=Il1onWCe45cu/Iq5BB2lH9BExeI6PjHra8tQyzlLeho=; b=sqN2ZoJIEvpFTgtb0IPS5G8xRtHlPE454mqnfHMwunnRuJhof8XHtPw4otMgXz6nT2B9F0BFNsi3gL+6DfNNhmEhxmylDzkzgEwBKVJUncxTxq7HFbls9yqVmHfKSp7dLphT14FLq6nhVUdGu0ZvZ+KWzizbVofcimPe9jxvs53HK1pHytcIHuDTyZ57M2d3IZY59JqA4B5hXDgXrAp4x9j+NfbWb9TOxdUZwSjPT71xCOpJ6UNu6xofFJiKkbeosbAooXDsmU+sG+b7Z4ps9bjd+FwZZRu6Ikupp7+VGlgaFMbwnNvRVIOIQ7Qwh3hJAmC6+JL9uORvGmWwLg6r/g== Received: from DM5PR19CA0066.namprd19.prod.outlook.com (2603:10b6:3:116::28) by SN6PR12MB4767.namprd12.prod.outlook.com (2603:10b6:805:e5::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.13; Fri, 28 Jan 2022 11:45:35 +0000 Received: from DM6NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:3:116:cafe::a6) by DM5PR19CA0066.outlook.office365.com (2603:10b6:3:116::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.17 via Frontend Transport; Fri, 28 Jan 2022 11:45:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) 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.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by DM6NAM11FT065.mail.protection.outlook.com (10.13.172.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4930.15 via Frontend Transport; Fri, 28 Jan 2022 11:45:35 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 28 Jan 2022 11:45:13 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Fri, 28 Jan 2022 03:45:13 -0800 Received: from kyarlagadda-linux.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.9 via Frontend Transport; Fri, 28 Jan 2022 03:45:08 -0800 From: Akhil R To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v5 2/3] docs: firmware-guide: ACPI: Add named interrupt doc Date: Fri, 28 Jan 2022 17:14:26 +0530 Message-ID: <1643370267-31804-3-git-send-email-akhilrajeev@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1643370267-31804-1-git-send-email-akhilrajeev@nvidia.com> References: <1643370267-31804-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: 34509184-385b-4808-9f93-08d9e253b2b9 X-MS-TrafficTypeDiagnostic: SN6PR12MB4767:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G+T0dZePBHbNas5sz2KosCINUHVc3Xr/U/lujFyl74QzjmsUrnNRf/kz7mxRkR5pWFj3aBLBLlWwVvDvP9xoLw8YAl40Vlv93CpfMFERsihEkmbVHknHminzDnVah539ghTi+S2phBjeXPOzdrlphCK0WSp7UBnJru5GPtUhSMdhB+IvkDe0b6pYDvOtAmb0sAL7fsITFrIKMZJzmu5dZ5Z8AXRf+er9VevBggXARGhlOqBwXmAECQ0IUD68jpOtP3LefJC/Ufb4osT4KRYgb8TofGsISFOgYko1K1pKIN+bLWXyffSb4K3dD0gXrNYGbeJUcQ67B44xfJCA1MWi8gPsoNmqxaU26PkGnCgv7d1iqA1/DMfDhxVHadIK1YTIsXkzObfKR5DGQNhG+TAs8/BUmYUt8XxSan0o2xYKRslksAtYdo8EBy+JoW39jka+De+xk0U/YFHjiUUQeQxNYw+CmGlLrQ1BwWxfZ4mV0AWpjm8wR0NKyxL9uzZ+ppEBlkQrfF2MqikUDivNuX7WqckxZRJeCI8RTWSdXrg/aNAcxxQqhWFDO5GcVZfj2Q7YTzSkwzBWEd30fzawxtBJ+9FF93Dt1mDDLtVebJqvy4V5QQF0w6i6b7vMpoOBgLLLMcrtT/AV9O2eWN2TeonIRQ7yrG/d/IFp5IRK9q2rlxvPK0YL9VBli4ZlEYcye/+m8BA01D8YhYUUtjnQWD8GqWZgnmkl5rk8RITAmfl6r8uzyfJ6EbAE5Ic97INJHvtHpZTwO74Brd6o57nvELDkZUdgAf+X6ls4gygxSd8MFnHsi/lvc/Qn/BK4s0pxEgseU3z1rnrPruYDM6GQ+CkXlNRn3k4MROv67yB1UY3pecg= X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(46966006)(40470700004)(36840700001)(336012)(921005)(40460700003)(82310400004)(81166007)(107886003)(356005)(110136005)(70586007)(8676002)(70206006)(8936002)(5660300002)(47076005)(2906002)(316002)(26005)(7416002)(508600001)(83380400001)(2616005)(186003)(7696005)(4326008)(36860700001)(6666004)(36756003)(86362001)(426003)(36900700001)(83996005)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jan 2022 11:45:35.6902 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34509184-385b-4808-9f93-08d9e253b2b9 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.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB4767 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Add a detailed example of the named interrupts in the ACPI table. Signed-off-by: Akhil R Reviewed-by: Andy Shevchenko Acked-by: Rafael J. Wysocki --- Documentation/firmware-guide/acpi/enumeration.rst | 39 +++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Documentation/firmware-guide/acpi/enumeration.rst b/Documentation/firmware-guide/acpi/enumeration.rst index 74b830b2..d002256 100644 --- a/Documentation/firmware-guide/acpi/enumeration.rst +++ b/Documentation/firmware-guide/acpi/enumeration.rst @@ -143,6 +143,45 @@ 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. Note that only the Interrupt() resource +is mapped and not GpioInt() or similar. + +The driver can call the function - fwnode_irq_get_byname() with the fwnode +and interrupt name as arguments to get the corresponding IRQ number. + SPI serial bus support ====================== From patchwork Fri Jan 28 11:44:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil R X-Patchwork-Id: 537966 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 4E076C433F5 for ; Fri, 28 Jan 2022 11:45:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348173AbiA1Lpc (ORCPT ); Fri, 28 Jan 2022 06:45:32 -0500 Received: from mail-dm6nam10on2085.outbound.protection.outlook.com ([40.107.93.85]:64129 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1348163AbiA1Lpb (ORCPT ); Fri, 28 Jan 2022 06:45:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=evMm25y6gsJyu1NeBRlE4LchYq6zDUQnUS85XgGqD14Xd9iYCkGM2l6QJ7kiDNTxu0P9DgMtTDxMSgaHJBdYcT1QYuSBZM8WFN8BcoTJgU0wDIxzkelsJUwULHoarJGN8RmXB/nHE7c0tBE4f4eh2eAKzS2Wj4oHmTXM0K6IdfDc19+FIwIAeGX5NrnhO430zw8wC0pLf4pe1pPTfblbyI9brEls5p+3YM3zxZsxW98Lx8FRhP+di2zh5WLnB2IEKpJlK8aoW0fjwxsPCEvjMWbqG3JbnVrMAqo5FDK6gREhlScVIPUsAKKGIPOY7ZdD6KZLWVynxTyiqw8y4A/PLw== 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=i5vYvKR5djdhNBCA+9M2bxCJI48EQzU4z4Z4raHAYB8=; b=lPNwFLPyi2dkQhv66BZll9yXfdS0hLj1+RhygXiqI1AL1GFY06NyTYAHUygViRO5g/3l8Vmva7SwRvF7nkF+VPwnarU9FUneDICYT07U/the4RhIsAp+GUnMJ4CP+vKHFr0mkBYj9vAgIxyLwAv5q4pxp7FzFXXAVXjCl7MAYkZE2smkwDjUZKqiwsthGuvpcCzYRVFNN4h/mVkdGT0pRq7pJvCYBXdqGTyl+/MO0JpgiHTPEP99v8QRijQLt0NGsSayqQpwOsOmcM4UB4tryZAq78abwYeJG505LxKLeFyCwSaIpPIFXNPcSKEv58NhZDxRNITEMcv2ibUQ0lZMOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=linuxfoundation.org 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=i5vYvKR5djdhNBCA+9M2bxCJI48EQzU4z4Z4raHAYB8=; b=nhYyUT5+hPppf3/a5hUW6/90YtUTEOrK2rCUmup9QXKIvO7vfft0R8Z8E/q+wYblWSZ/ks4Apnx8B9hAhKTE8lYYiaigQN2uOkUYCauFIgNklQA+scw83BJJeTopNr410urToH5h/CBkQCNdNxgPR5orGQAXkoqLKPEd/9g5gBn7G4mkXodUYcv3Rs4r1AVcfFKQrcJ7fd/JlREO1vpF9NTko5RAYdNLbDZdLy+eK+ZUL9KZzDYo12oWANmsQc48XsDgCzOoQnt2aBwhFnA+4ighz8+5PyjdjMEMirYdhNyX95fU6fUh3Agga2E7qMj/2m5fRo27cqtfUTfWBKoN/w== Received: from DM5PR07CA0100.namprd07.prod.outlook.com (2603:10b6:4:ae::29) by MN2PR12MB3613.namprd12.prod.outlook.com (2603:10b6:208:c1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.17; Fri, 28 Jan 2022 11:45:29 +0000 Received: from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:4:ae:cafe::69) by DM5PR07CA0100.outlook.office365.com (2603:10b6:4:ae::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15 via Frontend Transport; Fri, 28 Jan 2022 11:45:29 +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 DM6NAM11FT024.mail.protection.outlook.com (10.13.172.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4930.15 via Frontend Transport; Fri, 28 Jan 2022 11:45:28 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 28 Jan 2022 11:45:26 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Fri, 28 Jan 2022 03:45:26 -0800 Received: from kyarlagadda-linux.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.9 via Frontend Transport; Fri, 28 Jan 2022 03:45:21 -0800 From: Akhil R To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v5 3/3] i2c: smbus: Use device_*() functions instead of of_*() Date: Fri, 28 Jan 2022 17:14:27 +0530 Message-ID: <1643370267-31804-4-git-send-email-akhilrajeev@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1643370267-31804-1-git-send-email-akhilrajeev@nvidia.com> References: <1643370267-31804-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: 29e0ee5e-1636-4340-69e2-08d9e253ae65 X-MS-TrafficTypeDiagnostic: MN2PR12MB3613: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: AkdszMIJsoo0NX+mRQtPb0XkWyJpkLXWth5dU0jAcLn+M8jpRAa35Ev/1s5IAUxnn0aYKN9dJIw30guiUYwC1vAZag1upZnnEfAnZrORPpdghEbd3zpxlLkG8X5eU9tEbAahIlu4DMmFo26kENsPOitHbwXPSVsj64vGZcS6qx7yfmYPRu72B9xM3wrb+bm6FtE4j0QZ0Is4AhdbNB0IiOrT5kSJUAbdAyiPHPjDZRy2gjb2K8kMYcOk2IHljN/mtaYPMw7iBOXoyv1ngbHEAXPxqvu0QWQudavxfLcfQAq/EutaMtNW+3zWRvXPWC25YjFycEXZ08oOt8+sDrg6JyGvaEGKnj6rBNNyjbbAA/CjNKHmNJFCBlWObVtIXr4tqsmaCgUXcTfo2mUqLzyier3Yc/FjU+a2eQ4BLO3vKg90VF7ehEST578kngfjyYJ/tirUjq7hxfZ+qAF0u53KcPKX5eYWAf6KF9fO4V0aH8w3JUPBcibZTJW9KlJHFj/6XEovNirdC67o8qi0of04PzrbHAkuaA4CCVzSpWOXcM7ji+yoYQ62tvxpkWqtPWkfzIA+rompNpSyYbCkK/J9+1mdJtlFjtv75QhTyhFrkje+ROQqwlkXLXF3NZQff5XM/92M30LVuX43TD0neEAH/yxadXj2r+ozc/RHa15gPoIERiKtHAn1xsQCBzpo/RCI3fjKaaVR4U5OltpMlaLC7l56nXxvifJW2qLhohVA287OLMi2vNSVRTS/q1UI5b7g59rSrHxZM8HgmfytdY6X9w== 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:(13230001)(4636009)(46966006)(40470700004)(36840700001)(2906002)(7696005)(40460700003)(110136005)(186003)(107886003)(26005)(508600001)(36756003)(316002)(2616005)(36860700001)(86362001)(83380400001)(426003)(336012)(70206006)(70586007)(82310400004)(4326008)(8676002)(8936002)(81166007)(47076005)(921005)(7416002)(356005)(5660300002)(2101003)(83996005)(36900700001)(20210929001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jan 2022 11:45:28.4430 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 29e0ee5e-1636-4340-69e2-08d9e253ae65 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: DM6NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3613 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 | 11 ++++++----- drivers/i2c/i2c-smbus.c | 5 +++-- include/linux/i2c-smbus.h | 6 +++--- 4 files changed, 13 insertions(+), 11 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..304c2c8 100644 --- a/drivers/i2c/i2c-core-smbus.c +++ b/drivers/i2c/i2c-core-smbus.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "i2c-core.h" @@ -701,13 +702,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 +716,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..7753329 100644 --- a/drivers/i2c/i2c-smbus.c +++ b/drivers/i2c/i2c-smbus.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include @@ -128,7 +128,8 @@ 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 = fwnode_irq_get_byname(dev_fwnode(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; }