Skip to content

Commit ff7a7ba

Browse files
kimmansfieldjohnlange2
authored andcommitted
drivers: adc: Add Gecko ADC driver
This adds an ADC driver for SiLabs Pearl Gecko MCU Signed-off-by: Kim Mansfield <[email protected]>
1 parent cb63b66 commit ff7a7ba

File tree

12 files changed

+510
-7
lines changed

12 files changed

+510
-7
lines changed

boards/arm/tmo_dev_edge/board.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,4 @@
4444
#define LED_PWM_GREEN 2
4545
#define LED_PWM_BLUE 3
4646

47-
#define HWID_APORT adcPosSelAPORT4XCH23
48-
#define VBAT_APORT adcPosSelAPORT3XCH10
49-
50-
#define VBAT_EN_PORT gpioPortK
51-
#define VBAT_EN_PIN 0
52-
5347
#endif /* __INC_BOARD_H */

boards/arm/tmo_dev_edge/tmo_dev_edge-pinctrl.dtsi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,12 @@
6262
<GECKO_LOC(LEUART_TX, 6)>;
6363
};
6464
};
65+
66+
adc_default: adc_default {
67+
group1 {
68+
psels = <GECKO_ADC_VBATT>,
69+
<GECKO_ADC_HWID>;
70+
//input-enabled;
71+
};
72+
};
6573
};

boards/arm/tmo_dev_edge/tmo_dev_edge.dts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* Copyright (c) 2017 Christian Taedcke
33
* Copyright (c) 2019 Lemonbeat GmbH
44
* Copyright (c) 2023 T-Mobile USA, Inc.
@@ -102,6 +102,21 @@
102102
regulator-name = "bq24250rge";
103103
regulator-boot-on;
104104
};
105+
106+
adc:adc@40002000 {
107+
compatible = "silabs,gecko-adc";
108+
status = "disabled";
109+
reg = <0x40002000 0x400>;
110+
frequency= <16000000>;
111+
#io-channel-cells = <1>;
112+
vref-mv = <2500>;
113+
};
114+
};
115+
116+
&adc {
117+
status = "okay";
118+
pinctrl-0 = <&adc_default>;
119+
pinctrl-names = "default";
105120
};
106121

107122
&cpu0 {

boards/arm/tmo_dev_edge/tmo_dev_edge.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ supported:
1515
- nvs
1616
- watchdog
1717
- counter
18+
- adc
19+
1820
testing:
1921
default: true
2022
ignore_tags:

boards/arm/tmo_dev_edge/tmo_dev_edge_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ CONFIG_COUNTER=y
1818
CONFIG_PWM=y
1919
CONFIG_PWM_GECKO=y
2020
CONFIG_NOTIFY=y
21+
CONFIG_ADC=y
2122
CONFIG_PERSISTENT_GECKO_RTCC=y
2223
CONFIG_PINCTRL=y
2324
CONFIG_POSIX_CLOCK=y

drivers/adc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ zephyr_library_sources_ifdef(CONFIG_ADC_ADS7052 adc_ads7052.c)
3232
zephyr_library_sources_ifdef(CONFIG_ADC_RPI_PICO adc_rpi_pico.c)
3333
zephyr_library_sources_ifdef(CONFIG_ADC_XMC4XXX adc_xmc4xxx.c)
3434
zephyr_library_sources_ifdef(CONFIG_ADC_ESP32 adc_esp32.c)
35+
zephyr_library_sources_ifdef(CONFIG_ADC_GECKO adc_gecko.c)

drivers/adc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,5 @@ source "drivers/adc/Kconfig.rpi_pico"
9292

9393
source "drivers/adc/Kconfig.xmc4xxx"
9494

95+
source "drivers/adc/Kconfig.gecko"
9596
endif # ADC

0 commit comments

Comments
 (0)