Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3378522pxb; Mon, 17 Jan 2022 19:04:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1Xq0aJj3U8344OvPPNDQi9ewYaZ/17egRYgJRIIC62Y6zdqpYX6v8ezP1DxZ4SN7arUJ/ X-Received: by 2002:a17:90a:5d16:: with SMTP id s22mr28082291pji.81.1642475050340; Mon, 17 Jan 2022 19:04:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642475050; cv=none; d=google.com; s=arc-20160816; b=BDPglEcjYnpOwVLzRQZ1EkfohwRz/mPYIjZjICbNqIyahmWIaeE/+OodYGlPnuejK/ YOJeR8lktZH9REiE+0MJuqMgghojZ1yXg3S2w7888nrcY0TBNbsvFgjz4FjysssZYSsW KO5S2Gnz4Wge7uEWFC2FZiKDXd3rd7Zlf5IG3dWE319jTw1In1dZLS32v2XeA2UbkdBp 5+7botvk9PmpKCPTntdsdauvp/weQpX0yMFXP3gB4qoKat4fRrYOK1LSDI4Dcv4Q4dMD Xi4jCcSNIE8Kp1jEkdcoYezA614XC2oChLt3R5bN1ADYM9tnBJZRgBYrFfFdbOjEtHW+ HMMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :message-id:date:cc:to:from:dkim-signature; bh=eRfcHBnhbwqYtyrduiwv+S9EIycAIao9n4R5EcS/cbY=; b=mH1Y+TrHStYUG5Kmkm3DVvszP9D5puByUQDur5npu2uCNr6tjyRK9glKQ8FWfvNO03 FyaxJT8HZeXikVXu+W2QNep5xRVw7nBXSauX9PDZVRUK2SlJ+g7UVZ75wWivj2DWcQog 2dI+GnQluFD7y9LKnsQ1hm5rMnsbpIHPc9zmC/1U4Iq/vLeAGM+F/g6quqCT2xWHE6jb gllafXTgqVqGrriuqrNkV3JW0qh4j14FEkEf5veU9VSM7UYPoZcvkST8MbAUKUzUyOPb F8JO3xpSXBAnGAdDC0cGWZrgXulaQo66UDKWbojEdCC/s923o/kBqTE1nLk/KLvm/All UXlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=pPXEnO34; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u1si14825481plq.126.2022.01.17.19.03.58; Mon, 17 Jan 2022 19:04:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=pPXEnO34; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243728AbiAQW5y (ORCPT + 99 others); Mon, 17 Jan 2022 17:57:54 -0500 Received: from mail.hugovil.com ([162.243.120.170]:47636 "EHLO mail.hugovil.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238447AbiAQW5x (ORCPT ); Mon, 17 Jan 2022 17:57:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=eRfcHBnhbwqYtyrduiwv+S9EIycAIao9n4R5EcS/cbY=; b=p PXEnO348HBcs1W+V1mU/az3PRaAD035nCmCDeex0q0MnxjhzWa1h89L6Peu8HdxeQo5ovMVlGOn1I ZH/cKbvYwbBTq0AHWa6HIkZ/KPrzIwF3FRd3lgeRvi3haj/Ozwi2ifp4y8Vb2cfcIH2IXEfn/RWS9 DFJE9PgKrk6w/4tE=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:54814 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1n9awg-0005m9-1n; Mon, 17 Jan 2022 17:57:50 -0500 From: Hugo Villeneuve To: Alessandro Zummo , Alexandre Belloni Cc: hugo@hugovil.com, Hugo Villeneuve , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 17 Jan 2022 17:57:42 -0500 Message-Id: <20220117225742.1252362-1-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.hugovil.com X-Spam-Level: X-Spam-Report: * 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was * blocked. See * http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block * for more information. * [URIs: dimonoff.com] * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Subject: [PATCH] rtc: pcf2127: use IRQ flags obtained from device tree if available X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hugo Villeneuve If the interrupt pin of the PCF2127 is routed to the input of a GPIO expander using the pca953x driver, the later will only accept an IRQ of type IRQ_TYPE_EDGE_FALLING or IRQ_TYPE_EDGE_RISING, and the IRQ request will fail. Therefore, allow the IRQ type to be passed from the device tree data if available. Signed-off-by: Hugo Villeneuve --- drivers/rtc/rtc-pcf2127.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c index e6d0838ccfe3..cea10fdbb010 100644 --- a/drivers/rtc/rtc-pcf2127.c +++ b/drivers/rtc/rtc-pcf2127.c @@ -659,9 +659,20 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap, clear_bit(RTC_FEATURE_ALARM, pcf2127->rtc->features); if (alarm_irq > 0) { + unsigned long flags; + + /* + * If flags = 0, devm_request_threaded_irq() will use IRQ flags + * obtained from device tree. + */ + if (dev_fwnode(dev)) + flags = 0; + else + flags = IRQF_TRIGGER_LOW; + ret = devm_request_threaded_irq(dev, alarm_irq, NULL, pcf2127_rtc_irq, - IRQF_TRIGGER_LOW | IRQF_ONESHOT, + flags | IRQF_ONESHOT, dev_name(dev), dev); if (ret) { dev_err(dev, "failed to request alarm irq\n"); -- 2.30.2