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

« back to all changes in this revision

Viewing changes to drivers/staging/iio/adc/ad7291.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:
17
17
#include <linux/regulator/consumer.h>
18
18
#include <linux/err.h>
19
19
 
20
 
#include "../iio.h"
21
 
#include "../sysfs.h"
22
 
#include "../events.h"
 
20
#include <linux/iio/iio.h>
 
21
#include <linux/iio/sysfs.h>
 
22
#include <linux/iio/events.h>
23
23
 
24
24
/*
25
25
 * Simplified handling
132
132
                const char *buf,
133
133
                size_t len)
134
134
{
135
 
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
 
135
        struct iio_dev *indio_dev = dev_to_iio_dev(dev);
136
136
        struct ad7291_chip_info *chip = iio_priv(indio_dev);
137
137
 
138
138
        return ad7291_i2c_write(chip, AD7291_COMMAND,
214
214
                struct device_attribute *attr,
215
215
                char *buf)
216
216
{
217
 
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
 
217
        struct iio_dev *indio_dev = dev_to_iio_dev(dev);
218
218
        struct ad7291_chip_info *chip = iio_priv(indio_dev);
219
219
        struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
220
220
        u16 data;
232
232
                                      const char *buf,
233
233
                                      size_t len)
234
234
{
235
 
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
 
235
        struct iio_dev *indio_dev = dev_to_iio_dev(dev);
236
236
        struct ad7291_chip_info *chip = iio_priv(indio_dev);
237
237
        struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
238
238
        u16 data;
461
461
        s16 signval;
462
462
 
463
463
        switch (mask) {
464
 
        case 0:
 
464
        case IIO_CHAN_INFO_RAW:
465
465
                switch (chan->type) {
466
466
                case IIO_VOLTAGE:
467
467
                        mutex_lock(&chip->state_lock);
536
536
#define AD7291_VOLTAGE_CHAN(_chan)                                      \
537
537
{                                                                       \
538
538
        .type = IIO_VOLTAGE,                                            \
539
 
        .info_mask = IIO_CHAN_INFO_SCALE_SHARED_BIT,                    \
 
539
        .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |                   \
 
540
        IIO_CHAN_INFO_SCALE_SHARED_BIT,                                 \
540
541
        .indexed = 1,                                                   \
541
542
        .channel = _chan,                                               \
542
543
        .event_mask = IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING)|\
554
555
        AD7291_VOLTAGE_CHAN(7),
555
556
        {
556
557
                .type = IIO_TEMP,
557
 
                .info_mask = IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE_BIT |
 
558
                .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
 
559
                                IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE_BIT |
558
560
                                IIO_CHAN_INFO_SCALE_SEPARATE_BIT,
559
561
                .indexed = 1,
560
562
                .channel = 0,
585
587
        struct iio_dev *indio_dev;
586
588
        int ret = 0, voltage_uv = 0;
587
589
 
588
 
        indio_dev = iio_allocate_device(sizeof(*chip));
 
590
        indio_dev = iio_device_alloc(sizeof(*chip));
589
591
        if (indio_dev == NULL) {
590
592
                ret = -ENOMEM;
591
593
                goto error_ret;
667
669
        if (!IS_ERR(chip->reg))
668
670
                regulator_put(chip->reg);
669
671
 
670
 
        iio_free_device(indio_dev);
 
672
        iio_device_free(indio_dev);
671
673
error_ret:
672
674
        return ret;
673
675
}
687
689
                regulator_put(chip->reg);
688
690
        }
689
691
 
690
 
        iio_free_device(indio_dev);
 
692
        iio_device_free(indio_dev);
691
693
 
692
694
        return 0;
693
695
}