Skip to content

Commit b3b443a

Browse files
committed
drivers: adc: ti_am335x: change ADC reference
Change the ADC reference for channels from internal to VDD. This involves removing the present binding to get the internal reference. Signed-off-by: Amneesh Singh <[email protected]>
1 parent 433893e commit b3b443a

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

drivers/adc/adc_ti_am335x.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ static int ti_adc_channel_setup(const struct device *dev, const struct adc_chann
186186
return -EINVAL;
187187
}
188188

189+
if (chan_cfg->reference != ADC_REF_VDD_1) {
190+
LOG_ERR("Invalid channel reference");
191+
return -EINVAL;
192+
}
193+
189194
if (chan_cfg->gain != ADC_GAIN_1) {
190195
LOG_ERR("Gain must be 1x");
191196
return -EINVAL;
@@ -368,15 +373,17 @@ static void ti_adc_isr(const struct device *dev)
368373

369374
#define EXPLICIT_CHAN_PROP(node, prop) [DT_REG_ADDR(node)] = DT_PROP(node, prop)
370375

371-
#define CHAN_PROP_LIST(n, prop) {DT_INST_FOREACH_CHILD_SEP_VARGS(n, EXPLICIT_CHAN_PROP, (,), prop)}
376+
#define CHAN_PROP_LIST(n, prop) {DT_INST_FOREACH_CHILD_SEP_VARGS(n, EXPLICIT_CHAN_PROP, (, ), prop)}
377+
378+
static DEVICE_API(adc, ti_adc_driver_api) = {
379+
.channel_setup = ti_adc_channel_setup,
380+
.read = ti_adc_read,
381+
#ifdef CONFIG_ADC_ASYNC
382+
.read_async = ti_adc_read_async,
383+
#endif /* CONFIG_ADC_ASYNC */
384+
};
372385

373386
#define TI_ADC_INIT(n) \
374-
static DEVICE_API(adc, ti_adc_driver_api_##n) = { \
375-
.channel_setup = ti_adc_channel_setup, \
376-
.read = ti_adc_read, \
377-
.ref_internal = DT_INST_PROP(n, ti_vrefp), \
378-
IF_ENABLED(CONFIG_ADC_ASYNC, (.read_async = ti_adc_read_async,)) }; \
379-
\
380387
static void ti_adc_irq_setup_##n(const struct device *dev) \
381388
{ \
382389
IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), ti_adc_isr, \
@@ -400,6 +407,6 @@ static void ti_adc_isr(const struct device *dev)
400407
}; \
401408
\
402409
DEVICE_DT_INST_DEFINE(n, ti_adc_init, NULL, &ti_adc_data_##n, &ti_adc_cfg_##n, \
403-
POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, &ti_adc_driver_api_##n);
410+
POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, &ti_adc_driver_api);
404411

405412
DT_INST_FOREACH_STATUS_OKAY(TI_ADC_INIT)

dts/bindings/adc/ti,am335x-adc.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ properties:
1212
interrupts:
1313
required: true
1414

15-
ti,vrefp:
16-
type: int
17-
required: true
18-
description: Reference Voltage (in mV)
19-
2015
ti,fifo:
2116
type: int
2217
required: true

0 commit comments

Comments
 (0)