linux/drivers/hwmon/acpi_power_meter.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * A hwmon driver for ACPI 4.0 power meters
 * Copyright (C) 2009 IBM
 *
 * Author: Darrick J. Wong <[email protected]>
 */

#include <linux/module.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/jiffies.h>
#include <linux/mutex.h>
#include <linux/dmi.h>
#include <linux/slab.h>
#include <linux/kdev_t.h>
#include <linux/sched.h>
#include <linux/time.h>
#include <linux/err.h>
#include <linux/acpi.h>

#define ACPI_POWER_METER_NAME
#define ACPI_POWER_METER_DEVICE_NAME
#define ACPI_POWER_METER_CLASS

#define NUM_SENSORS

#define POWER_METER_CAN_MEASURE
#define POWER_METER_CAN_TRIP
#define POWER_METER_CAN_CAP
#define POWER_METER_CAN_NOTIFY
#define POWER_METER_IS_BATTERY
#define UNKNOWN_HYSTERESIS
#define UNKNOWN_POWER

#define METER_NOTIFY_CONFIG
#define METER_NOTIFY_TRIP
#define METER_NOTIFY_CAP
#define METER_NOTIFY_CAPPING
#define METER_NOTIFY_INTERVAL

#define POWER_AVERAGE_NAME
#define POWER_CAP_NAME
#define POWER_AVG_INTERVAL_NAME
#define POWER_ALARM_NAME

static int cap_in_hardware;
static bool force_cap_on;

static int can_cap_in_hardware(void)
{}

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

struct acpi_power_meter_capabilities {};

struct acpi_power_meter_resource {};

struct sensor_template {};

/* Averaging interval */
static int update_avg_interval(struct acpi_power_meter_resource *resource)
{}

static ssize_t show_avg_interval(struct device *dev,
				 struct device_attribute *devattr,
				 char *buf)
{}

static ssize_t set_avg_interval(struct device *dev,
				struct device_attribute *devattr,
				const char *buf, size_t count)
{}

/* Cap functions */
static int update_cap(struct acpi_power_meter_resource *resource)
{}

static ssize_t show_cap(struct device *dev,
			struct device_attribute *devattr,
			char *buf)
{}

static ssize_t set_cap(struct device *dev, struct device_attribute *devattr,
		       const char *buf, size_t count)
{}

/* Power meter trip points */
static int set_acpi_trip(struct acpi_power_meter_resource *resource)
{}

static ssize_t set_trip(struct device *dev, struct device_attribute *devattr,
			const char *buf, size_t count)
{}

/* Power meter */
static int update_meter(struct acpi_power_meter_resource *resource)
{}

static ssize_t show_power(struct device *dev,
			  struct device_attribute *devattr,
			  char *buf)
{}

/* Miscellaneous */
static ssize_t show_str(struct device *dev,
			struct device_attribute *devattr,
			char *buf)
{}

static ssize_t show_val(struct device *dev,
			struct device_attribute *devattr,
			char *buf)
{}

static ssize_t show_accuracy(struct device *dev,
			     struct device_attribute *devattr,
			     char *buf)
{}

static ssize_t show_name(struct device *dev,
			 struct device_attribute *devattr,
			 char *buf)
{}

#define RO_SENSOR_TEMPLATE

#define RW_SENSOR_TEMPLATE

/* Sensor descriptions.  If you add a sensor, update NUM_SENSORS above! */
static struct sensor_template meter_attrs[] =;

static struct sensor_template misc_cap_attrs[] =;

static struct sensor_template ro_cap_attrs[] =;

static struct sensor_template rw_cap_attrs[] =;

static struct sensor_template trip_attrs[] =;

static struct sensor_template misc_attrs[] =;

#undef RO_SENSOR_TEMPLATE
#undef RW_SENSOR_TEMPLATE

/* Read power domain data */
static void remove_domain_devices(struct acpi_power_meter_resource *resource)
{}

static int read_domain_devices(struct acpi_power_meter_resource *resource)
{}

/* Registration and deregistration */
static int register_attrs(struct acpi_power_meter_resource *resource,
			  struct sensor_template *attrs)
{}

static void remove_attrs(struct acpi_power_meter_resource *resource)
{}

static int setup_attrs(struct acpi_power_meter_resource *resource)
{}

static void free_capabilities(struct acpi_power_meter_resource *resource)
{}

static int read_capabilities(struct acpi_power_meter_resource *resource)
{}

/* Handle ACPI event notifications */
static void acpi_power_meter_notify(struct acpi_device *device, u32 event)
{}

static int acpi_power_meter_add(struct acpi_device *device)
{}

static void acpi_power_meter_remove(struct acpi_device *device)
{}

static int acpi_power_meter_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(acpi_power_meter_pm, NULL,
				acpi_power_meter_resume);

static struct acpi_driver acpi_power_meter_driver =;

/* Module init/exit routines */
static int __init enable_cap_knobs(const struct dmi_system_id *d)
{}

static const struct dmi_system_id pm_dmi_table[] __initconst =;

static int __init acpi_power_meter_init(void)
{}

static void __exit acpi_power_meter_exit(void)
{}

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

module_param(force_cap_on, bool, 0644);
MODULE_PARM_DESC();

module_init();
module_exit(acpi_power_meter_exit);