Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3915917iob; Mon, 2 May 2022 08:38:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwACp2KzVJK8HNqWZ70M4P8SKKwNCTvaRW0jpfEKhuvD+CpxRfjXb2KQAMMMwJfoYV/sEK+ X-Received: by 2002:a05:6a00:10cc:b0:505:ada6:e03e with SMTP id d12-20020a056a0010cc00b00505ada6e03emr11964676pfu.45.1651505916237; Mon, 02 May 2022 08:38:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651505916; cv=none; d=google.com; s=arc-20160816; b=js2L8SRnbzcASFn9D2ldAf6M+zz4FVd7YG8NI27DJK+W0RnH5SVlAN81Hzhv4E3MYz 0+CS55Xz1TZAE83z291UWdySoSb8QjndzZMBpV+PSGgZZAgORzSPBOWB0ZHqzCbAOhph +DwfqdS6KGGbrZz5Vmj7ZuRrRcyDG7mfWWzNOC6KH/9/nmfU3Li/ElazkHJkg/za6yJh mPOyu2VezUTcRLKY7Ue2CkXwtXtu4tOkOLkfqBB2KIT+Z98aEnCf2h1zOgVL7mIBaLH8 6n06A+/GdUtzElprpk9/e8qcUuuOi068W2gVJa/FaLIDib4vbYiH9nSyHBEiYCTe1Onz wVCA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=ZbduflGai2BniQyEKChWvgw5Vbl22wyDBPYLOeD9fFE=; b=y2cstbwuTYC+THMkneUsFRVHlSwM3j9iJishfbEqTxzRVlPK0K2n8F6GJqH4PpEfHo mkwNTdgwpIKsl25srpRzqQZu/AZAZK5QjLGiMBvgCUNswizWwdDTHWG9YWXOGZdduyyx V7MYiiDd6rnSVbGfEsBMEfi8tHbmjqI+oeagWfhPL6bzcGOgR4scDe2nE+Cx4Kh/S3Fo LDXUtyo9ED1u2oSqkuhyyUnbs2aVXGwSF6JVMWR9Nc7xjrduQM10xv0cxBApVXpNog6W 9+o2/tdSkyDmQ2W98/Gwg7W9h/b0X5t84Mx5C1JfgasyRneFLOLPDy0SMY9/tAPkFzrF xY8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bSYN+B3h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m4-20020a170902f64400b001590118e14dsi13533823plg.108.2022.05.02.08.38.19; Mon, 02 May 2022 08:38:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bSYN+B3h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379755AbiD2Ro6 (ORCPT + 99 others); Fri, 29 Apr 2022 13:44:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379753AbiD2Rov (ORCPT ); Fri, 29 Apr 2022 13:44:51 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6965BA27D9; Fri, 29 Apr 2022 10:41:32 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id a14-20020a7bc1ce000000b00393fb52a386so6817658wmj.1; Fri, 29 Apr 2022 10:41:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZbduflGai2BniQyEKChWvgw5Vbl22wyDBPYLOeD9fFE=; b=bSYN+B3h2mAeBcH3seOMQdUjesImu5IKiQxaWNE41w9Ju3YhzkXQnQhmcJhGN5Hf6V /gNkzLUOFK9RypYZA9N4rXeDdNDk4FD27/N2hepvIpMEh8JD0q8KorkElnFGPGq8P5eg vj4azpAnhkloekBwwrZExm4ggXkxmYOv3mfY4LWNP0QQc8YcWd1PrGsF9B0/mY44PBN2 TpY9XaI9R8Nd8CrabcnLEZrZxBshWhODKsHNHbWRQqPtPX0Pcmv7f5T9eXEJ3Jk2f7dV k8UTOx55qRFyb2ECcDiqvbomkf8UMPCU8UJMxOFa6Me58BbJIQOBPMGeajZfkIZ+8guA SnqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZbduflGai2BniQyEKChWvgw5Vbl22wyDBPYLOeD9fFE=; b=ueKVN23/cDM5OQy5UuJeZUhV70Avj0I7ffTORc26rqrjDEk97q78fHJfdM74T60uUD oopKQ3MFQBaWH0ZnfZ45mh6hotW2KUjH/QJrJrHgtZNFnx2Q7a0hodGzd6x0GjKen+pV bLg/R9GRIyV7HR2RYPQkuT0dQDErRj3KYyYuB5Qg4EDgpPFeCe9h3ixwje9gZdGufysG Ofmz8uRvfxJf8g6nBlF0Rb35wXMvhCwCASfU0b7DFCNJhMqyzJqvdypsmlmObhESkJTZ /zSjpyLLVtEjK5bwDRMMJPwa955utgCwMrB1bEkFeIikiRHSsnwYVgRnS6EdTLbE9Pyw C4PA== X-Gm-Message-State: AOAM5328hJ4YWln4R+C2P52v6LXnMrjkqUjlP2RO0YI+9jVjynj3rmrf ESvRZN78PMNduRhBJUvRh/M= X-Received: by 2002:a05:600c:348c:b0:392:990b:cf98 with SMTP id a12-20020a05600c348c00b00392990bcf98mr4225842wmq.194.1651254090842; Fri, 29 Apr 2022 10:41:30 -0700 (PDT) Received: from xws.localdomain (pd9e5acba.dip0.t-ipconnect.de. [217.229.172.186]) by smtp.gmail.com with ESMTPSA id k28-20020a05600c1c9c00b0039424a07762sm1239921wms.35.2022.04.29.10.41.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 10:41:29 -0700 (PDT) From: Maximilian Luz To: "Rafael J. Wysocki" Cc: Maximilian Luz , Len Brown , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ACPI: battery: Add "Not Charging" quirk for Microsoft Surface devices Date: Fri, 29 Apr 2022 19:41:14 +0200 Message-Id: <20220429174114.1277799-1-luzmaximilian@gmail.com> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Microsoft Surface devices have a limiter that sets a fixed maximum charge capacity for the battery. When that maximum capacity has been reached, charging stops. In that case, _BST returns a battery state field with both "charging" and "discharging" bits cleared. The battery driver, however, returns "unknown" as status. This seems to be the same behavior as observed on the ThinkPads, so let's use the same quirk to handle that. Signed-off-by: Maximilian Luz --- For what it's worth, I don't think the ACPI spec explicitly states that any of the status bits need to be set, or that there are only the "charging" and "discharging" states. As far as I can tell, ACPI only states: Notice that the Charging bit and the Discharging bit are mutually exclusive and must not both be set at the same time. Even in critical state, hardware should report the corresponding charging/discharging state. But that does not exclude the case that no bit is set. So, strictly going by spec, I don't think it's necessary to put all of this behind a quirk. --- drivers/acpi/battery.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index dc208f5f5a1f..1c88504aae5b 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -1152,6 +1152,19 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = { DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"), }, }, + { + /* + * Microsoft Surface devices have an optional "battery + * limiter". Due to this, there is a "Not Charging" state + * similar to the one on the Lenovo ThinkPads, described above. + */ + .callback = battery_quirk_not_charging, + .ident = "Microsoft Surface", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), + DMI_MATCH(DMI_PRODUCT_NAME, "Surface"), + }, + }, { /* Microsoft Surface Go 3 */ .callback = battery_notification_delay_quirk, -- 2.36.0