From patchwork Fri May 7 16:19:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 432381 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, TVD_SUBJ_WIPE_DEBT, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C7A9C433ED for ; Fri, 7 May 2021 16:21:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 227E06144F for ; Fri, 7 May 2021 16:21:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236371AbhEGQWf (ORCPT ); Fri, 7 May 2021 12:22:35 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:51202 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236039AbhEGQWe (ORCPT ); Fri, 7 May 2021 12:22:34 -0400 Received: from mail-qv1-f69.google.com ([209.85.219.69]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lf3EL-00088T-PR for linux-pm@vger.kernel.org; Fri, 07 May 2021 16:21:33 +0000 Received: by mail-qv1-f69.google.com with SMTP id 99-20020a0c80ec0000b029017de514d56fso6949370qvb.17 for ; Fri, 07 May 2021 09:21:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XW/9mYiVYyeTStSYaXn6R4LsQC+ZiyYHwHd014oNij8=; b=GMFp0ojN4kEn3E6o8oMfVi8PpczTLhzPnBUafN+amjAlQiXlpTwEWwzrj2/L7qNhP7 gpN+s/UmM0F6SnJSulK3hNb6ooxnC0RkD4jEVDRepDpoLc1i3tZprbshdSI7TwRFde14 JCQKtqwSsPrky7isqGUjGWRRB1EQ5vZ51fnqKc/17xtqioOH3/YCaOG0MMPCqRm1GBll WVd5QvMdCecZ2XXctqgwvDexSkr/gNhNKsps6DDZ/B+hyAZQzc8gWmwWPsFMfaodo5A1 h/QraWByrcVpYNd3TzVY5CzykRsHG8KspTwteLAli+Wljh89mzZGjCPSBaVh3sxFJXc6 rDTw== X-Gm-Message-State: AOAM531TCfdMYEW1INCXQez4UiCx6+Wvqamt850IVGcvOkSdWg4tMLIs HFA6NvE0zIuX3nECyibZAjPXgDf1JKVbRo0e8OR16qA63opborxPataulUuA1oSs4ZiRyDn+J5z Rwqzt3TCNCwRks2uX2N1XMY1xV7NIm5WnYJpQ X-Received: by 2002:a0c:bd13:: with SMTP id m19mr10619799qvg.29.1620404492932; Fri, 07 May 2021 09:21:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeTLsueDZAjedoM9qmR/TUIHVoHbW8SOlMK0023BrwGcAAfGdKnlBWj8QNSJ6uU2+0QlqFJQ== X-Received: by 2002:a0c:bd13:: with SMTP id m19mr10619784qvg.29.1620404492706; Fri, 07 May 2021 09:21:32 -0700 (PDT) Received: from localhost.localdomain ([45.237.49.1]) by smtp.gmail.com with ESMTPSA id i5sm4991869qki.115.2021.05.07.09.21.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 09:21:32 -0700 (PDT) From: Krzysztof Kozlowski To: Sebastian Reichel , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Iskren Chernev , Jonathan Bakker , Matheus Castello , Marek Szyprowski Subject: [RFT PATCH 1/3] power: supply: max17040: remove non-working POWER_SUPPLY_PROP_STATUS Date: Fri, 7 May 2021 12:19:25 -0400 Message-Id: <20210507161927.105862-1-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The driver was reporting POWER_SUPPLY_PROP_STATUS via platform data functions. Without platform data, the max17040_get_status() functions returns early with POWER_SUPPLY_STATUS_UNKNOWN. Since there are no platforms using the driver with platform data (no board files with the driver), the status property was always unknown. Signed-off-by: Krzysztof Kozlowski --- drivers/power/supply/max17040_battery.c | 32 +++---------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c index 1aab868adabf..12854c87df53 100644 --- a/drivers/power/supply/max17040_battery.c +++ b/drivers/power/supply/max17040_battery.c @@ -147,8 +147,6 @@ struct max17040_chip { /* battery capacity */ int soc; - /* State Of Charge */ - int status; /* Low alert threshold from 32% to 1% of the State of Charge */ u32 low_soc_alert; /* some devices return twice the capacity */ @@ -225,24 +223,6 @@ static int max17040_get_online(struct max17040_chip *chip) chip->pdata->battery_online() : 1; } -static int max17040_get_status(struct max17040_chip *chip) -{ - if (!chip->pdata || !chip->pdata->charger_online - || !chip->pdata->charger_enable) - return POWER_SUPPLY_STATUS_UNKNOWN; - - if (max17040_get_soc(chip) > MAX17040_BATTERY_FULL) - return POWER_SUPPLY_STATUS_FULL; - - if (chip->pdata->charger_online()) - if (chip->pdata->charger_enable()) - return POWER_SUPPLY_STATUS_CHARGING; - else - return POWER_SUPPLY_STATUS_NOT_CHARGING; - else - return POWER_SUPPLY_STATUS_DISCHARGING; -} - static int max17040_get_of_data(struct max17040_chip *chip) { struct device *dev = &chip->client->dev; @@ -283,7 +263,6 @@ static int max17040_get_of_data(struct max17040_chip *chip) static void max17040_check_changes(struct max17040_chip *chip) { chip->soc = max17040_get_soc(chip); - chip->status = max17040_get_status(chip); } static void max17040_queue_work(struct max17040_chip *chip) @@ -302,17 +281,16 @@ static void max17040_stop_work(void *data) static void max17040_work(struct work_struct *work) { struct max17040_chip *chip; - int last_soc, last_status; + int last_soc; chip = container_of(work, struct max17040_chip, work.work); - /* store SOC and status to check changes */ + /* store SOC to check changes */ last_soc = chip->soc; - last_status = chip->status; max17040_check_changes(chip); /* check changes and send uevent */ - if (last_soc != chip->soc || last_status != chip->status) + if (last_soc != chip->soc) power_supply_changed(chip->battery); max17040_queue_work(chip); @@ -415,9 +393,6 @@ static int max17040_get_property(struct power_supply *psy, struct max17040_chip *chip = power_supply_get_drvdata(psy); switch (psp) { - case POWER_SUPPLY_PROP_STATUS: - val->intval = max17040_get_status(chip); - break; case POWER_SUPPLY_PROP_ONLINE: val->intval = max17040_get_online(chip); break; @@ -444,7 +419,6 @@ static const struct regmap_config max17040_regmap = { }; static enum power_supply_property max17040_battery_props[] = { - POWER_SUPPLY_PROP_STATUS, POWER_SUPPLY_PROP_ONLINE, POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_CAPACITY, From patchwork Fri May 7 16:19:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 432748 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04A3FC43460 for ; Fri, 7 May 2021 16:21:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B81D161482 for ; Fri, 7 May 2021 16:21:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235256AbhEGQWg (ORCPT ); Fri, 7 May 2021 12:22:36 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:51211 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238085AbhEGQWg (ORCPT ); Fri, 7 May 2021 12:22:36 -0400 Received: from mail-qk1-f197.google.com ([209.85.222.197]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lf3EN-00089L-EE for linux-pm@vger.kernel.org; Fri, 07 May 2021 16:21:35 +0000 Received: by mail-qk1-f197.google.com with SMTP id b19-20020a05620a0893b02902e956b29f5dso6509285qka.16 for ; Fri, 07 May 2021 09:21:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zEwpl+e3d0cM7xieF+8lt3QhbZrV0cBIC8uccroyXHs=; b=D90oiUWxA4OBIoNOIRgljdqv+3wbDAidecpIAhQCdpQ7tlgk6Dr3Q6GvQY7xnmgIgN fJpYqxe9LUTV8QNOkJmonTHx6QeQqc+CMKffDWZ5pVzMtDl38UVz7TS0GowojufNoJQK +mt+cpPg/UaBhOnwT1zH9jH34FvgmWgSHRfhChaKMf7cC6DdPGR6dViMN2IdWbL6JqFL VROv4/YB0jhCmeJsYw/tL2ha4wzaK7ghaCLIiYY7+SCvYiEQUsXyZv3ShWoFbm9jBwEl QjBw7r8NbTmGf7mMAx89Rle9JDXCsm45Wu5u0oP76k/L2Hgz6iw5kUiG1h2XlMLOAmVf JuJQ== X-Gm-Message-State: AOAM533FVYdYWnyO0d/swGUKwX8O15UAee03fljqQdjRXN2D4qjMwjVf tFa8rN0Tqyz8T2HfjaTsdoOmEbqWL3pl8wz/KX7kIMA8TsuWqW9eiiGHJB8V6s0nLmkJLNUB9a9 5zXDtTvRmx9Ni6e4WtzTyJpt78Kekts/dhDUR X-Received: by 2002:ac8:5a46:: with SMTP id o6mr10093287qta.289.1620404494591; Fri, 07 May 2021 09:21:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwndiNIlAr4EYeCcBxKjh2kdc50Sh+P2UpllV1BwJlou9m+rQMwsW/WZZsiQmT+FzwleDgc3g== X-Received: by 2002:ac8:5a46:: with SMTP id o6mr10093263qta.289.1620404494363; Fri, 07 May 2021 09:21:34 -0700 (PDT) Received: from localhost.localdomain ([45.237.49.1]) by smtp.gmail.com with ESMTPSA id i5sm4991869qki.115.2021.05.07.09.21.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 09:21:33 -0700 (PDT) From: Krzysztof Kozlowski To: Sebastian Reichel , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Iskren Chernev , Jonathan Bakker , Matheus Castello , Marek Szyprowski Subject: [RFT PATCH 2/3] power: supply: max17040: simplify POWER_SUPPLY_PROP_ONLINE Date: Fri, 7 May 2021 12:19:26 -0400 Message-Id: <20210507161927.105862-2-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210507161927.105862-1-krzysztof.kozlowski@canonical.com> References: <20210507161927.105862-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The driver was reporting POWER_SUPPLY_PROP_ONLINE via platform data functions or '1' if no platform data was provided. Since there are no platforms using the driver with platform data (no board files with the driver), the online property can be simplified to always return '1'. Signed-off-by: Krzysztof Kozlowski --- drivers/power/supply/max17040_battery.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c index 12854c87df53..d51c3443d732 100644 --- a/drivers/power/supply/max17040_battery.c +++ b/drivers/power/supply/max17040_battery.c @@ -219,8 +219,7 @@ static int max17040_get_version(struct max17040_chip *chip) static int max17040_get_online(struct max17040_chip *chip) { - return chip->pdata && chip->pdata->battery_online ? - chip->pdata->battery_online() : 1; + return 1; } static int max17040_get_of_data(struct max17040_chip *chip) From patchwork Fri May 7 16:19:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 432380 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82CDAC43461 for ; Fri, 7 May 2021 16:21:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4EB3861466 for ; Fri, 7 May 2021 16:21:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238094AbhEGQWi (ORCPT ); Fri, 7 May 2021 12:22:38 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:51222 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238090AbhEGQWh (ORCPT ); Fri, 7 May 2021 12:22:37 -0400 Received: from mail-qt1-f200.google.com ([209.85.160.200]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lf3EP-0008A6-3Q for linux-pm@vger.kernel.org; Fri, 07 May 2021 16:21:37 +0000 Received: by mail-qt1-f200.google.com with SMTP id d16-20020ac811900000b02901bbebf64663so6031579qtj.14 for ; Fri, 07 May 2021 09:21:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+dB8otcToZ0kaQ8XLwm4gKZh/Gvp55gjgN8Q4hQT5d4=; b=kxA3U0C1MdWx8pJdlDIs6hpHKbrCnkndhYMGUFsLABkaKJFShq/Tnzt2mQBXdkoWDD 9VfAS1G6Vw5jSRK3PzUVA8Txg/dfhUQ7EyRbiuPlsJqaXSXgH6QTgEDGB+s/CNLSiFAB s+z0PJHo/dyTb5mYeR/f3kXqbH//0bLnTxIkZ29/noguYbQ+ONCvKCulKudaMVt4Xjqe EhSpCLt8BHw1QHaUBXkhsF6REwBIUMXRTVsVMfelAYeqOCerDuGJR+AR9Ne2DsoCkCe8 HBsasMxKamxGS5g6OY/VMWcVBNm7s8P3VrBvbcVMb9IBs3KOoixtXMZn/Llfn2+DjBsB q7Mg== X-Gm-Message-State: AOAM5327FqzZS/rela9njDHjytEB9arpt0cP3Kt926Txpjn08DXsFs5Y Ykjp6CiLkNCE/TLNtHOtCO75QWhpHpOg7BMFMMlVsi0seFIGHAxBSLpcQjEQiBsB6lrGgpULrqm +UEllfNoTCpdIm29zOXjvsADd+gQbth6SMRKL X-Received: by 2002:a05:622a:387:: with SMTP id j7mr10053747qtx.255.1620404496173; Fri, 07 May 2021 09:21:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztpOdmGOzbTTrf1BhbXzYpMKN6SwOt8oXJJTpBqWJY5h4B6QG8KwlYu67S3yPqWVtZnYvBRA== X-Received: by 2002:a05:622a:387:: with SMTP id j7mr10053736qtx.255.1620404496012; Fri, 07 May 2021 09:21:36 -0700 (PDT) Received: from localhost.localdomain ([45.237.49.1]) by smtp.gmail.com with ESMTPSA id i5sm4991869qki.115.2021.05.07.09.21.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 09:21:35 -0700 (PDT) From: Krzysztof Kozlowski To: Sebastian Reichel , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Iskren Chernev , Jonathan Bakker , Matheus Castello , Marek Szyprowski Subject: [RFT PATCH 3/3] power: supply: max17040: drop unused platform data support Date: Fri, 7 May 2021 12:19:27 -0400 Message-Id: <20210507161927.105862-3-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210507161927.105862-1-krzysztof.kozlowski@canonical.com> References: <20210507161927.105862-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are no platforms using the driver with platform data (no board files with the driver), so the dead code can be dropped. Signed-off-by: Krzysztof Kozlowski --- drivers/power/supply/max17040_battery.c | 3 --- include/linux/max17040_battery.h | 16 ---------------- 2 files changed, 19 deletions(-) delete mode 100644 include/linux/max17040_battery.h diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c index d51c3443d732..a8ba2c305034 100644 --- a/drivers/power/supply/max17040_battery.c +++ b/drivers/power/supply/max17040_battery.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -142,7 +141,6 @@ struct max17040_chip { struct regmap *regmap; struct delayed_work work; struct power_supply *battery; - struct max17040_platform_data *pdata; struct chip_data data; /* battery capacity */ @@ -453,7 +451,6 @@ static int max17040_probe(struct i2c_client *client, chip->client = client; chip->regmap = devm_regmap_init_i2c(client, &max17040_regmap); - chip->pdata = client->dev.platform_data; chip_id = (enum chip_id) id->driver_data; if (client->dev.of_node) { ret = max17040_get_of_data(chip); diff --git a/include/linux/max17040_battery.h b/include/linux/max17040_battery.h deleted file mode 100644 index 593602fc9317..000000000000 --- a/include/linux/max17040_battery.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (C) 2009 Samsung Electronics - * Minkyu Kang - */ - -#ifndef __MAX17040_BATTERY_H_ -#define __MAX17040_BATTERY_H_ - -struct max17040_platform_data { - int (*battery_online)(void); - int (*charger_online)(void); - int (*charger_enable)(void); -}; - -#endif