#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

if ARCH_BOARD_SPRESENSE

config CXD56_SPIFLASHSIZE
	hex
	default 0x400000
	depends on CXD56_SFC
	---help---
		Specify the SPI flash total available size for the application.
		This value is generally set half of SPI flash device capacity.

comment "Audio Options"

if AUDIO_CXD56 || CXD56_AUDIO

choice
	prompt "Audio I2S settings"
	default CXD56_I2S0

config CXD56_I2S0
	bool "I2S0"

config CXD56_I2S1
	bool "I2S1"
endchoice

menu "Audio baseband config settings"

choice
	prompt "Audio analog block selection"
	default CXD56_AUDIO_ANALOG_CXD5247

config CXD56_AUDIO_ANALOG_CXD5247
	bool "CXD5247"

config CXD56_AUDIO_ANALOG_NONE
	bool "System does not use audio analog block"
endchoice

if CXD56_AUDIO_ANALOG_CXD5247

menu "CXD5247 settings"
choice
	prompt "X'tal frequency of the CXD5247"
	default CXD56_AUDIO_XTAL_SEL_49_152MHZ

config CXD56_AUDIO_XTAL_SEL_24_576MHZ
	bool "24.576MHz"

config CXD56_AUDIO_XTAL_SEL_49_152MHZ
	bool "49.152MHz"
endchoice

choice
	prompt "MICBIAS voltage of the CXD5247"
	default CXD56_AUDIO_MICBIAS_20V

config CXD56_AUDIO_MICBIAS_20V
	bool "2.0V"

config CXD56_AUDIO_MICBIAS_28V
	bool "2.8V"
endchoice

config CXD56_AUDIO_MIC_CHANNEL_SEL
	hex "MIC channel select map"
	default 0xFFFF4321
	range 0 0xFFFFFFFF
	---help---
		This designates microphone input of the CXD5247 in matrix format.
		One microphone can be assigned to multiple channels (CHs.)
		(Example: When DMA transfer is performed in monaural mode,
		AMIC1 is assigned to CH1 and CH2 and the same audio data is
		transferred to the each channel)

choice
	prompt "Output drive strength of MCLKOUT selection"
	default CXD56_AUDIO_MCLKOUT_WEAKEST

config CXD56_AUDIO_MCLKOUT_WEAKEST
	bool "2mA"

config CXD56_AUDIO_MCLKOUT_WEAKER
	bool "4mA"

config CXD56_AUDIO_MCLKOUT_STRONGER
	bool "6mA"

config CXD56_AUDIO_MCLKOUT_STRONGEST
	bool "8mA"
endchoice

choice
	prompt "Output drive strength of CLKOUT_DMIC selection"
	default CXD56_AUDIO_CLKOUT_DMIC_WEAKEST

config CXD56_AUDIO_CLKOUT_DMIC_WEAKEST
	bool "2mA"

config CXD56_AUDIO_CLKOUT_DMIC_WEAKER
	bool "4mA"

config CXD56_AUDIO_CLKOUT_DMIC_STRONGER
	bool "6mA"

config CXD56_AUDIO_CLKOUT_DMIC_STRONGEST
	bool "8mA"
endchoice

choice
	prompt "Output drive strength of DA_DATA selection"
	default CXD56_AUDIO_DA_DATA_WEAKEST

config CXD56_AUDIO_DA_DATA_WEAKEST
	bool "2mA"

config CXD56_AUDIO_DA_DATA_WEAKER
	bool "4mA"

config CXD56_AUDIO_DA_DATA_STRONGER
	bool "6mA"

config CXD56_AUDIO_DA_DATA_STRONGEST
	bool "8mA"
endchoice

choice
	prompt "Output drive strength of GPO_A selection"
	default CXD56_AUDIO_GPO_A_WEAKEST

config CXD56_AUDIO_GPO_A_WEAKEST
	bool "2mA"

config CXD56_AUDIO_GPO_A_WEAKER
	bool "4mA"

config CXD56_AUDIO_GPO_A_STRONGER
	bool "6mA"

config CXD56_AUDIO_GPO_A_STRONGEST
	bool "8mA"
endchoice

choice
	prompt "Input source of Cascaded Integrator-Comb filter selection"
	default CXD56_AUDIO_CIC_IN_SEL_CXD

