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

Drivers: ADC: Introduce gd32 adc driver #42215

Merged
merged 6 commits into from
Jul 4, 2022

Conversation

cameled
Copy link
Contributor

@cameled cameled commented Jan 27, 2022

Add an initial support for gd32 adc interface.

This driver based on single conversion mode with regular channel.

Test with samples/drivers/adc sample on gd32f350r_eval, gd32f450i_eval and gd32vf103v_eval boards.

work list:

  • sample time config

@github-actions github-actions bot added area: ADC Analog-to-Digital Converter (ADC) area: Boards area: Devicetree area: Devicetree Binding PR modifies or adds a Device Tree binding area: Samples Samples labels Jan 27, 2022
@cameled cameled mentioned this pull request Feb 15, 2022
55 tasks
@cameled cameled marked this pull request as ready for review March 2, 2022 09:06
@cameled
Copy link
Contributor Author

cameled commented Mar 2, 2022

When compile the samples/drivers/adc sample on gd32f350r_eval board, I get an warning: unused variable 'cfg' at adc_gd32.c. gd32f450i_eval and gd32vf103v_eval boards doesn't have this issue.

I guess this issue caused by the ADC interface number. GD32F350 have one ADC interface, but GD32F450 and GD32VF103 have more than one ADC interface. And I use the DT_INST_FOREACH_STATUS_OKAY macro.

Warning output: warning.txt

@cameled
Copy link
Contributor Author

cameled commented Mar 2, 2022

@nandojve @gmarull GD32 ADC is ready to review.

Copy link
Member

@gmarull gmarull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a few minor comments. Boards board.yaml should also be updated to include adc on the supported list.

drivers/adc/adc_gd32.c Outdated Show resolved Hide resolved
drivers/adc/adc_gd32.c Outdated Show resolved Hide resolved
drivers/adc/adc_gd32.c Outdated Show resolved Hide resolved
drivers/adc/adc_gd32.c Outdated Show resolved Hide resolved
@cameled cameled force-pushed the gd32-adc branch 2 times, most recently from 8b825df to ac8e65d Compare March 2, 2022 11:15
drivers/adc/adc_gd32.c Outdated Show resolved Hide resolved
drivers/adc/adc_gd32.c Outdated Show resolved Hide resolved
drivers/adc/adc_gd32.c Outdated Show resolved Hide resolved
drivers/adc/adc_gd32.c Outdated Show resolved Hide resolved
drivers/adc/adc_gd32.c Outdated Show resolved Hide resolved
Add support for gd32 adc.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
@cameled cameled changed the title [DNM] Drivers: ADC: Introduce gd32 adc driver Drivers: ADC: Introduce gd32 adc driver Jun 27, 2022
gmarull
gmarull previously approved these changes Jun 28, 2022
drivers/adc/adc_gd32.c Outdated Show resolved Hide resolved
gmarull
gmarull previously approved these changes Jun 28, 2022
@cameled
Copy link
Contributor Author

cameled commented Jun 29, 2022

@nandojve Please help to confirm the new shared irq implement, thanks!

Copy link
Member

@nandojve nandojve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @cameled,

I found more two small fixes. Overall is a very nice work!

drivers/adc/adc_gd32.c Show resolved Hide resolved
boards/arm/gd32f403z_eval/gd32f403z_eval.dts Show resolved Hide resolved
HaiLong Yang added 5 commits July 3, 2022 19:28
This driver based on single conversion mode with regular channel.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
This add adc support for gd32f350r_eval, gd32f450i_eval and
gd32vf103v_eval boards.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
This add gd32 boards support for the adc sample.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
Add cameled as gd32 platform collaborator.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
DTS node address should use lower case. This fix an incorrect
gd32f403 usart3 node address.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
@nandojve nandojve requested review from gmarull and ycsin July 3, 2022 12:07
@carlescufi carlescufi merged commit ec0e842 into zephyrproject-rtos:main Jul 4, 2022
@cameled cameled deleted the gd32-adc branch July 4, 2022 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ADC Analog-to-Digital Converter (ADC) area: API Changes to public APIs area: Boards area: Devicetree Binding PR modifies or adds a Device Tree binding area: Devicetree area: Documentation area: Modules area: Process area: RISCV RISCV Architecture (32-bit & 64-bit) area: Samples Samples manifest manifest-hal_gigadevice platform: GD32 GigaDevice
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants