Received: by 2002:a05:6622:f08:0:0:0:0 with SMTP id l8csp4478432ivc; Tue, 3 Nov 2020 13:05:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwvatBPqa4I2DRO0c0bzEOONY0yqgvn4KcJ52ljA0QnZ25fNUCvrrfyEGrgmPqpBK2aN+fd X-Received: by 2002:a17:906:9455:: with SMTP id z21mr9487843ejx.160.1604437508229; Tue, 03 Nov 2020 13:05:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604437508; cv=none; d=google.com; s=arc-20160816; b=zfkEUJaoiMd6wvV2vhO0gKY6deaTfBkHZSt3SNByOJ06FYTyBRyrNmGkd+BSXu53LE sCAFqRpQDv59i/8bfKMrqPF/+MrSdgH86ihmrQVFmNOJy3r9Wpv4ACkNWWAj8foKHsLJ +dy26Cfs64fckz9Qx6m5Fi7gUBtiTxmgIQ+ZHLs5KnSt0gq5d6LJyR0y1PlOk4PQWjku 5m8Ac3eqtdjik6JmnVYFHn/GX9qXldTUSZ12w6lf7s6GMo9IzceBQ5FVVaNHHhj2w66k 4ALbm1dZlIzyKS085bI3v1hIIMlv8aLcxVFiWM1OiUNqxk8wli4YFakl0mS+bj7zX/6y oduw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i+Jg4aBfp1Ih8SHl0MbrKjcaLOCbFCuD3qDMT/kBdHU=; b=n+Z9y9CTquag4AM5nRpVJY0Yr5Q7RxWJSFaAqDzFtB0dnD71EiHiTmGDiZCd2GRtPq 537lVqHHtJLF/a18Us3CFgM7k7+DreoBHnZkWxpVH16k01DOrLIPpMh99sAvb0uhiQQV UxioNgmGH2hQ1mReGYgMQK1fx/QNPTSoiGlukVhLjGkS2QrrE34+25l8VC+s2gU0Ie2w 94M7h05Jnuje/HPtWx3GMNYxrLupC/1qAPK6ZOeYtXuH/G7MKMUEnXM0f8Z6VU0HTpCQ 0HwbWOg8OZ4i7PlL3QXZYxiF8CPj5iBlxs81xFUt0DRfrvb9yOSMbs7jR4Ni+sJstR3A HISA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r6o0a4WX; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bk9si13636ejb.42.2020.11.03.13.04.45; Tue, 03 Nov 2020 13:05:08 -0800 (PST) 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=r6o0a4WX; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387792AbgKCVD2 (ORCPT + 99 others); Tue, 3 Nov 2020 16:03:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:40958 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387822AbgKCVDZ (ORCPT ); Tue, 3 Nov 2020 16:03:25 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5E38D22226; Tue, 3 Nov 2020 21:03:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437404; bh=Buad1p3Pd54T/Nr6y0qGXdzSJ0UaRbe76WBV4d7Jmpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r6o0a4WXErAEHqCJpWa9NM/1/sTHPC7xf1Z+DmREJu9jmck4/2RCM7EUtJUQh54fp CKLDsJ0GupWgkPiGNTRYurUhAEWK1TptuSgFRNpjgUx2y9dbFQvNVNF0m3CxhDMSKx akR/Q+b21p+6heAqIl9eSZo208gZZCjxZ5SzYGiQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Sebastian Reichel , Sasha Levin Subject: [PATCH 4.19 063/191] power: supply: bq27xxx: report "not charging" on all types Date: Tue, 3 Nov 2020 21:35:55 +0100 Message-Id: <20201103203240.510019661@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 ff02a917556a9..93e3d9c747aa0 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -1680,8 +1680,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 { @@ -1693,6 +1691,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.27.0