From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 150BBC433E5 for ; Tue, 14 Jul 2020 21:16:12 +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 9772520656 for ; Tue, 14 Jul 2020 21:16:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="JVFs9Csn"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c4g5l41v" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9772520656 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 3E6D715F2; Tue, 14 Jul 2020 23:15:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3E6D715F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1594761370; bh=Oo+BzK4qk3JSgLLNjaFi89A5rMIoGwhkoZuK3UVN7rY=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JVFs9CsniIv4gAUwXFen6fuZ9zlawJ+1szGQUd7oS+2/bhkfYiwN0wEqeKumHZiBV QdazdMNSDwj0FRq2k+3jkNh+AwrG9z3sWlCPJBFz1sJaVblTUh5rB/6NluOfgE+r8P XlA/5L127qnTEjrqTWR1XQeFqZkdZfFoXrh5vbx0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B9D3CF80113; Tue, 14 Jul 2020 23:15:19 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CBD72F8019B; Tue, 14 Jul 2020 23:15:18 +0200 (CEST) Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) (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 81D76F80113 for ; Tue, 14 Jul 2020 23:15:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 81D76F80113 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c4g5l41v" Received: by mail-pg1-x541.google.com with SMTP id m22so8300219pgv.9 for ; Tue, 14 Jul 2020 14:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gUsxgEIbOCPN/g+dhdnfdWC6Rsm4WcdiQ4zDxdYgS80=; b=c4g5l41vPTzdfvBku6Gyyd9dtF0BOhHeYH39FPISi5h5zu/7m0KQBQAauU6DRWwCNI aJFxK5Oqe96j7ceibK0CyVHiTNei10p4jHaC3l7OVoXMCCEeHsi/Q8ezd90xrh3x8oJ6 UwDEyUiPh3Ja1sl8MrwnF5+o4DsaE+nx8NDmDwYw98Nea3ZKmlTfZx3CCP800NIM0SOY CXa3j3AUDNMdDH2KvVLhkxmyCWqXWjSov+f1nxIO31O0Gx6YS7hwxXt8puB0/xHjTd2f u1Y3X+ybA8mclQRcyyvl59frNzSpsGVtHfR6Mbi41HgC+bFjI9xSl+k3C4ePbPUODuiP oeqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gUsxgEIbOCPN/g+dhdnfdWC6Rsm4WcdiQ4zDxdYgS80=; b=cVoTbjQvQFeqYB+6qn9lpyQnbruBI5AEBiA72gdMhFJwV3TbfLMoEaUtMwVK2euTz0 HBYGAwCzAhf1tb14BFGntxjpY9DAGR6PBn7Rk0eyr85IT97217Cvv2llkLzMhcNOL8ap 4YddY8f69b/Lg6jBuysZh7LkyDbdBdgyFVvC4HLjXLuZUGzZ1PDTNdbfroHccn1wbY2c pkm9qWjQT8DC57nWLHrtdUV2qe+Wl3LlockARG8UPr5xzd4+iHOYnv9HeJ2jzK3zHaRz s0fs9AkilBd29mEUM8DwV/z2kS9hy5C59rGI1yzKv7e/12YNI8bD7soPcbzcxCN4XKXy hoMA== X-Gm-Message-State: AOAM533GyE/lwRwBFx/W/qv27cNKRWvOwvyy2U7wJi/yCf1Yz52LFY5+ BEj6OozW86QIXxVq9RAvPfg= X-Google-Smtp-Source: ABdhPJwsRQ9mKCwSTE8ucb75FPjtcLbouSD8dQj1J5mA3EExVAJ2tJ3R4hWiETcAhJVqwmV+N1o7rA== X-Received: by 2002:a63:441c:: with SMTP id r28mr4965134pga.372.1594761309828; Tue, 14 Jul 2020 14:15:09 -0700 (PDT) Received: from Asurada-Nvidia (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id y17sm105760pfe.30.2020.07.14.14.15.08 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Jul 2020 14:15:09 -0700 (PDT) Date: Tue, 14 Jul 2020 14:14:45 -0700 From: Nicolin Chen To: Shengjiu Wang Subject: Re: [PATCH 3/3] ASoC: fsl-asoc-card: Support Headphone and Microphone Jack detection Message-ID: <20200714211432.GA10818@Asurada-Nvidia> References: <1594717536-5188-1-git-send-email-shengjiu.wang@nxp.com> <1594717536-5188-4-git-send-email-shengjiu.wang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1594717536-5188-4-git-send-email-shengjiu.wang@nxp.com> User-Agent: Mutt/1.9.4 (2018-02-28) Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, timur@kernel.org, kuninori.morimoto.gx@renesas.com, samuel@sholland.org, katsuhiro@katsuster.net, linux-kernel@vger.kernel.org, Xiubo.Lee@gmail.com, lgirdwood@gmail.com, robh+dt@kernel.org, tiwai@suse.com, broonie@kernel.org, festevam@gmail.com 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" Hi Shengjiu, The whole series looks good to me. Just a couple of small questions inline: On Tue, Jul 14, 2020 at 05:05:36PM +0800, Shengjiu Wang wrote: > Use asoc_simple_init_jack function from simple card to implement > the Headphone and Microphone detection. > Register notifier to disable Speaker when Headphone is plugged in > and enable Speaker when Headphone is unplugged. > Register notifier to disable Digital Microphone when Analog Microphone > is plugged in and enable DMIC when Analog Microphone is unplugged. > > Signed-off-by: Shengjiu Wang > --- > sound/soc/fsl/Kconfig | 1 + > sound/soc/fsl/fsl-asoc-card.c | 69 ++++++++++++++++++++++++++++++++++- > 2 files changed, 68 insertions(+), 2 deletions(-) > static int fsl_asoc_card_late_probe(struct snd_soc_card *card) > { > struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(card); > @@ -745,8 +789,29 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) > snd_soc_card_set_drvdata(&priv->card, priv); > > ret = devm_snd_soc_register_card(&pdev->dev, &priv->card); > - if (ret && ret != -EPROBE_DEFER) > - dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); > + if (ret) { > + if (ret != -EPROBE_DEFER) > + dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); I think we may move this EPROBE_DEFER to the asrc_fail label. > + goto asrc_fail; > + } > + > + if (of_property_read_bool(np, "hp-det-gpio")) { Could we move this check inside asoc_simple_init_jack? There's no problem with doing it here though, yet I got a bit confused by it as I thought it's a boolean type property, which would be against the DT bindings until I saw asoc_simple_init_jack() uses the same string to get the GPIO. Just it probably would be a bit tricky as we need it to be optional here. Otherwise, I think we may add a line of comments to indicate that the API would use the same string to get the GPIO. > + ret = asoc_simple_init_jack(&priv->card, &priv->hp_jack, > + 1, NULL, "Headphone Jack"); > + if (ret) > + goto asrc_fail; > + > + snd_soc_jack_notifier_register(&priv->hp_jack.jack, &hp_jack_nb); > + } From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.3 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 3A2D7C433E2 for ; Tue, 14 Jul 2020 21:17:24 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 D900C20658 for ; Tue, 14 Jul 2020 21:17:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c4g5l41v" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D900C20658 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4B5tdF4c6gzDqQH for ; Wed, 15 Jul 2020 07:17:21 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::542; helo=mail-pg1-x542.google.com; envelope-from=nicoleotsuka@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=c4g5l41v; dkim-atps=neutral Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4B5tZr0Vr1zDqQH for ; Wed, 15 Jul 2020 07:15:13 +1000 (AEST) Received: by mail-pg1-x542.google.com with SMTP id t6so8316468pgq.1 for ; Tue, 14 Jul 2020 14:15:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gUsxgEIbOCPN/g+dhdnfdWC6Rsm4WcdiQ4zDxdYgS80=; b=c4g5l41vPTzdfvBku6Gyyd9dtF0BOhHeYH39FPISi5h5zu/7m0KQBQAauU6DRWwCNI aJFxK5Oqe96j7ceibK0CyVHiTNei10p4jHaC3l7OVoXMCCEeHsi/Q8ezd90xrh3x8oJ6 UwDEyUiPh3Ja1sl8MrwnF5+o4DsaE+nx8NDmDwYw98Nea3ZKmlTfZx3CCP800NIM0SOY CXa3j3AUDNMdDH2KvVLhkxmyCWqXWjSov+f1nxIO31O0Gx6YS7hwxXt8puB0/xHjTd2f u1Y3X+ybA8mclQRcyyvl59frNzSpsGVtHfR6Mbi41HgC+bFjI9xSl+k3C4ePbPUODuiP oeqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gUsxgEIbOCPN/g+dhdnfdWC6Rsm4WcdiQ4zDxdYgS80=; b=e/YbMAtrLLOtJICH1E3nhWLWC6uyV/f8v2TESnyGB4Qx6k46TdX1ybeFPUH/AYbPPp VEwXa0YbEXy66mPvazglWmwll4zN44WFZUvduM/qPxDJFLcZELKpR2+zUxJCcKXBJCbB 8dyHVGKXri+Xi3lV5cgJ+nd4Ooq/z6sG8UVjOn1YmS/P5SEBIIJsWz96i2LAZxE6f5W+ 0IKQ5vtkwkJUTVGMGSG3xSE5z36K07kKrpFrzeBEZVHNvBEoZrmrnim41+hWjwGOJKrt d5ZuUnspqoYlWzRxvF0uxHS+f3rBXLt/USVlApJA7/G6cuoQ+eSHO8wV4FfC8Fjc3r5b bFhw== X-Gm-Message-State: AOAM53398lKWV9Hmi1u6Sy3MG1mGp8n5d8a6DhHb/64O/PjhRlvT+Qws j+avo17jnatURb7vC9XMZ+o= X-Google-Smtp-Source: ABdhPJwsRQ9mKCwSTE8ucb75FPjtcLbouSD8dQj1J5mA3EExVAJ2tJ3R4hWiETcAhJVqwmV+N1o7rA== X-Received: by 2002:a63:441c:: with SMTP id r28mr4965134pga.372.1594761309828; Tue, 14 Jul 2020 14:15:09 -0700 (PDT) Received: from Asurada-Nvidia (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id y17sm105760pfe.30.2020.07.14.14.15.08 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Jul 2020 14:15:09 -0700 (PDT) Date: Tue, 14 Jul 2020 14:14:45 -0700 From: Nicolin Chen To: Shengjiu Wang Subject: Re: [PATCH 3/3] ASoC: fsl-asoc-card: Support Headphone and Microphone Jack detection Message-ID: <20200714211432.GA10818@Asurada-Nvidia> References: <1594717536-5188-1-git-send-email-shengjiu.wang@nxp.com> <1594717536-5188-4-git-send-email-shengjiu.wang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1594717536-5188-4-git-send-email-shengjiu.wang@nxp.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, timur@kernel.org, kuninori.morimoto.gx@renesas.com, samuel@sholland.org, katsuhiro@katsuster.net, linux-kernel@vger.kernel.org, Xiubo.Lee@gmail.com, lgirdwood@gmail.com, robh+dt@kernel.org, tiwai@suse.com, broonie@kernel.org, perex@perex.cz, festevam@gmail.com Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Hi Shengjiu, The whole series looks good to me. Just a couple of small questions inline: On Tue, Jul 14, 2020 at 05:05:36PM +0800, Shengjiu Wang wrote: > Use asoc_simple_init_jack function from simple card to implement > the Headphone and Microphone detection. > Register notifier to disable Speaker when Headphone is plugged in > and enable Speaker when Headphone is unplugged. > Register notifier to disable Digital Microphone when Analog Microphone > is plugged in and enable DMIC when Analog Microphone is unplugged. > > Signed-off-by: Shengjiu Wang > --- > sound/soc/fsl/Kconfig | 1 + > sound/soc/fsl/fsl-asoc-card.c | 69 ++++++++++++++++++++++++++++++++++- > 2 files changed, 68 insertions(+), 2 deletions(-) > static int fsl_asoc_card_late_probe(struct snd_soc_card *card) > { > struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(card); > @@ -745,8 +789,29 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) > snd_soc_card_set_drvdata(&priv->card, priv); > > ret = devm_snd_soc_register_card(&pdev->dev, &priv->card); > - if (ret && ret != -EPROBE_DEFER) > - dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); > + if (ret) { > + if (ret != -EPROBE_DEFER) > + dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); I think we may move this EPROBE_DEFER to the asrc_fail label. > + goto asrc_fail; > + } > + > + if (of_property_read_bool(np, "hp-det-gpio")) { Could we move this check inside asoc_simple_init_jack? There's no problem with doing it here though, yet I got a bit confused by it as I thought it's a boolean type property, which would be against the DT bindings until I saw asoc_simple_init_jack() uses the same string to get the GPIO. Just it probably would be a bit tricky as we need it to be optional here. Otherwise, I think we may add a line of comments to indicate that the API would use the same string to get the GPIO. > + ret = asoc_simple_init_jack(&priv->card, &priv->hp_jack, > + 1, NULL, "Headphone Jack"); > + if (ret) > + goto asrc_fail; > + > + snd_soc_jack_notifier_register(&priv->hp_jack.jack, &hp_jack_nb); > + } From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 92555C433E2 for ; Tue, 14 Jul 2020 21:15:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6995F20658 for ; Tue, 14 Jul 2020 21:15:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c4g5l41v" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726960AbgGNVPK (ORCPT ); Tue, 14 Jul 2020 17:15:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726446AbgGNVPK (ORCPT ); Tue, 14 Jul 2020 17:15:10 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8518DC061755; Tue, 14 Jul 2020 14:15:10 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id a14so8169302pfi.2; Tue, 14 Jul 2020 14:15:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gUsxgEIbOCPN/g+dhdnfdWC6Rsm4WcdiQ4zDxdYgS80=; b=c4g5l41vPTzdfvBku6Gyyd9dtF0BOhHeYH39FPISi5h5zu/7m0KQBQAauU6DRWwCNI aJFxK5Oqe96j7ceibK0CyVHiTNei10p4jHaC3l7OVoXMCCEeHsi/Q8ezd90xrh3x8oJ6 UwDEyUiPh3Ja1sl8MrwnF5+o4DsaE+nx8NDmDwYw98Nea3ZKmlTfZx3CCP800NIM0SOY CXa3j3AUDNMdDH2KvVLhkxmyCWqXWjSov+f1nxIO31O0Gx6YS7hwxXt8puB0/xHjTd2f u1Y3X+ybA8mclQRcyyvl59frNzSpsGVtHfR6Mbi41HgC+bFjI9xSl+k3C4ePbPUODuiP oeqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gUsxgEIbOCPN/g+dhdnfdWC6Rsm4WcdiQ4zDxdYgS80=; b=CJhBoUyDKNAruOx9OlNPhIoFgub1z5G0UVntrJbF7BH0UlDhUOHY2OeCF7qdukYk2x LvSLo4QvZsXPo4cY3H1bvyVPaW5XjGtG0Pi4HystgE4CjNb06GST0IMvPqXGXbzA3Ht0 7H88S9W/E66zCuD3JQK2ALBrS6+/aljYpLFSE18PAYEDNoh3yf8dqfz0GAG/6ZfP7/bL h3Ihb+ActDEtzNubyiUbXcqIa9NTlT7b2S6Jc8JEm6YwpR2l2csdryfSO7bhkgfXpCyI NWcm9+1sQUVOIS8BiM6x7j2sMCz2Uw545aqQeq5OecsQM4a0fSKTtSCJIqRPHLW0c+6E 4FsA== X-Gm-Message-State: AOAM530nD/P9ReNRmgkjA3FXYbCPnY7LBZDD/Z93oh6cYwj5iMffVkWQ 3ySCFp9XTSg2MvoKsdX6H0I= X-Google-Smtp-Source: ABdhPJwsRQ9mKCwSTE8ucb75FPjtcLbouSD8dQj1J5mA3EExVAJ2tJ3R4hWiETcAhJVqwmV+N1o7rA== X-Received: by 2002:a63:441c:: with SMTP id r28mr4965134pga.372.1594761309828; Tue, 14 Jul 2020 14:15:09 -0700 (PDT) Received: from Asurada-Nvidia (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id y17sm105760pfe.30.2020.07.14.14.15.08 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Jul 2020 14:15:09 -0700 (PDT) Date: Tue, 14 Jul 2020 14:14:45 -0700 From: Nicolin Chen To: Shengjiu Wang Cc: perex@perex.cz, tiwai@suse.com, lgirdwood@gmail.com, broonie@kernel.org, kuninori.morimoto.gx@renesas.com, katsuhiro@katsuster.net, samuel@sholland.org, alsa-devel@alsa-project.org, robh+dt@kernel.org, devicetree@vger.kernel.org, timur@kernel.org, Xiubo.Lee@gmail.com, festevam@gmail.com, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 3/3] ASoC: fsl-asoc-card: Support Headphone and Microphone Jack detection Message-ID: <20200714211432.GA10818@Asurada-Nvidia> References: <1594717536-5188-1-git-send-email-shengjiu.wang@nxp.com> <1594717536-5188-4-git-send-email-shengjiu.wang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1594717536-5188-4-git-send-email-shengjiu.wang@nxp.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Shengjiu, The whole series looks good to me. Just a couple of small questions inline: On Tue, Jul 14, 2020 at 05:05:36PM +0800, Shengjiu Wang wrote: > Use asoc_simple_init_jack function from simple card to implement > the Headphone and Microphone detection. > Register notifier to disable Speaker when Headphone is plugged in > and enable Speaker when Headphone is unplugged. > Register notifier to disable Digital Microphone when Analog Microphone > is plugged in and enable DMIC when Analog Microphone is unplugged. > > Signed-off-by: Shengjiu Wang > --- > sound/soc/fsl/Kconfig | 1 + > sound/soc/fsl/fsl-asoc-card.c | 69 ++++++++++++++++++++++++++++++++++- > 2 files changed, 68 insertions(+), 2 deletions(-) > static int fsl_asoc_card_late_probe(struct snd_soc_card *card) > { > struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(card); > @@ -745,8 +789,29 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) > snd_soc_card_set_drvdata(&priv->card, priv); > > ret = devm_snd_soc_register_card(&pdev->dev, &priv->card); > - if (ret && ret != -EPROBE_DEFER) > - dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); > + if (ret) { > + if (ret != -EPROBE_DEFER) > + dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); I think we may move this EPROBE_DEFER to the asrc_fail label. > + goto asrc_fail; > + } > + > + if (of_property_read_bool(np, "hp-det-gpio")) { Could we move this check inside asoc_simple_init_jack? There's no problem with doing it here though, yet I got a bit confused by it as I thought it's a boolean type property, which would be against the DT bindings until I saw asoc_simple_init_jack() uses the same string to get the GPIO. Just it probably would be a bit tricky as we need it to be optional here. Otherwise, I think we may add a line of comments to indicate that the API would use the same string to get the GPIO. > + ret = asoc_simple_init_jack(&priv->card, &priv->hp_jack, > + 1, NULL, "Headphone Jack"); > + if (ret) > + goto asrc_fail; > + > + snd_soc_jack_notifier_register(&priv->hp_jack.jack, &hp_jack_nb); > + }