Skip to content

Draft: drivers: adc: Add Gecko ADC driver #164

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

Open
wants to merge 1 commit into
base: tmo-main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 0 additions & 6 deletions boards/arm/tmo_dev_edge/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,4 @@
#define LED_PWM_GREEN 2
#define LED_PWM_BLUE 3

#define HWID_APORT adcPosSelAPORT4XCH23
#define VBAT_APORT adcPosSelAPORT3XCH10

#define VBAT_EN_PORT gpioPortK
#define VBAT_EN_PIN 0

#endif /* __INC_BOARD_H */
8 changes: 8 additions & 0 deletions boards/arm/tmo_dev_edge/tmo_dev_edge-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,12 @@
<GECKO_LOC(LEUART_TX, 6)>;
};
};

adc_default: adc_default {
group1 {
psels = <GECKO_ADC_VBATT>,
<GECKO_ADC_HWID>;
//input-enabled;
};
};
};
17 changes: 16 additions & 1 deletion boards/arm/tmo_dev_edge/tmo_dev_edge.dts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2017 Christian Taedcke
* Copyright (c) 2019 Lemonbeat GmbH
* Copyright (c) 2023 T-Mobile USA, Inc.
Expand Down Expand Up @@ -102,6 +102,21 @@
regulator-name = "bq24250rge";
regulator-boot-on;
};

adc:adc@40002000 {
compatible = "silabs,gecko-adc";
status = "disabled";
reg = <0x40002000 0x400>;
frequency= <16000000>;
#io-channel-cells = <1>;
vref-mv = <2500>;
};
};

&adc {
status = "okay";
pinctrl-0 = <&adc_default>;
pinctrl-names = "default";
};

&cpu0 {
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/tmo_dev_edge/tmo_dev_edge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ supported:
- nvs
- watchdog
- counter
- adc

testing:
default: true
ignore_tags:
Expand Down
1 change: 1 addition & 0 deletions boards/arm/tmo_dev_edge/tmo_dev_edge_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ CONFIG_GPIO=y
CONFIG_CMU_HFCLK_HFXO=y
CONFIG_COUNTER=y
CONFIG_NOTIFY=y
CONFIG_ADC=y
CONFIG_PERSISTENT_GECKO_RTCC=y
CONFIG_PINCTRL=y
CONFIG_POSIX_CLOCK=y
1 change: 1 addition & 0 deletions drivers/adc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ zephyr_library_sources_ifdef(CONFIG_ADC_ADS7052 adc_ads7052.c)
zephyr_library_sources_ifdef(CONFIG_ADC_RPI_PICO adc_rpi_pico.c)
zephyr_library_sources_ifdef(CONFIG_ADC_XMC4XXX adc_xmc4xxx.c)
zephyr_library_sources_ifdef(CONFIG_ADC_ESP32 adc_esp32.c)
zephyr_library_sources_ifdef(CONFIG_ADC_GECKO adc_gecko.c)
1 change: 1 addition & 0 deletions drivers/adc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,5 @@ source "drivers/adc/Kconfig.rpi_pico"

source "drivers/adc/Kconfig.xmc4xxx"

source "drivers/adc/Kconfig.gecko"
endif # ADC
Loading