From patchwork Wed Aug 16 13:58:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asmaa Mnebhi X-Patchwork-Id: 714185 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 210ECC41513 for ; Wed, 16 Aug 2023 13:59:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238955AbjHPN7J (ORCPT ); Wed, 16 Aug 2023 09:59:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245747AbjHPN67 (ORCPT ); Wed, 16 Aug 2023 09:58:59 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2072.outbound.protection.outlook.com [40.107.96.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85DB82706; Wed, 16 Aug 2023 06:58:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NzEltcxJWiz1PCWktKd1YY/uYG/GkIjyMRnwtMsjNPDb5eYEBiKI7v3LNCi/PwLDVtj3hCciPQoNv8sf+HQzbbKk9qufbMZJzyYpO8jc/N4e/RRNXgfAX/164Cdp0jTk3BQAOwO2zPQtcy2QE52lSGnzzH27vRxScDSSan8uCPhpClJXjcTpUoUf3nlYbghYAs0T2eqpfMXnpSyaOckhEJLL8FxjVEqw8LQHZhokB7P7f0yT7up/fueeS0cJa/Ho5Tbm6DsxPuiSgGFm5c3IMaQUm/6M03RoeEydferhbEKlLuQQBpNFCN7HhySJU8qFfE5vs5sOabXvEngsIMklSw== 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=azWKRJweerTVUH5GyahUtkzx+CcM76TsKBrPYtpBQNQ=; b=cXNBZ66RvWGEvfuvR/BLdV2MHz+/OYrm+WNjBODv06gTwdCX0iIlC1MXnGyFOH/SBCprrt3NSIO54cNWZiTE6JGWPeIne2/BqSQwoQCZYidsLNXEGvgd4iuHG7PHJAiEcE5Jm10aSBgsu+2zAAVlnfP+2PKyZJOha4q4aVFXsPHM4T1yYAI4PJz14pAU1nTZzCNP35IDXULR7i1R+rs3dt2d411mkzRNG+iVR+NMnRVl795utfWenQf8Xy0avRDpLSNTNt0dEOBrMfv4CZvEoc0Zhoz6jfGgfjTkriTDdKn4eDjlzE6+kVx3zTUYRb+8/BJsB6648D5Wrc283POrUQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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=azWKRJweerTVUH5GyahUtkzx+CcM76TsKBrPYtpBQNQ=; b=pvEnhVXn2e1/INcVGOHSi38DZEMwUNNbfpX373YtNxnByta1j8dVdVPxIRgrwhU5Fi+RRXX1Ppq4TwHe4Z/zhUHOw8P0+JRDCVRJQohsKHaOgxBvEz6Ptm2R+/7bI44EB2UPlgnIVjM9tJ5IomypHjqbuJIYln7TvRDZPEDTLUojdYIXSRRHxKYemm2x+0xj/WMIBP1EZKOIeVRBsNLXIKUSssVC7ns/hOXAhHl/e6vaApl8ITX6qiWdJT7Q1akMbkoOO3zqHBMd8QfjtsVZErDI/SGgxwHvpXNst92k9nsH8Ia7KZMCFqryND5DEAauxM6inuAis5Rs2S4euc4iBw== Received: from BN6PR17CA0043.namprd17.prod.outlook.com (2603:10b6:405:75::32) by SJ0PR12MB5633.namprd12.prod.outlook.com (2603:10b6:a03:428::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Wed, 16 Aug 2023 13:58:56 +0000 Received: from SN1PEPF0002636A.namprd02.prod.outlook.com (2603:10b6:405:75:cafe::c2) by BN6PR17CA0043.outlook.office365.com (2603:10b6:405:75::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.14 via Frontend Transport; Wed, 16 Aug 2023 13:58:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by SN1PEPF0002636A.mail.protection.outlook.com (10.167.241.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.14 via Frontend Transport; Wed, 16 Aug 2023 13:58:56 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 16 Aug 2023 06:58:45 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) 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.37; Wed, 16 Aug 2023 06:58:44 -0700 Received: from vdi.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Wed, 16 Aug 2023 06:58:43 -0700 From: Asmaa Mnebhi To: , , , , , CC: Asmaa Mnebhi Subject: [PATCH v1 1/2] pinctrl: mlxbf3: Remove gpio_disable_free() Date: Wed, 16 Aug 2023 09:58:38 -0400 Message-ID: <20230816135839.24011-2-asmaa@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20230816135839.24011-1-asmaa@nvidia.com> References: <20230816135839.24011-1-asmaa@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636A:EE_|SJ0PR12MB5633:EE_ X-MS-Office365-Filtering-Correlation-Id: ed603f14-fbe2-4f51-3dac-08db9e60eed4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PdOF9YIRKhdmTgjmMHf0wR2wuMdfq1jmzQCuGCS55bp/oPMNBariHVgUW9SvpcSbqQN6LW9iff5hYtQMYfc3G2jAAd010CUsyxqUe8wBAUb68GPYbDZqms7XruEwc/AV3ddZBpFr1PogD+101teLgv4wiIUPrB5EYdpa38DkgUbvk64ChDgH9a2f6pRrGQnrV0l2ABRTccm4cv0kwuBA3epFzvpKOzW0fiObRGam3twhz8GLKG5Yd0dzlmOGHUtIlXsMqqS4Oa4Hw7slMqYKDh52rvKqyVCXnzislacUYrNgPZ1tjQc7aamfx4YqkN+F7y5pf588ka4YzfwOnuZHMpjTs93DV668ov/iNzYH6fpG2DPC9LkgWY5zMWBxg5c3HJg3y3unTVQ9ce1fdhbieJy3Wnoz64Fz45NGsyiRiXedHlViscoBWshPwQq9CDunAOaMOXei+rPCfXMOv3i3Cr/RudAomVW1kUKPRJD06DMoa/P2q3NwVq4ZLYfa0HGliTXWnQDDqOkRqZypPksik7TxsPbuLYJCS1RVfDjyNpT7X1/luVppzGrD4cBr7XryyLgfP87Lf0hFt7KbpVMTyiV9u6pfVIvazkP/4G84jlA1nU4s4RifcTYFwF655VsJZYDwfZhG995GdFJTgeoUcBKPUK+DQQwf2Ffh1oTfp0DWvXA2D3LSMpshih0mPlJaG97DznSXrNGDJh23hr6Lip2srebtRhjN4QpDXtoY5NcnlwmIDlJAqRHhZeWdUzOnd+yBxQjBpqDy5jI9fyLOvw== X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(396003)(39860400002)(346002)(376002)(136003)(1800799009)(451199024)(186009)(82310400011)(46966006)(36840700001)(40470700004)(7636003)(316002)(356005)(82740400003)(110136005)(70586007)(70206006)(36860700001)(41300700001)(5660300002)(47076005)(8676002)(4326008)(8936002)(2906002)(40460700003)(83380400001)(26005)(40480700001)(478600001)(426003)(336012)(86362001)(107886003)(7696005)(36756003)(6666004)(1076003)(2616005)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2023 13:58:56.2742 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed603f14-fbe2-4f51-3dac-08db9e60eed4 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002636A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB5633 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Remove support for gpio_disable_free() because it is called when the libgpiod command "gpiset" is invoked. This gives the GPIO control back to hardware which cancels out the effort to set the GPIO value. Reminder of the code flow to change a GPIO value from software: 1) All GPIOs are controlled by hardware by default 2) To change the GPIO value, enable software control via a mux. 3) Once software has control over the GPIO pin, the gpio-mlxbf3 driver will be able to change the direction and value of the GPIO. When the user runs "gpioset gpiochip0 0=0" for example, the gpio pin value should change from 1 to 0. In this case, mlxbf3_gpio_request_enable() is called via gpiochip_generic_request(). The latter switches GPIO control from hardware to software. Then the GPIO value is changed from 1 to 0. However, gpio_disable_free() is also called which changes control back to hardware which changes the GPIO value back to 1. Fixes: d11f932808d ("pinctrl: mlxbf3: Add pinctrl driver support") Signed-off-by: Asmaa Mnebhi --- drivers/pinctrl/pinctrl-mlxbf3.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/pinctrl/pinctrl-mlxbf3.c b/drivers/pinctrl/pinctrl-mlxbf3.c index d9944e6a0af9..0e852a0d5ec2 100644 --- a/drivers/pinctrl/pinctrl-mlxbf3.c +++ b/drivers/pinctrl/pinctrl-mlxbf3.c @@ -223,26 +223,12 @@ static int mlxbf3_gpio_request_enable(struct pinctrl_dev *pctldev, return 0; } -static void mlxbf3_gpio_disable_free(struct pinctrl_dev *pctldev, - struct pinctrl_gpio_range *range, - unsigned int offset) -{ - struct mlxbf3_pinctrl *priv = pinctrl_dev_get_drvdata(pctldev); - - /* disable GPIO functionality by giving control back to hardware */ - if (offset < MLXBF3_NGPIOS_GPIO0) - writel(BIT(offset), priv->fw_ctrl_clr0); - else - writel(BIT(offset % MLXBF3_NGPIOS_GPIO0), priv->fw_ctrl_clr1); -} - static const struct pinmux_ops mlxbf3_pmx_ops = { .get_functions_count = mlxbf3_pmx_get_funcs_count, .get_function_name = mlxbf3_pmx_get_func_name, .get_function_groups = mlxbf3_pmx_get_groups, .set_mux = mlxbf3_pmx_set, .gpio_request_enable = mlxbf3_gpio_request_enable, - .gpio_disable_free = mlxbf3_gpio_disable_free, }; static struct pinctrl_desc mlxbf3_pin_desc = { From patchwork Wed Aug 16 13:58:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asmaa Mnebhi X-Patchwork-Id: 714473 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 41D5FC04FE1 for ; Wed, 16 Aug 2023 13:59:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245722AbjHPN7K (ORCPT ); Wed, 16 Aug 2023 09:59:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245753AbjHPN7D (ORCPT ); Wed, 16 Aug 2023 09:59:03 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2053.outbound.protection.outlook.com [40.107.243.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 645F22717; Wed, 16 Aug 2023 06:59:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CisoKJcQwQih3L+GN0iCB0zqnMgsgRzvGKPVQu/SV8+qQgows9aXuYm2QjN3GTJgkBTUpQC7D/5w5z/OS6Cn0PPUuSk7vZGspNdjBQlQYT5Bvz0SNXWwTSsk4lhNi5V2IDhCDg37YmDVXFJ5BAk4nCE/SDgyTfBjFrslMXmrGRMQxQmU12KGurP8znoKpuzmnhVJVJ5eoyWMk6jgqr1bNrloFUFn6BCYoQJdA9Z0uGsBJtkhDk2uR4WbZWOz6ibKqh1FedlX+PmgYoFmCqUcMfRrKxX7hFfKShxXsH+JBC6oeMzzedqw0ToZQTXNOswR9TGPGbV2XoPtmPhH3UdeWg== 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=ZnPncU7GpsKVHBUZ21L7VOD2DTea5LuRVaBzezbTyIY=; b=GnH6kGsc7a7VBVt2/I1087+Ol+NN4o3gM1e7pLK13uTASJ88suZZb/6xXKhGsmViqoiTVKXONjSE2X7rbN2hFhnhuAQMdMuTk29ffCC78DE9hlichKhnUyL5fzul+tLS7eUrjclTKIH+j1NaDB0NjjepB8J/+EBhXUIoZq/r41bi2iHGlmjx84Gphuv2Qd3Y/KuUF7K3Jkh0W/ZJwyJl2FLUyV0aHkC0AgDrk4nPLtPgtLYYvoG8neGh7Ef7IVGYQq2aJ4GdQL2BlmeczHiTSq8o41acsRZU+2QffG8UIBmRT13KiZXNIGHzAS+gxhmFoiH/xqkzBypSWPQAqAv/1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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=ZnPncU7GpsKVHBUZ21L7VOD2DTea5LuRVaBzezbTyIY=; b=Tzj0pQBBsXdynxIUG9ESbOHIIiF7GsrP87xKWgjQuF46vqQB38VL9cFlRr24HFOayaL3vB9qwcsuzN2SG7qGmf8XY7DrZ9ol/o+4c7srmuOJFMgRZgal4bxulszQRsm24UDtEvR4ReslfV+TQdmvEzab6xnE1PhsMy8amf/HNU4rTNwyw+nSvV9EUvzGnQ4saiC1QRpvwlSIVQ/Y0d47e716/r+FhrdQPmdauuhcbz80/EsC/opb77VceLUw9wHKnxmFFnnOdZmXl59djbpjNmdP/0mAU9N8d7YK8aYBGVCWQ+wEaNZCK69/utEiZeWIOhG0ZeRbGiGz21pfKbN9Nw== Received: from SA1P222CA0178.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c4::26) by PH7PR12MB6465.namprd12.prod.outlook.com (2603:10b6:510:1f7::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.29; Wed, 16 Aug 2023 13:58:57 +0000 Received: from SN1PEPF0002636B.namprd02.prod.outlook.com (2603:10b6:806:3c4:cafe::c3) by SA1P222CA0178.outlook.office365.com (2603:10b6:806:3c4::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.15 via Frontend Transport; Wed, 16 Aug 2023 13:58:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by SN1PEPF0002636B.mail.protection.outlook.com (10.167.241.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.14 via Frontend Transport; Wed, 16 Aug 2023 13:58:57 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 16 Aug 2023 06:58:47 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) 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.37; Wed, 16 Aug 2023 06:58:46 -0700 Received: from vdi.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Wed, 16 Aug 2023 06:58:45 -0700 From: Asmaa Mnebhi To: , , , , , CC: Asmaa Mnebhi Subject: [PATCH v1 2/2] gpio: mlxbf3: Support add_pin_ranges() Date: Wed, 16 Aug 2023 09:58:39 -0400 Message-ID: <20230816135839.24011-3-asmaa@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20230816135839.24011-1-asmaa@nvidia.com> References: <20230816135839.24011-1-asmaa@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636B:EE_|PH7PR12MB6465:EE_ X-MS-Office365-Filtering-Correlation-Id: 5146b2b5-ff3d-4486-2f4f-08db9e60ef5e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FtVlpA9iYGwFGXajdiqWSj5zCUll69DmZOnayTitFKAiP2cxpBLVA7/tVt2ugLbYE3+rFOOO/+zJnGrO23iLlm6h4QZxJMCBShWYVQB1mp5wsOYs7Sf8CGV5jT3K2/n4qDl+a2+dcynYJMm/sLFz5/mqEL9Zojk4vHMvoHAbBTqzrtDhB4sr/UR/YFNx/EcxobU3QaK4JLJvaEdcXyXB9k/gzpNT3NM3EVJ3YryfhycoE14PCZJjUs3MMNqRBfgJfBNtFqVgGZ8ilrpedCQ89IbJCI8eNwI65eS9lcMHms/Txkotf28Uo/KIlfzi9RImglllmbRkHg733E84vh73Arn8Vgoz6TTtmshaRqzjaqLrU90CsvTcnnmzlWNPQeligbZBVQscuw/9+tdYmHHMcehu74T0JMeLhvaii47Jf2Ihc/jsrfSdg7lGQ+aMPKNLAb5QfDGairddddGmckwFkcA8a5kll9F2ax6oEeMs8kgThN+1+weX/flc7ZIw94O4FILNAL8XXe33xXd3l5/9IQUMtcS6BGcz6qrzw9OkhgNqWUx2ofHd+SGtOlUTvaP77GbGlZ8VnxW4QH3jdsPBfZ0+Xf6qAYZ02FOcWlSryMZtaMmmEr9QYBhFXkXigdxtJMMQXzAmFgBDXlJyZyEZNgrmQWu8b26YQ/uc/X/hAt5OzbIRikRy5QviCSh0+sqeP/l53GQz258OXAM/ZnGlBl1HCSgLmrSfvNc9o5AhOpDT/jx1gvgoqU5NiSGAzKFH X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(396003)(39860400002)(346002)(376002)(136003)(1800799009)(451199024)(186009)(82310400011)(46966006)(36840700001)(40470700004)(7636003)(316002)(356005)(82740400003)(110136005)(70586007)(70206006)(36860700001)(41300700001)(5660300002)(47076005)(8676002)(4326008)(8936002)(2906002)(40460700003)(83380400001)(26005)(40480700001)(478600001)(426003)(336012)(86362001)(107886003)(7696005)(36756003)(6666004)(1076003)(2616005)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2023 13:58:57.1783 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5146b2b5-ff3d-4486-2f4f-08db9e60ef5e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002636B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6465 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Support add_pin_ranges() so that pinctrl_gpio_request() can be called. The GPIO value is not modified when the user runs the "gpioset" tool. This is because when gpiochip_generic_request is invoked by the gpio-mlxbf3 driver, "pin_ranges" is empty so it skips "pinctrl_gpio_request()". pinctrl_gpio_request() is essential in the code flow because it changes the mux value so that software has control over modifying the GPIO value. Adding add_pin_ranges() creates a dependency on the pinctrl-mlxbf3.c driver. Fixes: cd33f216d24 ("gpio: mlxbf3: Add gpio driver support") Signed-off-by: Asmaa Mnebhi --- drivers/gpio/gpio-mlxbf3.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/gpio/gpio-mlxbf3.c b/drivers/gpio/gpio-mlxbf3.c index e30cee108986..3828f5282b17 100644 --- a/drivers/gpio/gpio-mlxbf3.c +++ b/drivers/gpio/gpio-mlxbf3.c @@ -158,6 +158,24 @@ static const struct irq_chip gpio_mlxbf3_irqchip = { GPIOCHIP_IRQ_RESOURCE_HELPERS, }; +static int mlxbf3_gpio_add_pin_ranges(struct gpio_chip *chip) +{ + int ret; + int id = 0; + + id = !!(chip->ngpio % MLXBF3_GPIO_MAX_PINS_PER_BLOCK); + + ret = gpiochip_add_pin_range(chip, + "MLNXBF34:00", + chip->base, + id * MLXBF3_GPIO_MAX_PINS_PER_BLOCK, + chip->ngpio); + if (ret) + return ret; + + return 0; +} + static int mlxbf3_gpio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -197,6 +215,7 @@ static int mlxbf3_gpio_probe(struct platform_device *pdev) gc->request = gpiochip_generic_request; gc->free = gpiochip_generic_free; gc->owner = THIS_MODULE; + gc->add_pin_ranges = mlxbf3_gpio_add_pin_ranges; irq = platform_get_irq(pdev, 0); if (irq >= 0) { @@ -243,6 +262,7 @@ static struct platform_driver mlxbf3_gpio_driver = { }; module_platform_driver(mlxbf3_gpio_driver); +MODULE_SOFTDEP("pre: pinctrl-mlxbf3"); MODULE_DESCRIPTION("NVIDIA BlueField-3 GPIO Driver"); MODULE_AUTHOR("Asmaa Mnebhi "); MODULE_LICENSE("Dual BSD/GPL");