iio: staging: adc: palmas: Correct auto conversion period
Jinyoung Park [Fri, 29 Nov 2013 05:43:13 +0000 (14:43 +0900)]
Corrected auto conversion period calculation.

Bug 1366274

Change-Id: I9228bf66d614c327aa85c0c2d785e75dd53426cc
Signed-off-by: Jinyoung Park <jinyoungp@nvidia.com>
Reviewed-on: http://git-master/r/336846
Reviewed-by: Harry Hong <hhong@nvidia.com>
Tested-by: Harry Hong <hhong@nvidia.com>

drivers/staging/iio/adc/palmas_gpadc.c

index 08771ac..078c4ce 100644 (file)
@@ -654,8 +654,8 @@ static int palmas_adc_wakeup_configure(struct palmas_gpadc *adc)
 
        adc_period = adc->auto_conversion_period;
        for (i = 0; i < 16; ++i) {
-               if (((1000 * (1 << i))/32) < adc_period)
-                       continue;
+               if (((1000 * (1 << i))/32) > adc_period)
+                       break;
        }
        if (i > 0)
                i--;