Hi Ahmad, On 11/5/20 7:46 PM, Ahmad Fatoum wrote: > Hello Benjamin, > Hello Fabrice, > > In the stm32-timer-cnt driver I find unused #defines for TIM_CCMR_MASK and > TIM_CCER_MASK, which to me hint that support for the "input capture mode"[1] > was implemented but removed prior to upstreaming. Indeed, I'm not sure why such defines have been added in stm32-timer-cnt. They could probably be removed (and are possibly redundant with other definitions in STM32 PWM/capture driver...) > > It doesn't look like the counter device API is yet made to support such > an input capture mode (latching a counter value on an external event, e.g. > to timestamp incoming rising edges to measure jitter between pulses). Regarding recent updates for the counter device API, maybe William could bring some hints (I haven't checked or had time to follow this up :-(). > > I am still very new to this, so I figured I ask whether you already have > thoughts (or maybe code to share) on how to best integrate this with the > counter device API. FYI, The only use of the STM32 timer input capture mode currently implemented (in STM32 timer Linux drivers) is through the PWM capture interface (drivers/pwm/pwm-stm32.c). It's using 40.3.8 PWM input mode which is a particular case of input capture mode you point in [1]. Not sure if this can help for time-stamping (at best as code example?). One though I have is: a particular timer will be able to do either quadrature encoder or input capture... So likely timestamping would require an additional timer. But I haven't really checked how this could be implemented in the hardware or driver. May I ask a bit more information regarding your needs here? Regards, Fabrice > > I've added linux-iio/linux-stm32 to the CC as well, so if someone else > has an idea how to best do this, please share. > > [1]: 40.3.7 in RM0436 rev 3 > > Cheers, > Ahmad >