aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/accel
diff options
context:
space:
mode:
authorDenis CIOCCA <denis.ciocca@st.com>2013-06-03 10:58:00 -0400
committerJonathan Cameron <jic23@kernel.org>2013-06-05 13:41:23 -0400
commit607a568ab69c5ac345a286267a27294888f8bb5f (patch)
treef52d27c3f06725c7078d6fe876a3a194e45322b4 /drivers/iio/accel
parent762011d6193f8b9af9b491ded87dde3221d0600a (diff)
iio:common: Removed stuff macros, added num_data_channels on st_sensors struct and added support on one-shot sysfs reads to 3 byte channel
This patch introduce num_data_channels variable on st_sensors struct to manage different type of channels (size or number) in st_sensors_get_buffer_element function. Removed ST_SENSORS_NUMBER_DATA_CHANNELS and ST_SENSORS_BYTE_FOR_CHANNEL and used struct iio_chan_spec const *ch to catch data. Added 3 byte channel data support on one-shot reads. Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/accel')
-rw-r--r--drivers/iio/accel/st_accel_core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index 40236d5d8753..4aec121261d7 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -26,6 +26,8 @@
26#include <linux/iio/common/st_sensors.h> 26#include <linux/iio/common/st_sensors.h>
27#include "st_accel.h" 27#include "st_accel.h"
28 28
29#define ST_ACCEL_NUMBER_DATA_CHANNELS 3
30
29/* DEFAULT VALUE FOR SENSORS */ 31/* DEFAULT VALUE FOR SENSORS */
30#define ST_ACCEL_DEFAULT_OUT_X_L_ADDR 0x28 32#define ST_ACCEL_DEFAULT_OUT_X_L_ADDR 0x28
31#define ST_ACCEL_DEFAULT_OUT_Y_L_ADDR 0x2a 33#define ST_ACCEL_DEFAULT_OUT_Y_L_ADDR 0x2a
@@ -454,6 +456,7 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
454 if (err < 0) 456 if (err < 0)
455 goto st_accel_common_probe_error; 457 goto st_accel_common_probe_error;
456 458
459 adata->num_data_channels = ST_ACCEL_NUMBER_DATA_CHANNELS;
457 adata->multiread_bit = adata->sensor->multi_read_bit; 460 adata->multiread_bit = adata->sensor->multi_read_bit;
458 indio_dev->channels = adata->sensor->ch; 461 indio_dev->channels = adata->sensor->ch;
459 indio_dev->num_channels = ST_SENSORS_NUMBER_ALL_CHANNELS; 462 indio_dev->num_channels = ST_SENSORS_NUMBER_ALL_CHANNELS;