From mboxrd@z Thu Jan 1 00:00:00 1970 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=-19.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 6340FC4332F for ; Mon, 13 Sep 2021 13:05:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4CC816103B for ; Mon, 13 Sep 2021 13:05:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240177AbhIMNGU (ORCPT ); Mon, 13 Sep 2021 09:06:20 -0400 Received: from smtp-relay-internal-0.canonical.com ([185.125.188.122]:33046 "EHLO smtp-relay-internal-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238050AbhIMNDx (ORCPT ); Mon, 13 Sep 2021 09:03:53 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id C8CF440263 for ; Mon, 13 Sep 2021 13:02:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1631538156; bh=iu9zMq7VH8HxvbrRseM1CzfWgZBkbaUNi4Cw0YJuwM0=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=ZZ96PHBT7+p7K/JIE+0jsK4hEjFGrETGJRCloLsZ6gGw86rIzioQHwHldVOpGGj6x pbkPEa2rmuDq8HjVd/bjyqs4rRPOQ8juddPUsTj1iWheAYMkg8CJLDHIhjTPrdQV9m t3w7yIr5AIlNwZzW+/QXEbiy2sUpKKkoxw9gJZP2XGOeudXn8+BRwC3F8UV6mJhK9x ej2SiySEQUQjFIWMZjnpvK3oT55FZiGfndHoMcFy9890sCkfGdpkNbI1L1X6Wm7xEi KhwrsgF6i2D9NGXz5pZWkZ7WspOUwcaRphc8NKKtGhiHJP7x9v+6MZ7oD3IvAuAyPG 5QDD0kRQ3Jivg== Received: by mail-wm1-f69.google.com with SMTP id h1-20020a05600c350100b002e751bf6733so1629098wmq.8 for ; Mon, 13 Sep 2021 06:02:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=iu9zMq7VH8HxvbrRseM1CzfWgZBkbaUNi4Cw0YJuwM0=; b=08odQ2LSZ5jDBOXeMs9U+0Bz9XUU6WFy55ihdt8ZNV5Dt/jlRXmIpU6BCrFXj9SCyt lA0Wwk2/pAcKpBJZCA7/ur5sG6Oc5c8b1EsHtOxiZUhIHz7oSYfm1qymWfXkYPphJP7x 7d4fNWyjTa0O43ahvpFPUoNSvO95CsGF5GvwN1kuKB8gCdRKbAcToMNRS2mmhN09RRzY /0i/3ZDdc6L8Qif2FzpwD8vYxd4RdaJWtoKKftIJjEtFTsv4zYXncJ0LkNTVHT1sDrsE syxt7Ltqw7SgJB9GBS7hvrzMWYWy26e9qeP1FMUjyq0c+qbt4r52rx6APXc43KoT/SPx OhJA== X-Gm-Message-State: AOAM530qm/O5Mp+AagVTw4BJFavJLd/bwYzAfBkr62yU/YaFIvrFGnZI Oe9q2xZwcsyAyRm2mxE+SUKHgFTDSBcrdLYk3llCqNMHmIgk3rBdKacC36is7M/VCJX7tcofWut EVxOF97f0dig8zQhFJ1MUke4Ii+YmZNGuxW+V+kcM+Q== X-Received: by 2002:adf:ce03:: with SMTP id p3mr12573880wrn.261.1631538156529; Mon, 13 Sep 2021 06:02:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyaSKSMIX4A+QSHz2WtdORfG6b/MogxIP65fow2RNuWACKEFXZ5iZ+P8QZMy4+VzDS4hEY9Q== X-Received: by 2002:adf:ce03:: with SMTP id p3mr12573843wrn.261.1631538156267; Mon, 13 Sep 2021 06:02:36 -0700 (PDT) Received: from [192.168.3.211] (lk.84.20.244.219.dc.cable.static.lj-kabel.net. [84.20.244.219]) by smtp.gmail.com with ESMTPSA id o2sm7876376wrh.13.2021.09.13.06.02.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Sep 2021 06:02:35 -0700 (PDT) Subject: Re: [PATCH 1/2] power: supply: max17042_battery: Clear status bits in interrupt handler To: Sebastian Krzyszkowiak , Sebastian Reichel , linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Anton Vorontsov , Ramakrishna Pallala , Dirk Brandewie , stable@vger.kernel.org References: <20210912205402.160939-1-sebastian.krzyszkowiak@puri.sm> From: Krzysztof Kozlowski Message-ID: <0123524d-b767-5b5b-8b14-60d8cea3c429@canonical.com> Date: Mon, 13 Sep 2021 15:02:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210912205402.160939-1-sebastian.krzyszkowiak@puri.sm> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/09/2021 22:54, Sebastian Krzyszkowiak wrote: > The gauge requires us to clear the status bits manually for some alerts > to be properly dismissed. Previously the IRQ was configured to react only > on falling edge, which wasn't technically correct (the ALRT line is active > low), but it had a happy side-effect of preventing interrupt storms > on uncleared alerts from happening. > > Fixes: 7fbf6b731bca ("power: supply: max17042: Do not enforce (incorrect) interrupt trigger type") > Cc: > Signed-off-by: Sebastian Krzyszkowiak > --- > drivers/power/supply/max17042_battery.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c > index 8dffae76b6a3..c53980c8432a 100644 > --- a/drivers/power/supply/max17042_battery.c > +++ b/drivers/power/supply/max17042_battery.c > @@ -876,6 +876,9 @@ static irqreturn_t max17042_thread_handler(int id, void *dev) > max17042_set_soc_threshold(chip, 1); > } > > + regmap_clear_bits(chip->regmap, MAX17042_STATUS, > + 0xFFFF & ~(STATUS_POR_BIT | STATUS_BST_BIT)); > + Are you sure that this was the reason of interrupt storm? Not incorrect SoC value (read from register for ModelGauge m3 while not configuring fuel gauge model). You should only clear bits which you are awaken for... Have in mind that in DT-configuration the fuel gauge is most likely broken by missing configuration. With alert enabled, several other config fields should be cleared. Best regards, Krzysztof