]> git.karo-electronics.de Git - linux-beck.git/commitdiff
iio:common: ST_SENSORS_LSM_CHANNELS macro changed
authorDenis CIOCCA <denis.ciocca@st.com>
Mon, 3 Jun 2013 14:58:00 +0000 (15:58 +0100)
committerJonathan Cameron <jic23@kernel.org>
Tue, 4 Jun 2013 17:53:56 +0000 (18:53 +0100)
Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/accel/st_accel_core.c
drivers/iio/gyro/st_gyro_core.c
drivers/iio/magnetometer/st_magn_core.c
include/linux/iio/common/st_sensors.h

index e0f5a3ceba5edee7ce96ed4736f0a4a5f94aa653..40236d5d8753ebadfe7ad91c136af46ca6e58b0e 100644 (file)
 #define ST_ACCEL_3_MULTIREAD_BIT               false
 
 static const struct iio_chan_spec st_accel_12bit_channels[] = {
-       ST_SENSORS_LSM_CHANNELS(IIO_ACCEL, ST_SENSORS_SCAN_X, IIO_MOD_X, IIO_LE,
-               ST_SENSORS_DEFAULT_12_REALBITS, ST_ACCEL_DEFAULT_OUT_X_L_ADDR),
-       ST_SENSORS_LSM_CHANNELS(IIO_ACCEL, ST_SENSORS_SCAN_Y, IIO_MOD_Y, IIO_LE,
-               ST_SENSORS_DEFAULT_12_REALBITS, ST_ACCEL_DEFAULT_OUT_Y_L_ADDR),
-       ST_SENSORS_LSM_CHANNELS(IIO_ACCEL, ST_SENSORS_SCAN_Z, IIO_MOD_Z, IIO_LE,
-               ST_SENSORS_DEFAULT_12_REALBITS, ST_ACCEL_DEFAULT_OUT_Z_L_ADDR),
+       ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_LE, 12, 16,
+                       ST_ACCEL_DEFAULT_OUT_X_L_ADDR),
+       ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_LE, 12, 16,
+                       ST_ACCEL_DEFAULT_OUT_Y_L_ADDR),
+       ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_LE, 12, 16,
+                       ST_ACCEL_DEFAULT_OUT_Z_L_ADDR),
        IIO_CHAN_SOFT_TIMESTAMP(3)
 };
 
 static const struct iio_chan_spec st_accel_16bit_channels[] = {
-       ST_SENSORS_LSM_CHANNELS(IIO_ACCEL, ST_SENSORS_SCAN_X, IIO_MOD_X, IIO_LE,
-               ST_SENSORS_DEFAULT_16_REALBITS, ST_ACCEL_DEFAULT_OUT_X_L_ADDR),
-       ST_SENSORS_LSM_CHANNELS(IIO_ACCEL, ST_SENSORS_SCAN_Y, IIO_MOD_Y, IIO_LE,
-               ST_SENSORS_DEFAULT_16_REALBITS, ST_ACCEL_DEFAULT_OUT_Y_L_ADDR),
-       ST_SENSORS_LSM_CHANNELS(IIO_ACCEL, ST_SENSORS_SCAN_Z, IIO_MOD_Z, IIO_LE,
-               ST_SENSORS_DEFAULT_16_REALBITS, ST_ACCEL_DEFAULT_OUT_Z_L_ADDR),
+       ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_LE, 16, 16,
+                       ST_ACCEL_DEFAULT_OUT_X_L_ADDR),
+       ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_LE, 16, 16,
+                       ST_ACCEL_DEFAULT_OUT_Y_L_ADDR),
+       ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_LE, 16, 16,
+                       ST_ACCEL_DEFAULT_OUT_Z_L_ADDR),
        IIO_CHAN_SOFT_TIMESTAMP(3)
 };
 
index fa9b242199870facf4157251774268456cb81509..9bae46bcccee94d4ee9dc5d621dea2ec9f73b7a4 100644 (file)
 #define ST_GYRO_2_MULTIREAD_BIT                        true
 
 static const struct iio_chan_spec st_gyro_16bit_channels[] = {
-       ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL, ST_SENSORS_SCAN_X,
-               IIO_MOD_X, IIO_LE, ST_SENSORS_DEFAULT_16_REALBITS,
-                                               ST_GYRO_DEFAULT_OUT_X_L_ADDR),
-       ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL, ST_SENSORS_SCAN_Y,
-               IIO_MOD_Y, IIO_LE, ST_SENSORS_DEFAULT_16_REALBITS,
-                                               ST_GYRO_DEFAULT_OUT_Y_L_ADDR),
-       ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL, ST_SENSORS_SCAN_Z,
-               IIO_MOD_Z, IIO_LE, ST_SENSORS_DEFAULT_16_REALBITS,
-                                               ST_GYRO_DEFAULT_OUT_Z_L_ADDR),
+       ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL,
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_LE, 16, 16,
+                       ST_GYRO_DEFAULT_OUT_X_L_ADDR),
+       ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL,
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_LE, 16, 16,
+                       ST_GYRO_DEFAULT_OUT_Y_L_ADDR),
+       ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL,
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_LE, 16, 16,
+                       ST_GYRO_DEFAULT_OUT_Z_L_ADDR),
        IIO_CHAN_SOFT_TIMESTAMP(3)
 };
 
