Commit 0f7ddcc1bff1983d0be1573f971995371669fa4f
Committed by
Jonathan Cameron
1 parent
89ca79afe5
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
iio:adc:ad799x: Write default config on probe and reset alert status on probe
writing ALERT_EN and BUSY_ALERT to the chip config register clears pending alerts, BUSY_ALERT is cleared when reading back the register Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Showing 1 changed file with 13 additions and 6 deletions Side-by-side Diff
drivers/iio/adc/ad799x.c
... | ... | @@ -595,7 +595,7 @@ |
595 | 595 | AD799X_CHANNEL_WITH_EVENTS(1, 12), |
596 | 596 | IIO_CHAN_SOFT_TIMESTAMP(3), |
597 | 597 | }, |
598 | - .default_config = AD7998_ALERT_EN, | |
598 | + .default_config = AD7998_ALERT_EN | AD7998_BUSY_ALERT, | |
599 | 599 | .info = &ad7993_4_7_8_irq_info, |
600 | 600 | }, |
601 | 601 | }, |
... | ... | @@ -619,7 +619,7 @@ |
619 | 619 | AD799X_CHANNEL_WITH_EVENTS(3, 10), |
620 | 620 | IIO_CHAN_SOFT_TIMESTAMP(4), |
621 | 621 | }, |
622 | - .default_config = AD7998_ALERT_EN, | |
622 | + .default_config = AD7998_ALERT_EN | AD7998_BUSY_ALERT, | |
623 | 623 | .info = &ad7993_4_7_8_irq_info, |
624 | 624 | }, |
625 | 625 | }, |
... | ... | @@ -643,7 +643,7 @@ |
643 | 643 | AD799X_CHANNEL_WITH_EVENTS(3, 12), |
644 | 644 | IIO_CHAN_SOFT_TIMESTAMP(4), |
645 | 645 | }, |
646 | - .default_config = AD7998_ALERT_EN, | |
646 | + .default_config = AD7998_ALERT_EN | AD7998_BUSY_ALERT, | |
647 | 647 | .info = &ad7993_4_7_8_irq_info, |
648 | 648 | }, |
649 | 649 | }, |
... | ... | @@ -675,7 +675,7 @@ |
675 | 675 | AD799X_CHANNEL(7, 10), |
676 | 676 | IIO_CHAN_SOFT_TIMESTAMP(8), |
677 | 677 | }, |
678 | - .default_config = AD7998_ALERT_EN, | |
678 | + .default_config = AD7998_ALERT_EN | AD7998_BUSY_ALERT, | |
679 | 679 | .info = &ad7993_4_7_8_irq_info, |
680 | 680 | }, |
681 | 681 | }, |
... | ... | @@ -707,7 +707,7 @@ |
707 | 707 | AD799X_CHANNEL(7, 12), |
708 | 708 | IIO_CHAN_SOFT_TIMESTAMP(8), |
709 | 709 | }, |
710 | - .default_config = AD7998_ALERT_EN, | |
710 | + .default_config = AD7998_ALERT_EN | AD7998_BUSY_ALERT, | |
711 | 711 | .info = &ad7993_4_7_8_irq_info, |
712 | 712 | }, |
713 | 713 | }, |
... | ... | @@ -735,7 +735,6 @@ |
735 | 735 | st->chip_config = &chip_info->irq_config; |
736 | 736 | else |
737 | 737 | st->chip_config = &chip_info->noirq_config; |
738 | - st->config = st->chip_config->default_config; | |
739 | 738 | |
740 | 739 | /* TODO: Add pdata options for filtering and bit delay */ |
741 | 740 | |
... | ... | @@ -763,6 +762,14 @@ |
763 | 762 | indio_dev->modes = INDIO_DIRECT_MODE; |
764 | 763 | indio_dev->channels = st->chip_config->channel; |
765 | 764 | indio_dev->num_channels = chip_info->num_channels; |
765 | + | |
766 | + ret = ad799x_write_config(st, st->chip_config->default_config); | |
767 | + if (ret < 0) | |
768 | + goto error_disable_reg; | |
769 | + ret = ad799x_read_config(st); | |
770 | + if (ret < 0) | |
771 | + goto error_disable_reg; | |
772 | + st->config = ret; | |
766 | 773 | |
767 | 774 | ret = iio_triggered_buffer_setup(indio_dev, NULL, |
768 | 775 | &ad799x_trigger_handler, NULL); |
-
mentioned in commit 2eacc6
-
mentioned in commit 2eacc6
-
mentioned in commit 2eacc6
-
mentioned in commit 2eacc6
-
mentioned in commit 2eacc6
-
mentioned in commit 2eacc6
-
mentioned in commit 2eacc6
-
mentioned in commit 2eacc6
-
mentioned in commit 2eacc6
-
mentioned in commit 2eacc6
-
mentioned in commit 2eacc6
-
mentioned in commit 2eacc6
-
mentioned in commit 2eacc6