staging:iio:ad7606: Use GPIO descriptor API
[linux-2.6-block.git] / drivers / staging / iio / adc / ad7606.h
index 39f50440d915379dc601f333819954bea620f8e7..f5f85faf39215f196e0e4f0465c39e799326e2d3 100644 (file)
@@ -9,48 +9,14 @@
 #ifndef IIO_ADC_AD7606_H_
 #define IIO_ADC_AD7606_H_
 
-/*
- * TODO: struct ad7606_platform_data needs to go into include/linux/iio
- */
-
-/**
- * struct ad7606_platform_data - platform/board specific information
- * @default_os:                default oversampling value {0, 2, 4, 8, 16, 32, 64}
- * @default_range:     default range +/-{5000, 10000} mVolt
- * @gpio_convst:       number of gpio connected to the CONVST pin
- * @gpio_reset:                gpio connected to the RESET pin, if not used set to -1
- * @gpio_range:                gpio connected to the RANGE pin, if not used set to -1
- * @gpio_os0:          gpio connected to the OS0 pin, if not used set to -1
- * @gpio_os1:          gpio connected to the OS1 pin, if not used set to -1
- * @gpio_os2:          gpio connected to the OS2 pin, if not used set to -1
- * @gpio_frstdata:     gpio connected to the FRSTDAT pin, if not used set to -1
- * @gpio_stby:         gpio connected to the STBY pin, if not used set to -1
- */
-
-struct ad7606_platform_data {
-       unsigned int                    default_os;
-       unsigned int                    default_range;
-       unsigned int                    gpio_convst;
-       unsigned int                    gpio_reset;
-       unsigned int                    gpio_range;
-       unsigned int                    gpio_os0;
-       unsigned int                    gpio_os1;
-       unsigned int                    gpio_os2;
-       unsigned int                    gpio_frstdata;
-       unsigned int                    gpio_stby;
-};
-
 /**
  * struct ad7606_chip_info - chip specific information
  * @name:              identification string for chip
- * @int_vref_mv:       the internal reference voltage
  * @channels:          channel specification
  * @num_channels:      number of channels
  */
 
 struct ad7606_chip_info {
-       const char                      *name;
-       u16                             int_vref_mv;
        const struct iio_chan_spec      *channels;
        unsigned int                    num_channels;
 };
@@ -62,7 +28,6 @@ struct ad7606_chip_info {
 struct ad7606_state {
        struct device                   *dev;
        const struct ad7606_chip_info   *chip_info;
-       struct ad7606_platform_data     *pdata;
        struct regulator                *reg;
        struct work_struct              poll_work;
        wait_queue_head_t               wq_data_avail;
@@ -72,12 +37,19 @@ struct ad7606_state {
        bool                            done;
        void __iomem                    *base_address;
 
+       struct gpio_desc                *gpio_convst;
+       struct gpio_desc                *gpio_reset;
+       struct gpio_desc                *gpio_range;
+       struct gpio_desc                *gpio_standby;
+       struct gpio_desc                *gpio_frstdata;
+       struct gpio_descs               *gpio_os;
+
        /*
         * DMA (thus cache coherency maintenance) requires the
         * transfer buffers to live in their own cache lines.
+        * 8 * 16-bit samples + 64-bit timestamp
         */
-
-       unsigned short                  data[8] ____cacheline_aligned;
+       unsigned short                  data[12] ____cacheline_aligned;
 };
 
 struct ad7606_bus_ops {
@@ -85,11 +57,12 @@ struct ad7606_bus_ops {
        int (*read_block)(struct device *, int, void *);
 };
 
-struct iio_dev *ad7606_probe(struct device *dev, int irq,
-                             void __iomem *base_address, unsigned int id,
-                             const struct ad7606_bus_ops *bops);
-int ad7606_remove(struct iio_dev *indio_dev, int irq);
+int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
+                const char *name, unsigned int id,
+                const struct ad7606_bus_ops *bops);
+int ad7606_remove(struct device *dev, int irq);
 int ad7606_reset(struct ad7606_state *st);
+int ad7606_read_samples(struct ad7606_state *st);
 
 enum ad7606_supported_device_ids {
        ID_AD7606_8,