index 16f0d6df239f0be75e64c388b38b3760ace5d901..715d61681df3bcd23a10ad9d90260b7cd5d544aa 100644 (file)
 #define ST_MAGN_2_OUT_Z_L_ADDR                 0x2c
 
 static const struct iio_chan_spec st_magn_16bit_channels[] = {
-       ST_SENSORS_LSM_CHANNELS(IIO_MAGN, ST_SENSORS_SCAN_X, IIO_MOD_X, IIO_LE,
-               ST_SENSORS_DEFAULT_16_REALBITS, ST_MAGN_DEFAULT_OUT_X_L_ADDR),
-       ST_SENSORS_LSM_CHANNELS(IIO_MAGN, ST_SENSORS_SCAN_Y, IIO_MOD_Y, IIO_LE,
-               ST_SENSORS_DEFAULT_16_REALBITS, ST_MAGN_DEFAULT_OUT_Y_L_ADDR),
-       ST_SENSORS_LSM_CHANNELS(IIO_MAGN, ST_SENSORS_SCAN_Z, IIO_MOD_Z, IIO_LE,
-               ST_SENSORS_DEFAULT_16_REALBITS, ST_MAGN_DEFAULT_OUT_Z_L_ADDR),
+       ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_LE, 16, 16,
+                       ST_MAGN_DEFAULT_OUT_X_L_ADDR),
+       ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_LE, 16, 16,
+                       ST_MAGN_DEFAULT_OUT_Y_L_ADDR),
+       ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_LE, 16, 16,
+                       ST_MAGN_DEFAULT_OUT_Z_L_ADDR),
        IIO_CHAN_SOFT_TIMESTAMP(3)
 };
 
 static const struct iio_chan_spec st_magn_2_16bit_channels[] = {
-       ST_SENSORS_LSM_CHANNELS(IIO_MAGN, ST_SENSORS_SCAN_X, IIO_MOD_X, IIO_LE,
-               ST_SENSORS_DEFAULT_16_REALBITS, ST_MAGN_2_OUT_X_L_ADDR),
-       ST_SENSORS_LSM_CHANNELS(IIO_MAGN, ST_SENSORS_SCAN_Y, IIO_MOD_Y, IIO_LE,
-               ST_SENSORS_DEFAULT_16_REALBITS, ST_MAGN_2_OUT_Y_L_ADDR),
-       ST_SENSORS_LSM_CHANNELS(IIO_MAGN, ST_SENSORS_SCAN_Z, IIO_MOD_Z, IIO_LE,
-               ST_SENSORS_DEFAULT_16_REALBITS, ST_MAGN_2_OUT_Z_L_ADDR),
+       ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_LE, 16, 16,
+                       ST_MAGN_2_OUT_X_L_ADDR),
+       ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_LE, 16, 16,
+                       ST_MAGN_2_OUT_Y_L_ADDR),
+       ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_LE, 16, 16,
+                       ST_MAGN_2_OUT_Z_L_ADDR),
        IIO_CHAN_SOFT_TIMESTAMP(3)
 };
 
index 172c5b23cb840d5270fde51d9809e321f012211a..5ffd763702dcc3346f49012d7c2fc7d4d8d54f8b 100644 (file)
@@ -30,8 +30,6 @@
 #define ST_SENSORS_SCAN_X                      0
 #define ST_SENSORS_SCAN_Y                      1
 #define ST_SENSORS_SCAN_Z                      2
-#define ST_SENSORS_DEFAULT_12_REALBITS         12
-#define ST_SENSORS_DEFAULT_16_REALBITS         16
 #define ST_SENSORS_DEFAULT_POWER_ON_VALUE      0x01
 #define ST_SENSORS_DEFAULT_POWER_OFF_VALUE     0x00
 #define ST_SENSORS_DEFAULT_WAI_ADDRESS         0x0f
 #define ST_SENSORS_MAX_NAME                    17
 #define ST_SENSORS_MAX_4WAI                    7
 
-#define ST_SENSORS_LSM_CHANNELS(device_type, index, mod, endian, bits, addr) \
+#define ST_SENSORS_LSM_CHANNELS(device_type, mask, index, mod, \
+                                       ch2, s, endian, rbits, sbits, addr) \
 { \
        .type = device_type, \
-       .modified = 1, \
-       .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
-                       BIT(IIO_CHAN_INFO_SCALE), \
+       .modified = mod, \
+       .info_mask_separate = mask, \
        .scan_index = index, \
-       .channel2 = mod, \
+       .channel2 = ch2, \
        .address = addr, \
        .scan_type = { \
-               .sign = 's', \
-               .realbits = bits, \
-               .shift = 16 - bits, \
-               .storagebits = 16, \
+               .sign = s, \
+               .realbits = rbits, \
+               .shift = sbits - rbits, \
+               .storagebits = sbits, \
                .endianness = endian, \
        }, \
 }