[alsa-devel] [PATCH 2/2] ALSA: hda: support for wallclock timestamps

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Fri Jun 15 12:02:38 CEST 2012

>> +struct azx_timecounter {
>> +	cycle_t cycle_last;
>> +	cycle_t mask;
>> +	cycle_t elapsed_cycles;
>> +	u64     initial_time_nsec;
>> +	u32     mult;
>> +	u32     shift;
>> +};
> Any reason not using the normal struct timecounter stuff?
> Most of the open codes can be replaced gracefully with functions /
> macros there, I guess.

Yes there is a reason. The conversion from wall clock cycles to ns is a 
fractional operation (125/3 ratio from 24 MHz to 1 GHz). If you do this 
conversion to ns every time, you will accumulate rounding errors. That 
doesn't seem like a very good design if the precision depends on the 
duration of the track...
On top of this, I couldn't find a way to pass the 'chip' argument in the 
cyclecounter .read() operation to map it to azx_read.
Makes sense?

More information about the Alsa-devel mailing list