From patchwork Wed May 17 11:15:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Wu X-Patchwork-Id: 683589 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2009AC7EE2A for ; Wed, 17 May 2023 11:30:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230187AbjEQLa6 (ORCPT ); Wed, 17 May 2023 07:30:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231336AbjEQLa5 (ORCPT ); Wed, 17 May 2023 07:30:57 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC2182D5D; Wed, 17 May 2023 04:30:55 -0700 (PDT) X-UUID: 2647466ef4a411ed9cb5633481061a41-20230517 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=r/ynvpD56p320B6BbN2gG/8wM3GbWN7STgUsQ5UpneI=; b=KqEQWkKtmfot8OezVMYGgucItJO8e+4KfTMamiTh2WRW7TFhhxEAw44vNmxTcKgpnMlE4Qj0Ai8LCVH3OEnmBjQ45rMvwPeqshoVb2IZ2GjIxt2tHQ+ROvaZxjrZ3XW95260edU5FuhIsXD5ueENhGQmbVQtjCnmOFbU2b5SBB0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25, REQID:de3a0acb-93cc-4bd6-a18b-ecb2235d5053, IP:0, U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:d5b0ae3, CLOUDID:8d7825c1-e32c-4c97-918d-fbb3fc224d4e, B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: 2647466ef4a411ed9cb5633481061a41-20230517 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 640718673; Wed, 17 May 2023 19:15:37 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 17 May 2023 19:15:36 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 17 May 2023 19:15:35 +0800 From: Trevor Wu To: , , , , , , , , CC: , , , , , Subject: [PATCH 2/5] ASoC: mediatek: mt8188-mt6359: register hdmi/dp jack pins Date: Wed, 17 May 2023 19:15:31 +0800 Message-ID: <20230517111534.32630-3-trevor.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230517111534.32630-1-trevor.wu@mediatek.com> References: <20230517111534.32630-1-trevor.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Some userspace applications need jack control events, so register hdmi and dp jack pins to activate jack control events. Signed-off-by: Trevor Wu --- sound/soc/mediatek/mt8188/mt8188-mt6359.c | 27 +++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/sound/soc/mediatek/mt8188/mt8188-mt6359.c b/sound/soc/mediatek/mt8188/mt8188-mt6359.c index 833bc362dad2..6c3f36e2fffd 100644 --- a/sound/soc/mediatek/mt8188/mt8188-mt6359.c +++ b/sound/soc/mediatek/mt8188/mt8188-mt6359.c @@ -151,6 +151,20 @@ struct mt8188_mt6359_priv { struct snd_soc_jack hdmi_jack; }; +static struct snd_soc_jack_pin mt8188_hdmi_jack_pins[] = { + { + .pin = "HDMI", + .mask = SND_JACK_LINEOUT, + }, +}; + +static struct snd_soc_jack_pin mt8188_dp_jack_pins[] = { + { + .pin = "DP", + .mask = SND_JACK_LINEOUT, + }, +}; + struct mt8188_card_data { const char *name; unsigned long quirk; @@ -159,6 +173,8 @@ struct mt8188_card_data { static const struct snd_soc_dapm_widget mt8188_mt6359_widgets[] = { SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_SINK("HDMI"), + SND_SOC_DAPM_SINK("DP"), }; static const struct snd_kcontrol_new mt8188_mt6359_controls[] = { @@ -396,8 +412,10 @@ static int mt8188_hdmi_codec_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; int ret = 0; - ret = snd_soc_card_jack_new(rtd->card, "HDMI Jack", SND_JACK_LINEOUT, - &priv->hdmi_jack); + ret = snd_soc_card_jack_new_pins(rtd->card, "HDMI Jack", + SND_JACK_LINEOUT, &priv->hdmi_jack, + mt8188_hdmi_jack_pins, + ARRAY_SIZE(mt8188_hdmi_jack_pins)); if (ret) { dev_info(rtd->dev, "%s, new jack failed: %d\n", __func__, ret); return ret; @@ -417,8 +435,9 @@ static int mt8188_dptx_codec_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; int ret = 0; - ret = snd_soc_card_jack_new(rtd->card, "DP Jack", SND_JACK_LINEOUT, - &priv->dp_jack); + ret = snd_soc_card_jack_new_pins(rtd->card, "DP Jack", SND_JACK_LINEOUT, + &priv->dp_jack, mt8188_dp_jack_pins, + ARRAY_SIZE(mt8188_dp_jack_pins)); if (ret) { dev_info(rtd->dev, "%s, new jack failed: %d\n", __func__, ret); return ret;