linux/drivers/thermal/thermal_sysfs.c

// SPDX-License-Identifier: GPL-2.0
/*
 *  thermal.c - sysfs interface of thermal devices
 *
 *  Copyright (C) 2016 Eduardo Valentin <[email protected]>
 *
 *  Highly based on original thermal_core.c
 *  Copyright (C) 2008 Intel Corp
 *  Copyright (C) 2008 Zhang Rui <[email protected]>
 *  Copyright (C) 2008 Sujith Thomas <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/sysfs.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/jiffies.h>

#include "thermal_core.h"

/* sys I/F for thermal zone */

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

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

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

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

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

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

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

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

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

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

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

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

#if (IS_ENABLED(CONFIG_THERMAL_EMULATION))
static ssize_t
emul_temp_store(struct device *dev, struct device_attribute *attr,
		const char *buf, size_t count)
{}
static DEVICE_ATTR_WO(emul_temp);
#endif

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

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

#define create_s32_tzp_attr

create_s32_tzp_attr;
create_s32_tzp_attr;
create_s32_tzp_attr;
create_s32_tzp_attr;
create_s32_tzp_attr;
create_s32_tzp_attr;
create_s32_tzp_attr;
#undef create_s32_tzp_attr

/*
 * These are thermal zone device attributes that will always be present.
 * All the attributes created for tzp (create_s32_tzp_attr) also are always
 * present on the sysfs interface.
 */
static DEVICE_ATTR_RO(type);
static DEVICE_ATTR_RO(temp);
static DEVICE_ATTR_RW(policy);
static DEVICE_ATTR_RO(available_policies);
static DEVICE_ATTR_RW(sustainable_power);

/* These thermal zone device attributes are created based on conditions */
static DEVICE_ATTR_RW(mode);

/* These attributes are unconditionally added to a thermal zone */
static struct attribute *thermal_zone_dev_attrs[] =;

static const struct attribute_group thermal_zone_attribute_group =;

static struct attribute *thermal_zone_mode_attrs[] =;

static const struct attribute_group thermal_zone_mode_attribute_group =;

static const struct attribute_group *thermal_zone_attribute_groups[] =;

/**
 * create_trip_attrs() - create attributes for trip points
 * @tz:		the thermal zone device
 *
 * helper function to instantiate sysfs entries for every trip
 * point and its properties of a struct thermal_zone_device.
 *
 * Return: 0 on success, the proper error value otherwise.
 */
static int create_trip_attrs(struct thermal_zone_device *tz)
{}

/**
 * destroy_trip_attrs() - destroy attributes for trip points
 * @tz:		the thermal zone device
 *
 * helper function to free resources allocated by create_trip_attrs()
 */
static void destroy_trip_attrs(struct thermal_zone_device *tz)
{}

int thermal_zone_create_device_groups(struct thermal_zone_device *tz)
{}

void thermal_zone_destroy_device_groups(struct thermal_zone_device *tz)
{}

/* sys I/F for cooling device */
static ssize_t
cdev_type_show(struct device *dev, struct device_attribute *attr, char *buf)
{}

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

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

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

static struct device_attribute
dev_attr_cdev_type =;
static DEVICE_ATTR_RO(max_state);
static DEVICE_ATTR_RW(cur_state);

static struct attribute *cooling_device_attrs[] =;

static const struct attribute_group cooling_device_attr_group =;

static const struct attribute_group *cooling_device_attr_groups[] =;

#ifdef CONFIG_THERMAL_STATISTICS
struct cooling_dev_stats {};

static void update_time_in_state(struct cooling_dev_stats *stats)
{}

void thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev,
					 unsigned long new_state)
{}

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

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

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

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

static DEVICE_ATTR_RO(total_trans);
static DEVICE_ATTR_RO(time_in_state_ms);
static DEVICE_ATTR_WO(reset);
static DEVICE_ATTR_RO(trans_table);

static struct attribute *cooling_device_stats_attrs[] =;

static const struct attribute_group cooling_device_stats_attr_group =;

static void cooling_device_stats_setup(struct thermal_cooling_device *cdev)
{}

static void cooling_device_stats_destroy(struct thermal_cooling_device *cdev)
{}

#else

static inline void
cooling_device_stats_setup(struct thermal_cooling_device *cdev) {}
static inline void
cooling_device_stats_destroy(struct thermal_cooling_device *cdev) {}

#endif /* CONFIG_THERMAL_STATISTICS */

void thermal_cooling_device_setup_sysfs(struct thermal_cooling_device *cdev)
{}

void thermal_cooling_device_destroy_sysfs(struct thermal_cooling_device *cdev)
{}

void thermal_cooling_device_stats_reinit(struct thermal_cooling_device *cdev)
{}

/* these helper will be used only at the time of bindig */
ssize_t
trip_point_show(struct device *dev, struct device_attribute *attr, char *buf)
{}

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

ssize_t weight_store(struct device *dev, struct device_attribute *attr,
		     const char *buf, size_t count)
{}