From nobody Sat Dec 28 13:39:29 2024 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YL3PY68kMz5jNty for ; Sat, 28 Dec 2024 13:39:29 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YL3PY3htrz4QTF for ; Sat, 28 Dec 2024 13:39:29 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1735393169; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YZfMVw4wdUj7C1sTqsp5w2up5DdSbLQH7zxnDxfVf40=; b=OZ6giew/OsRPtksejUwPyQPPJgGC90sJWkXk4L2yPduIh4nUJiN2dSNUjevwdGcdEBSMhU MqmNHYbQLqO4tbpx5XoA8C6YE0U52hvv72IoH1yLrXrOnPngUqd/uPNYd/5RgDuNmMSswf Vdqihnzyifm+G/hJhflwWYL4rLnDI9st8LjVQckLW2sBDTNcojjJuDxO2Gx8g9Oqh7cIoj 85LTTU66mLG1OXzXV+HxUtiwV4jTpBJJPuB3oktMy5blxkOJAqDbNZfWN4JB+WALD/niTg MKxCaUt4+nEi+66g1Hu685fBRUwUacENABfC0GkYPpXrv9NAgiO6khkaRjSKSA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1735393169; a=rsa-sha256; cv=none; b=JLO8yP6pK9MiA8fL0dFxwgVkLrSNP6lkOxCtAgOT3esktGzMRKhlfBFCVGaUFVIBniR/00 FNFi86fZaYYl2vfPkzInv9NYgQg8x4qazdyVNatUgvnhMXEF2LPWEhiJOn6DnzEVPgbPz5 cEglc1cwIupyDw7sZop8Q1ewiOeaXNbpfAHYwNc07nHN6eZ9HYALCvbRXqBtRqvvBJAXdf C44k1I9DR2VlRk4O5Wor5uB8NUgLfynBJVnhg79nh2VOQng4/+AyTVU6hpSfQPPeuHW/q6 cEyo95kTVIra9ANEIUrDjHMSYCpHuaO9Wze8+kGuS/9todHvqljukXOCUJS36w== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YL3PY3JQ2zRBg for ; Sat, 28 Dec 2024 13:39:29 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 4BSDdTJk024357 for ; Sat, 28 Dec 2024 13:39:29 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 4BSDdTbi024356 for bugs@FreeBSD.org; Sat, 28 Dec 2024 13:39:29 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 283683] [PATCH] dev/acpica/acpi_cmbat.c: Add battery trip point (_BTP) Date: Sat, 28 Dec 2024 13:39:29 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 15.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: georg.lastname@web.de X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D283683 Bug ID: 283683 Summary: [PATCH] dev/acpica/acpi_cmbat.c: Add battery trip point (_BTP) Product: Base System Version: 15.0-CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: georg.lastname@web.de Created attachment 256226 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D256226&action= =3Dedit diff for sys/dev/acpica/acpi_cmbat.c [PATCH] Affected file: sys/dev/acpica/acpi_cmbat.c This patch implements _BTP (battery trip point). This is basically for laptop users. You set a warning level, e.g. 20%. Then devd will notify you when the batte= ry reaches 20%. Quoting the ACPI specification version 6.5 section 10.2.2.14 ("_BTP"): "This object is used to set a trip point to generate an SCI whenever the Battery Remaining Capacity reaches or crosses the value specified in the _B= TP object." I have another explanation here: https://github.com/random532/FreeBSD_Battery_Trip_Point The _BTP method is optional, so not every battery supports it. -- What I did (aka design choices): 1. The cmbat driver has a unique device_attach() routine. It loops multipe times until the battery controller is ready. So once that process is finished (aka the battery is registered), I feel li= ke that is a good place to add all the optional acpi methods. For now, the only optional method that is supported would be _BTP. I add a function acpi_initialize_btp() and a handler function acpi_cmbat_btp_sysctl(). 2. I chose a sysctl for the trip point. It is possible to use /dev/acpi and acpiconf for this, which at first glance is more consistent with the current design. However, the trip point is read-write. The current battery reportin= g is read-only. Also, we'd need a new argument for acpiconf, because right now, there is only acpiconf -i X, which reads battery information. I can see a design where the userland command would be "acpiconf -i 0 -w 20", where w w= ould be the warning level. But I think the sysctl is just fine. 3. More information is on github. I just want to put this out there. 4. So far tested on: ThinkPad x220 Thanks everyone. --=20 You are receiving this mail because: You are the assignee for the bug.=