Re: [PATCH v4 3/4] iio: adc: hi8435: Holt HI-8435 threshold detector
On 20/08/15 20:38, Vladimir Barinov wrote: > Add Holt threshold detector driver for HI-8435 chip > > Signed-off-by: Vladimir Barinov A few little bits and bobs below but basically there. Jonathan > --- > Changes in version 2: > - Added file sysfs-bus-iio-adc-hi8435 > - Changed naming from "discrete ADC" to "threshold detector" > - Replaced swab16p/swab32p with be16_to_cpup/be32_to_cpup > - Made *_show and *_store functions static > - moved out from iio buffers to iio events > - removed hi8436/hi8437 chips from the driver > - moved from debounce_soft_delay/enable to debounce_interval via > IIO_CHAN_INFO_DEBOUNCE_TIME > - added name extention "comparator" > - moved threshold/hysteresis setup via generic iio event sysfs > - added software mask/unmask channel events > - added programming sensor outputs while in test mode via > IIO_CHAN_INFO_RAW > - added channels .ext_info for programming sensing mode > Changes in version 3: > - fixed typos > - moved to match alphabetic order > - fixed missed */event/* prefix in the ABI description > - added missed colon in sysfs-bus-iio-adc-hi8435 file after "What" > - moved in_voltageY_comparator_thresh_either_en and debounce_time > to sysfs-bus-iio file > - added error checking for hi8435_write[b|w] > Changes in version 4: > - removed software debounce logic > - fixed typo in comment s/threshold/thresholds > - removed test_enable sysfs entry > - removed *_raw entries > - removed extended_name > - switched to GPIO descriptor API > - added comment describing the need of thresholds initialization > - added debugfs_reg_access > > Documentation/ABI/testing/sysfs-bus-iio| 1 + > Documentation/ABI/testing/sysfs-bus-iio-adc-hi8435 | 39 ++ > drivers/iio/adc/Kconfig| 11 + > drivers/iio/adc/Makefile | 1 + > drivers/iio/adc/hi8435.c | 535 > + > 5 files changed, 587 insertions(+) > create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-hi8435 > create mode 100644 drivers/iio/adc/hi8435.c > > diff --git a/Documentation/ABI/testing/sysfs-bus-iio > b/Documentation/ABI/testing/sysfs-bus-iio > index 42d360f..20312a0 100644 > --- a/Documentation/ABI/testing/sysfs-bus-iio > +++ b/Documentation/ABI/testing/sysfs-bus-iio > @@ -581,6 +581,7 @@ What: > /sys/.../iio:deviceX/events/in_voltageY_supply_thresh_rising_en > What: > /sys/.../iio:deviceX/events/in_voltageY_supply_thresh_falling_en > What:/sys/.../iio:deviceX/events/in_voltageY_thresh_rising_en > What: > /sys/.../iio:deviceX/events/in_voltageY_thresh_falling_en > +What:/sys/.../iio:deviceX/events/in_voltageY_thresh_either_en > What:/sys/.../iio:deviceX/events/in_tempY_thresh_rising_en > What:/sys/.../iio:deviceX/events/in_tempY_thresh_falling_en > KernelVersion: 2.6.37 > diff --git a/Documentation/ABI/testing/sysfs-bus-iio-adc-hi8435 > b/Documentation/ABI/testing/sysfs-bus-iio-adc-hi8435 > new file mode 100644 > index 000..e3f1943 > --- /dev/null > +++ b/Documentation/ABI/testing/sysfs-bus-iio-adc-hi8435 > @@ -0,0 +1,39 @@ > +What: > /sys/bus/iio/devices/iio:deviceX/in_voltageY_sensing_mode > +Date:August 2015 > +KernelVersion: 4.2.0 > +Contact: sou...@cogentembedded.com > +Description: > + Program sensor type for threshold detector inputs. > + Could be either "GND-Open" or "Supply-Open" mode. Y is a > + threshold detector input channel. Channels 0..7, 8..15, 16..23 > + and 24..31 has common sensor types. > + > +What: > /sys/bus/iio/devices/iio:deviceX/events/in_voltageY_thresh_falling_value > +Date:August 2015 > +KernelVersion: 4.2.0 > +Contact: sou...@cogentembedded.com > +Description: > + Channel Y low voltage threshold. If sensor input voltage goes > lower then > + this value then the threshold falling event is pushed. > + Depending on in_voltageY_sensing_mode the low voltage threshold > + is separately set for "GND-Open" and "Supply-Open" modes. > + Channels 0..31 have common low threshold values, but could have > different > + sensing_modes. > + The low voltage threshold range is between 2..21V. > + Hysteresis between low and high thresholds can not be lower > then 2 and > + can not be odd. Should note that what happens if it is set to odd. > + > +What: > /sys/bus/iio/devices/iio:deviceX/events/in_voltageY_thresh_rising_value > +Date:August 2015 > +KernelVersion: 4.2.0 > +Contact: sou...@cogentembedded.com > +Description: > + Channel Y high voltage threshold. If sensor input voltage goes > higher then > + this value then the threshold rising event is pushed. > +
[PATCH v4 3/4] iio: adc: hi8435: Holt HI-8435 threshold detector
Add Holt threshold detector driver for HI-8435 chip Signed-off-by: Vladimir Barinov --- Changes in version 2: - Added file sysfs-bus-iio-adc-hi8435 - Changed naming from "discrete ADC" to "threshold detector" - Replaced swab16p/swab32p with be16_to_cpup/be32_to_cpup - Made *_show and *_store functions static - moved out from iio buffers to iio events - removed hi8436/hi8437 chips from the driver - moved from debounce_soft_delay/enable to debounce_interval via IIO_CHAN_INFO_DEBOUNCE_TIME - added name extention "comparator" - moved threshold/hysteresis setup via generic iio event sysfs - added software mask/unmask channel events - added programming sensor outputs while in test mode via IIO_CHAN_INFO_RAW - added channels .ext_info for programming sensing mode Changes in version 3: - fixed typos - moved to match alphabetic order - fixed missed */event/* prefix in the ABI description - added missed colon in sysfs-bus-iio-adc-hi8435 file after "What" - moved in_voltageY_comparator_thresh_either_en and debounce_time to sysfs-bus-iio file - added error checking for hi8435_write[b|w] Changes in version 4: - removed software debounce logic - fixed typo in comment s/threshold/thresholds - removed test_enable sysfs entry - removed *_raw entries - removed extended_name - switched to GPIO descriptor API - added comment describing the need of thresholds initialization - added debugfs_reg_access Documentation/ABI/testing/sysfs-bus-iio| 1 + Documentation/ABI/testing/sysfs-bus-iio-adc-hi8435 | 39 ++ drivers/iio/adc/Kconfig| 11 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/hi8435.c | 535 + 5 files changed, 587 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-hi8435 create mode 100644 drivers/iio/adc/hi8435.c diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index 42d360f..20312a0 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -581,6 +581,7 @@ What: /sys/.../iio:deviceX/events/in_voltageY_supply_thresh_rising_en What: /sys/.../iio:deviceX/events/in_voltageY_supply_thresh_falling_en What: /sys/.../iio:deviceX/events/in_voltageY_thresh_rising_en What: /sys/.../iio:deviceX/events/in_voltageY_thresh_falling_en +What: /sys/.../iio:deviceX/events/in_voltageY_thresh_either_en What: /sys/.../iio:deviceX/events/in_tempY_thresh_rising_en What: /sys/.../iio:deviceX/events/in_tempY_thresh_falling_en KernelVersion: 2.6.37 diff --git a/Documentation/ABI/testing/sysfs-bus-iio-adc-hi8435 b/Documentation/ABI/testing/sysfs-bus-iio-adc-hi8435 new file mode 100644 index 000..e3f1943 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-iio-adc-hi8435 @@ -0,0 +1,39 @@ +What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_sensing_mode +Date: August 2015 +KernelVersion: 4.2.0 +Contact: sou...@cogentembedded.com +Description: + Program sensor type for threshold detector inputs. + Could be either "GND-Open" or "Supply-Open" mode. Y is a + threshold detector input channel. Channels 0..7, 8..15, 16..23 + and 24..31 has common sensor types. + +What: /sys/bus/iio/devices/iio:deviceX/events/in_voltageY_thresh_falling_value +Date: August 2015 +KernelVersion: 4.2.0 +Contact: sou...@cogentembedded.com +Description: + Channel Y low voltage threshold. If sensor input voltage goes lower then + this value then the threshold falling event is pushed. + Depending on in_voltageY_sensing_mode the low voltage threshold + is separately set for "GND-Open" and "Supply-Open" modes. + Channels 0..31 have common low threshold values, but could have different + sensing_modes. + The low voltage threshold range is between 2..21V. + Hysteresis between low and high thresholds can not be lower then 2 and + can not be odd. + +What: /sys/bus/iio/devices/iio:deviceX/events/in_voltageY_thresh_rising_value +Date: August 2015 +KernelVersion: 4.2.0 +Contact: sou...@cogentembedded.com +Description: + Channel Y high voltage threshold. If sensor input voltage goes higher then + this value then the threshold rising event is pushed. + Depending on in_voltageY_sensing_mode the high voltage threshold + is separately set for "GND-Open" and "Supply-Open" modes. + Channels 0..31 have common high threshold values, but could have different + sensing_modes. + The high voltage threshold range is between 3..22V. + Hysteresis between low and high thresholds can not be lower then 2 and +