This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
We meet a problem about reading the ADC in AM335X platform, the problem is as below:
1- The application is stuck while getting the ADC, the staus of the process is "D (Disk sleep)"
2- The stack of the process is as below:
[<c0599c9c>] am335x_tsc_se_set_once+0x138/0x1a0
[<c0781f3c>] tiadc_read_raw+0xe4/0x1b4
[<c077d174>] iio_channel_read+0xa8/0xb8
[<c077d220>] iio_read_channel_raw+0x4c/0x6c
[<bf09c070>] wfet_adc_read+0x70/0xb8 [wfos_adc]
[<bf0a4358>] wfet_battery_voltage_get_by_chan+0xc0/0xf8 [wfos_pm]
[<bf0a4650>] wfet_battery_read+0x54/0xdc [wfos_pm]
[<c0274684>] __vfs_read+0x38/0x12c
[<c0274810>] vfs_read+0x98/0x11c
[<c0274cf0>] SyS_read+0x4c/0xa0
[<c0108180>] arm_elf_read_implies_exec+0x50/0x50
[<ffffffff>] 0xffffffff
I have found the finally position of the stack, it is in ti_am335x_tscadc.c and the function is am335x_tscadc_need_adc
static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tscadc)
{
DEFINE_WAIT(wait);
u32 reg;
regmap_read(tscadc->regmap, REG_ADCFSM, ®);
if (reg & SEQ_STATUS) {
tscadc->adc_waiting = true;
prepare_to_wait(&tscadc->reg_se_wait, &wait,
TASK_UNINTERRUPTIBLE);
spin_unlock_irq(&tscadc->reg_lock);
schedule();
spin_lock_irq(&tscadc->reg_lock);
finish_wait(&tscadc->reg_se_wait, &wait);
/*
* Sequencer should either be idle or
* busy applying the charge step.
*/
regmap_read(tscadc->regmap, REG_ADCFSM, ®);
WARN_ON((reg & SEQ_STATUS) && !(reg & CHARGE_STEP));
tscadc->adc_waiting = false;
}
tscadc->adc_in_use = true;
}
when the REG_ADCFSM is busy, then the process enter in sleep mode and wait for wake-up, but nobody wake it,
so the process stuck all the time, please help to fix the problem, or give some ideas,thanks.