Skip to content

Commit 9394110

Browse files
ukleineknunojsa
authored andcommitted
iio: adc: ad4134: Specify PWM parameters in nanoseconds
With ref_clk running with a rate not bigger than 1 GHz there is no gain in using picosecond units as two different PWM settings differ by at least one nanosecond. So there is no need to differ from upstream where the pwm subsystem uses nanoseconds to specify PWM parameters. With the goal to drop support for time_unit, don't explicitly set state.time_unit = PWM_UNIT_NSEC but rely on this being the default. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
1 parent 429383d commit 9394110

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/iio/adc/ad4134.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,8 @@ static int _ad4134_set_odr(struct ad4134_state *st, unsigned int odr)
9595
* tODR_HIGH_TIME = 3 * tDIGCLK
9696
* See datasheet page 10, Table 3. Data Interface Timing with Gated DCLK.
9797
*/
98-
state.duty_cycle = DIV_ROUND_CLOSEST_ULL(PICO * 6, st->sys_clk_rate);
99-
state.period = DIV_ROUND_CLOSEST_ULL(PICO, odr);
100-
state.time_unit = PWM_UNIT_PSEC;
98+
state.duty_cycle = DIV_ROUND_CLOSEST_ULL(6ULL * NSEC_PER_SEC, st->sys_clk_rate);
99+
state.period = DIV_ROUND_CLOSEST(NSEC_PER_SEC, odr);
101100

102101
ret = pwm_apply_state(st->odr_pwm, &state);
103102
if (ret)

0 commit comments

Comments
 (0)