Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp256650ybd; Tue, 25 Jun 2019 20:53:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwb5dVpvf+yXDtnJl0mQgst5x53wxdqpAVlpHCjrkIBBTK8iDs12UdDk879O/1Yc5rOIA1Y X-Received: by 2002:a17:902:296a:: with SMTP id g97mr2555229plb.115.1561521181702; Tue, 25 Jun 2019 20:53:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561521181; cv=none; d=google.com; s=arc-20160816; b=PUW2lwqQdsxepf6DcMCxwttn3UyS+BsrcntsfrMKn6gKExaquCn+3KjCOllCSi7CVG 8f2fd1idb9Hn49N3g6FxbvzqfqVRAdYudgywMLqZ5qvO7LF00jOB5t51Y7th5D/J+icd UO6dY1ABw2vC7GL0sgRnP38cjer0O6vLSTmlPCcRruvnt1GLHXrdkndVBoBObtr8kToQ fPhPzCVQqtJhwXok3xa6WZc+pl1F//bLcTvgLzBJhMpruAHA/HSDIILPXowGnGg7b52U c0vVSr4lVNUhibusMVDU/H78ODW0aaKCqU9IH/i3aPcy8CMh5LG5Zfm9950aCd6ptAro tsAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fXHClJ2Ov9SoNGtW/BBFLvo4FuFw4KePUkZoM+p6uiU=; b=kjP6D22Izl0hvaFv+8t9owYxa8Szb7JKiefWZdazv68xRG5ALN7CZyelBvDEA2Mkuv EVQFUVHCpMqPKNVzu4SobmkQlOO0dfMAciGOW0VhdHske8XrJlB+pHpRbl6O8nCN0YmK L6YzBy5yLhMR3XU5urEH0zkw6ROmXdkyQC4SvB2aUE1wAUITGVqI+u8L0CeZCwg3sEjE 2SIs7OI3KUgZIKfBCmnhYhJGA4ZO9m0YJhua/WzUuhjxaB7fM5jsQLqPoGDfnmEqQ+9Y lvoVpKDH9RaK/nUoh+aWnE6/0wD7YvTEJd9w7nY1DNGAvux4UYC/5qFhNGlB/MzNIslJ 2UFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kwGjzGsy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12si15328379pgr.325.2019.06.25.20.52.45; Tue, 25 Jun 2019 20:53:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kwGjzGsy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727162AbfFZDuv (ORCPT + 99 others); Tue, 25 Jun 2019 23:50:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:52220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726819AbfFZDln (ORCPT ); Tue, 25 Jun 2019 23:41:43 -0400 Received: from sasha-vm.mshome.net (mobile-107-77-172-74.mobile.att.net [107.77.172.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AFF8E2146E; Wed, 26 Jun 2019 03:41:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561520502; bh=trAJRYMsW7mYtFLtD9y9stdKjKGvaJ2zZufxV8nukII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kwGjzGsyXAaUemVjnRcuCvWCi27D99VUR29wO80XNgdeUutlwIi1mu6+j6n6wsh8t nPglkifVcOryUJba9V1d1z5/817/PuCOYZhH9qAshXfw6jpCEDfpG0WSj3GuYGegJF +EvHtNmmN5Ltm7ZddjFh4Blpep0zT/uneUxgIZTk= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Georgii Staroselskii , Chen-Yu Tsai , Mark Brown , Sasha Levin Subject: [PATCH AUTOSEL 5.1 11/51] ASoC: sun4i-codec: fix first delay on Speaker Date: Tue, 25 Jun 2019 23:40:27 -0400 Message-Id: <20190626034117.23247-11-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190626034117.23247-1-sashal@kernel.org> References: <20190626034117.23247-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Georgii Staroselskii [ Upstream commit 1f2675f6655838aaf910f911fd0abc821e3ff3df ] Allwinner DAC seems to have a delay in the Speaker audio routing. When playing a sound for the first time, the sound gets chopped. On a second play the sound is played correctly. After some time (~5s) the issue gets back. This commit seems to be fixing the same issue as bf14da7 but for another codepath. This is the DTS that was used to debug the problem. &codec { allwinner,pa-gpios = <&r_pio 0 11 GPIO_ACTIVE_HIGH>; /* PL11 */ allwinner,audio-routing = "Speaker", "LINEOUT"; status = "okay"; } Signed-off-by: Georgii Staroselskii Reviewed-by: Chen-Yu Tsai Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sunxi/sun4i-codec.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c index 15d08e343b47..28d2f7713f8d 100644 --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c @@ -1329,6 +1329,15 @@ static int sun4i_codec_spk_event(struct snd_soc_dapm_widget *w, gpiod_set_value_cansleep(scodec->gpio_pa, !!SND_SOC_DAPM_EVENT_ON(event)); + if (SND_SOC_DAPM_EVENT_ON(event)) { + /* + * Need a delay to wait for DAC to push the data. 700ms seems + * to be the best compromise not to feel this delay while + * playing a sound. + */ + msleep(700); + } + return 0; } -- 2.20.1