linux/drivers/thermal/testing/zone.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright 2024, Intel Corporation
 *
 * Author: Rafael J. Wysocki <[email protected]>
 *
 * Thermal zone tempalates handling for thermal core testing.
 */

#define pr_fmt(fmt)

#include <linux/debugfs.h>
#include <linux/idr.h>
#include <linux/list.h>
#include <linux/thermal.h>
#include <linux/workqueue.h>

#include "thermal_testing.h"

#define TT_MAX_FILE_NAME_LENGTH

/**
 * struct tt_thermal_zone - Testing thermal zone template
 *
 * Represents a template of a thermal zone that can be used for registering
 * a test thermal zone with the thermal core.
 *
 * @list_node: Node in the list of all testing thermal zone templates.
 * @trips: List of trip point templates for this thermal zone template.
 * @d_tt_zone: Directory in debugfs representing this template.
 * @tz: Test thermal zone based on this template, if present.
 * @lock: Mutex for synchronizing changes of this template.
 * @ida: IDA for trip point IDs.
 * @id: The ID of this template for the debugfs interface.
 * @temp: Temperature value.
 * @tz_temp: Current thermal zone temperature (after registration).
 * @num_trips: Number of trip points in the @trips list.
 * @refcount: Reference counter for usage and removal synchronization.
 */
struct tt_thermal_zone {};

DEFINE_GUARD(tt_zone, struct tt_thermal_zone *, mutex_lock(&_T->lock), mutex_unlock(&_T->lock))

/**
 * struct tt_trip - Testing trip point template
 *
 * Represents a template of a trip point to be used for populating a trip point
 * during the registration of a thermal zone based on a given zone template.
 *
 * @list_node: Node in the list of all trip templates in the zone template.
 * @trip: Trip point data to use for thernal zone registration.
 * @id: The ID of this trip template for the debugfs interface.
 */
struct tt_trip {};

/*
 * It is both questionable and potentially problematic from the sychnronization
 * perspective to attempt to manipulate debugfs from within a debugfs file
 * "write" operation, so auxiliary work items are used for that.  The majority
 * of zone-related command functions have a part that runs from a workqueue and
 * make changes in debugs, among other things.
 */
struct tt_work {};

static inline struct tt_work *tt_work_of_work(struct work_struct *work)
{}

static LIST_HEAD(tt_thermal_zones);
static DEFINE_IDA(tt_thermal_zones_ida);
static DEFINE_MUTEX(tt_thermal_zones_lock);

static int tt_int_get(void *data, u64 *val)
{}
static int tt_int_set(void *data, u64 val)
{}
DEFINE_DEBUGFS_ATTRIBUTE_SIGNED();
DEFINE_DEBUGFS_ATTRIBUTE();

static int tt_zone_tz_temp_get(void *data, u64 *val)
{}
static int tt_zone_tz_temp_set(void *data, u64 val)
{}
DEFINE_DEBUGFS_ATTRIBUTE_SIGNED();

static void tt_zone_free_trips(struct tt_thermal_zone *tt_zone)
{}

static void tt_zone_free(struct tt_thermal_zone *tt_zone)
{}

static void tt_add_tz_work_fn(struct work_struct *work)
{}

int tt_add_tz(void)
{}

static void tt_del_tz_work_fn(struct work_struct *work)
{}

static void tt_zone_unregister_tz(struct tt_thermal_zone *tt_zone)
{}

int tt_del_tz(const char *arg)
{}

static struct tt_thermal_zone *tt_get_tt_zone(const char *arg)
{}

static void tt_put_tt_zone(struct tt_thermal_zone *tt_zone)
{}

static void tt_zone_add_trip_work_fn(struct work_struct *work)
{}

int tt_zone_add_trip(const char *arg)
{}

static int tt_zone_get_temp(struct thermal_zone_device *tz, int *temp)
{}

static struct thermal_zone_device_ops tt_zone_ops =;

static int tt_zone_register_tz(struct tt_thermal_zone *tt_zone)
{}

int tt_zone_reg(const char *arg)
{}

int tt_zone_unreg(const char *arg)
{}

void tt_zone_cleanup(void)
{}