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: adc_sam0: rework devicetree support #24789

Merged
merged 1 commit into from
Apr 29, 2020

Conversation

galak
Copy link
Collaborator

@galak galak commented Apr 28, 2020

Rework the devicetree to utilize new DT_INST macros and extract per
instance data for clocks from devicetree.

We add a property ('calib-offset') for the SAM{D,E}5x family of SoCs
that is the bit position offset from ADC0 BIASCOMP in the NVM Software
Calibration Area Mapping. For ADC0 this is typically 0 and for ADC1
this will be 14.

Signed-off-by: Kumar Gala [email protected]

@galak galak requested a review from anangl as a code owner April 28, 2020 22:02
@galak galak added this to the v2.3.0 milestone Apr 28, 2020
@galak galak added area: ADC Analog-to-Digital Converter (ADC) area: Devicetree platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM) labels Apr 28, 2020
@zephyrbot
Copy link
Collaborator

zephyrbot commented Apr 28, 2020

All checks are passing now.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

@nandojve nandojve mentioned this pull request Apr 28, 2020
61 tasks
Rework the devicetree to utilize new DT_INST macros and extract per
instance data for clocks from devicetree.

We add a property ('calib-offset') for the SAM{D,E}5x family of SoCs
that is the bit position offset from ADC0 BIASCOMP in the NVM Software
Calibration Area Mapping.  For ADC0 this is typically 0 and for ADC1
this will be 14.

Signed-off-by: Kumar Gala <[email protected]>
Copy link
Member

@stephanosio stephanosio left a comment

Choose a reason for hiding this comment

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

Looks ok to me.

Tested and verified working on atsamd21_xpro:

Running test suite adc_basic_test
===================================================================
starting test - test_adc_sample_one_channel
Samples read: 0x0d3c 0x0000 0x0000 0x0000 0x0000 0x0000
PASS - test_adc_sample_one_channel
===================================================================
starting test - test_adc_sample_two_channels
SKIP - test_adc_sample_two_channels
===================================================================
starting test - test_adc_asynchronous_call
Samples read: 0x0d3b 0x0d3a 0x0d38 0x0d3b 0x0d3e 0x0000
PASS - test_adc_asynchronous_call
===================================================================
starting test - test_adc_sample_with_interval
sample_with_interval_callback: sampling 0
sample_with_interval_callback: sampling 1
sample_with_interval_callback: sampling 2
sample_with_interval_callback: sampling 3
sample_with_interval_callback: sampling 4
Samples read: 0x0d35 0x0d36 0x0d34 0x0d33 0x0d37 0x0000
PASS - test_adc_sample_with_interval
===================================================================
starting test - test_adc_repeated_samplings
repeated_samplings_callback: done 1
Samples read: 0x0d38 0x0000 0x0000 0x0000 0x0000 0x0000
repeated_samplings_callback: done 2
Samples read: 0x0d38 0x0d2b 0x0000 0x0000 0x0000 0x0000
repeated_samplings_callback: done 3
Samples read: 0x0d2c 0x0d2b 0x0000 0x0000 0x0000 0x0000
repeated_samplings_callback: done 4
Samples read: 0x0d2a 0x0d2b 0x0000 0x0000 0x0000 0x0000
repeated_samplings_callback: done 5
Samples read: 0x0d2a 0x0d2b 0x0000 0x0000 0x0000 0x0000
repeated_samplings_callback: done 6
Samples read: 0x0d26 0x0d2b 0x0000 0x0000 0x0000 0x0000
repeated_samplings_callback: done 7
Samples read: 0x0d25 0x0d2b 0x0000 0x0000 0x0000 0x0000
repeated_samplings_callback: done 8
Samples read: 0x0d2c 0x0d2b 0x0000 0x0000 0x0000 0x0000
repeated_samplings_callback: done 9
Samples read: 0x0d27 0x0d2b 0x0000 0x0000 0x0000 0x0000
repeated_samplings_callback: done 10
Samples read: 0x0d26 0x0d2b 0x0000 0x0000 0x0000 0x0000
PASS - test_adc_repeated_samplings
===================================================================
starting test - test_adc_invalid_request
E: ADC resolution value 0 is not valid
E: ADC resolution value 0 is not valid
Samples read: 0x0d37 0x0000 0x0000 0x0000 0x0000 0x0000
PASS - test_adc_invalid_request
===================================================================
Test suite adc_basic_test succeeded
===================================================================
PROJECT EXECUTION SUCCESSFUL

As for atsame54_xpro, tests/drivers/adc/adc_api hangs, but that also happens on master, so the problem was not introduced by this PR.

@galak galak merged commit a918d30 into zephyrproject-rtos:master Apr 29, 2020
@galak galak deleted the adc-sam0 branch April 29, 2020 13:02
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: Devicetree platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants