Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5121341pxu; Thu, 10 Dec 2020 13:32:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJz56s+kpV3VP4bGvCKk9fgr507RsEY712buf8kyJm/thRvCOknrewTJETuIOMaJPk34jz/s X-Received: by 2002:a50:d74c:: with SMTP id i12mr8766442edj.236.1607635958028; Thu, 10 Dec 2020 13:32:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607635958; cv=none; d=google.com; s=arc-20160816; b=Bxi+K/bG1FQbgMgxp/f3eKS79Ki51XH4S0//iCF3KZ077Z8s/0nKYcg6vEqXqQqBiI uQ06YVYCsCNh85Bhax0l76DoMJE/YPrkPIQ8C51dGMYSZyEUs5sRCvPtyx20K1QbmdJ3 sEGCUO71f1Peo118qqJt5a6vYOx/iy53GhHQ4a1UfazzUZuVhAHyA0CBHFOkqpz6l1rH qbKyvPtwc6VOnQul4ROKX6C4y4xOr1+KjESKUdG9j0RYtKbCRwOR5fKmf2+9drlfZmDS gSBOe+foKRkD1/VZt55hqpIqI8JP3QZwgcLDtREs7avBnzjbzeRb3qjUVOL0ClTjtqML A4EQ== 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=5HWdN0z9pXunPpgBHndKQUtRESP0Q2ZgJMe6ClRJZUE=; b=EVcEniYJ70UpUuUXiKImYNQZg429IO6l3hSm7VfIeKX9Rt5kU1m3xMeosvPXlMvPJL BGtZ20nJxQ2DAflSb30vja0QdZp1D+gJZ4txMjZJ5JNSy22t80im5I2y6Dy5M9vfqSMG mmuZFSFY1KrLlmSXuHu+KIFEjvsn4iCoI/m6VPecWyaW1S+vlljsosr6Ec1zjc1x+h39 AbXvxayq4q16Enl+3KJtctC5GD/uVJsDYJ7AKxZ6tALDDVdyRFHa8dXdvOB0sD9e6Ywc aD23Bul3yaS0bizsgA6SOPsPjAVInXzunEoYirrxi3ClOjzcY5Yoo+hEC9L5rRBVzYzw nRkw== 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 cc21si4353444edb.123.2020.12.10.13.32.15; Thu, 10 Dec 2020 13:32:38 -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 S2404985AbgLJV21 (ORCPT + 99 others); Thu, 10 Dec 2020 16:28:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:38414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404943AbgLJV1l (ORCPT ); Thu, 10 Dec 2020 16:27:41 -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 17/18] mfd: max14577: Do not enforce (incorrect) interrupt trigger type Date: Thu, 10 Dec 2020 22:25:33 +0100 Message-Id: <20201210212534.216197-17-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 14577/77836 datasheets describe 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 charger 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/max14577.txt | 4 ++-- drivers/mfd/max14577.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/max14577.txt b/Documentation/devicetree/bindings/mfd/max14577.txt index 92070b346756..be11943a0560 100644 --- a/Documentation/devicetree/bindings/mfd/max14577.txt +++ b/Documentation/devicetree/bindings/mfd/max14577.txt @@ -71,7 +71,7 @@ max14577@25 { compatible = "maxim,max14577"; reg = <0x25>; interrupt-parent = <&gpx1>; - interrupts = <5 IRQ_TYPE_NONE>; + interrupts = <5 IRQ_TYPE_LEVEL_LOW>; muic: max14577-muic { compatible = "maxim,max14577-muic"; @@ -106,7 +106,7 @@ max77836@25 { compatible = "maxim,max77836"; reg = <0x25>; interrupt-parent = <&gpx1>; - interrupts = <5 IRQ_TYPE_NONE>; + interrupts = <5 IRQ_TYPE_LEVEL_LOW>; muic: max77836-muic { compatible = "maxim,max77836-muic"; diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c index be185e9d5f16..6c487fa14e9c 100644 --- a/drivers/mfd/max14577.c +++ b/drivers/mfd/max14577.c @@ -332,7 +332,7 @@ static int max77836_init(struct max14577 *max14577) } ret = regmap_add_irq_chip(max14577->regmap_pmic, max14577->irq, - IRQF_TRIGGER_FALLING | IRQF_ONESHOT | IRQF_SHARED, + IRQF_ONESHOT | IRQF_SHARED, 0, &max77836_pmic_irq_chip, &max14577->irq_data_pmic); if (ret != 0) { @@ -418,14 +418,14 @@ static int max14577_i2c_probe(struct i2c_client *i2c, irq_chip = &max77836_muic_irq_chip; mfd_devs = max77836_devs; mfd_devs_size = ARRAY_SIZE(max77836_devs); - irq_flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT | IRQF_SHARED; + irq_flags = IRQF_ONESHOT | IRQF_SHARED; break; case MAXIM_DEVICE_TYPE_MAX14577: default: irq_chip = &max14577_irq_chip; mfd_devs = max14577_devs; mfd_devs_size = ARRAY_SIZE(max14577_devs); - irq_flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT; + irq_flags = IRQF_ONESHOT; break; } -- 2.25.1