Question:
So just to clarify, reading from /sys/bus/iio/devices/iio:devic**e0/in_voltage0_raw reads attributes using sysfs, while reading from /dev/iio:device0 reads the values using IIO? Also another conceptual question, can you explain what exactly is in_voltage0_raw and iio:device0? I know it’s not a folder, and I interact with it by using cat. So is it just like a text file or something?
OK, so if you look at the /driver/iio/adc/ti_am335x_adc.c file, reading in_voltage0_raw is done by the tiadc_read_raw() function. The /dev/iio:device0 is a regular device driver interface, just like /dev/tty0. You can open, poll, read, etc. If you want to know how to interface to this driver, look at tools/iio/generic_buffer.c. So generally, you open /dev/iio:device0, then you poll this interface, which blocks, waiting for the buffer to exceed the watermark (prevents read from reading just a few values) and when poll returns, you read multiple values into a buffer in user space.
My answer:
in_voltage0_raw == one shot mode.
/dev/iio:device0 == continuous mode.
continuous mode is only really useful if you need more than 3-4 thousand samples a second. Otherwise one shot mode will possibly work just fine. It really how much you’re trying to do all at once.

John’s answer:
*Reading from /sys/bus/iio/devices/iio:*device0/in_voltage0_raw is reading and attribute of the IIO driver. Reading from /dev/iio:device0 is reading from the same IIO driver, but in this case you are reading from the buffer which stores samples defined in the DT overlay above.
Regards,
John
Total bullshit answer John. Which is getting to be common place from you. Sure iio:deviceX is a buffer, for continuous mode operation but in_voltageX_raw is not an fscking attribute. It’s a single value buffer. What’s more, your timing is impeccable. Bullshit answer right after I’ve already explained it. You tell me what I’m supposed to think about that.
There is no such thing as a single value buffer. Look up sysfs in the kernel docs, it is restricted to a single value (boolean, int, etc) per sysfs interface. Hence the reason why debugfs was developed, which can exchange complex data structures.
Additionally, you go about spouting complete FUD saying that one shot mode only gives the same value over, and over again. It’s very obvious you have no personal hands on knowledge here. in_voltageX_raw is refreshed every time the pseudo file is opened. That means, if you open the file, you must close it , then reopen in order for the value to refresh. I’ll also give you another clue. In continuous mode, you have to read above 200Ksps from a single ADC channel before you start getting redundant data. So what makes you think that a very slow operation such as opening a file before reading a value is going to make the ADC’s maximum samples / second any slower ? Bonus hint: it wont.
You don’t have to open the file for each read. You can open and then read and read again. That is what your example does. Looking at the code, it looks like you cannot read the same sample over and over again, because it waits for a new sample to complete before returning. This is probably why sysfs is slow because it has to wait for a complete scan cycle of all channels before returning a single value.
Anyway, I’m starting to feel like a 5 year old fighting over something incredibly stupid. So I’m done with this conversation. However, again. Stop spreading FUD about stuff you obviously know nothing about, and I’ll stop putting it back into your face. It surely seems like you know what the iio buffer is and does, and you know what some obscure device tree values for the ADC are ( I never even knew of those ). But you definitely have no clue about one shot mode.
You need to relax, take a breath. If you read the code in the driver, you will see that I am correct.
Regards,
John