Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5119968pxu; Thu, 10 Dec 2020 13:30:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJy3nEgO8YUinJR4wsnirkE4pRhjg2GpaWsFz3yxX7ghy+4d4W8Fn0Z/NdzNZ7lj9qlyX8lk X-Received: by 2002:a50:f61b:: with SMTP id c27mr8731926edn.61.1607635825937; Thu, 10 Dec 2020 13:30:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607635825; cv=none; d=google.com; s=arc-20160816; b=LtJCTvm9IM8VKJmUidTsKgzwQzdSm45HqN/8AAhv1CFHYVMiPifWw7PrDq31Ydnv59 lOxFxizuA2IlnuyGlsT3JU9YLyDC7Ug08aBf96hkwdVLGYrHFTRpnGDMbYenyy0kepLm Z9L+57NLeUFa6fmWYTj1bHFRYI2cBoEAKYMJURRgeUYoIELmU+zcY9H0EqXy4eQJ9rDN I267MspEhAM14MfT9FESgw79cbuVzwFxa1oh6WHkOGTFebZdwqncRAbM5K2IUJI0YJur D2JhQX7bYqV2J1CYVmy87Q/b8Iz6vp0D+ayQKqf8txWVidHSX6jItPvlOlTtw9dD+URG oFfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=vdkfN+iCKLWeSBLQM+m+gB/QfArUY0plLrVcKqGnhAo=; b=UskxnJJPiLXyqcqROC3wWk22Bu3ajhpWU3VmfGzAG8O0ELfX3/D/X43+Ujid889+hb udtmSnxauvhaWTLuSwBmF+KRKvD8Ccaltsb37HnV0FJVnCy9nAhzUaz9mTRqmYXKCOfP rxUtllDEuRjvHtuqQTaW8mXqjfiGgYORpkFJ6WKjFDaUp5zB9Sy/suIVKL6td+O23DNk Ncub6e+3z1jnaImEJvUJX9lqRJHdcI0vXQKyV8siNSm+G9NuhWj32RrFsMozvraTOpoA wdwVs1PvvmlcENJj8+vjkNDvtI8WivjuR1MmDAPTLsuVPAQjAGbnFUcKFXa19Ef8f4p2 lR1Q== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d13si3621912edv.602.2020.12.10.13.30.03; Thu, 10 Dec 2020 13:30:25 -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; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404937AbgLJV1j (ORCPT + 99 others); Thu, 10 Dec 2020 16:27:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:38786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404919AbgLJV1g (ORCPT ); Thu, 10 Dec 2020 16:27:36 -0500 From: Krzysztof Kozlowski Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Michael Turquette , Stephen Boyd , Rob Herring , Lee Jones , Sebastian Reichel , Liam Girdwood , Mark Brown , Andy Gross , Bjorn Andersson , Alessandro Zummo , Alexandre Belloni , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-rtc@vger.kernel.org Cc: Iskren Chernev , Matheus Castello , Sebastian Krzyszkowiak , Angus Ainslie , Hans de Goede Subject: [RFC 15/18] mfd: max77693: Do not enforce (incorrect) interrupt trigger type Date: Thu, 10 Dec 2020 22:25:31 +0100 Message-Id: <20201210212534.216197-15-krzk@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201210212534.216197-1-krzk@kernel.org> References: <20201210212534.216197-1-krzk@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Interrupt line can be configured on different hardware in different way, even inverted. Therefore driver should not enforce specific trigger type - edge falling - but instead rely on Devicetree to configure it. The Maxim 77693 datasheet describes the interrupt line as active low with a requirement of acknowledge from the CPU therefore the edge falling is not correct. The interrupt line is shared between PMIC and RTC driver, so using level sensitive interrupt is here especially important to avoid races. With an edge configuration in case if first PMIC signals interrupt followed shortly after by the RTC, the interrupt might not be yet cleared/acked thus the second one would not be noticed. Signed-off-by: Krzysztof Kozlowski --- This patch should wait till DTS changes are merged, as it relies on proper Devicetree. --- Documentation/devicetree/bindings/mfd/max77693.txt | 2 +- drivers/mfd/max77693.c | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/max77693.txt b/Documentation/devicetree/bindings/mfd/max77693.txt index 0ced96e16c16..1032df14498b 100644 --- a/Documentation/devicetree/bindings/mfd/max77693.txt +++ b/Documentation/devicetree/bindings/mfd/max77693.txt @@ -139,7 +139,7 @@ Example: compatible = "maxim,max77693"; reg = <0x66>; interrupt-parent = <&gpx1>; - interrupts = <5 2>; + interrupts = <5 IRQ_TYPE_LEVEL_LOW>; regulators { esafeout@1 { diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c index 596ed85cab3b..4e6244e17559 100644 --- a/drivers/mfd/max77693.c +++ b/drivers/mfd/max77693.c @@ -222,8 +222,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, } ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, - IRQF_ONESHOT | IRQF_SHARED | - IRQF_TRIGGER_FALLING, 0, + IRQF_ONESHOT | IRQF_SHARED, 0, &max77693_led_irq_chip, &max77693->irq_data_led); if (ret) { @@ -232,8 +231,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, } ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, - IRQF_ONESHOT | IRQF_SHARED | - IRQF_TRIGGER_FALLING, 0, + IRQF_ONESHOT | IRQF_SHARED, 0, &max77693_topsys_irq_chip, &max77693->irq_data_topsys); if (ret) { @@ -242,8 +240,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, } ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, - IRQF_ONESHOT | IRQF_SHARED | - IRQF_TRIGGER_FALLING, 0, + IRQF_ONESHOT | IRQF_SHARED, 0, &max77693_charger_irq_chip, &max77693->irq_data_chg); if (ret) { @@ -252,8 +249,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, } ret = regmap_add_irq_chip(max77693->regmap_muic, max77693->irq, - IRQF_ONESHOT | IRQF_SHARED | - IRQF_TRIGGER_FALLING, 0, + IRQF_ONESHOT | IRQF_SHARED, 0, &max77693_muic_irq_chip, &max77693->irq_data_muic); if (ret) { -- 2.25.1