#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: Apache-2.0
#

menuconfig NRF70_BUSLIB
	bool "NRF70 Bus Library"
	help
	  Enable the NRF70 Bus Library for the nRF7002 Wi-Fi shield.

if NRF70_BUSLIB

config NRF70_ON_QSPI
	def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF7002_QSPI)) ||\
			 $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF7001_QSPI)) ||\
			 $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF7000_QSPI))
	select NRFX_QSPI

config NRF70_ON_SPI
	def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF7002_SPI)) ||\
			 $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF7001_SPI)) ||\
			 $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF7000_SPI))
	select SPI

config NRF70_SUPPLY_GPIO
	def_bool $(dt_nodelabel_has_prop,nrf70,supply-gpios)
	help
	  Selected when the nRF70 supply rail is switched by a GPIO.

config NRF70_VIN_SUPPLY
	def_bool $(dt_nodelabel_has_prop,nrf70,vin-supply)
	select REGULATOR
	help
	  Selected when the nRF70 supply rail is fed from a regulator, so that
	  the regulator API the driver calls is built.

config NRF70_SUPPLY
	def_bool NRF70_SUPPLY_GPIO || NRF70_VIN_SUPPLY
	help
	  Selected when this driver switches the nRF70 supply rail, by either
	  method.

config NRF70_IOVDD_REGULATOR
	def_bool $(dt_nodelabel_has_prop,nrf70,iovdd-regulator)
	select REGULATOR
	help
	  Selected when IOVDD is fed from a regulator instead of a dedicated
	  GPIO, so that the regulator API the driver calls is built.

module = WIFI_NRF70_BUSLIB
module-dep = LOG
module-str = Log level for Wi-Fi nRF70 bus library
source "subsys/logging/Kconfig.template.log_config"

config WIFI_NRF70_BUSLIB_LOG_LEVEL
	# Enable error by default
	default 1

config NRF70_LOG_VERBOSE
	bool "Maintains the verbosity of information in logs"
	default y

config NRF70_SPI_PM_CLAIM_WHILE_ACTIVE
	bool "Keep SPI bus in ACTIVE state while nRF70 is powered"
	depends on PM_DEVICE_RUNTIME
	depends on NRF70_ON_SPI
	help
	  Requesting and releasing the SPI bus on every bus transaction when PM
	  device runtime is enabled has a negative impact on data throughput.
	  Enabling this option keeps the bus in the active state while the interface
	  is powered up.

endif # NRF70_BUSLIB
