From patchwork Mon May 10 22:08:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 434589 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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 2516FC433ED for ; Mon, 10 May 2021 22:09:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 065D96147E for ; Mon, 10 May 2021 22:09:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230463AbhEJWKg (ORCPT ); Mon, 10 May 2021 18:10:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229807AbhEJWKf (ORCPT ); Mon, 10 May 2021 18:10:35 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FF73C061574; Mon, 10 May 2021 15:09:29 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id q186so3055641ljq.8; Mon, 10 May 2021 15:09:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zC2m9tdB05UvOitG8AiDnA/r8NvGC3XS+DBBN1eDOIk=; b=fo9EMGf98O5I0aDtdX1qLO7IPIXmdaemjo6kn2Jw2TG7ylAShVJfYtqNGknQgxGDy9 kZaYRhiFnZdwDOO/SJe1Gupav/PDsjm0eNi6ZL2eNA1WnsbHPUp07p3Dw5452nGVBFdK lqJ1N97ULZac70/R3KyG+WUT+AiHwRKv8/Pfv8M25DbxSj24ZOLAOx2qp0VthfexiEIh m8l0HSbIeoOsxT55BNW0dmCFqo9b3FSO5D7W/a3ccu+WAAR3Fge7UTbnyGjcgUzORTbr G14E5KxzUGXy4iGzvlfrO7CgvCMyaMQEHmD1cB0Jp+Q6fQtQpDnbT+e00QBhFE1C+j6F L4Dw== 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=zC2m9tdB05UvOitG8AiDnA/r8NvGC3XS+DBBN1eDOIk=; b=p7oIJZtFft6bSrKHvE5r/MxzkeXEnJZPoaX4QIYZUNaVNq1q1KSLy4EUzijo+BqtpC M/1xZMrfgH0zMJdCC9iJMew4efRQ9DvFJ4yoAa7mcfACyJxLC2W91UvsSe5QyUizDrJt S+yrbSekhlnegqEdtz3XZ7qzqjVsoT+B+6W5/WgK5USwEOau3grZagur568C0/j0v/Xe XwYZLMGJ3YQod6DfFO3p5lEx0rk7IMJt2R6mm1/Uvw5tG1+yChlSUMOZu9rB9bYguK0l Ic+5pFxqZfwIGwq1xade6soNObzw3jGEupPUIBYbSfccJBQiDRYSv9IzUgsqbQRrBPAA gWUw== X-Gm-Message-State: AOAM531JxzhDFf8mNEgyvXu62B0cvUutXK7LWDr01h3xUEJTfvc9M6LI sAspKFedlsZTuPG5a+CaN4k= X-Google-Smtp-Source: ABdhPJzZMsIyJG0LaMscJd6YlMClncgHaLKOf3CoSkAy6rGpxrqKzZXnAR4JP/hwGkoMBPtwA9o1MA== X-Received: by 2002:a2e:b60d:: with SMTP id r13mr21171573ljn.503.1620684568026; Mon, 10 May 2021 15:09:28 -0700 (PDT) Received: from localhost.localdomain (109-252-193-91.dynamic.spd-mgts.ru. [109.252.193.91]) by smtp.gmail.com with ESMTPSA id y5sm2381479lfa.148.2021.05.10.15.09.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 May 2021 15:09:27 -0700 (PDT) From: Dmitry Osipenko To: Sebastian Reichel , Antoni Aloy Torrens , =?utf-8?q?Nikola_Milosavljevi=C4=87?= Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/2] power: supply: sbs-battery: Silence warning about unknown chemistry Date: Tue, 11 May 2021 01:08:26 +0300 Message-Id: <20210510220827.11595-1-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Older variants of controller don't support reporting type of the battery. Make warning message about unknown chemistry to be printed only once in order to stop flooding kernel log with the message on each request of the property. This patch fixes the noisy messages on Asus Transformer TF101. Tested-by: Antoni Aloy Torrens # TF101 Tested-by: Nikola Milosavljević # TF101 Signed-off-by: Dmitry Osipenko --- drivers/power/supply/sbs-battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c index 8d7a10730e43..b71fbf543428 100644 --- a/drivers/power/supply/sbs-battery.c +++ b/drivers/power/supply/sbs-battery.c @@ -814,7 +814,7 @@ static int sbs_get_chemistry(struct i2c_client *client, val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN; if (val->intval == POWER_SUPPLY_TECHNOLOGY_UNKNOWN) - dev_warn(&client->dev, "Unknown chemistry: %s\n", chemistry); + dev_warn_once(&client->dev, "Unknown chemistry: %s\n", chemistry); return 0; } From patchwork Mon May 10 22:08:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 433384 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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 8699FC433B4 for ; Mon, 10 May 2021 22:09:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5BD5E6147E for ; Mon, 10 May 2021 22:09:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230507AbhEJWKh (ORCPT ); Mon, 10 May 2021 18:10:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbhEJWKg (ORCPT ); Mon, 10 May 2021 18:10:36 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CD96C06175F; Mon, 10 May 2021 15:09:30 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id a2so4658222lfc.9; Mon, 10 May 2021 15:09:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DL2m5cGSzenHZYyzVc1zRqz7veWJz1V6YDyNEMjnPOM=; b=cMRTmTkFUEX5YA8DdYrOZj/TlrRyxftNaL1SShCZOjdJ91tmiy9kzLemzCocvv4eJa 0YltFrh5/dAdlkZD8wBHItu9hun9rwPQddWDLGJmsPTuMNKfrH4S05gLdhdQ24G8EZhr moWEojgJobsi8IXm3Y29nVb3TAL8FCwZ2kWfy0Eh8shHBvwud+g+4Uu8MoKq107dTHRr qT1tYDWiUrgdTG6YJfAv3WCCn/2flfvG+5isvzbRflrq6aeMfhXNXQlz8DlT38G17gbj ud6PkhuclE1uayuWvgor6iDZTiOH4oQ8yQpco/N/o8368Qph1fIRBclzlC+9psPLC4HZ bHQg== 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=DL2m5cGSzenHZYyzVc1zRqz7veWJz1V6YDyNEMjnPOM=; b=eGwFvAZby1Q6m5XKaFhxKWJiBDPc65jQe4/lODLFt4cmHL3VWRaWCuwxE+Rbp3Vcty xFCXmW4hB+SS8RnxF2G+eOHcIqqx4Yg5cf9Gy8Ns2XEDBsk2T2NDyo44n1Old2lNGp97 QKibT6rmq8q6Q/mfq8IqUG8nvmiuV5B2AHU/1w0HMLdqNHbLtq5GGKVXGug5cG1Ot+XS mkkkh7rydvNMCsrgaFqDsfAWonnq5hDOh70ZqEo1s/bj8fftusqUGtre2CwZCadSlkEV WZ//lfDIeCdPK8f2JCGSqDyNvqgpCYPSimbnwMtahyy7h82cQGKQ3OU2LyzqRFN+0wvE m1iQ== X-Gm-Message-State: AOAM53193+Oa0SaQOE3MzlDgGEB/TDueSyGJvmYJagpo1nDhh/s6u02/ jyYp5NgvLygKW361k7oNbiJR7vO3dSY= X-Google-Smtp-Source: ABdhPJyTZq4wwg1BAFI5gRI5StWdqqAbGj2wkgv//edRaFerxIvNMzzO83a3y2DbUA5YG2MmdKDBLA== X-Received: by 2002:a05:6512:31c2:: with SMTP id j2mr10980517lfe.69.1620684568613; Mon, 10 May 2021 15:09:28 -0700 (PDT) Received: from localhost.localdomain (109-252-193-91.dynamic.spd-mgts.ru. [109.252.193.91]) by smtp.gmail.com with ESMTPSA id y5sm2381479lfa.148.2021.05.10.15.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 May 2021 15:09:28 -0700 (PDT) From: Dmitry Osipenko To: Sebastian Reichel , Antoni Aloy Torrens , =?utf-8?q?Nikola_Milosavljevi=C4=87?= Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/2] power: supply: sbs-battery: Fall back to Li-ion battery type for bq20z75 Date: Tue, 11 May 2021 01:08:27 +0300 Message-Id: <20210510220827.11595-2-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210510220827.11595-1-digetx@gmail.com> References: <20210510220827.11595-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The older bq20z75 controller doesn't support reporting the battery type and the type is Li-ion in this case. Tested-by: Antoni Aloy Torrens # TF101 Tested-by: Nikola Milosavljević # TF101 Signed-off-by: Dmitry Osipenko --- drivers/power/supply/sbs-battery.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c index b71fbf543428..fec6c139d4ff 100644 --- a/drivers/power/supply/sbs-battery.c +++ b/drivers/power/supply/sbs-battery.c @@ -813,9 +813,17 @@ static int sbs_get_chemistry(struct i2c_client *client, else val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN; - if (val->intval == POWER_SUPPLY_TECHNOLOGY_UNKNOWN) + if (val->intval == POWER_SUPPLY_TECHNOLOGY_UNKNOWN) { + struct sbs_info *chip = i2c_get_clientdata(client); + dev_warn_once(&client->dev, "Unknown chemistry: %s\n", chemistry); + if (chip->flags & SBS_FLAGS_TI_BQ20ZX5) { + dev_warn_once(&client->dev, "Falling back to Li-ion\n"); + val->intval = POWER_SUPPLY_TECHNOLOGY_LION; + } + } + return 0; }