[alsa-devel] [PATCH 2/3] ALSA - hda: Add support for link audio time reporting

Vinod Koul vinod.koul at intel.com
Mon Jul 11 16:11:59 CEST 2016


On Mon, Jul 11, 2016 at 12:32:07PM +0200, Takashi Iwai wrote:
> On Mon, 11 Jul 2016 12:13:28 +0200,
> Vinod Koul wrote:
> > 
> > From: Guneshwor Singh <guneshwor.o.singh at intel.com>
> > 
> > Skylake onwards HDA controller supports reprting link audio
> > time, so add support for that.
> 
> It's way too few description, the text is almost same as the previous
> patch.  Please give more information.

Sure will add.

> >  #define CREATE_TRACE_POINTS
> >  #include "hda_controller_trace.h"
> >  
> > +#define SEC_TO_NSEC	1000000000LL
> 
> Can we use a definition in time64.h?

Yes NSEC_PER_SEC seems right, will update. Thanks for pointing

> >  
> > +static u64 azx_scale64(u64 base, u32 num, u32 den)
> > +{
> > +	u64 rem;
> > +
> > +	rem = do_div(base, den);
> > +
> > +	base *= num;
> > +	rem *= num;
> > +
> > +	do_div(rem, den);
> > +
> > +	return base + rem;
> > +}
> 
> What is this function supposed to do?

It is supposed to scale the timestamp values. Will try to add more comments
on this one.

> > +		ll_counter = (ll_counter_h << LLPC_CCU_SHIFT) |	ll_counter_l;
> > +		wallclk_cycles = wallclk_ctr & WALFCC_CIF_MASK;
> > +
> > +		if (wallclk_cycles < HDA_MAX_CYCLE_VALUE - HDA_MAX_CYCLE_OFFSET
> > +		    && wallclk_cycles > HDA_MAX_CYCLE_OFFSET)
> > +			break;
> 
> Is this condition really correct...?  It's hard to understand.

Looks so, i will double check

> > +	*device = ktime_add_ns(*device, (wallclk_cycles * SEC_TO_NSEC) /
> > +			       ((HDA_MAX_CYCLE_VALUE+1) * runtime->rate));
> 
> Hmm, the calculation here looks as if there can be an optimization...

Hmmm, let me try to optimize this bit

-- 
~Vinod


More information about the Alsa-devel mailing list