Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4785486iob; Mon, 9 May 2022 01:20:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2tSCwCZySHXV4dkPCSiAeKLOKeFjao58kUPgjcDr5jM1wRQuW9EIcR43ZLBduwpiBHEZU X-Received: by 2002:a17:902:aa06:b0:158:f13b:4859 with SMTP id be6-20020a170902aa0600b00158f13b4859mr15080224plb.141.1652084446839; Mon, 09 May 2022 01:20:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652084446; cv=none; d=google.com; s=arc-20160816; b=V7pFskSgf/lS0MbdOEKBRoFO4CJ8tl7aooKnwllvYGyptP8RCS4NRy6jQvq26oXZL8 XcrsXaxngGEZpeuUf1jXyiuWyx6s+gtp65tET6jlXCzEvukSXJaWAZmVHjBSrpNpcozb zwP8h7foLREZ4oQ8DHxY4dYzmjm4CP0zHdqidyjfPwqlYXizilrJri2wcYfVZA7GKmis 08sTrAJdhUj13aRvRFRRvTPLMGkF2TdRFomH4nD/NRPJX9/lIUOr2KR/k7NKGeYNez9n D6XP/Wp9BlZpVTcUQpJEGOsw4h/EGhlStDGdHZnTOx2zK1hRucwgABv131+g9GABL03L sJBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=ahozwA6JR5T2cdvT7X6332oCeq+rsm8ghW3MnqhOLVQ=; b=a8hevbQeWMiuj+LyDAm5o/KhGe2dtCfgTn3DjIrW3FCS7r6RTsWBNR6btKCiUOIP45 CJ1mCUPMQeZA+4U+D6sRC8e92QA39hrm2btaVEZLcbzn9bIjXo9sxsp9lBWHJymQsgxU ++2pypWpCTB2aRxm5SsNSgHbzingxlfI9MIrDppXiC+Y1iCeE81K9/da4unNqx5l2VJH yjyV3vUcGrNwi2R3J0jT/aTgwx/JqjNJDTjvVP3pNFubfkbJ/AyyJuOvVCBQZLnhOrng 6AKNwGN+b5G5dJOhnMBh2H8b4vRgjb5zX8XNIbJiPoRkcGh0uIQlwnTLg6ay+eIomzpF KzNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l17-20020a170903121100b00154304022c6si12639102plh.564.2022.05.09.01.20.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 01:20:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7CE501E21B7; Mon, 9 May 2022 01:08:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379813AbiEFSrA (ORCPT + 99 others); Fri, 6 May 2022 14:47:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbiEFSq5 (ORCPT ); Fri, 6 May 2022 14:46:57 -0400 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C491562F4; Fri, 6 May 2022 11:43:14 -0700 (PDT) Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-2f7c57ee6feso90984317b3.2; Fri, 06 May 2022 11:43:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ahozwA6JR5T2cdvT7X6332oCeq+rsm8ghW3MnqhOLVQ=; b=NiHH0BweiFoPVnDwANIlKnelwo5Qb51GmVdjG+c48HkTU6/RcipXw99p7NoFkz9ERf fVY+vgr0MzNlJfKVp0Lvlu7P3Gtucjr8Uj1nQaswSCiRe/4GjQNYIAHDliKDtgmS6Tfm ncEq7lHxbzLp87YFrS5ac9xoSILfiiLZZoe9+3OFD58BfNGatpsFCVg/cggr3kBwVl+o DlBaeYUVOkhRbCBPmwstgKbb9N62eHBFUqNJuBmY6qRKrCu2OlnPrXfROGMHeJJ4NR7m ZMC0VHaKfuTILNKukOlkLyIMIFleGCmu47Bp8p5LAUaajw6RAZdhySJb7SZe12jL5SZj hNQA== X-Gm-Message-State: AOAM533fyFV7OGis1JRs6oOS5lAvvm0DJKFOm5JjgwIc3/7QU9Rjbw+0 jarsWo5pYjKLSBle8zSQmE+dw8gUUyNaNV9VFow= X-Received: by 2002:a81:260a:0:b0:2f4:ca82:a42f with SMTP id m10-20020a81260a000000b002f4ca82a42fmr3879863ywm.149.1651862593459; Fri, 06 May 2022 11:43:13 -0700 (PDT) MIME-Version: 1.0 References: <20220429174114.1277799-1-luzmaximilian@gmail.com> In-Reply-To: <20220429174114.1277799-1-luzmaximilian@gmail.com> From: "Rafael J. Wysocki" Date: Fri, 6 May 2022 20:43:02 +0200 Message-ID: Subject: Re: [PATCH] ACPI: battery: Add "Not Charging" quirk for Microsoft Surface devices To: Maximilian Luz Cc: "Rafael J. Wysocki" , Len Brown , ACPI Devel Maling List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Fri, Apr 29, 2022 at 7:41 PM Maximilian Luz wrote: > > 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. I think that this should be covered by the patch I've just applied: https://patchwork.kernel.org/project/linux-acpi/patch/20220427154053.499203-1-wse@tuxedocomputers.com/ Shouldn't it? > --- > 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 >