From patchwork Wed Nov 28 16:05:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 152308 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1268201ljp; Wed, 28 Nov 2018 08:06:03 -0800 (PST) X-Google-Smtp-Source: AFSGD/V95PHoI3DyydW5cfMirdiLQLR+atpAcJfy7z5DRnCI+iCnMqnnFlbmEdYncyySAMJCAnJi X-Received: by 2002:adf:ee06:: with SMTP id y6mr32668816wrn.261.1543421163016; Wed, 28 Nov 2018 08:06:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543421163; cv=none; d=google.com; s=arc-20160816; b=I07ielIj4P48Boyov3x5YteX2NKuG63Yv+3Qc1pN5rsXwzadErRWpQcvjkNfoOGQ3E ZQISn7kSATPVlLv7EMNdf3wHviQsgav8IqvmnELXoC2Hs666VFcUpU3gXL80ymQ4mb/l nS8FUoA4W/DASrxVomXYfSaLB2i0bRyHac+zDBbuOHs8NYDGy9yGt4Ts/tgQAoepUOb9 pUOuj2M6nebwy5fSlSFgCeYd/UnjJGhvPQAr+dI7hpw4NmK/mPsqz9RThdNaWtwkUWz1 q4NUAZH+USDIM3iZhW1tQvWMO8gTovisfD2zBJofv5A629+8lymA7fHuD/cFUE4LI447 TI6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to; bh=oZigzXY1f37ncoGt/E5qymETNhcxlb5AyVkqbPS7t3c=; b=e3tNBm51xn153NGggMfvc1PCbWfPVI7RFj14cx6SxTRnLD4MfLYC425PhBnAXC/vhi Kh2+M7rzzGJScYdHMbz6c5i/qeR/7gqPmpicrAGPrm7tT9wzqoJaEhTWNGt1Ycu3RRGx q9ZevSe/RayR70n2xZRW4cHGhKd2aZ/q4b6PVoXzb7Mehr8PF5vnKxGWVCtSmoMzQefg rQpmQVA38UiVx5K7aJ3oc8FZ8bqrvC30GCKy1x1LfGdcU/SrzdxXBZJqVUmR1WQdXyD+ yt6ergND/n6knaAAWEYBoZoFswVdtp3NpkdflC6txNvJJheIy4HyPIr9+lMK1Qa5AzTj e2dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=TQXl7ix9; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id m128si2615336wme.70.2018.11.28.08.06.02; Wed, 28 Nov 2018 08:06:03 -0800 (PST) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=TQXl7ix9; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 15281267B7F; Wed, 28 Nov 2018 17:05:32 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id AE6F6267B75; Wed, 28 Nov 2018 17:05:27 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 82FA4267B01 for ; Wed, 28 Nov 2018 17:05:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=pFlZbrWS1LE++JUYzjyFDCwiKKCW+lnHqGVHZh7oiBw=; b=TQXl7ix9sEJv j0PYIRZGtA+QAxoDZpmRfZQQdMhe8S5qghZy9qrOPdyr1qLqwvHmIAWES/H+5onGRGKdxpXfk/CIg MTuj1A79EuQGMDpcZRaC6tDEGhg0jgn5TGYlAX3p4ktkVSladEMXOkTROUREJMbY74V1cforh/sWm l1gZs=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=debutante.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpa (Exim 4.89) (envelope-from ) id 1gS2L7-0005wm-1k; Wed, 28 Nov 2018 16:05:25 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id B60F8112521B; Wed, 28 Nov 2018 16:05:24 +0000 (GMT) From: Mark Brown To: Cheng-Yi Chiang In-Reply-To: Message-Id: <20181128160524.B60F8112521B@debutante.sirena.org.uk> Date: Wed, 28 Nov 2018 16:05:24 +0000 (GMT) Cc: Srinivas Kandagatla , alsa-devel@alsa-project.org, Mark Brown , Rohit kumar Subject: [alsa-devel] Applied "ASoC: qcom: sdm845: Create and setup jack in init callback" to the asoc tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch ASoC: qcom: sdm845: Create and setup jack in init callback has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 80e733fda42f511b346106351ba7b73d5a8196d4 Mon Sep 17 00:00:00 2001 From: Cheng-Yi Chiang Date: Sat, 24 Nov 2018 19:09:46 +0800 Subject: [PATCH] ASoC: qcom: sdm845: Create and setup jack in init callback Add a callback for init ops on dai_link to create and setup jack. Signed-off-by: Rohit kumar Signed-off-by: Cheng-Yi Chiang Acked-by: Srinivas Kandagatla Signed-off-by: Mark Brown --- sound/soc/qcom/sdm845.c | 57 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) -- 2.19.0.rc2 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c index 95d8d4422dae..43c03f8e8cdc 100644 --- a/sound/soc/qcom/sdm845.c +++ b/sound/soc/qcom/sdm845.c @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include "common.h" #include "qdsp6/q6afe.h" @@ -17,6 +19,8 @@ #define MI2S_BCLK_RATE 1536000 struct sdm845_snd_data { + struct snd_soc_jack jack; + bool jack_setup; struct snd_soc_card *card; uint32_t pri_mi2s_clk_count; uint32_t sec_mi2s_clk_count; @@ -100,6 +104,54 @@ static int sdm845_snd_hw_params(struct snd_pcm_substream *substream, return ret; } +static int sdm845_dai_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_component *component; + struct snd_soc_dai_link *dai_link = rtd->dai_link; + struct snd_soc_card *card = rtd->card; + struct sdm845_snd_data *pdata = snd_soc_card_get_drvdata(card); + int i, rval; + + if (!pdata->jack_setup) { + struct snd_jack *jack; + + rval = snd_soc_card_jack_new(card, "Headset Jack", + SND_JACK_HEADSET | + SND_JACK_HEADPHONE | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &pdata->jack, NULL, 0); + + if (rval < 0) { + dev_err(card->dev, "Unable to add Headphone Jack\n"); + return rval; + } + + jack = pdata->jack.jack; + + snd_jack_set_key(jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); + snd_jack_set_key(jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); + snd_jack_set_key(jack, SND_JACK_BTN_2, KEY_VOLUMEUP); + snd_jack_set_key(jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); + pdata->jack_setup = true; + } + + for (i = 0 ; i < dai_link->num_codecs; i++) { + struct snd_soc_dai *dai = rtd->codec_dais[i]; + + component = dai->component; + rval = snd_soc_component_set_jack( + component, &pdata->jack, NULL); + if (rval != 0 && rval != -ENOTSUPP) { + dev_warn(card->dev, "Failed to set jack: %d\n", rval); + return rval; + } + } + + return 0; +} + + static int sdm845_snd_startup(struct snd_pcm_substream *substream) { unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS; @@ -220,7 +272,7 @@ static const struct snd_soc_dapm_widget sdm845_snd_widgets[] = { SND_SOC_DAPM_MIC("Int Mic", NULL), }; -static void sdm845_add_be_ops(struct snd_soc_card *card) +static void sdm845_add_ops(struct snd_soc_card *card) { struct snd_soc_dai_link *link; int i; @@ -230,6 +282,7 @@ static void sdm845_add_be_ops(struct snd_soc_card *card) link->ops = &sdm845_be_ops; link->be_hw_params_fixup = sdm845_be_hw_params_fixup; } + link->init = sdm845_dai_init; } } @@ -264,7 +317,7 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev) data->card = card; snd_soc_card_set_drvdata(card, data); - sdm845_add_be_ops(card); + sdm845_add_ops(card); ret = snd_soc_register_card(card); if (ret) { dev_err(dev, "Sound card registration failed\n");