Re: [PATCH 1/2] iio: adc: ti-ads1015: fix conversion time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 1, 2017 at 11:26 AM, Ladislav Michl <ladis@xxxxxxxxxxxxxx> wrote:
> When reading diffrent channel value than device is currently processing
> wait time of conversion period is applied, which is not enough as device
> might be already in the middle of conversion and therefore previously
> converted value is returned - the one belonging to another channel.
> Fix it by waiting for two sampling periods.
>
> Signed-off-by: Ladislav Michl <ladis@xxxxxxxxxxxxxx>

Did you actually experienced this in practice? I guess you are right,
if you change the channel during a conversion, this change will be applied
to the next conversion *but* reading will still return old value because the
current conversion hasn't finished yet.

So,

Acked-by: Daniel Baluta <daniel.baluta@xxxxxxxxx>


> ---
>  drivers/iio/adc/ti-ads1015.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
> index 884b8e461b17..86fd2753869d 100644
> --- a/drivers/iio/adc/ti-ads1015.c
> +++ b/drivers/iio/adc/ti-ads1015.c
> @@ -260,7 +260,7 @@ int ads1015_get_adc_result(struct ads1015_data *data, int chan, int *val)
>                 return ret;
>
>         if (change) {
> -               conv_time = DIV_ROUND_UP(USEC_PER_SEC, data->data_rate[dr]);
> +               conv_time = 2 * DIV_ROUND_UP(USEC_PER_SEC, data->data_rate[dr]);
>                 usleep_range(conv_time, conv_time + 1);
>         }
>
> --
> 2.11.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux