From patchwork Wed Jan 11 11:49:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 9509907 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A71FF6075C for ; Wed, 11 Jan 2017 11:51:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D1F9285D3 for ; Wed, 11 Jan 2017 11:51:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DBE1285EE; Wed, 11 Jan 2017 11:51:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 596C6285D3 for ; Wed, 11 Jan 2017 11:51:00 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D185E266812; Wed, 11 Jan 2017 12:50:58 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 2E5D0266812; Wed, 11 Jan 2017 12:48:40 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 934DC267456; Wed, 11 Jan 2017 12:48:31 +0100 (CET) Received: from www.osadl.org (www.osadl.org [62.245.132.105]) by alsa0.perex.cz (Postfix) with ESMTP id 078BE266812 for ; Wed, 11 Jan 2017 12:48:29 +0100 (CET) Received: from debian01.hofrr.at (92-243-34-74.adsl.nanet.at [92.243.34.74] (may be forged)) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id v0BBmM0X019753; Wed, 11 Jan 2017 12:48:23 +0100 From: Nicholas Mc Guire To: Bard Liao Date: Wed, 11 Jan 2017 12:49:36 +0100 Message-Id: <1484135376-482-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 Cc: Oder Chiou , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Takashi Iwai , Liam Girdwood , Mark Brown , Nicholas Mc Guire Subject: [alsa-devel] [PATCH] ASoC: rt5651: use msleep for large delays X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP ulseep_range() uses hrtimers and provides no advantage over msleep() for larger delays. Fix up the 75/85ms delays here to use msleep() and reduce the load on the hrtimer subsystem. Signed-off-by: Nicholas Mc Guire --- As these are non-atomic regions and a delay of 75/85 ms implies that there is almost certainty multiple context switches occurring in the sleep time and thus relatively high jitter must be assumed with respect to actual wakeup time implying that there is little point in using high-resolution timers here. Patch was compile tested with: x86_64_defconfig + SND_SOC=m SND_SOC_INTEL_BYTCR_RT5651_MACH=m (implies CONFIG_SND_SOC_RT5651) Patch is aginast 4.10-rc3 (localversion-next is next-20170111) sound/soc/codecs/rt5651.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c index f5d3415..fb592b0 100644 --- a/sound/soc/codecs/rt5651.c +++ b/sound/soc/codecs/rt5651.c @@ -802,7 +802,7 @@ static int rt5651_hp_event(struct snd_soc_dapm_widget *w, case SND_SOC_DAPM_PRE_PMD: rt5651->hp_mute = 1; - usleep_range(70000, 75000); + msleep(75); break; default: @@ -822,7 +822,7 @@ static int rt5651_hp_post_event(struct snd_soc_dapm_widget *w, switch (event) { case SND_SOC_DAPM_POST_PMU: if (!rt5651->hp_mute) - usleep_range(80000, 85000); + msleep(85); break;