From patchwork Wed May 26 17:20:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 448344 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7503EC47088 for ; Wed, 26 May 2021 17:21:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D6D3613C3 for ; Wed, 26 May 2021 17:21:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235168AbhEZRXP (ORCPT ); Wed, 26 May 2021 13:23:15 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:36804 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235178AbhEZRWj (ORCPT ); Wed, 26 May 2021 13:22:39 -0400 Received: from mail-vs1-f69.google.com ([209.85.217.69]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1llxDN-0003eF-D1 for devicetree@vger.kernel.org; Wed, 26 May 2021 17:21:06 +0000 Received: by mail-vs1-f69.google.com with SMTP id q16-20020a67d7900000b0290228198e77b6so553480vsj.23 for ; Wed, 26 May 2021 10:21:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YYv9QSwtcmYn0218F0zCf1aEruGYQ8/WBysY7w5EfCc=; b=jzbNqhY0O1C6rMTvJrLa8BDbT6poHGDTMxC3TU7fUcijY7077eZICvQnycHdwM+tf/ V6ipfaoERNpgiS0c02ree4WoKO9MjH7vMME8KhqBeUlU/B2hEtNb9rro50tcf18vlnU1 Z5UrluuOTfDZDyGrLjLmj8dFCJvbJqlNQNib348+XL4sRAaDYUnn8cwjtGNBuQhdaOHu uq2vI47q1Pu2gsRbTiB5Jcszl4cxydsBhQeZMMOcALtOSU1KNRM8nP41Da+6dANnU/jv CabrW4+fvgEhGj7oK0HUgbvv6OoB/3I5G1NJ3R4iHPQ3AbbfpMfqD8xX7HVO5qWxtkSg gsPA== X-Gm-Message-State: AOAM533aWTwZv4Ot2OmgxQdKJMFBkvngFkH+nBQq1khzCkmC38n4En0R O39xt5z4UHX13j+lbCEHUfbjg7jKcCO2e3l6bVIPuBfXs6dA+OOkdpuM6PeqSSxbK0A00jp1V1/ +ch2GHYB5BPnNcpsFuLWxJqjDBSbOtfkSgVm5uI0= X-Received: by 2002:ac5:c382:: with SMTP id s2mr31980829vkk.24.1622049664527; Wed, 26 May 2021 10:21:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBWWyrs1VJTSEVr7gNlAWxnMbfMY4X+d68llpnvHKbyCP4O8ma7yU99jBXSJa7bdYyXsWV8g== X-Received: by 2002:ac5:c382:: with SMTP id s2mr31980793vkk.24.1622049664379; Wed, 26 May 2021 10:21:04 -0700 (PDT) Received: from localhost.localdomain ([45.237.48.6]) by smtp.gmail.com with ESMTPSA id u195sm2036032vsc.10.2021.05.26.10.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 10:21:03 -0700 (PDT) From: Krzysztof Kozlowski To: Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Michael Turquette , Stephen Boyd , Rob Herring , Lee Jones , Sebastian Reichel , Liam Girdwood , Mark Brown , Alessandro Zummo , Alexandre Belloni , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-rtc@vger.kernel.org Cc: Krzysztof Kozlowski , Iskren Chernev Subject: [PATCH v2 7/7] power: supply: max17040: Do not enforce (incorrect) interrupt trigger type Date: Wed, 26 May 2021 13:20:36 -0400 Message-Id: <20210526172036.183223-8-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210526172036.183223-1-krzysztof.kozlowski@canonical.com> References: <20210526172036.183223-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Krzysztof Kozlowski 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. Signed-off-by: Krzysztof Kozlowski Acked-by: Iskren Chernev Acked-by: Rob Herring --- Changes since v1: 1. Remove the 'flags' variable. 2. Added ack. 3. Rebase - the bindings were converted to dtschema. --- .../devicetree/bindings/power/supply/maxim,max17040.yaml | 2 +- drivers/power/supply/max17040_battery.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml index de91cf3f058c..f792d06db413 100644 --- a/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml +++ b/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml @@ -89,7 +89,7 @@ examples: reg = <0x36>; maxim,alert-low-soc-level = <10>; interrupt-parent = <&gpio7>; - interrupts = <2 IRQ_TYPE_EDGE_FALLING>; + interrupts = <2 IRQ_TYPE_LEVEL_LOW>; wakeup-source; }; }; diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c index 1aab868adabf..e80dd9141ae7 100644 --- a/drivers/power/supply/max17040_battery.c +++ b/drivers/power/supply/max17040_battery.c @@ -361,12 +361,10 @@ static irqreturn_t max17040_thread_handler(int id, void *dev) static int max17040_enable_alert_irq(struct max17040_chip *chip) { struct i2c_client *client = chip->client; - unsigned int flags; int ret; - flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT; ret = devm_request_threaded_irq(&client->dev, client->irq, NULL, - max17040_thread_handler, flags, + max17040_thread_handler, IRQF_ONESHOT, chip->battery->desc->name, chip); return ret;