zephyr/drivers/i2c/Kconfig
Ulf Magnusson ec3eff57e0 Kconfig: Use the first default with a satisfied condition
Up until now, Zephyr has patched Kconfig to use the last 'default' with
a satisfied condition, instead of the first one. I'm not sure why the
patch was added (it predates Kconfiglib), but I suspect it's related to
Kconfig.defconfig files.

There are at least three problems with the patch:

  1. It's inconsistent with how Kconfig works in other projects, which
     might confuse newcomers.

  2. Due to oversights, earlier 'range' properties are still preferred,
     as well as earlier 'default' properties on choices.

     In addition to being inconsistent, this makes it impossible to
     override 'range' properties and choice 'default' properties if the
     base definition of the symbol/choice already has 'range'/'default'
     properties.

     I've seen errors caused by the inconsistency, and I suspect there
     are more.

  3. A fork of Kconfiglib that adds the patch needs to be maintained.

Get rid of the patch and go back to standard Kconfig behavior, as
follows:

  1. Include the Kconfig.defconfig files first instead of last in
     Kconfig.zephyr.

  2. Include boards/Kconfig and arch/<arch>/Kconfig first instead of
     last in arch/Kconfig.

  3. Include arch/<arch>/soc/*/Kconfig first instead of last in
     arch/<arch>/Kconfig.

  4. Swap a few other 'source's to preserve behavior for some scattered
     symbols with multiple definitions.

     Swap 'source's in some no-op cases too, where it might match the
     intent.

  5. Reverse the defaults on symbol definitions that have more than one
     default.

     Skip defaults that are mutually exclusive, e.g. where each default
     has an 'if <some board>' condition. They are already safe.

  6. Remove the prefer-later-defaults patch from Kconfiglib.

Testing was done with a Python script that lists all Kconfig
symbols/choices with multiple defaults, along with a whitelist of fixed
symbols. The script also verifies that there are no "unreachable"
defaults hidden by defaults without conditions

As an additional test, zephyr/.config was generated before and after the
change for several samples and checked to be identical (after sorting).

This commit includes some default-related cleanups as well:

  - Simplify some symbol definitions, e.g. where a default has 'if FOO'
    when the symbol already has 'depends on FOO'.

  - Remove some redundant 'default ""' for string symbols. This is the
    implicit default.

Piggyback fixes for swapped ranges on BT_L2CAP_RX_MTU and
BT_L2CAP_TX_MTU (caused by confusing inconsistency).

Piggyback some fixes for style nits too, e.g. unindented help texts.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-10 12:38:28 -07:00

308 lines
8.0 KiB
Plaintext

# Kconfig - I2C configuration options
#
# Copyright (c) 2015 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
#
# I2C options
#
menuconfig I2C
bool "I2C Drivers"
help
Enable I2C Driver Configuration
if I2C
# Include these first so that any properties (e.g. defaults) below can be
# overriden (by defining symbols in multiple locations)
source "drivers/i2c/Kconfig.dw"
source "drivers/i2c/Kconfig.esp32"
source "drivers/i2c/slave/Kconfig"
source "drivers/i2c/Kconfig.gpio"
source "drivers/i2c/Kconfig.nrfx"
source "drivers/i2c/Kconfig.qmsi"
source "drivers/i2c/Kconfig.sbcon"
source "drivers/i2c/Kconfig.stm32"
config I2C_INIT_PRIORITY
int "Init priority"
default 60
help
I2C device driver initialization priority.
config SYS_LOG_I2C_LEVEL
int "I2C log level"
depends on SYS_LOG
default 0
help
Sets log level for I2C drivers.
Levels are:
- 0 OFF, do not write
- 1 ERROR, only write SYS_LOG_ERR
- 2 WARNING, write SYS_LOG_WRN in addition to previous level
- 3 INFO, write SYS_LOG_INF in addition to previous levels
- 4 DEBUG, write SYS_LOG_DBG in addition to previous levels
config I2C_0
bool "Enable I2C Port 0"
config I2C_0_NAME
string "Port 0 device name"
depends on I2C_0 && !HAS_DTS_I2C
default "I2C_0"
config I2C_0_DEFAULT_CFG
hex "Port 0 default configuration"
depends on I2C_0 && !HAS_DTS_I2C
default 0x0
help
Allows the I2C port to be brought up with a default configuration.
This is useful to set if other drivers depend upon using the I2C bus
before the application has a chance to custom configure the port.
Setting this value does not prohibit the application from customizing
the values later. Refer to include/i2c.h file for proper values.
config I2C_0_IRQ_PRI
int "Port 0 interrupt priority"
depends on I2C_0 && !HAS_DTS_I2C
help
IRQ priority.
config I2C_1
bool "Enable I2C Port 1"
config I2C_1_NAME
string "Port 1 device name"
default "I2C_1"
depends on I2C_1 && !HAS_DTS_I2C
config I2C_1_DEFAULT_CFG
hex "Port 1 default configuration"
depends on I2C_1 && !HAS_DTS_I2C
default 0x0
help
Allows the I2C port to be brought up with a default configuration.
This is useful to set if other drivers depend upon using the I2C bus
before the application has a chance to custom configure the port.
Setting this value does not prohibit the application from customizing
the values later. Refer to include/i2c.h file for proper values.
config I2C_1_IRQ_PRI
int "Port 1 interrupt priority"
depends on I2C_1 && !HAS_DTS_I2C
help
IRQ priority.
config I2C_2
bool "Enable I2C Port 2"
config I2C_2_NAME
string "Port 2 device name"
default "I2C_2"
depends on I2C_2 && !HAS_DTS_I2C
config I2C_2_DEFAULT_CFG
hex "Port 2 default configuration"
depends on I2C_2 && !HAS_DTS_I2C
default 0x0
help
Allows the I2C port to be brought up with a default configuration.
This is useful to set if other drivers depend upon using the I2C bus
before the application has a chance to custom configure the port.
Setting this value does not prohibit the application from customizing
the values later. Refer to include/i2c.h file for proper values.
config I2C_2_IRQ_PRI
int "Port 2 interrupt priority"
depends on I2C_2 && !HAS_DTS_I2C
help
IRQ priority.
config I2C_3
bool "Enable I2C Port 3"
config I2C_3_NAME
string "Port 3 device name"
depends on I2C_3 && !HAS_DTS_I2C
default "I2C_3"
config I2C_3_DEFAULT_CFG
hex "Port 3 default configuration"
depends on I2C_3 && !HAS_DTS_I2C
default 0x0
help
Allows the I2C port to be brought up with a default configuration.
This is useful to set if other drivers depend upon using the I2C bus
before the application has a chance to custom configure the port.
Setting this value does not prohibit the application from customizing
the values later. Refer to include/i2c.h file for proper values.
config I2C_3_IRQ_PRI
int "Port 3 interrupt priority"
depends on I2C_3 && !HAS_DTS_I2C
help
IRQ priority.
config I2C_4
bool "Enable I2C Port 4"
config I2C_4_NAME
string "Port 4 device name"
depends on I2C_4 && !HAS_DTS_I2C
default "I2C_4"
config I2C_4_DEFAULT_CFG
hex "Port 4 default configuration"
depends on I2C_4 && !HAS_DTS_I2C
default 0x0
help
Allows the I2C port to be brought up with a default configuration.
This is useful to set if other drivers depend upon using the I2C bus
before the application has a chance to custom configure the port.
Setting this value does not prohibit the application from customizing
the values later. Refer to include/i2c.h file for proper values.
config I2C_4_IRQ_PRI
int "Port 4 interrupt priority"
depends on I2C_4 && !HAS_DTS_I2C
help
IRQ priority.
config I2C_5
bool "Enable I2C Port 5"
config I2C_5_NAME
string "Port 5 device name"
depends on I2C_5 && !HAS_DTS_I2C
default "I2C_5"
config I2C_5_DEFAULT_CFG
hex "Port 5 default configuration"
depends on I2C_5 && !HAS_DTS_I2C
default 0x0
help
Allows the I2C port to be brought up with a default configuration.
This is useful to set if other drivers depend upon using the I2C bus
before the application has a chance to custom configure the port.
Setting this value does not prohibit the application from customizing
the values later. Refer to include/i2c.h file for proper values.
config I2C_5_IRQ_PRI
int "Port 5 interrupt priority"
depends on I2C_5 && !HAS_DTS_I2C
help
IRQ priority.
config I2C_6
bool "Enable I2C Port 6"
config I2C_6_NAME
string "Port 6 device name"
depends on I2C_6 && !HAS_DTS_I2C
default "I2C_6"
config I2C_6_DEFAULT_CFG
hex "Port 6 default configuration"
depends on I2C_6 && !HAS_DTS_I2C
default 0x0
help
Allows the I2C port to be brought up with a default configuration.
This is useful to set if other drivers depend upon using the I2C bus
before the application has a chance to custom configure the port.
Setting this value does not prohibit the application from customizing
the values later. Refer to include/i2c.h file for proper values.
config I2C_6_IRQ_PRI
int "Port 6 interrupt priority"
depends on I2C_6 && !HAS_DTS_I2C
help
IRQ priority.
config I2C_7
bool "Enable I2C Port 7"
config I2C_7_NAME
string "Port 7 device name"
depends on I2C_7 && !HAS_DTS_I2C
default "I2C_7"
config I2C_7_DEFAULT_CFG
hex "Port 7 default configuration"
depends on I2C_7 && !HAS_DTS_I2C
default 0x0
help
Allows the I2C port to be brought up with a default configuration.
This is useful to set if other drivers depend upon using the I2C bus
before the application has a chance to custom configure the port.
Setting this value does not prohibit the application from customizing
the values later. Refer to include/i2c.h file for proper values.
config I2C_7_IRQ_PRI
int "Port 7 interrupt priority"
depends on I2C_7 && !HAS_DTS_I2C
help
IRQ priority.
config I2C_ATMEL_SAM3
bool "[deprecated] Atmel SAM3X I2C Driver"
depends on SOC_SERIES_SAM3X
help
This driver is deprecated and will be removed. Use
"Atmel SAM (TWI) I2C driver" instead.
Enable I2C support on the Atmel SAM3 family processor.
Says y to enable additional options to enable support
for individual controllers.
config I2C_SAM_TWIHS
bool "Atmel SAM (TWIHS) I2C driver"
depends on SOC_FAMILY_SAM
select HAS_DTS_I2C
help
Enable Atmel SAM MCU Family (TWIHS) I2C bus driver.
config I2C_SAM_TWI
bool "Atmel SAM (TWI) I2C driver"
depends on SOC_FAMILY_SAM
select HAS_DTS_I2C
help
Enable Atmel SAM MCU Family (TWI) I2C bus driver.
config I2C_MCUX
bool "MCUX I2C driver"
depends on HAS_MCUX
select HAS_DTS_I2C
help
Enable the mcux I2C driver.
config I2C_IMX
bool "i.MX I2C driver"
depends on HAS_IMX_I2C
select HAS_DTS_I2C
help
Enable the i.MX I2C driver.
config I2C_CC32XX
bool "CC32XX I2C driver"
depends on SOC_SERIES_CC32XX
select HAS_DTS_I2C
help
Enable the CC32XX I2C driver.
config I2C_BITBANG
bool
help
Enable library used for software driven (bit banging) I2C support
config I2C_NIOS2
bool "Nios-II I2C driver"
depends on HAS_ALTERA_HAL
help
Enable the Nios-II I2C driver.
endif # I2C