From patchwork Thu Dec 9 15:05:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil R X-Patchwork-Id: 522907 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 EBC1FC433F5 for ; Thu, 9 Dec 2021 15:06:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239178AbhLIPJd (ORCPT ); Thu, 9 Dec 2021 10:09:33 -0500 Received: from mail-co1nam11on2080.outbound.protection.outlook.com ([40.107.220.80]:31840 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231782AbhLIPJc (ORCPT ); Thu, 9 Dec 2021 10:09:32 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hevRM0noGIn92FCbtLMCvuUAQyEEm9y9W7KTfrv1wdLXJQ7TPCvd7gst9YEh5GDp8fgtUHs6NcX6TS2uzbQFZdNazAhhR4qOG6M1G3Q6Ulid/u+th/Fd8Nm60if401h16aARqJ+K9vxnbtFP/dhPjuBl7kNwSYhsdvCy2JE0YfRrH9LTkREP1+vtyIsElHruwFl/UbJafpVGC5kGjNgPWKmLUeZE2gW2AuagpihcoHTzXxavTZqBhwv2nKFj7OHIk/R5KrNnKRZNX7lJE5jYiydfkqLIl/SZOZxHypeyoD7Q22RZnPDfqxkAQG4ytqOP2G+LKccacpcLl+KKrPFXiw== 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=FRwQj9eV6DR2mKj8FrI/GIqY8T3YDNmex/FfEmS3rXE=; b=N17gpFpkqI9dr0eVyHTfhsOd4ZGPBfLtg2uunbuYCfRYcZ2pWXLn1Bx2ZxbEpx/IGf+BkM61Q3dnO5lBXbp85e+mAwrDwEmojgd0ieCjnQPfimGZkEgvEh7WS6BUNmOPlN0pI9Dd6teqHigh5Fgy/TxgZD1Pgajg0MH6Ga5aEntb/xj7YvNYuys3vCatvD3b2fFhDFPXpDy7orxZ2caXjlcNmNLZrjYAW4pIze6T34k9L+9TPJG4JUpJIw0YsCqjeylNIjXFoXSqgdDdhwe2QXbEmENK+Qqmy0ik3+0DVJ14FD7TuW//kkaEhML9R0/VLxOk8WrQs/SPKyeogtHdjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 203.18.50.12) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=FRwQj9eV6DR2mKj8FrI/GIqY8T3YDNmex/FfEmS3rXE=; b=QcVBlBqSaeLcvg18e/8q3Z9zxPEoUrOJciD8tREGqY85CDfr1PceF3Xe0vOdqIk0cR1qJ/f42+70ShmLULFDSdMmF0fBaqV8N7NGmtiO9vHe1z0LbwxameSWrHWXid5yzWVQdgaTxA0HR10+WFh+Nh9bQN03mAof94pSUcixE7nIL92nUH461MYzNrEA1yNSO2BGhQUKTzbpYl+HkHJ13d/z03zZHYSoS38EtJaYa48dtzlaCSgV4XwyR1ks+gAIQE/4X+UGlcnO4DgLftHlvAWiM2rCqx1bKhL/S0r90K4cBogB4yFzsECvNfnrQftloibOidDmIx9gmwqf8iqIWg== Received: from DM5PR07CA0114.namprd07.prod.outlook.com (2603:10b6:4:ae::43) by CO6PR12MB5491.namprd12.prod.outlook.com (2603:10b6:303:13b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.20; Thu, 9 Dec 2021 15:05:57 +0000 Received: from DM6NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:4:ae:cafe::ab) by DM5PR07CA0114.outlook.office365.com (2603:10b6:4:ae::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Thu, 9 Dec 2021 15:05:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 203.18.50.12) 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 203.18.50.12 as permitted sender) receiver=protection.outlook.com; client-ip=203.18.50.12; helo=mail.nvidia.com; Received: from mail.nvidia.com (203.18.50.12) by DM6NAM11FT023.mail.protection.outlook.com (10.13.173.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4755.13 via Frontend Transport; Thu, 9 Dec 2021 15:05:56 +0000 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HKMAIL101.nvidia.com (10.18.16.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 9 Dec 2021 15:05:55 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 9 Dec 2021 07:05:54 -0800 Received: from kyarlagadda-linux.nvidia.com (172.20.187.6) by mail.nvidia.com (172.20.187.12) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 9 Dec 2021 15:05:50 +0000 From: Akhil R To: , , , , , , , , , , , , , , , CC: Subject: [PATCH 1/2] dt-bindings: i2c: tegra: Add SMBus feature properties Date: Thu, 9 Dec 2021 20:35:20 +0530 Message-ID: <1639062321-18840-2-git-send-email-akhilrajeev@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1639062321-18840-1-git-send-email-akhilrajeev@nvidia.com> References: <1639062321-18840-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: 69f46f5a-e85b-4d60-bf58-08d9bb256768 X-MS-TrafficTypeDiagnostic: CO6PR12MB5491: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: 855MDg5xhEeYVjnJRAEBTvadjRcWTMgX1ETbQmq5rTDaRHzHRQR9eZzmAejK3IzacPUyIeDLmCR11Q4RfN2pzsBUnkpoSsAiDJMNGP+SgYCz73aEO4LUGTNvL0UWKAlZwkbQTOi3pxvhnPUnX7sX7jEJOgeLfaDRbLRl/f5SMrPcbCAMLtNaZ/VzbaSFAOuOnuhqzvYu2tUEW0cXxsdjI8fdEzlPLAzNzt8re0uazxRYxxNczLDqXMd9ub9mkdUfPs5jpa51QB0GMmDUPMY3xRetexLp1PIMeY6mqHrwl6xlxn9jMqFto7R8Qfkiu2Wx7F+wip8aKmwKDCmT9JkGgRNcYTiO7uDWMLx02OhyKFoZTJmYxb2CB+82RQ5j0loe5hxFRAhCTgzTZQbHB85NLLHMcnFojHNWnE13g+np6zaxS8+5rq0hiBHxZIYA/F0hU/MH+kwVypbx5VBVCHqbrgAId1/N5pRjyzMZZw5BvweoCFlFOZOkIARwtGr8GhoWh+UjSscmJHCpgY7LgRROEwSlwD75uMnAr3VXV8aho+ymC70q3uhSGrUjDHcAZc55AabcEr+sXb7F7S6DyQAUr1sxtTNX4S4FBmwLmeOfePVwR0Lfa+7D9lG93oknJIw4a0i06JE7v7Q+pME2yNT7xw1YkbEnq0nTp+8X0M/FajjSDBxqnbZBE7zqy1wwTZTICuTnYqzPGKoDqJs4pAubHomj4gB8QF/i32jEKO1Er1OtrHy/v18gzCTKhUVP0+1KBM4hjVGP4dwLj63SLSYpeDs+c0yHHB1pEP6laesqmgMFdhzXvtBQL781QkqSSF+xluWOreWe4m8wmMVV63OUVGsQ3EBfBgsyyNbxTd1+PSI= X-Forefront-Antispam-Report: CIP:203.18.50.12; CTRY:HK; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:hkhybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(2906002)(336012)(6666004)(8676002)(2616005)(508600001)(8936002)(36860700001)(7416002)(5660300002)(83380400001)(107886003)(34020700004)(316002)(921005)(186003)(47076005)(7696005)(426003)(356005)(110136005)(70586007)(70206006)(82310400004)(4744005)(40460700001)(86362001)(4326008)(26005)(7636003)(36756003)(2101003)(83996005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2021 15:05:56.8363 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69f46f5a-e85b-4d60-bf58-08d9bb256768 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[203.18.50.12]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5491 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Tegra I2C can use a gpio as an smbus-alert. Document the usage of the same. Signed-off-by: Akhil R --- Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.txt b/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.txt index 3f2f990..71ee79b 100644 --- a/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.txt +++ b/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.txt @@ -70,6 +70,10 @@ Required properties: - rx - tx +optional properties: +- smbalert-gpio: Must contain an entry for the gpio to be used as smbus alert. + It will be used only if optional smbus-alert property is present. + Example: i2c@7000c000 { From patchwork Thu Dec 9 15:05:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil R X-Patchwork-Id: 522644 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 61249C433EF for ; Thu, 9 Dec 2021 15:06:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239191AbhLIPJr (ORCPT ); Thu, 9 Dec 2021 10:09:47 -0500 Received: from mail-bn8nam12on2076.outbound.protection.outlook.com ([40.107.237.76]:40129 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239190AbhLIPJr (ORCPT ); Thu, 9 Dec 2021 10:09:47 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ovm/spe8nZA2Z7AqL6jew/JmxvktYqaU00ll6aMV5k1KiRphCuou7lyq1db8JSgpucf2z3hbJb0ObMIeHSFKcolluTIUc/Z3EItYWqsx7JSF2J+XdV3ZcPLw86QN5Jo+qpi5pnBhUntwwJiBL+7T5XeHM4WPIrmfGKaDaiIFdTdqPuiAidJ1rd/dAbF1S5wWpJLYeUvmgUH1cchTUiGwcXDDshDuacgEnAR2gvBkMRD6JoFxutZsOCdfWnvYWPzOboonjhytEwIpM+r5zLY1VHpbtW0yGHtwHwzMHOG0S7KRw+z5gLZdpVhHq9QLRpca02LoIMLdxT0uyWQip+yJMg== 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=YbLhIRsgwe8ksrnvwi8Rk/xSnMJ04UgcCgTrN4U02xA=; b=khbEAuDtJgmd7nG/sGUjUPwujSNRWXxfnVehrffcYcGpA7U5lHcy3I7HUbHWhBwm8Qj8OxHZbnpTDR7yonIWgH7yeCt19YtR7HXXB5VwVeriNm+PINXC+fw7I81gL6axt4JaS01kTp7Bs8U8H2zb+mqjsczVWEqOBUDv3vUiMq7HEWbUcfkg/vpTyQmQvgb5d2qYGh0NdxbNKUoBiV5oYKnNo1spKprxt6o3d7Bar70YdnQwl3wynRUmzHYztnl03beP9UgKh2X1xEN4DX05PDLohJhDEgZUBZYT43XvQUN6g+hVxrVuLXQt5eTJYipoyDL+7hqedwjH/phQKUpHhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 203.18.50.12) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=YbLhIRsgwe8ksrnvwi8Rk/xSnMJ04UgcCgTrN4U02xA=; b=cPsXiBRCWqQJzBXcVWz629iorKaKN39wLzn1dA9Rjzu5FTDE+Yph4Ia7FK/UydCsMcC2g4oWcp75tN8jNFi/kugyosyjOjUgQKdUbWxETYkrVo7acfxPbr+olIvdgnz7wsY90dFd7Qm1OVztOX3uBEBSmS2qwsXWJ20SFiyVDpbGg5B0WoTr5jZEPwvmCo943Br3X8/Jcw3M9NqX/q8eAmK6nG35KP0OHGgNwphTQuPCdzFAxtrzxLZh5MRVIGQxXjvnXknmaXk4wruPR8DETKiys9/MW42/A4vXF6/adJlqE7j29K1JZMsVoDal6ImVVMecdlGLFWsqfByEFEasow== Received: from DS7PR03CA0256.namprd03.prod.outlook.com (2603:10b6:5:3b3::21) by DM6PR12MB4436.namprd12.prod.outlook.com (2603:10b6:5:2a3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.21; Thu, 9 Dec 2021 15:06:11 +0000 Received: from DM6NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b3:cafe::ad) by DS7PR03CA0256.outlook.office365.com (2603:10b6:5:3b3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Thu, 9 Dec 2021 15:06:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 203.18.50.12) 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 203.18.50.12 as permitted sender) receiver=protection.outlook.com; client-ip=203.18.50.12; helo=mail.nvidia.com; Received: from mail.nvidia.com (203.18.50.12) by DM6NAM11FT036.mail.protection.outlook.com (10.13.172.64) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4755.13 via Frontend Transport; Thu, 9 Dec 2021 15:06:10 +0000 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HKMAIL101.nvidia.com (10.18.16.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 9 Dec 2021 15:06:06 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 9 Dec 2021 15:06:04 +0000 Received: from kyarlagadda-linux.nvidia.com (172.20.187.6) by mail.nvidia.com (172.20.187.12) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 9 Dec 2021 15:05:59 +0000 From: Akhil R To: , , , , , , , , , , , , , , , CC: Subject: [PATCH 2/2] i2c: tegra: Add SMBus block read and SMBus alert functions Date: Thu, 9 Dec 2021 20:35:21 +0530 Message-ID: <1639062321-18840-3-git-send-email-akhilrajeev@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1639062321-18840-1-git-send-email-akhilrajeev@nvidia.com> References: <1639062321-18840-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: e1662357-1e62-47e2-b6de-08d9bb256fb7 X-MS-TrafficTypeDiagnostic: DM6PR12MB4436:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: COF6HRgxcMKIFVo00KbZkjQDOI1lCOrt4fXl//RUUhq69QdaqUoZNi1GAcRviUbnzRhhVIqN5z/OC6RXMkitz8e6oKIno0JvsqVnPJVJ7jfP8j8FBUnWNovoVcgiE5HdlIS3wYoxGnTDhFx8r3U3o+ELdfI+VGj/3M7a4bAWfsmBLrHz+yVpqQGreIG19C/Yqypjq8WZqTqmWFDFavFuuvTmjhhpxl3QQ+ag7eq624jxegpdnuhAwwOUBqq+E8OWiX4D8hPXWyceGtLKNy/S0sV0qD3oPFUbd04yeT3pWz33cXPAm3nvTwt4yTfEkD0BA5tDA74LoK6GqIvFhUtdLPPTfkzeX67WB5EU32tRJFV+Gty+gJsGkew3VC5P5c3Pmc4TO3KoSyXI2q4ptEIuozipsvNb+c5WyupMNY6iPqYbxMYmOTVXzoN/rqmPSEB9W8cPV54fmXXUCwv9zWtj7ozkWrZfXy6zQu/wMDYT/TQWBtKVOBG3TdOyWO6NY4ve6HpZxmaA8Ft68Kv0MXkxoyvwz90dpsYsEi3Tc47NQh2XrRwfmuf8sW5SvyOLoSslGvvI5a4zF8Jpolyy/b+YdUhRixj/cPnRzh5Fcpjo/5rJ2speqVR8LU4vWle2+whjS61GCinvYrrqmQLg0V8UWMfAuOkFH0mT86h9GGc0QfyRBP9odcx+y98cnRSWtL168mqG0Gsp7rHvIzsuWcDi7pmSBgLq8hBuhJyfSb6FrdUOd7o4Nr+PIupPamjG0aZwZu3WGVW1DfA7UyQXGxKFqyvlIO/F4umDsFyQwasPKVIIA+jZtKSOsN8Oi2Ntpq5CqAq7Pt60vwt553QjKq0sHQxTCFfEzBG0GZod3M+wj/g= X-Forefront-Antispam-Report: CIP:203.18.50.12; CTRY:HK; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:hkhybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(70586007)(8936002)(82310400004)(110136005)(86362001)(36756003)(7696005)(36860700001)(7636003)(356005)(316002)(107886003)(2906002)(70206006)(40460700001)(8676002)(508600001)(34020700004)(5660300002)(921005)(15650500001)(26005)(47076005)(4326008)(7416002)(336012)(2616005)(83380400001)(426003)(6666004)(186003)(83996005)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2021 15:06:10.7756 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1662357-1e62-47e2-b6de-08d9bb256fb7 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[203.18.50.12]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4436 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Emulate the SMBus block read using ContinueXfer and SMBus using GPIO interrupt. For SMBus block read, the driver reads the first byte with ContinueXfer set which will help to parse the data count and read the remaining bytes without stop condition in between. SMBus alert is implemented using external gpio interrupt. Signed-off-by: Akhil R --- drivers/i2c/busses/i2c-tegra.c | 54 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index a5be8f0..3b70013 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -226,6 +227,11 @@ struct tegra_i2c_hw_feature { bool has_interface_timing_reg; }; +struct tegra_i2c_smbalert { + struct i2c_smbus_alert_setup alert_data; + struct i2c_client *ara; +}; + /** * struct tegra_i2c_dev - per device I2C context * @dev: device reference for power management @@ -280,6 +286,8 @@ struct tegra_i2c_dev { int msg_err; u8 *msg_buf; + struct tegra_i2c_smbalert smbalert; + struct completion dma_complete; struct dma_chan *tx_dma_chan; struct dma_chan *rx_dma_chan; @@ -1232,6 +1240,11 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, return err; i2c_dev->msg_buf = msg->buf; + + /* The condition true implies smbus block read and len is already read*/ + if (msg->flags & I2C_M_RECV_LEN && end_state != MSG_END_CONTINUE) + i2c_dev->msg_buf = msg->buf + 1; + i2c_dev->msg_buf_remaining = msg->len; i2c_dev->msg_err = I2C_ERR_NONE; i2c_dev->msg_read = !!(msg->flags & I2C_M_RD); @@ -1388,6 +1401,15 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], else end_type = MSG_END_REPEAT_START; } + /* If M_RECV_LEN use ContinueXfer to read the first byte */ + if (msgs[i].flags & I2C_M_RECV_LEN) { + ret = tegra_i2c_xfer_msg(i2c_dev, &msgs[i], MSG_END_CONTINUE); + if (ret) + break; + /* Set the read byte as msg len */ + msgs[i].len = msgs[i].buf[0]; + dev_dbg(i2c_dev->dev, "reading %d bytes\n", msgs[i].len); + } ret = tegra_i2c_xfer_msg(i2c_dev, &msgs[i], end_type); if (ret) break; @@ -1415,7 +1437,8 @@ static u32 tegra_i2c_func(struct i2c_adapter *adap) { struct tegra_i2c_dev *i2c_dev = i2c_get_adapdata(adap); u32 ret = I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK) | - I2C_FUNC_10BIT_ADDR | I2C_FUNC_PROTOCOL_MANGLING; + I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_10BIT_ADDR | + I2C_FUNC_PROTOCOL_MANGLING; if (i2c_dev->hw->has_continue_xfer_support) ret |= I2C_FUNC_NOSTART; @@ -1727,6 +1750,29 @@ static int tegra_i2c_init_hardware(struct tegra_i2c_dev *i2c_dev) return ret; } +static int tegra_i2c_setup_smbalert(struct tegra_i2c_dev *i2c_dev) +{ + struct tegra_i2c_smbalert *smbalert = &i2c_dev->smbalert; + struct gpio_desc *alert_gpiod; + struct i2c_client *ara; + + alert_gpiod = devm_gpiod_get(i2c_dev->dev, "smbalert", GPIOD_IN); + if (IS_ERR(alert_gpiod)) + return PTR_ERR(alert_gpiod); + + smbalert->alert_data.irq = gpiod_to_irq(alert_gpiod); + if (smbalert->alert_data.irq <= 0) + return smbalert->alert_data.irq; + + ara = i2c_new_smbus_alert_device(&i2c_dev->adapter, &smbalert->alert_data); + if (IS_ERR(ara)) + return PTR_ERR(ara); + + smbalert->ara = ara; + + return 0; +} + static int tegra_i2c_probe(struct platform_device *pdev) { struct tegra_i2c_dev *i2c_dev; @@ -1821,6 +1867,12 @@ static int tegra_i2c_probe(struct platform_device *pdev) if (err) goto release_rpm; + if (device_property_read_bool(i2c_dev->dev, "smbus-alert")) { + err = tegra_i2c_setup_smbalert(i2c_dev); + if (err) + dev_warn(&pdev->dev, "smbus-alert setup failed: %d\n", err); + } + return 0; release_rpm: