Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2046641ybh; Tue, 14 Jul 2020 14:16:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzmzFtso9tTfQLNLb7sl8Lyd5SFYdJ3wehK0MFbvTqXsfpnbWVDjos1gaGgZSe3zZXg/V/ X-Received: by 2002:a17:906:4757:: with SMTP id j23mr5994085ejs.431.1594761381601; Tue, 14 Jul 2020 14:16:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594761381; cv=none; d=google.com; s=arc-20160816; b=j3gfShA6jJXgcQ2LVnHMhqb0GiTcDhPREFI5bid3Z3XNL7Msh4VgWCGa5effFmF1mY J1Y8uo2PxB2zrvbEauFkW0+kAB8hbP8IEdz9On9b2XhcBBGyXcYulbS7mxN0QuFue45j 59FpfLoRqqQW3TL/78NHqFlDjrHrQg/HQxcND10M5IVgbMZ7+8Cy29wAiDf+gAzRiOFZ qMP3ywR4+FB8pPTiENJ3E0aEQEyGzM8Dh7Ax+K+GvPZ/oSjTlTrGocnD0aofEraeN0er 5NSzdHkcMIuBSTxtYOgyN3PrfUl0KaEf1d90dlQDYg3XjW8BLNF2yLj1K8muSMofgmIg B2TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=gUsxgEIbOCPN/g+dhdnfdWC6Rsm4WcdiQ4zDxdYgS80=; b=1EeTKFNd+61nFNxw+bVMnbq0S+f94Jx1O47rLducy1bWQ7tiAtw9EaSyKa5EKH9aiY hWEsKJ0FKB5yyIBwUOCy708AT+uL8kuQ1s3QrG8lIpUbBqQC6WUc8zgv8dQg1Hph3CoH 2hoQ8edq9iePaG3sYORFy4f/4uKudqyobEPd/cWYvw7dqe+pxs1DLEMe5FGT2aY4diEO c2kVm+0KG0uLYkj9fsvsAWa74iLLBBu9p1QAB2F9HTEVRftatzpMIiIJkUTSfx04L9aA j5DtGYmYFnlRIWfhk7ap+cA81vxlo235pDfMcQT1VK5OPxjZ52wHHgV8wgIJZm5gX+Us jocA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=c4g5l41v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lu24si11379990ejb.477.2020.07.14.14.15.58; Tue, 14 Jul 2020 14:16:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=c4g5l41v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728042AbgGNVPL (ORCPT + 99 others); Tue, 14 Jul 2020 17:15:11 -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-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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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); > + }