Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751449AbeABTxE (ORCPT + 1 other); Tue, 2 Jan 2018 14:53:04 -0500 Received: from mga02.intel.com ([134.134.136.20]:33914 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751014AbeABTxD (ORCPT ); Tue, 2 Jan 2018 14:53:03 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,498,1508828400"; d="scan'208";a="16283383" Subject: Re: [alsa-devel] [PATCH 15/27] ALSA: hda - Use timecounter_initialize interface To: Richard Cochran Cc: alsa-devel@alsa-project.org, Takashi Iwai , linux-kernel@vger.kernel.org, Vinod Koul , Thomas Gleixner , Sagar Arun Kamble References: <1513323522-15021-1-git-send-email-sagar.a.kamble@intel.com> <1513323522-15021-16-git-send-email-sagar.a.kamble@intel.com> <20171215165125.avkz25eek56i5md4@localhost> <20171228164944.crphv46zegvwautk@localhost> <1a9a1507-7ca3-459b-c2ce-02fc2afad2ff@intel.com> <3c5734a2-8f97-4a8b-26d4-42852cc86352@linux.intel.com> <20180102182146.vbfnihz73lhgf6lc@localhost> From: Pierre-Louis Bossart Message-ID: <9f09abee-68b8-4515-131f-0f3e210503b0@linux.intel.com> Date: Tue, 2 Jan 2018 13:53:01 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180102182146.vbfnihz73lhgf6lc@localhost> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 1/2/18 12:21 PM, Richard Cochran wrote: > On Tue, Jan 02, 2018 at 11:15:45AM -0600, Pierre-Louis Bossart wrote: >> I wrote the code for HDaudio and I remember wasting time trying to figure >> out the gory details of the cycle counter stuff when all I wanted was a >> conversion from a 24MHz counter to ns values using a 125/3 operation in the >> right order - as explained in the comments > > Would using clocks_calc_mult_shift() work for you? In theory yes, but I'd need to re-check what the results would be. I remember applying the 1/3 factor separately to avoid wrap-around after 4 hours [1], but I can't remember the details on the analysis. I can't figure out what the 'maxsec' argument should be either. [1] http://elixir.free-electrons.com/linux/latest/source/sound/hda/hdac_stream.c#L486