I've read the post http://e2e.ti.com/support/arm/sitara_arm/f/791/t/250914.aspx?pi301021=1.
and I have my adc working now. But there is still a problem I can't understand.
following are my codes about adc:
static struct tsc_data am335x_touchscreen_data = {
.wires = 0,
.x_plate_resistance = 200,
.steps_to_configure = 5,
};
static struct adc_data am335x_adc_data = {
.adc_channels = 8,
};
static struct mfd_tscadc_board tscadc = {
.tsc_init = &am335x_touchscreen_data,
.adc_init = &am335x_adc_data,
};
static struct pinmux_config adc_pin_mux[] = {
{"ain0.ain0", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
{"vrefp.vrefp", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
{"vrefn.vrefn", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
{NULL, 0},
};
when I use this code, the correspoding file in iio is: /sys/bus/iio/devices/iio\:device0/in_voltage0_raw
that's OK.
however, because I use only the "ain0" to get the battery voltage. when I change the code to :
static struct adc_data am335x_adc_data = {
.adc_channels = 1,
};
with anything else unchanged. there is only one file in iio, it's "in_voltage7_raw". and it can not work right !
Does anyone know how this happen ?