config CXD56_AUDIO_CIC_IN_SEL_CXD
	bool "from CXD5247"

config CXD56_AUDIO_CIC_IN_SEL_DMIC
	bool "from DMIC"

config CXD56_AUDIO_CIC_IN_SEL_NONE
	bool "No Cascaded Integrator-Comb filter input"
endchoice

choice
	prompt "Drive currents of PDM signals"
	default CXD56_AUDIO_PDM_LOWEMI_2MA

config CXD56_AUDIO_PDM_LOWEMI_2MA
	bool "2mA"

config CXD56_AUDIO_PDM_LOWEMI_4MA
	bool "4mA"
endchoice

choice
	prompt "HPADC mic bias selection"
	default CXD56_AUDIO_HPADC_MIC_BIAS_OFF
	---help---
		This setting depends on a circuit board configuration.
		Set "Microphone bias is enabled" when a microphone connected to
		HPADC should be applied with voltage from the CXD5247.
		Otherwise, set "Microphone bias is disabled".

config CXD56_AUDIO_HPADC_MIC_BIAS_ON
	bool "Microphone bias is enabled"

config CXD56_AUDIO_HPADC_MIC_BIAS_OFF
	bool "Microphone bias is disabled"
endchoice

choice
	prompt "Version of the CXD5247"
	default CXD56_CXD5247_VER_ES4

config CXD56_CXD5247_VER_ES2
	bool "ES Version 2.0"

config CXD56_CXD5247_VER_ES3
	bool "ES Version 3.0"

config CXD56_CXD5247_VER_ES4
	bool "ES Version 4.0"
endchoice

if CXD56_CXD5247_VER_ES4
choice
	prompt "Speaker time split on drive selection"
	default CXD56_AUDIO_SP_SPLIT_SHORTEST

config CXD56_AUDIO_SP_SPLIT_SHORTEST
	bool "shortest"

config CXD56_AUDIO_SP_SPLIT_SHORT
	bool "short"

config CXD56_AUDIO_SP_SPLIT_LONG
	bool "long"

config CXD56_AUDIO_SP_SPLIT_LONGEST
	bool "longest"
endchoice

choice
	prompt "Speaker drive mode selection"
	default CXD56_AUDIO_SP_DRV_LINEOUT

config CXD56_AUDIO_SP_DRV_4DRIVERT
	bool "4Driver(SPK)"

config CXD56_AUDIO_SP_DRV_2DRIVERT
	bool "2Driver"

config CXD56_AUDIO_SP_DRV_1DRIVERT
	bool "1Driver(HP)"

config CXD56_AUDIO_SP_DRV_LINEOUT
	bool "Lineout"
endchoice
endif # CXD56_CXD5247_VER_ES4
endmenu
endif # CXD56_AUDIO_ANALOG_CXD5247

menu "I2S settings"

if CXD56_I2S0
choice
	prompt "I2S0 device mode selection"
	default CXD56_AUDIO_I2S_DEVICE_1_SLAVE
	---help---
		This designates ports and clock modes that are connected
		as interfaces for PCM signal input and output.

config CXD56_AUDIO_I2S_DEVICE_1_SLAVE
	bool "I2S0 Slave mode"

config CXD56_AUDIO_I2S_DEVICE_1_MASTER
	bool "I2S0 Master mode"
endchoice

choice
	prompt "I2S0 format type selection"
	default CXD56_AUDIO_I2S_FORMAT_1_I2S
	---help---
		This designates the format of PCM signals on I2S.

config CXD56_AUDIO_I2S_FORMAT_1_I2S
	bool "I2S format"

config CXD56_AUDIO_I2S_FORMAT_1_LEFT
	bool "Left Justified format"
endchoice

choice
	prompt "I2S0 bypass mode selection"
	default CXD56_AUDIO_I2S_BYPASS_MODE_1_DISABLE
	---help---
		This designates the bypass mode of the sampling rate converter.
		To improve sound quality, set it to "Enable".
		The bypass mode can be enable when audio clk_mode is Hi-Res mode,
		and I2S device mode is master mode and rate is 192kHz(192000).

config CXD56_AUDIO_I2S_BYPASS_MODE_1_ENABLE
	bool "Enable bypass"

