Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp268230rwb; Thu, 22 Sep 2022 17:58:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5H/QJX6ljou1UCIjeJ5Q92PFIqYRbXbvqO6eJnF2ERUDR7uwELNZbToJEBN8eUQWqxoTi5 X-Received: by 2002:a17:90b:3a8e:b0:200:78b2:d8d9 with SMTP id om14-20020a17090b3a8e00b0020078b2d8d9mr6851929pjb.152.1663894739102; Thu, 22 Sep 2022 17:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663894739; cv=none; d=google.com; s=arc-20160816; b=JGpLS3jBjbSn25huT4bihrIiu0Izi6xzJghtIw1AUG/V32vrGuregZ88UIu18TXXiT ZBannrxkEW9ThrbCXxESUDETtUe9QhAY+vdxIK5eEjKMXtKOxEw2OIsKZDlhs/AtZAnE PYZnwaxMJQd/5FkWHvBuwoDgRGhJ2Gmr/ponGToR+NzCVn5D7tGXWjoF/7BJifwaV3Sf MMP7uu5RCnmbXCgFF6xEqwjJbb3sn3LMxYu12Y2+0+saxakNbZPxSitQ0TvI1oRDomoz ckDNYAMEz+ZPVl0GS199gjt2AsG6l9qmUeN0n2yleav4jfiICWHw41oX/p5jqbzZksjQ YmOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tjXlq+UfHh9BRTH9qSENwd2hPgyXUVIwIE+7KdM09GA=; b=EeXbamEPS2IFb0mPl0QnFIT4Zes2E+oRr4fmENhOxc5LqFMOrcjPOFT8yAhRsPUldQ NQHQRRNUYc4XDqBMPY4mUzK2nmlU5ibxP7y1LrRNYpgt3G5GSSwC4wbpKV9LU1QgXurf SRh9yI+tRz11DQkAAHaMaYtsSTgHceCUUmsr46itjQQnxpuYJRi3Yhj1yoUJTZiL+tr+ ofLNGUrWZKit16SV7sCUsFZChCIEvKGSe7F1BUJTo61Cv/Se94nqvPFD66nHaRcdksm7 Xx34rfblW/Y0UAwh/j5XzTFoxy0RAsNtEGhsz6ntEoUeFie5BG1E0v04mfs329GqplCF HluQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=fXD++uf1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n66-20020a634045000000b0042af7555d10si7157408pga.862.2022.09.22.17.58.23; Thu, 22 Sep 2022 17:58:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=fXD++uf1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230155AbiIWAAV (ORCPT + 99 others); Thu, 22 Sep 2022 20:00:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229953AbiIWAAI (ORCPT ); Thu, 22 Sep 2022 20:00:08 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFC627E029 for ; Thu, 22 Sep 2022 17:00:06 -0700 (PDT) Received: from notapiano.myfiosgateway.com (unknown [71.190.76.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by madras.collabora.co.uk (Postfix) with ESMTPSA id F21C96602238; Fri, 23 Sep 2022 01:00:03 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1663891205; bh=ISOW3z3UoH6ajFB2isdB1bDkL2oaj2boZn5kSY9GOek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fXD++uf1S/DU/o3qgoQuzLEuPjsV/8hsGcGH6JPA8b0kISH6CZxN/3z2fpHs7EZSQ xxEF8xEIQdzaJAnQDGQ6YFRMteV0jGr+ITZ0pv0M5FSrDQz9mokez4g9pJnIlCe/fN f5x2amI/KWrPugmS0QoAP7NRckfVaWUfs4gKsWsXwbG0YOGbkwWOXB4IkmH5cpWtta ctaHvw2ONYX8+SjYLXxY876Ee5md+TzaxFAUb1A6JRblSvLusp/Ht7DBuuLsh9qi5P zrcosJqUwBx+2wdfVmmaJZ5m+wndV6Gsms+TmlclU4lZOzcbBbfznKezFNmxzbmFkI kxizSUPJb88dA== From: =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= To: Mark Brown Cc: AngeloGioacchino Del Regno , kernel@collabora.com, =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= , Jaroslav Kysela , Jiaxin Yu , Liam Girdwood , Matthias Brugger , Takashi Iwai , alsa-devel@alsa-project.org, "chunxu.li" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 4/6] ASoC: mediatek: mt8186-da7219: Expose individual headset jack pins Date: Thu, 22 Sep 2022 19:59:49 -0400 Message-Id: <20220922235951.252532-5-nfraprado@collabora.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220922235951.252532-1-nfraprado@collabora.com> References: <20220922235951.252532-1-nfraprado@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The da7219 codec is able to distinguish between two event types: headphone insertion/removal and headset microphone insertion/removal. However, currently, the mt8186-da7219 driver exposes a single kcontrol for the headset jack, so userspace isn't able to differentiate between the two events. Add a definition for the headset jack pins, so that a separate jack kcontrol is created for each one, allowing userspace to track and handle them individually. Signed-off-by: NĂ­colas F. R. A. Prado --- .../mt8186/mt8186-mt6366-da7219-max98357.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c b/sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c index 8d428bc4a3b2..cfca6bdee834 100644 --- a/sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c +++ b/sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c @@ -37,6 +37,18 @@ struct mt8186_mt6366_da7219_max98357_priv { struct snd_soc_jack headset_jack, hdmi_jack; }; +/* Headset jack detection DAPM pins */ +static struct snd_soc_jack_pin mt8186_jack_pins[] = { + { + .pin = "Headphones", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + static struct snd_soc_codec_conf mt8186_mt6366_da7219_max98357_codec_conf[] = { { .dlc = COMP_CODEC_CONF("mt6358-sound"), @@ -72,11 +84,12 @@ static int mt8186_da7219_init(struct snd_soc_pcm_runtime *rtd) } /* Enable Headset and 4 Buttons Jack detection */ - ret = snd_soc_card_jack_new(rtd->card, "Headset Jack", + ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack", SND_JACK_HEADSET | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | SND_JACK_BTN_3 | SND_JACK_LINEOUT, - jack); + jack, mt8186_jack_pins, + ARRAY_SIZE(mt8186_jack_pins)); if (ret) { dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret); return ret; -- 2.37.3