linux/drivers/thermal/intel/int340x_thermal/processor_thermal_power_floor.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Processor thermal device module for registering and processing
 * power floor. When the hardware reduces the power to the minimum
 * possible, the power floor is notified via an interrupt.
 *
 * Operation:
 * When user space enables power floor reporting:
 * - Use mailbox to:
 *	Enable processor thermal device interrupt
 *
 * - Current status of power floor is read from offset 0x5B18
 *   bit 39.
 *
 * Two interface functions are provided to call when there is a
 * thermal device interrupt:
 * - proc_thermal_power_floor_intr():
 *	Check if the interrupt is for change in power floor.
 *	Called from interrupt context.
 *
 * - proc_thermal_power_floor_intr_callback():
 *	Callback for interrupt processing in thread context. This involves
 *	sending notification to user space that there is a change in the
 *	power floor status.
 *
 * Copyright (c) 2023, Intel Corporation.
 */

#include <linux/pci.h>
#include "processor_thermal_device.h"

#define SOC_POWER_FLOOR_STATUS
#define SOC_POWER_FLOOR_SHIFT

#define SOC_POWER_FLOOR_INT_ENABLE_BIT
#define SOC_POWER_FLOOR_INT_ACTIVE

int proc_thermal_read_power_floor_status(struct proc_thermal_device *proc_priv)
{}
EXPORT_SYMBOL_NS_GPL();

static bool enable_state;
static DEFINE_MUTEX(pf_lock);

int proc_thermal_power_floor_set_state(struct proc_thermal_device *proc_priv, bool enable)
{}
EXPORT_SYMBOL_NS_GPL();

bool proc_thermal_power_floor_get_state(struct proc_thermal_device *proc_priv)
{}
EXPORT_SYMBOL_NS_GPL();

/**
 * proc_thermal_check_power_floor_intr() - Check power floor interrupt.
 * @proc_priv: Processor thermal device instance.
 *
 * Callback to check if the interrupt for power floor is active.
 *
 * Context: Called from interrupt context.
 *
 * Return: true if power floor is active, false when not active.
 */
bool proc_thermal_check_power_floor_intr(struct proc_thermal_device *proc_priv)
{}
EXPORT_SYMBOL_NS_GPL();

/**
 * proc_thermal_power_floor_intr_callback() - Process power floor notification
 * @pdev:	PCI device instance
 * @proc_priv: Processor thermal device instance.
 *
 * Check if the power floor interrupt is active, if active send notification to
 * user space for the attribute "power_limits", so that user can read the attribute
 * and take action.
 *
 * Context: Called from interrupt thread context.
 *
 * Return: None.
 */
void proc_thermal_power_floor_intr_callback(struct pci_dev *pdev,
					    struct proc_thermal_device *proc_priv)
{}
EXPORT_SYMBOL_NS_GPL();

MODULE_IMPORT_NS();
MODULE_LICENSE();
MODULE_DESCRIPTION();