Received: by 10.223.185.116 with SMTP id b49csp3584959wrg; Tue, 6 Mar 2018 01:19:57 -0800 (PST) X-Google-Smtp-Source: AG47ELuDY1UqoTNSm73FMFiDVayqrqHrmYCEKlBDoPmkhso5LGTgkMOXdCAFe/9C/itCoI0eGTba X-Received: by 2002:a17:902:8a89:: with SMTP id p9-v6mr16038032plo.379.1520327997021; Tue, 06 Mar 2018 01:19:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520327996; cv=none; d=google.com; s=arc-20160816; b=SLTvr23ik92CGiKcYkktFOs+TWjUTbuRpcfqLR+PNoqCyufZp/zsOqG8fOSHnrL45p NOJtXqn6anmzLZe+pde3ZqEPucLzM0vosK5QmsayECuOrNJdKvqlD3ntfS3zjrGL02Un FnbdfrebHUu8IA5Tb6OA2RV7R/ZVHeRiYml2k5MjI9VeLhpCTVoGr1mNAZstsZVvZ7gH cgKsIaWcWGz+DIr16lo3OccEiZvkZ8SzgZ+a+a0kXSFAXYzkznaixf+v2fXd5PY0htcn OmaVbyzVLy28CK/KEGv1rPqki7tSAURL62wJX8TPmMtjK7ftsPK85Kf/Z2afAOjG07p5 8DgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=94wUbJbRwPS8RxmycIyi34Pw+nQOysVdVNr6kSjrlA4=; b=vm50RoVO0mgdgHGaylH3GoascxJJxk84DbQguisDbX+nR2RN0zHLGQTNhYe50w6UEy Dsbo7T+rR6SP+Lp+dyplWmEpdKt1PlaDR9O0dCZPfu40llC2gSpGuIVhWPaCrWOl2jlO t7A3+wToMqNzbY/lkfK1fOa6MIf/jdqYKs5LSYibTMLIiBoE62Q0ybUvCfOuQ5lzCvNg 0/siZn+DETrk4wmfZCRyH+v1zQnugGupREQ9OeaI3zHvp9ETaDxfsUMtAnDGATkF/26P zoV7/9sLXiKgL6a2+CPYWU+E0d5ClZkLlzhcT4Q0vZv4DXcxAPIYmJBpgkf0OZ1JSgIm LKmg== ARC-Authentication-Results: i=1; mx.google.com; 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 b59-v6si10876085plb.529.2018.03.06.01.19.43; Tue, 06 Mar 2018 01:19:56 -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; 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 S1753358AbeCFJSv (ORCPT + 99 others); Tue, 6 Mar 2018 04:18:51 -0500 Received: from anchovy3.45ru.net.au ([203.30.46.155]:53743 "EHLO anchovy3.45ru.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753322AbeCFJSt (ORCPT ); Tue, 6 Mar 2018 04:18:49 -0500 Received: (qmail 8245 invoked by uid 5089); 6 Mar 2018 09:18:46 -0000 Received: by simscan 1.2.0 ppid: 8163, pid: 8166, t: 0.0525s scanners: regex: 1.2.0 attach: 1.2.0 clamav: 0.88.3/m:40/d:1950 Received: from unknown (HELO ?192.168.0.122?) (preid@electromag.com.au@203.59.235.95) by anchovy2.45ru.net.au with ESMTPA; 6 Mar 2018 09:18:46 -0000 Subject: Re: [PATCH 3/3] i2c: xlp9xx: Add support for SMBAlert To: Jan Glauber , George Cherian Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, wsa@the-dreams.de, Kamlakant Patel References: <1519737980-27997-1-git-send-email-george.cherian@cavium.com> <1519737980-27997-3-git-send-email-george.cherian@cavium.com> <20180306083647.GA11729@wintermute> From: Phil Reid Message-ID: Date: Tue, 6 Mar 2018 17:18:43 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180306083647.GA11729@wintermute> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-AU Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/03/2018 16:36, Jan Glauber wrote: > On Tue, Feb 27, 2018 at 01:26:20PM +0000, George Cherian wrote: >> 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; > > Hi George, > > I think this is not needed anymore, see: > 9b9f2b8bc2ac i2c: i2c-smbus: Use threaded irq for smbalert > > --Jan Yes. And also all of this is not needed if named interrupts. - interrupt-names "irq", "wakeup" and "smbus_alert" names are recognized by I2C core, other names are left to individual drivers. presence of named irq smbus_alert should result in alert handler being created for that bus by the core > >> + >> + 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 > > -- Regards Phil Reid