From patchwork Fri Mar 20 20:55:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 193217 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B427DC4332D for ; Fri, 20 Mar 2020 20:58:55 +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 3DA0120709 for ; Fri, 20 Mar 2020 20:58:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="QX9wvyuo"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uJ662SXh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3DA0120709 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 7EF9984A; Fri, 20 Mar 2020 21:58:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7EF9984A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1584737933; bh=VZYqMg+388ubn9qo9sEi5m8itQMIvAwFL3qPzdXbemU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QX9wvyuoaEK4feQe4cPUDr6icggWAFQbzVKbDUT17ImBzyTZhxWIcZdgKzXIoUcKb hlArpKr4Dhgrqg/Y8P/IlL4SpN7URL/n8emDAhXsKXmYY4jUQBncTMK2xS6JkevY+o 5Dhg1VfApWgW/RvflsXY0f+yzQZL63P3owU9SlM4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C0ACEF80227; Fri, 20 Mar 2020 21:56:23 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 49B87F8015B; Fri, 20 Mar 2020 21:56:21 +0100 (CET) Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) (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 A1748F800C0 for ; Fri, 20 Mar 2020 21:56:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A1748F800C0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uJ662SXh" Received: by mail-lf1-x144.google.com with SMTP id i1so4938930lfo.1 for ; Fri, 20 Mar 2020 13:56:18 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=q9oV0Jet7GMraR3xqtV0h+iLCecJI0XRcctkMuUHagA=; b=uJ662SXhR9zxkO088xiUitQhQMrirDeOS3TUScosTIg4zji4P6drAcNKY1fliPnOLy TC7gD8qUZrOf1kuPbaPvTabKzsGP3+LRRZmLE0lz5JSMe2wWs6GT1/UeTu/8K8YKM5m4 QNZb+C04XDHdbjfO/nfKsjrFOVGlNAOS/9jFz5LPgWs5XULwEAd1K7SS0CJu4qR0hIUv JCHHsgdq+nftXyM2M0XI0YNoWXCN8k5JOVmv1ksoWcXG3XVNO5y3cZQmcnOXhKmfoqvb XeFq5/4B0ZHYZNQgch62LqTbYyHVxUMhRXFH9qnpo1VFSWMHdosYyFV0p96nS/DjKEUd vFuw== 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=q9oV0Jet7GMraR3xqtV0h+iLCecJI0XRcctkMuUHagA=; b=rOePwN+9Y9l5RulFtv8XRLSF04IVKRBys8dlqkFm4aD7JLN8+wBpJZbLjH93fAHNF9 EVMYV7EiVuYmeB+5q+CcWhvvnGrrBv+ptLrven1QcPyRCI04mwXTVMxfTrqCrqnO5o97 ZNHg5m3NaCHbRILnkZdXptFtxxPPIbznJONcqPHeIJ7lCWBM9c2n9ob8zJcAXUV5MVr6 7EdE9YcX9MPRPGmgnpl8AietF1/ZBOEc2Trocl1MTLvPv7AGdD35XO9DR9mWxzuE79Bw Alihe0TdZywpq8z2DQLmCcUSG6kbhg23DuBIxbNYuKz4xHCAgYLxRzYrRSAQnXGoW916 L+SQ== X-Gm-Message-State: ANhLgQ3VFVJ/FxYUpB2/3wDk3uzQuWsW6nQ1A1vh9Ui4FrqxRKiTwL3O +L6v5Bc0LL4DLe+/NPlngsg= X-Google-Smtp-Source: ADFU+vsLajssmyb9pDEbtINGlaD8mIM0RtJt8T7pAoYMTjD1DsK8CE1iAEpQ1DTyU2ucTWgIXn+98g== X-Received: by 2002:a05:6512:108a:: with SMTP id j10mr6566513lfg.35.1584737776522; Fri, 20 Mar 2020 13:56:16 -0700 (PDT) Received: from localhost.localdomain (94-29-39-224.dynamic.spd-mgts.ru. [94.29.39.224]) by smtp.gmail.com with ESMTPSA id 1sm3873356lft.47.2020.03.20.13.56.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2020 13:56:15 -0700 (PDT) From: Dmitry Osipenko To: Rob Herring , Mark Brown , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Stephen Warren , Jonathan Hunter Subject: [PATCH v1 2/2] ASoC: tegra: tegra_wm8903: Support DAPM events for built-in microphone Date: Fri, 20 Mar 2020 23:55:04 +0300 Message-Id: <20200320205504.30466-3-digetx@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200320205504.30466-1-digetx@gmail.com> References: <20200320205504.30466-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" The enable-GPIO needs to be toggled on a DAPM event in order to turn microphone ON/OFF, otherwise microphone won't work. Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra_wm8903.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c index f08d3489c3cf..071c7d2de77c 100644 --- a/sound/soc/tegra/tegra_wm8903.c +++ b/sound/soc/tegra/tegra_wm8903.c @@ -143,14 +143,32 @@ static int tegra_wm8903_event_hp(struct snd_soc_dapm_widget *w, return 0; } +static int tegra_wm8903_event_int_mic(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *k, int event) +{ + struct snd_soc_dapm_context *dapm = w->dapm; + struct snd_soc_card *card = dapm->card; + struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); + + if (!gpio_is_valid(machine->gpio_int_mic_en)) + return 0; + + gpio_set_value_cansleep(machine->gpio_int_mic_en, + SND_SOC_DAPM_EVENT_ON(event)); + + return 0; +} + static const struct snd_soc_dapm_widget tegra_wm8903_dapm_widgets[] = { SND_SOC_DAPM_SPK("Int Spk", tegra_wm8903_event_int_spk), SND_SOC_DAPM_HP("Headphone Jack", tegra_wm8903_event_hp), SND_SOC_DAPM_MIC("Mic Jack", NULL), + SND_SOC_DAPM_MIC("Int Mic", tegra_wm8903_event_int_mic), }; static const struct snd_kcontrol_new tegra_wm8903_controls[] = { SOC_DAPM_PIN_SWITCH("Int Spk"), + SOC_DAPM_PIN_SWITCH("Int Mic"), }; static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)