From patchwork Sat Jan 22 11:32:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil R X-Patchwork-Id: 534159 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 7C18AC433EF for ; Sat, 22 Jan 2022 11:33:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234368AbiAVLdV (ORCPT ); Sat, 22 Jan 2022 06:33:21 -0500 Received: from mail-dm6nam11on2073.outbound.protection.outlook.com ([40.107.223.73]:45632 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229678AbiAVLdV (ORCPT ); Sat, 22 Jan 2022 06:33:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q8DdXaTqsnP3TKQXdEWpF/XjILfsIM+aetOU4u0Q30gUke0nPZanyGKrDAghVWlSeojv2QiB5NGrxrtORkKJIkSip+MxfzyWujkXkwugobdgZ7T0chNbx3glXMa8DIBA4rakm8JvT93kmByRAw93mUXOIENs5+QUT55f7GSWA2YKQjV4lXfx0+zXEVmOLP/rWS5u+vjbCjy3UpBm5rhGpuVLGY8OFlxF1Qx2Zm6dcPJtAOtsC0Gan6pCkVrfip/f9LHXsvObaLBLT9TFuDkkpc8ls2S10Z6CalYk2QvepXuQq65E2HSXCM7J4CCXvaTAzQ5UdxgtDufIf5ylbcckQw== 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=hrLUu9G4K7xqSwXLM/W9h8nTno9bSSBpviXglNYTcGE=; b=kffPjPLMR13F9a5YQXNATh/SIzCVNpvMF0gHUt1AVxIRREmMixxzgc7SOdreGnqaeG/pEJ+HrE+NTKmnNliYa8AU69yPubNEfCke8aZhBWNeuiwm4HStuo18kYqvAw/3CIlee4g+MxRrq4OABGFsM7sdF0p8SfLu2tpXUQeoCgPcv8SG81apgjLC0EnmmjyCdzqg80DAg+KHtyYkB6o+r4CVQLiU7g9fQE7+T/Ku+91LmBZ8eoQ5VCizHV5OBaw4pYh3fRGrYPQtlSg6zVhhwmusYmBgcs4SQthUGzw/3gXnncsEIoTt0/jtyamviwc1MVTe2nhe9FC8qQx+c0bEGg== 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=hrLUu9G4K7xqSwXLM/W9h8nTno9bSSBpviXglNYTcGE=; b=FTboXZNfaHnv9uVoorbA8RFLw8Sf3ma1dKflIjnOAyuigymiFuXTg6xG0pRjjnYR0eYUHwTz3Uqp/Gx944x5xyuKIAN7NruaLWYjTiMmp4OIgWuVimgmeaYjNytvoI4AQoVQoXk3XmCnqKJ94nXTsuMmGvzoNUsTpop8hzHiDXzZlbTWIBfnpWPiaCyhBtz491xW5um6QS1fkqPGKHp3FbGwdsEWS/pD13c1mu6gL5oso4Gg5s7M+7jzIl64iAmdqzp+SU/eP6eMOU2BJ/xqpLIovaC0+j7BbQBgNfYwZFqc94Hk4DHlD+3gUZxkizcjuA9/dCiac3NKJPSfZQhPCw== Received: from MW4PR04CA0182.namprd04.prod.outlook.com (2603:10b6:303:86::7) by BL1PR12MB5318.namprd12.prod.outlook.com (2603:10b6:208:31d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Sat, 22 Jan 2022 11:33:17 +0000 Received: from CO1NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::24) by MW4PR04CA0182.outlook.office365.com (2603:10b6:303:86::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.7 via Frontend Transport; Sat, 22 Jan 2022 11:33:16 +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 CO1NAM11FT022.mail.protection.outlook.com (10.13.175.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4909.7 via Frontend Transport; Sat, 22 Jan 2022 11:33:16 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sat, 22 Jan 2022 11:33:14 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Sat, 22 Jan 2022 03:33:13 -0800 Received: from kyarlagadda-linux.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.986.9 via Frontend Transport; Sat, 22 Jan 2022 03:33:09 -0800 From: Akhil R To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v4 1/3] device property: Add fwnode_irq_get_byname Date: Sat, 22 Jan 2022 17:02:44 +0530 Message-ID: <1642851166-27096-2-git-send-email-akhilrajeev@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1642851166-27096-1-git-send-email-akhilrajeev@nvidia.com> References: <1642851166-27096-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: 6ef31eb0-8b0b-4b61-765b-08d9dd9afb78 X-MS-TrafficTypeDiagnostic: BL1PR12MB5318: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: /X71dCDYd+VfpcNWaob96aJzOC+VAf+8zqEkoEGxVp0UqX/Ui6AxKWm0kuO+zuZwTbO1fHymeupGa1XQsZ2jC7ABTYK+oxZ9U+29nVj1OwAan/B4vHuyWBrPEbvgmRsDR0PapSg9/7iXBs49U1fFn986XcHL39JLwKbUYpnfnJ/8nC51fSk+UyGVljPybRyPyaUCErRFPh1kGiplN0YMaeiEj9wH5sjZRR2q5PrMhfC9iOHsHlQua81Sk38j85PAUp59rmlWC6CTewWYe0HEQ8k8D5SJX/kZzuC7ytv7TKKx2wf8GO+iJbeiCGg45EoQ/hZqq77RTUS9avfI4rcB+ZOeb2o9vroX07UfuQt7D++UzeMkoLRo+RoXeSyt/8z006fDYVHK+SQ2QSifIhWDX7QL4P71RqQPL6PPDdVlT/VIkw98GuTsR5WvkSBTyuT4aRCGO5wTfeeThsFEk+jGJfVnOexRdiwGZmL8uwajH/JTk+PkCz2KA2sjd9SC9hdPlxki+onsGwKrwHcOJ4KCGOntXB1+jxYLRJ3tIiFkBE6X3FHponXC8E8dQK5VGUWBVkhlcxU5jK3EfcH8VCOz++kEBQP9DzZnGvMjEc3z3ZKN7HZ7DF6ppRqk+qrEOuvTgWsC226nZOxT8aE2tEWKp3/FMWfeauGij2IpYh5ffNzttM6sKKgIj1Ij8r8w10EiW15Qxiy2bPA3k6+H3FisiP9Ke1sfADCm8/Wwsuk0AxaP8AeEqXONNyALxP6RFx4UpJvVuFw2DBQYw2taVHFUVSL9690OjYxELjIH6j3cCaGOWxf0PSU5js9sQBGxAS16HeuByOgpaBf1I9ZGBC+MsNt8dSnPH9EPZfSkJsy3jDqAt5+ZosR9ac85FEUi2fFzYvcLsKDu8CpP1m+yftjScj2kVuWPvoV477WsG+AOnMw= 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)(107886003)(356005)(47076005)(40460700003)(336012)(2616005)(8676002)(316002)(70586007)(186003)(36756003)(426003)(5660300002)(508600001)(4326008)(921005)(36860700001)(70206006)(7416002)(7696005)(86362001)(82310400004)(110136005)(26005)(6666004)(81166007)(2906002)(8936002)(2101003)(36900700001)(83996005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2022 11:33:16.2220 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6ef31eb0-8b0b-4b61-765b-08d9dd9afb78 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: CO1NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5318 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@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 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 Sat Jan 22 11:32:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil R X-Patchwork-Id: 534357 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 2D5A4C433EF for ; Sat, 22 Jan 2022 11:33:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234419AbiAVLdc (ORCPT ); Sat, 22 Jan 2022 06:33:32 -0500 Received: from mail-mw2nam12on2072.outbound.protection.outlook.com ([40.107.244.72]:35168 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234437AbiAVLdb (ORCPT ); Sat, 22 Jan 2022 06:33:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AbQmUzG1IjWh9G+Palx4ipGABGpeCYgCh+S06xh1v3z2/neBl35NXaBRYN+e0UuZmVpvozgU9PlKOQauGHd4sBMGY+6qMwd1y0TOEttO/fvkaWOaeHYw4LKFGQnKxnV4/vxoalLeadiY7qSL81XD6rGBz2zop0juPkAuuVmJWc1R7UpHODGB4WdjdArvoUZyWd6NO5VIBRBrbOJaw7GOPwy3fPy1TRW2hAuD5mcPBhmImHUzKakCAZquJ+pXnFlfDH2RoNVc4wYxiDlNBsrSPqZztQWFNuhOvatoKJsomxuZkjXh+2FZd/zEBEEmlo9jG9RF5HBCb4zHPq8O75VnGw== 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=AvR3Tzrn79Yyg1oFi2i7R0yaiEiqQw8RUH+AWsjGdQs=; b=m1KCLhrkhZSI6tYqxEbMz9xt7tDgt3uWZt6r9uLf+xHzg2nCWbYwrdfVg2awmGVY5/fNNn/BnnZC+pZv2wdbzejxdei9uduMqpyGHSMglrjeybyi6O3dIVpDmMM0iAZeSApC2XOvWz1KdJhiO4XwvpoddDr+StdWSFddNavSSwuUaJsrHA4LP8JuM2m3ml4sPH76U7mBe/tbFuDvbsjdBwLRy9QxWDMs91eH7syKTxdhnKuwyMt/SW1c18mlUCHITJKN0rsnG5bCMoh/4vqL39oEu+jcsBISJgbmztmQh151MkLViMQegUfSHLWVQk73f/SYNP4Mq2xgd9090e4/MA== 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=AvR3Tzrn79Yyg1oFi2i7R0yaiEiqQw8RUH+AWsjGdQs=; b=j48CvQ8Y2vARWvomicPqgOj59wMYYhgR9m1OETFfsD3TbtVZu9WKiyfEu6yTGIlEpUigVmef4H9HiZQoxwwnB+56MMerPgcHuvpf1oAQfKjPIQK4cuMU4zvH672OzvJvXSNHRE/Rb0lHNHG6SvHfmsA4XxJz1wAalzh2fWh89FpYCBLy2bRPtruh/iQ4GrUod2kfJik7Thok6ON4A8kPUnj08AOhIqpgalWzS9LwRBLSYHvFHXNLDWrMgj9qWZzsk8dMUv6RCXwroRD1ubDs5hxUuUVMEUUsASBBr3JYHeByyhF559lDfvlf1LjN6kreu+Ta1BSwqdLhtOsf+wIt2A== Received: from DM6PR08CA0026.namprd08.prod.outlook.com (2603:10b6:5:80::39) by DM6PR12MB4976.namprd12.prod.outlook.com (2603:10b6:5:1ba::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.7; Sat, 22 Jan 2022 11:33:26 +0000 Received: from DM6NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:5:80:cafe::75) by DM6PR08CA0026.outlook.office365.com (2603:10b6:5:80::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.12 via Frontend Transport; Sat, 22 Jan 2022 11:33:25 +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 DM6NAM11FT026.mail.protection.outlook.com (10.13.172.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4909.7 via Frontend Transport; Sat, 22 Jan 2022 11:33:25 +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; Sat, 22 Jan 2022 11:33:24 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) 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; Sat, 22 Jan 2022 03:33:24 -0800 Received: from kyarlagadda-linux.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.986.9 via Frontend Transport; Sat, 22 Jan 2022 03:33:19 -0800 From: Akhil R To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v4 2/3] docs: firmware-guide: ACPI: Add named interrupt doc Date: Sat, 22 Jan 2022 17:02:45 +0530 Message-ID: <1642851166-27096-3-git-send-email-akhilrajeev@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1642851166-27096-1-git-send-email-akhilrajeev@nvidia.com> References: <1642851166-27096-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: 0123e401-c5e2-4a98-2aad-08d9dd9b011b X-MS-TrafficTypeDiagnostic: DM6PR12MB4976: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: 49eUzkJ8byijPyQM1tIlvQo69gGmKix7xaOVK/uuitvVzhDh11DP90Ax7gsf6f1ZOI/fTGLxTDbvVW741IFl3UOIIFwP80PX3da1C4uKFslCw4KxYkbDL371/G/3Uas6Bn+y3fVqRGs2SCmAD4UmV0m3Yddl+wHZ3Ur/FOozH7kC4qQqQgmxVkEvFjLm4NWL/SJanNmE/zYdN047mOfbZKe+V2RdaY+xsLR0Bz3jrlQDgwrtTUqoG9makRUq2udRnwsA7cRsbK04I63loO9K1U/HAiouocyUh24aK+e01yjBcdOilWTY0rkofplycTYYvYaGaOLwwDeeBVhHYeuHSqxWNKoNra0n6IU2aMB9wwKE2VwemnRtPPdoP+MkBpt8RMYw64Kz1rrCLar9w1EdoopHPphIYwtT+xtnCw7bdSSpqhggi5xtfEFqrgqtgOGaqwqhXZ+Txyzaiboox0ZwpFFAvG6aiifDyCzij+UtyMS71EIetUkB2YIR6xJBjjNh4/9T+ehxnKTj2LMU7j57s0/rc8dd9HqRiIxjPRNSKj/ydz79DsxUDvqQhRCoiRGLH6pfBca472uE29I/UlVYozxj31/tflWNwobuWyJ14erMkRy1He9/6ZN4P622DatCqOC5VI88BoFEnIVRDxN97BGwDSfOFqbZHQiaU7TC4pKZtjIFxwsZw8Y2/NHFmgny020y64xol4yvqXRqTaTpP15E2vkM+4SOCPmYFdes+CJAkH8PFUAoq52xE7sUloox2/F0ylaTscYR4BgFC0YPN+R6Qe13X3MiII2VdOkA0By3SWNpqhy0IsjXLlMAHIPvDrUoOGdSqdN5nbEBMuWT/VUvYppTH7gHMEzElOuDz58= 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:(4636009)(40470700004)(36840700001)(46966006)(83380400001)(36756003)(426003)(356005)(81166007)(2616005)(2906002)(336012)(921005)(47076005)(82310400004)(86362001)(40460700003)(36860700001)(8676002)(6666004)(110136005)(4326008)(316002)(5660300002)(107886003)(7416002)(7696005)(508600001)(70586007)(8936002)(186003)(26005)(70206006)(36900700001)(83996005)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2022 11:33:25.6456 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0123e401-c5e2-4a98-2aad-08d9dd9b011b 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: DM6NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4976 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Add a detailed example of the named interrupts in the ACPI table. Signed-off-by: Akhil R 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 Sat Jan 22 11:32:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil R X-Patchwork-Id: 534158 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 54DF6C433F5 for ; Sat, 22 Jan 2022 11:33:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234453AbiAVLdi (ORCPT ); Sat, 22 Jan 2022 06:33:38 -0500 Received: from mail-bn7nam10on2078.outbound.protection.outlook.com ([40.107.92.78]:2589 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234457AbiAVLdh (ORCPT ); Sat, 22 Jan 2022 06:33:37 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QjKAXTfbVVD96PMW2mB2EbOyNp16U6bFV1L6oqarYhBObfnulgyhqC3hOT4YbcWjsOKfzA6NBNAjaRp2vkHGH8k4KCk2PUehlgghFVNR00s8JUyFd2kbbTVG2tHKOHezfl+HbDc5MdS85jJzbqS22LPdhmoSMjxkq2y1S9dx/Hv3JyjB28ksfW5w2Qm+LdKutkCXOFhSauumXNlqASF5lCIkhr49Z5lpdEfsKrlLuTuniAC0TOrGLPC61p3DThBtm4GoxiitBlGpoG4hSV+YnRnQu/6GfwwSQdkk9nktybjnLIOCcqdVs/SNtDjTTfk52ApRVN/ZnJGQOhJHg5G3yQ== 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=11qrQckzhIflZAPjqm044Qyn1W2pRpQsw8fCA76lbIw=; b=BQdHTun5d88Kn/ca+piUD4+w/BoQYoHjS61KMdoawsjAd5OkRWXaEGPsSyR0mCa29qd3TyWSri3wz7SCNEptfRFYODXZjXUENmTK9Nzx51TnPCuf53Bv/vNJ8sKFSAQoNIRoYgDX0uMrG18GDsNDfclIcKi0QHier8oIwA6E2wsdUckznKhdyKEEfoCRGSYFmYdZDXYldbcARxJsXnW3OtdZcvrEIUvUN3gI/C+qDaxed10ZfwSC3puyM1Vsx1vVsnDvyBfjPmVWAIulMrnherAJPSgNe7ehAFF4RDPnpI4KZO5xPTHyd6V/I8mKWbKGDVk0RzinYkJaU7EuJIt0hA== 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=11qrQckzhIflZAPjqm044Qyn1W2pRpQsw8fCA76lbIw=; b=BdQqF0lev07fCKBa7HDxlDYzd6CmGtCS2T+bQ8HFJ2gfY5curPxHV9UinXdJTHYVVHgmH+kiiIS+meWeSEQkJiS2aWJW+Srh3UxvbFkRs+lgUKjJ2FO0wpeYk2dDJTTLd0ZFNRf1d8BhZtENLzpbkTsdzZ5sMbfcyk9n4J93J8136A2JXbqZCtw0uQBB92g5ulw7V5XZa2J1shpV2S98ts9/HB9dc+KtaYBIp+jzuDMgT5aiifXsS+ywFxRHtlSsxV16ewDpY8MlggGVFU6WJSlbpro89fJ9oCOV677Hu3ctmf0NVInhcqNVIRdcIGFUNXOX3EV9bMfougDyiZDADA== Received: from CO2PR06CA0065.namprd06.prod.outlook.com (2603:10b6:104:3::23) by DM6PR12MB3642.namprd12.prod.outlook.com (2603:10b6:5:11f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.12; Sat, 22 Jan 2022 11:33:35 +0000 Received: from CO1NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:104:3:cafe::99) by CO2PR06CA0065.outlook.office365.com (2603:10b6:104:3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.8 via Frontend Transport; Sat, 22 Jan 2022 11:33: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 CO1NAM11FT016.mail.protection.outlook.com (10.13.175.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4909.7 via Frontend Transport; Sat, 22 Jan 2022 11:33:34 +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; Sat, 22 Jan 2022 11:33:33 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) 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; Sat, 22 Jan 2022 03:33:32 -0800 Received: from kyarlagadda-linux.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.986.9 via Frontend Transport; Sat, 22 Jan 2022 03:33:28 -0800 From: Akhil R To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v4 3/3] i2c: smbus: Use device_*() functions instead of of_*() Date: Sat, 22 Jan 2022 17:02:46 +0530 Message-ID: <1642851166-27096-4-git-send-email-akhilrajeev@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1642851166-27096-1-git-send-email-akhilrajeev@nvidia.com> References: <1642851166-27096-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: 159b8330-2e91-4018-58f8-08d9dd9b0697 X-MS-TrafficTypeDiagnostic: DM6PR12MB3642: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: PyjYT01/jusPqKI0Lnab9AGTZ+eLR2Xb4E/SJyTMl3kqu18WqEhmrGAk5IklUVmORRc7pPghw+h+9nS7ANtrH90zbZawZUPmQo6I+mOueByV6l1OHCBm4xbiIAUzXBxQodYYnmeMqV1TdYL7yC8UvTezGBG6U67PfksDlji9mZEQA4fCbCR6K+pLsoCg86ztcDQPwT/6J0HamZodqU8cTHsXxuFGH8lOljhkEsUs47fsp8OlebAMULRRoUCSWspz4L3y9NuXWLK2CsG3Hcp8LfUo5TN/zuusesnpP7svNnx4VV6M9dDOd/c8aTwszgNJS1l+bWb6NkV85fZ+4Z4LJRn8gVkwtlUWXB5HZl2K8Sj/DAAluva4jlpQQBxgTEzr8oh0pe07PT6c8gNg9OdoC/9oofIzTANOEYxwyGarKEd4hgqheYbu718J5FGaCoTSLtuh2nzgF3OvlmYs6DC0C1sXApp1swuknSdxfKLyp2QfX3qM9tu2UrysubBcRQqv6x2rMsZKTR/Elu1wZT7XAkQW7lhcEGRwafoYi4lDgQb6F+uTAv3dtP8wkNi6EPNkMtVsrFh6LFcYuKlYANGoc5m9wxohdleXa7aA+yPYGssrKSKmp/sMYtXy/CjDNTxFmQ7bq5qlNf/3r/FuspOpdQMlZXcuGd893bFpKWxhbdCk4PEedG0XiR3j01vWyVx4ALDjOyhRTEhQ1Sxi/qZuh+jt/em6Tc1ZzycVTZ3OE82SuBZATACgFi/nQNqwfdJ+O1zqAQErF02+DX5NNorkpKLT6HkVxhUhf03NMovQsdDXNdoqauQmOjrJIAhSkmL/BY81tdo+6TZWDJSGbI8BH9MyWrJDOMYDK+2E1YeGmuQ= 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)(40470700004)(36840700001)(46966006)(82310400004)(316002)(4326008)(336012)(5660300002)(107886003)(40460700003)(8936002)(2906002)(81166007)(356005)(26005)(508600001)(70206006)(70586007)(6666004)(110136005)(186003)(7416002)(426003)(36756003)(83380400001)(2616005)(7696005)(36860700001)(47076005)(921005)(8676002)(86362001)(83996005)(36900700001)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2022 11:33:34.8637 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 159b8330-2e91-4018-58f8-08d9dd9b0697 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: CO1NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3642 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@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 | 3 ++- include/linux/i2c-smbus.h | 6 +++--- 4 files changed, 11 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..026e2355 100644 --- a/drivers/i2c/i2c-smbus.c +++ b/drivers/i2c/i2c-smbus.c @@ -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; }