~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to drivers/staging/iio/adc/ad7606.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * AD7606 ADC driver
 
3
 *
 
4
 * Copyright 2011 Analog Devices Inc.
 
5
 *
 
6
 * Licensed under the GPL-2.
 
7
 */
 
8
 
 
9
#ifndef IIO_ADC_AD7606_H_
 
10
#define IIO_ADC_AD7606_H_
 
11
 
 
12
/*
 
13
 * TODO: struct ad7606_platform_data needs to go into include/linux/iio
 
14
 */
 
15
 
 
16
/**
 
17
 * struct ad7606_platform_data - platform/board specifc information
 
18
 * @default_os:         default oversampling value {0, 2, 4, 8, 16, 32, 64}
 
19
 * @default_range:      default range +/-{5000, 10000} mVolt
 
20
 * @gpio_convst:        number of gpio connected to the CONVST pin
 
21
 * @gpio_reset:         gpio connected to the RESET pin, if not used set to -1
 
22
 * @gpio_range:         gpio connected to the RANGE pin, if not used set to -1
 
23
 * @gpio_os0:           gpio connected to the OS0 pin, if not used set to -1
 
24
 * @gpio_os1:           gpio connected to the OS1 pin, if not used set to -1
 
25
 * @gpio_os2:           gpio connected to the OS2 pin, if not used set to -1
 
26
 * @gpio_frstdata:      gpio connected to the FRSTDAT pin, if not used set to -1
 
27
 * @gpio_stby:          gpio connected to the STBY pin, if not used set to -1
 
28
 */
 
29
 
 
30
struct ad7606_platform_data {
 
31
        unsigned                        default_os;
 
32
        unsigned                        default_range;
 
33
        unsigned                        gpio_convst;
 
34
        unsigned                        gpio_reset;
 
35
        unsigned                        gpio_range;
 
36
        unsigned                        gpio_os0;
 
37
        unsigned                        gpio_os1;
 
38
        unsigned                        gpio_os2;
 
39
        unsigned                        gpio_frstdata;
 
40
        unsigned                        gpio_stby;
 
41
};
 
42
 
 
43
/**
 
44
 * struct ad7606_chip_info - chip specifc information
 
45
 * @name:               indentification string for chip
 
46
 * @bits:               accuracy of the adc in bits
 
47
 * @bits:               output coding [s]igned or [u]nsigned
 
48
 * @int_vref_mv:        the internal reference voltage
 
49
 * @num_channels:       number of physical inputs on chip
 
50
 */
 
51
 
 
52
struct ad7606_chip_info {
 
53
        char                            name[10];
 
54
        u8                              bits;
 
55
        char                            sign;
 
56
        u16                             int_vref_mv;
 
57
        unsigned                        num_channels;
 
58
};
 
59
 
 
60
/**
 
61
 * struct ad7606_state - driver instance specific data
 
62
 */
 
63
 
 
64
struct ad7606_state {
 
65
        struct iio_dev                  *indio_dev;
 
66
        struct device                   *dev;
 
67
        const struct ad7606_chip_info   *chip_info;
 
68
        struct ad7606_platform_data     *pdata;
 
69
        struct regulator                *reg;
 
70
        struct work_struct              poll_work;
 
71
        wait_queue_head_t               wq_data_avail;
 
72
        atomic_t                        protect_ring;
 
73
        size_t                          d_size;
 
74
        const struct ad7606_bus_ops     *bops;
 
75
        int                             irq;
 
76
        unsigned                        id;
 
77
        unsigned                        range;
 
78
        unsigned                        oversampling;
 
79
        bool                            done;
 
80
        bool                            have_frstdata;
 
81
        bool                            have_os;
 
82
        bool                            have_stby;
 
83
        bool                            have_reset;
 
84
        bool                            have_range;
 
85
        void __iomem                    *base_address;
 
86
 
 
87
        /*
 
88
         * DMA (thus cache coherency maintenance) requires the
 
89
         * transfer buffers to live in their own cache lines.
 
90
         */
 
91
 
 
92
        unsigned short                  data[8] ____cacheline_aligned;
 
93
};
 
94
 
 
95
struct ad7606_bus_ops {
 
96
        /* more methods added in future? */
 
97
        int (*read_block)(struct device *, int, void *);
 
98
};
 
99
 
 
100
void ad7606_suspend(struct ad7606_state *st);
 
101
void ad7606_resume(struct ad7606_state *st);
 
102
struct ad7606_state *ad7606_probe(struct device *dev, int irq,
 
103
                              void __iomem *base_address, unsigned id,
 
104
                              const struct ad7606_bus_ops *bops);
 
105
int ad7606_remove(struct ad7606_state *st);
 
106
int ad7606_reset(struct ad7606_state *st);
 
107
 
 
108
enum ad7606_supported_device_ids {
 
109
        ID_AD7606_8,
 
110
        ID_AD7606_6,
 
111
        ID_AD7606_4
 
112
};
 
113
 
 
114
int ad7606_scan_from_ring(struct ad7606_state *st, unsigned ch);
 
115
int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev);
 
116
void ad7606_ring_cleanup(struct iio_dev *indio_dev);
 
117
#endif /* IIO_ADC_AD7606_H_ */