Commit bf3608f3 authored by Iwona Winiarska's avatar Iwona Winiarska Committed by Greg Kroah-Hartman

hwmon: peci: Add cputemp driver

Add peci-cputemp driver for Digital Thermal Sensor (DTS) thermal
readings of the processor package and processor cores that are
accessible via the PECI interface.

The main use case for the driver (and PECI interface) is out-of-band
management, where we're able to obtain the DTS readings from an external
entity connected with PECI, e.g. BMC on server platforms.
Co-developed-by: default avatarJae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: default avatarGuenter Roeck <linux@roeck-us.net>
Acked-by: default avatarJoel Stanley <joel@jms.id.au>
Signed-off-by: default avatarJae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
Signed-off-by: default avatarIwona Winiarska <iwona.winiarska@intel.com>
Link: https://lore.kernel.org/r/20220208153639.255278-11-iwona.winiarska@intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 93e1821c
...@@ -15104,6 +15104,12 @@ L: platform-driver-x86@vger.kernel.org ...@@ -15104,6 +15104,12 @@ L: platform-driver-x86@vger.kernel.org
S: Maintained S: Maintained
F: drivers/platform/x86/peaq-wmi.c F: drivers/platform/x86/peaq-wmi.c
PECI HARDWARE MONITORING DRIVERS
M: Iwona Winiarska <iwona.winiarska@intel.com>
L: linux-hwmon@vger.kernel.org
S: Supported
F: drivers/hwmon/peci/
PECI SUBSYSTEM PECI SUBSYSTEM
M: Iwona Winiarska <iwona.winiarska@intel.com> M: Iwona Winiarska <iwona.winiarska@intel.com>
L: openbmc@lists.ozlabs.org (moderated for non-subscribers) L: openbmc@lists.ozlabs.org (moderated for non-subscribers)
......
...@@ -1538,6 +1538,8 @@ config SENSORS_PCF8591 ...@@ -1538,6 +1538,8 @@ config SENSORS_PCF8591
These devices are hard to detect and rarely found on mainstream These devices are hard to detect and rarely found on mainstream
hardware. If unsure, say N. hardware. If unsure, say N.
source "drivers/hwmon/peci/Kconfig"
source "drivers/hwmon/pmbus/Kconfig" source "drivers/hwmon/pmbus/Kconfig"
config SENSORS_PWM_FAN config SENSORS_PWM_FAN
......
...@@ -208,6 +208,7 @@ obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o ...@@ -208,6 +208,7 @@ obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o
obj-$(CONFIG_SENSORS_XGENE) += xgene-hwmon.o obj-$(CONFIG_SENSORS_XGENE) += xgene-hwmon.o
obj-$(CONFIG_SENSORS_OCC) += occ/ obj-$(CONFIG_SENSORS_OCC) += occ/
obj-$(CONFIG_SENSORS_PECI) += peci/
obj-$(CONFIG_PMBUS) += pmbus/ obj-$(CONFIG_PMBUS) += pmbus/
ccflags-$(CONFIG_HWMON_DEBUG_CHIP) := -DDEBUG ccflags-$(CONFIG_HWMON_DEBUG_CHIP) := -DDEBUG
......
# SPDX-License-Identifier: GPL-2.0-only
config SENSORS_PECI_CPUTEMP
tristate "PECI CPU temperature monitoring client"
depends on PECI
select SENSORS_PECI
select PECI_CPU
help
If you say yes here you get support for the generic Intel PECI
cputemp driver which provides Digital Thermal Sensor (DTS) thermal
readings of the CPU package and CPU cores that are accessible via
the processor PECI interface.
This driver can also be built as a module. If so, the module
will be called peci-cputemp.
config SENSORS_PECI
tristate
# SPDX-License-Identifier: GPL-2.0-only
peci-cputemp-y := cputemp.o
obj-$(CONFIG_SENSORS_PECI_CPUTEMP) += peci-cputemp.o
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2021 Intel Corporation */
#include <linux/mutex.h>
#include <linux/types.h>
#ifndef __PECI_HWMON_COMMON_H
#define __PECI_HWMON_COMMON_H
#define PECI_HWMON_UPDATE_INTERVAL HZ
/**
* struct peci_sensor_state - PECI state information
* @valid: flag to indicate the sensor value is valid
* @last_updated: time of the last update in jiffies
* @lock: mutex to protect sensor access
*/
struct peci_sensor_state {
bool valid;
unsigned long last_updated;
struct mutex lock; /* protect sensor access */
};
/**
* struct peci_sensor_data - PECI sensor information
* @value: sensor value in milli units
* @state: sensor update state
*/
struct peci_sensor_data {
s32 value;
struct peci_sensor_state state;
};
/**
* peci_sensor_need_update() - check whether sensor update is needed or not
* @sensor: pointer to sensor data struct
*
* Return: true if update is needed, false if not.
*/
static inline bool peci_sensor_need_update(struct peci_sensor_state *state)
{
return !state->valid ||
time_after(jiffies, state->last_updated + PECI_HWMON_UPDATE_INTERVAL);
}
/**
* peci_sensor_mark_updated() - mark the sensor is updated
* @sensor: pointer to sensor data struct
*/
static inline void peci_sensor_mark_updated(struct peci_sensor_state *state)
{
state->valid = true;
state->last_updated = jiffies;
}
#endif /* __PECI_HWMON_COMMON_H */
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment