Merge branch 'next' into for-linus
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 24 May 2011 07:06:26 +0000 (00:06 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 24 May 2011 07:06:26 +0000 (00:06 -0700)
1  2 
drivers/input/touchscreen/ads7846.c
include/linux/mfd/wm831x/pdata.h

@@@ -109,6 -109,7 +109,7 @@@ struct ads7846 
        u16                     pressure_max;
  
        bool                    swap_xy;
+       bool                    use_internal;
  
        struct ads7846_packet   *packet;
  
@@@ -281,24 -282,17 +282,24 @@@ struct ser_req 
        u8                      command;
        u8                      ref_off;
        u16                     scratch;
 -      __be16                  sample;
        struct spi_message      msg;
        struct spi_transfer     xfer[6];
 +      /*
 +       * DMA (thus cache coherency maintenance) requires the
 +       * transfer buffers to live in their own cache lines.
 +       */
 +      __be16 sample ____cacheline_aligned;
  };
  
  struct ads7845_ser_req {
        u8                      command[3];
 -      u8                      pwrdown[3];
 -      u8                      sample[3];
        struct spi_message      msg;
        struct spi_transfer     xfer[2];
 +      /*
 +       * DMA (thus cache coherency maintenance) requires the
 +       * transfer buffers to live in their own cache lines.
 +       */
 +      u8 sample[3] ____cacheline_aligned;
  };
  
  static int ads7846_read12_ser(struct device *dev, unsigned command)
        struct ads7846 *ts = dev_get_drvdata(dev);
        struct ser_req *req;
        int status;
-       int use_internal;
  
        req = kzalloc(sizeof *req, GFP_KERNEL);
        if (!req)
  
        spi_message_init(&req->msg);
  
-       /* FIXME boards with ads7846 might use external vref instead ... */
-       use_internal = (ts->model == 7846);
        /* maybe turn on internal vREF, and let it settle */
-       if (use_internal) {
+       if (ts->use_internal) {
                req->ref_on = REF_ON;
                req->xfer[0].tx_buf = &req->ref_on;
                req->xfer[0].len = 1;
                /* for 1uF, settle for 800 usec; no cap, 100 usec.  */
                req->xfer[1].delay_usecs = ts->vref_delay_usecs;
                spi_message_add_tail(&req->xfer[1], &req->msg);
+               /* Enable reference voltage */
+               command |= ADS_PD10_REF_ON;
        }
  
+       /* Enable ADC in every case */
+       command |= ADS_PD10_ADC_ON;
        /* take sample */
        req->command = (u8) command;
        req->xfer[2].tx_buf = &req->command;
@@@ -416,7 -412,7 +419,7 @@@ name ## _show(struct device *dev, struc
  { \
        struct ads7846 *ts = dev_get_drvdata(dev); \
        ssize_t v = ads7846_read12_ser(dev, \
-                       READ_12BIT_SER(var) | ADS_PD10_ALL_ON); \
+                       READ_12BIT_SER(var)); \
        if (v < 0) \
                return v; \
        return sprintf(buf, "%u\n", adjust(ts, v)); \
@@@ -509,6 -505,7 +512,7 @@@ static int ads784x_hwmon_register(struc
                if (!ts->vref_mv) {
                        dev_dbg(&spi->dev, "assuming 2.5V internal vREF\n");
                        ts->vref_mv = 2500;
+                       ts->use_internal = true;
                }
                break;
        case 7845:
@@@ -969,6 -966,13 +973,13 @@@ static int __devinit ads7846_setup_pend
                                pdata->gpio_pendown);
                        return err;
                }
+               err = gpio_direction_input(pdata->gpio_pendown);
+               if (err) {
+                       dev_err(&spi->dev, "failed to setup pendown GPIO%d\n",
+                               pdata->gpio_pendown);
+                       gpio_free(pdata->gpio_pendown);
+                       return err;
+               }
  
                ts->gpio_pendown = pdata->gpio_pendown;
  
@@@ -1340,8 -1344,7 +1351,7 @@@ static int __devinit ads7846_probe(stru
        if (ts->model == 7845)
                ads7845_read12_ser(&spi->dev, PWRDOWN);
        else
-               (void) ads7846_read12_ser(&spi->dev,
-                               READ_12BIT_SER(vaux) | ADS_PD10_ALL_ON);
+               (void) ads7846_read12_ser(&spi->dev, READ_12BIT_SER(vaux));
  
        err = sysfs_create_group(&spi->dev.kobj, &ads784x_attr_group);
        if (err)
@@@ -81,9 -81,7 +81,9 @@@ struct wm831x_touch_pdata 
        int rpu;               /** Pen down sensitivity resistor divider */
        int pressure;          /** Report pressure (boolean) */
        unsigned int data_irq; /** Touch data ready IRQ */
 +      int data_irqf;         /** IRQ flags for data ready IRQ */
        unsigned int pd_irq;   /** Touch pendown detect IRQ */
 +      int pd_irqf;           /** IRQ flags for pen down IRQ */
  };
  
  enum wm831x_watchdog_action {
@@@ -106,11 -104,17 +106,17 @@@ struct wm831x_watchdog_pdata 
  #define WM831X_MAX_ISINK  2
  
  struct wm831x_pdata {
+       /** Used to distinguish multiple WM831x chips */
+       int wm831x_num;
        /** Called before subdevices are set up */
        int (*pre_init)(struct wm831x *wm831x);
        /** Called after subdevices are set up */
        int (*post_init)(struct wm831x *wm831x);
  
+       /** Put the /IRQ line into CMOS mode */
+       bool irq_cmos;
        int irq_base;
        int gpio_base;
        struct wm831x_backlight_pdata *backlight;