From nobody Wed Dec 11 12:38:09 2024 X-Original-To: freebsd-arm@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 4Y7Zs50r3Sz5gsSg for ; Wed, 11 Dec 2024 12:38:33 +0000 (UTC) (envelope-from darius@dons.net.au) Received: from midget.dons.net.au (midget.dons.net.au [IPv6:2403:580d:ae98:0:225:90ff:fe47:39b4]) by mx1.freebsd.org (Postfix) with ESMTP id 4Y7Zs42RNHz524g for ; Wed, 11 Dec 2024 12:38:32 +0000 (UTC) (envelope-from darius@dons.net.au) Authentication-Results: mx1.freebsd.org; none Received: from smtpclient.apple (unknown [IPv6:2403:580d:ae98:0:8924:6ca5:392a:ae23]) by midget.dons.net.au (Postfix) with ESMTPSA id 00C3073D087; Wed, 11 Dec 2024 23:08:19 +1030 (ACDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dons.net.au; s=default; t=1733920701; bh=oN0Qu1kDGdcJAR4G+UmEy8k8yoEiY2/Mf+3b0ZhQrSw=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=R+2zY/awvr9rED73PMOU4/yn1ASRi4XELgt3eD5t8HitCtIfQpePxZ3lUdiIXARy1 24kzXQFMB5AryHgFMZacSb8Nkrdc0AArUbRxpH6Kk7ogFqKx/QxXqEiGJT022nnAWa 2fdUZke283g6FBG3tsCHWuMmkgJvI+TbBPK0eYJHtiSXQ1LB1pkGXJEgqZrlWVNjGN tCnov7bhbC8aBSGYSZ8Ahp9wIaEARUA/mzzbRo/JhblxhOPCkFzP5sFRCn8NBhzCyv kbfJL6+V8gl74VZSdrTW69VPeNI0A/d+TEC3GQNDHp95+6fo4hDv6ex8rBajzyz0Mm m6kS1I06KrVig== Content-Type: text/plain; charset=us-ascii List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.200.121\)) Subject: Re: Battery info sysctl for arm devices From: Daniel O'Connor In-Reply-To: <20241211071534.Horde.gSiFIgVN4paXTOU2_b343Cw@cloud.nextcloudhosting.co.za> Date: Wed, 11 Dec 2024 23:08:09 +1030 Cc: freebsd-arm@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20241211071534.Horde.gSiFIgVN4paXTOU2_b343Cw@cloud.nextcloudhosting.co.za> To: Toby Kurien X-Mailer: Apple Mail (2.3826.200.121) X-Rspamd-Action: no action X-Rspamd-Server: midget.dons.net.au X-Spam-Status: No, score=-1.10 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:4764, ipnet:2403:5800::/27, country:AU] X-Rspamd-Queue-Id: 4Y7Zs42RNHz524g X-Spamd-Bar: ---- > On 11 Dec 2024, at 17:45, Toby Kurien wrote: > I am new to FreeBSD and busy implementing a driver for the battery and = charge controller in the Pinephone Pro. Everything battery-related = appears to fall under ACPI, including the sysctls in hw.acpi.battery.* = and I was wondering how battery on ARM is normally handled? Is there a = /dev/acpi on ARM or is there a different standard for handling battery = on ARM?=20 > =20 > I looked into the source for upower to see how it handles FreeBSD, but = it seems to be based on ACPI. I was wondering if I should "emulate" ACPI = by registering "hw.acpi.battery.*" to expose the battery info, but then = it seems upower will try to use /dev/acpi, which would fail. Any = pointers on how to expose battery state on ARM would be appreciated.=20 I think you could emulate the sysctls - I had a similar issue with the = Raspberry PiJuice board - unfortunately it looks like the battery = infrastructure is glued to ACPI which is disabled (at least on RPi). For power status (so powerd run the scripts for power coming and going) = I send devctl ACPI/ACAD/notify messages. -- Daniel O'Connor "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum