summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/iio/Documentation')
-rw-r--r--drivers/staging/iio/Documentation/dac/max51741
-rw-r--r--drivers/staging/iio/Documentation/generic_buffer.c66
-rw-r--r--drivers/staging/iio/Documentation/iio_utils.h63
-rw-r--r--drivers/staging/iio/Documentation/sysfs-bus-iio81
-rw-r--r--drivers/staging/iio/Documentation/sysfs-bus-iio-trigger-sysfs11
5 files changed, 217 insertions, 45 deletions
diff --git a/drivers/staging/iio/Documentation/dac/max517 b/drivers/staging/iio/Documentation/dac/max517
new file mode 100644
index 000000000000..e60ec2f91a7a
--- /dev/null
+++ b/drivers/staging/iio/Documentation/dac/max517
@@ -0,0 +1,41 @@
+Kernel driver max517
+====================
+
+Supported chips:
+ * Maxim MAX517, MAX518, MAX519
+ Prefix: 'max517'
+ Datasheet: Publicly available at the Maxim website
+ http://www.maxim-ic.com/
+
+Author:
+ Roland Stigge <stigge@antcom.de>
+
+Description
+-----------
+
+The Maxim MAX517/518/519 is an 8-bit DAC on the I2C bus. The following table
+shows the different feature sets of the variants MAX517, MAX518 and MAX519:
+
+Feature MAX517 MAX518 MAX519
+--------------------------------------------------------------------------
+One output channel X
+Two output channels X X
+Simultaneous output updates X X
+Supply voltage as reference X
+Separate reference input X
+Reference input for each DAC X
+
+Via the iio sysfs interface, there are three attributes available: out1_raw,
+out2_raw and out12_raw. With out1_raw and out2_raw, the current output values
+(0..255) of the DACs can be written to the device. out12_raw can be used to set
+both output channel values simultaneously.
+
+With MAX517, only out1_raw is available.
+
+Via out1_scale (and where appropriate, out2_scale), the current scaling factor
+in mV can be read.
+
+When the operating system goes to a power down state, the Power Down function
+of the chip is activated, reducing the supply current to 4uA.
+
+On power-up, the device is in 0V-output state.
diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c
index df23aeb9d529..3cc18ab4ebfd 100644
--- a/drivers/staging/iio/Documentation/generic_buffer.c
+++ b/drivers/staging/iio/Documentation/generic_buffer.c
@@ -26,11 +26,9 @@
#include <sys/stat.h>
#include <sys/dir.h>
#include <linux/types.h>
+#include <string.h>
#include "iio_utils.h"
-const int buf_len = 128;
-const int num_loops = 2;
-
/**
* size_from_channelarray() - calculate the storage size of a scan
* @channels: the channel info array
@@ -118,6 +116,11 @@ void process_scan(char *data,
int main(int argc, char **argv)
{
+ unsigned long num_loops = 2;
+ unsigned long timedelay = 1000000;
+ unsigned long buf_len = 128;
+
+
int ret, c, i, j, toread;
FILE *fp_ev;
@@ -134,10 +137,12 @@ int main(int argc, char **argv)
int dev_num, trig_num;
char *buffer_access, *buffer_event;
int scan_size;
+ int noevents = 0;
+ char *dummy;
struct iio_channel_info *infoarray;
- while ((c = getopt(argc, argv, "t:n:")) != -1) {
+ while ((c = getopt(argc, argv, "l:w:c:et:n:")) != -1) {
switch (c) {
case 'n':
device_name = optarg;
@@ -146,11 +151,26 @@ int main(int argc, char **argv)
trigger_name = optarg;
datardytrigger = 0;
break;
+ case 'e':
+ noevents = 1;
+ break;
+ case 'c':
+ num_loops = strtoul(optarg, &dummy, 10);
+ break;
+ case 'w':
+ timedelay = strtoul(optarg, &dummy, 10);
+ break;
+ case 'l':
+ buf_len = strtoul(optarg, &dummy, 10);
+ break;
case '?':
return -1;
}
}
+ if (device_name == NULL)
+ return -1;
+
/* Find the device requested */
dev_num = find_type_by_name(device_name, "device");
if (dev_num < 0) {
@@ -260,22 +280,30 @@ int main(int argc, char **argv)
/* Wait for events 10 times */
for (j = 0; j < num_loops; j++) {
- read_size = fread(&dat, 1, sizeof(struct iio_event_data),
- fp_ev);
- switch (dat.id) {
- case IIO_EVENT_CODE_RING_100_FULL:
- toread = buf_len;
- break;
- case IIO_EVENT_CODE_RING_75_FULL:
- toread = buf_len*3/4;
- break;
- case IIO_EVENT_CODE_RING_50_FULL:
- toread = buf_len/2;
- break;
- default:
- printf("Unexpecteded event code\n");
- continue;
+ if (!noevents) {
+ read_size = fread(&dat,
+ 1,
+ sizeof(struct iio_event_data),
+ fp_ev);
+ switch (dat.id) {
+ case IIO_EVENT_CODE_RING_100_FULL:
+ toread = buf_len;
+ break;
+ case IIO_EVENT_CODE_RING_75_FULL:
+ toread = buf_len*3/4;
+ break;
+ case IIO_EVENT_CODE_RING_50_FULL:
+ toread = buf_len/2;
+ break;
+ default:
+ printf("Unexpecteded event code\n");
+ continue;
+ }
+ } else {
+ usleep(timedelay);
+ toread = 64;
}
+
read_size = read(fp,
data,
toread*scan_size);
diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h
index 03724246b95a..8095727b3966 100644
--- a/drivers/staging/iio/Documentation/iio_utils.h
+++ b/drivers/staging/iio/Documentation/iio_utils.h
@@ -51,7 +51,7 @@ static int iioutils_break_up_name(const char *full_name,
w = working;
r = working;
- while(*r != '\0') {
+ while (*r != '\0') {
if (!isdigit(*r)) {
*w = *r;
w++;
@@ -113,7 +113,7 @@ inline int iioutils_get_type(unsigned *is_signed,
DIR *dp;
char *scan_el_dir, *builtname, *builtname_generic, *filename = 0;
char signchar;
- unsigned sizeint, padint;
+ unsigned padint;
const struct dirent *ent;
ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir);
@@ -159,7 +159,7 @@ inline int iioutils_get_type(unsigned *is_signed,
fscanf(sysfsfp,
"%c%u/%u", &signchar, bits_used, &padint);
*bytes = padint / 8;
- if (sizeint == 64)
+ if (*bits_used == 64)
*mask = ~0;
else
*mask = (1 << *bits_used) - 1;
@@ -242,6 +242,26 @@ error_ret:
return ret;
}
+/**
+ * bsort_channel_array_by_index() - reorder so that the array is in index order
+ *
+ **/
+
+inline void bsort_channel_array_by_index(struct iio_channel_info **ci_array,
+ int cnt)
+{
+
+ struct iio_channel_info temp;
+ int x, y;
+
+ for (x = 0; x < cnt; x++)
+ for (y = 0; y < (cnt - 1); y++)
+ if ((*ci_array)[y].index > (*ci_array)[y+1].index) {
+ temp = (*ci_array)[y + 1];
+ (*ci_array)[y + 1] = (*ci_array)[y];
+ (*ci_array)[y] = temp;
+ }
+}
/**
* build_channel_array() - function to figure out what channels are present
@@ -254,7 +274,7 @@ inline int build_channel_array(const char *device_dir,
{
DIR *dp;
FILE *sysfsfp;
- int count = 0, temp, i;
+ int count, temp, i;
struct iio_channel_info *current;
int ret;
const struct dirent *ent;
@@ -293,12 +313,13 @@ inline int build_channel_array(const char *device_dir,
fclose(sysfsfp);
free(filename);
}
- *ci_array = malloc(sizeof(**ci_array)*(*counter));
+ *ci_array = malloc(sizeof(**ci_array) * (*counter));
if (*ci_array == NULL) {
ret = -ENOMEM;
goto error_close_dir;
}
seekdir(dp, 0);
+ count = 0;
while (ent = readdir(dp), ent != NULL) {
if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"),
"_en") == 0) {
@@ -319,7 +340,13 @@ inline int build_channel_array(const char *device_dir,
}
fscanf(sysfsfp, "%u", &current->enabled);
fclose(sysfsfp);
- free(filename);
+
+ if (!current->enabled) {
+ free(filename);
+ count--;
+ continue;
+ }
+
current->scale = 1.0;
current->offset = 0;
current->name = strndup(ent->d_name,
@@ -374,31 +401,15 @@ inline int build_channel_array(const char *device_dir,
current->generic_name);
}
}
- /* reorder so that the array is in index order*/
- current = malloc(sizeof(**ci_array)**counter);
- if (current == NULL) {
- ret = -ENOMEM;
- goto error_cleanup_array;
- }
+
closedir(dp);
- count = 0;
- temp = 0;
- while (count < *counter)
- for (i = 0; i < *counter; i++)
- if ((*ci_array)[i].index == temp) {
- memcpy(&current[count++],
- &(*ci_array)[i],
- sizeof(*current));
- temp++;
- break;
- }
- free(*ci_array);
- *ci_array = current;
+ /* reorder so that the array is in index order */
+ bsort_channel_array_by_index(ci_array, *counter);
return 0;
error_cleanup_array:
- for (i = count - 1; i >= 0; i++)
+ for (i = count - 1; i >= 0; i--)
free((*ci_array)[i].name);
free(*ci_array);
error_close_dir:
diff --git a/drivers/staging/iio/Documentation/sysfs-bus-iio b/drivers/staging/iio/Documentation/sysfs-bus-iio
index 2dde97de75f8..4915aee14d88 100644
--- a/drivers/staging/iio/Documentation/sysfs-bus-iio
+++ b/drivers/staging/iio/Documentation/sysfs-bus-iio
@@ -53,6 +53,31 @@ Description:
When the internal sampling clock can only take a small
discrete set of values, this file lists those available.
+What: /sys/bus/iio/devices/deviceX/range
+KernelVersion: 2.6.38
+Contact: linux-iio@vger.kernel.org
+Description:
+ Hardware dependent ADC Full Scale Range in mVolt.
+
+What: /sys/bus/iio/devices/deviceX/range_available
+KernelVersion: 2.6.38
+Contact: linux-iio@vger.kernel.org
+Description:
+ Hardware dependent supported vales for ADC Full Scale Range.
+
+What: /sys/bus/iio/devices/deviceX/oversampling_ratio
+KernelVersion: 2.6.38
+Contact: linux-iio@vger.kernel.org
+Description:
+ Hardware dependent ADC oversampling. Controls the sampling ratio
+ of the digital filter if available.
+
+What: /sys/bus/iio/devices/deviceX/oversampling_ratio_available
+KernelVersion: 2.6.38
+Contact: linux-iio@vger.kernel.org
+Description:
+ Hardware dependent values supported by the oversampling filter.
+
What: /sys/bus/iio/devices/deviceX/inY_raw
What: /sys/bus/iio/devices/deviceX/inY_supply_raw
KernelVersion: 2.6.35
@@ -86,6 +111,12 @@ Description:
sensor is associated with one part of a compound device (e.g.
a gyroscope axis).
+What: /sys/bus/iio/devices/deviceX/tempX_input
+KernelVersion: 2.6.38
+Contact: linux-iio@vger.kernel.org
+Description:
+ Scaled temperature measurement in milli degrees Celsius.
+
What: /sys/bus/iio/devices/deviceX/accel_x_raw
What: /sys/bus/iio/devices/deviceX/accel_y_raw
What: /sys/bus/iio/devices/deviceX/accel_z_raw
@@ -168,6 +199,7 @@ Description:
What: /sys/bus/iio/devices/deviceX/inY_scale
What: /sys/bus/iio/devices/deviceX/inY_supply_scale
What: /sys/bus/iio/devices/deviceX/in_scale
+What: /sys/bus/iio/devices/deviceX/outY_scale
What: /sys/bus/iio/devices/deviceX/accel_scale
What: /sys/bus/iio/devices/deviceX/accel_peak_scale
What: /sys/bus/iio/devices/deviceX/gyro_scale
@@ -222,6 +254,55 @@ Description:
If a discrete set of scale values are available, they
are listed in this attribute.
+What: /sys/bus/iio/devices/deviceX/outY_raw
+KernelVersion: 2.6.37
+Contact: linux-iio@vger.kernel.org
+Description:
+ Raw (unscaled, no bias etc.) output voltage for
+ channel Y. The number must always be specified and
+ unique if the output corresponds to a single channel.
+
+What: /sys/bus/iio/devices/deviceX/outY&Z_raw
+KernelVersion: 2.6.37
+Contact: linux-iio@vger.kernel.org
+Description:
+ Raw (unscaled, no bias etc.) output voltage for an aggregate of
+ channel Y, channel Z, etc. This interface is available in cases
+ where a single output sets the value for multiple channels
+ simultaneously.
+
+What: /sys/bus/iio/devices/deviceX/outY_powerdown_mode
+What: /sys/bus/iio/devices/deviceX/out_powerdown_mode
+KernelVersion: 2.6.38
+Contact: linux-iio@vger.kernel.org
+Description:
+ Specifies the output powerdown mode.
+ DAC output stage is disconnected from the amplifier and
+ 1kohm_to_gnd: connected to ground via an 1kOhm resistor
+ 100kohm_to_gnd: connected to ground via an 100kOhm resistor
+ three_state: left floating
+ For a list of available output power down options read
+ outX_powerdown_mode_available. If Y is not present the
+ mode is shared across all outputs.
+
+What: /sys/bus/iio/devices/deviceX/outY_powerdown_mode_available
+What: /sys/bus/iio/devices/deviceX/out_powerdown_mode_available
+KernelVersion: 2.6.38
+Contact: linux-iio@vger.kernel.org
+Description:
+ Lists all available output power down modes.
+ If Y is not present the mode is shared across all outputs.
+
+What: /sys/bus/iio/devices/deviceX/outY_powerdown
+What: /sys/bus/iio/devices/deviceX/out_powerdown
+KernelVersion: 2.6.38
+Contact: linux-iio@vger.kernel.org
+Description:
+ Writing 1 causes output Y to enter the power down mode specified
+ by the corresponding outY_powerdown_mode. Clearing returns to
+ normal operation. Y may be suppressed if all outputs are
+ controlled together.
+
What: /sys/bus/iio/devices/deviceX/deviceX:eventY
KernelVersion: 2.6.35
Contact: linux-iio@vger.kernel.org
diff --git a/drivers/staging/iio/Documentation/sysfs-bus-iio-trigger-sysfs b/drivers/staging/iio/Documentation/sysfs-bus-iio-trigger-sysfs
new file mode 100644
index 000000000000..5235e6c749ab
--- /dev/null
+++ b/drivers/staging/iio/Documentation/sysfs-bus-iio-trigger-sysfs
@@ -0,0 +1,11 @@
+What: /sys/bus/iio/devices/triggerX/trigger_now
+KernelVersion: 2.6.38
+Contact: linux-iio@vger.kernel.org
+Description:
+ This file is provided by the iio-trig-sysfs stand-alone trigger
+ driver. Writing this file with any value triggers an event
+ driven driver, associated with this trigger, to capture data
+ into an in kernel buffer. This approach can be valuable during
+ automated testing or in situations, where other trigger methods
+ are not applicable. For example no RTC or spare GPIOs.
+ X is the IIO index of the trigger.