Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers:iio:light:isl29125: added macros for sensing range

Added macros for sensing range as the corresponding magic numbers
were used at multiple places.
- ISL29125_SENSING_RANGE_0 for 375 lux full range
- ISL29125_SENSING_RANGE_1 for 10k lux full range

Signed-off-by: Bijosh Thykkoottathil <bijosh.t@hotmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>

authored by

Bijosh Thykkoottathil and committed by
Jonathan Cameron
60b1addb 90efe055

+7 -4
+7 -4
drivers/iio/light/isl29125.c
··· 44 44 #define ISL29125_MODE_B 0x3 45 45 #define ISL29125_MODE_RGB 0x5 46 46 47 + #define ISL29125_SENSING_RANGE_0 5722 /* 375 lux full range */ 48 + #define ISL29125_SENSING_RANGE_1 152590 /* 10k lux full range */ 49 + 47 50 #define ISL29125_MODE_RANGE BIT(3) 48 51 49 52 #define ISL29125_STATUS_CONV BIT(1) ··· 142 139 case IIO_CHAN_INFO_SCALE: 143 140 *val = 0; 144 141 if (data->conf1 & ISL29125_MODE_RANGE) 145 - *val2 = 152590; /* 10k lux full range */ 142 + *val2 = ISL29125_SENSING_RANGE_1; /*10k lux full range*/ 146 143 else 147 - *val2 = 5722; /* 375 lux full range */ 144 + *val2 = ISL29125_SENSING_RANGE_0; /*375 lux full range*/ 148 145 return IIO_VAL_INT_PLUS_MICRO; 149 146 } 150 147 return -EINVAL; ··· 160 157 case IIO_CHAN_INFO_SCALE: 161 158 if (val != 0) 162 159 return -EINVAL; 163 - if (val2 == 152590) 160 + if (val2 == ISL29125_SENSING_RANGE_1) 164 161 data->conf1 |= ISL29125_MODE_RANGE; 165 - else if (val2 == 5722) 162 + else if (val2 == ISL29125_SENSING_RANGE_0) 166 163 data->conf1 &= ~ISL29125_MODE_RANGE; 167 164 else 168 165 return -EINVAL;