Skip to content

Commit 7cda467

Browse files
ubiedanashif
authored andcommitted
sensor: vcnl36825t: Scrub redundant scaling on meas_timeout_us
Confirming the Proximity Integration is an integer, we don't need to pre-apply the Scaling factor to then be accounted for when the actual meas_timeout_us is calculated. Signed-off-by: Luis Ubieda <luisf@croxel.com>
1 parent 51ad3d3 commit 7cda467

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/sensor/vishay/vcnl36825t/vcnl36825t.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,21 +240,21 @@ static int vcnl36825t_init_registers(const struct device *dev)
240240
switch (config->proximity_it) {
241241
case VCNL36825T_PROXIMITY_INTEGRATION_1T:
242242
reg_value |= VCNL36825T_PS_IT_1T;
243-
data->meas_timeout_us *= 1 * VCNL36825T_FORCED_FACTOR_SCALE;
243+
data->meas_timeout_us *= 1;
244244
break;
245245
case VCNL36825T_PROXIMITY_INTEGRATION_2T:
246246
reg_value |= VCNL36825T_PS_IT_2T;
247-
data->meas_timeout_us *= 2 * VCNL36825T_FORCED_FACTOR_SCALE;
247+
data->meas_timeout_us *= 2;
248248
break;
249249
case VCNL36825T_PROXIMITY_INTEGRATION_4T:
250250
reg_value |= VCNL36825T_PS_IT_4T;
251-
data->meas_timeout_us *= 4 * VCNL36825T_FORCED_FACTOR_SCALE;
251+
data->meas_timeout_us *= 4;
252252
break;
253253
case VCNL36825T_PROXIMITY_INTEGRATION_8T:
254254
__fallthrough;
255255
default:
256256
reg_value |= VCNL36825T_PS_IT_8T;
257-
data->meas_timeout_us *= 8 * VCNL36825T_FORCED_FACTOR_SCALE;
257+
data->meas_timeout_us *= 8;
258258
break;
259259
}
260260

@@ -377,7 +377,7 @@ static int vcnl36825t_init_registers(const struct device *dev)
377377
*/
378378
data->meas_timeout_us =
379379
(data->meas_timeout_us * VCNL36825T_FORCED_FACTOR_SUM) /
380-
(VCNL36825T_FORCED_FACTOR_SCALE * VCNL36825T_FORCED_FACTOR_SCALE) +
380+
(VCNL36825T_FORCED_FACTOR_SCALE) +
381381
1;
382382

383383
return 0;

0 commit comments

Comments
 (0)