linux/drivers/platform/x86/quickstart.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * ACPI Direct App Launch driver
 *
 * Copyright (C) 2024 Armin Wolf <[email protected]>
 * Copyright (C) 2022 Arvid Norlander <[email protected]>
 * Copyright (C) 2007-2010 Angelo Arrifano <[email protected]>
 *
 * Information gathered from disassembled dsdt and from here:
 * <https://archive.org/details/microsoft-acpi-dirapplaunch>
 */

#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/input/sparse-keymap.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/pm_wakeup.h>
#include <linux/printk.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/types.h>

#include <asm/unaligned.h>

#define DRIVER_NAME

/*
 * There will be two events:
 * 0x02 - Button was pressed while device was off/sleeping.
 * 0x80 - Button was pressed while device was up.
 */
#define QUICKSTART_EVENT_RUNTIME

struct quickstart_data {};

/*
 * Knowing what these buttons do require system specific knowledge.
 * This could be done by matching on DMI data in a long quirk table.
 * However, it is easier to leave it up to user space to figure this out.
 *
 * Using for example udev hwdb the scancode 0x1 can be remapped suitably.
 */
static const struct key_entry quickstart_keymap[] =;

static ssize_t button_id_show(struct device *dev, struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(button_id);

static struct attribute *quickstart_attrs[] =;
ATTRIBUTE_GROUPS();

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

/*
 * The GHID ACPI method is used to indicate the "role" of the button.
 * However, all the meanings of these values are vendor defined.
 *
 * We do however expose this value to user space.
 */
static int quickstart_get_ghid(struct quickstart_data *data)
{}

static void quickstart_notify_remove(void *context)
{}

static void quickstart_mutex_destroy(void *data)
{}

static int quickstart_probe(struct platform_device *pdev)
{}

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

static struct platform_driver quickstart_platform_driver =;
module_platform_driver();

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