From patchwork Fri Apr 26 09:26:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 10918923 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED0191398 for ; Fri, 26 Apr 2019 09:26:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCF1A28DC2 for ; Fri, 26 Apr 2019 09:26:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D178C28DC4; Fri, 26 Apr 2019 09:26:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79A8628DC2 for ; Fri, 26 Apr 2019 09:26:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725935AbfDZJ05 (ORCPT ); Fri, 26 Apr 2019 05:26:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:52312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725923AbfDZJ05 (ORCPT ); Fri, 26 Apr 2019 05:26:57 -0400 Received: from PC-kkoz.proceq.com (unknown [213.160.61.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D8BD22077B; Fri, 26 Apr 2019 09:26:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556270817; bh=fhNkvRB4wRn3bg/u+c3v8maFQ5a5icxUBYeoSwqYGEs=; h=From:To:Cc:Subject:Date:From; b=WFYR+hAeX8R6KwM6oD3/oBzfafJBX2X/t/KsZqqdoqI2lPd/OxFeurIFv/N+sciob fd68VIalcp7he5HZdt6EslCbPmNL9MdDuZaEekMRwa51W1b96s++qAcXMibvVW/sxy 0NkeBH9Z2ElwRbpzvjWY+nFUo+nAbGaFtcKt/cMo= From: Krzysztof Kozlowski To: =?utf-8?q?Pali_Roh=C3=A1r?= , "Andrew F. Davis" , Sebastian Reichel , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH] power: supply: bq27xxx_battery: Notify also about status changes Date: Fri, 26 Apr 2019 11:26:48 +0200 Message-Id: <1556270808-21331-1-git-send-email-krzk@kernel.org> X-Mailer: git-send-email 2.7.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP User-space might be interested in receiving uevents when the charging starts/stops or if conditions of battery changes (e.g. over-temperature). Notify about changes in battery also when the flags change, not only SoC. Signed-off-by: Krzysztof Kozlowski --- drivers/power/supply/bq27xxx_battery.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c index 29b3a4056865..cb9306160c14 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -1612,7 +1612,8 @@ void bq27xxx_battery_update(struct bq27xxx_device_info *di) di->charge_design_full = bq27xxx_battery_read_dcap(di); } - if (di->cache.capacity != cache.capacity) + if ((di->cache.capacity != cache.capacity) || \ + (di->cache.flags != cache.flags)) power_supply_changed(di->bat); if (memcmp(&di->cache, &cache, sizeof(cache)) != 0)