All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gwendal Grignou <gwendal@chromium.org>
To: hdegoede@redhat.com
Cc: platform-driver-x86@vger.kernel.org,
	Gwendal Grignou <gwendal@chromium.org>
Subject: [PATCH 0/2] platform/x86: intel-vbtn: Fix ASUS VivoBook boot state
Date: Fri, 29 Mar 2024 07:32:04 -0700	[thread overview]
Message-ID: <20240329143206.2977734-1-gwendal@chromium.org> (raw)

While qualifying ASUS VivoBook Flip 14 (TP401NAS) for ChromeOS Plex,
we notice it always boot in tablet mode, with the keyboard and touchpad
disabled. We have to rotate its lid over 180 degree and back to get into
clamshell mode, or put it into sleep and wake it up.

Disassembling the ACPI table, the virtual button/switch ACPI device is
implemented as follow:

  Device (VGBI)
  {
      Name (_HID, EisaId ("INT33D6") /* Intel Virtual Buttons Device */)  // _HID: Hardware ID
      Name (VBDS, Zero)
      Method (_STA, 0, Serialized)  // _STA: Status
      {
          PB1E |= 0x20
          If ((OSYS >= 0x07DD))
          {
              Return (0x0F)
          }

          Return (Zero)
      }

      Method (VBDL, 0, Serialized)
      {
          PB1E |= 0x20
          VBDS |= 0x40
      }

      Method (VGBS, 0, Serialized)
      {
          Return (VBDS) /* \_SB_.PCI0.SBRG.EC0_.VGBI.VBDS */
      }

      Method (UPBT, 2, Serialized)
      {
          Local0 = (One << Arg0)
          If (Arg1)
          {
              VBDS |= Local0
          }
          Else
          {
              VBDS &= ~Local0
          }
      }
  }

Method UBPT is called when lid angle cross 180 degree boundary or when
the device is woken up.

At boot, VBDS is set to 0 ("tablet mode") until UBPT or VBDL are called.

VBDL used to be evaluated before VGBS by the intel-vbtn driver probe
routine, but since commit 26173179fae1 ("platform/x86: intel-vbtn: Eval VBDL after registering our notifier"),
call to VGBS is delayed until after the notifier is register.

To bring back the expected behavior (device booting in clamshell
mode), make sure we evaluate VGBS after VBDL.

While at it, use function acpi_has_method() when we only need to know if a
method exist, as commit 26173179fae1 does.

Gwendal Grignou (2):
  platform/x86: intel-vbtn: Use acpi_has_method to check for switch
  platform/x86: intel-vbtn: Update tablet mode switch at end of probe

 drivers/platform/x86/intel/vbtn.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

-- 
2.44.0.478.gd926399ef9-goog


             reply	other threads:[~2024-03-29 14:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-29 14:32 Gwendal Grignou [this message]
2024-03-29 14:32 ` [PATCH 1/2] platform/x86: intel-vbtn: Use acpi_has_method to check for switch Gwendal Grignou
2024-03-29 18:49   ` Kuppuswamy Sathyanarayanan
2024-04-08 15:44     ` Ilpo Järvinen
2024-03-29 14:32 ` [PATCH 2/2] platform/x86: intel-vbtn: Update tablet mode switch at end of probe Gwendal Grignou
2024-03-29 18:50   ` Kuppuswamy Sathyanarayanan
2024-04-08 13:17 ` [PATCH 0/2] platform/x86: intel-vbtn: Fix ASUS VivoBook boot state Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240329143206.2977734-1-gwendal@chromium.org \
    --to=gwendal@chromium.org \
    --cc=hdegoede@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.