aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 15:11:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 15:11:39 -0400
commitdef7cb8cd4e3258db88050eaaca5438bcc3dafca (patch)
tree23fcf90ddc98acec07bb115c2f7740c21cf44a84 /include/linux
parent06d2fe153b9b35e57221e35831a26918f462db68 (diff)
parente1878957b4676a17cf398f7f5723b365e9a2ca48 (diff)
Merge tag 'staging-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging tree update from Greg Kroah-Hartman: "Here is the big staging tree update for the 3.7-rc1 merge window. There are a few patches in here that are outside of the staging area, namely HID and IIO patches, but all of them have been acked by the relevant subsystem maintainers. The IIO stuff is still coming in through this tree as it hasn't entirely moved out of the staging tree, but is almost there. Other than that, there wa a ton of work on the comedi drivers to make them more readable and the correct style. Doing that removed a lot of code, but we added a new driver to the staging tree, so we didn't end up with a net reduction this time around: 662 files changed, 51649 insertions(+), 26582 deletions(-) All of these patches have been in the linux-next tree already. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" * tag 'staging-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1094 commits) staging: comedi: jr3_pci: fix iomem dereference staging: comedi: drivers: use comedi_fc.h cmdtest helpers Staging: winbond: usb_free_urb(NULL) is safe Staging: winbond: checkpatch cleanup Staging: winbond: Removed undesired spaces, lines and tabs Staging: winbond: Typo corrections in comments Staging: winbond: Changed c99 comments to c89 comments staging: r8712u: Do not queue cloned skb staging: comedi: ni_mio_common: always lock in ni_ai_poll() staging: comedi: s626: add FIXME comment staging: comedi: s626: don't dereference insn->data staging: comedi: s526: fix if() check in s526_gpct_winsn() staging: comedi: s626: cleanup comments in s626_initialize() staging: comedi: s626: remove clear of kzalloc'ed data staging: comedi: s626: remove 'WDInterval' from private data staging: comedi: s626: remove 'ChargeEnabled' from private data staging: comedi: s626: remove 'IsBoardRevA' comment staging: comedi: s626: #if 0 out the "SAA7146 BUG WORKAROUND" staging: comedi: s626: remove 'allocatedBuf' from private data staging: comedi: s626: add final attach message ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/hid-sensor-hub.h160
-rw-r--r--include/linux/hid-sensor-ids.h112
-rw-r--r--include/linux/iio/adc/ad_sigma_delta.h173
-rw-r--r--include/linux/iio/buffer.h6
-rw-r--r--include/linux/iio/consumer.h44
-rw-r--r--include/linux/iio/iio.h65
-rw-r--r--include/linux/iio/kfifo_buf.h3
-rw-r--r--include/linux/iio/machine.h5
-rw-r--r--include/linux/iio/trigger.h13
-rw-r--r--include/linux/iio/trigger_consumer.h11
-rw-r--r--include/linux/iio/types.h1
-rw-r--r--include/linux/mod_devicetable.h8
-rw-r--r--include/linux/platform_data/ad5755.h103
-rw-r--r--include/linux/platform_data/ad7791.h17
-rw-r--r--include/linux/power/generic-adc-battery.h29
15 files changed, 730 insertions, 20 deletions
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
new file mode 100644
index 000000000000..0aa5f4c42ae6
--- /dev/null
+++ b/include/linux/hid-sensor-hub.h
@@ -0,0 +1,160 @@
1/*
2 * HID Sensors Driver
3 * Copyright (c) 2012, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19#ifndef _HID_SENSORS_HUB_H
20#define _HID_SENSORS_HUB_H
21
22#include <linux/hid.h>
23#include <linux/hid-sensor-ids.h>
24
25/**
26 * struct hid_sensor_hub_attribute_info - Attribute info
27 * @usage_id: Parent usage id of a physical device.
28 * @attrib_id: Attribute id for this attribute.
29 * @report_id: Report id in which this information resides.
30 * @index: Field index in the report.
31 * @units: Measurment unit for this attribute.
32 * @unit_expo: Exponent used in the data.
33 * @size: Size in bytes for data size.
34 */
35struct hid_sensor_hub_attribute_info {
36 u32 usage_id;
37 u32 attrib_id;
38 s32 report_id;
39 s32 index;
40 s32 units;
41 s32 unit_expo;
42 s32 size;
43};
44
45/**
46 * struct hid_sensor_hub_device - Stores the hub instance data
47 * @hdev: Stores the hid instance.
48 * @vendor_id: Vendor id of hub device.
49 * @product_id: Product id of hub device.
50 */
51struct hid_sensor_hub_device {
52 struct hid_device *hdev;
53 u32 vendor_id;
54 u32 product_id;
55};
56
57/**
58 * struct hid_sensor_hub_callbacks - Client callback functions
59 * @pdev: Platform device instance of the client driver.
60 * @suspend: Suspend callback.
61 * @resume: Resume callback.
62 * @capture_sample: Callback to get a sample.
63 * @send_event: Send notification to indicate all samples are
64 * captured, process and send event
65 */
66struct hid_sensor_hub_callbacks {
67 struct platform_device *pdev;
68 int (*suspend)(struct hid_sensor_hub_device *hsdev, void *priv);
69 int (*resume)(struct hid_sensor_hub_device *hsdev, void *priv);
70 int (*capture_sample)(struct hid_sensor_hub_device *hsdev,
71 u32 usage_id, size_t raw_len, char *raw_data,
72 void *priv);
73 int (*send_event)(struct hid_sensor_hub_device *hsdev, u32 usage_id,
74 void *priv);
75};
76
77/* Registration functions */
78
79/**
80* sensor_hub_register_callback() - Register client callbacks
81* @hsdev: Hub device instance.
82* @usage_id: Usage id of the client (E.g. 0x200076 for Gyro).
83* @usage_callback: Callback function storage
84*
85* Used to register callbacks by client processing drivers. Sensor
86* hub core driver will call these callbacks to offload processing
87* of data streams and notifications.
88*/
89int sensor_hub_register_callback(struct hid_sensor_hub_device *hsdev,
90 u32 usage_id,
91 struct hid_sensor_hub_callbacks *usage_callback);
92
93/**
94* sensor_hub_remove_callback() - Remove client callbacks
95* @hsdev: Hub device instance.
96* @usage_id: Usage id of the client (E.g. 0x200076 for Gyro).
97*
98* If there is a callback registred, this call will remove that
99* callbacks, so that it will stop data and event notifications.
100*/
101int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev,
102 u32 usage_id);
103
104
105/* Hid sensor hub core interfaces */
106
107/**
108* sensor_hub_input_get_attribute_info() - Get an attribute information
109* @hsdev: Hub device instance.
110* @type: Type of this attribute, input/output/feature
111* @usage_id: Attribute usage id of parent physical device as per spec
112* @attr_usage_id: Attribute usage id as per spec
113* @info: return information about attribute after parsing report
114*
115* Parses report and returns the attribute information such as report id,
116* field index, units and exponet etc.
117*/
118int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
119 u8 type,
120 u32 usage_id, u32 attr_usage_id,
121 struct hid_sensor_hub_attribute_info *info);
122
123/**
124* sensor_hub_input_attr_get_raw_value() - Synchronous read request
125* @usage_id: Attribute usage id of parent physical device as per spec
126* @attr_usage_id: Attribute usage id as per spec
127* @report_id: Report id to look for
128*
129* Issues a synchronous read request for an input attribute. Returns
130* data upto 32 bits. Since client can get events, so this call should
131* not be used for data paths, this will impact performance.
132*/
133
134int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
135 u32 usage_id,
136 u32 attr_usage_id, u32 report_id);
137/**
138* sensor_hub_set_feature() - Feature set request
139* @report_id: Report id to look for
140* @field_index: Field index inside a report
141* @value: Value to set
142*
143* Used to set a field in feature report. For example this can set polling
144* interval, sensitivity, activate/deactivate state.
145*/
146int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
147 u32 field_index, s32 value);
148
149/**
150* sensor_hub_get_feature() - Feature get request
151* @report_id: Report id to look for
152* @field_index: Field index inside a report
153* @value: Place holder for return value
154*
155* Used to get a field in feature report. For example this can get polling
156* interval, sensitivity, activate/deactivate state.
157*/
158int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
159 u32 field_index, s32 *value);
160#endif
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
new file mode 100644
index 000000000000..ca8d7e94eb3c
--- /dev/null
+++ b/include/linux/hid-sensor-ids.h
@@ -0,0 +1,112 @@
1/*
2 * HID Sensors Driver
3 * Copyright (c) 2012, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19#ifndef _HID_SENSORS_IDS_H
20#define _HID_SENSORS_IDS_H
21
22#define HID_UP_SENSOR 0x00200000
23#define HID_MAX_PHY_DEVICES 0xFF
24
25/* Accel 3D (200073) */
26#define HID_USAGE_SENSOR_ACCEL_3D 0x200073
27#define HID_USAGE_SENSOR_ACCEL_X_AXIS 0x200453
28#define HID_USAGE_SENSOR_ACCEL_Y_AXIS 0x200454
29#define HID_USAGE_SENSOR_ACCEL_Z_AXIS 0x200455
30
31/* ALS (200041) */
32#define HID_USAGE_SENSOR_ALS 0x200041
33#define HID_USAGE_SENSOR_LIGHT_ILLUM 0x2004d1
34
35/* Gyro 3D: (200076) */
36#define HID_USAGE_SENSOR_GYRO_3D 0x200076
37#define HID_USAGE_SENSOR_ANGL_VELOCITY_X_AXIS 0x200457
38#define HID_USAGE_SENSOR_ANGL_VELOCITY_Y_AXIS 0x200458
39#define HID_USAGE_SENSOR_ANGL_VELOCITY_Z_AXIS 0x200459
40
41/*ORIENTATION: Compass 3D: (200083) */
42#define HID_USAGE_SENSOR_COMPASS_3D 0x200083
43#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING 0x200471
44#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_X 0x200472
45#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_Y 0x200473
46#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_Z 0x200474
47
48#define HID_USAGE_SENSOR_ORIENT_COMP_MAGN_NORTH 0x200475
49#define HID_USAGE_SENSOR_ORIENT_COMP_TRUE_NORTH 0x200476
50#define HID_USAGE_SENSOR_ORIENT_MAGN_NORTH 0x200477
51#define HID_USAGE_SENSOR_ORIENT_TRUE_NORTH 0x200478
52
53#define HID_USAGE_SENSOR_ORIENT_DISTANCE 0x200479
54#define HID_USAGE_SENSOR_ORIENT_DISTANCE_X 0x20047A
55#define HID_USAGE_SENSOR_ORIENT_DISTANCE_Y 0x20047B
56#define HID_USAGE_SENSOR_ORIENT_DISTANCE_Z 0x20047C
57#define HID_USAGE_SENSOR_ORIENT_DISTANCE_OUT_OF_RANGE 0x20047D
58#define HID_USAGE_SENSOR_ORIENT_TILT 0x20047E
59#define HID_USAGE_SENSOR_ORIENT_TILT_X 0x20047F
60#define HID_USAGE_SENSOR_ORIENT_TILT_Y 0x200480
61#define HID_USAGE_SENSOR_ORIENT_TILT_Z 0x200481
62#define HID_USAGE_SENSOR_ORIENT_ROTATION_MATRIX 0x200482
63#define HID_USAGE_SENSOR_ORIENT_QUATERNION 0x200483
64#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX 0x200484
65
66#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_X_AXIS 0x200485
67#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_Y_AXIS 0x200486
68#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_Z_AXIS 0x200487
69
70/* Units */
71#define HID_USAGE_SENSOR_UNITS_NOT_SPECIFIED 0x00
72#define HID_USAGE_SENSOR_UNITS_LUX 0x01
73#define HID_USAGE_SENSOR_UNITS_KELVIN 0x01000100
74#define HID_USAGE_SENSOR_UNITS_FAHRENHEIT 0x03000100
75#define HID_USAGE_SENSOR_UNITS_PASCAL 0xF1E1
76#define HID_USAGE_SENSOR_UNITS_NEWTON 0x11E1
77#define HID_USAGE_SENSOR_UNITS_METERS_PER_SECOND 0x11F0
78#define HID_USAGE_SENSOR_UNITS_METERS_PER_SEC_SQRD 0x11E0
79#define HID_USAGE_SENSOR_UNITS_FARAD 0xE14F2000
80#define HID_USAGE_SENSOR_UNITS_AMPERE 0x01001000
81#define HID_USAGE_SENSOR_UNITS_WATT 0x21d1
82#define HID_USAGE_SENSOR_UNITS_HENRY 0x21E1E000
83#define HID_USAGE_SENSOR_UNITS_OHM 0x21D1E000
84#define HID_USAGE_SENSOR_UNITS_VOLT 0x21D1F000
85#define HID_USAGE_SENSOR_UNITS_HERTZ 0x01F0
86#define HID_USAGE_SENSOR_UNITS_DEGREES_PER_SEC_SQRD 0x14E0
87#define HID_USAGE_SENSOR_UNITS_RADIANS 0x12
88#define HID_USAGE_SENSOR_UNITS_RADIANS_PER_SECOND 0x12F0
89#define HID_USAGE_SENSOR_UNITS_RADIANS_PER_SEC_SQRD 0x12E0
90#define HID_USAGE_SENSOR_UNITS_SECOND 0x0110
91#define HID_USAGE_SENSOR_UNITS_GAUSS 0x01E1F000
92#define HID_USAGE_SENSOR_UNITS_GRAM 0x0101
93#define HID_USAGE_SENSOR_UNITS_CENTIMETER 0x11
94#define HID_USAGE_SENSOR_UNITS_G 0x1A
95#define HID_USAGE_SENSOR_UNITS_MILLISECOND 0x19
96#define HID_USAGE_SENSOR_UNITS_PERCENT 0x17
97#define HID_USAGE_SENSOR_UNITS_DEGREES 0x14
98#define HID_USAGE_SENSOR_UNITS_DEGREES_PER_SECOND 0x15
99
100/* Common selectors */
101#define HID_USAGE_SENSOR_PROP_REPORT_INTERVAL 0x20030E
102#define HID_USAGE_SENSOR_PROP_SENSITIVITY_ABS 0x20030F
103#define HID_USAGE_SENSOR_PROP_SENSITIVITY_RANGE_PCT 0x200310
104#define HID_USAGE_SENSOR_PROP_SENSITIVITY_REL_PCT 0x200311
105#define HID_USAGE_SENSOR_PROP_ACCURACY 0x200312
106#define HID_USAGE_SENSOR_PROP_RESOLUTION 0x200313
107#define HID_USAGE_SENSOR_PROP_RANGE_MAXIMUM 0x200314
108#define HID_USAGE_SENSOR_PROP_RANGE_MINIMUM 0x200315
109#define HID_USAGE_SENSOR_PROP_REPORT_STATE 0x200316
110#define HID_USAGE_SENSOR_PROY_POWER_STATE 0x200319
111
112#endif
diff --git a/include/linux/iio/adc/ad_sigma_delta.h b/include/linux/iio/adc/ad_sigma_delta.h
new file mode 100644
index 000000000000..2e4eab9868a3
--- /dev/null
+++ b/include/linux/iio/adc/ad_sigma_delta.h
@@ -0,0 +1,173 @@
1/*
2 * Support code for Analog Devices Sigma-Delta ADCs
3 *
4 * Copyright 2012 Analog Devices Inc.
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
6 *
7 * Licensed under the GPL-2.
8 */
9#ifndef __AD_SIGMA_DELTA_H__
10#define __AD_SIGMA_DELTA_H__
11
12enum ad_sigma_delta_mode {
13 AD_SD_MODE_CONTINUOUS = 0,
14 AD_SD_MODE_SINGLE = 1,
15 AD_SD_MODE_IDLE = 2,
16 AD_SD_MODE_POWERDOWN = 3,
17};
18
19/**
20 * struct ad_sigma_delta_calib_data - Calibration data for Sigma Delta devices
21 * @mode: Calibration mode.
22 * @channel: Calibration channel.
23 */
24struct ad_sd_calib_data {
25 unsigned int mode;
26 unsigned int channel;
27};
28
29struct ad_sigma_delta;
30struct iio_dev;
31
32/**
33 * struct ad_sigma_delta_info - Sigma Delta driver specific callbacks and options
34 * @set_channel: Will be called to select the current channel, may be NULL.
35 * @set_mode: Will be called to select the current mode, may be NULL.
36 * @postprocess_sample: Is called for each sampled data word, can be used to
37 * modify or drop the sample data, it, may be NULL.
38 * @has_registers: true if the device has writable and readable registers, false
39 * if there is just one read-only sample data shift register.
40 * @addr_shift: Shift of the register address in the communications register.
41 * @read_mask: Mask for the communications register having the read bit set.
42 */
43struct ad_sigma_delta_info {
44 int (*set_channel)(struct ad_sigma_delta *, unsigned int channel);
45 int (*set_mode)(struct ad_sigma_delta *, enum ad_sigma_delta_mode mode);
46 int (*postprocess_sample)(struct ad_sigma_delta *, unsigned int raw_sample);
47 bool has_registers;
48 unsigned int addr_shift;
49 unsigned int read_mask;
50};
51
52/**
53 * struct ad_sigma_delta - Sigma Delta device struct
54 * @spi: The spi device associated with the Sigma Delta device.
55 * @trig: The IIO trigger associated with the Sigma Delta device.
56 *
57 * Most of the fields are private to the sigma delta library code and should not
58 * be accessed by individual drivers.
59 */
60struct ad_sigma_delta {
61 struct spi_device *spi;
62 struct iio_trigger *trig;
63
64/* private: */
65 struct completion completion;
66 bool irq_dis;
67
68 bool bus_locked;
69
70 uint8_t comm;
71
72 const struct ad_sigma_delta_info *info;
73
74 /*
75 * DMA (thus cache coherency maintenance) requires the
76 * transfer buffers to live in their own cache lines.
77 */
78 uint8_t data[4] ____cacheline_aligned;
79};
80
81static inline int ad_sigma_delta_set_channel(struct ad_sigma_delta *sd,
82 unsigned int channel)
83{
84 if (sd->info->set_channel)
85 return sd->info->set_channel(sd, channel);
86
87 return 0;
88}
89
90static inline int ad_sigma_delta_set_mode(struct ad_sigma_delta *sd,
91 unsigned int mode)
92{
93 if (sd->info->set_mode)
94 return sd->info->set_mode(sd, mode);
95
96 return 0;
97}
98
99static inline int ad_sigma_delta_postprocess_sample(struct ad_sigma_delta *sd,
100 unsigned int raw_sample)
101{
102 if (sd->info->postprocess_sample)
103 return sd->info->postprocess_sample(sd, raw_sample);
104
105 return 0;
106}
107
108void ad_sd_set_comm(struct ad_sigma_delta *sigma_delta, uint8_t comm);
109int ad_sd_write_reg(struct ad_sigma_delta *sigma_delta, unsigned int reg,
110 unsigned int size, unsigned int val);
111int ad_sd_read_reg(struct ad_sigma_delta *sigma_delta, unsigned int reg,
112 unsigned int size, unsigned int *val);
113
114int ad_sigma_delta_single_conversion(struct iio_dev *indio_dev,
115 const struct iio_chan_spec *chan, int *val);
116int ad_sd_calibrate_all(struct ad_sigma_delta *sigma_delta,
117 const struct ad_sd_calib_data *cd, unsigned int n);
118int ad_sd_init(struct ad_sigma_delta *sigma_delta, struct iio_dev *indio_dev,
119 struct spi_device *spi, const struct ad_sigma_delta_info *info);
120
121int ad_sd_setup_buffer_and_trigger(struct iio_dev *indio_dev);
122void ad_sd_cleanup_buffer_and_trigger(struct iio_dev *indio_dev);
123
124int ad_sd_validate_trigger(struct iio_dev *indio_dev, struct iio_trigger *trig);
125
126#define __AD_SD_CHANNEL(_si, _channel1, _channel2, _address, _bits, \
127 _storagebits, _shift, _extend_name, _type) \
128 { \
129 .type = (_type), \
130 .differential = (_channel2 == -1 ? 0 : 1), \
131 .indexed = 1, \
132 .channel = (_channel1), \
133 .channel2 = (_channel2), \
134 .address = (_address), \
135 .extend_name = (_extend_name), \
136 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
137 IIO_CHAN_INFO_SCALE_SHARED_BIT | \
138 IIO_CHAN_INFO_OFFSET_SEPARATE_BIT, \
139 .scan_index = (_si), \
140 .scan_type = { \
141 .sign = 'u', \
142 .realbits = (_bits), \
143 .storagebits = (_storagebits), \
144 .shift = (_shift), \
145 .endianness = IIO_BE, \
146 }, \
147 }
148
149#define AD_SD_DIFF_CHANNEL(_si, _channel1, _channel2, _address, _bits, \
150 _storagebits, _shift) \
151 __AD_SD_CHANNEL(_si, _channel1, _channel2, _address, _bits, \
152 _storagebits, _shift, NULL, IIO_VOLTAGE)
153
154#define AD_SD_SHORTED_CHANNEL(_si, _channel, _address, _bits, \
155 _storagebits, _shift) \
156 __AD_SD_CHANNEL(_si, _channel, _channel, _address, _bits, \
157 _storagebits, _shift, "shorted", IIO_VOLTAGE)
158
159#define AD_SD_CHANNEL(_si, _channel, _address, _bits, \
160 _storagebits, _shift) \
161 __AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \
162 _storagebits, _shift, NULL, IIO_VOLTAGE)
163
164#define AD_SD_TEMP_CHANNEL(_si, _address, _bits, _storagebits, _shift) \
165 __AD_SD_CHANNEL(_si, 0, -1, _address, _bits, \
166 _storagebits, _shift, NULL, IIO_TEMP)
167
168#define AD_SD_SUPPLY_CHANNEL(_si, _channel, _address, _bits, _storagebits, \
169 _shift) \
170 __AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \
171 _storagebits, _shift, "supply", IIO_VOLTAGE)
172
173#endif
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index 8ba516fc2ec6..c629b3a1d9a9 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -36,7 +36,7 @@ struct iio_buffer;
36 * any of them not existing. 36 * any of them not existing.
37 **/ 37 **/
38struct iio_buffer_access_funcs { 38struct iio_buffer_access_funcs {
39 int (*store_to)(struct iio_buffer *buffer, u8 *data, s64 timestamp); 39 int (*store_to)(struct iio_buffer *buffer, u8 *data);
40 int (*read_first_n)(struct iio_buffer *buffer, 40 int (*read_first_n)(struct iio_buffer *buffer,
41 size_t n, 41 size_t n,
42 char __user *buf); 42 char __user *buf);
@@ -118,10 +118,8 @@ int iio_scan_mask_set(struct iio_dev *indio_dev,
118 * iio_push_to_buffer() - push to a registered buffer. 118 * iio_push_to_buffer() - push to a registered buffer.
119 * @buffer: IIO buffer structure for device 119 * @buffer: IIO buffer structure for device
120 * @data: the data to push to the buffer 120 * @data: the data to push to the buffer
121 * @timestamp: timestamp to associate with the data
122 */ 121 */
123int iio_push_to_buffer(struct iio_buffer *buffer, unsigned char *data, 122int iio_push_to_buffer(struct iio_buffer *buffer, unsigned char *data);
124 s64 timestamp);
125 123
126int iio_update_demux(struct iio_dev *indio_dev); 124int iio_update_demux(struct iio_dev *indio_dev);
127 125
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
index e2657e6d4d26..e875bcf0478f 100644
--- a/include/linux/iio/consumer.h
+++ b/include/linux/iio/consumer.h
@@ -8,7 +8,7 @@
8 * the Free Software Foundation. 8 * the Free Software Foundation.
9 */ 9 */
10#ifndef _IIO_INKERN_CONSUMER_H_ 10#ifndef _IIO_INKERN_CONSUMER_H_
11#define _IIO_INKERN_CONSUMER_H 11#define _IIO_INKERN_CONSUMER_H_
12#include <linux/iio/types.h> 12#include <linux/iio/types.h>
13 13
14struct iio_dev; 14struct iio_dev;
@@ -61,7 +61,7 @@ void iio_channel_release_all(struct iio_channel *chan);
61 61
62/** 62/**
63 * iio_read_channel_raw() - read from a given channel 63 * iio_read_channel_raw() - read from a given channel
64 * @channel: The channel being queried. 64 * @chan: The channel being queried.
65 * @val: Value read back. 65 * @val: Value read back.
66 * 66 *
67 * Note raw reads from iio channels are in adc counts and hence 67 * Note raw reads from iio channels are in adc counts and hence
@@ -71,6 +71,21 @@ int iio_read_channel_raw(struct iio_channel *chan,
71 int *val); 71 int *val);
72 72
73/** 73/**
74 * iio_read_channel_processed() - read processed value from a given channel
75 * @chan: The channel being queried.
76 * @val: Value read back.
77 *
78 * Returns an error code or 0.
79 *
80 * This function will read a processed value from a channel. A processed value
81 * means that this value will have the correct unit and not some device internal
82 * representation. If the device does not support reporting a processed value
83 * the function will query the raw value and the channels scale and offset and
84 * do the appropriate transformation.
85 */
86int iio_read_channel_processed(struct iio_channel *chan, int *val);
87
88/**
74 * iio_get_channel_type() - get the type of a channel 89 * iio_get_channel_type() - get the type of a channel
75 * @channel: The channel being queried. 90 * @channel: The channel being queried.
76 * @type: The type of the channel. 91 * @type: The type of the channel.
@@ -82,7 +97,7 @@ int iio_get_channel_type(struct iio_channel *channel,
82 97
83/** 98/**
84 * iio_read_channel_scale() - read the scale value for a channel 99 * iio_read_channel_scale() - read the scale value for a channel
85 * @channel: The channel being queried. 100 * @chan: The channel being queried.
86 * @val: First part of value read back. 101 * @val: First part of value read back.
87 * @val2: Second part of value read back. 102 * @val2: Second part of value read back.
88 * 103 *
@@ -93,4 +108,27 @@ int iio_get_channel_type(struct iio_channel *channel,
93int iio_read_channel_scale(struct iio_channel *chan, int *val, 108int iio_read_channel_scale(struct iio_channel *chan, int *val,
94 int *val2); 109 int *val2);
95 110
111/**
112 * iio_convert_raw_to_processed() - Converts a raw value to a processed value
113 * @chan: The channel being queried
114 * @raw: The raw IIO to convert
115 * @processed: The result of the conversion
116 * @scale: Scale factor to apply during the conversion
117 *
118 * Returns an error code or 0.
119 *
120 * This function converts a raw value to processed value for a specific channel.
121 * A raw value is the device internal representation of a sample and the value
122 * returned by iio_read_channel_raw, so the unit of that value is device
123 * depended. A processed value on the other hand is value has a normed unit
124 * according with the IIO specification.
125 *
126 * The scale factor allows to increase the precession of the returned value. For
127 * a scale factor of 1 the function will return the result in the normal IIO
128 * unit for the channel type. E.g. millivolt for voltage channels, if you want
129 * nanovolts instead pass 1000 as the scale factor.
130 */
131int iio_convert_raw_to_processed(struct iio_channel *chan, int raw,
132 int *processed, unsigned int scale);
133
96#endif 134#endif
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index be82936c4089..c0ae76ac4e0b 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -35,10 +35,13 @@ enum iio_chan_info_enum {
35 IIO_CHAN_INFO_FREQUENCY, 35 IIO_CHAN_INFO_FREQUENCY,
36 IIO_CHAN_INFO_PHASE, 36 IIO_CHAN_INFO_PHASE,
37 IIO_CHAN_INFO_HARDWAREGAIN, 37 IIO_CHAN_INFO_HARDWAREGAIN,
38 IIO_CHAN_INFO_HYSTERESIS,
38}; 39};
39 40
40#define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2) 41#define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2)
41#define IIO_CHAN_INFO_SEPARATE_BIT(type) BIT(type*2 + 1) 42#define IIO_CHAN_INFO_SEPARATE_BIT(type) BIT(type*2 + 1)
43#define IIO_CHAN_INFO_BITS(type) (IIO_CHAN_INFO_SHARED_BIT(type) | \
44 IIO_CHAN_INFO_SEPARATE_BIT(type))
42 45
43#define IIO_CHAN_INFO_RAW_SEPARATE_BIT \ 46#define IIO_CHAN_INFO_RAW_SEPARATE_BIT \
44 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW) 47 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW)
@@ -100,6 +103,10 @@ enum iio_chan_info_enum {
100 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HARDWAREGAIN) 103 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
101#define IIO_CHAN_INFO_HARDWAREGAIN_SHARED_BIT \ 104#define IIO_CHAN_INFO_HARDWAREGAIN_SHARED_BIT \
102 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HARDWAREGAIN) 105 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
106#define IIO_CHAN_INFO_HYSTERESIS_SEPARATE_BIT \
107 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HYSTERESIS)
108#define IIO_CHAN_INFO_HYSTERESIS_SHARED_BIT \
109 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HYSTERESIS)
103 110
104enum iio_endian { 111enum iio_endian {
105 IIO_CPU, 112 IIO_CPU,
@@ -164,7 +171,7 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
164 * IIO_ENUM() - Initialize enum extended channel attribute 171 * IIO_ENUM() - Initialize enum extended channel attribute
165 * @_name: Attribute name 172 * @_name: Attribute name
166 * @_shared: Whether the attribute is shared between all channels 173 * @_shared: Whether the attribute is shared between all channels
167 * @_e: Pointer to a iio_enum struct 174 * @_e: Pointer to an iio_enum struct
168 * 175 *
169 * This should usually be used together with IIO_ENUM_AVAILABLE() 176 * This should usually be used together with IIO_ENUM_AVAILABLE()
170 */ 177 */
@@ -180,9 +187,9 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
180/** 187/**
181 * IIO_ENUM_AVAILABLE() - Initialize enum available extended channel attribute 188 * IIO_ENUM_AVAILABLE() - Initialize enum available extended channel attribute
182 * @_name: Attribute name ("_available" will be appended to the name) 189 * @_name: Attribute name ("_available" will be appended to the name)
183 * @_e: Pointer to a iio_enum struct 190 * @_e: Pointer to an iio_enum struct
184 * 191 *
185 * Creates a read only attribute which list all the available enum items in a 192 * Creates a read only attribute which lists all the available enum items in a
186 * space separated list. This should usually be used together with IIO_ENUM() 193 * space separated list. This should usually be used together with IIO_ENUM()
187 */ 194 */
188#define IIO_ENUM_AVAILABLE(_name, _e) \ 195#define IIO_ENUM_AVAILABLE(_name, _e) \
@@ -229,6 +236,7 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
229 * @indexed: Specify the channel has a numerical index. If not, 236 * @indexed: Specify the channel has a numerical index. If not,
230 * the channel index number will be suppressed for sysfs 237 * the channel index number will be suppressed for sysfs
231 * attributes but not for event codes. 238 * attributes but not for event codes.
239 * @output: Channel is output.
232 * @differential: Channel is differential. 240 * @differential: Channel is differential.
233 */ 241 */
234struct iio_chan_spec { 242struct iio_chan_spec {
@@ -255,6 +263,21 @@ struct iio_chan_spec {
255 unsigned differential:1; 263 unsigned differential:1;
256}; 264};
257 265
266
267/**
268 * iio_channel_has_info() - Checks whether a channel supports a info attribute
269 * @chan: The channel to be queried
270 * @type: Type of the info attribute to be checked
271 *
272 * Returns true if the channels supports reporting values for the given info
273 * attribute type, false otherwise.
274 */
275static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
276 enum iio_chan_info_enum type)
277{
278 return chan->info_mask & IIO_CHAN_INFO_BITS(type);
279}
280
258#define IIO_ST(si, rb, sb, sh) \ 281#define IIO_ST(si, rb, sb, sh) \
259 { .sign = si, .realbits = rb, .storagebits = sb, .shift = sh } 282 { .sign = si, .realbits = rb, .storagebits = sb, .shift = sh }
260 283
@@ -312,6 +335,9 @@ struct iio_dev;
312 * Meaning is event dependent. 335 * Meaning is event dependent.
313 * @validate_trigger: function to validate the trigger when the 336 * @validate_trigger: function to validate the trigger when the
314 * current trigger gets changed. 337 * current trigger gets changed.
338 * @update_scan_mode: function to configure device and scan buffer when
339 * channels have changed
340 * @debugfs_reg_access: function to read or write register value of device
315 **/ 341 **/
316struct iio_info { 342struct iio_info {
317 struct module *driver_module; 343 struct module *driver_module;
@@ -367,10 +393,10 @@ struct iio_info {
367 * scan mask is valid for the device. 393 * scan mask is valid for the device.
368 */ 394 */
369struct iio_buffer_setup_ops { 395struct iio_buffer_setup_ops {
370 int (*preenable)(struct iio_dev *); 396 int (*preenable)(struct iio_dev *);
371 int (*postenable)(struct iio_dev *); 397 int (*postenable)(struct iio_dev *);
372 int (*predisable)(struct iio_dev *); 398 int (*predisable)(struct iio_dev *);
373 int (*postdisable)(struct iio_dev *); 399 int (*postdisable)(struct iio_dev *);
374 bool (*validate_scan_mask)(struct iio_dev *indio_dev, 400 bool (*validate_scan_mask)(struct iio_dev *indio_dev,
375 const unsigned long *scan_mask); 401 const unsigned long *scan_mask);
376}; 402};
@@ -516,6 +542,31 @@ static inline struct iio_dev *iio_device_get(struct iio_dev *indio_dev)
516 return indio_dev ? dev_to_iio_dev(get_device(&indio_dev->dev)) : NULL; 542 return indio_dev ? dev_to_iio_dev(get_device(&indio_dev->dev)) : NULL;
517} 543}
518 544
545
546/**
547 * iio_device_set_drvdata() - Set device driver data
548 * @indio_dev: IIO device structure
549 * @data: Driver specific data
550 *
551 * Allows to attach an arbitrary pointer to an IIO device, which can later be
552 * retrieved by iio_device_get_drvdata().
553 */
554static inline void iio_device_set_drvdata(struct iio_dev *indio_dev, void *data)
555{
556 dev_set_drvdata(&indio_dev->dev, data);
557}
558
559/**
560 * iio_device_get_drvdata() - Get device driver data
561 * @indio_dev: IIO device structure
562 *
563 * Returns the data previously set with iio_device_set_drvdata()
564 */
565static inline void *iio_device_get_drvdata(struct iio_dev *indio_dev)
566{
567 return dev_get_drvdata(&indio_dev->dev);
568}
569
519/* Can we make this smaller? */ 570/* Can we make this smaller? */
520#define IIO_ALIGN L1_CACHE_BYTES 571#define IIO_ALIGN L1_CACHE_BYTES
521/** 572/**
diff --git a/include/linux/iio/kfifo_buf.h b/include/linux/iio/kfifo_buf.h
index 014d5a13b32b..25eeac762e84 100644
--- a/include/linux/iio/kfifo_buf.h
+++ b/include/linux/iio/kfifo_buf.h
@@ -1,3 +1,5 @@
1#ifndef __LINUX_IIO_KFIFO_BUF_H__
2#define __LINUX_IIO_KFIFO_BUF_H__
1 3
2#include <linux/kfifo.h> 4#include <linux/kfifo.h>
3#include <linux/iio/iio.h> 5#include <linux/iio/iio.h>
@@ -6,3 +8,4 @@
6struct iio_buffer *iio_kfifo_allocate(struct iio_dev *indio_dev); 8struct iio_buffer *iio_kfifo_allocate(struct iio_dev *indio_dev);
7void iio_kfifo_free(struct iio_buffer *r); 9void iio_kfifo_free(struct iio_buffer *r);
8 10
11#endif
diff --git a/include/linux/iio/machine.h b/include/linux/iio/machine.h
index 400a453ff67b..809a3f08d5a5 100644
--- a/include/linux/iio/machine.h
+++ b/include/linux/iio/machine.h
@@ -8,6 +8,9 @@
8 * the Free Software Foundation. 8 * the Free Software Foundation.
9 */ 9 */
10 10
11#ifndef __LINUX_IIO_MACHINE_H__
12#define __LINUX_IIO_MACHINE_H__
13
11/** 14/**
12 * struct iio_map - description of link between consumer and device channels 15 * struct iio_map - description of link between consumer and device channels
13 * @adc_channel_label: Label used to identify the channel on the provider. 16 * @adc_channel_label: Label used to identify the channel on the provider.
@@ -22,3 +25,5 @@ struct iio_map {
22 const char *consumer_dev_name; 25 const char *consumer_dev_name;
23 const char *consumer_channel; 26 const char *consumer_channel;
24}; 27};
28
29#endif
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index a9819940a84c..20239da1d0f7 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -29,7 +29,7 @@ struct iio_subirq {
29 * instances of a given device. 29 * instances of a given device.
30 **/ 30 **/
31struct iio_trigger_ops { 31struct iio_trigger_ops {
32 struct module *owner; 32 struct module *owner;
33 int (*set_trigger_state)(struct iio_trigger *trig, bool state); 33 int (*set_trigger_state)(struct iio_trigger *trig, bool state);
34 int (*try_reenable)(struct iio_trigger *trig); 34 int (*try_reenable)(struct iio_trigger *trig);
35 int (*validate_device)(struct iio_trigger *trig, 35 int (*validate_device)(struct iio_trigger *trig,
@@ -39,7 +39,7 @@ struct iio_trigger_ops {
39 39
40/** 40/**
41 * struct iio_trigger - industrial I/O trigger device 41 * struct iio_trigger - industrial I/O trigger device
42 * 42 * @ops: [DRIVER] operations structure
43 * @id: [INTERN] unique id number 43 * @id: [INTERN] unique id number
44 * @name: [DRIVER] unique name 44 * @name: [DRIVER] unique name
45 * @dev: [DRIVER] associated device (if relevant) 45 * @dev: [DRIVER] associated device (if relevant)
@@ -76,19 +76,19 @@ struct iio_trigger {
76static inline struct iio_trigger *to_iio_trigger(struct device *d) 76static inline struct iio_trigger *to_iio_trigger(struct device *d)
77{ 77{
78 return container_of(d, struct iio_trigger, dev); 78 return container_of(d, struct iio_trigger, dev);
79}; 79}
80 80
81static inline void iio_trigger_put(struct iio_trigger *trig) 81static inline void iio_trigger_put(struct iio_trigger *trig)
82{ 82{
83 module_put(trig->ops->owner); 83 module_put(trig->ops->owner);
84 put_device(&trig->dev); 84 put_device(&trig->dev);
85}; 85}
86 86
87static inline void iio_trigger_get(struct iio_trigger *trig) 87static inline void iio_trigger_get(struct iio_trigger *trig)
88{ 88{
89 get_device(&trig->dev); 89 get_device(&trig->dev);
90 __module_get(trig->ops->owner); 90 __module_get(trig->ops->owner);
91}; 91}
92 92
93/** 93/**
94 * iio_trigger_register() - register a trigger with the IIO core 94 * iio_trigger_register() - register a trigger with the IIO core
@@ -104,7 +104,8 @@ void iio_trigger_unregister(struct iio_trigger *trig_info);
104 104
105/** 105/**
106 * iio_trigger_poll() - called on a trigger occurring 106 * iio_trigger_poll() - called on a trigger occurring
107 * @trig: trigger which occurred 107 * @trig: trigger which occurred
108 * @time: timestamp when trigger occurred
108 * 109 *
109 * Typically called in relevant hardware interrupt handler. 110 * Typically called in relevant hardware interrupt handler.
110 **/ 111 **/
diff --git a/include/linux/iio/trigger_consumer.h b/include/linux/iio/trigger_consumer.h
index 60d64b356945..c4f8c7409666 100644
--- a/include/linux/iio/trigger_consumer.h
+++ b/include/linux/iio/trigger_consumer.h
@@ -7,6 +7,15 @@
7 * the Free Software Foundation. 7 * the Free Software Foundation.
8 */ 8 */
9 9
10#ifndef __LINUX_IIO_TRIGGER_CONSUMER_H__
11#define __LINUX_IIO_TRIGGER_CONSUMER_H__
12
13#include <linux/interrupt.h>
14#include <linux/types.h>
15
16struct iio_dev;
17struct iio_trigger;
18
10/** 19/**
11 * struct iio_poll_func - poll function pair 20 * struct iio_poll_func - poll function pair
12 * 21 *
@@ -50,3 +59,5 @@ void iio_trigger_notify_done(struct iio_trigger *trig);
50 */ 59 */
51int iio_triggered_buffer_postenable(struct iio_dev *indio_dev); 60int iio_triggered_buffer_postenable(struct iio_dev *indio_dev);
52int iio_triggered_buffer_predisable(struct iio_dev *indio_dev); 61int iio_triggered_buffer_predisable(struct iio_dev *indio_dev);
62
63#endif
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 44e397705d7f..5c647ecfd5ba 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -57,5 +57,6 @@ enum iio_modifier {
57#define IIO_VAL_INT_PLUS_MICRO 2 57#define IIO_VAL_INT_PLUS_MICRO 2
58#define IIO_VAL_INT_PLUS_NANO 3 58#define IIO_VAL_INT_PLUS_NANO 3
59#define IIO_VAL_INT_PLUS_MICRO_DB 4 59#define IIO_VAL_INT_PLUS_MICRO_DB 4
60#define IIO_VAL_FRACTIONAL 10
60 61
61#endif /* _IIO_TYPES_H_ */ 62#endif /* _IIO_TYPES_H_ */
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 6955045199b0..70c6a359b2f4 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -600,4 +600,12 @@ struct x86_cpu_id {
600#define X86_MODEL_ANY 0 600#define X86_MODEL_ANY 0
601#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */ 601#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */
602 602
603#define IPACK_ANY_FORMAT 0xff
604#define IPACK_ANY_ID (~0)
605struct ipack_device_id {
606 __u8 format; /* Format version or IPACK_ANY_ID */
607 __u32 vendor; /* Vendor ID or IPACK_ANY_ID */
608 __u32 device; /* Device ID or IPACK_ANY_ID */
609};
610
603#endif /* LINUX_MOD_DEVICETABLE_H */ 611#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/platform_data/ad5755.h b/include/linux/platform_data/ad5755.h
new file mode 100644
index 000000000000..a5a1cb751874
--- /dev/null
+++ b/include/linux/platform_data/ad5755.h
@@ -0,0 +1,103 @@
1/*
2 * Copyright 2012 Analog Devices Inc.
3 *
4 * Licensed under the GPL-2.
5 */
6#ifndef __LINUX_PLATFORM_DATA_AD5755_H__
7#define __LINUX_PLATFORM_DATA_AD5755_H__
8
9enum ad5755_mode {
10 AD5755_MODE_VOLTAGE_0V_5V = 0,
11 AD5755_MODE_VOLTAGE_0V_10V = 1,
12 AD5755_MODE_VOLTAGE_PLUSMINUS_5V = 2,
13 AD5755_MODE_VOLTAGE_PLUSMINUS_10V = 3,
14 AD5755_MODE_CURRENT_4mA_20mA = 4,
15 AD5755_MODE_CURRENT_0mA_20mA = 5,
16 AD5755_MODE_CURRENT_0mA_24mA = 6,
17};
18
19enum ad5755_dc_dc_phase {
20 AD5755_DC_DC_PHASE_ALL_SAME_EDGE = 0,
21 AD5755_DC_DC_PHASE_A_B_SAME_EDGE_C_D_OPP_EDGE = 1,
22 AD5755_DC_DC_PHASE_A_C_SAME_EDGE_B_D_OPP_EDGE = 2,
23 AD5755_DC_DC_PHASE_90_DEGREE = 3,
24};
25
26enum ad5755_dc_dc_freq {
27 AD5755_DC_DC_FREQ_250kHZ = 0,
28 AD5755_DC_DC_FREQ_410kHZ = 1,
29 AD5755_DC_DC_FREQ_650kHZ = 2,
30};
31
32enum ad5755_dc_dc_maxv {
33 AD5755_DC_DC_MAXV_23V = 0,
34 AD5755_DC_DC_MAXV_24V5 = 1,
35 AD5755_DC_DC_MAXV_27V = 2,
36 AD5755_DC_DC_MAXV_29V5 = 3,
37};
38
39enum ad5755_slew_rate {
40 AD5755_SLEW_RATE_64k = 0,
41 AD5755_SLEW_RATE_32k = 1,
42 AD5755_SLEW_RATE_16k = 2,
43 AD5755_SLEW_RATE_8k = 3,
44 AD5755_SLEW_RATE_4k = 4,
45 AD5755_SLEW_RATE_2k = 5,
46 AD5755_SLEW_RATE_1k = 6,
47 AD5755_SLEW_RATE_500 = 7,
48 AD5755_SLEW_RATE_250 = 8,
49 AD5755_SLEW_RATE_125 = 9,
50 AD5755_SLEW_RATE_64 = 10,
51 AD5755_SLEW_RATE_32 = 11,
52 AD5755_SLEW_RATE_16 = 12,
53 AD5755_SLEW_RATE_8 = 13,
54 AD5755_SLEW_RATE_4 = 14,
55 AD5755_SLEW_RATE_0_5 = 15,
56};
57
58enum ad5755_slew_step_size {
59 AD5755_SLEW_STEP_SIZE_1 = 0,
60 AD5755_SLEW_STEP_SIZE_2 = 1,
61 AD5755_SLEW_STEP_SIZE_4 = 2,
62 AD5755_SLEW_STEP_SIZE_8 = 3,
63 AD5755_SLEW_STEP_SIZE_16 = 4,
64 AD5755_SLEW_STEP_SIZE_32 = 5,
65 AD5755_SLEW_STEP_SIZE_64 = 6,
66 AD5755_SLEW_STEP_SIZE_128 = 7,
67 AD5755_SLEW_STEP_SIZE_256 = 8,
68};
69
70/**
71 * struct ad5755_platform_data - AD5755 DAC driver platform data
72 * @ext_dc_dc_compenstation_resistor: Whether an external DC-DC converter
73 * compensation register is used.
74 * @dc_dc_phase: DC-DC converter phase.
75 * @dc_dc_freq: DC-DC converter frequency.
76 * @dc_dc_maxv: DC-DC maximum allowed boost voltage.
77 * @dac.mode: The mode to be used for the DAC output.
78 * @dac.ext_current_sense_resistor: Whether an external current sense resistor
79 * is used.
80 * @dac.enable_voltage_overrange: Whether to enable 20% voltage output overrange.
81 * @dac.slew.enable: Whether to enable digital slew.
82 * @dac.slew.rate: Slew rate of the digital slew.
83 * @dac.slew.step_size: Slew step size of the digital slew.
84 **/
85struct ad5755_platform_data {
86 bool ext_dc_dc_compenstation_resistor;
87 enum ad5755_dc_dc_phase dc_dc_phase;
88 enum ad5755_dc_dc_freq dc_dc_freq;
89 enum ad5755_dc_dc_maxv dc_dc_maxv;
90
91 struct {
92 enum ad5755_mode mode;
93 bool ext_current_sense_resistor;
94 bool enable_voltage_overrange;
95 struct {
96 bool enable;
97 enum ad5755_slew_rate rate;
98 enum ad5755_slew_step_size step_size;
99 } slew;
100 } dac[4];
101};
102
103#endif
diff --git a/include/linux/platform_data/ad7791.h b/include/linux/platform_data/ad7791.h
new file mode 100644
index 000000000000..f9e4db1b82ae
--- /dev/null
+++ b/include/linux/platform_data/ad7791.h
@@ -0,0 +1,17 @@
1#ifndef __LINUX_PLATFORM_DATA_AD7791__
2#define __LINUX_PLATFORM_DATA_AD7791__
3
4/**
5 * struct ad7791_platform_data - AD7791 device platform data
6 * @buffered: If set to true configure the device for buffered input mode.
7 * @burnout_current: If set to true the 100mA burnout current is enabled.
8 * @unipolar: If set to true sample in unipolar mode, if set to false sample in
9 * bipolar mode.
10 */
11struct ad7791_platform_data {
12 bool buffered;
13 bool burnout_current;
14 bool unipolar;
15};
16
17#endif
diff --git a/include/linux/power/generic-adc-battery.h b/include/linux/power/generic-adc-battery.h
new file mode 100644
index 000000000000..b1ebe08533b6
--- /dev/null
+++ b/include/linux/power/generic-adc-battery.h
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2012, Anish Kumar <anish198519851985@gmail.com>
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 as
5 * published by the Free Software Foundation.
6 */
7
8#ifndef GENERIC_ADC_BATTERY_H
9#define GENERIC_ADC_BATTERY_H
10
11/**
12 * struct gab_platform_data - platform_data for generic adc iio battery driver.
13 * @battery_info: recommended structure to specify static power supply
14 * parameters
15 * @cal_charge: calculate charge level.
16 * @gpio_charge_finished: gpio for the charger.
17 * @gpio_inverted: Should be 1 if the GPIO is active low otherwise 0
18 * @jitter_delay: delay required after the interrupt to check battery
19 * status.Default set is 10ms.
20 */
21struct gab_platform_data {
22 struct power_supply_info battery_info;
23 int (*cal_charge)(long value);
24 int gpio_charge_finished;
25 bool gpio_inverted;
26 int jitter_delay;
27};
28
29#endif /* GENERIC_ADC_BATTERY_H */