Lines Matching +full:adc +full:- +full:channels

1 // SPDX-License-Identifier: GPL-2.0+
3 * Tests for the driver model ADC API
10 #include <adc.h>
19 #include <sandbox-adc.h>
27 ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev)); in dm_test_adc_bind()
28 ut_asserteq_str(SANDBOX_ADC_DEVNAME, dev->name); in dm_test_adc_bind()
31 ut_asserteq((1 << SANDBOX_ADC_CHANNELS) - 1, channel_mask); in dm_test_adc_bind()
41 ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev)); in dm_test_adc_wrong_channel_selection()
42 ut_asserteq(-EINVAL, adc_start_channel(dev, SANDBOX_ADC_CHANNELS)); in dm_test_adc_wrong_channel_selection()
54 ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev)); in dm_test_adc_supply()
56 /* Test Vss value - predefined 0 uV */ in dm_test_adc_supply()
60 /* Test Vdd initial value - buck2 */ in dm_test_adc_supply()
64 /* Change Vdd value - buck2 manual preset */ in dm_test_adc_supply()
69 /* Update ADC platdata and get new Vdd value */ in dm_test_adc_supply()
73 /* Disable buck2 and test ADC supply enable function */ in dm_test_adc_supply()
97 ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev)); in dm_test_adc_single_channel_conversion()
98 /* Test each ADC channel's value */ in dm_test_adc_single_channel_conversion()
100 ut_assertok(adc_start_channel(dev, tdata->id)); in dm_test_adc_single_channel_conversion()
101 ut_assertok(adc_channel_data(dev, tdata->id, &data)); in dm_test_adc_single_channel_conversion()
102 ut_asserteq(tdata->data, data); in dm_test_adc_single_channel_conversion()
111 struct adc_channel channels[SANDBOX_ADC_CHANNELS]; in dm_test_adc_multi_channel_conversion() local
120 ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev)); in dm_test_adc_multi_channel_conversion()
122 ut_assertok(adc_channels_data(dev, channel_mask, channels)); in dm_test_adc_multi_channel_conversion()
126 ut_asserteq(tdata->data, channels[i].data); in dm_test_adc_multi_channel_conversion()
139 ut_assertok(adc_channel_single_shot("adc", tdata->id, &data)); in dm_test_adc_single_channel_shot()
141 ut_asserteq(tdata->data, data); in dm_test_adc_single_channel_shot()
150 struct adc_channel channels[SANDBOX_ADC_CHANNELS]; in dm_test_adc_multi_channel_shot() local
158 ut_assertok(adc_channels_single_shot("adc", channel_mask, channels)); in dm_test_adc_multi_channel_shot()
162 ut_asserteq(tdata->data, channels[i].data); in dm_test_adc_multi_channel_shot()
186 ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev)); in dm_test_adc_raw_to_uV()
187 /* Test each ADC channel's value in microvolts */ in dm_test_adc_raw_to_uV()
189 ut_assertok(adc_start_channel(dev, tdata->id)); in dm_test_adc_raw_to_uV()
190 ut_assertok(adc_channel_data(dev, tdata->id, &data)); in dm_test_adc_raw_to_uV()