Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce reworked API for ADC drivers #7691

Merged
merged 21 commits into from
Aug 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
18c1554
dts: nrf: Add ADC nodes and bindings for nRF SoCs
anangl Jun 28, 2018
54a10cf
boards: nrf: Enable ADC nodes in DTS for nRF boards
anangl Jun 28, 2018
5f23ec2
drivers: adc: Introduce reworked API
anangl May 21, 2018
23135a2
drivers: adc: Add shims for nrfx ADC and SAADC drivers
anangl May 21, 2018
4fffbf7
tests: adc_api: Add configurations for nRF5 boards
anangl Jun 29, 2018
174940a
drivers: adc: Select HAS_DTS_ADC for all ADC drivers
anangl Jul 11, 2018
ab926d6
adc: Convert mcux adc16 driver to the new adc api
MaureenHelm Aug 6, 2018
c371d6d
tests: adc_api: Add support for kinetis boards
MaureenHelm Aug 6, 2018
b465ef3
sam: adc: Updated SAM ADC driver.
fallrisk Aug 15, 2018
d623676
drivers: Use Designware driver for sensor subsystem
punitvara Aug 17, 2018
c0f499b
dts: arc: Use dts tree for designware driver
punitvara Aug 17, 2018
49d26d7
boards: quark_se_c1000_ss_devboard: Enable ADC node
punitvara Aug 24, 2018
0c35d44
drivers: adc: Update new ADC APIs
punitvara Aug 17, 2018
f211236
drivers: Kconfig.dw: Remove unnecessary Kconfig
punitvara Aug 24, 2018
9c4852a
drivers: grove: Modify light sensor
punitvara Aug 14, 2018
21f2efc
drivers: grove: Update temperature driver
punitvara Aug 15, 2018
92dc94e
tests: adc_api: Add ARC related parameters for ADC
punitvara Aug 24, 2018
735b709
samples: grove_light: Provide device name from Kconfig
punitvara Aug 25, 2018
6766f3f
samples: grove_temperature: Use device name from Kconfig
punitvara Aug 25, 2018
642e234
boards: quark_d2000_crb: Remove adc support
punitvara Aug 26, 2018
47dfd81
tests: adc_api: Remove sample width test scenario
punitvara Aug 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions arch/arc/soc/quark_se_c1000_ss/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,8 @@ endif
endif # I2C

if ADC
config ADC_QMSI_SS
config ADC_DW
def_bool y
config ADC_0_IRQ_PRI
default 0
endif

if BT_H4
Expand Down
6 changes: 6 additions & 0 deletions arch/arc/soc/quark_se_c1000_ss/dts.fixup
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,10 @@
#define CONFIG_GPIO_QMSI_1_IRQ INTEL_QMSI_GPIO_B0800B00_IRQ_0
#define CONFIG_GPIO_QMSI_1_IRQ_PRI INTEL_QMSI_GPIO_B0800B00_IRQ_0_PRIORITY

#define CONFIG_ADC_0_IRQ SNPS_DW_ADC_80015000_IRQ_NORMAL
#define CONFIG_ADC_IRQ_ERR SNPS_DW_ADC_80015000_IRQ_ERROR
#define CONFIG_ADC_0_IRQ_PRI SNPS_DW_ADC_80015000_IRQ_0_PRIORITY
#define CONFIG_ADC_0_NAME SNPS_DW_ADC_80015000_LABEL
#define CONFIG_ADC_0_BASE_ADDRESS SNPS_DW_ADC_80015000_BASE_ADDRESS

/* End of SoC Level DTS fixup file */
2 changes: 2 additions & 0 deletions arch/arm/soc/atmel_sam/same70/dts.fixup
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@
#define CONFIG_ADC_0_IRQ ATMEL_SAM_AFEC_4003C000_IRQ_0
#define CONFIG_ADC_0_IRQ_PRI ATMEL_SAM_AFEC_4003C000_IRQ_0_PRIORITY
#define CONFIG_ADC_0_NAME ATMEL_SAM_AFEC_4003C000_LABEL
#define CONFIG_ADC_0_PERIPHERAL_ID ATMEL_SAM_AFEC_4003C000_PERIPHERAL_ID

#define CONFIG_ADC_1_BASE_ADDRESS ATMEL_SAM_AFEC_40064000_BASE_ADDRESS
#define CONFIG_ADC_1_IRQ ATMEL_SAM_AFEC_40064000_IRQ_0
#define CONFIG_ADC_1_IRQ_PRI ATMEL_SAM_AFEC_40064000_IRQ_0_PRIORITY
#define CONFIG_ADC_1_NAME ATMEL_SAM_AFEC_40064000_LABEL
#define CONFIG_ADC_1_PERIPHERAL_ID ATMEL_SAM_AFEC_40064000_PERIPHERAL_ID

/* End of SoC Level DTS fixup file */
5 changes: 5 additions & 0 deletions arch/arm/soc/nordic_nrf/nrf51/dts.fixup
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/* SoC level DTS fixup file */

#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V6M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS

#define CONFIG_ADC_0_IRQ NORDIC_NRF_ADC_40007000_IRQ_0
#define CONFIG_ADC_0_IRQ_PRI NORDIC_NRF_ADC_40007000_IRQ_0_PRIORITY
#define CONFIG_ADC_0_NAME NORDIC_NRF_ADC_40007000_LABEL

#define CONFIG_UART_0_BASE NORDIC_NRF_UART_40002000_BASE_ADDRESS
#define CONFIG_UART_0_IRQ_PRI NORDIC_NRF_UART_40002000_IRQ_0_PRIORITY
#define CONFIG_UART_0_IRQ_NUM NORDIC_NRF_UART_40002000_IRQ_0
Expand Down
5 changes: 5 additions & 0 deletions arch/arm/soc/nordic_nrf/nrf52/dts.fixup
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/* SoC level DTS fixup file */

#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS

#define CONFIG_ADC_0_IRQ NORDIC_NRF_SAADC_40007000_IRQ_0
#define CONFIG_ADC_0_IRQ_PRI NORDIC_NRF_SAADC_40007000_IRQ_0_PRIORITY
#define CONFIG_ADC_0_NAME NORDIC_NRF_SAADC_40007000_LABEL

#if defined(NORDIC_NRF_UARTE_40002000_BASE_ADDRESS)
#define CONFIG_UART_0_BASE NORDIC_NRF_UARTE_40002000_BASE_ADDRESS
#define CONFIG_UART_0_IRQ_PRI NORDIC_NRF_UARTE_40002000_IRQ_0_PRIORITY
Expand Down
4 changes: 4 additions & 0 deletions boards/arc/arduino_101_sss/arduino_101_sss.dts
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@
&i2c3 {
status = "ok";
};

&adc0 {
status = "ok";
};
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@
&i2c3 {
status = "ok";
};

&adc0 {
status = "ok";
};
4 changes: 4 additions & 0 deletions boards/arm/nrf51_pca10028/nrf51_pca10028.dts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
status ="ok";
};

&adc {
status ="ok";
};

&uart0 {
current-speed = <115200>;
status = "ok";
Expand Down
1 change: 1 addition & 0 deletions boards/arm/nrf51_pca10028/nrf51_pca10028.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ toolchain:
- gnuarmemb
ram: 32
supported:
- adc
- ble
- nvs
4 changes: 4 additions & 0 deletions boards/arm/nrf52810_pca10040/nrf52810_pca10040.dts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@
};
};

&adc {
status = "ok";
};

&gpiote {
status ="ok";
};
Expand Down
4 changes: 4 additions & 0 deletions boards/arm/nrf52840_pca10056/nrf52840_pca10056.dts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
};
};

&adc {
status ="ok";
};

&gpiote {
status ="ok";
};
Expand Down
1 change: 1 addition & 0 deletions boards/arm/nrf52840_pca10056/nrf52840_pca10056.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ toolchain:
- zephyr
- gnuarmemb
supported:
- adc
- usb_device
- ble
- ieee802154
4 changes: 4 additions & 0 deletions boards/arm/nrf52_pca10040/nrf52_pca10040.dts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
};
};

&adc {
status ="ok";
};

