Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2748559ybz; Sun, 3 May 2020 08:23:48 -0700 (PDT) X-Google-Smtp-Source: APiQypLhrEiNjcokzxrwI6juUgQT2qyKqHOpbf3oD+23J3ktx9eJ3WfZTxuZoKoq0nMzbxFOpdGK X-Received: by 2002:aa7:c40c:: with SMTP id j12mr10935676edq.169.1588519428371; Sun, 03 May 2020 08:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588519428; cv=none; d=google.com; s=arc-20160816; b=SYquWRJGveUrbBSqmyFI5eENZavMnf1o4ceAzB+TsWRWY3CPJbZCBQqR1REIUl9Dv3 exczHZwLzSsnf16/OjhPKT/B+rTCDLwxra+tWvO1NCE8oAtZ8//EqOzFv2n0k1nO7fit r39McC6EcQnYxXopvXo7Xm76zBDa56LmJc0Dg5TV+gj8I2+XAcC318BPPWggNtflrQvE A60hzZ9MNvdoBoZsEZ9jZ/G6HKjq/NpVvW4GfQLs7GEnJHfMgUXgFH3LCcFKY6sWAG9S QweUkL0LaUgNzZUnaEpDxbkjCndOALY0lkQYE56xWfCLEb2QykrMM6hDeaoeWYtb+7+U HkpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:content-transfer-encoding :mime-version:subject:from:references:in-reply-to:message-id:date :dkim-signature; bh=J9Lkji7H/XNXci4opQ3XssORZAkgAhSqC1IperbSnZY=; b=K2qpcPjVZ+ll9pWnAlPetOMLAsNsEPA1YD86aUC/cVHvd395sAGWHhpuq7Q7cmlk5A CMHNxTZMnAAmvHGFDCuBAJti1yYBXhG4HuR9pBYe9kOjSb4b1BSpubYa9q0dqsUr9xLK 56BlGu+zKMzyeAtfOaRdDvkqyjnt1qmdI0TRdRFldkhYztczO0Zxl7wNqpqQRfXlgUwD gWTyTZQRh24vfNJe5NTn/qLQEekg6Vtv9byGJ/TVcSgYxAVvj6/0EDpu+gXgSnb5KsvH +qshoisZ29JIJixhD2QL7ZuwhVbQj1eVY/kA+gfPp3fG/mT9mENyq+yaS6sytOQNDtqH TuuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=iJkQy5Wj; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ks5si4736203ejb.398.2020.05.03.08.23.09; Sun, 03 May 2020 08:23:48 -0700 (PDT) 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; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=iJkQy5Wj; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728772AbgECPVQ (ORCPT + 99 others); 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?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH v2 06/11] power: bq25890: update state on property read MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To: Rob Herring , Sebastian Reichel Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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) -- 2.20.1