From patchwork Tue Jul 21 18:27:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 11676387 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2275013A4 for ; Tue, 21 Jul 2020 18:29:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 EBEED206E9 for ; Tue, 21 Jul 2020 18:29:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="B28bkbZG"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ph86JCwg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EBEED206E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=Px2z2gYiUNw7KxSBLNKnojVYG7UuIaqw5y7fuK6i+Fw=; b=B28bkbZG+aeVUBYF6itrW33Vwr 4yB8RpxLWOUyZ3sZtbWsLhocKeHt1HEqvmQhJyHPr04kEoKjtMUDhUa4uHAzDBqK7EAd3L7iS60Vy Ip0gwOyNBbv72JpJX+LRvup/h22p2LH5Kw4m93wPEYtJVIivGvdkjuI42bC6U1XN5liDx+6WMAU27 ddRWAPcxNw48w7uIX3yB4o4UD3/xI7YcByYHPJPsF92XwoZR60UVJtHt/i90cxy0rnz2h6wrb6ihY URgh3PlBayCg6O1Tatc5DG95ph3b56FCbwfOPaCOiIVbSOXeNzkZPw7+diYImIgVKq1yNVdG42PL1 hvtSBvLg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxx0k-0001Cq-Fo; Tue, 21 Jul 2020 18:29:06 +0000 Received: from mail-ej1-x641.google.com ([2a00:1450:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxx0h-0001CQ-FJ; Tue, 21 Jul 2020 18:29:04 +0000 Received: by mail-ej1-x641.google.com with SMTP id l4so6377530ejd.13; Tue, 21 Jul 2020 11:29:02 -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:mime-version :content-transfer-encoding; bh=4jBpCAfHmvrXMsleahVys7l2Kbtf/JTxu6AXTIkM0eQ=; b=ph86JCwgAqK1FafyGhguYtYD9m1MR+zqcBbTXsg8IP83H4jR+1Msy9ofw8JwBHPkBH ryf1PDwI/2ck3LAn4CYZ0jSaBhoePx1DxNUmO5leaJ6oichh5CjPdWJbFpZn8nSQ1mP6 6FQ3HutBUXBCSfAseimn6jrVVkEt4TsA2fysQRViTliWKVuA0tVxqN6yxHra5zMM6Z/2 u0DKVHBff+qBD72/RB5fnv06htnRbIlmW4Ebk5kQNqyZ+peu2f4/dUJrwDFX0OSPu02P EnhYv13WCFw4l82yHLWeV1x5LOWZII9u0MXBFgkyo1uIjj01lDL4T6fcx3O1kZwYXd3Q CHTQ== 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:mime-version :content-transfer-encoding; bh=4jBpCAfHmvrXMsleahVys7l2Kbtf/JTxu6AXTIkM0eQ=; b=Q4h2NXRFh/PJD9gAF6rmQ729zg1nQP77Idqgj35P7g/jFeUlnwXPBvnlFM1cmPPlUy zWeV3D05ql83+ZU0sxl+Kom11bQ3VB4rYzWk+uVu4xMmY2HcSJIC7kW4dSKBO9NmldxS ojlK5EpCbxDC5FvLK5m4sX5UeeerFjX01pAr4r3k6c6e7J5yYdgkJHwwBVRdgwJFNk6z bNiu65eG07bq4sNNgFjV0gbkhzQF0YYhgaIao43ygUbmIUggfWqHXhwgyqtwvRMt8SbO WnBmBSmRQlcI2nEh6yBFBoV3Td580Y4Hwz1QFHJ4t5sFFD8n509CepEYRku/3gHX3c8z F4kA== X-Gm-Message-State: AOAM533SnJrSXIhe0CK7Rb3LXyiFJQ2nK1+bPwh/IoZzTT4ByqpeSSn/ 5qVZqBKklHS6Qcm9P4a+uj0= X-Google-Smtp-Source: ABdhPJyEgjQbISmhm3byo3MXCSUHt+hp1xt7nWYRb4nRip5I+01vDGLbcwHA7g6DLRR1xMIebM/Eig== X-Received: by 2002:a17:906:a84d:: with SMTP id dx13mr25279915ejb.246.1595356141506; Tue, 21 Jul 2020 11:29:01 -0700 (PDT) Received: from localhost.localdomain ([178.233.178.9]) by smtp.gmail.com with ESMTPSA id q6sm16959454ejn.30.2020.07.21.11.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 11:29:00 -0700 (PDT) From: Alper Nebi Yasak To: Mark Brown Subject: [PATCH] ASoC: rk3399_gru_sound: Add DAPM pins, kcontrols for jack detection Date: Tue, 21 Jul 2020 21:27:10 +0300 Message-Id: <20200721182709.6895-1-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.28.0.rc1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_142903_585471_69228A97 X-CRM114-Status: GOOD ( 12.23 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [alpernebiyasak[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, Heiko Stuebner , Takashi Iwai , Liam Girdwood , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Alper Nebi Yasak , Jaroslav Kysela , linux-arm-kernel@lists.infradead.org Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org PulseAudio (and perhaps other userspace utilities) can not detect any jack for rk3399_gru_sound as the driver doesn't expose related Jack kcontrols. This patch adds two DAPM pins to the headset jack, where the snd_soc_card_jack_new() call automatically creates "Headphones Jack" and "Headset Mic Jack" kcontrols from them. With an appropriate ALSA UCM config specifying JackControl fields for the "Headphones" and "Headset" (mic) devices, PulseAudio can detect plug/unplug events for both of them after this patch. Signed-off-by: Alper Nebi Yasak --- sound/soc/rockchip/rk3399_gru_sound.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index f45e5aaa4b30..c17d146717a8 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c @@ -32,6 +32,19 @@ static unsigned int dmic_wakeup_delay; static struct snd_soc_jack rockchip_sound_jack; +/* Headset jack detection DAPM pins */ +static struct snd_soc_jack_pin rockchip_sound_jack_pins[] = { + { + .pin = "Headphones", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, + +}; + static const struct snd_soc_dapm_widget rockchip_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphones", NULL), SND_SOC_DAPM_SPK("Speakers", NULL), @@ -176,7 +189,9 @@ static int rockchip_sound_da7219_init(struct snd_soc_pcm_runtime *rtd) SND_JACK_HEADSET | SND_JACK_LINEOUT | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | SND_JACK_BTN_3, - &rockchip_sound_jack, NULL, 0); + &rockchip_sound_jack, + rockchip_sound_jack_pins, + ARRAY_SIZE(rockchip_sound_jack_pins)); if (ret) { dev_err(rtd->card->dev, "New Headset Jack failed! (%d)\n", ret);