config CXD56_AUDIO_I2S_BYPASS_MODE_1_DISABLE
	bool "Disable bypass"
endchoice

config CXD56_AUDIO_I2S_RATE_1
	int "I2S0 data rate"
	default  48000
	range 48000 192000
	---help---
		This designates input and output data rate of I2S.
		The maximum rate is 192000.

endif # CXD56_I2S0

if CXD56_I2S1
choice
	prompt "I2S1 device mode selection"
	default CXD56_AUDIO_I2S_DEVICE_2_SLAVE
	---help---
		This designates ports and clock modes that are connected
		as interfaces for PCM signal input and output.

config CXD56_AUDIO_I2S_DEVICE_2_SLAVE
	bool "I2S1 Slave mode"

config CXD56_AUDIO_I2S_DEVICE_2_MASTER
	bool "I2S1 Master mode"
endchoice

choice
	prompt "I2S1 format type selection"
	default CXD56_AUDIO_I2S_FORMAT_2_I2S
	---help---
		This designates the format of PCM signals on I2S0.

config CXD56_AUDIO_I2S_FORMAT_2_I2S
	bool "I2S format"

config CXD56_AUDIO_I2S_FORMAT_2_LEFT
	bool "Left Justified format"
endchoice

choice
	prompt "I2S1 bypass mode selection"
	default CXD56_AUDIO_I2S_BYPASS_MODE_2_DISABLE
	---help---
		This designates the bypass mode of the sampling rate converter.
		To improve sound quality, set it to "Enable".
		The bypass mode can be enable when audio clk_mode is Hi-Res mode,
		and I2S device mode is master mode and rate is 192kHz(192000).

config CXD56_AUDIO_I2S_BYPASS_MODE_2_ENABLE
	bool "Enable bypass"

config CXD56_AUDIO_I2S_BYPASS_MODE_2_DISABLE
	bool "Disable bypass"
endchoice

config CXD56_AUDIO_I2S_RATE_2
	int "I2S1 data rate"
	default  48000
	range 48000 192000
	---help---
		This designates input and output data rate of I2S1.
		The maximum rate is 192000.

endif # CXD56_I2S1

choice
	prompt "Drive currents of I2S signals"
	default CXD56_AUDIO_I2S_LOWEMI_2MA

config CXD56_AUDIO_I2S_LOWEMI_2MA
	bool "2mA"

config CXD56_AUDIO_I2S_LOWEMI_4MA
	bool "4mA"
endchoice
endmenu

choice
	prompt "ON/OFF of Automatic Level Control/Sound Pressure Counter selection"
	default CXD56_AUDIO_ALC_SPC_SEL_OFF

config CXD56_AUDIO_ALC_SPC_SEL_OFF
	bool "All OFF"

config CXD56_AUDIO_ALC_SPC_SEL_ALC
	bool "Automatic Level Control ON"

config CXD56_AUDIO_ALC_SPC_SEL_SPC
	bool "Sound Pressure Counter ON"
endchoice

if CXD56_AUDIO_ALC_SPC_SEL_ALC
menu "Automatic Level Control setting"
config CXD56_AUDIO_ALC_KNEE
	int "Knee levels of Automatic Level Control.[(1/10)dB]"
	default -40
	range -635 0
	---help---
		This command sets integer values 10 times larger than knee levels of
		Automatic Level Control. (step width: 0.5 dB) When a value within the
		range in the table below with a number other than 0 or 5 in one's
		place is designated, it will be regarded as a integer value round up
		to zero or five in the one's place. For example, when "-24" is
		designated, the value will be regarded as "-20".

config CXD56_AUDIO_ALC_TARGET
	int "Target level of Automatic Level Control.[dB]"
	default 0
	range -63 0
endmenu
endif # CXD56_AUDIO_ALC_SPC_SEL_ALC

if CXD56_AUDIO_ALC_SPC_SEL_SPC
menu "Sound Pressure Conter setting"
config CXD56_AUDIO_SPC_LIMIT
	int "Limit levels of Sound Pressure Counter.[(1/10)dB]"
	default 0
	range -250 0
	---help---
		This command sets integer values 10 times larger than limit levels of
		Sound Pressure Counter. (step width: 0.5 dB) When a value within the
		range in the table below with a number other than 0 or 5 in one's
		place is designated, it will be regarded as a integer value round up
		to zero or five in the one's place. For example, when "-24" is
		designated, the value will be regarded as "-20".
