Received: by 10.223.185.116 with SMTP id b49csp4948418wrg; Tue, 27 Feb 2018 05:28:06 -0800 (PST) X-Google-Smtp-Source: AH8x225CELo9wlGWLLuBdqxLtWTIv25pA/kNT/Ae/kZGqZLHaun6pcEri6185U/hwhySFtFDd+FH X-Received: by 2002:a17:902:27:: with SMTP id 36-v6mr14269714pla.128.1519738086000; Tue, 27 Feb 2018 05:28:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519738085; cv=none; d=google.com; s=arc-20160816; b=J5c+Y5l/E9D9DFlqxY2sdYE4GsOmohYc1seEFNJSOypAS/Hcc8jHaGpNdmFbSFkkrh ocaHj8GZCJOKJE7GoQPCMSEXThvoWMv2yE0pGPrc7fQxIVhxjKDpyueZrzCr3AVpH3/I 6v6M+eCQVkn8n+NT18p6WnCefH5X7hrJcoIOkHnB7YBhZHUpdEHRg2ghbX8GJry2EeCe bOIBAGR0/hhOVhOwZxtgiLYcQ4iAke6WLGuBzH+kYP0sA2EgBQ3N+EvGKb72r0gwRXFY zDyQDcsl9bNkPyWT+KpE2B/2FDR1a4yWgorighiZz78de5lE9R3NMtutoqpMzA7dbZ+0 Bdkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=6+LI8F+Bg1zwpn/P6Hij+PRQqRZH9OjiPM3q8Qz0It8=; b=aardefyFqfT6bsp6xl2wSANE+UY/b6weSpsuFBSnqcdFd5Su1faW+0hXz5geJ8Dkm0 Ch2lqvyrT4cOp2fttFlVdLpWcKvNJFktmKLxeyjibY8bdNz6P+VPytfLYPtEwVtqpTNj NqecRJpchdzDDIDsAItF+7hHhAVtZciuRPakf7ryTSt4bVL0xC5sv0azfwN3RWFnJiJB PeIrpeDRZXHq3P5p2wOM7BkO6YzAyYsHHJHbFgydoBPWtRG4wGL8FqMPmXowY9hMwgeR npKEsCaFRo/9iHU42sIwSlQv4NIvpEUQFoy3U6Pf9jCMHN8rhdTnWtEksfq9EG7UKr5G XHVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=TfkXwXbL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3si593430pgv.79.2018.02.27.05.27.51; Tue, 27 Feb 2018 05:28:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=TfkXwXbL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753344AbeB0N1C (ORCPT + 99 others); Tue, 27 Feb 2018 08:27:02 -0500 Received: from mail-co1nam03on0047.outbound.protection.outlook.com ([104.47.40.47]:14560 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753239AbeB0N0s (ORCPT ); Tue, 27 Feb 2018 08:26:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=6+LI8F+Bg1zwpn/P6Hij+PRQqRZH9OjiPM3q8Qz0It8=; b=TfkXwXbLvaynPzEvyXm97z9Lb9vBav6IND+UoqNNBdEcXaml9H9CIJ6oATjH0Ll9qtPI1ZYybv5HJP8yIXYaRUsz7u3H3u50Qp7AjhXDypiUf5b7VJN1ccAe7Aqj+LINFDnpQaYkSRzycZ1afTk8+ZiesGit7+siB0G88xbmdZ4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=George.Cherian@cavium.com; Received: from ubuntu.caveonetworks.com (111.93.218.67) by BY2PR07MB2328.namprd07.prod.outlook.com (10.166.114.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Tue, 27 Feb 2018 13:26:44 +0000 From: George Cherian To: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: wsa@the-dreams.de, George Cherian , Kamlakant Patel Subject: [PATCH 3/3] i2c: xlp9xx: Add support for SMBAlert Date: Tue, 27 Feb 2018 13:26:20 +0000 Message-Id: <1519737980-27997-3-git-send-email-george.cherian@cavium.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1519737980-27997-1-git-send-email-george.cherian@cavium.com> References: <1519737980-27997-1-git-send-email-george.cherian@cavium.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0086.INDPRD01.PROD.OUTLOOK.COM (10.174.208.154) To BY2PR07MB2328.namprd07.prod.outlook.com (10.166.114.142) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 53b38eb2-40e5-4e99-deca-08d57de5bfbc X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:BY2PR07MB2328; X-Microsoft-Exchange-Diagnostics: 1;BY2PR07MB2328;3:dEcDCXPGbDiacPCuzsJNmlf4SyyB2pFncMXjTebqVoLQPTWW3vJc1bBOSsmZIbuHsFB2IVtDHe+zGBl6oGEdVHTONg4xt42BRELsynYjYblzHa9N9QjUlr+dQR5LZ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cFjJQiEWkLxfUjyd3mrt06roi4NUlkwU04kgSyNaqzMsYs8gl+l9F3Git2g9jaRejhZfEr+Cxw5uWO/z1XD22rUCgqZF5MnxGaWgOiVFiTw+z7dgnc4cQO7eXJTrWoPHGre934/SU4TxIfRVy6cdzqBZ7k69dT6U7xBb4ERcodTBNfWaZF8yIs4cH6x1nsUm4yoBuKx4JDfVne5yRD2w79s1kf7xx5zQbI2n;4:CKIZ8eHV+/I9sNd/MjpZTinfoPMDLxxn5HQJuDiCecwmM00EBAEOvQu3Pwl0jfYt2AoM6sqIDX7Amrk1lEQryuU7l97aAwQqTgVz+1cPeW94BwcZ1IdkkVZsZKef43+ZSKVUhm8/f6vyqWJ241K7JwFi32IhCkMmjfHlJWYofCIY992wKjafPHOHQx1Cm/hnySQC4n2EN7Rw7Bglr/evzctmrgWT0DrnPKexLNIFrfWF4/kaGh5saFlyZNQhIDm24hO1+itpKAPdVj59ezt4uA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040501)(2401047)(8121501046)(5005006)(3002001)(3231220)(944501198)(93006095)(93001095)(10201501046)(6041288)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011);SRVR:BY2PR07MB2328;BCL:0;PCL:0;RULEID:;SRVR:BY2PR07MB2328; X-Forefront-PRVS: 05961EBAFC X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(346002)(376002)(39380400002)(366004)(396003)(39860400002)(199004)(189003)(97736004)(51416003)(50466002)(86362001)(54906003)(48376002)(36756003)(66066001)(305945005)(6486002)(7736002)(53416004)(26005)(386003)(68736007)(16526019)(478600001)(16586007)(6666003)(76176011)(72206003)(316002)(52116002)(4326008)(106356001)(5009440100003)(25786009)(2950100002)(107886003)(105586002)(186003)(6506007)(53936002)(6512007)(6116002)(3846002)(5660300001)(81166006)(50226002)(8676002)(2906002)(69596002)(81156014)(47776003)(8936002);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR07MB2328;H:ubuntu.caveonetworks.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR07MB2328;23:ck/BepZv3zWVaGlmv3xzBRfpqM4uwKhVN28DPYzdR?= =?us-ascii?Q?cU+RFbgnyS3dZB/9HezXSQ6cEOQ5s3bf0tVzYm+9BoUx9Vs+PsyvTE55G31G?= =?us-ascii?Q?zdNnEBlIKTwSGU8ZmC4AR3prVOxtIh7vvP36dFGgN4u7Aa9AYlQwK3agoRTU?= =?us-ascii?Q?AsJZMvX9kFjAmxzSvba9h2gzT0MFoNA0VvWJYTA5pn5s3OFDX5FAiq2xXuZJ?= =?us-ascii?Q?kW+snA8LEHBz2Y96MBbtIdB0XO3POu0bp6UIxOPetT4nY/b3qxIxWhJfT9Kp?= =?us-ascii?Q?5PjNbYEqweTGO+JvOeUJtzIppza8w0ZhecjXxYHYwWFEV+dxBKD23EIWZi3z?= =?us-ascii?Q?/266Qcnq6r3c7uKYYx3w8zszr9Lgm7k22RN2qa7/NWOV4+dGODWYBkg8Z9cu?= =?us-ascii?Q?DURLcbUNFg8/z8U644l4SK0s2KAOF1H2uEBg+Dxbaeslk3HwrUWVmae7eDkZ?= =?us-ascii?Q?MLtv/v2t2FYoTvLj8WAgTVaELvW0vQl1HETLo7SdFQnAUEUCowXOmPEEZzpS?= =?us-ascii?Q?sls0uHaDQMr4kPG5nA9bWAjMJ0kCrptAptUUV/FBWNkGWJEzuUx+uE0J1hfT?= =?us-ascii?Q?V1WbacpysiM7ksvoNAep65XoaeiXbdLQ/4hq1C8YKfsn5Mbh3otft7aerhx3?= =?us-ascii?Q?Tr+VwocfX28+icyMRowc2FkJq0h6cYpeBLz+f1figgL7J7qqtYUP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D15j5niOND8fwuMrRsTPW04YFQV4=;5:zLCHPG5nsBi49QqAR2GWxkFVXZgfkG6xn0m022QXfkF78Bvb92Q5c5KdWp87tc42TffxbPnf23vHd6hYl662raSrVB94h9xkDtiVG4+VjCTTR2VDvZoDHtWBOocYF/RXSwbH6fFrQLDkSnIug6NgdXoK5KuKRSQdYiwDbofvqyk=;24:+uifslQqzapcGlc49sjol3ICuS8opHbkyIDQhzxQ8JhJiKUEOfNl04hJlEHhpYJ2YquVZfTHDgk2IeXvO9k2gafRwKHeQjRedNA4jVq0LpE=;7:hG6sy21MLZTlPdo10HAvckzCc/qqGfssd+fcrUJXpUwq81FcqxYh81UFQ/5D1o5ON8vcIGPr0VjiPzRBpRyTxGW8YIVWxpk6xUkf1RLN7L11JK0idKjpUzAmKlhPn2QVgONNj8ACVYY3CWJyW9f94J9VyuyWllIMyxN/sbZdRoSu3i8jBBTU+U2IrOz5/20uIjCkCtGlEW8bKYrVrVSOQlCjxx6P5B9h1fOULFcjtoxobk5Msb57bQvxz6vcExU6 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2018 13:26:44.1382 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 53b38eb2-40e5-4e99-deca-08d57de5bfbc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR07MB2328 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for SMBus alert mechanism to i2c-xlp9xx driver. The second interrupt is parsed to use for SMBus alert. The first interrupt is the i2c controller main interrupt. Signed-off-by: Kamlakant Patel Signed-off-by: George Cherian --- drivers/i2c/busses/i2c-xlp9xx.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/i2c/busses/i2c-xlp9xx.c b/drivers/i2c/busses/i2c-xlp9xx.c index eb8913e..9462eab 100644 --- a/drivers/i2c/busses/i2c-xlp9xx.c +++ b/drivers/i2c/busses/i2c-xlp9xx.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -84,6 +85,8 @@ struct xlp9xx_i2c_dev { struct device *dev; struct i2c_adapter adapter; struct completion msg_complete; + struct i2c_smbus_alert_setup alert_data; + struct i2c_client *ara; int irq; bool msg_read; bool len_recv; @@ -447,6 +450,21 @@ static int xlp9xx_i2c_get_frequency(struct platform_device *pdev, return 0; } +static int xlp9xx_i2c_smbus_setup(struct xlp9xx_i2c_dev *priv, + struct platform_device *pdev) +{ + if (!priv->alert_data.irq) + return -EINVAL; + + priv->alert_data.alert_edge_triggered = 0; + + priv->ara = i2c_setup_smbus_alert(&priv->adapter, &priv->alert_data); + if (!priv->ara) + return -ENODEV; + + return 0; +} + static int xlp9xx_i2c_probe(struct platform_device *pdev) { struct xlp9xx_i2c_dev *priv; @@ -467,6 +485,10 @@ static int xlp9xx_i2c_probe(struct platform_device *pdev) dev_err(&pdev->dev, "invalid irq!\n"); return priv->irq; } + /* SMBAlert irq */ + priv->alert_data.irq = platform_get_irq(pdev, 1); + if (priv->alert_data.irq <= 0) + priv->alert_data.irq = 0; xlp9xx_i2c_get_frequency(pdev, priv); xlp9xx_i2c_init(priv); @@ -493,6 +515,10 @@ static int xlp9xx_i2c_probe(struct platform_device *pdev) if (err) return err; + err = xlp9xx_i2c_smbus_setup(priv, pdev); + if (err) + dev_info(&pdev->dev, "No active SMBus alert %d\n", err); + platform_set_drvdata(pdev, priv); dev_dbg(&pdev->dev, "I2C bus:%d added\n", priv->adapter.nr); -- 2.1.4