]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/iio/imu/adis_buffer.c
Merge tag 'v3.8-rc3' into v4l_for_linus
[karo-tx-linux.git] / drivers / iio / imu / adis_buffer.c
index a91b4cbdc73a571fc68acdaba040c7c52c949ed6..99d8e0b0dd34243168a750794df130ee77d8fe37 100644 (file)
@@ -64,6 +64,8 @@ int adis_update_scan_mode(struct iio_dev *indio_dev,
        for (i = 0; i < indio_dev->num_channels; i++, chan++) {
                if (!test_bit(chan->scan_index, scan_mask))
                        continue;
+               if (chan->scan_type.storagebits == 32)
+                       *tx++ = cpu_to_be16((chan->address + 2) << 8);
                *tx++ = cpu_to_be16(chan->address << 8);
        }
 
@@ -81,10 +83,25 @@ static irqreturn_t adis_trigger_handler(int irq, void *p)
        if (!adis->buffer)
                return -ENOMEM;
 
+       if (adis->data->has_paging) {
+               mutex_lock(&adis->txrx_lock);
+               if (adis->current_page != 0) {
+                       adis->tx[0] = ADIS_WRITE_REG(ADIS_REG_PAGE_ID);
+                       adis->tx[1] = 0;
+                       spi_write(adis->spi, adis->tx, 2);
+               }
+       }
+
        ret = spi_sync(adis->spi, &adis->msg);
        if (ret)
                dev_err(&adis->spi->dev, "Failed to read data: %d", ret);
 
+
+       if (adis->data->has_paging) {
+               adis->current_page = 0;
+               mutex_unlock(&adis->txrx_lock);
+       }
+
        /* Guaranteed to be aligned with 8 byte boundary */
        if (indio_dev->scan_timestamp) {
                void *b = adis->buffer + indio_dev->scan_bytes - sizeof(s64);