Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3558539imu; Mon, 17 Dec 2018 23:53:45 -0800 (PST) X-Google-Smtp-Source: AFSGD/V4A5UrPJSVTdKklYDkZDaBggVD74dbnD4jBT3l+CFFZ7hgeHsNI3bTZArNanmrpaGnCB/T X-Received: by 2002:a63:3287:: with SMTP id y129mr14935754pgy.337.1545119625773; Mon, 17 Dec 2018 23:53:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545119625; cv=none; d=google.com; s=arc-20160816; b=UpRa8wffXEroPPzhZZ5GO9YMopcupr7LcsAkMvvuCkQ9MAThoiuYot5r+evqZeLjCR rXnIeOZSn1x9aT0ydStFXadXsDoXm0BgDcJ232FHjDrfrkvO5PXi/2EvTqH3ynLx1EfF DX0yzsNNmVfh5v/BSs8iwCiVw2Mx9XTSZ8mhjXlKApISzyayJiOCFNP6nPGivq4Rrf7u OAFmh18T+zeSO5MFY3NlClGpOgdv8/aQn5rH1pUoyKV59dt+OGL4j13PS4/nKLIXoba0 sD8N3gOn+GGKRdnwu3NXsx3r329QwzOBeFLWnShSu/fIIfJo9iNkHVf7hpn3IYwsMlvB rRcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=LRQ1Ns1Hb+fH3c6jwKhR+JIom6cyMNiXXfCsZV1TOJY=; b=YhkZ6QsSYQ4l7x+wnsUPGCqHtkqNilA8JpQrR8ycozaOWtK3NFianLoaxAwgwSl5R1 4OdxREwH+ub+TiaYWpy2t89a7tKBEN/Fx1+h1k2BE6q0xLpIohkVV8ILAhTXnSN1IF/B 1DXNQixP+PtATT2bq5nXswHqcrRI8b1YMWr+gnMbPAKObY742zEoVTssm65QxMai+19Q kbi/P07WNRewpNSMbtS0Bo4J4JduCfMeXOHz0gJg0QlrWC2hSYi02G3zlWh8CV88aqTx G6CkJk81Zuj1Jc6aZ4D1rucDZ2Ie0rN5EskVtLXISOloC2wmBbOmNRCdoDJLlmsasgdb M5QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="B/SwwLqM"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10si13056196plg.82.2018.12.17.23.53.30; Mon, 17 Dec 2018 23:53:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="B/SwwLqM"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726467AbeLRHvR (ORCPT + 99 others); Tue, 18 Dec 2018 02:51:17 -0500 Received: from mail-vs1-f68.google.com ([209.85.217.68]:42957 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726346AbeLRHvR (ORCPT ); Tue, 18 Dec 2018 02:51:17 -0500 Received: by mail-vs1-f68.google.com with SMTP id b74so9425316vsd.9 for ; Mon, 17 Dec 2018 23:51:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LRQ1Ns1Hb+fH3c6jwKhR+JIom6cyMNiXXfCsZV1TOJY=; b=B/SwwLqMR1ys1/6yMXoGDbABr1z/UbvXPGdjTxo5QT0gwbWSXm6KHwpxzEXUG0Nrxt bDXFh3nxhVz0AZhr2y/jTZIJmST5C+YpyBzy9eoxe6VGrCtl/tmQ2uOmbNpiMdXUH4S/ 5TflPRUMtmw/BSZ72AkDRJaDxskeFo/NymFXE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LRQ1Ns1Hb+fH3c6jwKhR+JIom6cyMNiXXfCsZV1TOJY=; b=gsIL0rS6qU0htXppyxAdive6auEBEMp7F/NOaus8pxUt7FKVGNg0BSLWmL9K3emlO0 8B5hClO3Jq6WgSQnyQsSDQL9bg55W0O6pFDBfk+JQC+2MHiRdGDN6pHRp+Lx8SCzAKXW /60L9n3qscRZW2S57ajMa9TprvLe86AoG0mD1oLYLIYKEujhrSz81RQKsRxtgbnUyfy/ cpdC7eH1q1gHn1fRRFYuAYcFwNDrSxKfPpJuC80eJf4tnhZRyAjhgQAslZdLCoIqAvJm tPp+XNJyqC+yxtLP9aUi0L2UARnOVrUbU5bG2R4KrMjhM0zAheiRzSPVUUTMzXPs0o8U FSfg== X-Gm-Message-State: AA+aEWYnSBwoGj4J1ViETuv+mIMvWu9Ry57MdFX3dUx0vZivHXdtcKF6 ue0mgOYi4CDr+priqZ4hycrb/PqXsG30r5TqCrZ7dg== X-Received: by 2002:a67:ad02:: with SMTP id t2mr730786vsl.170.1545119476147; Mon, 17 Dec 2018 23:51:16 -0800 (PST) MIME-Version: 1.0 References: <1544781703-9585-1-git-send-email-rohitkr@codeaurora.org> In-Reply-To: <1544781703-9585-1-git-send-email-rohitkr@codeaurora.org> From: Cheng-yi Chiang Date: Tue, 18 Dec 2018 15:50:49 +0800 Message-ID: Subject: Re: [alsa-devel] [PATCH] ASoC: sdm845: set jack only for a specific backend To: Rohit kumar Cc: plai@codeaurora.org, bgoswami@codeaurora.org, asishb@codeaurora.org, Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Rohit Kumar , Srini Kandagatla Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 14, 2018 at 6:02 PM Rohit kumar wrote: > > Headset codec is connected over PRIMARY_MI2S interface. Call > set_jack for codec associated with Primary Mi2s interface. > Also, set_jack to NULL when jack is freed. > > Signed-off-by: Rohit kumar > --- > sound/soc/qcom/sdm845.c | 31 ++++++++++++++++++++++--------- > 1 file changed, 22 insertions(+), 9 deletions(-) > > diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c > index 1db8ef66..6f66a58 100644 > --- a/sound/soc/qcom/sdm845.c > +++ b/sound/soc/qcom/sdm845.c > @@ -158,17 +158,24 @@ static int sdm845_snd_hw_params(struct snd_pcm_substream *substream, > return ret; > } > > +static void sdm845_jack_free(struct snd_jack *jack) > +{ > + struct snd_soc_component *component = jack->private_data; > + > + snd_soc_component_set_jack(component, NULL, NULL); > +} > + > 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 snd_soc_dai *codec_dai = rtd->codec_dai; > + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; > struct sdm845_snd_data *pdata = snd_soc_card_get_drvdata(card); > - int i, rval; > + struct snd_jack *jack; > + int rval; > > if (!pdata->jack_setup) { > - struct snd_jack *jack; > - > rval = snd_soc_card_jack_new(card, "Headset Jack", > SND_JACK_HEADSET | > SND_JACK_HEADPHONE | > @@ -190,16 +197,22 @@ static int sdm845_dai_init(struct snd_soc_pcm_runtime *rtd) > pdata->jack_setup = true; > } > > - for (i = 0 ; i < dai_link->num_codecs; i++) { > - struct snd_soc_dai *dai = rtd->codec_dais[i]; > + switch (cpu_dai->id) { > + case PRIMARY_MI2S_RX: > + jack = pdata->jack.jack; > + component = codec_dai->component; > > - component = dai->component; > - rval = snd_soc_component_set_jack( > - component, &pdata->jack, NULL); > + jack->private_data = component; > + jack->private_free = sdm845_jack_free; > + 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; > } > + break; > + default: > + break; > } > > return 0; > -- > Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., > is a member of Code Aurora Forum, a Linux Foundation Collaborative Project. > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel Thanks a lot for the fix! Reviewed-by: Cheng-Yi Chiang Tested-by: Cheng-Yi Chiang