From patchwork Fri Apr 14 14:02:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pawe=C5=82_Anikiel?= X-Patchwork-Id: 13212361 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 912FDC7619A for ; Sat, 15 Apr 2023 09:11:56 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5AA92DF2; Sat, 15 Apr 2023 11:11:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5AA92DF2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1681549914; bh=BlWJQbfAxmqzCyKltZtuChU+IXB1xFpetJoDryTxfwY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Reply-To:Cc:From; b=hXnnRRb0uYdyTxmJEoerTeLmlmI6PWzBN5YxA8dXVNVlxyIZzk0dQoEcmFFwEap7I xUs88R028rlgN2Ka4ZDGVXK7CaqkkCszIhHCEWpQnK79Cr7sNxPuzFqdAXK1wOkWaH FehrNeEmf/dt+cwfJYhqxS3oiVrd/ZVU4aO0m/rg= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 7E966F80544; Sat, 15 Apr 2023 11:09:30 +0200 (CEST) To: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH 7/9] ASoC: ssm2602: Add mute gpio Date: Fri, 14 Apr 2023 16:02:01 +0200 In-Reply-To: <20230414140203.707729-1-pan@semihalf.com> References: <20230414140203.707729-1-pan@semihalf.com> X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 X-Mailman-Approved-At: Sat, 15 Apr 2023 09:08:57 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <168154976963.26.12831314436545841195@mailman-core.alsa-project.org> X-Patchwork-Original-From: =?utf-8?q?Pawe=C5=82_Anikiel_via_Alsa-devel?= From: =?utf-8?q?Pawe=C5=82_Anikiel?= Reply-To: =?utf-8?q?Pawe=C5=82_Anikiel?= Cc: tiwai@suse.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dinguyen@kernel.org, lars@metafoo.de, nuno.sa@analog.com, upstream@semihalf.com, =?utf-8?q?Pawe=C5=82_Anikiel?= Content-Disposition: inline The SSM2603 has a hardware mute pin. Add an optional mute gpio to control it. Signed-off-by: Paweł Anikiel --- sound/soc/codecs/ssm2602.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index 35c4743e756e..dd81e62d7a3b 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -32,6 +33,8 @@ struct ssm2602_priv { enum ssm2602_type type; unsigned int clk_out_pwr; + + struct gpio_desc *mute_gpiod; }; /* @@ -352,6 +355,10 @@ static int ssm2602_mute(struct snd_soc_dai *dai, int mute, int direction) else regmap_update_bits(ssm2602->regmap, SSM2602_APDIGI, APDIGI_ENABLE_DAC_MUTE, 0); + + if (ssm2602->mute_gpiod) + gpiod_set_value_cansleep(ssm2602->mute_gpiod, mute); + return 0; } @@ -680,6 +687,10 @@ int ssm2602_probe(struct device *dev, enum ssm2602_type type, ssm2602->type = type; ssm2602->regmap = regmap; + ssm2602->mute_gpiod = devm_gpiod_get_optional(dev, "mute", GPIOD_OUT_LOW); + if (IS_ERR(ssm2602->mute_gpiod)) + return PTR_ERR(ssm2602->mute_gpiod); + return devm_snd_soc_register_component(dev, &soc_component_dev_ssm2602, &ssm2602_dai, 1); }