From patchwork Mon Apr 29 13:29:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10921823 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 5EDF81398 for ; Mon, 29 Apr 2019 13:30:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F7E9286A1 for ; Mon, 29 Apr 2019 13:30:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DA002880A; Mon, 29 Apr 2019 13:30:51 +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_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 09D3628922 for ; Mon, 29 Apr 2019 13:30:49 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D06CE1660; Mon, 29 Apr 2019 15:29:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D06CE1660 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556544647; bh=alszsw4kxd6BWHYqE9KsWHvAj0iIyuYUhKqGhhE2SgM=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=vG0QEj9QfWSfmUYrjJpxhSKi8f3MB2xGmgV96tbyrfUZkwGeONwIsbKOxDpjDl0WS QeyszN5x47OAFBNTZoUOheFgciIYVycFtDZXhvT5te3wFFQE48kXxbPzVKH5JP92r1 YYY2Z7b2+quGqIl0Mn/JUNlCeR3Q/Yy8HiR5gCsk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A65E7F89693; Mon, 29 Apr 2019 15:29:56 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id A7C38F896B7; Mon, 29 Apr 2019 15:29:53 +0200 (CEST) Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A8C19F80641 for ; Mon, 29 Apr 2019 15:29:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A8C19F80641 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="pFUVGdlR" Received: by mail-wr1-x442.google.com with SMTP id l2so406619wrb.9 for ; Mon, 29 Apr 2019 06:29:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u5gkjIo0jKHz5nMirUsgx+T49vpY9J+GcHz2XWc4FKc=; b=pFUVGdlRPrcuUqW2/0hELTzPbKKNEYhqDI3CkoHGbZm5Yq65C2D4IF8ZEXBAdCGtm8 6y06tr2gg4sOArlY8cGKjM3ebjdz0ngMoptkgu46RzVGo5BR9g2+DFM/wOEPtp9o8wT4 Rwoc0G8zd17SAbTmHP7FagKPPu93ZXMX/8yb+MbH4oV242MLkVQFh4kWT4loQuxdmu0x tYoULFW6Gm/RlFujGK8PtsjODesDRrDXCUEXXxbX1fOWnMy/BdnVREtQkCQeYj8X50nr ymiJSVYd7oFu6C++IEeQyMRAe+AFq2Wdm4m2vv7Zk3zP031MG5rTwCecm4QiH1gEyYXu Hx8A== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=u5gkjIo0jKHz5nMirUsgx+T49vpY9J+GcHz2XWc4FKc=; b=GWTBV/wB+obI9fweeVCXK2jQ7Dt6QcMZOIa46bAOzIngM8kNKdVNDVDPtEB8jRi1sG DU97cdWumCCTX670OBlLUw7Uf+FNt6wyGf/HoTXBsRODJmwdBTKoeSNLhRddBge0/+Db fqysQxLyrsL68nSn+88Y4RFCkvfPCsijjO6wC1oLJ9QPIPJqTm0BNStUzcMJkVlVrxlP KIsEMe756pqhoWobMR2MSHICT+c03lz/B5kybWa7dEkADwBnti5j6s1Y3TdGGgSn9Txk e031foAAy33s9WB8F0/DwGBeLdGaGeZLT4vJ8zZjw2rlv9OSF1/JUkYnSMVBP91cQekT 125w== X-Gm-Message-State: APjAAAVAW99YbhZQY132MSJ7EboxYq6+T3MEjC7HGTCfdE6HV26tmjV9 Lwb/cdZxXbfuiML/AW8FXfEHFg== X-Google-Smtp-Source: APXvYqwQRjw0fpniFRPWZPbufXRuMFumxyoEfAbrckJdhgOSUuRSLDn24hIGZQuswECs2edXbWvhNQ== X-Received: by 2002:a5d:4392:: with SMTP id i18mr10153524wrq.239.1556544589439; Mon, 29 Apr 2019 06:29:49 -0700 (PDT) Received: from boomer.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id s17sm2857593wra.94.2019.04.29.06.29.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 06:29:48 -0700 (PDT) From: Jerome Brunet To: Mark Brown , Liam Girdwood Date: Mon, 29 Apr 2019 15:29:38 +0200 Message-Id: <20190429132943.16269-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190429132943.16269-1-jbrunet@baylibre.com> References: <20190429132943.16269-1-jbrunet@baylibre.com> MIME-Version: 1.0 Cc: patchwork-bot+notify@kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Jerome Brunet Subject: [alsa-devel] [PATCH 1/6] ASoC: hdmi-codec: remove function name debug traces X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP Remove the debug traces only showing the function name on entry. The same can be obtained using ftrace. Signed-off-by: Jerome Brunet --- sound/soc/codecs/hdmi-codec.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index e5b6769b9797..9dca24732069 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -416,8 +416,6 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); int ret = 0; - dev_dbg(dai->dev, "%s()\n", __func__); - ret = hdmi_codec_new_stream(substream, dai); if (ret) return ret; @@ -453,8 +451,6 @@ static void hdmi_codec_shutdown(struct snd_pcm_substream *substream, { struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); - dev_dbg(dai->dev, "%s()\n", __func__); - WARN_ON(hcp->current_stream != substream); hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; @@ -531,8 +527,6 @@ static int hdmi_codec_set_fmt(struct snd_soc_dai *dai, struct hdmi_codec_daifmt cf = { 0 }; int ret = 0; - dev_dbg(dai->dev, "%s()\n", __func__); - if (dai->id == DAI_ID_SPDIF) { cf.fmt = HDMI_SPDIF; } else { @@ -602,8 +596,6 @@ static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute) { struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); - dev_dbg(dai->dev, "%s()\n", __func__); - if (hcp->hcd.ops->digital_mute) return hcp->hcd.ops->digital_mute(dai->dev->parent, hcp->hcd.data, mute); @@ -661,8 +653,6 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd, }; int ret; - dev_dbg(dai->dev, "%s()\n", __func__); - ret = snd_pcm_add_chmap_ctls(rtd->pcm, SNDRV_PCM_STREAM_PLAYBACK, NULL, drv->playback.channels_max, 0, &hcp->chmap_info); @@ -759,8 +749,6 @@ static int hdmi_codec_probe(struct platform_device *pdev) int dai_count, i = 0; int ret; - dev_dbg(dev, "%s()\n", __func__); - if (!hcd) { dev_err(dev, "%s: No plalform data\n", __func__); return -EINVAL; From patchwork Mon Apr 29 13:29:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10921827 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 9D33C1390 for ; Mon, 29 Apr 2019 13:32:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A32328915 for ; Mon, 29 Apr 2019 13:32:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DF76288F4; Mon, 29 Apr 2019 13:32:31 +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_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CFEB2288F4 for ; Mon, 29 Apr 2019 13:32:30 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0891D1672; Mon, 29 Apr 2019 15:31:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0891D1672 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556544749; bh=UonJeZSVBXPWbOdTeqwVSzZQTq+mebHLnf7ouvX7pAc=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=eNdm/tOekzmfV/ph+tHindKeO+fqCOMgQvIXFGJMjdrTGG/hZE3ZwOi7e0dZSya0b cSH9EePpuDkwgAWO98fEjuxzxm1hughMprFOwVfeg5sKxCIRHlf8b9ZhwqGA3GLd61 uHCLcG4oRKx4ujcLBCqUtVQicDiDNiq/s0psHH4Y= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A3904F89722; Mon, 29 Apr 2019 15:30:01 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 671C1F8962A; Mon, 29 Apr 2019 15:29:54 +0200 (CEST) Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 41105F80C41 for ; Mon, 29 Apr 2019 15:29:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 41105F80C41 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="ns9DV7vl" Received: by mail-wm1-x341.google.com with SMTP id h11so15794598wmb.5 for ; Mon, 29 Apr 2019 06:29:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jguxe++uQg1Tg16qsCOT2xdBZ2LoE15AQChE753+pog=; b=ns9DV7vl1GqOrO/l7Pw/dLmy4NgN3/x795IBIKZ+BKXrvNhko8jL+GoCk33SLpy7nF GphkEdLsA1stWrdCKWx20VUWt0I8WUBc+s7fvJgfBs1SeB61JEkA1oxNmTRIluXP87g5 xJtw8WLKxGjC2bFqvsAiFkZtMyKHE4MJdov2el5ZY2sbLNkl/K52f9Xitk383AEiq/Ht ZIIYkFr4XvTxV8WamLucfoPYlelow6AmwOej3EUaHz4AebYx52vKuwUdQyv+BoZTmUjB ndUGecFTHr8UYRamWk0vJP6sQLfC4pLm9TnIcemJ8aIKRqoZU3wZhZaghTXBIXLZc0sk BaSw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=jguxe++uQg1Tg16qsCOT2xdBZ2LoE15AQChE753+pog=; b=nJOLTCshFYNfQA2rO3GvBV99pS6eo6eBQtUVA4rI6neDncvw6yN6kJLit7GBzjaqvr aFaCbmXpAufXNoXRmoLzHIm7Lt7mu3tQHnLQn4vgHIdGAZddMP7J4vR3lW3ErqcfWMQS aLmnaODSd5KJE8cUE9+3a9tFhuCNHXRCmrdTYUXEp+KYkjpAdJTJ2009xZJBiga3dIfn HFjPkvCOtz/EiMRBvPXeYPzCHVvzaMOVZy6LyGYYTV76XKTVS+RdSyC0Yw5MRiLkE0pD DlzA2+yxc0n1CwcrR4miTOJSxolp1UA1XZDk4GRD/QTeR9twL8htvLX00YxQ4EozgoRb ZUqw== X-Gm-Message-State: APjAAAWhUhgfOTnNUKQrPZFgX+uPrnM2YXOzWjTbZS78ODgprAniXDBg 6sh/sdCZe8oaOSaUQrdmWvzTeg== X-Google-Smtp-Source: APXvYqznEB34S8Y0R3lfnUYKt0vBonlD/vhA5qe5px4C4oql/IzQD3R62u57tqApFNuPCVB1fZfEEQ== X-Received: by 2002:a7b:ce84:: with SMTP id q4mr18135443wmj.41.1556544590406; Mon, 29 Apr 2019 06:29:50 -0700 (PDT) Received: from boomer.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id s17sm2857593wra.94.2019.04.29.06.29.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 06:29:49 -0700 (PDT) From: Jerome Brunet To: Mark Brown , Liam Girdwood Date: Mon, 29 Apr 2019 15:29:39 +0200 Message-Id: <20190429132943.16269-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190429132943.16269-1-jbrunet@baylibre.com> References: <20190429132943.16269-1-jbrunet@baylibre.com> MIME-Version: 1.0 Cc: patchwork-bot+notify@kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Jerome Brunet Subject: [alsa-devel] [PATCH 2/6] ASoC: hdmi-codec: unlock the device on startup errors X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP If the hdmi codec startup fails, it should clear the current_substream pointer to free the device. This is properly done for the audio_startup() callback but for snd_pcm_hw_constraint_eld(). Make sure the pointer cleared if an error is reported. Signed-off-by: Jerome Brunet --- sound/soc/codecs/hdmi-codec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 9dca24732069..4bd598253c62 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -437,8 +437,12 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, if (!ret) { ret = snd_pcm_hw_constraint_eld(substream->runtime, hcp->eld); - if (ret) + if (ret) { + mutex_lock(&hcp->current_stream_lock); + hcp->current_stream = NULL; + mutex_unlock(&hcp->current_stream_lock); return ret; + } } /* Select chmap supported */ hdmi_codec_eld_chmap(hcp); From patchwork Mon Apr 29 13:29:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10921833 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 243231390 for ; Mon, 29 Apr 2019 13:34:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1195C285EA for ; Mon, 29 Apr 2019 13:34:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0537F286B3; Mon, 29 Apr 2019 13:34:30 +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_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5E9FA285EA for ; Mon, 29 Apr 2019 13:34:29 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A53CE1668; Mon, 29 Apr 2019 15:33:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A53CE1668 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556544867; bh=QlvV29nj5N61DY1JZ6pDjMeEC9ekppxdZpCUL3LMCa8=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=I4h0Y8X6zmtwJkGYMnCf3LBy/L624nJePjM9TUA/oqj4rawGbcamGr+ZRaNcbGk+Y lHIOzDEbj77wd0c68CcQb/Vdz7UfI9WIpX1ovnPEDS/8iqaN4FGz5Tkvs+b7QXeodo gI4uymUGWhIXUDh/l6v6yQEXqsZqLr4TZDVZm4Bg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2A583F89732; Mon, 29 Apr 2019 15:30:14 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id AFD80F89724; Mon, 29 Apr 2019 15:30:01 +0200 (CEST) Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 815F2F80CAB for ; Mon, 29 Apr 2019 15:29:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 815F2F80CAB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="J2dTv1NP" Received: by mail-wr1-x443.google.com with SMTP id s18so16140705wrp.0 for ; Mon, 29 Apr 2019 06:29:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=whsOXQ8xRakI5AVYAzepVuB15C/D0yrTQsABLkaS6Vw=; b=J2dTv1NPn4J99TrrljZ2hOdA1bv1ifuVO+cH2SVjLUxRsCwvDn6BHWRe13ydolX9HU f0TgeitA6xsof7AZ1BTeJMhJx9kNVCtreRIIz9tilr7F8ppdQBBxnamrpVfxs+7s0EuC /JVT4wZ1PMsPZY5/LjXMc70KWL4sthpL7sEtgbb7ZuUzPpYMMhz4nifFsD75k0rW8ryA spcy4SlO6AluDcIowl1fcf1VPnzD2N57NI7qTRcgkQAlS9idnCiCIUExwUaYbgeV7gih tm7D8w2q0cvdL0hYkGcQiVK21c5VDYXHMhWi8jpwQFBdbCzSs5At+eD45xDtXv+WytzX tf+A== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=whsOXQ8xRakI5AVYAzepVuB15C/D0yrTQsABLkaS6Vw=; b=Pt1JgpeqYOtiHpsUR7zJOrsBgJkG4dHfdi5iWgJgFe4MJEM8OUpeGJU1/iiNwaXZLu GgCIgh5ZXtXBM+Id6VhcDiyFQwL/TO8u/GAFwAMe1Qn7EGvMUQTe6VXWEQkVSSt+wr/e zMjoy4MmQd3NrtQr+EaL/DsHOfZHsny5B5cl8pbLQqX85brmgiNpvuT/wHSDKU6OxuOv HbExzB2cCqF9husH1rtFu+LRLPhfQiFjTp2yRHAPYJi+tBwVbOPsGefubpNjf0zwqsD6 m/Xa3jQ+xfX94/vs9S4xDr1k9ox1pgXxGkMhf/PzKIMyoENFU2OLonkOXFFCIJ1qkoRk zWDw== X-Gm-Message-State: APjAAAWE249M4Zfc6m1RfJV1XrUt8yOT6qaAUH9C8Gg82eiu9zwQSA1R eKbMeFdKZ9LofA4oZXlNHKLSrQ== X-Google-Smtp-Source: APXvYqxOsG9oiU7eEepi7586wap76Pj0lBUVZ/mY6bdH1Ba/VKYnS+x1TJFaXAE4iJXvcVWCek6nRA== X-Received: by 2002:adf:f845:: with SMTP id d5mr2185657wrq.107.1556544591717; Mon, 29 Apr 2019 06:29:51 -0700 (PDT) Received: from boomer.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id s17sm2857593wra.94.2019.04.29.06.29.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 06:29:51 -0700 (PDT) From: Jerome Brunet To: Mark Brown , Liam Girdwood Date: Mon, 29 Apr 2019 15:29:40 +0200 Message-Id: <20190429132943.16269-4-jbrunet@baylibre.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190429132943.16269-1-jbrunet@baylibre.com> References: <20190429132943.16269-1-jbrunet@baylibre.com> MIME-Version: 1.0 Cc: patchwork-bot+notify@kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Jerome Brunet Subject: [alsa-devel] [PATCH 3/6] ASoC: hdmi-codec: stream is already locked in hw_params X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP startup() should have run before hw_params() is called, so the current_substream pointer should already be properly set. There is no reason to call hdmi_codec_new_stream() again in the hw_params() callback Signed-off-by: Jerome Brunet --- sound/soc/codecs/hdmi-codec.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 4bd598253c62..780f2008b271 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -495,10 +495,6 @@ static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, return ret; } - ret = hdmi_codec_new_stream(substream, dai); - if (ret) - return ret; - hdmi_audio_infoframe_init(&hp.cea); hp.cea.channels = params_channels(params); hp.cea.coding_type = HDMI_AUDIO_CODING_TYPE_STREAM; From patchwork Mon Apr 29 13:29:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10921829 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 058921398 for ; Mon, 29 Apr 2019 13:33:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4D3E285EA for ; Mon, 29 Apr 2019 13:33:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D589C286AC; Mon, 29 Apr 2019 13:33:23 +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_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A4FE4285EA for ; Mon, 29 Apr 2019 13:33:21 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A1D661663; Mon, 29 Apr 2019 15:32:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A1D661663 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556544799; bh=rPw91l/SJw8PBTzfaFAG52M3hioW0lFvxaYPoBEw4ec=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=b59i2ZJCPTEr3MC/UDYRzjko3YiK4K1yXclAzGtISg0hfUjxX0f7WavfPgTEdgPyp pTR5JErsf4V3YNHyMNXG3lf+YVAxY2RMQwt4wJ46aRIesE/Q691WIBhsRUV6lLOWjE fXaKWJI/zYyU8jjSueFe5gQsskxJDNH4I01agOJU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A29BEF8972B; Mon, 29 Apr 2019 15:30:11 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id B487FF896CB; Mon, 29 Apr 2019 15:29:56 +0200 (CEST) Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 7C1DBF80641 for ; Mon, 29 Apr 2019 15:29:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7C1DBF80641 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="C4SN6Sjb" Received: by mail-wm1-x344.google.com with SMTP id j13so14195394wmh.2 for ; Mon, 29 Apr 2019 06:29:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hd6mJetFt+bYMfDoxeUlaN2SLCfgBvFwtxKuQlMcFOY=; b=C4SN6SjbEVh9brvwWa9I0k53I0+eUkzThi7Z4tRSiWcMVwsyOZkS2Ri2zTPFrRU1hA EX/Qwh90q+DdtDX5XD3rlaN050hOPFVqbmNEVbyos3JbwA6mzccSmjWIaZPBUpywAIPb +n0lfVLB+RwIP/HVA+qrZJlAooCK1oDs9FWOJ/UH1ymIGBpoFQJcmHKkt34UQ6B/S5M1 qakEvdkdQC1+yhn3HOWd4JlDgMDcPRolzMqRbMQzZhlFoFyM2+m045V8Tze+YtdDT7hQ RH8eFWekONdGWfyo9zvBOhVFQmPyzzQt+1SuV6+7hosSTQVBEy+lVvumrFEhB2BWSJvV AbTA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hd6mJetFt+bYMfDoxeUlaN2SLCfgBvFwtxKuQlMcFOY=; b=Kd1Jju3NYwDr9uQLlHVdUApiX4Xi2qj9pszRKWn9D7RQyDnZKuOpvryXmauc/6Waco hotHmnjLetpibiH0LWpDEbs1LWu+7f+gJF2oeetqrXg+d224ZSruF7GMuL2bQxnyo3X9 b4S9idsqcd62+rE1jrlICG4shwMxftv11el/4IQ2Q5xbK50Q8UzU1ifCgCczjAlYvihP qtun4YB/Bcb0htRnjYSwmI0K0fJEXvXBD8YCK9jcFv4kdfrhr8yrNiwun35TZVSvQmqR nCX3cEaSv3d8IeJkMWQYaVwZA5j9UIAUavWSakolbHguM0CUVduENd7uZ2D2Cxq0R41F xgng== X-Gm-Message-State: APjAAAWsnsqckawoMPlyfWz059/SKK7dzWXgkx15edJ26Eg8f1xiRdK8 0Lr8UQ9LwsFpoCYu2lMBucvSWg== X-Google-Smtp-Source: APXvYqxbSL2cfvOi7tkjEEW2XPKHTx8LzMHgfHwDAxQTBNK2aCvrCQgBr3M74UAUFrHy88HSqn8nCA== X-Received: by 2002:a1c:3845:: with SMTP id f66mr16599583wma.97.1556544592685; Mon, 29 Apr 2019 06:29:52 -0700 (PDT) Received: from boomer.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id s17sm2857593wra.94.2019.04.29.06.29.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 06:29:52 -0700 (PDT) From: Jerome Brunet To: Mark Brown , Liam Girdwood Date: Mon, 29 Apr 2019 15:29:41 +0200 Message-Id: <20190429132943.16269-5-jbrunet@baylibre.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190429132943.16269-1-jbrunet@baylibre.com> References: <20190429132943.16269-1-jbrunet@baylibre.com> MIME-Version: 1.0 Cc: patchwork-bot+notify@kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Jerome Brunet Subject: [alsa-devel] [PATCH 4/6] ASoC: hdmi-codec: remove reference to the current substream X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP If the hdmi-codec is on a codec-to-codec link, the substream pointer it receives is completely made up by snd_soc_dai_link_event(). The pointer will be different between startup() and shutdown(). The hdmi-codec complains when this happens even if it is not really a problem. The current_substream pointer is not used for anything useful apart from getting the exclusive ownership of the device. Remove current_substream pointer and replace the exclusive locking mechanism with a simple variable and some atomic operations. Signed-off-by: Jerome Brunet --- sound/soc/codecs/hdmi-codec.c | 58 ++++++++++------------------------- 1 file changed, 16 insertions(+), 42 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 780f2008b271..717d0949f8b4 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -280,11 +280,10 @@ struct hdmi_codec_priv { struct hdmi_codec_pdata hcd; struct snd_soc_dai_driver *daidrv; struct hdmi_codec_daifmt daifmt[2]; - struct mutex current_stream_lock; - struct snd_pcm_substream *current_stream; uint8_t eld[MAX_ELD_BYTES]; struct snd_pcm_chmap *chmap_info; unsigned int chmap_idx; + unsigned long busy; }; static const struct snd_soc_dapm_widget hdmi_widgets[] = { @@ -392,42 +391,22 @@ static int hdmi_codec_chmap_ctl_get(struct snd_kcontrol *kcontrol, return 0; } -static int hdmi_codec_new_stream(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) -{ - struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); - int ret = 0; - - mutex_lock(&hcp->current_stream_lock); - if (!hcp->current_stream) { - hcp->current_stream = substream; - } else if (hcp->current_stream != substream) { - dev_err(dai->dev, "Only one simultaneous stream supported!\n"); - ret = -EINVAL; - } - mutex_unlock(&hcp->current_stream_lock); - - return ret; -} - static int hdmi_codec_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); int ret = 0; - ret = hdmi_codec_new_stream(substream, dai); - if (ret) - return ret; + ret = test_and_set_bit(0, &hcp->busy); + if (ret) { + dev_err(dai->dev, "Only one simultaneous stream supported!\n"); + return -EINVAL; + } if (hcp->hcd.ops->audio_startup) { ret = hcp->hcd.ops->audio_startup(dai->dev->parent, hcp->hcd.data); - if (ret) { - mutex_lock(&hcp->current_stream_lock); - hcp->current_stream = NULL; - mutex_unlock(&hcp->current_stream_lock); - return ret; - } + if (ret) + goto err; } if (hcp->hcd.ops->get_eld) { @@ -437,17 +416,18 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, if (!ret) { ret = snd_pcm_hw_constraint_eld(substream->runtime, hcp->eld); - if (ret) { - mutex_lock(&hcp->current_stream_lock); - hcp->current_stream = NULL; - mutex_unlock(&hcp->current_stream_lock); - return ret; - } + if (ret) + goto err; } /* Select chmap supported */ hdmi_codec_eld_chmap(hcp); } return 0; + +err: + /* Release the exclusive lock on error */ + clear_bit(0, &hcp->busy); + return ret; } static void hdmi_codec_shutdown(struct snd_pcm_substream *substream, @@ -455,14 +435,10 @@ static void hdmi_codec_shutdown(struct snd_pcm_substream *substream, { struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); - WARN_ON(hcp->current_stream != substream); - hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; hcp->hcd.ops->audio_shutdown(dai->dev->parent, hcp->hcd.data); - mutex_lock(&hcp->current_stream_lock); - hcp->current_stream = NULL; - mutex_unlock(&hcp->current_stream_lock); + clear_bit(0, &hcp->busy); } static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, @@ -766,8 +742,6 @@ static int hdmi_codec_probe(struct platform_device *pdev) return -ENOMEM; hcp->hcd = *hcd; - mutex_init(&hcp->current_stream_lock); - hcp->daidrv = devm_kcalloc(dev, dai_count, sizeof(*hcp->daidrv), GFP_KERNEL); if (!hcp->daidrv) From patchwork Mon Apr 29 13:29:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10921831 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 339E01390 for ; Mon, 29 Apr 2019 13:33:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 207C1285EA for ; Mon, 29 Apr 2019 13:33:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11D08286B3; Mon, 29 Apr 2019 13:33:58 +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_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 41A77285EA for ; Mon, 29 Apr 2019 13:33:57 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 78FE31678; Mon, 29 Apr 2019 15:33:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 78FE31678 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556544835; bh=tEMVobRI9eFC0BMJ6Xh2M2zA+rmq5T2tW4x5Q3L6n5E=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=hxt9IX9pf7kHjxmfh7yNJ0hH/k9wB2yhGteZ2RI86SlModNFrB+YzZWJoXETy/WbJ PBnCrdWZ4hsSd1sJKmZcD9GHMozaoED2W4AZL761/CbrKl0liM5Fw4i0eBbaWDRiOO rgYfD28F7pHMzbimiZifDzboWfJehqOCdDJrkD8E= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D5B83F89730; Mon, 29 Apr 2019 15:30:12 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id B99E0F8971A; Mon, 29 Apr 2019 15:29:58 +0200 (CEST) Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 97170F80C0D for ; Mon, 29 Apr 2019 15:29:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 97170F80C0D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="meqj0rsJ" Received: by mail-wm1-x344.google.com with SMTP id h18so15836622wml.1 for ; Mon, 29 Apr 2019 06:29:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c2Ly6nFnbTUuYqirG7Hg6dg1zRcYgFT1GAPuXl6J8C8=; b=meqj0rsJv5rfBIShZLQunnMvrc8ItTEICy2+kAclCNP4u/MykXbVjfGB2rZlt3+NG8 0kXXs/AjAOB2zWPpqduLNYKK4WD+nT7H86fGbdVPXEA3IBi/rPUQSOWSWFGHXIpJw3gS VpwnuOvEyHRtvq17hw0O0lylYaxZV0eRkY2PknHzpbM8+q2P5biZpCQkFjQWcHzi4zhL CC1/4GTBYQwp/l4GSLsrOss2g/4OaEOEYetdNnJa3KWknO88apc6PrwVP0C816M4Gniz Qm+xY1TJ17Kqn7M9V0EIOYMQrG6u9ijK54KnoLq+iXPVWBf2904tvI2g/pqxJwkDa1eh KYWA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=c2Ly6nFnbTUuYqirG7Hg6dg1zRcYgFT1GAPuXl6J8C8=; b=tT9lBllOUHqi+pczjHCHWUYb+OmswQC0Iq4GVs+8RZ/63H8DBAxTHE0whvdNgDMl+9 ZrMGSIN9buHZtcwJCffgPNvSOXIHXVUocT9UdTJYA+CYL9np3/pN14vwmXtaq2JFgW+r QDPnRpCySrGyY6v7geRkVhSGSI6mZzsAjF7rn7dKha0YtFsoqT4YFmi5S2UwpeKbJQKZ Evyj62izIa9M/q3w36v0QqPDP25zQBpjTQKv1IzpPRwg8h2I/PJTnt/kURlMN4tD+WSl a8OlLdods23XbusRCFGjHKtZSuJAKvyrjrGygsEA3dRXpaZFH9n6pQi8PWgBALGf0eTk PX8g== X-Gm-Message-State: APjAAAVb3uKUgvAwTv+p/wvhuJcpO05glKCudDxHij1FUVajcqbMue1o qT5sMKtSHFVgZzQVyVab79N5wDLKCss= X-Google-Smtp-Source: APXvYqyFKnuadadxSREMNcWSC4Shu/wM2PVEDGkr9qobVHvnCB63myFUBW77jIIhHazK18HxgyS2nw== X-Received: by 2002:a05:600c:204d:: with SMTP id p13mr2263305wmg.53.1556544593778; Mon, 29 Apr 2019 06:29:53 -0700 (PDT) Received: from boomer.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id s17sm2857593wra.94.2019.04.29.06.29.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 06:29:53 -0700 (PDT) From: Jerome Brunet To: Mark Brown , Liam Girdwood Date: Mon, 29 Apr 2019 15:29:42 +0200 Message-Id: <20190429132943.16269-6-jbrunet@baylibre.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190429132943.16269-1-jbrunet@baylibre.com> References: <20190429132943.16269-1-jbrunet@baylibre.com> MIME-Version: 1.0 Cc: patchwork-bot+notify@kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Jerome Brunet Subject: [alsa-devel] [PATCH 5/6] ASoC: hdmi-codec: remove reference to the dai drivers in the private data X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP Keeping the a pointer to the dai drivers is not necessary. It is not used by the hdmi_codec after the probe. Even if it was used, the 'struct snd_soc_dai_driver' can accessed through the 'struct snd_soc_dai' so keeping the pointer in the private data structure is not useful. Signed-off-by: Jerome Brunet --- sound/soc/codecs/hdmi-codec.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 717d0949f8b4..bcc2e5c3bf43 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -278,7 +278,6 @@ static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = { struct hdmi_codec_priv { struct hdmi_codec_pdata hcd; - struct snd_soc_dai_driver *daidrv; struct hdmi_codec_daifmt daifmt[2]; uint8_t eld[MAX_ELD_BYTES]; struct snd_pcm_chmap *chmap_info; @@ -720,6 +719,7 @@ static const struct snd_soc_component_driver hdmi_driver = { static int hdmi_codec_probe(struct platform_device *pdev) { struct hdmi_codec_pdata *hcd = pdev->dev.platform_data; + struct snd_soc_dai_driver *daidrv; struct device *dev = &pdev->dev; struct hdmi_codec_priv *hcp; int dai_count, i = 0; @@ -742,25 +742,23 @@ static int hdmi_codec_probe(struct platform_device *pdev) return -ENOMEM; hcp->hcd = *hcd; - hcp->daidrv = devm_kcalloc(dev, dai_count, sizeof(*hcp->daidrv), - GFP_KERNEL); - if (!hcp->daidrv) + daidrv = devm_kcalloc(dev, dai_count, sizeof(*daidrv), GFP_KERNEL); + if (!daidrv) return -ENOMEM; if (hcd->i2s) { - hcp->daidrv[i] = hdmi_i2s_dai; - hcp->daidrv[i].playback.channels_max = - hcd->max_i2s_channels; + daidrv[i] = hdmi_i2s_dai; + daidrv[i].playback.channels_max = hcd->max_i2s_channels; i++; } if (hcd->spdif) - hcp->daidrv[i] = hdmi_spdif_dai; + daidrv[i] = hdmi_spdif_dai; dev_set_drvdata(dev, hcp); - ret = devm_snd_soc_register_component(dev, &hdmi_driver, hcp->daidrv, - dai_count); + ret = devm_snd_soc_register_component(dev, &hdmi_driver, daidrv, + dai_count); if (ret) { dev_err(dev, "%s: snd_soc_register_component() failed (%d)\n", __func__, ret); From patchwork Mon Apr 29 13:29:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10921835 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 1BBF61390 for ; Mon, 29 Apr 2019 13:35:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 040AD23B24 for ; Mon, 29 Apr 2019 13:35:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4F3527DCD; Mon, 29 Apr 2019 13:35:11 +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_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BEEA223B24 for ; Mon, 29 Apr 2019 13:35:10 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1B8EA1665; Mon, 29 Apr 2019 15:34:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1B8EA1665 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556544909; bh=Ro8yadGAcXvHNkfg+vFSAFlKKfLB4D1DBs580Wwl6y0=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=IvLLgaHZt8lofNS7IvdMJ02Wz0hKosSUqdIOyANjrQTOmruGELy9JJF8Cm31FqVYy L+fsl5l+zfmdwLy60kqfAV7WDDpVBSvG+jOWse7o9ktrROsVwUhLpHIohHg/fk/XgA b9D/PW/5pWe7zlM4zqAQW43wVGaw+G2ZvInlOF2A= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D03B3F8973A; Mon, 29 Apr 2019 15:30:15 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2E65AF89725; Mon, 29 Apr 2019 15:30:04 +0200 (CEST) Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E4363F80C41 for ; Mon, 29 Apr 2019 15:29:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E4363F80C41 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="a7wNSCFm" Received: by mail-wm1-x342.google.com with SMTP id y197so15842197wmd.0 for ; Mon, 29 Apr 2019 06:29:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CKsfp1x/LbsxbNcHvbSqLYmsrwzcbB2URURXREr5yxQ=; b=a7wNSCFml35ej21GIKLMIp1B8FJJD6WKn+HBxm7MnD0q03OqMi1T+ixkgRHxkJMvcz 8OHqdXfzd4s6QyHxAZm0QonNqasgOMMjc469b3x7+R9UX4EeGwEgb70oOz2gQrmrgNvI qfgIq7RestSYIyCkpVAttt9NVhXdZDwjd/CFL8xwgZCFiNz3nK/HO6WeEnIbLLPbS5zG bYTm32Bv/lwGgZ6buYs3a5Adeo5TZIcLTk1SD7pYAwnexKvh1sBURl7g7d0KL3N8uQij 5UGBAs0yAO5TYECwcHH2x05Ri/RrKY4W/rXX0MrV9w3xEJjYgYTcF/PefvxHz1Xn3xH0 30+Q== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=CKsfp1x/LbsxbNcHvbSqLYmsrwzcbB2URURXREr5yxQ=; b=aRLIaWEPnoUbB6/jbj0y3AmHcv6cK7k2MacBMcmlSRMFBRPUL+uohzUuH9K1KvzxV+ Ipinn1Kzq8YFAOk2HonfqWwLJMdKuTDTjVxCUKH970g8WbQkf0N8aWHKYnj9VizxgSNq bAQO9Q3D5J8pz9jaqQSV5tFvxcTGCbgcq+k4nBjph5B4I9inJdHphbNmZtWv08FU+pyN l7owMIMh4IO4sKZPpPlpjYlQEXDMTTEuZ+ExlZuNEcUaSGMpUFQeV1F35VDAJJDB0+Aa veaQvv+tsZ1803ZsBDop5isO9D5nlBBZ9vhWHbJej7bnK7BqXwiIe3sFgFA1QMu1ovkk UmFQ== X-Gm-Message-State: APjAAAUsDEc/eCq4y8NEWtEPhl15wd8lvxJmYlp647H7GmBn9kAyX1rO K/y8gvEWAp7haTH80NeA69bETA== X-Google-Smtp-Source: APXvYqwR6U+ckUpQSfw4rBQinHqbCKTFMkYGOMFQIam7EZM4On40jNGGpk0nOkTFLJXG1nS7Dy+ADA== X-Received: by 2002:a1c:b782:: with SMTP id h124mr2298471wmf.5.1556544594954; Mon, 29 Apr 2019 06:29:54 -0700 (PDT) Received: from boomer.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id s17sm2857593wra.94.2019.04.29.06.29.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 06:29:54 -0700 (PDT) From: Jerome Brunet To: Mark Brown , Liam Girdwood Date: Mon, 29 Apr 2019 15:29:43 +0200 Message-Id: <20190429132943.16269-7-jbrunet@baylibre.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190429132943.16269-1-jbrunet@baylibre.com> References: <20190429132943.16269-1-jbrunet@baylibre.com> MIME-Version: 1.0 Cc: patchwork-bot+notify@kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Jerome Brunet Subject: [alsa-devel] [PATCH 6/6] ASoC: hdmi-codec: remove ops dependency on the dai id X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP The dependency on the dai_id can be removed by setting different ops for the i2s and spdif dai and storing the dai format information in each dai structure. It simplies the code a bit. Signed-off-by: Jerome Brunet --- sound/soc/codecs/hdmi-codec.c | 173 ++++++++++++++++++++-------------- 1 file changed, 102 insertions(+), 71 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index bcc2e5c3bf43..4b56fc92a80d 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -278,7 +278,6 @@ static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = { struct hdmi_codec_priv { struct hdmi_codec_pdata hcd; - struct hdmi_codec_daifmt daifmt[2]; uint8_t eld[MAX_ELD_BYTES]; struct snd_pcm_chmap *chmap_info; unsigned int chmap_idx; @@ -445,6 +444,7 @@ static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); + struct hdmi_codec_daifmt *cf = dai->playback_dma_data; struct hdmi_codec_params hp = { .iec = { .status = { 0 }, @@ -492,79 +492,85 @@ static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, hp.channels = params_channels(params); return hcp->hcd.ops->hw_params(dai->dev->parent, hcp->hcd.data, - &hcp->daifmt[dai->id], &hp); + cf, &hp); } -static int hdmi_codec_set_fmt(struct snd_soc_dai *dai, - unsigned int fmt) +static int hdmi_codec_i2s_set_fmt(struct snd_soc_dai *dai, + unsigned int fmt) { - struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); - struct hdmi_codec_daifmt cf = { 0 }; - int ret = 0; - - if (dai->id == DAI_ID_SPDIF) { - cf.fmt = HDMI_SPDIF; - } else { - switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { - case SND_SOC_DAIFMT_CBM_CFM: - cf.bit_clk_master = 1; - cf.frame_clk_master = 1; - break; - case SND_SOC_DAIFMT_CBS_CFM: - cf.frame_clk_master = 1; - break; - case SND_SOC_DAIFMT_CBM_CFS: - cf.bit_clk_master = 1; - break; - case SND_SOC_DAIFMT_CBS_CFS: - break; - default: - return -EINVAL; - } + struct hdmi_codec_daifmt *cf = dai->playback_dma_data; + + /* Reset daifmt */ + memset(cf, 0, sizeof(*cf)); + + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { + case SND_SOC_DAIFMT_CBM_CFM: + cf->bit_clk_master = 1; + cf->frame_clk_master = 1; + break; + case SND_SOC_DAIFMT_CBS_CFM: + cf->frame_clk_master = 1; + break; + case SND_SOC_DAIFMT_CBM_CFS: + cf->bit_clk_master = 1; + break; + case SND_SOC_DAIFMT_CBS_CFS: + break; + default: + return -EINVAL; + } - switch (fmt & SND_SOC_DAIFMT_INV_MASK) { - case SND_SOC_DAIFMT_NB_NF: - break; - case SND_SOC_DAIFMT_NB_IF: - cf.frame_clk_inv = 1; - break; - case SND_SOC_DAIFMT_IB_NF: - cf.bit_clk_inv = 1; - break; - case SND_SOC_DAIFMT_IB_IF: - cf.frame_clk_inv = 1; - cf.bit_clk_inv = 1; - break; - } + switch (fmt & SND_SOC_DAIFMT_INV_MASK) { + case SND_SOC_DAIFMT_NB_NF: + break; + case SND_SOC_DAIFMT_NB_IF: + cf->frame_clk_inv = 1; + break; + case SND_SOC_DAIFMT_IB_NF: + cf->bit_clk_inv = 1; + break; + case SND_SOC_DAIFMT_IB_IF: + cf->frame_clk_inv = 1; + cf->bit_clk_inv = 1; + break; + } - switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { - case SND_SOC_DAIFMT_I2S: - cf.fmt = HDMI_I2S; - break; - case SND_SOC_DAIFMT_DSP_A: - cf.fmt = HDMI_DSP_A; - break; - case SND_SOC_DAIFMT_DSP_B: - cf.fmt = HDMI_DSP_B; - break; - case SND_SOC_DAIFMT_RIGHT_J: - cf.fmt = HDMI_RIGHT_J; - break; - case SND_SOC_DAIFMT_LEFT_J: - cf.fmt = HDMI_LEFT_J; - break; - case SND_SOC_DAIFMT_AC97: - cf.fmt = HDMI_AC97; - break; - default: - dev_err(dai->dev, "Invalid DAI interface format\n"); - return -EINVAL; - } + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { + case SND_SOC_DAIFMT_I2S: + cf->fmt = HDMI_I2S; + break; + case SND_SOC_DAIFMT_DSP_A: + cf->fmt = HDMI_DSP_A; + break; + case SND_SOC_DAIFMT_DSP_B: + cf->fmt = HDMI_DSP_B; + break; + case SND_SOC_DAIFMT_RIGHT_J: + cf->fmt = HDMI_RIGHT_J; + break; + case SND_SOC_DAIFMT_LEFT_J: + cf->fmt = HDMI_LEFT_J; + break; + case SND_SOC_DAIFMT_AC97: + cf->fmt = HDMI_AC97; + break; + default: + dev_err(dai->dev, "Invalid DAI interface format\n"); + return -EINVAL; } - hcp->daifmt[dai->id] = cf; + return 0; +} + +static int hdmi_codec_spdif_set_fmt(struct snd_soc_dai *dai, + unsigned int fmt) +{ + struct hdmi_codec_daifmt *cf = dai->playback_dma_data; + + /* No need to reset the format, it is always the same for spdif */ + cf->fmt = HDMI_SPDIF; - return ret; + return 0; } static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute) @@ -578,14 +584,21 @@ static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute) return 0; } -static const struct snd_soc_dai_ops hdmi_dai_ops = { +static const struct snd_soc_dai_ops hdmi_codec_i2s_dai_ops = { .startup = hdmi_codec_startup, .shutdown = hdmi_codec_shutdown, .hw_params = hdmi_codec_hw_params, - .set_fmt = hdmi_codec_set_fmt, + .set_fmt = hdmi_codec_i2s_set_fmt, .digital_mute = hdmi_codec_digital_mute, }; +static const struct snd_soc_dai_ops hdmi_codec_spdif_dai_ops = { + .startup = hdmi_codec_startup, + .shutdown = hdmi_codec_shutdown, + .hw_params = hdmi_codec_hw_params, + .set_fmt = hdmi_codec_spdif_set_fmt, + .digital_mute = hdmi_codec_digital_mute, +}; #define HDMI_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 |\ @@ -653,20 +666,37 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd, static int hdmi_dai_probe(struct snd_soc_dai *dai) { struct snd_soc_dapm_context *dapm; + struct hdmi_codec_daifmt *daifmt; struct snd_soc_dapm_route route = { .sink = "TX", .source = dai->driver->playback.stream_name, }; + int ret; dapm = snd_soc_component_get_dapm(dai->component); + ret = snd_soc_dapm_add_routes(dapm, &route, 1); + if (ret) + return ret; - return snd_soc_dapm_add_routes(dapm, &route, 1); + daifmt = kzalloc(sizeof(*daifmt), GFP_KERNEL); + if (!daifmt) + return -ENOMEM; + + dai->playback_dma_data = daifmt; + return 0; +} + +static int hdmi_codec_dai_remove(struct snd_soc_dai *dai) +{ + kfree(dai->playback_dma_data); + return 0; } static const struct snd_soc_dai_driver hdmi_i2s_dai = { .name = "i2s-hifi", .id = DAI_ID_I2S, .probe = hdmi_dai_probe, + .remove = hdmi_codec_dai_remove, .playback = { .stream_name = "I2S Playback", .channels_min = 2, @@ -675,7 +705,7 @@ static const struct snd_soc_dai_driver hdmi_i2s_dai = { .formats = I2S_FORMATS, .sig_bits = 24, }, - .ops = &hdmi_dai_ops, + .ops = &hdmi_codec_i2s_dai_ops, .pcm_new = hdmi_codec_pcm_new, }; @@ -683,6 +713,7 @@ static const struct snd_soc_dai_driver hdmi_spdif_dai = { .name = "spdif-hifi", .id = DAI_ID_SPDIF, .probe = hdmi_dai_probe, + .remove = hdmi_codec_dai_remove, .playback = { .stream_name = "SPDIF Playback", .channels_min = 2, @@ -690,7 +721,7 @@ static const struct snd_soc_dai_driver hdmi_spdif_dai = { .rates = HDMI_RATES, .formats = SPDIF_FORMATS, }, - .ops = &hdmi_dai_ops, + .ops = &hdmi_codec_spdif_dai_ops, .pcm_new = hdmi_codec_pcm_new, };