~ubuntu-branches/ubuntu/saucy/linux-ti-omap4/saucy-proposed

« back to all changes in this revision

Viewing changes to drivers/staging/iio/dac/ad5686.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Stefan Bader, Upstream Kernel Changes
  • Date: 2012-08-15 17:17:43 UTC
  • Revision ID: package-import@ubuntu.com-20120815171743-h5wnuf51xe7pvdid
Tags: 3.5.0-207.13
[ Paolo Pisati ]

* Start new release

[ Stefan Bader ]

* (config) Enable getabis to use local package copies

[ Upstream Kernel Changes ]

* fixup: gargabe collect iva_seq[0|1] init
* [Config] enable all SND_OMAP_SOC_*s
* fixup: cm2xxx_3xxx.o is needed for omap2_cm_read|write_reg
* fixup: add some snd_soc_dai* helper functions
* fixup: s/snd_soc_dpcm_params/snd_soc_dpcm/g
* fixup: typo, no_host_mode and useless SDP4430 init
* fixup: enable again aess hwmod

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
#include <linux/sysfs.h>
17
17
#include <linux/regulator/consumer.h>
18
18
 
19
 
#include "../iio.h"
20
 
#include "../sysfs.h"
 
19
#include <linux/iio/iio.h>
 
20
#include <linux/iio/sysfs.h>
21
21
#include "dac.h"
22
22
 
23
23
#define AD5686_DAC_CHANNELS                     4
98
98
                .indexed = 1,                                   \
99
99
                .output = 1,                                    \
100
100
                .channel = chan,                                \
101
 
                .info_mask = IIO_CHAN_INFO_SCALE_SHARED_BIT,    \
 
101
                .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |   \
 
102
                IIO_CHAN_INFO_SCALE_SHARED_BIT,                 \
102
103
                .address = AD5686_ADDR_DAC(chan),                       \
103
104
                .scan_type = IIO_ST('u', bits, 16, shift)       \
104
105
}
172
173
static ssize_t ad5686_read_powerdown_mode(struct device *dev,
173
174
                                      struct device_attribute *attr, char *buf)
174
175
{
175
 
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
 
176
        struct iio_dev *indio_dev = dev_to_iio_dev(dev);
176
177
        struct ad5686_state *st = iio_priv(indio_dev);
177
178
        struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
178
179
 
186
187
                                       struct device_attribute *attr,
187
188
                                       const char *buf, size_t len)
188
189
{
189
 
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
 
190
        struct iio_dev *indio_dev = dev_to_iio_dev(dev);
190
191
        struct ad5686_state *st = iio_priv(indio_dev);
191
192
        struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
192
193
        unsigned mode;
210
211
                                           struct device_attribute *attr,
211
212
                                           char *buf)
212
213
{
213
 
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
 
214
        struct iio_dev *indio_dev = dev_to_iio_dev(dev);
214
215
        struct ad5686_state *st = iio_priv(indio_dev);
215
216
        struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
216
217
 
224
225
{
225
226
        bool readin;
226
227
        int ret;
227
 
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
 
228
        struct iio_dev *indio_dev = dev_to_iio_dev(dev);
228
229
        struct ad5686_state *st = iio_priv(indio_dev);
229
230
        struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
230
231
 
296
297
        int ret;
297
298
 
298
299
        switch (m) {
299
 
        case 0:
 
300
        case IIO_CHAN_INFO_RAW:
300
301
                mutex_lock(&indio_dev->mlock);
301
302
                ret = ad5686_spi_read(st, chan->address);
302
303
                mutex_unlock(&indio_dev->mlock);
326
327
        int ret;
327
328
 
328
329
        switch (mask) {
329
 
        case 0:
 
330
        case IIO_CHAN_INFO_RAW:
330
331
                if (val > (1 << chan->scan_type.realbits) || val < 0)
331
332
                        return -EINVAL;
332
333
 
358
359
        struct iio_dev *indio_dev;
359
360
        int ret, regdone = 0, voltage_uv = 0;
360
361
 
361
 
        indio_dev = iio_allocate_device(sizeof(*st));
 
362
        indio_dev = iio_device_alloc(sizeof(*st));
362
363
        if (indio_dev == NULL)
363
364
                return  -ENOMEM;
364
365
 
410
411
        if (!IS_ERR(st->reg))
411
412
                regulator_put(st->reg);
412
413
 
413
 
        iio_free_device(indio_dev);
 
414
        iio_device_free(indio_dev);
414
415
 
415
416
        return ret;
416
417
}
425
426
                regulator_disable(st->reg);
426
427
                regulator_put(st->reg);
427
428
        }
428
 
        iio_free_device(indio_dev);
 
429
        iio_device_free(indio_dev);
429
430
 
430
431
        return 0;
431
432
}