#ifndef _VERSAL_SYSMON_H_
#define _VERSAL_SYSMON_H_
#include <linux/bits.h>
#include <linux/mutex.h>
#include <linux/spinlock_types.h>
#include <linux/workqueue.h>
struct device;
struct regmap;
#define SYSMON_NPI_LOCK 0x000C
#define SYSMON_ISR 0x0044
#define SYSMON_IMR 0x0048
#define SYSMON_IER 0x004C
#define SYSMON_IDR 0x0050
#define SYSMON_CONFIG 0x0100
#define SYSMON_TEMP_MAX 0x1030
#define SYSMON_TEMP_MIN 0x1034
#define SYSMON_SUPPLY_BASE 0x1040
#define SYSMON_ALARM_FLAG 0x1018
#define SYSMON_ALARM_REG 0x1940
#define SYSMON_SUPPLY_EN_AVG_BASE 0x1958
#define SYSMON_TEMP_TH_LOW 0x1970
#define SYSMON_TEMP_TH_UP 0x1974
#define SYSMON_SUPPLY_TH_LOW 0x1980
#define SYSMON_SUPPLY_TH_UP 0x1C80
#define SYSMON_TEMP_EV_CFG 0x1F84
#define SYSMON_TEMP_MIN_MIN 0x1F8C
#define SYSMON_TEMP_MAX_MAX 0x1F90
#define SYSMON_STATUS_RESET 0x1F94
#define SYSMON_TEMP_SAT_BASE 0x1FAC
#define SYSMON_TEMP_EN_AVG_BASE 0x24B4
#define SYSMON_MAX_REG 0x24C0
#define SYSMON_NPI_UNLOCK_CODE 0xF9E8D7C6
#define SYSMON_REG_STRIDE 4
#define SYSMON_SUPPLY_IDX_MAX 159
#define SYSMON_TEMP_SAT_MAX 64
#define SYSMON_NO_OF_EVENTS 32
#define SYSMON_INTR_ALL_MASK GENMASK(31, 0)
#define SYSMON_TEMP_INTR_MASK BIT(9)
#define SYSMON_CONFIG_SUPPLY_OSR GENMASK(17, 14)
#define SYSMON_CONFIG_TEMP_SAT_OSR GENMASK(27, 24)
#define SYSMON_SUPPLY_EN_AVG_COUNT 5
#define SYSMON_TEMP_EN_AVG_COUNT 2
#define SYSMON_MANTISSA_MASK GENMASK(15, 0)
#define SYSMON_FMT_MASK BIT(16)
#define SYSMON_MODE_MASK GENMASK(18, 17)
#define SYSMON_FRACTIONAL_SHIFT 7U
#define SYSMON_SUPPLY_MANTISSA_BITS 16
#define SYSMON_ALARM_BITS_PER_REG 32
#define SYSMON_UNMASK_WORK_DELAY_MS 500
struct sysmon {
struct regmap *regmap;
struct mutex lock;
spinlock_t irq_lock;
unsigned int masked_temp;
unsigned int temp_mask;
int temp_hysteresis;
struct delayed_work sysmon_unmask_work;
unsigned int temp_oversampling;
unsigned int supply_oversampling;
};
int devm_versal_sysmon_core_probe(struct device *dev, struct regmap *regmap);
#endif /* _VERSAL_SYSMON_H_ */