Aw: GPD Micro PC power button and lid close [originally Re: GPD Micro PC serial port]

From: <georg.lastname_at_web.de>
Date: Sat, 05 Mar 2022 18:19:35 UTC
> Gesendet: Freitag, den 04.03.2022 um 16:16 Uhr
> Von: "Milan Obuch" <freebsd-hackers@dino.sk>
> An: freebsd-hackers@freebsd.org
> Betreff: GPD Micro PC power button and lid close [originally Re: GPD Micro PC serial port]
>
> On Fri, 4 Mar 2022 20:51:50 +0700
> Eugene Grosbein <eugen@grosbein.net> wrote:
>
> > 04.03.2022 20:42, Milan Obuch wrote:
> >
> > > Hi,
> > >
> > > for mobile usage I've got Micro PC from GPD, some description and
> > > data here:
> > >
> > > https://www.amazon.com/Industry-Portable-Computer-Notebook-Graphics/dp/B07QYZHM8F
> > >
> > > I managed to install dual boot FreeBSD/Windows here. Working with
> > > FreeBSD 13 here, it was possible to verify working ethernet, wifi, X
> > > on both internal display and HDMI connected monitor, and all basic
> > > devices.
> > >
> > > I've put dmesg from at
> > > https://dmesgd.nycbug.org/index.cgi?do=view&id=6461
> > >
> > > There is one think I'd like to get into working state - serial
> > > port. In Windows, it is COM2 with standard I/O address and IRQ,
> > > however, I see nothing in FreeBSD... has somebody any hint for me?
> >
> > You seem to use custom kernel configuration. Did you try GENERIC?
> > Can you share your kernel config? Also output of "pciconf -lv"
> > and "dmidecode" commands ("pkg install dmidecode" for the latter).
> >
>
> Yes, I use custom kernel, basically MINIMAL with some modules loaded
> via loader.conf, other automatically and i915kms from rc.conf. As I
> verified correct values are in device.hints, I found the solution -
> loading module uart.ko from running system installed uart2..uart5 (no
> idea what it is used for, you'll see them in some data provided), but
> loading it from loader.conf brings uart1..uart5. Problem solved, I just
> verified it is exactly the port on back.
>
> Just for info, output from 'pciconf -lv' is attached. 'dmidecode'
> output added as well. Now, with serial port working, I see there is
> something else I forgot - power button does nothing when FreeBSD is
> running, just long press powers it off without proper shutdown
> sequence. 'dmesg | grep acpi' tells
>
> acpi0: <ALASKA A M I >
> cpu0: <ACPI CPU> on acpi0
> attimer0: <AT timer> port 0x40-0x43,0x50-0x53 irq 0 on acpi0
> atrtc0: <AT realtime clock> port 0x70-0x77 on acpi0
> hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff irq 8 on acpi0
> acpi_timer0: <32-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
> acpi_ec0: <Embedded Controller: GPE 0x26> port 0x62,0x66 on acpi0
> pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
> acpi_button0: <Power Button> on acpi0
> acpi_tz0: <Thermal Zone> on acpi0
> atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
> uart1: <16550 or compatible> port 0x2f8-0x2ff irq 3 on acpi0
> acpi_acad0: <AC Adapter> on acpi0
> battery0: <ACPI Control Method Battery> on acpi0
> acpi_lid0: <Control Method Lid Switch> on acpi0
>
> so there should be something handling power button (and lid close
> event, as well). Any idea here?
>
> Regards,
> Milan

Hey,

You can turn on verbose logging of acpi with "hw.acpi.verbose" kernel environment variable. On pressing the power button, you should see the log "power button pressed\n" and maybe more..
Maybe this cpu doesnt support sleep state S5 (I'm a noob), as it should be triggered when pressing the power button (see the  hw.acpi.power_button_state sysctl).