# Kconfig - ADT7420 temperature sensor configuration options
#
# Copyright (c) 2018 Analog Devices Inc.
#
# SPDX-License-Identifier: Apache-2.0
#

menuconfig ADT7420
	bool "ADT7420 Temperature Sensor"
	depends on I2C
	help
	  Enable the driver for Analog Devices ADT7420 High-Accuracy
	  16-bit Digital I2C Temperature Sensors.

if ADT7420

if !HAS_DTS_I2C_DEVICE

config ADT7420_NAME
	string "Driver name"
	default "ADT7420"
	help
	  Device name with which the ADT7420 sensor is identified.

config ADT7420_I2C_ADDR
	hex "I2C address for ADT7420"
	default 0x48
	help
	  I2C address of the ADT7420 sensor.

	  0x48: A0 connected GND and A1 connected to GND.
	  0x49: A0 connected VDD and A1 connected to GND.
	  0x4A: A0 connected GND and A1 connected to VDD.
	  0x4B: A0 connected VDD and A1 connected to VDD.

config ADT7420_I2C_MASTER_DEV_NAME
	string "I2C master where ADT7420 is connected"
	default "I2C_0"
	help
	  Specify the device name of the I2C master device to which the
	  ADT7420 chip is connected.

endif # !HAS_DTS_I2C_DEVICE

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
	default 147
	help
	  The critical overtemperature pin asserts when the temperature
	  exceeds this value. The default value of 147 is the reset default
	  of the ADT7420.

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
	select ADT7420_TRIGGER

config ADT7420_TRIGGER_OWN_THREAD
	bool "Use own thread"
	depends on GPIO
	select ADT7420_TRIGGER

endchoice

config ADT7420_TRIGGER
	bool

if !HAS_DTS_GPIO_DEVICE

config ADT7420_GPIO_DEV_NAME
	string "GPIO device"
	default "GPIO_0"
	depends on ADT7420_TRIGGER
	help
	  The GPIO device's name where the ADT7420 interrupt (alert) pin is
	  connected.

config ADT7420_GPIO_PIN_NUM
	int "Interrupt GPIO pin number"
	default 0
	depends on ADT7420_TRIGGER
	help
	  The GPIO pin number receiving the interrupt signal from the
	  ADT7420 sensor.

endif # !HAS_DTS_GPIO_DEVICE

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