&gpiote {
status ="ok";
};
Expand Down
1 change: 1 addition & 0 deletions boards/arm/nrf52_pca10040/nrf52_pca10040.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ toolchain:
ram: 64
flash: 512
supported:
- adc
- nvs
4 changes: 4 additions & 0 deletions boards/arm/nrf52_pca20020/nrf52_pca20020.dts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
};
};

&adc {
status = "ok";
};

&gpiote {
status = "ok";
};
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/sam_e70_xplained/doc/sam_e70_xplained.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ features:
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
| ADC | on-chip | ADC via AFEC |
+-----------+------------+-------------------------------------+

Other hardware features are not currently supported by Zephyr.

Expand Down
1 change: 1 addition & 0 deletions boards/arm/sam_e70_xplained/sam_e70_xplained.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ toolchain:
- gnuarmemb
supported:
- netif:eth
- adc
1 change: 0 additions & 1 deletion boards/x86/quark_d2000_crb/quark_d2000_crb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ toolchain:
ram: 8
flash: 32
supported:
- adc
- i2c
- spi
- gpio
Expand Down
15 changes: 7 additions & 8 deletions drivers/adc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
zephyr_library()

zephyr_library_sources_ifdef(CONFIG_ADC_DW adc_dw.c)
zephyr_library_sources_ifdef(CONFIG_ADC_MCUX_ADC16 adc_mcux_adc16.c)
zephyr_library_sources_ifdef(CONFIG_ADC_QMSI adc_qmsi.c)
zephyr_library_sources_ifdef(CONFIG_ADC_QMSI_SS adc_qmsi_ss.c)
zephyr_library_sources_ifdef(CONFIG_ADC_SAM_AFEC adc_sam_afec.c)
zephyr_library_sources_ifdef(CONFIG_ADC_TI_ADC108S102 adc_ti_adc108s102.c)

zephyr_library_sources_ifdef(CONFIG_USERSPACE adc_handlers.c)
zephyr_library_sources_ifdef(CONFIG_ADC_DW adc_dw.c)
zephyr_library_sources_ifdef(CONFIG_ADC_MCUX_ADC16 adc_mcux_adc16.c)
zephyr_library_sources_ifdef(CONFIG_ADC_QMSI adc_qmsi.c)
zephyr_library_sources_ifdef(CONFIG_ADC_SAM_AFEC adc_sam_afec.c)
zephyr_library_sources_ifdef(CONFIG_ADC_TI_ADC108S102 adc_ti_adc108s102.c)
zephyr_library_sources_ifdef(CONFIG_ADC_NRFX_ADC adc_nrfx_adc.c)
zephyr_library_sources_ifdef(CONFIG_ADC_NRFX_SAADC adc_nrfx_saadc.c)
19 changes: 18 additions & 1 deletion drivers/adc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,26 @@
#
menuconfig ADC
bool "ADC drivers"
# All platforms that implement the ADC driver are now required to
# provide relevant DTS entries.
select HAS_DTS_ADC
help
Enable ADC (Analog to Digital Converter) driver configuration
Enable ADC (Analog to Digital Converter) driver configuration.

if ADC

# By selecting or not this option particular ADC drivers indicate if it is
# required to explicitly specify analog inputs when configuring channels or
# just the channel identifier is sufficient.
config ADC_CONFIGURABLE_INPUTS
bool

config ADC_ASYNC
bool "Enable asynchronous call support"
select POLL
help
This option enables the asynchronous API calls.

config SYS_LOG_ADC_LEVEL
int "ADC drivers log level"
depends on SYS_LOG
Expand Down Expand Up @@ -73,6 +88,8 @@ source "drivers/adc/Kconfig.dw"

source "drivers/adc/Kconfig.mcux"

source "drivers/adc/Kconfig.nrfx"

source "drivers/adc/Kconfig.qmsi"

source "drivers/adc/Kconfig.sam_afec"
Expand Down
37 changes: 0 additions & 37 deletions drivers/adc/Kconfig.dw
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ config ADC_DW_CALIBRATION
If disabled, the ADC will require the application/system-integrator
to provide a calibration method.

config ADC_DW_DUMMY_CONVERSION
bool "Enable dummy conversion"
default y
help
After awaking from low power state a dummy
conversion must be performed and discarded.
If disabled the user will have to discard the first
sample after a resume from a low power state.

