From patchwork Sun May 3 15:21:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 212152 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=-6.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS 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 514AFC4725A for ; Sun, 3 May 2020 15:21:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 26B722071C for ; Sun, 3 May 2020 15:21:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="iJkQy5Wj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728739AbgECPVQ (ORCPT ); Sun, 3 May 2020 11:21:16 -0400 Received: from rere.qmqm.pl ([91.227.64.183]:34101 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728699AbgECPVP (ORCPT ); Sun, 3 May 2020 11:21:15 -0400 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 49FV7X31HqzfV; Sun, 3 May 2020 17:21:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1588519272; bh=X6di/kZ9JXtfx1MiBhjtRiHxgwlcVR2sOcyLvmd+Kuk=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=iJkQy5WjomYB9rOwyo93wOUgoSQnHTuwg9EeOBxUThjQ3uVn45QuVMor/q2XrucnT TrQuLdTHTLC5nIO1NkMou8t48udmThxM3KQSz877MrKCBOKTZdLA4tj8+fGTFF2JFq b17jmceveqZZT03PfPz2xYNvvQJiIY5S8JaMrZLSeDKXVip31hiNiDJftB63LsqebX GCh2hNtKEWTYeP8jPsbJ7pCAkqFMd45MzY7bH5MpSkADff0N9UfKOFp5PJIfQ2QBrK NN28r18PEa/iCOxy7/0+pbHebZ36O62qFaeJN3EqWlTu4dHU9DnYXBO1tjDQTyHrXy As/FvQxWBabQQ== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.2 at mail Date: Sun, 03 May 2020 17:21:12 +0200 Message-Id: <5c8e8f4c5a7fc2cecb62342f9a964f69f3fde7ae.1588517058.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH v2 06/11] power: bq25890: update state on property read MIME-Version: 1.0 To: Rob Herring , Sebastian Reichel Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Edge interrupts from the charger may be lost or stuck in fault mode since probe(). Check if something changed everytime userspace wants some data. Signed-off-by: Michał Mirosław --- drivers/power/supply/bq25890_charger.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c index 3b02fa80aedd..e4368d01396a 100644 --- a/drivers/power/supply/bq25890_charger.c +++ b/drivers/power/supply/bq25890_charger.c @@ -389,6 +389,8 @@ static bool bq25890_is_adc_property(enum power_supply_property psp) } } +static irqreturn_t __bq25890_handle_irq(struct bq25890_device *bq); + static int bq25890_power_supply_get_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) @@ -399,6 +401,8 @@ static int bq25890_power_supply_get_property(struct power_supply *psy, int ret; mutex_lock(&bq->lock); + /* update state in case we lost an interrupt */ + __bq25890_handle_irq(bq); state = bq->state; do_adc_conv = !state.online && bq25890_is_adc_property(psp); if (do_adc_conv)