mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
iio: adc: try to get flag again after the first failure [2/2]
PD#SH-451 Problem: to get flag maybe occasionally fail Solution: try to get flag again after the first failure Verify: test pass on s400 Change-Id: Ibf430c9c331c7740864e797047962ad45e6698e3 Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
This commit is contained in:
@@ -619,6 +619,7 @@ static int meson_sar_adc_lock(struct iio_dev *indio_dev)
|
||||
mutex_lock(&indio_dev->mlock);
|
||||
|
||||
if (priv->data->has_bl30_integration) {
|
||||
again:
|
||||
/* wait until BL30 releases it's lock (so we can use
|
||||
* the SAR ADC)
|
||||
*/
|
||||
@@ -636,10 +637,10 @@ static int meson_sar_adc_lock(struct iio_dev *indio_dev)
|
||||
MESON_SAR_ADC_DELAY_KERNEL_BUSY);
|
||||
isb();
|
||||
dsb(sy);
|
||||
udelay(1);
|
||||
udelay(5);
|
||||
regmap_read(priv->regmap, MESON_SAR_ADC_DELAY, &val);
|
||||
if (val & MESON_SAR_ADC_DELAY_BL30_BUSY)
|
||||
return -ETIMEDOUT;
|
||||
goto again;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -649,10 +650,14 @@ static void meson_sar_adc_unlock(struct iio_dev *indio_dev)
|
||||
{
|
||||
struct meson_sar_adc_priv *priv = iio_priv(indio_dev);
|
||||
|
||||
if (priv->data->has_bl30_integration)
|
||||
if (priv->data->has_bl30_integration) {
|
||||
/* allow BL30 to use the SAR ADC again */
|
||||
regmap_update_bits(priv->regmap, MESON_SAR_ADC_DELAY,
|
||||
MESON_SAR_ADC_DELAY_KERNEL_BUSY, 0);
|
||||
isb();
|
||||
dsb(sy);
|
||||
udelay(5);
|
||||
}
|
||||
|
||||
mutex_unlock(&indio_dev->mlock);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user