iio: Add I/Q modifiers
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 22 May 2015 16:17:38 +0000 (18:17 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sat, 23 May 2015 09:49:55 +0000 (10:49 +0100)
I/Q modifiers can be used to denote signals which are represented by a
in-phase and a quadrature component.

The ABI documentation describes the I and Q modifiers for current and
voltage channels for now as those will be the most likely users.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Documentation/ABI/testing/sysfs-bus-iio
drivers/iio/industrialio-core.c
include/uapi/linux/iio/types.h

index f66262c64e2f058e6c1fe490756fae272dea7827..bbed111c31b4ed7658e61ac6b7140284c3035dc6 100644 (file)
@@ -71,6 +71,8 @@ Description:
 
 What:          /sys/bus/iio/devices/iio:deviceX/in_voltageY_raw
 What:          /sys/bus/iio/devices/iio:deviceX/in_voltageY_supply_raw
+What:          /sys/bus/iio/devices/iio:deviceX/in_voltageY_i_raw
+What:          /sys/bus/iio/devices/iio:deviceX/in_voltageY_q_raw
 KernelVersion: 2.6.35
 Contact:       linux-iio@vger.kernel.org
 Description:
@@ -81,6 +83,11 @@ Description:
                unique to allow association with event codes. Units after
                application of scale and offset are millivolts.
 
+               Channels with 'i' and 'q' modifiers always exist in pairs and both
+               channels refer to the same signal. The 'i' channel contains the in-phase
+               component of the signal while the 'q' channel contains the quadrature
+               component.
+
 What:          /sys/bus/iio/devices/iio:deviceX/in_voltageY-voltageZ_raw
 KernelVersion: 2.6.35
 Contact:       linux-iio@vger.kernel.org
@@ -246,8 +253,16 @@ What:              /sys/bus/iio/devices/iio:deviceX/in_accel_y_offset
 What:          /sys/bus/iio/devices/iio:deviceX/in_accel_z_offset
 What:          /sys/bus/iio/devices/iio:deviceX/in_voltageY_offset
 What:          /sys/bus/iio/devices/iio:deviceX/in_voltage_offset
+What:          /sys/bus/iio/devices/iio:deviceX/in_voltageY_i_offset
+What:          /sys/bus/iio/devices/iio:deviceX/in_voltageY_q_offset
+What:          /sys/bus/iio/devices/iio:deviceX/in_voltage_q_offset
+What:          /sys/bus/iio/devices/iio:deviceX/in_voltage_i_offset
 What:          /sys/bus/iio/devices/iio:deviceX/in_currentY_offset
 What:          /sys/bus/iio/devices/iio:deviceX/in_current_offset
+What:          /sys/bus/iio/devices/iio:deviceX/in_currentY_i_offset
+What:          /sys/bus/iio/devices/iio:deviceX/in_currentY_q_offset
+What:          /sys/bus/iio/devices/iio:deviceX/in_current_q_offset
+What:          /sys/bus/iio/devices/iio:deviceX/in_current_i_offset
 What:          /sys/bus/iio/devices/iio:deviceX/in_tempY_offset
 What:          /sys/bus/iio/devices/iio:deviceX/in_temp_offset
 What:          /sys/bus/iio/devices/iio:deviceX/in_pressureY_offset
@@ -273,14 +288,22 @@ Description:
                to the _raw output.
 
 What:          /sys/bus/iio/devices/iio:deviceX/in_voltageY_scale
+What:          /sys/bus/iio/devices/iio:deviceX/in_voltageY_i_scale
+What:          /sys/bus/iio/devices/iio:deviceX/in_voltageY_q_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_voltageY_supply_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_voltage_scale
+What:          /sys/bus/iio/devices/iio:deviceX/in_voltage_i_scale
+What:          /sys/bus/iio/devices/iio:deviceX/in_voltage_q_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_voltage-voltage_scale
 What:          /sys/bus/iio/devices/iio:deviceX/out_voltageY_scale
 What:          /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_currentY_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_currentY_supply_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_current_scale
+What:          /sys/bus/iio/devices/iio:deviceX/in_currentY_i_scale
+What:          /sys/bus/iio/devices/iio:deviceX/in_currentY_q_scale
+What:          /sys/bus/iio/devices/iio:deviceX/in_current_i_scale
+What:          /sys/bus/iio/devices/iio:deviceX/in_current_q_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_accel_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_accel_peak_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_anglvel_scale
@@ -328,6 +351,10 @@ Description:
 
 What           /sys/bus/iio/devices/iio:deviceX/in_voltageY_calibscale
 What           /sys/bus/iio/devices/iio:deviceX/in_voltageY_supply_calibscale
+What           /sys/bus/iio/devices/iio:deviceX/in_voltageY_i_calibscale
+What           /sys/bus/iio/devices/iio:deviceX/in_voltageY_q_calibscale
+What           /sys/bus/iio/devices/iio:deviceX/in_voltage_i_calibscale
+What           /sys/bus/iio/devices/iio:deviceX/in_voltage_q_calibscale
 What           /sys/bus/iio/devices/iio:deviceX/in_voltage_calibscale
 What           /sys/bus/iio/devices/iio:deviceX/in_accel_x_calibscale
 What           /sys/bus/iio/devices/iio:deviceX/in_accel_y_calibscale
@@ -1046,6 +1073,10 @@ What:            /sys/.../iio:deviceX/scan_elements/in_timestamp_en
 What:          /sys/.../iio:deviceX/scan_elements/in_voltageY_supply_en
 What:          /sys/.../iio:deviceX/scan_elements/in_voltageY_en
 What:          /sys/.../iio:deviceX/scan_elements/in_voltageY-voltageZ_en
+What:          /sys/.../iio:deviceX/scan_elements/in_voltageY_i_en
+What:          /sys/.../iio:deviceX/scan_elements/in_voltageY_q_en
+What:          /sys/.../iio:deviceX/scan_elements/in_voltage_i_en
+What:          /sys/.../iio:deviceX/scan_elements/in_voltage_q_en
 What:          /sys/.../iio:deviceX/scan_elements/in_incli_x_en
 What:          /sys/.../iio:deviceX/scan_elements/in_incli_y_en
 What:          /sys/.../iio:deviceX/scan_elements/in_pressureY_en
@@ -1064,6 +1095,10 @@ What:            /sys/.../iio:deviceX/scan_elements/in_incli_type
 What:          /sys/.../iio:deviceX/scan_elements/in_voltageY_type
 What:          /sys/.../iio:deviceX/scan_elements/in_voltage_type
 What:          /sys/.../iio:deviceX/scan_elements/in_voltageY_supply_type
+What:          /sys/.../iio:deviceX/scan_elements/in_voltageY_i_type
+What:          /sys/.../iio:deviceX/scan_elements/in_voltageY_q_type
+What:          /sys/.../iio:deviceX/scan_elements/in_voltage_i_type
+What:          /sys/.../iio:deviceX/scan_elements/in_voltage_q_type
 What:          /sys/.../iio:deviceX/scan_elements/in_timestamp_type
 What:          /sys/.../iio:deviceX/scan_elements/in_pressureY_type
 What:          /sys/.../iio:deviceX/scan_elements/in_pressure_type
@@ -1101,6 +1136,10 @@ Description:
 
 What:          /sys/.../iio:deviceX/scan_elements/in_voltageY_index
 What:          /sys/.../iio:deviceX/scan_elements/in_voltageY_supply_index
+What:          /sys/.../iio:deviceX/scan_elements/in_voltageY_i_index
+What:          /sys/.../iio:deviceX/scan_elements/in_voltageY_q_index
+What:          /sys/.../iio:deviceX/scan_elements/in_voltage_i_index
+What:          /sys/.../iio:deviceX/scan_elements/in_voltage_q_index
 What:          /sys/.../iio:deviceX/scan_elements/in_accel_x_index
 What:          /sys/.../iio:deviceX/scan_elements/in_accel_y_index
 What:          /sys/.../iio:deviceX/scan_elements/in_accel_z_index
@@ -1260,6 +1299,8 @@ Description:
                or without compensation from tilt sensors.
 
 What:          /sys/bus/iio/devices/iio:deviceX/in_currentX_raw
+What:          /sys/bus/iio/devices/iio:deviceX/in_currentX_i_raw
+What:          /sys/bus/iio/devices/iio:deviceX/in_currentX_q_raw
 KernelVersion: 3.18
 Contact:       linux-iio@vger.kernel.org
 Description:
@@ -1268,6 +1309,11 @@ Description:
                present, output should be considered as processed with the
                unit in milliamps.
 
+               Channels with 'i' and 'q' modifiers always exist in pairs and both
+               channels refer to the same signal. The 'i' channel contains the in-phase
+               component of the signal while the 'q' channel contains the quadrature
+               component.
+
 What:          /sys/.../iio:deviceX/in_energy_en
 What:          /sys/.../iio:deviceX/in_distance_en
 What:          /sys/.../iio:deviceX/in_velocity_sqrt(x^2+y^2+z^2)_en
index 9688a88b6198ee0a27a8336519ba3a30776e7e8d..3524b0de872110d31442060a109c5c4243a3f0cf 100644 (file)
@@ -101,6 +101,8 @@ static const char * const iio_modifier_names[] = {
        [IIO_MOD_WALKING] = "walking",
        [IIO_MOD_STILL] = "still",
        [IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z] = "sqrt(x^2+y^2+z^2)",
+       [IIO_MOD_I] = "i",
+       [IIO_MOD_Q] = "q",
 };
 
 /* relies on pairs of these shared then separate */
index 5c460193500544222d6da4fa1ed0e4b3c47e4486..2f8b11722204dcc6528dfab601961ef6834f3e13 100644 (file)
@@ -70,6 +70,8 @@ enum iio_modifier {
        IIO_MOD_WALKING,
        IIO_MOD_STILL,
        IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z,
+       IIO_MOD_I,
+       IIO_MOD_Q,
 };
 
 enum iio_event_type {