ADC mini210s

Guilherme
Hi, 
I am having problem with ADC using linux in mini210s, I need read 3
channels of ADC,  to testing the channels I run the adc-test.c - read all
channels and display their values on screen, the problem that the values
being displayed are the value to channel 0 (trimpot), already tried putting
a channel in GND(0) but the value is not changed.

I check and there /dev/adc but not /dev/adc0, adc1,adc3….

Anyone have any idea hot to read other channels?

guilherme
Anyone have any idea how to read other channels?***

Reggie
as far as I can see, there is only one /dev/adc and you read the channels
by setting the channel you want to read with something like:

ioctl(fd, ADC_SET_CHANNEL, channel);

the adc-test.c file shows this at line 43, it then reads the channel data:

read(fd, buffer, sizeof buffer -1);

If you look at the adc-test.c example, you will see that you need to
disable the 'S3C touchscreen driver for Mini6410', this may be different
for the 210 but I suspect that it may need to be disabled, you can also see
on line 27 that you need to uncomment it and comment out line 26.

guilherme
I do all steps, disable S3C touchscreen... 

the problem is - all results are to channel 0, when I move trimpot all
values up or down, same with a channel fixed in GND

Reggie
The trimpot will only affect the channel it's attached to, the others will
stay fixed unless you connect something to them that changes.

Wenqi
I've got the same problem. Debugged the kernel (2.6.35.7-20121027) and
adcdev.channel changed accordingly after ioctl is called, so is ADCCON.
However, no matter what, the there's still readout from channel 0 only.
Anyone got any idea?

Wenqi
Hi All,

I found the solution. S5P chips have uses a different register to store the
channel number. To fix the problem, you'll need to patch
driver/char/mini210_adc.c

#define ADCDAT1                 __ADCREG(S3C_ADCDAT1)
#define ADCUPDN                 __ADCREG(S3C_ADCUPDN)
+ #define ADCMUX                  __ADCREG(S3C_ADCMUX)

#define START_ADC_AIN(ch, prescale) \
        do { \
-                ADCCON = PRESCALE_EN | PRSCVL(prescale) | ADC_INPUT((ch))
; \
+                ADCCON = PRESCALE_EN | PRSCVL(prescale); \
+                ADCMUX = 0xf&ch; \
                ADCCON |= ADC_START; \
        } while (0)

And that's all.

Have a nice day! :)