Re: GPD Micro PC power button and lid close

From: Milan Obuch <freebsd-hackers_at_dino.sk>
Date: Sat, 05 Mar 2022 18:40:20 UTC
On Sat, 5 Mar 2022 19:19:35 +0100
georg.lastname@web.de wrote:

> > 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]

[ snip ]

> > 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).
> 

This is output of 'sysctl hw.acpi' (minus battery, acline and thermal
objects, not relevant here):

hw.acpi.cpu.cx_lowest: C1
hw.acpi.reset_video: 0
hw.acpi.handle_reboot: 1
hw.acpi.disable_on_reboot: 0
hw.acpi.verbose: 1
hw.acpi.s4bios: 0
hw.acpi.sleep_delay: 1
hw.acpi.suspend_state: S3
hw.acpi.standby_state: NONE
hw.acpi.lid_switch_state: NONE
hw.acpi.sleep_button_state: S3
hw.acpi.power_button_state: S5
hw.acpi.supported_sleep_state: S3 S4 S5

Setting hw.acpi.verbose to 1 did not achieve anything in console log,
i.e. pressing power button does not geenrate any event logged there.

Regards,
Milan