From patchwork Tue Jun 23 01:20:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11622559 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0DE2E912 for ; Wed, 24 Jun 2020 08:03:09 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 99D182137B for ; Wed, 24 Jun 2020 08:03:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Y2uOttcm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 99D182137B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 2DF5B1858; Wed, 24 Jun 2020 10:02:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2DF5B1858 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1592985787; bh=BEgM/bxEZucgBickK9um8aksRu81x3Ud0/XG8PTowEk=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Y2uOttcm8L2bV8GA0RauHN5DtiFAS0KW2IydhbUTL3df68H8VAOpUMu+p/X6Vjv7y /K3WRzWf6E5cV0jYyLOkEr6lWc9JPLVHzlv2xj3jOoOWXd9Y9ouEWbYebIe3vso6p4 I1Q5iAaUAmEF6czDmWlYXlhZzmKTsRzQiW2zp+5U= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E3FECF8036E; Wed, 24 Jun 2020 09:50:05 +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 9F7E6F80162; Tue, 23 Jun 2020 03:21:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 82DEEF8010D for ; Tue, 23 Jun 2020 03:20:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 82DEEF8010D Date: 23 Jun 2020 10:20:54 +0900 X-IronPort-AV: E=Sophos;i="5.75,268,1589209200"; d="scan'208";a="50118981" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 23 Jun 2020 10:20:54 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 902BF4183C43; Tue, 23 Jun 2020 10:20:53 +0900 (JST) Message-ID: <87tuz21sso.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 15/19] ASoC: codecs: da*: merge .digital_mute() into .mute_stream() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Mark Brown In-Reply-To: <87ftam37ko.wl-kuninori.morimoto.gx@renesas.com> References: <87ftam37ko.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-Mailman-Approved-At: Wed, 24 Jun 2020 09:49:29 +0200 Cc: Shengjiu Wang , Linux-ALSA , Michael Walle , =?iso-8859-1?q?=22Heiko_St=FCbner=22?= , Neil Armstrong , David Airlie , =?iso-8859-2?q?=22Micha=B3_Miros=B3aw=22?= , Jonghwan Choi , Alexandre Belloni , Paul Cercueil , Andrzej Hajda , Frank Shi , Laurent Pinchart , Benjamin Gaignard , "Andrew F. Davis" , Fabio Estevam , Jerome Brunet , Nikita Yushchenko , Pierre-Louis Bossart , Lars-Peter Clausen , Joonyoung Shim , Matthias Reichl , Katsuhiro Suzuki , Kevin Hilman , Kai Vehmanen , Takashi Iwai , YueHaibing , Russell King , Krzysztof Kozlowski , Daniel Drake , Tzung-Bi Shih , Ludovic Desroches , Kukjin Kim , Ranjani Sridharan , Dinghao Liu , Codrin Ciubotariu , Cheng-Yi Chiang , Chun-Kuang Hu , Bartosz Golaszewski , Charles Keepax , Philipp Zabel , Jonas Karlman , Liam Girdwood , Nicolas Ferre , Chuhong Yuan , Robin Murphy , James Schulman , Inki Dae , Masahiro Yamada , Christophe JAILLET , Dan Murphy , Matthias Brugger , =?iso-8859-1?q?=22Nuno_S=E1=22?= , Vincent Abriou , Peter Ujfalusi , Jernej Skrabec , Support Opensource , Marek Szyprowski , Jason Yan , Stephen Boyd , Pankaj Bharadiya , David Rhodes , Seung-Woo Kim , Sandy Huang , Pavel Dobias , Philipp Puschmann , Kyungmin Park , Vishwas A Deshpande , Daniel Vetter , Colin Ian King , Kevin Cernekee , Lucas Stach , Shawn Guo , Peter Rosin , M R Swami Reddy 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" From: Kuninori Morimoto snd_soc_dai_digital_mute() is internally using both mute_stream() (1) or digital_mute() (2), but the difference between these 2 are only handling direction. We can merge digital_mute() into mute_stream int snd_soc_dai_digital_mute(xxx, int direction) { ... else if (dai->driver->ops->mute_stream) (1) return dai->driver->ops->mute_stream(xxx, direction); else if (direction == SNDRV_PCM_STREAM_PLAYBACK && dai->driver->ops->digital_mute) (2) return dai->driver->ops->digital_mute(xxx); ... } Signed-off-by: Kuninori Morimoto Reviewed-by: Adam Thomson --- sound/soc/codecs/da7210.c | 7 +++++-- sound/soc/codecs/da7213.c | 7 +++++-- sound/soc/codecs/da9055.c | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c index 0c99dcf242e4..8e5e5cd4bcbe 100644 --- a/sound/soc/codecs/da7210.c +++ b/sound/soc/codecs/da7210.c @@ -924,11 +924,14 @@ static int da7210_set_dai_fmt(struct snd_soc_dai *codec_dai, u32 fmt) return 0; } -static int da7210_mute(struct snd_soc_dai *dai, int mute) +static int da7210_mute(struct snd_soc_dai *dai, int mute, int direction) { struct snd_soc_component *component = dai->component; u8 mute_reg = snd_soc_component_read(component, DA7210_DAC_HPF) & 0xFB; + if (direction != SNDRV_PCM_STREAM_PLAYBACK) + return 0; + if (mute) snd_soc_component_write(component, DA7210_DAC_HPF, mute_reg | 0x4); else @@ -1034,7 +1037,7 @@ static const struct snd_soc_dai_ops da7210_dai_ops = { .set_fmt = da7210_set_dai_fmt, .set_sysclk = da7210_set_dai_sysclk, .set_pll = da7210_set_dai_pll, - .digital_mute = da7210_mute, + .mute_stream = da7210_mute, }; static struct snd_soc_dai_driver da7210_dai = { diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c index cc4ae7b311b4..55f8097112e1 100644 --- a/sound/soc/codecs/da7213.c +++ b/sound/soc/codecs/da7213.c @@ -1321,10 +1321,13 @@ static int da7213_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) return 0; } -static int da7213_mute(struct snd_soc_dai *dai, int mute) +static int da7213_mute(struct snd_soc_dai *dai, int mute, int direction) { struct snd_soc_component *component = dai->component; + if (direction != SNDRV_PCM_STREAM_PLAYBACK) + return 0; + if (mute) { snd_soc_component_update_bits(component, DA7213_DAC_L_CTRL, DA7213_MUTE_EN, DA7213_MUTE_EN); @@ -1507,7 +1510,7 @@ static int da7213_set_component_pll(struct snd_soc_component *component, static const struct snd_soc_dai_ops da7213_dai_ops = { .hw_params = da7213_hw_params, .set_fmt = da7213_set_dai_fmt, - .digital_mute = da7213_mute, + .mute_stream = da7213_mute, }; static struct snd_soc_dai_driver da7213_dai = { diff --git a/sound/soc/codecs/da9055.c b/sound/soc/codecs/da9055.c index e93436ccb674..e388b1c0ba19 100644 --- a/sound/soc/codecs/da9055.c +++ b/sound/soc/codecs/da9055.c @@ -1211,10 +1211,13 @@ static int da9055_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) return 0; } -static int da9055_mute(struct snd_soc_dai *dai, int mute) +static int da9055_mute(struct snd_soc_dai *dai, int mute, int direction) { struct snd_soc_component *component = dai->component; + if (direction != SNDRV_PCM_STREAM_PLAYBACK) + return 0; + if (mute) { snd_soc_component_update_bits(component, DA9055_DAC_L_CTRL, DA9055_DAC_L_MUTE_EN, DA9055_DAC_L_MUTE_EN); @@ -1324,7 +1327,7 @@ static const struct snd_soc_dai_ops da9055_dai_ops = { .set_fmt = da9055_set_dai_fmt, .set_sysclk = da9055_set_dai_sysclk, .set_pll = da9055_set_dai_pll, - .digital_mute = da9055_mute, + .mute_stream = da9055_mute, }; static struct snd_soc_dai_driver da9055_dai = {