choice
prompt "Output Mode"
default ADC_DW_SERIAL
Expand All @@ -48,20 +39,6 @@ config ADC_DW_PARALLEL

endchoice

choice
prompt "Sequence Mode"
default ADC_DW_SINGLESHOT
help
ADC sequence mode - single run/repetitive

config ADC_DW_SINGLESHOT
bool "Single Ended"

config ADC_DW_REPETITIVE
bool "Differential"

endchoice

choice
prompt "Capture Mode"
default ADC_DW_RISING_EDGE
Expand All @@ -77,20 +54,6 @@ config ADC_DW_FALLING_EDGE

endchoice

config ADC_DW_SAMPLE_WIDTH
int "Sample Width"
default 31
help
Defines ADC device data sample width (resolution):

- 0 = 6 bits resolution

- 1 = 8 bits resolution

- 2 = 10 bits resolution

- 3 = 12 bits resolution

config ADC_DW_SERIAL_DELAY
int "Serial Delay"
default 1
Expand Down
1 change: 0 additions & 1 deletion drivers/adc/Kconfig.mcux
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
config ADC_MCUX_ADC16
bool "MCUX ADC16 driver"
depends on HAS_MCUX_ADC16
select HAS_DTS_ADC
help
Enable the MCUX ADC16 driver.
32 changes: 32 additions & 0 deletions drivers/adc/Kconfig.nrfx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Kconfig - ADC configuration options

#
# Copyright (c) 2018, Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
#

config ADC_NRFX_ADC
bool "nRF ADC nrfx driver"
depends on HAS_HW_NRF_ADC
select NRFX_ADC
select ADC_CONFIGURABLE_INPUTS
help
Enable support for nrfx ADC driver for nRF51 MCU series.

config ADC_NRFX_ADC_CHANNEL_COUNT
int "Number of ADC channels"
depends on ADC_NRFX_ADC
range 1 8
default 1
help
Number of ADC channels to be supported by the driver. Each channel
needs a dedicated structure in RAM that stores the ADC settings
to be used when sampling this channel.

config ADC_NRFX_SAADC
bool "nRF SAADC nrfx driver"
depends on HAS_HW_NRF_SAADC
select ADC_CONFIGURABLE_INPUTS
help
Enable support for nrfx SAADC driver for nRF52 MCU series.
29 changes: 2 additions & 27 deletions drivers/adc/Kconfig.qmsi
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,7 @@ menuconfig ADC_QMSI
help
Enable the driver implementation of the QMSI ADC IP.

menuconfig ADC_QMSI_SS
bool "QMSI ADC Driver for the Sensor Subsystem"
depends on QMSI
select ADC_0
help
Enable the driver implementation of the QMSI ADC IP.

if ADC_QMSI || ADC_QMSI_SS
if ADC_QMSI

choice
prompt "Capturing Mode"
Expand Down Expand Up @@ -59,7 +52,6 @@ config ADC_QMSI_SERIAL_DELAY
the serial output is delayed after the conversion
has started.

if ADC_QMSI
config ADC_QMSI_SAMPLE_WIDTH
int "Sample Width"
default 3
Expand All @@ -73,22 +65,5 @@ config ADC_QMSI_SAMPLE_WIDTH
- 2 = 10 bits resolution

- 3 = 12 bits resolution
endif

if ADC_QMSI_SS
config ADC_QMSI_SAMPLE_WIDTH
int "Sample Width"
default 11
help
Defines ADC device data sample width (resolution):

- 5 = 6 bits resolution

- 7 = 8 bits resolution

- 9 = 10 bits resolution

- 11 = 12 bits resolution
endif

endif # ADC_QMSI || ADC_QMSI_SS
endif # ADC_QMSI
1 change: 0 additions & 1 deletion drivers/adc/Kconfig.sam_afec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
menuconfig ADC_SAM_AFEC
bool "SAM ADC Driver"
depends on SOC_FAMILY_SAM
select HAS_DTS_ADC
help
Enable Atmel SAM MCU Family Analog-to-Digital Converter (ADC) driver
based on AFEC module.
Loading