Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f6fc7d5 authored by Zubair Lutfullah's avatar Zubair Lutfullah Committed by Jonathan Cameron
Browse files

iio: ti_am335x_adc: optimize memory usage



12 bit ADC data is stored in 32 bits of storage.
Change from u32 to u16 to reduce wasted memory.

Signed-off-by: default avatarZubair Lutfullah <zubair.lutfullah@gmail.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent baee5399
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -122,7 +122,7 @@ static int tiadc_channel_init(struct iio_dev *indio_dev, int channels)
		chan->datasheet_name = chan_name_ain[chan->channel];
		chan->datasheet_name = chan_name_ain[chan->channel];
		chan->scan_type.sign = 'u';
		chan->scan_type.sign = 'u';
		chan->scan_type.realbits = 12;
		chan->scan_type.realbits = 12;
		chan->scan_type.storagebits = 32;
		chan->scan_type.storagebits = 16;
	}
	}


	indio_dev->channels = chan_array;
	indio_dev->channels = chan_array;
@@ -186,7 +186,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
		if (stepid == map_val) {
		if (stepid == map_val) {
			read = read & FIFOREAD_DATA_MASK;
			read = read & FIFOREAD_DATA_MASK;
			found = true;
			found = true;
			*val = read;
			*val = (u16) read;
		}
		}
	}
	}