From patchwork Fri Oct 12 15:32:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10638815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C1B751869 for ; Fri, 12 Oct 2018 15:33:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B001C2BCCE for ; Fri, 12 Oct 2018 15:33:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A46532BFB7; Fri, 12 Oct 2018 15:33:45 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3E4D12BCCE for ; Fri, 12 Oct 2018 15:33:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=eNoEMmGvVZCq/c2pl/RYHEDIi0Z2V23EPCqgGKv4YmE=; b=EL+FRFGtmy7r7w d/W3M61HuQQtpDEJ8slwFRFKS9TTdS0UqvrtwxhH9dUwQ42OYTZp/ZAAWFZo0k5hzI2dsZsqHIKw3 gMiai8zHk3BiCdp9ualkhicDDB6KWjEf/BHKgHLhqmOxn5L1Vt5rTgtsmaiXLpdOC6A1K2zi71d0V ywr63QKK7SUIxWOyxnBMPzFTR+ml5QnSeFZgaxUhrQrTm1kikz6jE8SnW84tISr5W/9aeH3GgTGny +g8LCes8FOk9MrIRvH9nKtfFoD3tSJknX+PGC7V79mrSEI9ym6r6DxwRkkSlGN46TNQWLP9gl8lx+ YiGBoQm8416IZmJZVEOg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAzRW-0002GM-8p; Fri, 12 Oct 2018 15:33:34 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAzRT-0002FC-94 for linux-arm-kernel@lists.infradead.org; Fri, 12 Oct 2018 15:33:32 +0000 Received: by mail-pl1-x641.google.com with SMTP id f18-v6so6116091plr.1 for ; Fri, 12 Oct 2018 08:33:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0EQGg3omqD7uQjtqL87tXa6pFaN1NOUw/Ac44EC6Mrw=; b=o/FcS/JMRbu0d0JCLy6F7aFb9xDGQza1qj3c2YqpWqZNIkH/XJWnFpmhGBRJcR+M21 jg7LAz+Nf0XNz1BlesV0p02Tg+9G0rIa08ZLGHt7vKA4xrr0Xj/nhjbgPk8/YfD99k6x timG0XQS+n/ei/UtUGnPpnzu45tLtcJIPN7ll1KmIBi+W6y/Atlk2/Qpp2HrBenuQs0X 6M1U8HMhi9cThpGnHWiy2rxHX6NaCvaAbOUJ9gZpLs7HK9eNjqIOL3VXju9ikyGZFBl/ LHeDKJuBGTflkWXVlPCmp0KmPmOf9J1O4P56gdjywrpL1D00bG0pK01i5ENYgj548NSh TkNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0EQGg3omqD7uQjtqL87tXa6pFaN1NOUw/Ac44EC6Mrw=; b=CgNKye+P5h3gBwUniH+Lw3sPdSlxMlEJbiUix9FzBKS8cwZUuYD0tCPBdbLeWtL6qP 5pWv6hCy/U78526ANyAKyuOCSB/ximlDHcG6b0+i0phH/wsJf5D7lVl7u3a0cfKkc0DD Dpe5JEE34lD2FQD/3y4EtBvpqXwPw5a7Ki5oevb9SXY5X80EFiTVlhTBJ2PWqOIO4ysL r33tJDHiMttneNQw6qlkXu4b66gpPOE7xIAU7FAzoII9kCBw68WUqTa8X7miHCpcM1VP 84qSKhiBhnkY8+JDztpCcNwnKCV2BcI0jrKFfKTVXWQmvFfQrq0u5nn3u8TO3NZKUTJ0 IWeQ== X-Gm-Message-State: ABuFfohCNqLhWsZVyQJkOHDFETTsotU6li6EGso/ks4tDYKzUws0c+xL R5Hk3fl2i3BA94GkW4OtIos= X-Google-Smtp-Source: ACcGV62s7CQn5XF0FxMETWJyUkQAfuGQMqSWbhtpHcHWyc6snuhUW+Nq2DlD8+KV0DHbvTndz10klQ== X-Received: by 2002:a17:902:7b84:: with SMTP id w4-v6mr6220851pll.32.1539358400315; Fri, 12 Oct 2018 08:33:20 -0700 (PDT) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id 126-v6sm2403131pfd.16.2018.10.12.08.33.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 08:33:19 -0700 (PDT) From: Vasily Khoruzhick To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Maxime Ripard , Chen-Yu Tsai , Marcus Cooper , Yong Deng , alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] ASoC: sun4i-i2s: don't try to start up or shut down DAI if it's active Date: Fri, 12 Oct 2018 08:32:54 -0700 Message-Id: <20181012153254.10844-1-anarsoul@gmail.com> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181012_083331_328789_9CE26348 X-CRM114-Status: GOOD ( 10.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasily Khoruzhick Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Otherwise we may end up with shutting down I2S if shutdown() was called for capture substream, but playback is still running. Signed-off-by: Vasily Khoruzhick --- sound/soc/sunxi/sun4i-i2s.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index a9ea329dc046..787b67c4f845 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -649,6 +649,9 @@ static int sun4i_i2s_startup(struct snd_pcm_substream *substream, { struct sun4i_i2s *i2s = snd_soc_dai_get_drvdata(dai); + if (dai->active) + return 0; + /* Enable the whole hardware block */ regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG, SUN4I_I2S_CTRL_GL_EN, SUN4I_I2S_CTRL_GL_EN); @@ -667,6 +670,9 @@ static void sun4i_i2s_shutdown(struct snd_pcm_substream *substream, { struct sun4i_i2s *i2s = snd_soc_dai_get_drvdata(dai); + if (dai->active) + return; + clk_disable_unprepare(i2s->mod_clk); /* Disable our output lines */