Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6870147imm; Tue, 24 Jul 2018 04:42:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpemSddse9pJPUymZTvlWOuSbhNfT/gsKcUP4CWf4QoFKCeO/EOzWtz9uvcsgoCg8wiAE9CV X-Received: by 2002:a17:902:1a2:: with SMTP id b31-v6mr16334862plb.279.1532432555467; Tue, 24 Jul 2018 04:42:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532432555; cv=none; d=google.com; s=arc-20160816; b=ENBAh3M3lFqBTrsLYmZq87vSG8q9C6c1H+fpKOlGdb714j/+BOLq2+TjNoKZSXMFL4 IwsMtUV5GVvv1RyherY0geMq8dzkebMRRSsjdgNnNzhix+zAJvw7Y9HpcrekuA7z6bpy vCvy21K2fBjW4ndxHgBuu+jzo8+k/un8q5Z70IzP3aSL5gTo+zARF8UMiUlb+AO3Nv3Z U9KwFI02+jqiA/598bP5ZeXrZjC5O7EspkZHn1CDKZtMCZCIGgW8+CQvtgY48vXCWmAQ 3f+11aj7HHsjbQqquNAV57kawSGR6EgP5K4E/gizuV1cuotQXWM1CtEZydqYgpRBSAsM Q1hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:mime-version:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:subject:cc:to :from:arc-authentication-results; bh=yyZ1lMzj+t9OFzBmAXKIXYAY8E9odgPu058d6iKcKGE=; b=qdUGlk3iczlagQijewfaA3mCxaPUMvfhA+Ro/GksZPsR7rdNk41S7FhlfMID86AiNK R8RNiGF6gSh2oxUJHT1TvW/IFwCChIWcvI9/xp8cP71CCRHEhD6SXKUDaA17mR/0be6/ cALcaQXsjOzfvCrJRmVljL9wweZI/zeNACeKflddn1b5ixj0XpXBlrkubK7i13ADU1hu /eoKlG3AmG3PQI8OdVMQMgHBmk5nuOACZUKqF3xTHChuDH9S+Tic8Ui6TwFQ6A7aaCLU VFZaVk76FrNW+Gf/e+aa9fxBycZ8uOGElGD8/SPdbtZN1Q3CjDNiNpNanzJJuix12T0D iBAg== 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 u11-v6si9952094plq.456.2018.07.24.04.42.21; Tue, 24 Jul 2018 04:42:35 -0700 (PDT) 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 S2388457AbeGXMr1 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 24 Jul 2018 08:47:27 -0400 Received: from enterprise02.smtp.diehl.com ([193.201.238.220]:61312 "EHLO enterprise02.smtp.diehl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388417AbeGXMr0 (ORCPT ); Tue, 24 Jul 2018 08:47:26 -0400 X-$ESA-Groupmapping: true X-IronPort-AV: E=Sophos;i="5.51,397,1526335200"; d="scan'208";a="34467534" From: Denis OSTERLAND To: "a.zummo@towertech.it" , "alexandre.belloni@bootlin.com" CC: "linux-kernel@vger.kernel.org" , "robh+dt@kernel.org" , "m.grzeschik@pengutronix.de" , "devicetree@vger.kernel.org" , "mark.rutland@arm.com" , "linux-rtc@vger.kernel.org" , "kernel@pengutronix.de" , Denis OSTERLAND Subject: [PATCH v5 3/5] rtc: isl1208: Add "evdet" interrupt source for isl1219. Thread-Topic: [PATCH v5 3/5] rtc: isl1208: Add "evdet" interrupt source for isl1219. Thread-Index: AQHUI0HYyinCarqjR0ey3Ma/gWTNfw== Date: Tue, 24 Jul 2018 11:31:21 +0000 Message-ID: <20180724095437.6016-4-Denis.Osterland@diehl.com> References: <20180724095437.6016-1-Denis.Osterland@diehl.com> In-Reply-To: <20180724095437.6016-1-Denis.Osterland@diehl.com> Accept-Language: de-DE, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Evolution 3.18.5.2-0ubuntu3.2 MIME-Version: 1.0 X-TrailerSkip: 1 X-GBS-PROC: byQFdw3ukCM+zy1/poiPc3S+cPOwesVRp3YOtqJ1nLGxRkIgAaoKJEzjYB8Fub9+ X-TNEFEvaluated: 1 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="iso-8859-1" Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Denis Osterland Add support for "evdet" named interrupt source. The check if i2c client irq matches evdet irq is needed for the case that there is only one interrupt named "evdet". In this case i2c client code handles this like an unnamed interrupt souce and assigns the value. Signed-off-by: Denis Osterland Reviewed-by: Michael Grzeschik --- drivers/rtc/rtc-isl1208.c | 46 +++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index 3150ebdcb179..0812a14c2d5c 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c @@ -15,6 +15,7 @@ #include #include #include "rtc-core.h" +#include /* Register map */ /* rtc section */ @@ -725,11 +726,30 @@ static const struct attribute_group isl1219_rtc_sysfs_files = { .attrs = isl1219_rtc_attrs, }; +static int isl1208_setup_irq(struct i2c_client *client, int irq) +{ + int rc = devm_request_threaded_irq(&client->dev, irq, NULL, + isl1208_rtc_interrupt, + IRQF_SHARED | IRQF_ONESHOT, + isl1208_driver.driver.name, + client); + if (!rc) { + device_init_wakeup(&client->dev, 1); + enable_irq_wake(irq); + } else { + dev_err(&client->dev, + "Unable to request irq %d, no alarm support\n", + irq); + } + return rc; +} + static int isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id) { int rc = 0; struct rtc_device *rtc; + int evdet_irq = -1; if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -ENODEV; @@ -766,28 +786,22 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id) rc = rtc_add_group(rtc, &isl1219_rtc_sysfs_files); if (rc) return rc; + evdet_irq = of_irq_get_byname(client->dev.of_node, "evdet"); } rc = sysfs_create_group(&client->dev.kobj, &isl1208_rtc_sysfs_files); if (rc) return rc; - if (client->irq > 0) { - rc = devm_request_threaded_irq(&client->dev, client->irq, NULL, - isl1208_rtc_interrupt, - IRQF_SHARED | IRQF_ONESHOT, - isl1208_driver.driver.name, - client); - if (!rc) { - device_init_wakeup(&client->dev, 1); - enable_irq_wake(client->irq); - } else { - dev_err(&client->dev, - "Unable to request irq %d, no alarm support\n", - client->irq); - client->irq = 0; - } - } + if (client->irq > 0) + rc = isl1208_setup_irq(client, client->irq); + if (rc) + return rc; + + if (evdet_irq > 0 && evdet_irq != client->irq) + rc = isl1208_setup_irq(client, evdet_irq); + if (rc) + return rc; return rtc_register_device(rtc); } -- 2.18.0 Diehl Connectivity Solutions GmbH Gesch?ftsf?hrung: Horst Leonberger Sitz der Gesellschaft: N?rnberg - Registergericht: Amtsgericht N?rnberg: HRB 32315 ___________________________________________________________________________________________________ Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht. Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt. The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited.