linux/drivers/platform/chrome/chromeos_acpi.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * ChromeOS specific ACPI extensions
 *
 * Copyright 2022 Google LLC
 *
 * This driver attaches to the ChromeOS ACPI device and then exports the
 * values reported by the ACPI in a sysfs directory. All values are
 * presented in the string form (numbers as decimal values) and can be
 * accessed as the contents of the appropriate read only files in the
 * sysfs directory tree.
 */
#include <linux/acpi.h>
#include <linux/platform_device.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>

#define ACPI_ATTR_NAME_LEN

#define DEV_ATTR(_var, _name)

#define GPIO_ATTR_GROUP(_group, _name, _num)

static unsigned int chromeos_acpi_gpio_groups;

/* Parse the ACPI package and return the data related to that attribute */
static int chromeos_acpi_handle_package(struct device *dev, union acpi_object *obj,
					int pkg_num, int sub_pkg_num, char *name, char *buf)
{}

static int chromeos_acpi_evaluate_method(struct device *dev, int pkg_num, int sub_pkg_num,
					 char *name, char *buf)
{}

static int parse_attr_name(const char *name, char *attr_name, int *attr_num)
{}

static ssize_t chromeos_first_level_attr_show(struct device *dev, struct device_attribute *attr,
					      char *buf)
{}

static unsigned int get_gpio_pkg_num(struct device *dev)
{}

DEV_ATTR()
DEV_ATTR()
DEV_ATTR()
DEV_ATTR()
DEV_ATTR()
DEV_ATTR()
DEV_ATTR()
DEV_ATTR()
DEV_ATTR()
DEV_ATTR()
DEV_ATTR()

static struct attribute *first_level_attrs[] =;

static const struct attribute_group first_level_attr_group =;

/*
 * Every platform can have a different number of GPIO attribute groups.
 * Define upper limit groups. At run time, the platform decides to show
 * the present number of groups only, others are hidden.
 */
GPIO_ATTR_GROUP()
GPIO_ATTR_GROUP()
GPIO_ATTR_GROUP()
GPIO_ATTR_GROUP()
GPIO_ATTR_GROUP()
GPIO_ATTR_GROUP()
GPIO_ATTR_GROUP()
GPIO_ATTR_GROUP()

static const struct attribute_group *chromeos_acpi_all_groups[] =;

static int chromeos_acpi_device_probe(struct platform_device *pdev)
{}

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

static struct platform_driver chromeos_acpi_device_driver =;
module_platform_driver();

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