iio: adc: rockchip_saradc: fix RK3588 channel issue

If read multiple channels at the same time, channel 1 will
error, add assert when start saradc as a workaround.

Change-Id: Iababf604b200555a46a96e1ca0bc7108c6df8680
Signed-off-by: Simon Xue <xxm@rock-chips.com>
This commit is contained in:
Simon Xue
2021-11-13 14:17:42 +08:00
committed by Tao Huang
parent cea2902425
commit 57ed5527ed
+10 -1
View File
@@ -82,6 +82,8 @@ struct rockchip_saradc {
#endif
};
static void rockchip_saradc_reset_controller(struct reset_control *reset);
static void rockchip_saradc_start_v1(struct rockchip_saradc *info,
int chn)
{
@@ -97,6 +99,12 @@ static void rockchip_saradc_start_v2(struct rockchip_saradc *info,
{
int val;
/* If read other chn at anytime, then chn1 will error, assert
* controller as a workaround.
*/
if (info->reset)
rockchip_saradc_reset_controller(info->reset);
writel_relaxed(0xc, info->regs + SARADC_T_DAS_SOC);
writel_relaxed(0x20, info->regs + SARADC_T_PD_SOC);
val = SARADC2_EN_END_INT << 16 | SARADC2_EN_END_INT;
@@ -149,8 +157,9 @@ static int rockchip_saradc_conversion(struct rockchip_saradc *info,
{
reinit_completion(&info->completion);
rockchip_saradc_start(info, chan->channel);
/* prevent isr get NULL last_chan */
info->last_chan = chan;
rockchip_saradc_start(info, chan->channel);
if (!wait_for_completion_timeout(&info->completion, SARADC_TIMEOUT))
return -ETIMEDOUT;