linux/drivers/platform/x86/intel/vbtn.c

// SPDX-License-Identifier: GPL-2.0+
/*
 *  Intel Virtual Button driver for Windows 8.1+
 *
 *  Copyright (C) 2016 AceLan Kao <[email protected]>
 *  Copyright (C) 2016 Alex Hung <[email protected]>
 */

#include <linux/acpi.h>
#include <linux/cleanup.h>
#include <linux/dmi.h>
#include <linux/input.h>
#include <linux/input/sparse-keymap.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/suspend.h>
#include "../dual_accel_detect.h"

/* Returned when NOT in tablet mode on some HP Stream x360 11 models */
#define VGBS_TABLET_MODE_FLAG_ALT
/* When NOT in tablet mode, VGBS returns with the flag 0x40 */
#define VGBS_TABLET_MODE_FLAG
#define VGBS_DOCK_MODE_FLAG

#define VGBS_TABLET_MODE_FLAGS

MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_AUTHOR();

static const struct acpi_device_id intel_vbtn_ids[] =;
MODULE_DEVICE_TABLE(acpi, intel_vbtn_ids);

/* In theory, these are HID usages. */
static const struct key_entry intel_vbtn_keymap[] =;

static const struct key_entry intel_vbtn_switchmap[] =;

struct intel_vbtn_priv {};

static void detect_tablet_mode(struct device *dev)
{}

/*
 * Note this unconditionally creates the 2 input_dev-s and sets up
 * the sparse-keymaps. Only the registration is conditional on
 * have_buttons / have_switches. This is done so that the notify
 * handler can always call sparse_keymap_entry_from_scancode()
 * on the input_dev-s do determine the event type.
 */
static int intel_vbtn_input_setup(struct platform_device *device)
{}

static void notify_handler(acpi_handle handle, u32 event, void *context)
{}

/*
 * There are several laptops (non 2-in-1) models out there which support VGBS,
 * but simply always return 0, which we translate to SW_TABLET_MODE=1. This in
 * turn causes userspace (libinput) to suppress events from the builtin
 * keyboard and touchpad, making the laptop essentially unusable.
 *
 * Since the problem of wrongly reporting SW_TABLET_MODE=1 in combination
 * with libinput, leads to a non-usable system. Where as OTOH many people will
 * not even notice when SW_TABLET_MODE is not being reported, a DMI based allow
 * list is used here. This list mainly matches on the chassis-type of 2-in-1s.
 *
 * There are also some 2-in-1s which use the intel-vbtn ACPI interface to report
 * SW_TABLET_MODE with a chassis-type of 8 ("Portable") or 10 ("Notebook"),
 * these are matched on a per model basis, since many normal laptops with a
 * possible broken VGBS ACPI-method also use these chassis-types.
 */
static const struct dmi_system_id dmi_switches_allow_list[] =;

static bool intel_vbtn_has_switches(acpi_handle handle, bool dual_accel)
{}

static int intel_vbtn_probe(struct platform_device *device)
{}

static void intel_vbtn_remove(struct platform_device *device)
{}

static int intel_vbtn_pm_prepare(struct device *dev)
{}

static void intel_vbtn_pm_complete(struct device *dev)
{}

static int intel_vbtn_pm_resume(struct device *dev)
{}

static const struct dev_pm_ops intel_vbtn_pm_ops =;

static struct platform_driver intel_vbtn_pl_driver =;

static acpi_status __init
check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv)
{}

static int __init intel_vbtn_init(void)
{}
module_init();

static void __exit intel_vbtn_exit(void)
{}
module_exit(intel_vbtn_exit);