Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp275226rwb; Thu, 22 Sep 2022 18:05:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UaaPSH1Lqi+akf3SoOTAy53/dyDP6TUllRFEB4VBHbB91Eq7xMhroh3Fk1/ZA0GjZO8uH X-Received: by 2002:a17:903:41c3:b0:176:b990:6c28 with SMTP id u3-20020a17090341c300b00176b9906c28mr5914160ple.94.1663895104589; Thu, 22 Sep 2022 18:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663895104; cv=none; d=google.com; s=arc-20160816; b=wINMPRC22Z5brBzPJx94ft2PX4yVMfs6EcKLxpfLWL9Xbcsqdo0p4RxAkD1jBzCeNK qGcHchKwiAYUDm2fJmlYmeCSjps/ZJ3OD1wo7cuN0caniI8RAC8UMwSnP3tycWaihLye PaHeQ9kwhtZLIdpQ6A7skVGrsCI00Xse2Mn8H737Gb2EA/D1nhDwPdFH/VUajFffof2W KPDjYqr2/35kI3xYiWz5K4tVcTRypmCCGI7s6rO8FnsMv4+wogUJdZpVOSRLfCKI0R4Y TgGxJ7cNTdBFzVF1fpcxxG8G8+I1PYKXzkd/Silen5ygcqZ95wnwNv8QLT9M3atQjTE5 /KSw== 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=fYNDpw3ic2n8idvrx4ftm4zQEfT/iosDRX1xx0G8azw=; b=t6XxUYa259t6uZjgCPAaNh2+Q4u1xbxUoFeEeBq4qlLAsWHO/hgIS2OCHJ1dg2HMmj LQ5+PJz/09QD6a8bj/ERxOlnmuLasWRnRWANzCxmSjWiM+Z+uq+/0qu95yGnl8KDgGdf caDMdQfgCTfzhnSjSvzLjU9KVmLbHMiCrWCi85DY1fUjbvL7WJ6fFBh0ED8fvCTG+yAp b51Jods96IKiVmP25/xCN6eOWIUPzDCN9N32sZHKEqMuQj6T+tKYtJbYXW4YHkE33Orh TxHAU/X26AtvS3TlHjYPafMuEtV0yuyNWo/CXyJiM7rXmX3ZcTUdiA4PKuBedcSbvnRz ytrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=fRZ6ih9L; 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 r19-20020a63ce53000000b00439d86cf509si7329930pgi.645.2022.09.22.18.04.51; Thu, 22 Sep 2022 18:05:04 -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=fRZ6ih9L; 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 S230070AbiIWAAa (ORCPT + 99 others); Thu, 22 Sep 2022 20:00:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230092AbiIWAAR (ORCPT ); Thu, 22 Sep 2022 20:00:17 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 756ACB08AC for ; Thu, 22 Sep 2022 17:00:10 -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 AD38B660223D; Fri, 23 Sep 2022 01:00:07 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1663891209; bh=CvJeb17W9oXXmIkOz4RxpDIvAsD9k0w+VI709NtMMlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fRZ6ih9LwAkI0KXAq2usOAZaS/JKkOsXjNJQiqFL6MvMycujfmHoLhpRPnYIsAYUb JN6+jRUWFl3nd2BSqCi61le6PTkTpJdq9qR0W/D//oFkmgnLcCZNo8J7WyM/NtXs++ sBZgSR11QFLMmr/H0Ty30LBkVlDPPwzPKa4QuZG1nDaokWB6Od8pOG9nl8GuztcN0D FvSsKsTRm2nllEOk0Fd8dhqbQxwwyMpT+mqSVsQYe47tKBKSkWxWquq+PngTUcwKKW oW8RjISu/pOsqgy6A/vkJqRr5QQMd6EAZyC1KXhVc/ICDaQR5zh4hv/mh4gUghFOxj a/KU4vusoG6sQ== 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 6/6] ASoC: mediatek: mt8186-rt5682: Expose individual headset jack pins Date: Thu, 22 Sep 2022 19:59:51 -0400 Message-Id: <20220922235951.252532-7-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 rt5682 codec is able to distinguish between two event types: headphone insertion/removal and headset microphone insertion/removal. However, currently, the mt8186-rt5682 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-rt1019-rt5682s.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c b/sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c index 4360871bfc44..2414c5b77233 100644 --- a/sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c +++ b/sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c @@ -41,6 +41,18 @@ struct mt8186_mt6366_rt1019_rt5682s_priv { struct snd_soc_jack headset_jack, hdmi_jack; }; +/* Headset jack detection DAPM pins */ +static struct snd_soc_jack_pin mt8186_jack_pins[] = { + { + .pin = "Headphone", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + static struct snd_soc_codec_conf mt8186_mt6366_rt1019_rt5682s_codec_conf[] = { { .dlc = COMP_CODEC_CONF("mt6358-sound"), @@ -75,11 +87,12 @@ static int mt8186_rt5682s_init(struct snd_soc_pcm_runtime *rtd) return ret; } - 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, - 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