iio: adc: ti-ads1298: Add parentheses around macro parameter
PATCH v3 1/3 iio: adc: ti-ads1298: Add parentheses around macro parameter
ADS1298_REG_CHnSET() is missing parentheses around the parameter 'n'. Add them to follow kernel macro coding style and prevent potential operator precedence issues if the argument is an expression.
--- drivers/iio/adc/ti-ads1298.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti-ads1298.c +1 -1
@@ -66,7 +66,7 @@#define ADS1298_MASK_CONFIG3_VREF_4V BIT(5)#define ADS1298_REG_LOFF 0x04 -#define ADS1298_REG_CHnSET (n) (0x05 + n) +#define ADS1298_REG_CHnSET (n) (0x05 + (n))#define ADS1298_MASK_CH_PD BIT(7)#define ADS1298_MASK_CH_PGA GENMASK(6, 4)#define ADS1298_MASK_CH_MUX GENMASK(2, 0)
--
2.54.0.windows.1
PATCH v3 2/3 iio: adc: ti-ads1298: Fix timeout comment and value
At the lowest supported data rate of 250Hz, one conversion period is 4ms, not 40ms. Fix the comment to correctly reflect the timing and reduce the timeout from 50ms to 5ms, which is still more than enough margin.
--- drivers/iio/adc/ti-ads1298.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ti-ads1298.c +2 -2
@@ -210,7 +210,7 @@ static int ads1298_read_one(struct ads1298_private *priv, int chan_index)return ret; } -/* Cannot take longer than 40ms (250Hz) */ - ret =wait_for_completion_timeout (&priv->completion,msecs_to_jiffies (50 )); +/* Cannot take longer than 4ms at the lowest rate (250Hz) */ + ret =wait_for_completion_timeout (&priv->completion,msecs_to_jiffies (5 ));if (!ret)return -ETIMEDOUT ;
--
2.54.0.windows.1
PATCH v3 3/3 iio: adc: ti-ads1298: Remove unnecessary CONFIG2 write during init
In reply to Md Shofiqul IslamThe driver was enabling the internal test signal (INT_TEST), double amplitude (TEST_AMP), and fast frequency (TEST_FREQ_FAST) bits in CONFIG2 during initialization. These bits activate an internal square wave generator intended for device testing and calibration, not normal ECG operation.
CONFIG2 defaults to having only the RESERVED bit set after reset, which is the correct value for normal operation. Remove the write entirely since it would just be writing the reset default value.
--- drivers/iio/adc/ti-ads1298.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/iio/adc/ti-ads1298.c +0 -9
@@ -615,15 +615,6 @@ static int ads1298_init(struct iio_dev *indio_dev)if (!indio_dev->name)return -ENOMEM ; -/* Enable internal test signal, double amplitude, double frequency */ - ret =regmap_write (priv->regmap,ADS1298_REG_CONFIG2 , -ADS1298_MASK_CONFIG2_RESERVED | -ADS1298_MASK_CONFIG2_INT_TEST | -ADS1298_MASK_CONFIG2_TEST_AMP | -ADS1298_MASK_CONFIG2_TEST_FREQ_FAST ); -if (ret) -return ret; - val =ADS1298_MASK_CONFIG3_RESERVED ;/* Must write 1 always */ if (!priv->reg_vref) {/* Enable internal reference */
--
2.54.0.windows.1
Quoted 3 lines · Md Shofiqul Islam
ADS1298_REG_CHnSET()is missing parentheses around the parameter 'n'. Add them to follow kernel macro coding style and prevent potential operator precedence issues if the argument is an expression.
This is series of three patches and missed the cover letter which has to provide the purpose of the series and the changelog (it's v3).
Please, always provide that message. You can use my "smart" script [1] that helps with that.
[1]: https://github.com/andy-shev/home-bin-tools/blob/master/ge2maintainer.sh
Signature · 2 lines
With Best Regards, Andy Shevchenko