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

From: Milan Obuch <freebsd-hackers_at_dino.sk>
Date: Fri, 04 Mar 2022 15:16:09 UTC
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