Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp634512pxx; Mon, 26 Oct 2020 17:36:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQHseu9aJZlpYPCjSiTk32AsOPHtkAMnk1ol6Virm0sF+Koqn7kJycDcMc0n7NXiGJ/TEF X-Received: by 2002:a17:906:e103:: with SMTP id gj3mr17881008ejb.442.1603758964979; Mon, 26 Oct 2020 17:36:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603758964; cv=none; d=google.com; s=arc-20160816; b=BF3QRoksBSDtoDDVOzZdrpAhUWcLaO9mQv545M3Ytb/xF6JzHk5vtX0kt/9f3BPa7L eVmvMS59eoX/5TQfmc8A8oeOI7uzfBg7wjhnOyv2ddV5vdMpgJNJZ9G/2o4NkkrU8tk8 UY3JLtwUYYYI9fHPT+34Ws2lG1wYeHAcW01bz0KfhStinR2BsOd7RmJuGrCnLPE9I/3m 1lCaSXzzOzXueAZWRMjQX9o/BQuY2+zeI2pkZPcfCaCnqbjtgvjM063xxZY6Dl1lTieL o2ew2v7LnktxPfsB3qSs2w08JtByZw82PpfwXvmND40yU86eMFX/zaYX9P/Jw/8Qf0Er 4dhg== 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=9skas9R3UJGKot1KhUYdvViMqduEq+6LL/PJHBGGigQ=; b=XfDWJ1GXLpRbNvMcYL/bP6zFmuCW/TmELfcd+v2HE3QjTd2qtxfvuEOHSKQ13nyT9F UNvwYr7PnKMThl8SFcR8FvTzaPpPwBHB2M/B4LWAuiDpBL2HH4OyAwqafy47LQIjeGtl 6Jvj4xyMj5AFT4SeF9J1F9OUr0RM4lPKaBOsR58BGGXiLCmbXwZJg/SzRMp11TlAOphO m0vM3SY4pinD5zmqJrlu5zZ59yx42n+izV7+FTHDFfM44agGVFnLktBXvIKoQxb3K3zz 02+YyHOr7aGD7ZGHHdlt45LuJ8QsPICV3xxjIygWK+se2T/ehIcERonMwtZfKDp0/+8w domg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IQcbnjh0; 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 b9si8347986eja.250.2020.10.26.17.35.43; Mon, 26 Oct 2020 17:36:04 -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=IQcbnjh0; 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 S2441403AbgJ0AXM (ORCPT + 99 others); Mon, 26 Oct 2020 20:23:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:33688 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410915AbgJZXzf (ORCPT ); Mon, 26 Oct 2020 19:55:35 -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 C5EC822202; Mon, 26 Oct 2020 23:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756534; bh=4mPmGH4ZMEdJWt6NgLwqyuOOqm7p4UkN2VDy0Yz7Fag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IQcbnjh05f7UAtB2co0ncxn/e5ZdyoCx2JsV06Jz5ZVB9YcqLjGhHGwzn/sD/XXnE t1xLHtRwmEEMsElmZvqDyMY7C84MpQ91mOoB4ohq4nIWuJCw+WFE9KYY86G32Nfi+L gwZLY27cUNigFOFYzk+n1v6z0xwfmhRrEaLftLwM= 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.4 14/80] power: supply: bq27xxx: report "not charging" on all types Date: Mon, 26 Oct 2020 19:54:10 -0400 Message-Id: <20201026235516.1025100-14-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026235516.1025100-1-sashal@kernel.org> References: <20201026235516.1025100-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 664e50103eaaf..aff0a0a5e7f8c 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -1678,8 +1678,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 { @@ -1691,6 +1689,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