From patchwork Mon Aug 16 18:16:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 12439027 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2C89C4320A for ; Mon, 16 Aug 2021 18:16:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5F9360F22 for ; Mon, 16 Aug 2021 18:16:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229912AbhHPSRS (ORCPT ); Mon, 16 Aug 2021 14:17:18 -0400 Received: from mail-co1nam11on2043.outbound.protection.outlook.com ([40.107.220.43]:35169 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229781AbhHPSRS (ORCPT ); Mon, 16 Aug 2021 14:17:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P7xlFPgaUWJUr1LNu1uY6YcsYHkhd47RndpE5dVJYKhrxKiR5k1XNwFzXeerRMo5tc4sw25YxPldK3KVL0x8be67DzhT5VgopV0ljWamILztJvWu16n+UnSSP7gC9+ztXRYRiYWyShtVGLF13ZMoMtaBepmI08R9Je3nSWDuPD0H47k9Cjtxl4zSizw9F4zcG22QicYkah2r1dz+g1Te/xFCVJxPIBPTkGMThwhW+Zy7Xp/HdB2OFeP7oaop8F7clJrO4nRL+xWH/oEIfp1mVal4qvLoKY4R6BRc6eSF1jroLrrmFw+1HLimrBn3a8OIwVj73FAPLuYpOZfE60ikHA== 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-SenderADCheck; bh=XDr/Ue3yLTW8MnswZmtHCpqhXQ/0n7tW17bYRAsbhuc=; b=aQ3tYsJk8ScDnMnoHZJoXeLAioTszsxoW9kzMFsXoEn4VkT456CvCYDj99ODKKB483vGFapdLKgGZoOZuRK8tV0GXG8lIxAvhY4TLMsbT2o3gymTnZCiYsNmEzIqbJaMb516E1VYxE07ppjVjBX3HFvtIYVhweqa4VXxluhqsyZWJ+pfvoAYY5HFNEoQXRf8Ex1N6plHyFGYxRj7xbiZC3Wzhm/gcjE7f10O20/xW4mpp2pZSjBw0kprke0vjKNe9DCT2u6PKyOtodMA8L2nbwjl+2pHp8aqiwjQlkcZbLKIEB5Kyjpg2eq89Q/46J4ttR2r2c5kW/Uvk0iCDf4L7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=axentia.se smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none 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=XDr/Ue3yLTW8MnswZmtHCpqhXQ/0n7tW17bYRAsbhuc=; b=V2Uit/HZqd81RLW+/PErWRt3YM+lrXD4x2Iy4/mbTdiyYzaTlMTRA2nWAdnyssNA9YUV9l5D60V2DeGACpYXk/PCzCJVR0EoVN+CycMSo+0GZWEOKuEGtZcayUHAQGBq7BxtVQ0dlYcXFFp0H8JsYZ27WwSRslf0b3Uu0/MAd5Z6SbBaHq4a1GSaQJLWugDx4R7Z1LZdcEeWU3rPpKoLlTu3HKcg6loURye9ORlQZWu+6bdqG5xY5/loKUIrj0Fx5VBbvVYBTwlfBJDjlL81dOExDlFwZjdKMx1x68Dy8fSYhmGhAq9EmF3X7dKLRlsoc4tNe/0qX2A6EViawDpUAQ== Received: from CO2PR04CA0085.namprd04.prod.outlook.com (2603:10b6:104:6::11) by BN8PR12MB2978.namprd12.prod.outlook.com (2603:10b6:408:42::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17; Mon, 16 Aug 2021 18:16:43 +0000 Received: from CO1NAM11FT047.eop-nam11.prod.protection.outlook.com (2603:10b6:104:6:cafe::50) by CO2PR04CA0085.outlook.office365.com (2603:10b6:104:6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14 via Frontend Transport; Mon, 16 Aug 2021 18:16:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; axentia.se; dkim=none (message not signed) header.d=none;axentia.se; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by CO1NAM11FT047.mail.protection.outlook.com (10.13.174.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4415.14 via Frontend Transport; Mon, 16 Aug 2021 18:16:42 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 16 Aug 2021 11:16:41 -0700 Received: from dev-r-vrt-156.mtr.labs.mlnx (172.20.187.6) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 16 Aug 2021 18:16:39 +0000 From: Vadim Pasternak To: CC: , , Vadim Pasternak Subject: [PATCH i2c-next 1/4] i2c: mlxcpld: Fix criteria for frequency setting Date: Mon, 16 Aug 2021 21:16:12 +0300 Message-ID: <20210816181615.2625662-2-vadimp@nvidia.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816181615.2625662-1-vadimp@nvidia.com> References: <20210816181615.2625662-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 69bb6a22-95b0-4092-3761-08d960e1ff9f X-MS-TrafficTypeDiagnostic: BN8PR12MB2978: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dMKAx0W50pk1+XdjAg0em4YGcWYkaVddzUFC5c+FCu3WU844ALzvTIqUeMUtNODrmevR44BTKdjOkcWKwzrvzRSp0iknXHp332xoEHnJAwXCjMHJKtgFahtFO8Uxcu0LkhESgxZNfjh4HtwYOxBkCjQZRnIyyE8VWrGahiRBzp3byefw9vuG8Kf7EUKHtBePpqio1X2n1A7Oy+YRHXZLbC/6aDNp/4/YFIxTMTxUvpHf3NoKGGB3Z8xuCRU2LHAmtu8AO33Rgw569W+/j+WhxAu+Si3RmGQmfEeOpFZuCpkTCNOjupb/daNjIcMpARl64mIBN+RrqXRkU21bZyn+iB9gYEzil1b3RvQTnpHKYiisLzhZQNqGpz0SFvNtmV+pTxYnBwNg4gyNQAP8JiARjgi72sZtSUcwy/4JYWDhdTpUOqyjtmv6kfCZBPxQDiaKoLwcdQNfpFbWKpnYk0Runli8E1zHKIhfSdduta8eoNXq/XxEaCKjS6T2uEf5TFEumPA5IT+1ACpizlgO+muhZJ7rUCofYctLvO0v4PqSdX9cCjEF55UtUAdrijpu5yBha6SiOXGahM4p8uTl1hse2IZUFtYbGT79letMArYXa2d0FnvvgqeAhASd8g+xuKzpTW17UJbD/txbhe9P2LplOg8/N45yh66u6OgaNp8RLvr2ySFkGP8nk3HRTh7cZWz/LTMuxTP4aAeaYTjIBH5IGdZ6FQIKnYXQzfTh6RwnEGY= X-Forefront-Antispam-Report: CIP:216.228.112.32;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:schybrid01.nvidia.com;CAT:NONE;SFS:(4636009)(136003)(396003)(39860400002)(346002)(376002)(36840700001)(46966006)(47076005)(356005)(5660300002)(70206006)(316002)(82310400003)(82740400003)(36860700001)(2906002)(4744005)(70586007)(6666004)(36756003)(7636003)(2616005)(86362001)(8936002)(26005)(186003)(16526019)(426003)(107886003)(336012)(4326008)(8676002)(54906003)(6916009)(1076003)(478600001)(83380400001)(133343001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 18:16:42.1069 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69bb6a22-95b0-4092-3761-08d960e1ff9f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.112.32];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT047.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB2978 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Value for getting frequency capability wrongly has been taken from register offset instead of register value. Fixes: 66b0c2846ba8 ("i2c: mlxcpld: Add support for I2C bus frequency setting") Signed-off-by: Vadim Pasternak --- drivers/i2c/busses/i2c-mlxcpld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-mlxcpld.c b/drivers/i2c/busses/i2c-mlxcpld.c index 4e0b7c2882ce..6d41c3db8a2b 100644 --- a/drivers/i2c/busses/i2c-mlxcpld.c +++ b/drivers/i2c/busses/i2c-mlxcpld.c @@ -495,7 +495,7 @@ mlxcpld_i2c_set_frequency(struct mlxcpld_i2c_priv *priv, return err; /* Set frequency only if it is not 100KHz, which is default. */ - switch ((data->reg & data->mask) >> data->bit) { + switch ((regval & data->mask) >> data->bit) { case MLXCPLD_I2C_FREQ_1000KHZ: freq = MLXCPLD_I2C_FREQ_1000KHZ_SET; break; From patchwork Mon Aug 16 18:16:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 12439029 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61948C432BE for ; Mon, 16 Aug 2021 18:16:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4146260F11 for ; Mon, 16 Aug 2021 18:16:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229781AbhHPSRT (ORCPT ); Mon, 16 Aug 2021 14:17:19 -0400 Received: from mail-dm6nam11on2054.outbound.protection.outlook.com ([40.107.223.54]:22048 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229481AbhHPSRS (ORCPT ); Mon, 16 Aug 2021 14:17:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RD+UU9WpZJ5m+h2lFrWXnTdSJpAL3FseMbGJLI8pLFTxQLC1971T4Ao9q6MFGuC5SvG+a2qj5lK7P+uu9U4eYmIdXZYBULXw7uQBc9Plt3jD+VH+V6xjSe4y61knfJ0saF9gnPwIrz2TjC3UN/m7ulvjGRAqYLgrCc2dhixMHrD3Yu6r38jiz7gz/cNZjZzNFScyaM3x+f8ROHpa2qab0DMBN1UJ6ch2ZhVW1YqYevo5Tjdt1IKDFd+8oCShIue5qP4xrctTrBQDgwnv9g71p4HlE+JIUZ8qpswBuAwnI22LVNd77DXFEr4D+IzQ3Nw/X2zZd3TiuKWgEixe0u2LEQ== 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-SenderADCheck; bh=brskK6KkJLd7GMYWJYj9QFsecBFsQyHMV4VYCwbPnvE=; b=eX4TeSpo8GJiEndRQwpWB4LLQdKFXsCSd9yXalHYG9iI3C0b9P5SgxIXiE5+qohGw0npg7SJneb1+1a5gZ+OeSD7czGVLUfuOzhAEqV6G7hs4K9VV+filxhdqKlRaQci8ALkhBykmCC2nyYbArYNMkqjgf8Tmm+Lv6+hAOuLoEQIUGtA49r9MjgvUfoWD4p07i1BmM/QHlvM5fsrFqircK0XgWQw2j8dbwkYuXw+S1tb9HaTKmaAUDqcgp2albGEZ6UefXI6IUkisLKhcBh4tRpG4Mo7cEP9gEmMpRzhTZ+URILhMbbpS4tbhSl4HZI6rTmq7FTNS9qAD+cskPs1xA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=axentia.se smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none 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=brskK6KkJLd7GMYWJYj9QFsecBFsQyHMV4VYCwbPnvE=; b=FccAZ35csxX9NF+3V+LUPa/ZcpnnvSd/TzO7t8lQlqr6Wu4xEVri7t+1z7+Om8oejDyHAI/xAj9UBmnFYi1eYHg0+laAsl31ErASu2OzLujgxKvp00ETSC9kfrwWbiU5dugqE3gOHlxA7W+kCH1VGaJiqCITWkPjMg+TdTCXkp6y124jWc7flRLjhIHYwrA0R1r8l5N0pXnvR+3s6aR1z+nltKD3luDtYlO6xIBoVGtXnOKLh0wKhw0LzTXGUen7nyFnlkUaDzKlqW1gUaozpkjvpTtwjV8pcBWbQM9NgVoV5WCLM6lyQWrOdzXL9+8568nC35gFLILr8iijNJG18w== Received: from DS7PR07CA0003.namprd07.prod.outlook.com (2603:10b6:5:3af::11) by BN8PR12MB3059.namprd12.prod.outlook.com (2603:10b6:408:42::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16; Mon, 16 Aug 2021 18:16:45 +0000 Received: from DM6NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3af:cafe::21) by DS7PR07CA0003.outlook.office365.com (2603:10b6:5:3af::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.22 via Frontend Transport; Mon, 16 Aug 2021 18:16:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; axentia.se; dkim=none (message not signed) header.d=none;axentia.se; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT053.mail.protection.outlook.com (10.13.173.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4415.16 via Frontend Transport; Mon, 16 Aug 2021 18:16:45 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 16 Aug 2021 18:16:44 +0000 Received: from dev-r-vrt-156.mtr.labs.mlnx (172.20.187.6) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 16 Aug 2021 18:16:43 +0000 From: Vadim Pasternak To: CC: , , Vadim Pasternak Subject: [PATCH i2c-next 2/4] i2c: mlxcpld: Modify register setting for 400KHz frequency Date: Mon, 16 Aug 2021 21:16:13 +0300 Message-ID: <20210816181615.2625662-3-vadimp@nvidia.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816181615.2625662-1-vadimp@nvidia.com> References: <20210816181615.2625662-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ec787cae-3ced-4da0-4d25-08d960e20182 X-MS-TrafficTypeDiagnostic: BN8PR12MB3059: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1079; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +ta0RPdtaoyRG40EcGNdRB6mY1zqr3Zl2YNcLfCfMtC5IreDlD2yqM6+XFzwUzNL08Enj1pT77X6CyHUeAzQZVTlrIvWwpNk6+X4CujiBZiqbhsp9Tx7I0EaopgjavKYucLLTE7yw+LlbtYpg/So7J1msY1RZHY9oWiw+NBc6GnVbJJq+qjzSVAip4Qda5UWn4ElEmppY5BIuN+R8vlZIEtsAQMuextBy4TkPHMS0YTiBbPcfAv7btncTYElaKbQs4vaf8UfM3FQ71ilEq/OLyDc2GlSOnJ0fWf0iWZIhNnUNW+1W0KiJBDHaeHNSQ+okTT3bi/V6ywPSFZFKYV981BEFkWL4SaS4VN6/dBizUVlQdQKIPfBjHgmgJzAL5sssHp16seTWO+WIQ3eFFb05nnX9RUR+X+jGAOEPDv/H/gjjP9gb31f9NgxI/IGf30SHm++IJ53Xs2QRzaKmPo5R0OA2dmRaaJa03nadi2l8Gw8f4YWxpO7KbCHtqus+H3+WNa6I8EyGOFXH8bYUhiKX3KgqRCAJ94m5bxABoWKagOhVdcu2Kb/XOJ3NZNgDFBjtH502p+kt2dLghQQoRivbNP5tx3AfIVNEyTEQmMLyLiIAHuJccNyjYm4Ax9xVXLzsW1H+sJy76KMTIVLSahmfFOUovUGHu70kOSo010qgFqtjjIvEYSqW3uaCdI6itvXoEWNARCp8GFRt8TfWjRpmmP7bK8HB23qt9kj+XGTUYQ= X-Forefront-Antispam-Report: CIP:216.228.112.34;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:schybrid03.nvidia.com;CAT:NONE;SFS:(4636009)(346002)(136003)(396003)(39860400002)(376002)(36840700001)(46966006)(186003)(70206006)(26005)(82310400003)(336012)(86362001)(478600001)(16526019)(6666004)(107886003)(6916009)(2616005)(5660300002)(1076003)(36756003)(36906005)(2906002)(70586007)(36860700001)(54906003)(82740400003)(8676002)(47076005)(4326008)(7636003)(426003)(356005)(8936002)(83380400001)(316002)(4744005)(133343001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 18:16:45.2488 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ec787cae-3ced-4da0-4d25-08d960e20182 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.112.34];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3059 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Change setting for 400KHz frequency support by more accurate value. Fixes: 66b0c2846ba8 ("i2c: mlxcpld: Add support for I2C bus frequency setting") Signed-off-by: Vadim Pasternak --- drivers/i2c/busses/i2c-mlxcpld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-mlxcpld.c b/drivers/i2c/busses/i2c-mlxcpld.c index 6d41c3db8a2b..015e11c4663f 100644 --- a/drivers/i2c/busses/i2c-mlxcpld.c +++ b/drivers/i2c/busses/i2c-mlxcpld.c @@ -49,7 +49,7 @@ #define MLXCPLD_LPCI2C_NACK_IND 2 #define MLXCPLD_I2C_FREQ_1000KHZ_SET 0x04 -#define MLXCPLD_I2C_FREQ_400KHZ_SET 0x0f +#define MLXCPLD_I2C_FREQ_400KHZ_SET 0x0c #define MLXCPLD_I2C_FREQ_100KHZ_SET 0x42 enum mlxcpld_i2c_frequency { From patchwork Mon Aug 16 18:16:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 12439031 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15DB0C432BE for ; Mon, 16 Aug 2021 18:16:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F255C60F11 for ; Mon, 16 Aug 2021 18:16:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229481AbhHPSRW (ORCPT ); Mon, 16 Aug 2021 14:17:22 -0400 Received: from mail-dm6nam08on2052.outbound.protection.outlook.com ([40.107.102.52]:54163 "EHLO NAM04-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229959AbhHPSRV (ORCPT ); Mon, 16 Aug 2021 14:17:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SboMDRdbs1myAafDszyllYM00FIJk4Uouy3mABL+DRHUgV1VddXlG9OjwoH7rhBN8/cKil3j3BmwVNU63yZAlOQ3EVr58uvVS6+9ICnSnLi/DZGgCvEJ3mZjPR+2nSBtnrXAlzmg2RuqKKeeF+yGXG33yfsiFKrd9H7OuX/GVbMRvM0nTLpBzhzer6ZxdkNzXBVxnwyPveQ4HlPl8ujsv55G2A6P5cF7JyUjJAn/wOJrQ7RinBxh317zxh3ccuOJruVtLNkVz5gAKtsh1KbID6rwOzbW4l+l2c25EWLXaA+FYyu+NAvKT37tQGnoykihO+3CWqjAo7mk3VOrBb9IzA== 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-SenderADCheck; bh=3/fofUa81Qq+ZSwd4Jv2n5dNPZC1KIm88eNRKKMsnhw=; b=epANa2qpvZHs1gx7Md7H9tLvdoMBEZ+slslCJG6wHTrf/05sXMwZyKBrVhTDsBF5e5EjOHfqQIHYXgA3yTlIASlQ5seYXP+mdO2M1Jkn/gzeOhENzTe0gdBlZlsbMhUYFCmF0KvhaFSgi4SJ9oxxNefwcnoWu9985ac8tGBUd7e5KvLwyitVcwW5sd8eO/p3nSoThgESxTk6YwDVMlb53I+5b6/ygULlYSFBS/Togat/4lonle+YAaX9DOXu3rISzHDI3Z8wMGamlW+T+9bAeW6X8kPlcka8Mmw/sohoeVreKLziNHNjGn4O4ghWh/Mqaix5HBzb0eLVEF0YfIXlgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.36) smtp.rcpttodomain=axentia.se smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none 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=3/fofUa81Qq+ZSwd4Jv2n5dNPZC1KIm88eNRKKMsnhw=; b=C4xAkpWVD17bNZ9WkIYcw+xWDg4wkyIPPWRMmEfkNrzN2nhPHv3vHcem9Y0nKL7OlVCdefoAFbxceXEl/8gixL9Kuy2jRshxn741ktsWYOo0aAqwLpBrXh9NwrXc6zutkyMbBMOFqdF5V0Oe6AO+Xkk3XFOu9UG9xepv7ko+zFeJGT3iB4arvMVdmUCSZtvXskcr5Ap6QHs/mYF5IismR8surq3nL3e0jfyfO8mOvfXx8vgL2pJ2RYnTbOHj0nkT7vwL0uuVLYqus7akciYrMXfexptZC9qhAdB4laiYgzmdkmdrkcKly9GLzg7PCu8KgU4lg1D6GnaTBBncgnXVOw== Received: from BN9PR03CA0190.namprd03.prod.outlook.com (2603:10b6:408:f9::15) by MN2PR12MB4782.namprd12.prod.outlook.com (2603:10b6:208:a3::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.18; Mon, 16 Aug 2021 18:16:48 +0000 Received: from BN8NAM11FT005.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f9:cafe::ed) by BN9PR03CA0190.outlook.office365.com (2603:10b6:408:f9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14 via Frontend Transport; Mon, 16 Aug 2021 18:16:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.36) smtp.mailfrom=nvidia.com; axentia.se; dkim=none (message not signed) header.d=none;axentia.se; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.36 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.36; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.36) by BN8NAM11FT005.mail.protection.outlook.com (10.13.176.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4415.16 via Frontend Transport; Mon, 16 Aug 2021 18:16:48 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 16 Aug 2021 18:16:47 +0000 Received: from dev-r-vrt-156.mtr.labs.mlnx (172.20.187.6) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 16 Aug 2021 18:16:45 +0000 From: Vadim Pasternak To: CC: , , Vadim Pasternak Subject: [PATCH i2c-next 3/4] i2c: mlxcpld: Reduce polling time for performance improvement Date: Mon, 16 Aug 2021 21:16:14 +0300 Message-ID: <20210816181615.2625662-4-vadimp@nvidia.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816181615.2625662-1-vadimp@nvidia.com> References: <20210816181615.2625662-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eee4bae3-0cb4-4f95-ee2f-08d960e20332 X-MS-TrafficTypeDiagnostic: MN2PR12MB4782: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H9UySd+R/CBWFX1P0p/ULn9z2LNi1zvTcykN8Fb2wORT5v40Wo+IHyG/VXLaqNK3x6wz4F+JnXS9NSfG5p48WSQfqCn7jXR0pKQ5BAQOo1K9ifNwCY5j7RloVDsADGzfJCfKXJ214b5P4WFDPop7kikYoC/6HnBMgTgQckgawwOlYqrRnTJSRpMrG6WctwJWZcgKCY8PVsz+q88JktCqOtJnNE+d49Bj8XAurjOcPHrxeYmoU8ZGP/DYInvYGyCVQwsl1BntRWrHZHzwZWWpir2medLSpIfa1pqNQbvN8FPTwq7//MWZfFVOrXt/QgVEQjMKtmjSGv1xa2z9kYWXPJoNLeouTu4TfXj6EksWKIcoE1hVvDOeBnz+pQaLsDniiGyIQDROnTJz5Ec2GF74bAEnPfsOu5i1psb/fYrFXoYVi5uHcFQtcL8jamp3mq7CY37Nt7LeJGiWT8LKcLsLzyWLkRTOrPGvhUm63pSoQ3JeDh+Uv+++Yx6aQDYGYebAM61Pkpi5EGT35uUVknWx1nESBrEQZ8yZJZNxE44nO6Hr2yMX533mu2FThG5qHwcoDBsp13NbuSXQFgP8s9mHITzw1Ab2NgZ5id69Jv8+tzwFJ+8xadiXP6HCte3XX2SdzMDehaooblXgWqo137hryT7A9/VkzD77+PE3E6m78wWlX0Ic9W4chOeRv7kRsuVM0GOjf0Ra8jFgHS1SDpk+7ssOFzW04+NXu2dvvufS/wU= X-Forefront-Antispam-Report: CIP:216.228.112.36;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:schybrid05.nvidia.com;CAT:NONE;SFS:(4636009)(136003)(39860400002)(396003)(346002)(376002)(46966006)(36840700001)(70586007)(82740400003)(36906005)(16526019)(186003)(70206006)(316002)(8936002)(107886003)(26005)(426003)(36756003)(356005)(5660300002)(8676002)(336012)(4326008)(2616005)(54906003)(82310400003)(7636003)(478600001)(86362001)(6666004)(83380400001)(47076005)(1076003)(36860700001)(4744005)(2906002)(6916009)(133343001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 18:16:48.0401 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eee4bae3-0cb4-4f95-ee2f-08d960e20332 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.112.36];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT005.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4782 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Decrease polling time 'MLXCPLD_I2C_POLL_TIME' from 400 usec to 200 usec. It improves performance of I2C transactions. Reliability of setting polling time to 200 usec has been validated across all the supported systems. Signed-off-by: Vadim Pasternak --- drivers/i2c/busses/i2c-mlxcpld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-mlxcpld.c b/drivers/i2c/busses/i2c-mlxcpld.c index 015e11c4663f..615f0a98640e 100644 --- a/drivers/i2c/busses/i2c-mlxcpld.c +++ b/drivers/i2c/busses/i2c-mlxcpld.c @@ -27,7 +27,7 @@ #define MLXCPLD_I2C_MAX_ADDR_LEN 4 #define MLXCPLD_I2C_RETR_NUM 2 #define MLXCPLD_I2C_XFER_TO 500000 /* usec */ -#define MLXCPLD_I2C_POLL_TIME 400 /* usec */ +#define MLXCPLD_I2C_POLL_TIME 200 /* usec */ /* LPC I2C registers */ #define MLXCPLD_LPCI2C_CPBLTY_REG 0x0 From patchwork Mon Aug 16 18:16:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 12439033 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7AA9C4338F for ; Mon, 16 Aug 2021 18:16:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0A68604D7 for ; Mon, 16 Aug 2021 18:16:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230026AbhHPSRa (ORCPT ); Mon, 16 Aug 2021 14:17:30 -0400 Received: from mail-bn7nam10on2060.outbound.protection.outlook.com ([40.107.92.60]:40672 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229881AbhHPSR3 (ORCPT ); Mon, 16 Aug 2021 14:17:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PqXjz+NGIKopJRO58KtOp+vG1bpEgD5SVWc209nola4ot3bqjGPNqLFn9wnfp04xFvdFxV/87zIuDlIHJQdCFYep4K7DYEnUdn5QRbn5mj6KDW7hkY2S+zj2TyKdqgAPuk/qaPlT78GRog3N0H/B+I4l05USm82MlP3xdMhJJHSDJpJ/4DLb3VnQZUzwt7ku5bEYKgu+YBURXx9d/5VIw2HwKvz6SXIZ4ysmsy15zbVhH4RNAZn+qPmIvWp1+41RLGtRnwx803LmlvMkyM3iD/o+Wa6gL41zvwQ46YWXE0T+REaKbm/H4KVUaPFcR2RqVVL424N6w5tOneFqIUmPRQ== 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-SenderADCheck; bh=EXF672+7NF+s0+EGQHO15zBr+4vSi58iP3SEvBXmHSw=; b=RKlDzHNMjv1hZ6ppIaPVSn/lKGw7rxLIsCfbQP6KdZMqOFwY4JQ/mUZ4VjvVlCrRI+GI67os1HpDUxjchpVhLnBsLGwP2qLZLyL4BDyUTIcyrbfZTbp9Jk/d+BQSdkqJnVmPsmW49XGSp6wF/EqsPVsWrgv5ctNEHYH3cJVTWUp+wmZI+GN6CbTgvjBGTQ2FN3Psm3l+m1JpBLyBGL115aptrhszAXHXGP1g6F5uz7NQfSTqMNivPjPqQoElYUaAkayF0LBUrlkSRzPQsJH2sv6ui7FngKRdw4PPc1ao4gS7Z+j/atUmvYSq1Ki3d6+gEBfzrSPXKIRbYNrVqv+s9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=axentia.se smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none 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=EXF672+7NF+s0+EGQHO15zBr+4vSi58iP3SEvBXmHSw=; b=fiHFROcWg4LkW44iL4N0U+ya7hy/saIu+Vj6V09RPUr0bBPFCfjL6WaxAUxZzkP2VWQZb+eAAepGC35Z8Oi6O29PpHcmu7nkY4kOX4IXcRKSmvUt4dnU9crbSSBmb2flSeNAQVS+y87t9TM50NlRJypmlct8farB0q9k1VZ7sqYIdo3ACeVyH3BX//Prg3G0Nwtln9HVeWCfnBsg1XzTJ2zAFigKQagFNbDiKlwGVBHlZUS+UkzSP3i98ijTTscCze9PUNKaTTFw9i/EsOr9iwvxWpS05prUH35c4sNiR7+ZDnnxzAaGI4k/7uz+irINsUCXZHcaF1cHjmxM3RlNsg== Received: from BN8PR12CA0005.namprd12.prod.outlook.com (2603:10b6:408:60::18) by SJ0PR12MB5424.namprd12.prod.outlook.com (2603:10b6:a03:300::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14; Mon, 16 Aug 2021 18:16:56 +0000 Received: from BN8NAM11FT013.eop-nam11.prod.protection.outlook.com (2603:10b6:408:60:cafe::b1) by BN8PR12CA0005.outlook.office365.com (2603:10b6:408:60::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14 via Frontend Transport; Mon, 16 Aug 2021 18:16:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) smtp.mailfrom=nvidia.com; axentia.se; dkim=none (message not signed) header.d=none;axentia.se; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by BN8NAM11FT013.mail.protection.outlook.com (10.13.176.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4415.16 via Frontend Transport; Mon, 16 Aug 2021 18:16:53 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 16 Aug 2021 18:16:50 +0000 Received: from dev-r-vrt-156.mtr.labs.mlnx (172.20.187.6) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 16 Aug 2021 18:16:49 +0000 From: Vadim Pasternak To: CC: , , Vadim Pasternak Subject: [PATCH i2c-next 4/4] i2c: mlxcpld: Allow flexible polling time setting for I2C transactions Date: Mon, 16 Aug 2021 21:16:15 +0300 Message-ID: <20210816181615.2625662-5-vadimp@nvidia.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816181615.2625662-1-vadimp@nvidia.com> References: <20210816181615.2625662-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1fd2cde9-5235-44b7-20ae-08d960e20697 X-MS-TrafficTypeDiagnostic: SJ0PR12MB5424: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7AotJA2meChgKUBZeqJGjmDkppOr2eTLHMTN84fbzhG69PQw3c997/1ohLUj5WK9hAiPyDbU5lVJHoRGeXF3NUCBamMTaFgw14oyB4UrdNJJEDUMCz7Ajirk5sdWPlGnhZJhGn0a8eTWkih1GvVMvjbUb530z5F0JaD2e/BL8kuYTsYcYZKuUc8F5x73TH1uvH93u6XFIb1eDp/Fxaak8Q27YgqVZF1MGlVzRvzZZ2097lAi4MI6t+n+OUxMtwC0ShOTwMnr/YGJsFobxs3IZHAyV0OJId4F2szMPjuSRvW1eyfav/WO3cpSBVCzy7cTmfQDJja6pJuueYXKFetNGpSpLs8QugINOHp0IP0r1XjMmiu15zh536BTJ2stc7JcRrpqEM8PkQgm/+ZJRr4CryDNhgbXLqY0S2q4oPljiI4BV1fTo6ROq54RfaWf5p1oH/idPvgIiGLAP1Mu1D5OAbRj3WDQx/jx8jhNtfMtBgrRgw/eFDfxddxOQs3sSRs8eaR3ZTgLwJB834N+Fud4baZog6IOjDQBtkFjVg9XZ31WChh3y26njXAwhYEzQJlVsk1LZIvC9KlkuZQMPzT9XdLgJuzjDzlT3gPtf9fXpXAFyJVZ1Oqu0twAyT9cyeilz5nC1V9xUlVpW5N+rYCEmGSGm2Kpr2XXcyWEJAbW45I2z6j4nhK7/h7lUchgbzNOvCFs8wAcFzZjtdEK4C0eOK0g74bLxPnY3tEBtqdv7ac= X-Forefront-Antispam-Report: CIP:216.228.112.35;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:schybrid04.nvidia.com;CAT:NONE;SFS:(4636009)(376002)(396003)(346002)(136003)(39860400002)(36840700001)(46966006)(2906002)(82740400003)(47076005)(5660300002)(70586007)(70206006)(83380400001)(82310400003)(186003)(16526019)(336012)(316002)(2616005)(6666004)(7636003)(426003)(36860700001)(54906003)(107886003)(356005)(26005)(8676002)(1076003)(6916009)(4326008)(478600001)(86362001)(36756003)(8936002)(133343001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 18:16:53.7449 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1fd2cde9-5235-44b7-20ae-08d960e20697 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.112.35];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT013.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB5424 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Allow polling time setting according to I2C frequency supported across the system. For base frequency 400 KHz and 1 MHz set polling time is set four times less than for system with base frequency 100KHz. Signed-off-by: Vadim Pasternak --- drivers/i2c/busses/i2c-mlxcpld.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-mlxcpld.c b/drivers/i2c/busses/i2c-mlxcpld.c index 615f0a98640e..56aa424fd71d 100644 --- a/drivers/i2c/busses/i2c-mlxcpld.c +++ b/drivers/i2c/busses/i2c-mlxcpld.c @@ -73,6 +73,7 @@ struct mlxcpld_i2c_priv { struct mlxcpld_i2c_curr_xfer xfer; struct device *dev; bool smbus_block; + int polling_time; }; static void mlxcpld_i2c_lpc_write_buf(u8 *data, u8 len, u32 addr) @@ -267,8 +268,8 @@ static int mlxcpld_i2c_wait_for_free(struct mlxcpld_i2c_priv *priv) do { if (!mlxcpld_i2c_check_busy(priv)) break; - usleep_range(MLXCPLD_I2C_POLL_TIME / 2, MLXCPLD_I2C_POLL_TIME); - timeout += MLXCPLD_I2C_POLL_TIME; + usleep_range(priv->polling_time / 2, priv->polling_time); + timeout += priv->polling_time; } while (timeout <= MLXCPLD_I2C_XFER_TO); if (timeout > MLXCPLD_I2C_XFER_TO) @@ -288,10 +289,10 @@ static int mlxcpld_i2c_wait_for_tc(struct mlxcpld_i2c_priv *priv) u8 datalen, val; do { - usleep_range(MLXCPLD_I2C_POLL_TIME / 2, MLXCPLD_I2C_POLL_TIME); + usleep_range(priv->polling_time / 2, priv->polling_time); if (!mlxcpld_i2c_check_status(priv, &status)) break; - timeout += MLXCPLD_I2C_POLL_TIME; + timeout += priv->polling_time; } while (status == 0 && timeout < MLXCPLD_I2C_XFER_TO); switch (status) { @@ -498,9 +499,11 @@ mlxcpld_i2c_set_frequency(struct mlxcpld_i2c_priv *priv, switch ((regval & data->mask) >> data->bit) { case MLXCPLD_I2C_FREQ_1000KHZ: freq = MLXCPLD_I2C_FREQ_1000KHZ_SET; + priv->polling_time /= 4; break; case MLXCPLD_I2C_FREQ_400KHZ: freq = MLXCPLD_I2C_FREQ_400KHZ_SET; + priv->polling_time /= 4; break; default: return 0; @@ -527,6 +530,7 @@ static int mlxcpld_i2c_probe(struct platform_device *pdev) priv->dev = &pdev->dev; priv->base_addr = MLXPLAT_CPLD_LPC_I2C_BASE_ADDR; + priv->polling_time = MLXCPLD_I2C_POLL_TIME; /* Set I2C bus frequency if platform data provides this info. */ pdata = dev_get_platdata(&pdev->dev);