1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * intel_soc_dts_iosf.h
4 * Copyright (c) 2015, Intel Corporation.
5 */
6
7#ifndef _INTEL_SOC_DTS_IOSF_CORE_H
8#define _INTEL_SOC_DTS_IOSF_CORE_H
9
10#include <linux/thermal.h>
11
12/* DTS0 and DTS 1 */
13#define SOC_MAX_DTS_SENSORS	2
14
15/* Only 2 out of 4 is allowed for OSPM */
16#define SOC_MAX_DTS_TRIPS	2
17
18enum intel_soc_dts_interrupt_type {
19	INTEL_SOC_DTS_INTERRUPT_NONE,
20	INTEL_SOC_DTS_INTERRUPT_APIC,
21	INTEL_SOC_DTS_INTERRUPT_MSI,
22	INTEL_SOC_DTS_INTERRUPT_SCI,
23	INTEL_SOC_DTS_INTERRUPT_SMI,
24};
25
26struct intel_soc_dts_sensors;
27
28struct intel_soc_dts_sensor_entry {
29	int id;
30	u32 store_status;
31	struct thermal_zone_device *tzone;
32	struct intel_soc_dts_sensors *sensors;
33};
34
35struct intel_soc_dts_sensors {
36	u32 tj_max;
37	spinlock_t intr_notify_lock;
38	struct mutex dts_update_lock;
39	enum intel_soc_dts_interrupt_type intr_type;
40	struct intel_soc_dts_sensor_entry soc_dts[SOC_MAX_DTS_SENSORS];
41};
42
43
44struct intel_soc_dts_sensors *
45intel_soc_dts_iosf_init(enum intel_soc_dts_interrupt_type intr_type,
46			bool critical_trip, int crit_offset);
47void intel_soc_dts_iosf_exit(struct intel_soc_dts_sensors *sensors);
48void intel_soc_dts_iosf_interrupt_handler(
49				struct intel_soc_dts_sensors *sensors);
50#endif
51