endmenu
endif # CXD56_AUDIO_ALC_SPC_SEL_SPC

choice
	prompt "LR data format during DMA transfer"
	default CXD56_AUDIO_DMA_DATA_FORMAT_RL
	---help---
		This sets the data arrangement of left channel and right channel in
		the data format for 16 bit DMA transfer.

config CXD56_AUDIO_DMA_DATA_FORMAT_LR
	bool "allocate left channel data in most significant bit"

config CXD56_AUDIO_DMA_DATA_FORMAT_RL
	bool "allocate right channel data in most significant bit"
endchoice

config CXD56_AUDIO_MIC_BOOT_WAIT
	int "Wait time for mic booting.[msec]"
	default 1100
	range 0 65535

endmenu
endif # Spresense Audio

config CXD56_IMAGEPROC
	bool "Spresense Image Processor"
	default n
	select CXD56_GE2D
	---help---
		Enable support for accelerated format converter, rotation and so on.
		using the CXD5602 image processing accelerator.

config SPRESENSE_EXTENSION
	bool "Extension board"
	default n
	select CXD56_CUSTOM_PINCONFIG
	---help---
		Indicates to the configuration that an SPresense extension board is
		present.  If there is no extension board attached, the SPresense
		may run in a low-power mode by default (as determined by the
		CONFIG_CXD56_CUSTOM_PINCONFIG option).  If an extension board is
		present, then the SPresense will need to run at a higher power mode,
		selected by this option.

if  SPRESENSE_EXTENSION
config SDCARD_TXS02612
	bool "SD Card TXS02612 port expander with voltage level translation"
	default y
	---help---
		Enable TXS02612 Dual Voltage Level Translator for SD-Card interface.
		This device is used in SPD-003C board.

if SDCARD_TXS02612

choice
	prompt "TXS02612 port"
	default SDCARD_TXS02612_PORT0

config SDCARD_TXS02612_PORT0
	bool "Port 0"

config SDCARD_TXS02612_PORT1
	bool "Port 1"

endchoice # "TXS02612 port"

endif # SDCARD_TXS02612
endif # SPRESENSE_EXTENSION

if LCD

choice
	prompt "LCD SPI connection"
	default LCD_ON_EXTENSION_BOARD

config LCD_ON_EXTENSION_BOARD
	bool "Extension board: SPI4"
	select CXD56_SPI4
	select CXD56_DMAC_SPI4_TX
	select CXD56_DMAC_SPI4_RX
	---help---
		Display connected to extension board.

config LCD_ON_MAIN_BOARD
	bool "Main board: SPI5"
	select CXD56_SPI5
	select CXD56_DMAC_SPI5_TX
	select CXD56_DMAC_SPI5_RX
	---help---
		Display connected to main board.

endchoice
endif
comment "LTE Options"

menuconfig CXD56_LTE
        bool "LTE"
        default n

if CXD56_LTE

choice
        prompt "LTE SPI selection"
        default CXD56_LTE_SPI4

config CXD56_LTE_SPI4
        bool "Use SPI4"
        select CXD56_SPI4

config CXD56_LTE_SPI5
        bool "Use SPI5"
        select CXD56_SPI5
endchoice

if CXD56_LTE_SPI4

config CXD56_LTE_SPI4_DMAC
        bool "Use DMAC for SPI4"
        default y
        select CXD56_DMAC_SPI4_TX
        select CXD56_DMAC_SPI4_RX

endif # CXD56_LTE_SPI4

if CXD56_LTE_SPI5

config CXD56_LTE_SPI5_DMAC
        bool "Use DMAC for SPI5"
        default y
        select CXD56_DMAC_SPI5_TX
        select CXD56_DMAC_SPI5_RX

endif # CXD56_LTE_SPI4

endif # CXD56_LTE

config CXD56_BINARY
	bool "spk binary format"
	default n
	---help---
		Create nuttx.spk binary format used on spresense board and boards
		based on cxd56xx arch.

endif
