Skip to content

Commit 9491f75

Browse files
Fabrice Gasnierjic23
authored andcommitted
iio: adc: stm32-dfsdm: enable hw consumer
Optionally enable IIO hw consumer, when provided (e.g. for DFSDM_IIO type). This is precursor patch to introduce buffer modes. Signed-off-by: Fabrice Gasnier <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 7464850 commit 9491f75

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

drivers/iio/adc/stm32-dfsdm-adc.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,9 +630,15 @@ static int stm32_dfsdm_postenable(struct iio_dev *indio_dev)
630630
/* Reset adc buffer index */
631631
adc->bufi = 0;
632632

633+
if (adc->hwc) {
634+
ret = iio_hw_consumer_enable(adc->hwc);
635+
if (ret < 0)
636+
return ret;
637+
}
638+
633639
ret = stm32_dfsdm_start_dfsdm(adc->dfsdm);
634640
if (ret < 0)
635-
return ret;
641+
goto err_stop_hwc;
636642

637643
ret = stm32_dfsdm_adc_dma_start(indio_dev);
638644
if (ret) {
@@ -652,6 +658,9 @@ static int stm32_dfsdm_postenable(struct iio_dev *indio_dev)
652658
stm32_dfsdm_adc_dma_stop(indio_dev);
653659
stop_dfsdm:
654660
stm32_dfsdm_stop_dfsdm(adc->dfsdm);
661+
err_stop_hwc:
662+
if (adc->hwc)
663+
iio_hw_consumer_disable(adc->hwc);
655664

656665
return ret;
657666
}
@@ -667,6 +676,9 @@ static int stm32_dfsdm_predisable(struct iio_dev *indio_dev)
667676

668677
stm32_dfsdm_stop_dfsdm(adc->dfsdm);
669678

679+
if (adc->hwc)
680+
iio_hw_consumer_disable(adc->hwc);
681+
670682
return 0;
671683
}
672684

0 commit comments

Comments
 (0)