Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp870754pxx; Tue, 27 Oct 2020 02:31:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9Y9GhaBTg5Ff5e3+TSrSZXRZ71/2QHGpqckxhH0nNA/J2UMFcc3Na5Jq/N/ZDb95RFS7E X-Received: by 2002:a05:6402:134c:: with SMTP id y12mr1220531edw.344.1603791096708; Tue, 27 Oct 2020 02:31:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603791096; cv=none; d=google.com; s=arc-20160816; b=tSNcx3XfTGBUf1u7MxcctzkEWC7Yl/svLpwCzb13BAcycWELsawmasEM1NvapXg4IM Jylye3BnbQYVkkD5BSEnY/71L6hBUq5FdmS67oTeEVUIW4Cmliy13FFC15jMQ194BBAR v6ZLa4MqoPyLEfdOZdab55t5P+43KafJjMqusgF/0TmqdHEA24ShVS6lTukgjVcAj3JE hiphKlgKOt/j9Uk3FKvxYTuzQqlM706NPvWfIT0PKmU7PfQT+INyJuN9mLOrx1iaOxTe rNjI3HDNyly56RpUou3q1LyMBMt13Zo3y+ORgkHu1r07FXFjPY+7wii9xjQcYnwlgI5/ SehQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HUHI2n2S4SMYGTHKSfdxxPmavYuvTupv2GQfg0rzdnc=; b=rq7Ln5IhTuHRXmGbbrdEzuGikH+5G3sEwexd51TMQ7JC+b670qRaEUebM3W6dGFFv5 TKZh6SuynTwszIRjKH0B+Ucat16tcw4HmzzJ7ydJQo8O8jwDOi0WvPr33omdHyJVxVI0 0ys1CC4bPS5mhPN5ZxBAflqc2I6XNM6fOC5hdXdLOk90kztRGbi3XyfQj2OC6sFQ/o4w L7/leSRMZNf0kKIn7LpY1GKoSPhZ4qeKfmEsyjekjQdFSXu4zPk2Nq8x7qxvhpYEz7bd EVbflk8H74/1blEmamQ9t+4Ccs4Xo+VxDwgTyBoWCm9kAQffrOt4f5jA3juHqay1/f1Z 3eEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lmR5fTgL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w23si457058eds.571.2020.10.27.02.30.59; Tue, 27 Oct 2020 02:31:36 -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=@kernel.org header.s=default header.b=lmR5fTgL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408985AbgJZXuC (ORCPT + 99 others); Mon, 26 Oct 2020 19:50:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:47840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408767AbgJZXtj (ORCPT ); Mon, 26 Oct 2020 19:49:39 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1BB7121D41; Mon, 26 Oct 2020 23:49:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756178; bh=ftelrFd5qq8bj6IxDaG8EjWQWBM3xxSpIdhhPwUR07o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lmR5fTgLTZGZ/lTk6tb15HoxURTN1ngKmh8QhU+CgYTBhWhXzGvp+H4awZ9bFiNFR 2oeGIWZMbdLfjS5TEiW50Dc1TMms57lAFYkeFxk/Rax+xPGbGQZufa+lCUNqz3LZTT +79Wqzggn6vtZWQJlZCw06edscHOyCEp4D/X0Deo= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Krzysztof Kozlowski , Sebastian Reichel , Sasha Levin , linux-pm@vger.kernel.org Subject: [PATCH AUTOSEL 5.9 026/147] power: supply: bq27xxx: report "not charging" on all types Date: Mon, 26 Oct 2020 19:47:04 -0400 Message-Id: <20201026234905.1022767-26-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026234905.1022767-1-sashal@kernel.org> References: <20201026234905.1022767-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Krzysztof Kozlowski [ Upstream commit 7bf738ba110722b63e9dc8af760d3fb2aef25593 ] Commit 6f24ff97e323 ("power: supply: bq27xxx_battery: Add the BQ27Z561 Battery monitor") and commit d74534c27775 ("power: bq27xxx_battery: Add support for additional bq27xxx family devices") added support for new device types by copying most of the code and adding necessary quirks. However they did not copy the code in bq27xxx_battery_status() responsible for returning POWER_SUPPLY_STATUS_NOT_CHARGING. Unify the bq27xxx_battery_status() so for all types when charger is supplied, it will return "not charging" status. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/power/supply/bq27xxx_battery.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c index a123f6e21f08a..08b9d025a3e81 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -1772,8 +1772,6 @@ static int bq27xxx_battery_status(struct bq27xxx_device_info *di, status = POWER_SUPPLY_STATUS_FULL; else if (di->cache.flags & BQ27000_FLAG_CHGS) status = POWER_SUPPLY_STATUS_CHARGING; - else if (power_supply_am_i_supplied(di->bat) > 0) - status = POWER_SUPPLY_STATUS_NOT_CHARGING; else status = POWER_SUPPLY_STATUS_DISCHARGING; } else if (di->opts & BQ27Z561_O_BITS) { @@ -1792,6 +1790,10 @@ static int bq27xxx_battery_status(struct bq27xxx_device_info *di, status = POWER_SUPPLY_STATUS_CHARGING; } + if ((status == POWER_SUPPLY_STATUS_DISCHARGING) && + (power_supply_am_i_supplied(di->bat) > 0)) + status = POWER_SUPPLY_STATUS_NOT_CHARGING; + val->intval = status; return 0; -- 2.25.1