/** * ad799x_ring_preenable() setup the parameters of the ring before enabling * * The complex nature of the setting of the nuber of bytes per datum is due * to this driver currently ensuring that the timestamp is stored at an 8 * byte boundary. **/ static int ad799x_ring_preenable(struct iio_dev *indio_dev) { struct iio_buffer *ring = indio_dev->buffer; struct ad799x_state *st = iio_priv(indio_dev); /* * Need to figure out the current mode based upon the requested * scan mask in iio_dev */ if (st->id == ad7997 || st->id == ad7998) ad7997_8_set_scan_mode(st, *indio_dev->active_scan_mask); st->d_size = bitmap_weight(indio_dev->active_scan_mask, indio_dev->masklength) * 2; if (ring->scan_timestamp) { st->d_size += sizeof(s64); if (st->d_size % sizeof(s64)) st->d_size += sizeof(s64) - (st->d_size % sizeof(s64)); } if (indio_dev->buffer->access->set_bytes_per_datum) indio_dev->buffer->access-> set_bytes_per_datum(indio_dev->buffer, st->d_size); return 0; }
/** * ad799x_ring_preenable() setup the parameters of the ring before enabling * * The complex nature of the setting of the number of bytes per datum is due * to this driver currently ensuring that the timestamp is stored at an 8 * byte boundary. **/ static int ad799x_ring_preenable(struct iio_dev *indio_dev) { struct ad799x_state *st = iio_priv(indio_dev); /* * Need to figure out the current mode based upon the requested * scan mask in iio_dev */ if (st->id == ad7997 || st->id == ad7998) ad7997_8_set_scan_mode(st, *indio_dev->active_scan_mask); return iio_sw_buffer_preenable(indio_dev); }