# ADT7420 temperature sensor configuration options

# Copyright (c) 2018, 2026 Analog Devices Inc.
# SPDX-License-Identifier: Apache-2.0

menuconfig ADT7420
	bool "ADT7420 Temperature Sensor"
	default y
	depends on DT_HAS_ADI_ADT7420_ENABLED || DT_HAS_ADI_ADT7410_ENABLED || \
			DT_HAS_ADI_ADT7422_ENABLED
	select I2C
	help
	  Enable the driver for Analog Devices ADT7420 High-Accuracy
	  16-bit Digital I2C Temperature Sensors.

if ADT7420

config ADT7420_TEMP_HYST
	int "Temperature hysteresis in °C"
	range 0 15
	default 5
	help
	  Specify the temperature hysteresis in °C for the THIGH, TLOW,
	  and TCRIT temperature limits.

config ADT7420_TEMP_CRIT
	int "Critical overtemperature in °C"
	range -40 150 if $(dt_compat_enabled,$(DT_COMPAT_ADI_ADT7420))
	range -55 150 if $(dt_compat_enabled,$(DT_COMPAT_ADI_ADT7410))
	range -40 125 if $(dt_compat_enabled,$(DT_COMPAT_ADI_ADT7422))
	default 147 if $(dt_compat_enabled,$(DT_COMPAT_ADI_ADT7410)) || \
				$(dt_compat_enabled,$(DT_COMPAT_ADI_ADT7420))
	default 125 if $(dt_compat_enabled,$(DT_COMPAT_ADI_ADT7422))

	help
	  The critical overtemperature pin asserts when the temperature
	  exceeds this value.

choice
	prompt "Trigger mode"
	default ADT7420_TRIGGER_NONE
	help
	  Specify the type of triggering used by the driver.

config ADT7420_TRIGGER_NONE
	bool "No trigger"

config ADT7420_TRIGGER_GLOBAL_THREAD
	bool "Use global thread"
	depends on GPIO
	depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ADI_ADT7420),int-gpios)
	select ADT7420_TRIGGER

config ADT7420_TRIGGER_OWN_THREAD
	bool "Use own thread"
	depends on GPIO
	depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ADI_ADT7420),int-gpios)
	select ADT7420_TRIGGER

endchoice

config ADT7420_TRIGGER
	bool

config ADT7420_THREAD_PRIORITY
	int "Thread priority"
	depends on ADT7420_TRIGGER_OWN_THREAD && ADT7420_TRIGGER
	default 10
	help
	  Priority of thread used by the driver to handle interrupts.

config ADT7420_THREAD_STACK_SIZE
	int "Thread stack size"
	depends on ADT7420_TRIGGER_OWN_THREAD && ADT7420_TRIGGER
	default 1024
	help
	  Stack size of thread used by the driver to handle interrupts.

endif # ADT7420
